1 178 179 package com.sun.enterprise.tools.common.dd.webapp; 180 181 import org.w3c.dom.*; 182 import org.netbeans.modules.schema2beans.*; 183 import java.beans.*; 184 import java.util.*; 185 import java.io.*; 186 import com.sun.enterprise.tools.common.dd.EjbRef; 187 import com.sun.enterprise.tools.common.dd.ResourceEnvRef; 188 import com.sun.enterprise.tools.common.dd.ResourceRef; 189 import com.sun.enterprise.tools.common.dd.ServiceRef; 190 import com.sun.enterprise.tools.common.dd.SecurityRoleMapping; 191 import com.sun.enterprise.tools.common.dd.MessageDestination; 192 import com.sun.enterprise.tools.common.dd.WebserviceDescription; 193 194 196 public class SunWebApp extends com.sun.enterprise.tools.common.dd.SunBaseBean 197 { 198 199 static Vector comparators = new Vector(); 200 201 static public final String ERRORURL = "ErrorUrl"; static public final String CONTEXT_ROOT = "ContextRoot"; static public final String SECURITY_ROLE_MAPPING = "SecurityRoleMapping"; static public final String SERVLET = "Servlet"; static public final String IDEMPOTENT_URL_PATTERN = "IdempotentUrlPattern"; static public final String IDEMPOTENTURLPATTERNURLPATTERN = "IdempotentUrlPatternUrlPattern"; static public final String IDEMPOTENTURLPATTERNNUMOFRETRIES = "IdempotentUrlPatternNumOfRetries"; static public final String SESSION_CONFIG = "SessionConfig"; static public final String EJB_REF = "EjbRef"; static public final String RESOURCE_REF = "ResourceRef"; static public final String RESOURCE_ENV_REF = "ResourceEnvRef"; static public final String SERVICE_REF = "ServiceRef"; static public final String CACHE = "Cache"; static public final String CLASS_LOADER = "ClassLoader"; static public final String JSP_CONFIG = "JspConfig"; static public final String LOCALE_CHARSET_INFO = "LocaleCharsetInfo"; static public final String PARAMETER_ENCODING = "ParameterEncoding"; static public final String PARAMETERENCODINGFORMHINTFIELD = "ParameterEncodingFormHintField"; static public final String PARAMETERENCODINGDEFAULTCHARSET = "ParameterEncodingDefaultCharset"; static public final String PROPERTY = "WebProperty"; static public final String MESSAGE_DESTINATION = "MessageDestination"; static public final String WEBSERVICE_DESCRIPTION = "WebserviceDescription"; 224 public SunWebApp() throws org.netbeans.modules.schema2beans.Schema2BeansException { 225 this(null, Common.USE_DEFAULT_VALUES); 226 } 227 228 public SunWebApp(org.w3c.dom.Node doc, int options) throws org.netbeans.modules.schema2beans.Schema2BeansException { 229 this(Common.NO_DEFAULT_VALUES); 230 initFromNode(doc, options); 231 } 232 protected void initFromNode(org.w3c.dom.Node doc, int options) throws Schema2BeansException 233 { 234 if (doc == null) 235 { 236 doc = GraphManager.createRootElementNode("sun-web-app"); if (doc == null) 238 throw new Schema2BeansException(Common.getMessage( 239 "CantCreateDOMRoot_msg", "sun-web-app")); 240 } 241 Node n = GraphManager.getElementNode("sun-web-app", doc); if (n == null) 243 throw new Schema2BeansException(Common.getMessage( 244 "DocRootNotInDOMGraph_msg", "sun-web-app", doc.getFirstChild().getNodeName())); 245 246 this.graphManager.setXmlDocument(doc); 247 248 this.createBean(n, this.graphManager()); 250 this.initialize(options); 251 } 252 public SunWebApp(int options) 253 { 254 super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 255 initOptions(options); 256 } 257 protected void initOptions(int options) 258 { 259 this.graphManager = new GraphManager(this); 261 this.createRoot("sun-web-app", "SunWebApp", Common.TYPE_1 | Common.TYPE_BEAN, SunWebApp.class); 263 264 this.createProperty("context-root", CONTEXT_ROOT, 267 Common.TYPE_0_1 | Common.TYPE_STRING | Common.TYPE_KEY, 268 String .class); 269 this.createProperty("security-role-mapping", SECURITY_ROLE_MAPPING, 271 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 272 SecurityRoleMapping.class); 273 this.createProperty("servlet", SERVLET, 275 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 276 Servlet.class); 277 this.createProperty("idempotent-url-pattern", IDEMPOTENT_URL_PATTERN, 279 Common.TYPE_0_N | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 280 Boolean .class); 281 this.createAttribute(IDEMPOTENT_URL_PATTERN, "url-pattern", "UrlPattern", 282 AttrProp.CDATA | AttrProp.REQUIRED, 283 null, null); 284 this.createAttribute(IDEMPOTENT_URL_PATTERN, "num-of-retries", "NumOfRetries", 285 AttrProp.CDATA, 286 null, "-1"); 287 this.createProperty("session-config", SESSION_CONFIG, 289 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 290 SessionConfig.class); 291 this.createProperty("ejb-ref", EJB_REF, 293 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 294 EjbRef.class); 295 this.createProperty("resource-ref", RESOURCE_REF, 297 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 298 ResourceRef.class); 299 this.createProperty("resource-env-ref", RESOURCE_ENV_REF, 301 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 302 ResourceEnvRef.class); 303 this.createProperty("service-ref", SERVICE_REF, 305 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 306 ServiceRef.class); 307 this.createProperty("cache", CACHE, 309 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 310 Cache.class); 311 this.createAttribute(CACHE, "max-entries", "MaxEntries", 312 AttrProp.CDATA, 313 null, "4096"); 314 this.createAttribute(CACHE, "timeout-in-seconds", "TimeoutInSeconds", 315 AttrProp.CDATA, 316 null, "30"); 317 this.createAttribute(CACHE, "enabled", "Enabled", 318 AttrProp.CDATA, 319 null, "true"); 320 this.createProperty("class-loader", CLASS_LOADER, 322 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 323 ClassLoader .class); 324 this.createAttribute(CLASS_LOADER, "extra-class-path", "ExtraClassPath", 325 AttrProp.CDATA | AttrProp.IMPLIED, 326 null, null); 327 this.createAttribute(CLASS_LOADER, "delegate", "Delegate", 328 AttrProp.CDATA, 329 null, "true"); 330 this.createAttribute(CLASS_LOADER, "dynamic-reload-interval", "DynamicReloadInterval", 331 AttrProp.CDATA | AttrProp.IMPLIED, 332 null, null); 333 this.createProperty("jsp-config", JSP_CONFIG, 335 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 336 JspConfig.class); 337 this.createProperty("locale-charset-info", LOCALE_CHARSET_INFO, 339 Common.TYPE_0_1 | Common.TYPE_BEAN | Common.TYPE_KEY, 340 LocaleCharsetInfo.class); 341 this.createAttribute(LOCALE_CHARSET_INFO, "default-locale", "DefaultLocale", 342 AttrProp.CDATA | AttrProp.IMPLIED, 343 null, null); 344 this.createProperty("parameter-encoding", PARAMETER_ENCODING, 346 Common.TYPE_0_1 | Common.TYPE_BOOLEAN | Common.TYPE_KEY, 347 Boolean .class); 348 this.createAttribute(PARAMETER_ENCODING, "form-hint-field", "FormHintField", 349 AttrProp.CDATA | AttrProp.IMPLIED, 350 null, null); 351 this.createAttribute(PARAMETER_ENCODING, "default-charset", "DefaultCharset", 352 AttrProp.CDATA | AttrProp.IMPLIED, 353 null, null); 354 this.createProperty("property", PROPERTY, 356 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 357 WebProperty.class); 358 this.createAttribute(PROPERTY, "name", "Name", 359 AttrProp.CDATA | AttrProp.REQUIRED, 360 null, null); 361 this.createAttribute(PROPERTY, "value", "Value", 362 AttrProp.CDATA | AttrProp.REQUIRED, 363 null, null); 364 this.createProperty("message-destination", MESSAGE_DESTINATION, 366 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 367 MessageDestination.class); 368 this.createProperty("webservice-description", WEBSERVICE_DESCRIPTION, 370 Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 371 WebserviceDescription.class); 372 this.createAttribute("error-url", "ErrorUrl", 373 AttrProp.CDATA, 374 null, ""); 375 this.initialize(options); 376 } 377 378 void initialize(int options) 380 { 381 382 } 383 384 public void setErrorUrl(java.lang.String value) { 386 setAttributeValue(ERRORURL, value); 387 } 388 389 public java.lang.String getErrorUrl() { 391 return getAttributeValue(ERRORURL); 392 } 393 394 public void setContextRoot(String value) { 396 this.setValue(CONTEXT_ROOT, value); 397 } 398 399 public String getContextRoot() { 401 return (String )this.getValue(CONTEXT_ROOT); 402 } 403 404 public void setSecurityRoleMapping(int index, SecurityRoleMapping value) { 406 this.setValue(SECURITY_ROLE_MAPPING, index, value); 407 } 408 409 public SecurityRoleMapping getSecurityRoleMapping(int index) { 411 return (SecurityRoleMapping)this.getValue(SECURITY_ROLE_MAPPING, index); 412 } 413 414 public void setSecurityRoleMapping(SecurityRoleMapping[] value) { 416 this.setValue(SECURITY_ROLE_MAPPING, value); 417 } 418 419 public SecurityRoleMapping[] getSecurityRoleMapping() { 421 return (SecurityRoleMapping[])this.getValues(SECURITY_ROLE_MAPPING); 422 } 423 424 public int sizeSecurityRoleMapping() { 426 return this.size(SECURITY_ROLE_MAPPING); 427 } 428 429 public int addSecurityRoleMapping(SecurityRoleMapping value) { 431 return this.addValue(SECURITY_ROLE_MAPPING, value); 432 } 433 434 public int removeSecurityRoleMapping(SecurityRoleMapping value) { 439 return this.removeValue(SECURITY_ROLE_MAPPING, value); 440 } 441 442 public void setServlet(int index, Servlet value) { 444 this.setValue(SERVLET, index, value); 445 } 446 447 public Servlet getServlet(int index) { 449 return (Servlet)this.getValue(SERVLET, index); 450 } 451 452 public void setServlet(Servlet[] value) { 454 this.setValue(SERVLET, value); 455 } 456 457 public Servlet[] getServlet() { 459 return (Servlet[])this.getValues(SERVLET); 460 } 461 462 public int sizeServlet() { 464 return this.size(SERVLET); 465 } 466 467 public int addServlet(com.sun.enterprise.tools.common.dd.webapp.Servlet value) { 469 return this.addValue(SERVLET, value); 470 } 471 472 public int removeServlet(com.sun.enterprise.tools.common.dd.webapp.Servlet value) { 477 return this.removeValue(SERVLET, value); 478 } 479 480 public void setIdempotentUrlPattern(int index, boolean value) { 482 this.setValue(IDEMPOTENT_URL_PATTERN, index, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 483 } 484 485 public boolean isIdempotentUrlPattern(int index) { 487 Boolean ret = (Boolean )this.getValue(IDEMPOTENT_URL_PATTERN, index); 488 if (ret == null) 489 ret = (Boolean )Common.defaultScalarValue(Common.TYPE_BOOLEAN); 490 return ((java.lang.Boolean )ret).booleanValue(); 491 } 492 493 public void setIdempotentUrlPattern(boolean[] value) { 495 Boolean [] values = null; 496 if (value != null) 497 { 498 values = new Boolean [value.length]; 499 for (int i=0; i<value.length; i++) 500 values[i] = new Boolean (value[i]); 501 } 502 this.setValue(IDEMPOTENT_URL_PATTERN, values); 503 } 504 505 public boolean[] getIdempotentUrlPattern() { 507 boolean[] ret = null; 508 Boolean [] values = (Boolean [])this.getValues(IDEMPOTENT_URL_PATTERN); 509 if (values != null) 510 { 511 ret = new boolean[values.length]; 512 for (int i=0; i<values.length; i++) 513 ret[i] = values[i].booleanValue(); 514 } 515 return ret; 516 } 517 518 public int sizeIdempotentUrlPattern() { 520 return this.size(IDEMPOTENT_URL_PATTERN); 521 } 522 523 public int addIdempotentUrlPattern(boolean value) { 525 return this.addValue(IDEMPOTENT_URL_PATTERN, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 526 } 527 528 public int removeIdempotentUrlPattern(boolean value) { 533 return this.removeValue(IDEMPOTENT_URL_PATTERN, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 534 } 535 536 public void removeIdempotentUrlPattern(int index) { 540 this.removeValue(IDEMPOTENT_URL_PATTERN, index); 541 } 542 543 public void setIdempotentUrlPatternUrlPattern(int index, java.lang.String value) { 545 if (size(IDEMPOTENT_URL_PATTERN) == 0) { 547 addValue(IDEMPOTENT_URL_PATTERN, ""); 548 } 549 setAttributeValue(IDEMPOTENT_URL_PATTERN, index, "UrlPattern", value); 550 } 551 552 public java.lang.String getIdempotentUrlPatternUrlPattern(int index) { 554 if (size(IDEMPOTENT_URL_PATTERN) == 0) { 556 return null; 557 } else { 558 return getAttributeValue(IDEMPOTENT_URL_PATTERN, index, "UrlPattern"); 559 } 560 } 561 562 public void setIdempotentUrlPatternNumOfRetries(int index, java.lang.String value) { 564 if (size(IDEMPOTENT_URL_PATTERN) == 0) { 566 addValue(IDEMPOTENT_URL_PATTERN, ""); 567 } 568 setAttributeValue(IDEMPOTENT_URL_PATTERN, index, "NumOfRetries", value); 569 } 570 571 public java.lang.String getIdempotentUrlPatternNumOfRetries(int index) { 573 if (size(IDEMPOTENT_URL_PATTERN) == 0) { 575 return null; 576 } else { 577 return getAttributeValue(IDEMPOTENT_URL_PATTERN, index, "NumOfRetries"); 578 } 579 } 580 581 public void setSessionConfig(SessionConfig value) { 583 this.setValue(SESSION_CONFIG, value); 584 } 585 586 public SessionConfig getSessionConfig() { 588 return (SessionConfig)this.getValue(SESSION_CONFIG); 589 } 590 591 public void setEjbRef(int index, EjbRef value) { 593 this.setValue(EJB_REF, index, value); 594 } 595 596 public EjbRef getEjbRef(int index) { 598 return (EjbRef)this.getValue(EJB_REF, index); 599 } 600 601 public void setEjbRef(EjbRef[] value) { 603 this.setValue(EJB_REF, value); 604 } 605 606 public EjbRef[] getEjbRef() { 608 return (EjbRef[])this.getValues(EJB_REF); 609 } 610 611 public int sizeEjbRef() { 613 return this.size(EJB_REF); 614 } 615 616 public int addEjbRef(EjbRef value) { 618 return this.addValue(EJB_REF, value); 619 } 620 621 public int removeEjbRef(EjbRef value) { 626 return this.removeValue(EJB_REF, value); 627 } 628 629 public void setResourceRef(int index, ResourceRef value) { 631 this.setValue(RESOURCE_REF, index, value); 632 } 633 634 public ResourceRef getResourceRef(int index) { 636 return (ResourceRef)this.getValue(RESOURCE_REF, index); 637 } 638 639 public void setResourceRef(ResourceRef[] value) { 641 this.setValue(RESOURCE_REF, value); 642 } 643 644 public ResourceRef[] getResourceRef() { 646 return (ResourceRef[])this.getValues(RESOURCE_REF); 647 } 648 649 public int sizeResourceRef() { 651 return this.size(RESOURCE_REF); 652 } 653 654 public int addResourceRef(ResourceRef value) { 656 return this.addValue(RESOURCE_REF, value); 657 } 658 659 public int removeResourceRef(ResourceRef value) { 664 return this.removeValue(RESOURCE_REF, value); 665 } 666 667 public void setResourceEnvRef(int index, ResourceEnvRef value) { 669 this.setValue(RESOURCE_ENV_REF, index, value); 670 } 671 672 public ResourceEnvRef getResourceEnvRef(int index) { 674 return (ResourceEnvRef)this.getValue(RESOURCE_ENV_REF, index); 675 } 676 677 public void setResourceEnvRef(ResourceEnvRef[] value) { 679 this.setValue(RESOURCE_ENV_REF, value); 680 } 681 682 public ResourceEnvRef[] getResourceEnvRef() { 684 return (ResourceEnvRef[])this.getValues(RESOURCE_ENV_REF); 685 } 686 687 public int sizeResourceEnvRef() { 689 return this.size(RESOURCE_ENV_REF); 690 } 691 692 public int addResourceEnvRef(ResourceEnvRef value) { 694 return this.addValue(RESOURCE_ENV_REF, value); 695 } 696 697 public int removeResourceEnvRef(ResourceEnvRef value) { 702 return this.removeValue(RESOURCE_ENV_REF, value); 703 } 704 705 public void setServiceRef(int index, ServiceRef value) { 707 this.setValue(SERVICE_REF, index, value); 708 } 709 710 public ServiceRef getServiceRef(int index) { 712 return (ServiceRef)this.getValue(SERVICE_REF, index); 713 } 714 715 public void setServiceRef(ServiceRef[] value) { 717 this.setValue(SERVICE_REF, value); 718 } 719 720 public ServiceRef[] getServiceRef() { 722 return (ServiceRef[])this.getValues(SERVICE_REF); 723 } 724 725 public int sizeServiceRef() { 727 return this.size(SERVICE_REF); 728 } 729 730 public int addServiceRef(ServiceRef value) { 732 return this.addValue(SERVICE_REF, value); 733 } 734 735 public int removeServiceRef(ServiceRef value) { 740 return this.removeValue(SERVICE_REF, value); 741 } 742 743 public void setCache(Cache value) { 745 this.setValue(CACHE, value); 746 } 747 748 public Cache getCache() { 750 return (Cache)this.getValue(CACHE); 751 } 752 753 public void setClassLoader(ClassLoader value) { 755 this.setValue(CLASS_LOADER, value); 756 } 757 758 public ClassLoader getClassLoader() { 760 return (ClassLoader )this.getValue(CLASS_LOADER); 761 } 762 763 public void setJspConfig(JspConfig value) { 765 this.setValue(JSP_CONFIG, value); 766 } 767 768 public JspConfig getJspConfig() { 770 return (JspConfig)this.getValue(JSP_CONFIG); 771 } 772 773 public void setLocaleCharsetInfo(LocaleCharsetInfo value) { 775 this.setValue(LOCALE_CHARSET_INFO, value); 776 } 777 778 public LocaleCharsetInfo getLocaleCharsetInfo() { 780 return (LocaleCharsetInfo)this.getValue(LOCALE_CHARSET_INFO); 781 } 782 783 public void setParameterEncoding(boolean value) { 785 this.setValue(PARAMETER_ENCODING, (value ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE)); 786 } 787 788 public boolean isParameterEncoding() { 790 Boolean ret = (Boolean )this.getValue(PARAMETER_ENCODING); 791 if (ret == null) 792 ret = (Boolean )Common.defaultScalarValue(Common.TYPE_BOOLEAN); 793 return ((java.lang.Boolean )ret).booleanValue(); 794 } 795 796 public void setParameterEncodingFormHintField(java.lang.String value) { 798 if (size(PARAMETER_ENCODING) == 0) { 800 setValue(PARAMETER_ENCODING, ""); 801 } 802 setAttributeValue(PARAMETER_ENCODING, "FormHintField", value); 803 } 804 805 public java.lang.String getParameterEncodingFormHintField() { 807 if (size(PARAMETER_ENCODING) == 0) { 809 return null; 810 } else { 811 return getAttributeValue(PARAMETER_ENCODING, "FormHintField"); 812 } 813 } 814 815 public void setParameterEncodingDefaultCharset(java.lang.String value) { 817 if (size(PARAMETER_ENCODING) == 0) { 819 setValue(PARAMETER_ENCODING, ""); 820 } 821 setAttributeValue(PARAMETER_ENCODING, "DefaultCharset", value); 822 } 823 824 public java.lang.String getParameterEncodingDefaultCharset() { 826 if (size(PARAMETER_ENCODING) == 0) { 828 return null; 829 } else { 830 return getAttributeValue(PARAMETER_ENCODING, "DefaultCharset"); 831 } 832 } 833 834 public void setWebProperty(int index, WebProperty value) { 836 this.setValue(PROPERTY, index, value); 837 } 838 839 public WebProperty getWebProperty(int index) { 841 return (WebProperty)this.getValue(PROPERTY, index); 842 } 843 844 public void setWebProperty(WebProperty[] value) { 846 this.setValue(PROPERTY, value); 847 } 848 849 public WebProperty[] getWebProperty() { 851 return (WebProperty[])this.getValues(PROPERTY); 852 } 853 854 public int sizeWebProperty() { 856 return this.size(PROPERTY); 857 } 858 859 public int addWebProperty(com.sun.enterprise.tools.common.dd.webapp.WebProperty value) { 861 return this.addValue(PROPERTY, value); 862 } 863 864 public int removeWebProperty(com.sun.enterprise.tools.common.dd.webapp.WebProperty value) { 869 return this.removeValue(PROPERTY, value); 870 } 871 872 public void setMessageDestination(int index, MessageDestination value) { 874 this.setValue(MESSAGE_DESTINATION, index, value); 875 } 876 877 public MessageDestination getMessageDestination(int index) { 879 return (MessageDestination)this.getValue(MESSAGE_DESTINATION, index); 880 } 881 882 public void setMessageDestination(MessageDestination[] value) { 884 this.setValue(MESSAGE_DESTINATION, value); 885 } 886 887 public MessageDestination[] getMessageDestination() { 889 return (MessageDestination[])this.getValues(MESSAGE_DESTINATION); 890 } 891 892 public int sizeMessageDestination() { 894 return this.size(MESSAGE_DESTINATION); 895 } 896 897 public int addMessageDestination(MessageDestination value) { 899 return this.addValue(MESSAGE_DESTINATION, value); 900 } 901 902 public int removeMessageDestination(MessageDestination value) { 907 return this.removeValue(MESSAGE_DESTINATION, value); 908 } 909 910 public void setWebserviceDescription(int index, WebserviceDescription value) { 912 this.setValue(WEBSERVICE_DESCRIPTION, index, value); 913 } 914 915 public WebserviceDescription getWebserviceDescription(int index) { 917 return (WebserviceDescription)this.getValue(WEBSERVICE_DESCRIPTION, index); 918 } 919 920 public void setWebserviceDescription(WebserviceDescription[] value) { 922 this.setValue(WEBSERVICE_DESCRIPTION, value); 923 } 924 925 public WebserviceDescription[] getWebserviceDescription() { 927 return (WebserviceDescription[])this.getValues(WEBSERVICE_DESCRIPTION); 928 } 929 930 public int sizeWebserviceDescription() { 932 return this.size(WEBSERVICE_DESCRIPTION); 933 } 934 935 public int addWebserviceDescription(WebserviceDescription value) { 937 return this.addValue(WEBSERVICE_DESCRIPTION, value); 938 } 939 940 public int removeWebserviceDescription(WebserviceDescription value) { 945 return this.removeValue(WEBSERVICE_DESCRIPTION, value); 946 } 947 948 public static void addComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 950 comparators.add(c); 951 } 952 953 public static void removeComparator(org.netbeans.modules.schema2beans.BeanComparator c) { 955 comparators.remove(c); 956 } 957 public static SunWebApp createGraph(org.w3c.dom.Node doc) throws org.netbeans.modules.schema2beans.Schema2BeansException { 962 return new SunWebApp(doc, Common.NO_DEFAULT_VALUES); 963 } 964 965 public static SunWebApp createGraph(java.io.InputStream in) throws org.netbeans.modules.schema2beans.Schema2BeansException { 966 return createGraph(in, false); 967 } 968 969 public static SunWebApp createGraph(java.io.InputStream in, boolean validate) throws org.netbeans.modules.schema2beans.Schema2BeansException { 970 Document doc = GraphManager.createXmlDocument(in, validate); 971 return createGraph(doc); 972 } 973 974 public static SunWebApp createGraph() { 978 try { 979 return new SunWebApp(); 980 } 981 catch (Schema2BeansException e) { 982 throw new RuntimeException (e.getMessage()); 983 } 984 } 985 986 public void validate() throws org.netbeans.modules.schema2beans.ValidateException { 987 boolean restrictionFailure = false; 988 if (getErrorUrl() == null) { 990 throw new org.netbeans.modules.schema2beans.ValidateException("getErrorUrl() == null", "errorUrl", this); } 992 if (getContextRoot() != null) { 994 } 995 for (int _index = 0; _index < sizeSecurityRoleMapping(); ++_index) { 997 SecurityRoleMapping element = getSecurityRoleMapping(_index); 998 if (element != null) { 999 element.validate(); 1000 } 1001 } 1002 for (int _index = 0; _index < sizeServlet(); ++_index) { 1004 com.sun.enterprise.tools.common.dd.webapp.Servlet element = getServlet(_index); 1005 if (element != null) { 1006 element.validate(); 1007 } 1008 } 1009 for (int _index = 0; _index < sizeIdempotentUrlPattern(); 1011 ++_index) { 1012 boolean element = isIdempotentUrlPattern(_index); 1013 } 1014 if (getSessionConfig() != null) { 1018 getSessionConfig().validate(); 1019 } 1020 for (int _index = 0; _index < sizeEjbRef(); ++_index) { 1022 EjbRef element = getEjbRef(_index); 1023 if (element != null) { 1024 element.validate(); 1025 } 1026 } 1027 for (int _index = 0; _index < sizeResourceRef(); ++_index) { 1029 ResourceRef element = getResourceRef(_index); 1030 if (element != null) { 1031 element.validate(); 1032 } 1033 } 1034 for (int _index = 0; _index < sizeResourceEnvRef(); ++_index) { 1036 ResourceEnvRef element = getResourceEnvRef(_index); 1037 if (element != null) { 1038 element.validate(); 1039 } 1040 } 1041 for (int _index = 0; _index < sizeServiceRef(); ++_index) { 1043 ServiceRef element = getServiceRef(_index); 1044 if (element != null) { 1045 element.validate(); 1046 } 1047 } 1048 if (getCache() != null) { 1050 getCache().validate(); 1051 } 1052 if (getClassLoader() != null) { 1054 getClassLoader().validate(); 1055 } 1056 if (getJspConfig() != null) { 1058 getJspConfig().validate(); 1059 } 1060 if (getLocaleCharsetInfo() != null) { 1062 getLocaleCharsetInfo().validate(); 1063 } 1064 if (getParameterEncodingFormHintField() != null) { 1067 } 1068 if (getParameterEncodingDefaultCharset() != null) { 1070 } 1071 for (int _index = 0; _index < sizeWebProperty(); ++_index) { 1073 com.sun.enterprise.tools.common.dd.webapp.WebProperty element = getWebProperty(_index); 1074 if (element != null) { 1075 element.validate(); 1076 } 1077 } 1078 for (int _index = 0; _index < sizeMessageDestination(); ++_index) { 1080 MessageDestination element = getMessageDestination(_index); 1081 if (element != null) { 1082 element.validate(); 1083 } 1084 } 1085 for (int _index = 0; _index < sizeWebserviceDescription(); 1087 ++_index) { 1088 WebserviceDescription element = getWebserviceDescription(_index); 1089 if (element != null) { 1090 element.validate(); 1091 } 1092 } 1093 } 1094 1095 private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { 1097 ByteArrayOutputStream baos = new ByteArrayOutputStream(); 1098 write(baos); 1099 String str = baos.toString();; 1100 out.writeUTF(str); 1102 } 1103 private void readObject(java.io.ObjectInputStream in) throws java.io.IOException , ClassNotFoundException { 1105 try{ 1106 init(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0)); 1107 String strDocument = in.readUTF(); 1108 ByteArrayInputStream bais = new ByteArrayInputStream(strDocument.getBytes()); 1110 Document doc = GraphManager.createXmlDocument(bais, false); 1111 initOptions(Common.NO_DEFAULT_VALUES); 1112 initFromNode(doc, Common.NO_DEFAULT_VALUES); 1113 } 1114 catch (Schema2BeansException e) { 1115 e.printStackTrace(); 1116 throw new RuntimeException (e.getMessage()); 1117 } 1118 } 1119 1120 public void dump(StringBuffer str, String indent){ 1122 String s; 1123 Object o; 1124 org.netbeans.modules.schema2beans.BaseBean n; 1125 str.append(indent); 1126 str.append("ContextRoot"); str.append(indent+"\t"); str.append("<"); s = this.getContextRoot(); 1130 str.append((s==null?"null":s.trim())); str.append(">\n"); this.dumpAttributes(CONTEXT_ROOT, 0, str, indent); 1133 1134 str.append(indent); 1135 str.append("SecurityRoleMapping["+this.sizeSecurityRoleMapping()+"]"); for(int i=0; i<this.sizeSecurityRoleMapping(); i++) 1137 { 1138 str.append(indent+"\t"); 1139 str.append("#"+i+":"); 1140 n = (org.netbeans.modules.schema2beans.BaseBean) this.getSecurityRoleMapping(i); 1141 if (n != null) 1142 n.dump(str, indent + "\t"); else 1144 str.append(indent+"\tnull"); this.dumpAttributes(SECURITY_ROLE_MAPPING, i, str, indent); 1146 } 1147 1148 str.append(indent); 1149 str.append("Servlet["+this.sizeServlet()+"]"); for(int i=0; i<this.sizeServlet(); i++) 1151 { 1152 str.append(indent+"\t"); 1153 str.append("#"+i+":"); 1154 n = (org.netbeans.modules.schema2beans.BaseBean) this.getServlet(i); 1155 if (n != null) 1156 n.dump(str, indent + "\t"); else 1158 str.append(indent+"\tnull"); this.dumpAttributes(SERVLET, i, str, indent); 1160 } 1161 1162 str.append(indent); 1163 str.append("IdempotentUrlPattern["+this.sizeIdempotentUrlPattern()+"]"); for(int i=0; i<this.sizeIdempotentUrlPattern(); i++) 1165 { 1166 str.append(indent+"\t"); 1167 str.append("#"+i+":"); 1168 str.append(indent+"\t"); str.append((this.isIdempotentUrlPattern(i)?"true":"false")); 1170 this.dumpAttributes(IDEMPOTENT_URL_PATTERN, i, str, indent); 1171 } 1172 1173 str.append(indent); 1174 str.append("SessionConfig"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getSessionConfig(); 1176 if (n != null) 1177 n.dump(str, indent + "\t"); else 1179 str.append(indent+"\tnull"); this.dumpAttributes(SESSION_CONFIG, 0, str, indent); 1181 1182 str.append(indent); 1183 str.append("EjbRef["+this.sizeEjbRef()+"]"); for(int i=0; i<this.sizeEjbRef(); i++) 1185 { 1186 str.append(indent+"\t"); 1187 str.append("#"+i+":"); 1188 n = (org.netbeans.modules.schema2beans.BaseBean) this.getEjbRef(i); 1189 if (n != null) 1190 n.dump(str, indent + "\t"); else 1192 str.append(indent+"\tnull"); this.dumpAttributes(EJB_REF, i, str, indent); 1194 } 1195 1196 str.append(indent); 1197 str.append("ResourceRef["+this.sizeResourceRef()+"]"); for(int i=0; i<this.sizeResourceRef(); i++) 1199 { 1200 str.append(indent+"\t"); 1201 str.append("#"+i+":"); 1202 n = (org.netbeans.modules.schema2beans.BaseBean) this.getResourceRef(i); 1203 if (n != null) 1204 n.dump(str, indent + "\t"); else 1206 str.append(indent+"\tnull"); this.dumpAttributes(RESOURCE_REF, i, str, indent); 1208 } 1209 1210 str.append(indent); 1211 str.append("ResourceEnvRef["+this.sizeResourceEnvRef()+"]"); for(int i=0; i<this.sizeResourceEnvRef(); i++) 1213 { 1214 str.append(indent+"\t"); 1215 str.append("#"+i+":"); 1216 n = (org.netbeans.modules.schema2beans.BaseBean) this.getResourceEnvRef(i); 1217 if (n != null) 1218 n.dump(str, indent + "\t"); else 1220 str.append(indent+"\tnull"); this.dumpAttributes(RESOURCE_ENV_REF, i, str, indent); 1222 } 1223 1224 str.append(indent); 1225 str.append("ServiceRef["+this.sizeServiceRef()+"]"); for(int i=0; i<this.sizeServiceRef(); i++) 1227 { 1228 str.append(indent+"\t"); 1229 str.append("#"+i+":"); 1230 n = (org.netbeans.modules.schema2beans.BaseBean) this.getServiceRef(i); 1231 if (n != null) 1232 n.dump(str, indent + "\t"); else 1234 str.append(indent+"\tnull"); this.dumpAttributes(SERVICE_REF, i, str, indent); 1236 } 1237 1238 str.append(indent); 1239 str.append("Cache"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getCache(); 1241 if (n != null) 1242 n.dump(str, indent + "\t"); else 1244 str.append(indent+"\tnull"); this.dumpAttributes(CACHE, 0, str, indent); 1246 1247 str.append(indent); 1248 str.append("ClassLoader"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getClassLoader(); 1250 if (n != null) 1251 n.dump(str, indent + "\t"); else 1253 str.append(indent+"\tnull"); this.dumpAttributes(CLASS_LOADER, 0, str, indent); 1255 1256 str.append(indent); 1257 str.append("JspConfig"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getJspConfig(); 1259 if (n != null) 1260 n.dump(str, indent + "\t"); else 1262 str.append(indent+"\tnull"); this.dumpAttributes(JSP_CONFIG, 0, str, indent); 1264 1265 str.append(indent); 1266 str.append("LocaleCharsetInfo"); n = (org.netbeans.modules.schema2beans.BaseBean) this.getLocaleCharsetInfo(); 1268 if (n != null) 1269 n.dump(str, indent + "\t"); else 1271 str.append(indent+"\tnull"); this.dumpAttributes(LOCALE_CHARSET_INFO, 0, str, indent); 1273 1274 str.append(indent); 1275 str.append("ParameterEncoding"); str.append(indent+"\t"); str.append((this.isParameterEncoding()?"true":"false")); 1278 this.dumpAttributes(PARAMETER_ENCODING, 0, str, indent); 1279 1280 str.append(indent); 1281 str.append("WebProperty["+this.sizeWebProperty()+"]"); for(int i=0; i<this.sizeWebProperty(); i++) 1283 { 1284 str.append(indent+"\t"); 1285 str.append("#"+i+":"); 1286 n = (org.netbeans.modules.schema2beans.BaseBean) this.getWebProperty(i); 1287 if (n != null) 1288 n.dump(str, indent + "\t"); else 1290 str.append(indent+"\tnull"); this.dumpAttributes(PROPERTY, i, str, indent); 1292 } 1293 1294 str.append(indent); 1295 str.append("MessageDestination["+this.sizeMessageDestination()+"]"); for(int i=0; i<this.sizeMessageDestination(); i++) 1297 { 1298 str.append(indent+"\t"); 1299 str.append("#"+i+":"); 1300 n = (org.netbeans.modules.schema2beans.BaseBean) this.getMessageDestination(i); 1301 if (n != null) 1302 n.dump(str, indent + "\t"); else 1304 str.append(indent+"\tnull"); this.dumpAttributes(MESSAGE_DESTINATION, i, str, indent); 1306 } 1307 1308 str.append(indent); 1309 str.append("WebserviceDescription["+this.sizeWebserviceDescription()+"]"); for(int i=0; i<this.sizeWebserviceDescription(); i++) 1311 { 1312 str.append(indent+"\t"); 1313 str.append("#"+i+":"); 1314 n = (org.netbeans.modules.schema2beans.BaseBean) this.getWebserviceDescription(i); 1315 if (n != null) 1316 n.dump(str, indent + "\t"); else 1318 str.append(indent+"\tnull"); this.dumpAttributes(WEBSERVICE_DESCRIPTION, i, str, indent); 1320 } 1321 1322 } 1323 public String dumpBeanNode(){ 1324 StringBuffer str = new StringBuffer (); 1325 str.append("SunWebApp\n"); this.dump(str, "\n "); return str.toString(); 1328 }} 1329 1330 1332 1333 1355 | Popular Tags |