Author: remm
Date: Thu Apr  6 07:13:54 2006
New Revision: 391991

URL: http://svn.apache.org/viewcvs?rev=391991&view=rev
Log:
- Add "support" (note: not in NamingContextListener yet) for service-ref (after 
all, there's support
  for all other elements, so ...).
- Submitted by Fabien Carrion.

Added:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/ContextService.java
Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebRuleSet.java

Added: tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/ContextService.java
URL: 
http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/ContextService.java?rev=391991&view=auto
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/ContextService.java 
(added)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/ContextService.java 
Thu Apr  6 07:13:54 2006
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.catalina.deploy;
+
+import java.io.Serializable;
+
+/**
+ * Representation of a web service reference for a web application, as
+ * represented in a <code>&lt;service-ref&gt;</code> element in the
+ * deployment descriptor.
+ *
+ * @author Fabien Carrion
+ * @version $Revision: 303342 $ $Date: 2005-03-15 23:29:49 -0700 (Web, 15 Mar 
2006) $
+ */
+
+public class ContextService extends ResourceBase implements Serializable {
+
+
+    // ------------------------------------------------------------- Properties
+
+
+    /**
+     * The WebService reference name.
+     */
+    private String displayname = null;
+
+    public String getDisplayname() {
+        return (this.displayname);
+    }
+
+    public void setDisplayname(String displayname) {
+        this.displayname = displayname;
+    }
+
+    /**
+     * An icon for this WebService.
+     */
+    private String icon = null;
+
+    public String getIcon() {
+        return (this.icon);
+    }
+
+    public void setIcon(String icon) {
+        this.icon = icon;
+    }
+
+    /**
+     * An icon for this WebService.
+     */
+    private String serviceinterface = null;
+
+    public String getServiceinterface() {
+        return (this.serviceinterface);
+    }
+
+    public void setServiceinterface(String serviceinterface) {
+        this.serviceinterface = serviceinterface;
+    }
+
+    /**
+     * Contains the location (relative to the root of
+     * the module) of the web service WSDL description.
+     */
+    private String wsdlfile = null;
+
+    public String getWsdlfile() {
+        return (this.wsdlfile);
+    }
+
+    public void setWsdlfile(String wsdlfile) {
+        this.wsdlfile = wsdlfile;
+    }
+
+    /**
+     * A file specifying the correlation of the WSDL definition
+     * to the interfaces (Service Endpoint Interface, Service Interface). 
+     */
+    private String jaxrpcmappingfile = null;
+
+    public String getJaxrpcmappingfile() {
+        return (this.jaxrpcmappingfile);
+    }
+
+    public void setJaxrpcmappingfile(String jaxrpcmappingfile) {
+        this.jaxrpcmappingfile = jaxrpcmappingfile;
+    }
+
+    /**
+     * Declares the specific WSDL service element that is being referred to.
+     * It is not specified if no wsdl-file is declared or if WSDL contains only
+     * 1 service element.
+     *
+     * A service-qname is composed by a namespaceURI and a localpart.
+     * It must be defined if more than 1 service is declared in the WSDL.
+     *
+     * serviceqname[0] : namespaceURI
+     * serviceqname[1] : localpart
+     */
+    private String[] serviceqname = new String[2];
+
+    public String[] getServiceqname() {
+        return (this.serviceqname);
+    }
+
+    public void setServiceqname(String[] serviceqname) {
+        this.serviceqname = serviceqname;
+    }
+
+    public void setServiceqname(String serviceqname, int i) {
+        this.serviceqname[i] = serviceqname;
+    }
+
+    public void setNamespaceURI(String namespaceuri) {
+        this.serviceqname[0] = namespaceuri;
+    }
+
+    public void setLocalpart(String localpart) {
+        this.serviceqname[1] = localpart;
+    }
+
+    /**
+     * Declares a client dependency on the container to resolving a Service 
Endpoint Interface
+     * to a WSDL port. It optionally associates the Service Endpoint Interface 
with a
+     * particular port-component.
+     *
+     * portcomponent[0] : service-endpoint-interface
+     * portcomponent[1] : port-component-link
+     */
+    private String[] portcomponent = new String[2];
+
+    public String[] getPortcomponent() {
+        return (this.portcomponent);
+    }
+
+    public void setPortcomponent(String[] portcomponent) {
+        this.portcomponent = portcomponent;
+    }
+
+    public void setPortcomponent(String portcomponent, int i) {
+        this.portcomponent[i] = portcomponent;
+    }
+
+    public void setServiceendpoint(String serviceendpoint) {
+        this.portcomponent[0] = serviceendpoint;
+    }
+
+    public void setPortlink(String portlink) {
+        this.portcomponent[1] = portlink;
+    }
+
+    /**
+     * A list of Handler to use for this service-ref.
+     *
+     * The instanciation of the handler have to be done.
+     */
+    private String handler = null;
+
+    public String getHandler() {
+        return (this.handler);
+    }
+
+    public void setHandler(String handler) {
+        this.handler = handler;
+    }
+
+
+    // --------------------------------------------------------- Public Methods
+
+
+    /**
+     * Return a String representation of this object.
+     */
+    public String toString() {
+
+        StringBuffer sb = new StringBuffer("ContextService[");
+        sb.append("name=");
+        sb.append(getName());
+        if (getDescription() != null) {
+            sb.append(", description=");
+            sb.append(getDescription());
+        }
+        if (getType() != null) {
+            sb.append(", type=");
+            sb.append(getType());
+        }
+        if (displayname != null) {
+            sb.append(", displayname=");
+            sb.append(displayname);
+        }
+        if (icon != null) {
+            sb.append(", icon=");
+            sb.append(icon);
+        }
+        if (wsdlfile != null) {
+            sb.append(", wsdl-file=");
+            sb.append(wsdlfile);
+        }
+        if (jaxrpcmappingfile != null) {
+            sb.append(", jaxrpc-mapping-file=");
+            sb.append(jaxrpcmappingfile);
+        }
+        if (serviceqname != null) {
+            sb.append(", service-qname=");
+            sb.append(serviceqname);
+        }
+        if (portcomponent != null) {
+            sb.append(", port-component=");
+            sb.append(portcomponent);
+        }
+        if (handler != null) {
+            sb.append(", handler=");
+            sb.append(handler);
+        }
+        sb.append("]");
+        return (sb.toString());
+
+    }
+
+}

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java
URL: 
http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java?rev=391991&r1=391990&r2=391991&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/deploy/NamingResources.java 
Thu Apr  6 07:13:54 2006
@@ -108,10 +108,16 @@
 
 
     /**
+     * The web service references for this web application, keyed by name.
+     */
+    private HashMap services = new HashMap();
+
+
+    /**
      * The transaction for this webapp.
      */
     private ContextTransaction transaction = null;
