Author: mmerz
Date: Mon Jan 17 16:54:25 2005
New Revision: 125451

URL: http://svn.apache.org/viewcvs?view=rev&rev=125451
Log:
Clean ups and minor bug fixes.


Modified:
   
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadata.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WebServiceMetadataViewer.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
   
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java

Modified: 
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java?view=diff&rev=125451&p1=incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java&r1=125450&p2=incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java&r2=125451
==============================================================================
--- 
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java
 (original)
+++ 
incubator/beehive/trunk/wsm/drt/tests/org/apache/beehive/wsm/axis/AxisHookTest.java
 Mon Jan 17 16:54:25 2005
@@ -126,8 +126,8 @@
     }
 
     protected Jsr181TypeMetadata makeFakeMetadata() throws Exception {
-        Jsr181TypeMetadata wstm =
-            new Jsr181TypeMetadataImpl(WS_CLASS.getName());
+        Jsr181TypeMetadata wstm = new Jsr181TypeMetadataImpl();
+        wstm.setClassName(WS_CLASS.getName());
         wstm.setWsName(WS_NAME);
         /*
          * NOTE [EMAIL PROTECTED] 2004-Sep-13 -- 

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java?view=diff&rev=125451&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java&r1=125450&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java&r2=125451
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
   (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/axis/AxisHook.java
   Mon Jan 17 16:54:25 2005
@@ -86,7 +86,7 @@
              */
             cl = AxisHook.class.getClassLoader();
         }
