1 19 package org.netbeans.modules.j2ee.websphere6.dd.beans; 20 21 import org.w3c.dom.*; 22 import org.netbeans.modules.schema2beans.*; 23 import java.beans.*; 24 import java.util.*; 25 import java.io.*; 26 27 31 public class WSAppBnd extends DDXmi{ 32 33 private static final String ROOT=TYPE_APP_BND_ID; 34 private static final String ROOT_NAME="ApplicationBnd"; 35 36 37 38 public WSAppBnd() { 39 this(null, Common.USE_DEFAULT_VALUES); 40 } 41 public WSAppBnd(org.w3c.dom.Node doc, int options) { 42 this(Common.NO_DEFAULT_VALUES); 43 try { 44 initFromNode(doc, options); 45 } catch (Schema2BeansException e) { 46 throw new RuntimeException (e); 47 } 48 } 49 50 public WSAppBnd(int options) { 51 super(options,ROOT); 52 } 54 55 56 public WSAppBnd(File f,boolean validate) throws IOException{ 57 this(GraphManager.createXmlDocument(new FileInputStream(f), validate), Common.NO_DEFAULT_VALUES); 58 } 59 60 public WSAppBnd(InputStream in, boolean validate) { 61 this(GraphManager.createXmlDocument(in, validate), Common.NO_DEFAULT_VALUES); 62 } 63 64 protected void initFromNode(org.w3c.dom.Node doc, int options) throws Schema2BeansException { 65 if (doc == null) { 66 doc = GraphManager.createRootElementNode(ROOT); if (doc == null) 68 throw new Schema2BeansException(Common.getMessage( 69 "CantCreateDOMRoot_msg", ROOT)); 70 } 71 Node n = GraphManager.getElementNode(ROOT, doc); if (n == null) { 73 throw new Schema2BeansException(Common.getMessage("DocRootNotInDOMGraph_msg", ROOT, doc.getFirstChild().getNodeName())); 74 } 75 this.graphManager.setXmlDocument(doc); 76 this.createBean(n, this.graphManager()); 77 this.initialize(options); 78 }; 79 80 public void initialize(int options) { 81 } 82 83 84 public void setDefaults() { 85 setNsApp(); 86 setNsAppBnd(); 87 setNsCommon(); 88 setNsXmi(); 89 setNsXsi(); 90 setXmiId("Application_ID_Bnd"); 91 setAuthTable(new AuthorizationTableType()); 92 setAuthTableId(AUTH_TABLE+"_1"); 93 setApplication(""); 94 setApplicationHref("Application_ID"); 95 } 96 protected void initOptions(int options) { 97 this.graphManager = new GraphManager(this); 98 this.createRoot(ROOT, ROOT_NAME, 99 Common.TYPE_1 | Common.TYPE_BEAN, WSAppBnd.class); 100 101 this.createAttribute(XMI_ID_ID, XMI_ID,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 102 this.createAttribute(NS_APP_ID, NS_APP,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 103 this.createAttribute(NS_COMMON_ID, NS_COMMON,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 104 this.createAttribute(NS_APP_BND_ID,NS_APP_BND,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 105 this.createAttribute(NS_XMI_ID, NS_XMI,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 106 this.createAttribute(NS_XSI_ID, NS_XSI,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 107 this.createAttribute(XMI_VERSION_ID,XMI_VERSION,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 108 initPropertyTables(3); 110 111 this.createProperty(AUTH_TABLE_ID, 112 AUTH_TABLE, 113 Common.TYPE_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 114 AuthorizationTableType.class); 115 this.createAttribute(AUTH_TABLE,XMI_ID_ID,AUTH_TABLE_XMI_ID,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 116 117 this.createProperty(APPLICATION_ID, 118 APPLICATION, 119 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 120 java.lang.String .class); 121 this.createAttribute(APPLICATION,HREF_ID,APPLICATION_HREF,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 122 123 124 this.createProperty(RUN_AS_MAP_ID, 125 RUN_AS_MAP, 126 Common.TYPE_1 | Common.TYPE_STRING | Common.TYPE_KEY, 127 java.lang.String .class); 128 this.createAttribute(RUN_AS_MAP,XMI_ID_ID,RUN_AS_MAP_XMI_ID,AttrProp.CDATA | AttrProp.IMPLIED,null, null); 129 this.initialize(options); 130 } 131 132 public void setAuthTable(AuthorizationTableType value) { 133 this.setValue(AUTH_TABLE, value); 134 } 135 136 public AuthorizationTableType getAuthorizationTable() { 138 return (AuthorizationTableType)this.getValue(AUTH_TABLE); 139 } 140 public int sizeAuthorizationTable() { 141 return this.size(AUTH_TABLE); 142 } 143 144 public void setAuthTableId(String value) { 145 setAttributeValue(AUTH_TABLE,AUTH_TABLE_XMI_ID,value); 146 } 147 public String getAuthTableId(){ 148 return (String )getAttributeValue(AUTH_TABLE,AUTH_TABLE_XMI_ID); 149 } 150 151 public void setRunAsMapId(String value) { 152 if(getRunAsMap()==null) { 153 setRunAsMap(""); 154 } 155 setAttributeValue(RUN_AS_MAP,RUN_AS_MAP_XMI_ID,value); 156 } 157 public String getRunAsMapId(){ 158 if(getRunAsMap()==null) { 159 return null; 160 } 161 return (String )getAttributeValue(RUN_AS_MAP,RUN_AS_MAP_XMI_ID); 162 } 163 public void setRunAsMap(String value) { 164 setValue(RUN_AS_MAP,value); 165 } 166 public String getRunAsMap(){ 167 return (String )getValue(RUN_AS_MAP); 168 } 169 170 171 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 172 173 if (getAuthorizationTable()!= null) { 174 getAuthorizationTable().validate(); 175 } else { 176 throw new org.netbeans.modules.schema2beans.ValidateException("getAuthorizationTable() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, AUTH_TABLE, this); } 178 179 if (getApplication()== null) { 180 throw new org.netbeans.modules.schema2beans.ValidateException("getApplication() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, APPLICATION, this); } 182 if(getApplicationHref()==null) { 183 throw new org.netbeans.modules.schema2beans.ValidateException("getApplicationHref() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, APPLICATION, this); } 185 if(getNsApp()==null) { 186 throw new org.netbeans.modules.schema2beans.ValidateException("getNsApp() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, ROOT, this); } 188 if(getNsAppBnd()==null) { 189 throw new org.netbeans.modules.schema2beans.ValidateException("getNsAppBnd() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, ROOT, this); } 191 if(getNsCommon()==null) { 192 throw new org.netbeans.modules.schema2beans.ValidateException("getNsCommon() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, ROOT, this); } 194 if(getNsXmi()==null) { 195 throw new org.netbeans.modules.schema2beans.ValidateException("getNsXmi() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, ROOT, this); } 197 if(getAuthorizationTable()!=null) 198 if(getAuthTableId()==null) { 199 throw new org.netbeans.modules.schema2beans.ValidateException("getAuthTableId() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, AUTH_TABLE, this); } 201 if(getXmiId()==null) { 202 throw new org.netbeans.modules.schema2beans.ValidateException("getXmiId() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, ROOT, this); } 204 if(getXmiVersion()==null) { 205 throw new org.netbeans.modules.schema2beans.ValidateException("getXmiVersion() == null", org.netbeans.modules.schema2beans.ValidateException.FailureType.NULL_VALUE, ROOT, this); } 207 } 208 209 public void dump(StringBuffer str, String indent){ 210 String s; 211 Object o; 212 org.netbeans.modules.schema2beans.BaseBean n; 213 214 str.append(indent); 215 str.append(AUTH_TABLE); n = (org.netbeans.modules.schema2beans.BaseBean) this.getAuthorizationTable(); 217 if (n != null) 218 n.dump(str, indent + "\t"); else 220 str.append(indent+"\tnull"); this.dumpAttributes(AUTH_TABLE, 0, str, indent); 222 223 str.append(indent); 224 str.append(APPLICATION); str.append(indent+"\t"); str.append("<"); o = this.getApplication(); 228 str.append((o==null?"null":o.toString().trim())); str.append(">\n"); this.dumpAttributes(APPLICATION, 0, str, indent); 231 } 232 public String dumpBeanNode(){ 233 StringBuffer str = new StringBuffer (); 234 str.append(getClass().getName()); this.dump(str, "\n "); return str.toString(); 237 } 238 } 239 | Popular Tags |