-    
+
 
     /**
      * The property change support for this component.
@@ -325,6 +331,28 @@
 
 
     /**
+     * Add a web service reference for this web application.
+     *
+     * @param service New web service reference
+     */
+    public void addService(ContextService service) {
+        
+        if (entries.containsKey(service.getName())) {
+            return;
+        } else {
+            entries.put(service.getName(), service.getType());
+        }
+        
+        synchronized (services) {
+            service.setNamingResources(this);
+            services.put(service.getName(), service);
+        }
+        support.firePropertyChange("service", null, service);
+        
+    }
+
+
+    /**
      * Return the EJB resource reference with the specified name, if any;
      * otherwise, return <code>null</code>.
      *
@@ -533,6 +561,35 @@
 
 
     /**
+     * Return the web service reference for the specified
+     * name, if any; otherwise return <code>null</code>.
+     *
+     * @param name Name of the desired web service
+     */
+    public ContextService findService(String name) {
+
+        synchronized (services) {
+            return ((ContextService) services.get(name));
+        }
+
+    }
+
+
+    /**
+     * Return the defined web service references for this application.  If
+     * none have been defined, a zero-length array is returned.
+     */
+    public ContextService[] findServices() {
+        
+        synchronized (services) {
+            ContextService results[] = new ContextService[services.size()];
+            return ((ContextService[]) services.values().toArray(results));
+        }
+        
+    }
+
+
+    /**
      * Return true if the name specified already exists.
      */
     public boolean exists(String name) {
@@ -699,6 +756,27 @@
             resourceLink.setNamingResources(null);
         }
 
+    }
+
+
+    /**
+     * Remove any web service reference with the specified name.
+     *
+     * @param name Name of the web service reference to remove
+     */
+    public void removeService(String name) {
+        
+        entries.remove(name);
+        
+        ContextService service = null;
+        synchronized (services) {
+            service = (ContextService) services.remove(name);
+        }
+        if (service != null) {
+            support.firePropertyChange("service", service, null);
+            service.setNamingResources(null);
+        }
+        
     }
 
 

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebRuleSet.java
URL: 
http://svn.apache.org/viewcvs/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebRuleSet.java?rev=391991&r1=391990&r2=391991&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebRuleSet.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/WebRuleSet.java Thu 
Apr  6 07:13:54 2006
@@ -369,6 +369,40 @@
         digester.addCallMethod(prefix + "web-app/security-role/role-name",
                                "addSecurityRole", 0);
 
+        digester.addObjectCreate(prefix + "web-app/service-ref",
+                                 "org.apache.catalina.deploy.ContextService");
+        digester.addRule(prefix + "web-app/service-ref",
+                         new SetNextNamingRule("addService",
+                         "org.apache.catalina.deploy.ContextService"));
+        
+        digester.addCallMethod(prefix + "web-app/service-ref/description",
+                               "setDescription", 0);
+        digester.addCallMethod(prefix + "web-app/service-ref/display-name",
+                               "setDisplayname", 0);
+        digester.addCallMethod(prefix + "web-app/service-ref/icon",
+                               "setIcon", 0);
+        digester.addCallMethod(prefix + "web-app/service-ref/service-ref-name",
+                               "setName", 0);
+        digester.addCallMethod(prefix + 
"web-app/service-ref/service-interface",
+                               "setServiceinterface", 0);
+        digester.addCallMethod(prefix + "web-app/service-ref/wsdl-file",
+                               "setWsdlfile", 0);
+        digester.addCallMethod(prefix + 
"web-app/service-ref/jaxrpc-mapping-file",
+                               "setJaxrpcmappingfile", 0);
+        digester.addCallMethod(prefix + 
"web-app/service-ref/service-qname/namespaceURI",
+                               "setNamespaceURI", 0);
+        digester.addCallMethod(prefix + 
"web-app/service-ref/service-qname/localpart",
+                               "setLocalpart", 0);
+        digester.addCallMethod(prefix + 
+                               
"web-app/service-ref/port-component/service-endpoint-interface",
+                               "setServiceendpoint", 0);
+        digester.addCallMethod(prefix + 
"web-app/service-ref/port-component/port-component-link",
+                               "setPortlink", 0);
+        digester.addCallMethod(prefix + "web-app/service-ref/handler",
+                               "setHandler", 0);
+        digester.addCallMethod(prefix + "web-app/service-ref/service-ref-type",
+                               "setType", 0);
+        
         digester.addRule(prefix + "web-app/servlet",
                          new WrapperCreateRule());
         digester.addSetNext(prefix + "web-app/servlet",



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to