You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2008/03/04 15:31:52 UTC

svn commit: r633485 [1/7] - in /webservices/axis2/trunk/java/modules: integration/test-resources/ integration/test-resources/ComplexDataTypes/ integration/test/org/apache/axis2/deployment/ integration/test/org/apache/axis2/engine/ integration/test/org/...

Author: sanka
Date: Tue Mar  4 06:31:32 2008
New Revision: 633485

URL: http://svn.apache.org/viewvc?rev=633485&view=rev
Log:
Committed the patched suggested in https://issues.apache.org/jira/browse/AXIS2-3523

Added:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/PolicySubject.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/PolicyLocator.java
Modified:
    webservices/axis2/trunk/java/modules/integration/test-resources/BaseDataTypes.wsdl
    webservices/axis2/trunk/java/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/WSDLClientTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java
    webservices/axis2/trunk/java/modules/integration/test/org/tempuri/BaseDataTypesTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/PolicyDataLocator.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingMessage.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisEndpoint.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL20ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/PolicyUtil.java

Modified: webservices/axis2/trunk/java/modules/integration/test-resources/BaseDataTypes.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/BaseDataTypes.wsdl?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/BaseDataTypes.wsdl (original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/BaseDataTypes.wsdl Tue Mar  4 06:31:32 2008
@@ -552,7 +552,7 @@
             <wsdl:output message="ns:retULongResponse" wsaw:Action="urn:retULongResponse"/>
         </wsdl:operation>
     </wsdl:portType>
-    <wsdl:binding name="BaseDataTypesSOAP11Binding" type="ns:BaseDataTypesPortType">
+    <wsdl:binding name="BaseDataTypesHttpSoap11Binding" type="ns:BaseDataTypesPortType">
         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
         <wsdl:operation name="retUInt">
             <soap:operation soapAction="urn:retUInt" style="document"/>
@@ -753,7 +753,7 @@
             </wsdl:output>
         </wsdl:operation>
     </wsdl:binding>
-    <wsdl:binding name="BaseDataTypesSOAP12Binding" type="ns:BaseDataTypesPortType">
+    <wsdl:binding name="BaseDataTypesHttpSoap12Binding" type="ns:BaseDataTypesPortType">
         <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
         <wsdl:operation name="retUInt">
             <soap12:operation soapAction="urn:retUInt" style="document"/>
@@ -1156,13 +1156,13 @@
         </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="BaseDataTypes">
-        <wsdl:port name="BaseDataTypesSOAP11port_http" binding="ns:BaseDataTypesSOAP11Binding">
+        <wsdl:port name="BaseDataTypesHttpSoap11Endpoint" binding="ns:BaseDataTypesHttpSoap11Binding">
             <soap:address location="http://localhost:8080/axis2/services/BaseDataTypes"/>
         </wsdl:port>
-        <wsdl:port name="BaseDataTypesSOAP12port_http" binding="ns:BaseDataTypesSOAP12Binding">
+        <wsdl:port name="BaseDataTypesHttpSoap12Endpoint" binding="ns:BaseDataTypesHttpSoap12Binding">
             <soap12:address location="http://localhost:8080/axis2/services/BaseDataTypes"/>
         </wsdl:port>
-        <wsdl:port name="BaseDataTypesHttpport" binding="ns:BaseDataTypesHttpBinding">
+        <wsdl:port name="BaseDataTypesHttpEndpoint" binding="ns:BaseDataTypesHttpBinding">
             <http:address location="http://localhost:8080/axis2/services/BaseDataTypes"/>
         </wsdl:port>
     </wsdl:service>

Modified: webservices/axis2/trunk/java/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl (original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/ComplexDataTypes/ComplexDataTypes.wsdl Tue Mar  4 06:31:32 2008
@@ -1029,7 +1029,7 @@
             <wsdl:output message="ns:retStructSNSAResponse" wsaw:Action="urn:retStructSNSAResponse"/>
         </wsdl:operation>
     </wsdl:portType>
-    <wsdl:binding name="ComplexDataTypesSOAP11Binding" type="ns:ComplexDataTypesPortType">
+    <wsdl:binding name="ComplexDataTypesHttpSoap11Binding" type="ns:ComplexDataTypesPortType">
         <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
         <wsdl:operation name="retObject">
             <soap:operation soapAction="urn:retObject" style="document"/>
@@ -1374,7 +1374,7 @@
             </wsdl:output>
         </wsdl:operation>
     </wsdl:binding>
-    <wsdl:binding name="ComplexDataTypesSOAP12Binding" type="ns:ComplexDataTypesPortType">
+    <wsdl:binding name="ComplexDataTypesHttpSoap12Binding" type="ns:ComplexDataTypesPortType">
         <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
         <wsdl:operation name="retObject">
             <soap12:operation soapAction="urn:retObject" style="document"/>
@@ -2065,13 +2065,13 @@
         </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="ComplexDataTypes">
-        <wsdl:port name="ComplexDataTypesSOAP11port_http" binding="ns:ComplexDataTypesSOAP11Binding">
+        <wsdl:port name="ComplexDataTypesHttpSoap11Endpoint" binding="ns:ComplexDataTypesHttpSoap11Binding">
             <soap:address location="http://localhost:8080/axis2/services/ComplexDataTypes"/>
         </wsdl:port>
-        <wsdl:port name="ComplexDataTypesSOAP12port_http" binding="ns:ComplexDataTypesSOAP12Binding">
+        <wsdl:port name="ComplexDataTypesHttpSoap12Endpoint" binding="ns:ComplexDataTypesHttpSoap12Binding">
             <soap12:address location="http://localhost:8080/axis2/services/ComplexDataTypes"/>
         </wsdl:port>
-        <wsdl:port name="ComplexDataTypesHttpport" binding="ns:ComplexDataTypesHttpBinding">
+        <wsdl:port name="ComplexDataTypesHttpEndpoint" binding="ns:ComplexDataTypesHttpBinding">
             <http:address location="http://localhost:8080/axis2/services/ComplexDataTypes"/>
         </wsdl:port>
     </wsdl:service>

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/deployment/WSDL11ToAxisServiceBuilderTest.java Tue Mar  4 06:31:32 2008
@@ -39,10 +39,8 @@
             WSDL11ToAllAxisServicesBuilder builder = new WSDL11ToAllAxisServicesBuilder(
                     new FileInputStream(testResourceFile));
             AxisService axisService = builder.populateService();
-            System.out.println("WSDL file: " + testResourceFile.getAbsolutePath());
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             axisService.printWSDL(baos);
-            System.out.println(new String(baos.toByteArray()));
             assertXMLEqual(new FileReader(testResourceFile), new StringReader(new String(baos.toByteArray())));
         } catch (Exception e) {
             System.out.println("Error in WSDL : " + testResourceFile.getName());

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/ServiceCreateTest.java Tue Mar  4 06:31:32 2008
@@ -68,7 +68,6 @@
         assertNotNull(messge.getSchemaElement());
         assertNotNull(service.getOperation(new QName("putValue")));
         assertNotNull(axisConfig.getService("MyService"));
-        service.printWSDL(System.out);
 
         RPCServiceClient client = new RPCServiceClient(clinetConfigurationctx, null);
 

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/WSDLClientTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/WSDLClientTest.java?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/WSDLClientTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/WSDLClientTest.java Tue Mar  4 06:31:32 2008
@@ -61,7 +61,7 @@
                                                         new QName(
                                                                 "http://engine.axis2.apache.org",
                                                                 "EchoXMLService"),
-                                                        "EchoXMLServiceSOAP11port_http");
+                                                        "EchoHttpSoap11Endpoint");
         OMElement payload =
                 TestingUtils.createDummyOMElement("http://engine.axis2.apache.org");
         String epr = "http://127.0.0.1:" + UtilServer.TESTING_PORT +

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/rpc/complex/ComplexDataTypesComplexDataTypesSOAP11Test.java Tue Mar  4 06:31:32 2008
@@ -68,7 +68,7 @@
     protected AxisConfiguration axisConfiguration;
 
     protected boolean finish = false;
