geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r524699 - /geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java
Date Sun, 01 Apr 2007 22:58:20 GMT
Author: gawor
Date: Sun Apr  1 15:58:19 2007
New Revision: 524699

URL: http://svn.apache.org/viewvc?view=rev&rev=524699
Log:
add in missing service-ref elements, support mappedName and lookup wsdl location on service
class

Modified:
    geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java

Modified: geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java?view=diff&rev=524699&r1=524698&r2=524699
==============================================================================
--- geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java
(original)
+++ geronimo/server/trunk/modules/geronimo-j2ee-builder/src/main/java/org/apache/geronimo/j2ee/deployment/annotation/WebServiceRefAnnotationHelper.java
Sun Apr  1 15:58:19 2007
@@ -23,6 +23,7 @@
 import java.util.Arrays;
 import java.util.List;
 
+import javax.xml.ws.WebServiceClient;
 import javax.xml.ws.WebServiceRef;
 import javax.xml.ws.WebServiceRefs;
 
@@ -30,10 +31,10 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.xbeans.javaee.FullyQualifiedClassType;
-import org.apache.geronimo.xbeans.javaee.InjectionTargetType;
 import org.apache.geronimo.xbeans.javaee.JndiNameType;
 import org.apache.geronimo.xbeans.javaee.ServiceRefType;
 import org.apache.geronimo.xbeans.javaee.XsdAnyURIType;
+import org.apache.geronimo.xbeans.javaee.XsdStringType;
 import org.apache.xbean.finder.ClassFinder;
 
 
@@ -249,59 +250,82 @@
         //------------------------------------------------------------------------------------------
         // 1. <service-ref>
         //------------------------------------------------------------------------------------------
-        //If there is already xml for the service ref, just add injection targets and return.
+
+        ServiceRefType serviceRef = null;
+        
         ServiceRefType[] serviceRefs = annotatedApp.getServiceRefArray();
-        for (ServiceRefType serviceRef : serviceRefs) {
-            if (serviceRef.getServiceRefName().getStringValue().trim().equals(webServiceRefName))
{
-                if (method != null || field != null) {
-                    InjectionTargetType[] targets = serviceRef.getInjectionTargetArray();
-                    if (!hasTarget(method, field, targets)) {
-                        configureInjectionTarget(serviceRef.addNewInjectionTarget(), method,
field);
-                    }
-                }
-                return;
+        for (ServiceRefType currServiceRef : serviceRefs) {
+            if (currServiceRef.getServiceRefName().getStringValue().trim().equals(webServiceRefName))
{
+                serviceRef = currServiceRef;
+                break;
             }
         }
 
-        // Doesn't exist in deployment descriptor -- add new
-        ServiceRefType serviceRef = annotatedApp.addNewServiceRef();
-
+        if (serviceRef == null) {
+            // Doesn't exist in deployment descriptor -- add new
+            serviceRef = annotatedApp.addNewServiceRef();
+
+            // ------------------------------------------------------------------------------
+            // <service-ref> required elements:
+            // ------------------------------------------------------------------------------
+
+            // service-ref-name
+            JndiNameType serviceRefName = serviceRef.addNewServiceRefName();
+            serviceRefName.setStringValue(webServiceRefName);
+        
+            // service-ref-interface
+            if (!webServiceRefValue.equals(Object.class)) {
+                FullyQualifiedClassType qualifiedClass = serviceRef.addNewServiceInterface();
+                qualifiedClass.setStringValue(webServiceRefValue.getName());
+                serviceRef.setServiceInterface(qualifiedClass);
+            } else {
+                FullyQualifiedClassType qualifiedClass = serviceRef.addNewServiceInterface();
+                qualifiedClass.setStringValue(webServiceRefType.getName());
+                serviceRef.setServiceInterface(qualifiedClass);
+            }
+        }
+        
         //------------------------------------------------------------------------------
-        // <service-ref> required elements:
+        // <service-ref> optional elements:
         //------------------------------------------------------------------------------
 
-        // service-ref-name
-        JndiNameType serviceRefName = serviceRef.addNewServiceRefName();
-        serviceRefName.setStringValue(webServiceRefName);
-
         // service-ref-type
-        if (!webServiceRefType.equals(Object.class)) {
+        if (!serviceRef.isSetServiceRefType() && !webServiceRefType.equals(Object.class))
{
             FullyQualifiedClassType qualifiedClass = serviceRef.addNewServiceRefType();
             qualifiedClass.setStringValue(webServiceRefType.getName());
             serviceRef.setServiceRefType(qualifiedClass);
         }
 
-        // service-ref-interface
-        if (!webServiceRefValue.equals(Object.class)) {
-            FullyQualifiedClassType qualifiedClass = serviceRef.addNewServiceInterface();
-            qualifiedClass.setStringValue(webServiceRefValue.getName());
-            serviceRef.setServiceInterface(qualifiedClass);
-        } else {
-            FullyQualifiedClassType qualifiedClass = serviceRef.addNewServiceInterface();
-            qualifiedClass.setStringValue(webServiceRefType.getName());
-            serviceRef.setServiceInterface(qualifiedClass);
+        // mapped-name
+        if (!serviceRef.isSetMappedName() && annotation.mappedName().trim().length()
> 0) {
+            XsdStringType mappedName = serviceRef.addNewMappedName();
+            mappedName.setStringValue(annotation.mappedName().trim());
+            serviceRef.setMappedName(mappedName);
         }
 
-        //------------------------------------------------------------------------------
-        // <service-ref> optional elements:
-        //------------------------------------------------------------------------------
-
         // WSDL document location
-        String documentAnnotation = annotation.wsdlLocation();
-        if (!documentAnnotation.equals("")) {
-            XsdAnyURIType wsdlFile = serviceRef.addNewWsdlFile();
-            wsdlFile.setStringValue(documentAnnotation);
-            serviceRef.setWsdlFile(wsdlFile);
+        if (!serviceRef.isSetWsdlFile()) {
+            String wsdlLocation = annotation.wsdlLocation();
+            
+            if (wsdlLocation == null || wsdlLocation.trim().length() == 0) {
+                WebServiceClient wsClient = null;
+                if (Object.class.equals(webServiceRefValue)) {
+                    wsClient = (WebServiceClient) webServiceRefType.getAnnotation(WebServiceClient.class);
+                } else {
+                    wsClient = (WebServiceClient) webServiceRefValue.getAnnotation(WebServiceClient.class);
+                }
+                if (wsClient == null) {                    
+                    wsdlLocation = null;
+                } else {
+                    wsdlLocation = wsClient.wsdlLocation();
+                }
+            }
+            
+            if (wsdlLocation != null && wsdlLocation.trim().length() > 0) {
+                XsdAnyURIType wsdlFile = serviceRef.addNewWsdlFile();
+                wsdlFile.setStringValue(wsdlLocation);
+                serviceRef.setWsdlFile(wsdlFile);
+            }
         }
 
         if (method != null || field != null) {



Mime
View raw message