KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > share > configbean > customizers > LoginConfigEntry


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * LoginConfigEntry.java
21  *
22  * Created on December 12, 2003, 6:28 PM
23  */

24
25 package org.netbeans.modules.j2ee.sun.share.configbean.customizers;
26
27 import java.util.ResourceBundle JavaDoc;
28
29 import org.netbeans.modules.j2ee.sun.dd.api.CommonDDBean;
30 import org.netbeans.modules.j2ee.sun.dd.api.common.WebserviceEndpoint;
31 import org.netbeans.modules.j2ee.sun.dd.api.common.LoginConfig;
32
33 import org.netbeans.modules.j2ee.sun.share.configbean.ServletRef;
34 import org.netbeans.modules.j2ee.sun.share.configbean.StorageBeanFactory;
35 import org.netbeans.modules.j2ee.sun.share.configbean.customizers.common.GenericTableModel;
36
37
38 /**
39  *
40  * @author Peter Williams
41  */

42 public class LoginConfigEntry extends GenericTableModel.TableEntry {
43
44     private static final ResourceBundle JavaDoc customizerBundle = ResourceBundle.getBundle(
45         "org.netbeans.modules.j2ee.sun.share.configbean.customizers.Bundle"); // NOI18N
46

47     public LoginConfigEntry() {
48         super(WebserviceEndpoint.LOGIN_CONFIG, customizerBundle.getString("LBL_AuthenticationMethod")); // NOI18N
49
}
50
51     public Object JavaDoc getEntry(CommonDDBean parent) {
52         Object JavaDoc result = null;
53
54         CommonDDBean loginConfig = (CommonDDBean) parent.getValue(propertyName);
55         if(loginConfig != null) {
56             result = loginConfig.getValue(LoginConfig.AUTH_METHOD);
57         }
58
59         return result;
60     }
61
62     public void setEntry(CommonDDBean parent, Object JavaDoc value) {
63         // Set blank strings to null. This object also handles message-security-binding
64
// though, so we have to check it out.
65
if(value instanceof String JavaDoc && ((String JavaDoc) value).length() == 0) {
66             value = null;
67         }
68
69         LoginConfig lc = (LoginConfig) parent.getValue(WebserviceEndpoint.LOGIN_CONFIG);
70         if(value != null) {
71             if(lc == null) {
72                 WebserviceEndpoint endpoint = (WebserviceEndpoint) parent;
73                 lc = endpoint.newLoginConfig();
74                 parent.setValue(propertyName, lc);
75             }
76
77             lc.setValue(LoginConfig.AUTH_METHOD, value);
78         } else {
79             if(lc != null) {
80                 parent.setValue(WebserviceEndpoint.LOGIN_CONFIG, null);
81             }
82         }
83     }
84     
85     public Object JavaDoc getEntry(CommonDDBean parent, int row) {
86         throw new UnsupportedOperationException JavaDoc();
87     }
88     
89     public void setEntry(CommonDDBean parent, int row, Object JavaDoc value) {
90         throw new UnsupportedOperationException JavaDoc();
91     }
92     
93 }
94
Popular Tags