-    org.tempuri.complex.ComplexDataTypesComplexDataTypesSOAP11Port_httpStub stub;
+    org.tempuri.complex.ComplexDataTypesComplexDataTypesHttpSoap11EndpointStub stub;
 
     public ComplexDataTypesComplexDataTypesSOAP11Test() {
         super(ComplexDataTypesComplexDataTypesSOAP11Test.class.getName());
@@ -97,7 +97,7 @@
                 new EndpointReference("http://127.0.0.1:"
                         + (UtilServer.TESTING_PORT)
                         + "/axis2/services/ComplexDataTypes");
-        stub  = new org.tempuri.complex.ComplexDataTypesComplexDataTypesSOAP11Port_httpStub(null,targetEPR.getAddress());
+        stub  = new org.tempuri.complex.ComplexDataTypesComplexDataTypesHttpSoap11EndpointStub(null,targetEPR.getAddress());
     }
 
     protected void tearDown() throws Exception {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/tempuri/BaseDataTypesTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/tempuri/BaseDataTypesTest.java?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/tempuri/BaseDataTypesTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/tempuri/BaseDataTypesTest.java Tue Mar  4 06:31:32 2008
@@ -42,7 +42,6 @@
             builder.generateWSDL();
             FileReader control = new FileReader(wsdlLocation);
             StringReader test = new StringReader(new String(out.toByteArray()));
-            
             Diff myDiff = new Diff(XMLUnit.buildDocument(XMLUnit.getControlParser(), control), 
 		               XMLUnit.buildDocument(XMLUnit.getControlParser(), test), 
 		               (DifferenceEngine) null, new WSDLElementQualifier());

Modified: webservices/axis2/trunk/java/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/tempuri/complex/ComplexDataTypesTest.java Tue Mar  4 06:31:32 2008
@@ -43,7 +43,6 @@
             builder.generateWSDL();
             FileReader control = new FileReader(wsdlLocation);
             StringReader test = new StringReader(new String(out.toByteArray()));
-            
             Diff myDiff = new Diff(XMLUnit.buildDocument(XMLUnit.getControlParser(), control), 
 		               XMLUnit.buildDocument(XMLUnit.getControlParser(), test), 
 		               new WSDLDifferenceEngine(new WSDLController()), new WSDLElementQualifier());

Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java Tue Mar  4 06:31:32 2008
@@ -40,355 +40,375 @@
 
 import java.io.OutputStream;
 import java.lang.reflect.Constructor;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
 
 public class Java2WSDLBuilder implements Java2WSDLConstants {
 
-    public static final String ALL = "all";
-    private OutputStream out;
-    private String className;
-    private ClassLoader classLoader;
-    private String wsdlPrefix = "wsdl";
-
-    private String serviceName = null;
-
-    //these apply for the WSDL
-    private String targetNamespace = null;
-    private String targetNamespacePrefix = null;
-
-    private String attrFormDefault = null;
-    private String elementFormDefault = null;
-    private String schemaTargetNamespace = null;
-    private String schemaTargetNamespacePrefix = null;
-    private String style = Java2WSDLConstants.DOCUMENT;
-    private String use = Java2WSDLConstants.LITERAL;
-    private String locationUri;
-    private ArrayList extraClasses;
-
-    private String nsGenClassName = null;
-    private Map pkg2nsMap = null;
-    private boolean pretty = true;
-    private String wsdlVersion = WSDL_VERSION_1;
-    private String schemaGenClassName = null;
-    private boolean generateDocLitBare = false;
-    private AxisConfiguration axisConfig;
+	public static final String ALL = "all";
+	private OutputStream out;
+	private String className;
+	private ClassLoader classLoader;
+	private String wsdlPrefix = "wsdl";
+
+	private String serviceName = null;
+
+	// these apply for the WSDL
+	private String targetNamespace = null;
+	private String targetNamespacePrefix = null;
+
+	private String attrFormDefault = null;
+	private String elementFormDefault = null;
+	private String schemaTargetNamespace = null;
+	private String schemaTargetNamespacePrefix = null;
+	private String style = Java2WSDLConstants.DOCUMENT;
+	private String use = Java2WSDLConstants.LITERAL;
+	private String locationUri;
+	private ArrayList extraClasses;
+
+	private String nsGenClassName = null;
+	private Map pkg2nsMap = null;
+	private boolean pretty = true;
+	private String wsdlVersion = WSDL_VERSION_1;
+	private String schemaGenClassName = null;
+	private boolean generateDocLitBare = false;
+	private AxisConfiguration axisConfig;
     private String customSchemaLocation;
     // location of the class name to package mapping file
     // File is simple file with qualifiedClassName:SchemaQName
     private String mappingFileLocation;
 
-    public Java2WSDLBuilder() {
-        try {
-            ConfigurationContext configCtx =
-                    ConfigurationContextFactory.createDefaultConfigurationContext();
-            axisConfig = configCtx.getAxisConfiguration();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public Java2WSDLBuilder(AxisConfiguration axisConfig) {
-        this.axisConfig = axisConfig;
-    }
-
-    public Java2WSDLBuilder(OutputStream out, String className, ClassLoader classLoader) {
-        try {
-            ConfigurationContext configCtx =
-                    ConfigurationContextFactory.createDefaultConfigurationContext();
-            axisConfig = configCtx.getAxisConfiguration();
-            this.out = out;
-            this.className = className;
-            this.classLoader = classLoader;
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public String getSchemaTargetNamespace() throws Exception {
-        if (schemaTargetNamespace == null) {
-            schemaTargetNamespace =
-                    Java2WSDLUtils.schemaNamespaceFromClassName(className, classLoader, resolveNSGen()).toString();
-        }
-        return schemaTargetNamespace;
-    }
-
-    public String getStyle() {
-        return style;
-    }
-
-    public String getLocationUri() {
-        return locationUri;
-    }
-
-    public void setLocationUri(String locationUri) {
-        this.locationUri = locationUri;
-    }
-
-    public void setStyle(String style) {
-        this.style = style;
-    }
-
-    public String getUse() {
-        return use;
-    }
-
-    public void setUse(String use) {
-        this.use = use;
-    }
-
-    public void setSchemaTargetNamespace(String schemaTargetNamespace) {
-        this.schemaTargetNamespace = schemaTargetNamespace;
-    }
-
-    public String getSchemaTargetNamespacePrefix() {
-        if (schemaTargetNamespacePrefix == null) {
-            this.schemaTargetNamespacePrefix = SCHEMA_NAMESPACE_PRFIX;
-        }
-        return schemaTargetNamespacePrefix;
-    }
-
-    public void setSchemaTargetNamespacePrefix(String schemaTargetNamespacePrefix) {
-        this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix;
-    }
-
-    public String getTargetNamespace() {
-        return targetNamespace;
-    }
-
-    public void setTargetNamespace(String targetNamespace) {
-        this.targetNamespace = targetNamespace;
-    }
-
-    public String getTargetNamespacePrefix() {
-        if (targetNamespacePrefix == null) {
-            this.targetNamespacePrefix = TARGETNAMESPACE_PREFIX;
-        }
-        return targetNamespacePrefix;
-    }
-
-    public void setTargetNamespacePrefix(String targetNamespacePrefix) {
-        this.targetNamespacePrefix = targetNamespacePrefix;
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public void setServiceName(String serviceName) {
-        this.serviceName = serviceName;
-    }
-
-
-    public String getWsdlPrefix() {
-        return wsdlPrefix;
-    }
-
-    public void setWsdlPrefix(String wsdlPrefix) {
-        this.wsdlPrefix = wsdlPrefix;
-    }
-
-
-    public boolean isGenerateDocLitBare() {
-        return generateDocLitBare;
-    }
-
-    public void setGenerateDocLitBare(boolean generateDocLitBare) {
-        this.generateDocLitBare = generateDocLitBare;
-    }
-
-    public void generateWSDL() throws Exception {
-        SchemaGenerator schemaGenerator = resolveSchemaGen(classLoader,
-                                                           className,
-                                                           getSchemaTargetNamespace(),
-                                                           getSchemaTargetNamespacePrefix());
-
-        ArrayList excludedOperation = new ArrayList();
-        Utils.addExcludeMethods(excludedOperation);
-        schemaGenerator.setExcludeMethods(excludedOperation);
-        schemaGenerator.setAttrFormDefault(getAttrFormDefault());
-        schemaGenerator.setElementFormDefault(getElementFormDefault());
-        schemaGenerator.setExtraClasses(getExtraClasses());
-        schemaGenerator.setNsGen(resolveNSGen());
-        schemaGenerator.setPkg2nsmap(getPkg2nsMap());
-        schemaGenerator.setMappingFileLocation(mappingFileLocation);
-        schemaGenerator.setCustomSchemaLocation(customSchemaLocation);
-        if (getPkg2nsMap() != null && !getPkg2nsMap().isEmpty() &&
-            (getPkg2nsMap().containsKey(ALL) || getPkg2nsMap().containsKey(ALL.toUpperCase()))) {
-            schemaGenerator.setUseWSDLTypesNamespace(true);
-        }
-
-        HashMap messageReciverMap = new HashMap();
-        Class inOnlyMessageReceiver = Loader.loadClass(
-                "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
-        MessageReceiver messageReceiver =
-                (MessageReceiver) inOnlyMessageReceiver.newInstance();
-        messageReciverMap.put(
-                WSDL2Constants.MEP_URI_IN_ONLY,
-                messageReceiver);
-        Class inoutMessageReceiver = Loader.loadClass(
-                "org.apache.axis2.rpc.receivers.RPCMessageReceiver");
-        MessageReceiver inOutmessageReceiver =
-                (MessageReceiver) inoutMessageReceiver.newInstance();
-        messageReciverMap.put(
-                WSDL2Constants.MEP_URI_IN_OUT,
-                inOutmessageReceiver);
-        AxisService service = new AxisService();
-        schemaGenerator.setAxisService(service);
-        AxisService axisService = AxisService.createService(className,
-                                                            serviceName == null ? Java2WSDLUtils.getSimpleClassName(className) : serviceName,
-                                                            axisConfig,
-                                                            messageReciverMap,
-                                                            targetNamespace == null ? Java2WSDLUtils.namespaceFromClassName(className, classLoader, resolveNSGen()).toString() : targetNamespace,
-                                                            classLoader,
-                                                            schemaGenerator, service);
-        schemaGenerator.setAxisService(axisService);
-        axisService.setTargetNamespacePrefix(getTargetNamespacePrefix());
-        axisService.setSchemaTargetNamespace(getSchemaTargetNamespace());
-        axisService.setSchematargetNamespacePrefix(getSchemaTargetNamespacePrefix());
-        String uri = locationUri;
-        if (uri == null) {
-            uri = DEFAULT_LOCATION_URL + (serviceName == null ? Java2WSDLUtils.getSimpleClassName(className) : serviceName);
-        }
-        axisService.setEPRs(new String[]{uri});
-        axisConfig.addService(axisService);
-
-        if (WSDL_VERSION_1.equals(wsdlVersion)) {
-            AxisService2WSDL11 g = new AxisService2WSDL11(axisService);
-            g.setStyle(this.style);
-            g.setUse(this.use);
-            OMElement wsdlElement = g.generateOM();
-            if (!isPretty()) {
-                wsdlElement.serialize(out);
-            } else {
-                XMLPrettyPrinter.prettify(wsdlElement, out);
-            }
-        } else {
-            AxisService2WSDL20 g = new AxisService2WSDL20(axisService);
-            OMElement wsdlElement = g.generateOM();
-            if (!isPretty()) {
-                wsdlElement.serialize(out);
-            } else {
-                XMLPrettyPrinter.prettify(wsdlElement, out);
-            }
-        }
-
-        out.flush();
-        out.close();
-    }
-
-    public String getAttrFormDefault() {
-        return attrFormDefault;
-    }
-
-    public void setAttrFormDefault(String attrFormDefault) {
-        this.attrFormDefault = attrFormDefault;
-    }
-
-    public String getElementFormDefault() {
-        return elementFormDefault;
-    }
-
-    public void setElementFormDefault(String elementFormDefault) {
-        this.elementFormDefault = elementFormDefault;
-    }
-
-    public ArrayList getExtraClasses() {
-        return extraClasses;
-    }
-
-    public void setExtraClasses(ArrayList extraClasses) {
-        this.extraClasses = extraClasses;
-    }
-
-    public String getNsGenClassName() {
-        return nsGenClassName;
-    }
-
-    public void setNsGenClassName(String nsGenClassName) {
-        this.nsGenClassName = nsGenClassName;
-    }
-
-    public String getSchemaGenClassName() {
-        return schemaGenClassName;
-    }
-
-    public void setSchemaGenClassName(String schemaGenClassName) {
-        this.schemaGenClassName = schemaGenClassName;
-    }
-
-    public Map getPkg2nsMap() {
-        return pkg2nsMap;
-    }
-
-    public void setPkg2nsMap(Map pkg2nsMap) {
-        this.pkg2nsMap = pkg2nsMap;
-    }
-
-    private NamespaceGenerator resolveNSGen() {
-        NamespaceGenerator nsGen;
-        if (this.nsGenClassName == null) {
-            nsGen = new DefaultNamespaceGenerator();
-        } else {
-            try {
-                nsGen = (NamespaceGenerator) Class.forName(this.nsGenClassName).newInstance();
-            } catch (Exception e) {
-                nsGen = new DefaultNamespaceGenerator();
-            }
-        }
-        return nsGen;
-    }
-
-    private SchemaGenerator resolveSchemaGen(ClassLoader loader, String className,
-                                             String schematargetNamespace,
-                                             String schematargetNamespacePrefix) throws Exception {
-        SchemaGenerator schemaGen;
-        if (this.schemaGenClassName == null) {
-            if (generateDocLitBare) {
-                schemaGen = new DocLitBareSchemaGenerator(
-                        loader, className, schematargetNamespace,
-                        schematargetNamespacePrefix, null);
-            } else {
-                schemaGen = new DefaultSchemaGenerator(
-                        loader, className, schematargetNamespace,
-                        schematargetNamespacePrefix, null);
-            }
-
-        } else {
-            try {
-                Class clazz = Class.forName(this.schemaGenClassName);
-                Constructor constructor = clazz.getConstructor(
-                        new Class[]{ClassLoader.class, String.class, String.class, String.class});
-                schemaGen = (SchemaGenerator) constructor.newInstance(
-                        new Object[]{loader, className, schematargetNamespace, schematargetNamespacePrefix});
-            } catch (Exception e) {
-                if (generateDocLitBare) {
-                    schemaGen = new DocLitBareSchemaGenerator(
-                            loader, className, schematargetNamespace,
-                            schematargetNamespacePrefix, null);
-                } else {
-                    schemaGen = new DefaultSchemaGenerator(
-                            loader, className, schematargetNamespace,
-                            schematargetNamespacePrefix, null);
-                }
-
-            }
-        }
-        return schemaGen;
-    }
-
-    public boolean isPretty() {
-        return pretty;
-    }
-
-    public void setPretty(boolean pretty) {
-        this.pretty = pretty;
-    }
-
-    public void setWSDLVersion(String wsdlVersion) {
-        this.wsdlVersion = wsdlVersion;
-    }
+	public Java2WSDLBuilder() {
+		try {
+			ConfigurationContext configCtx = ConfigurationContextFactory
+					.createDefaultConfigurationContext();
+			axisConfig = configCtx.getAxisConfiguration();
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+	}
+
+	public Java2WSDLBuilder(AxisConfiguration axisConfig) {
+		this.axisConfig = axisConfig;
+	}
+
+	public Java2WSDLBuilder(OutputStream out, String className,
+			ClassLoader classLoader) {
+		try {
+			ConfigurationContext configCtx = ConfigurationContextFactory
+					.createDefaultConfigurationContext();
+			axisConfig = configCtx.getAxisConfiguration();
+			this.out = out;
+			this.className = className;
+			this.classLoader = classLoader;
+		} catch (Exception e) {
+			throw new RuntimeException(e);
+		}
+	}
+
+	public String getSchemaTargetNamespace() throws Exception {
+		if (schemaTargetNamespace == null) {
+			schemaTargetNamespace = Java2WSDLUtils
+					.schemaNamespaceFromClassName(className, classLoader,
+							resolveNSGen()).toString();
+		}
+		return schemaTargetNamespace;
+	}
+
+	public String getStyle() {
+		return style;
+	}
+
+	public String getLocationUri() {
+		return locationUri;
+	}
+
+	public void setLocationUri(String locationUri) {
+		this.locationUri = locationUri;
+	}
+
+	public void setStyle(String style) {
+		this.style = style;
+	}
+
+	public String getUse() {
+		return use;
+	}
+
+	public void setUse(String use) {
+		this.use = use;
+	}
+
+	public void setSchemaTargetNamespace(String schemaTargetNamespace) {
+		this.schemaTargetNamespace = schemaTargetNamespace;
+	}
+
+	public String getSchemaTargetNamespacePrefix() {
+		if (schemaTargetNamespacePrefix == null) {
+			this.schemaTargetNamespacePrefix = SCHEMA_NAMESPACE_PRFIX;
+		}
+		return schemaTargetNamespacePrefix;
+	}
+
+	public void setSchemaTargetNamespacePrefix(
+			String schemaTargetNamespacePrefix) {
+		this.schemaTargetNamespacePrefix = schemaTargetNamespacePrefix;
+	}
+
+	public String getTargetNamespace() {
+		return targetNamespace;
+	}
+
+	public void setTargetNamespace(String targetNamespace) {
+		this.targetNamespace = targetNamespace;
+	}
+
+	public String getTargetNamespacePrefix() {
+		if (targetNamespacePrefix == null) {
+			this.targetNamespacePrefix = TARGETNAMESPACE_PREFIX;
+		}
+		return targetNamespacePrefix;
+	}
+
+	public void setTargetNamespacePrefix(String targetNamespacePrefix) {
+		this.targetNamespacePrefix = targetNamespacePrefix;
+	}
+
+	public String getServiceName() {
+		return serviceName;
+	}
+
+	public void setServiceName(String serviceName) {
+		this.serviceName = serviceName;
+	}
+
+	public String getWsdlPrefix() {
+		return wsdlPrefix;
+	}
+
+	public void setWsdlPrefix(String wsdlPrefix) {
+		this.wsdlPrefix = wsdlPrefix;
+	}
+
+	public boolean isGenerateDocLitBare() {
+		return generateDocLitBare;
+	}
+
+	public void setGenerateDocLitBare(boolean generateDocLitBare) {
+		this.generateDocLitBare = generateDocLitBare;
+	}
+
+	public void generateWSDL() throws Exception {
+		SchemaGenerator schemaGenerator = resolveSchemaGen(classLoader,
+				className, getSchemaTargetNamespace(),
+				getSchemaTargetNamespacePrefix());
+
+		ArrayList excludedOperation = new ArrayList();
+		Utils.addExcludeMethods(excludedOperation);
+		schemaGenerator.setExcludeMethods(excludedOperation);
+		schemaGenerator.setAttrFormDefault(getAttrFormDefault());
+		schemaGenerator.setElementFormDefault(getElementFormDefault());
+		schemaGenerator.setExtraClasses(getExtraClasses());
+		schemaGenerator.setNsGen(resolveNSGen());
+		schemaGenerator.setPkg2nsmap(getPkg2nsMap());
+		if (getPkg2nsMap() != null
+				&& !getPkg2nsMap().isEmpty()
+				&& (getPkg2nsMap().containsKey(ALL) || getPkg2nsMap()
+						.containsKey(ALL.toUpperCase()))) {
+			schemaGenerator.setUseWSDLTypesNamespace(true);
+		}
+
+		HashMap messageReciverMap = new HashMap();
+		Class inOnlyMessageReceiver = Loader
+				.loadClass("org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver");
+		MessageReceiver messageReceiver = (MessageReceiver) inOnlyMessageReceiver
+				.newInstance();
+		messageReciverMap.put(WSDL2Constants.MEP_URI_IN_ONLY, messageReceiver);
+		Class inoutMessageReceiver = Loader
+				.loadClass("org.apache.axis2.rpc.receivers.RPCMessageReceiver");
+		MessageReceiver inOutmessageReceiver = (MessageReceiver) inoutMessageReceiver
+				.newInstance();
+		messageReciverMap.put(WSDL2Constants.MEP_URI_IN_OUT,
+				inOutmessageReceiver);
+		AxisService service = new AxisService();
+		schemaGenerator.setAxisService(service);
+		AxisService axisService = AxisService.createService(className,
+				serviceName == null ? Java2WSDLUtils
+						.getSimpleClassName(className) : serviceName,
+				axisConfig, messageReciverMap,
+				targetNamespace == null ? Java2WSDLUtils
+						.namespaceFromClassName(className, classLoader,
+								resolveNSGen()).toString() : targetNamespace,
+				classLoader, schemaGenerator, service);
+		schemaGenerator.setAxisService(axisService);
+		axisService.setTargetNamespacePrefix(getTargetNamespacePrefix());
+		axisService.setSchemaTargetNamespace(getSchemaTargetNamespace());
+		axisService
+				.setSchematargetNamespacePrefix(getSchemaTargetNamespacePrefix());
+		String uri = locationUri;
+		if (uri == null) {
+			uri = DEFAULT_LOCATION_URL
+					+ (serviceName == null ? Java2WSDLUtils
+							.getSimpleClassName(className) : serviceName);
+		}
+		// axisService.setEPRs(new String[]{uri});
+		setServiceEPR(axisService, uri);
+		axisConfig.addService(axisService);
+
+		if (WSDL_VERSION_1.equals(wsdlVersion)) {
+			AxisService2WSDL11 g = new AxisService2WSDL11(axisService);
+			g.setStyle(this.style);
+			g.setUse(this.use);
+			OMElement wsdlElement = g.generateOM();
+			if (!isPretty()) {
+				wsdlElement.serialize(out);
+			} else {
+				XMLPrettyPrinter.prettify(wsdlElement, out);
+			}
+		} else {
+			AxisService2WSDL20 g = new AxisService2WSDL20(axisService);
+			OMElement wsdlElement = g.generateOM();
+			if (!isPretty()) {
+				wsdlElement.serialize(out);
+			} else {
+				XMLPrettyPrinter.prettify(wsdlElement, out);
+			}
+		}
+		
+		out.flush();
+		out.close();
+	}
+
+	public String getAttrFormDefault() {
+		return attrFormDefault;
+	}
+
+	public void setAttrFormDefault(String attrFormDefault) {
+		this.attrFormDefault = attrFormDefault;
+	}
+
+	public String getElementFormDefault() {
+		return elementFormDefault;
+	}
+
+	public void setElementFormDefault(String elementFormDefault) {
+		this.elementFormDefault = elementFormDefault;
+	}
+
+	public ArrayList getExtraClasses() {
+		return extraClasses;
+	}
+
+	public void setExtraClasses(ArrayList extraClasses) {
+		this.extraClasses = extraClasses;
+	}
+
+	public String getNsGenClassName() {
+		return nsGenClassName;
+	}
+
+	public void setNsGenClassName(String nsGenClassName) {
+		this.nsGenClassName = nsGenClassName;
+	}
+
+	public String getSchemaGenClassName() {
+		return schemaGenClassName;
+	}
+
+	public void setSchemaGenClassName(String schemaGenClassName) {
+		this.schemaGenClassName = schemaGenClassName;
+	}
+
+	public Map getPkg2nsMap() {
+		return pkg2nsMap;
+	}
+
+	public void setPkg2nsMap(Map pkg2nsMap) {
+		this.pkg2nsMap = pkg2nsMap;
+	}
+
+	private NamespaceGenerator resolveNSGen() {
+		NamespaceGenerator nsGen;
+		if (this.nsGenClassName == null) {
+			nsGen = new DefaultNamespaceGenerator();
+		} else {
+			try {
+				nsGen = (NamespaceGenerator) Class.forName(this.nsGenClassName)
+						.newInstance();
+			} catch (Exception e) {
+				nsGen = new DefaultNamespaceGenerator();
+			}
+		}
+		return nsGen;
+	}
+
+	private SchemaGenerator resolveSchemaGen(ClassLoader loader,
+			String className, String schematargetNamespace,
+			String schematargetNamespacePrefix) throws Exception {
+		SchemaGenerator schemaGen;
+		if (this.schemaGenClassName == null) {
+			if (generateDocLitBare) {
+				schemaGen = new DocLitBareSchemaGenerator(loader, className,
+						schematargetNamespace, schematargetNamespacePrefix,
+						null);
+			} else {
+				schemaGen = new DefaultSchemaGenerator(loader, className,
+						schematargetNamespace, schematargetNamespacePrefix,
+						null);
+			}
+
+		} else {
+			try {
+				Class clazz = Class.forName(this.schemaGenClassName);
+				Constructor constructor = clazz.getConstructor(new Class[] {
+						ClassLoader.class, String.class, String.class,
+						String.class });
+				schemaGen = (SchemaGenerator) constructor
+						.newInstance(new Object[] { loader, className,
+								schematargetNamespace,
+								schematargetNamespacePrefix });
+			} catch (Exception e) {
+				if (generateDocLitBare) {
+					schemaGen = new DocLitBareSchemaGenerator(loader,
+							className, schematargetNamespace,
+							schematargetNamespacePrefix, null);
+				} else {
+					schemaGen = new DefaultSchemaGenerator(loader, className,
+							schematargetNamespace, schematargetNamespacePrefix,
+							null);
+				}
+
+			}
+		}
+		return schemaGen;
+	}
+
+	public boolean isPretty() {
+		return pretty;
+	}
+
+	public void setPretty(boolean pretty) {
+		this.pretty = pretty;
+	}
+
+	public void setWSDLVersion(String wsdlVersion) {
+		this.wsdlVersion = wsdlVersion;
+	}
+
+	private void setServiceEPR(AxisService axisService, String urlString)
+			throws Exception {
+		URL url = new URL(urlString);
+		Utils.addSoap11Endpoint(axisService, url);
+		Utils.addSoap12Endpoint(axisService, url);
+		
+		String protocol = url.getProtocol();
+		if ("http".equals(protocol)) {
+			Utils.addHttpEndpoint(axisService, url);
+		}
+	}
 
 
     public String getCustomSchemaLocation() {
@@ -407,4 +427,3 @@
         this.mappingFileLocation = mappingFileLocation;
     }
 }
-

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/PolicyDataLocator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/PolicyDataLocator.java?rev=633485&r1=633484&r2=633485&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/PolicyDataLocator.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/dataretrieval/PolicyDataLocator.java Tue Mar  4 06:31:32 2008
@@ -19,22 +19,23 @@
 
 package org.apache.axis2.dataretrieval;
 
+
 /**
- * Axis 2 Data Locator responsibles for retrieving Policy  metadata.
- * The class is created as model for policy specific data locator; and also
- * easier for any future implementation policy specific data retrieval logic.
+ * Axis 2 Data Locator responsibles for retrieving Policy metadata. The class is
+ * created as model for policy specific data locator; and also easier for any
+ * future implementation policy specific data retrieval logic.
  */
-public class PolicyDataLocator extends BaseAxisDataLocator implements AxisDataLocator {
-
-    protected PolicyDataLocator() {
+public class PolicyDataLocator extends BaseAxisDataLocator implements
+		AxisDataLocator {
 
-    }
+	protected PolicyDataLocator() {
 
-    /**
-     * Constructor
-     */
-    protected PolicyDataLocator(ServiceData[] data) {
-        dataList = data;
-    }
+	}
 
+	/**
+	 * Constructor
+	 */
+	protected PolicyDataLocator(ServiceData[] data) {
+		dataList = data;
+	}
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org