-        final Class serviceClass = 
cl.loadClass(wsm.getServiceImplementationBean());
+        final Class serviceClass = cl.loadClass(wsm.getClassName());
         sd.setName(wsm.getWsName());
         sd.setImplClass(serviceClass);
         String targetNamespace = wsm.getWsTargetNamespace();

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadata.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadata.java?view=diff&rev=125451&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadata.java&r1=125450&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadata.java&r2=125451
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadata.java
 (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadata.java
 Mon Jan 17 16:54:25 2005
@@ -91,9 +91,8 @@
     List<SOAPMessageHandlerInfo> getSoapHandlers();
     void addSOAPHandler(SOAPMessageHandlerInfo soapHandler);
     
-    String getServiceImplementationBean();
-    
-    String getServiceEndpointInterface();
+    String getClassName();
+    void setClassName(String className);
     
     void merge(Jsr181TypeMetadata objectModel) throws Exception;
 }

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java?view=diff&rev=125451&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java&r1=125450&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java&r2=125451
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
     (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/model/Jsr181TypeMetadataImpl.java
     Mon Jan 17 16:54:25 2005
@@ -73,27 +73,21 @@
             new ArrayList<SOAPMessageHandlerInfo>();
     private SecurityRolesInfo securityRoles;
     private String siValue;
-    private String sibClassName; // name of the service implementation bean
-    private String seiClassName; // name of the service endpoint interface
+    private String className;
 
     /**
-     * Constructor.
-     *
-     * @param sibClassName The fully-qualified name of the service
-     *                     implementation bean class.
+     * Default constructor.
      */
-    public Jsr181TypeMetadataImpl(String sibClassName) {
-        super();
-        this.sibClassName = sibClassName;
+    public Jsr181TypeMetadataImpl() {
     }
 
     /**
      * This method does not require to load the service implementation bean
      * class.
      *
-     * @param sibWsAnnotation The @WebService annotation of the service
+     * @param wsAnnotation The @WebService annotation of the service
      *                        implementation bean.
-     * @param sibClassName    The fully-qualified name of the service
+     * @param className    The fully-qualified name of the service
      *                        implementation bean class.
      * @param annotations     All annotations (including @WebService) of the
      *                        service endpoint interface if it exists; all 
annotations
@@ -101,31 +95,31 @@
      * @param webMethods      All methods that are published by the service.
      * @throws Exception
      */
-    public Jsr181TypeMetadataImpl(WebService sibWsAnnotation,
-                                  String sibClassName,
-                                  Collection<Annotation> annotations,
-                                  Collection<? extends Jsr181MethodMetadata> 
webMethods) throws Exception {
+    public Jsr181TypeMetadataImpl(
+        WebService wsAnnotation,
+        String className,
+        Collection<Annotation> annotations,
+        Collection<? extends Jsr181MethodMetadata> webMethods
+    ) throws Exception
+    {
         super();
 
-        // check required parameter: sibWsAnnotation
-        if (null == sibWsAnnotation) {
+        // check required parameter: wsAnnotation
+        if (null == wsAnnotation) {
             throw new IllegalArgumentException("@WebService is required for 
service implementation beans");
         }
 
-        // check required parameter: sibClassName
-        if ((null == sibClassName) || (0 == sibClassName.length())) {
+        // check required parameter: className
+        if ((null == className) || (0 == className.length())) {
             throw new IllegalArgumentException("service implementation bean 
class not set");
         }
-        this.sibClassName = sibClassName;
+        this.className = className;
 
         // check required parameters: annotations, webMethods
         if ((null == annotations) || (null == webMethods)) {
             throw new IllegalArgumentException("annotations or webMethods is 
null");
         }
 
-        // optional parameter: seiClassName
-        seiClassName = sibWsAnnotation.endpointInterface();
-        
         // enforce JSR-181 rules
         if (AnnotationModel.hasAnnotationType(annotations, 
SOAPMessageHandlers.class) &&
                 AnnotationModel.hasAnnotationType(annotations, 
HandlerChain.class)) {
@@ -134,15 +128,11 @@
         }
         
         // initilize instance
-        WebService seiWsAnnotation = null;
-        if (0 < seiClassName.length()) {
-            seiWsAnnotation =
-                (WebService) AnnotationModel.getAnnotationOfType(annotations, 
WebService.class);
-        }
-        initFromAnnotation(sibWsAnnotation, seiWsAnnotation);
+        initFromAnnotation(wsAnnotation);
 
         // set optional annotations
         for (Annotation a : annotations) {
+
             // @HandlerChain
             if (a.annotationType() == javax.jws.HandlerChain.class) {
                 initFromAnnotation((javax.jws.HandlerChain) a);
@@ -174,9 +164,9 @@
                 // todo: why can't we do this here?
             }
             
-            // Unknown annotation
+            // unsupported annotation
             else {
-                throw new Exception("Invalid annotation: " + 
a.annotationType().getName());
+                throw new Exception("found unsupported annotation: " + 
a.annotationType().getName());
             }
         }
         
@@ -201,25 +191,27 @@
         }
     }
 
-    protected void initFromAnnotation(WebService sibWsAnnotation, WebService 
seiWsAnnotation) {
+    protected void initFromAnnotation(WebService wsAnnotation) {
+
+        if (null == wsAnnotation) {
+            return;
+        }
+        
         // initialize fields with values from annotations
+        wsEndpointInterface = wsAnnotation.endpointInterface().trim();
         
-        if (null == seiWsAnnotation) {
-            setWsName(sibWsAnnotation.name());
-            setWsTargetNamespace(sibWsAnnotation.targetNamespace());
-            setWsWsdlLocation(sibWsAnnotation.wsdlLocation());
-        } else {
-            setWsName(seiWsAnnotation.name());
-            setWsTargetNamespace(seiWsAnnotation.targetNamespace());
-            setWsWsdlLocation(seiWsAnnotation.wsdlLocation());
-        }
-        setWsServiceName(sibWsAnnotation.serviceName());
-        setWsEndpointInterface(sibWsAnnotation.endpointInterface());
+        // todo: check for concrete class, etc.
+        
+        setWsName(wsAnnotation.name());
+        setWsTargetNamespace(wsAnnotation.targetNamespace());
+        setWsWsdlLocation(wsAnnotation.wsdlLocation());
+        setWsServiceName(wsAnnotation.serviceName());
+        setWsEndpointInterface(wsAnnotation.endpointInterface());
 
         // set default values
         
         // name
-        String name = (0 == seiClassName.length()) ? sibClassName : 
seiClassName;
+        String name = className;
         if (-1 < name.indexOf('.')) {
             int index = name.lastIndexOf('.');
             name = name.substring(index + 1);
@@ -229,7 +221,7 @@
         }
 
         // serviceName
-        String serviceName = sibClassName;
+        String serviceName = className;
         if (-1 < serviceName.indexOf('.')) {
             int index = serviceName.lastIndexOf('.');
             serviceName = serviceName.substring(index + 1);
@@ -240,9 +232,7 @@
 
         // targetNamespace
         if (0 == getWsTargetNamespace().length()) {
-            String defaultNamespaceSrc =
-                    (0 == seiClassName.length()) ? sibClassName : seiClassName;
-            setWsTargetNamespace(getTargetNamespace(defaultNamespaceSrc));
+            setWsTargetNamespace(getTargetNamespace(className));
         }
     }
 
@@ -312,15 +302,19 @@
         // no defaults to handle
     }
 
-    private void configureHandlerChain(String handlerChainConfigPath,
-                                       String handlerChainName)
-            throws Exception {
+    private void configureHandlerChain(
+        String handlerChainConfigPath,
+        String handlerChainName
+    )
+        throws Exception
+    {
         URL handlerChainConfigURL;
         
         // check if we have a likely absolute URL
         if (handlerChainConfigPath.indexOf("://") > 2) {
             handlerChainConfigURL = new URL(handlerChainConfigPath);
-        } else {
+        }
+        else {
             // attempt to load a handler config file as a resource.
             /*
              * FIXME [EMAIL PROTECTED] 2004-Sep-16 -- perhaps add code to 
ensure
@@ -329,19 +323,17 @@
              * 
              * Using the current ClassLoader for the moment.
              */
-            handlerChainConfigURL = getClass().getClassLoader()
-                    .getResource(handlerChainConfigPath);
+            handlerChainConfigURL =
+                
getClass().getClassLoader().getResource(handlerChainConfigPath);
             if (handlerChainConfigURL == null) {
                 // try again using the classes package as a prefix
-                StringBuffer fullPath = new StringBuffer
-                        (sibClassName.substring(0, sibClassName
-                        .lastIndexOf('.')));
-                if (!handlerChainConfigPath.startsWith("/")) {
+                StringBuffer fullPath =
+                    new StringBuffer(className.substring(0, 
className.lastIndexOf('.')));
+                if (! handlerChainConfigPath.startsWith("/")) {
                     fullPath.append('/');
                 }
-                handlerChainConfigURL = getClass().getClassLoader()
-                        .getResource(fullPath.toString().replace('.', '/') +
-                        handlerChainConfigPath);
+                handlerChainConfigURL =
+                    
getClass().getClassLoader().getResource(fullPath.toString().replace('.', '/') + 
handlerChainConfigPath);
             }
         }
         initHandlersFromChainConfig(handlerChainConfigURL, handlerChainName);
@@ -682,12 +674,12 @@
         soapHandlers.add(soapHandler);
     }
 
-    public String getServiceImplementationBean() {
-        return sibClassName;
+    public String getClassName() {
+        return className;
     }
 
-    public String getServiceEndpointInterface() {
-        return seiClassName;
+    public void setClassName(String className) {
+        this.className = className;
     }
 
     private String getTargetNamespace(String fqClassName) {
@@ -739,11 +731,18 @@
         
         // check if objectModel doesn't reference this endpointInterface --> 
error
         String omEndpointInterface = objectModel.getWsEndpointInterface();
-        if (null == omEndpointInterface || 0 >= omEndpointInterface.length() 
|| ! omEndpointInterface.equals(getServiceImplementationBean()))
-            throw new Exception("Internal error: object model for " + 
objectModel.getServiceImplementationBean() + " does not reference endpoint 
interface "+ omEndpointInterface);
+        if (null == omEndpointInterface || 0 >= omEndpointInterface.length() 
|| ! omEndpointInterface.equals(getClassName()))
+            throw new Exception("Internal error: object model for " + 
objectModel.getClassName() + " does not reference endpoint interface "+ 
omEndpointInterface);
+
+        // check if objectModel.wsWsdlLocation != null --> error
+        if (null != objectModel.getWsWsdlLocation() && 0 < 
objectModel.getWsWsdlLocation().length()) {
+            throw new Exception("implementation bean must not reference a 
service endpoint interface and a WSDL location at the same time");
+        }
         
         setWsServiceName(objectModel.getWsServiceName());
         setWsEndpointInterface(objectModel.getWsEndpointInterface());
+        
+        setClassName(objectModel.getClassName());
     }
 
     /**

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WebServiceMetadataViewer.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WebServiceMetadataViewer.java?view=diff&rev=125451&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WebServiceMetadataViewer.java&r1=125450&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WebServiceMetadataViewer.java&r2=125451
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WebServiceMetadataViewer.java
   (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WebServiceMetadataViewer.java
   Mon Jan 17 16:54:25 2005
@@ -53,7 +53,7 @@
         print(tab, "hcFileName", webServiceTYPEMetadata.getHcFileName());
         print(tab, "hcName", webServiceTYPEMetadata.getHcName());
         //print( tab, "siRunAs"             , 
webServiceTYPEMetadata.getSiRunAs() );
-        print(tab, "serviceImplementationBean", 
webServiceTYPEMetadata.getServiceImplementationBean());
+//        print(tab, "serviceImplementationBean", 
webServiceTYPEMetadata.getServiceImplementationBean());
         print("");
         tab++;
         print(tab, webServiceTYPEMetadata.getMethods());

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java?view=diff&rev=125451&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java&r1=125450&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java&r2=125451
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
     (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/processor/apt/WsmAnnotationProcessor.java
     Mon Jan 17 16:54:25 2005
@@ -139,7 +139,6 @@
 
                 // check if we have an object model
                 if (null == om) {
-//                    messager.printError(classDecl.getPosition(), "cannot 
create object model for service implementation bean: " + 
classDecl.getQualifiedName());
                     return;
                 }
 
@@ -156,7 +155,6 @@
                 // create object model
                 Jsr181TypeMetadata om = 
getWebServiceTYPEMetadata(interfaceDecl, true);
                 if (null == om) {
-//                    messager.printError(interfaceDecl.getPosition(), "cannot 
create object model for service endpoint interface: " + 
interfaceDecl.getQualifiedName());
                     return;
                 }
 
@@ -244,7 +242,7 @@
             if (null != wspm) {
                 webParams.add(wspm);
             }
-        }
+    }
 
         // create & return webMethod
         Jsr181MethodMetadata wsmm = null;
@@ -314,7 +312,7 @@
     protected void validate(Jsr181TypeMetadata objectModel, ClassDeclaration 
classDecl) {
         
         // check if we have a service endpoint interface
-        String endpointInterface = objectModel.getServiceEndpointInterface();
+        String endpointInterface = objectModel.getWsEndpointInterface();
         if (null == endpointInterface && 0 >= endpointInterface.length()) {
             return;
         }
@@ -338,6 +336,10 @@
         }
     }
 
+    /**
+     * @param decl
+     * @return
+     */
     protected Collection<Annotation> getAnnotations(Declaration decl) {
         Collection<Annotation> annotations = new ArrayList<Annotation>();
         for (AnnotationMirror am : decl.getAnnotationMirrors()) {

Modified: 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java
Url: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java?view=diff&rev=125451&p1=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java&r1=125450&p2=incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java&r2=125451
==============================================================================
--- 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java
        (original)
+++ 
incubator/beehive/trunk/wsm/src/runtime/org/apache/beehive/wsm/jsr181/wsdl/XmlBeanWSDLProcessor.java
        Mon Jan 17 16:54:25 2005
@@ -119,7 +119,7 @@
     public Jsr181TypeMetadata toWebServiceMetadata
         (DefinitionsDocument defDoc)
         throws Exception {
-        Jsr181TypeMetadata wsm = new Jsr181TypeMetadataImpl(null);
+        Jsr181TypeMetadata wsm = new Jsr181TypeMetadataImpl();
         Map<String, Jsr181MethodMetadata> methodMap =
                 new HashMap<String, Jsr181MethodMetadata>();
         TDefinitions defs = defDoc.getDefinitions();

Reply via email to