Author: thomas.diesler(a)jboss.com
Date: 2007-03-09 09:14:08 -0500 (Fri, 09 Mar 2007)
New Revision: 2572
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceRefHandlerJAXRPC.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefElement.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefHandler.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefMetaData.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/ServiceRefMetaDataParser.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedCallPropertyMetaData.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerMetaData.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java
Log:
Unified service-ref handling for jboss50
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.client;
+
+// $Id$
+
+import java.lang.reflect.AnnotatedElement;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxrpc.client.ServiceRefHandlerJAXRPC;
+import org.jboss.ws.core.jaxws.client.ServiceRefHandlerJAXWS;
+import org.jboss.ws.integration.ServiceRefElement;
+import org.jboss.ws.integration.ServiceRefHandler;
+import org.jboss.ws.integration.ServiceRefMetaData;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * Bind service refs in the client's ENC for every service-ref element in the
+ * deployment descriptor.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Nov-2006
+ */
+public class ServiceRefHandlerImpl implements ServiceRefHandler
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceRefHandlerImpl.class);
+
+ private ServiceRefObjectFactory objectFactory = new ServiceRefObjectFactory();
+
+ public ServiceRefMetaData newServiceRefMetaData()
+ {
+ return new UnifiedServiceRefMetaData();
+ }
+
+ public void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot,
ServiceRefMetaData sref) throws NamingException
+ {
+ if (sref.isProcessed())
+ {
+ log.warn("Attempt to rebind service-ref: " + sref);
+ return;
+ }
+
+ UnifiedServiceRefMetaData serviceRef = (UnifiedServiceRefMetaData)sref;
+ serviceRef.setVfsRoot(vfsRoot);
+ try
+ {
+ if (isServiceRefJaxRpc(serviceRef))
+ {
+ ServiceRefHandlerJAXRPC handler = new ServiceRefHandlerJAXRPC();
+ handler.setupServiceRef(encCtx, encName, serviceRef);
+ }
+ else
+ {
+ AnnotatedElement anElement = sref.getAnnotatedElement();
+ ServiceRefHandlerJAXWS handler = new ServiceRefHandlerJAXWS();
+ handler.setupServiceRef(encCtx, encName, anElement, serviceRef);
+ }
+ }
+ finally
+ {
+ sref.setProcessed(true);
+ }
+ }
+
+ public Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
+ {
+ return objectFactory.newChild(ref, navigator, namespaceURI, localName, attrs);
+ }
+
+ public void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
+ {
+ objectFactory.setValue(ref, navigator, namespaceURI, localName, value);
+ }
+
+ private boolean isServiceRefJaxRpc(UnifiedServiceRefMetaData serviceRef)
+ {
+ // The <service-interface> is a required element
+ // for JAXRPC and not defined for JAXWS
+ return serviceRef.getServiceInterface() != null;
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,298 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.client;
+
+// $Id$
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.integration.ServiceRefElement;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedCallPropertyMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerChainsMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedHandlerMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedInitParamMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedPortComponentRefMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedStubPropertyMetaData;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * A object model factory for <service-ref>
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ */
+public class ServiceRefObjectFactory
+{
+ public Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (ref instanceof UnifiedHandlerChainsMetaData)
+ child = newChild((UnifiedHandlerChainsMetaData)ref, navigator, namespaceURI,
localName, attrs);
+ else if (ref instanceof UnifiedHandlerMetaData)
+ child = newChild((UnifiedHandlerMetaData)ref, navigator, namespaceURI,
localName, attrs);
+ else if (ref instanceof UnifiedPortComponentRefMetaData)
+ child = newChild((UnifiedPortComponentRefMetaData)ref, navigator, namespaceURI,
localName, attrs);
+ else if (ref instanceof UnifiedServiceRefMetaData)
+ child = newChild((UnifiedServiceRefMetaData)ref, navigator, namespaceURI,
localName, attrs);
+ return child;
+ }
+
+ public void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
+ {
+ if (ref instanceof UnifiedCallPropertyMetaData)
+ setValue((UnifiedCallPropertyMetaData)ref, navigator, namespaceURI, localName,
value);
+ else if (ref instanceof UnifiedHandlerChainMetaData)
+ setValue((UnifiedHandlerChainMetaData)ref, navigator, namespaceURI, localName,
value);
+ else if (ref instanceof UnifiedHandlerMetaData)
+ setValue((UnifiedHandlerMetaData)ref, navigator, namespaceURI, localName,
value);
+ else if (ref instanceof UnifiedInitParamMetaData)
+ setValue((UnifiedInitParamMetaData)ref, navigator, namespaceURI, localName,
value);
+ else if (ref instanceof UnifiedPortComponentRefMetaData)
+ setValue((UnifiedPortComponentRefMetaData)ref, navigator, namespaceURI,
localName, value);
+ else if (ref instanceof UnifiedServiceRefMetaData)
+ setValue((UnifiedServiceRefMetaData)ref, navigator, namespaceURI, localName,
value);
+ else if (ref instanceof UnifiedStubPropertyMetaData)
+ setValue((UnifiedStubPropertyMetaData)ref, navigator, namespaceURI, localName,
value);
+
+ }
+
+ private void setValue(UnifiedServiceRefMetaData ref, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ /* Standard properties */
+ if (localName.equals("service-ref-name"))
+ {
+ ref.setServiceRefName(value);
+ }
+ else if (localName.equals("service-interface"))
+ {
+ ref.setServiceInterface(value);
+ }
+ else if (localName.equals("service-ref-type"))
+ {
+ ref.setServiceRefType(value);
+ }
+ else if (localName.equals("wsdl-file"))
+ {
+ ref.setWsdlFile(value);
+ }
+ else if (localName.equals("jaxrpc-mapping-file"))
+ {
+ ref.setMappingFile(value);
+ }
+ else if (localName.equals("service-qname"))
+ {
+ ref.setServiceQName(QName.valueOf(value));
+ }
+
+ /* JBoss properties */
+ else if (localName.equals("service-impl-class"))
+ {
+ ref.setServiceImplClass(value);
+ }
+ else if (localName.equals("config-name"))
+ {
+ ref.setConfigName(value);
+ }
+ else if (localName.equals("config-file"))
+ {
+ ref.setConfigFile(value);
+ }
+ else if (localName.equals("wsdl-override"))
+ {
+ ref.setWsdlOverride(value);
+ }
+ else if (localName.equals("handler-chain"))
+ {
+ ref.setHandlerChain(value);
+ }
+ }
+
+ private Object newChild(UnifiedServiceRefMetaData ref, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("port-component-ref"))
+ {
+ child = new UnifiedPortComponentRefMetaData(ref);
+ ref.addPortComponentRef((UnifiedPortComponentRefMetaData)child);
+ }
+ else if (localName.equals("handler"))
+ {
+ child = new UnifiedHandlerMetaData();
+ ref.addHandler((UnifiedHandlerMetaData)child);
+ }
+ else if (localName.equals("handler-chains"))
+ {
+ child = new UnifiedHandlerChainsMetaData();
+ ref.setHandlerChains((UnifiedHandlerChainsMetaData)child);
+ }
+ else if (localName.equals("call-property"))
+ {
+ child = new UnifiedCallPropertyMetaData();
+ ref.addCallProperty((UnifiedCallPropertyMetaData)child);
+ }
+ return child;
+ }
+
+ private Object newChild(UnifiedHandlerChainsMetaData ref, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("handler-chain"))
+ {
+ child = new UnifiedHandlerChainMetaData();
+ ref.addHandlerChain((UnifiedHandlerChainMetaData)child);
+ }
+ return child;
+ }
+
+ private void setValue(UnifiedPortComponentRefMetaData ref, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
+ {
+ if (localName.equals("service-endpoint-interface"))
+ {
+ ref.setServiceEndpointInterface(value);
+ }
+ else if (localName.equals("enable-mtom"))
+ {
+ ref.setEnableMTOM(Boolean.valueOf(value));
+ }
+ else if (localName.equals("port-component-link"))
+ {
+ ref.setPortComponentLink(value);
+ }
+ else if (localName.equals("port-qname"))
+ {
+ ref.setPortQName(QName.valueOf(value));
+ }
+ else if (localName.equals("config-name"))
+ {
+ ref.setConfigName(value);
+ }
+ else if (localName.equals("config-file"))
+ {
+ ref.setConfigFile(value);
+ }
+ }
+
+ private Object newChild(UnifiedPortComponentRefMetaData ref, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("call-property"))
+ {
+ child = new UnifiedCallPropertyMetaData();
+ ref.addCallProperty((UnifiedCallPropertyMetaData)child);
+ }
+ if (localName.equals("stub-property"))
+ {
+ child = new UnifiedStubPropertyMetaData();
+ ref.addStubProperty((UnifiedStubPropertyMetaData)child);
+ }
+ return child;
+ }
+
+ private void setValue(UnifiedHandlerChainMetaData ref, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ if (localName.equals("service-name-pattern"))
+ {
+ ref.setServiceNamePattern(QName.valueOf(value));
+ }
+ else if (localName.equals("port-name-pattern"))
+ {
+ ref.setPortNamePattern(QName.valueOf(value));
+ }
+ else if (localName.equals("protocol-binding"))
+ {
+ ref.setProtocolBindings(value);
+ }
+ }
+
+ private void setValue(UnifiedHandlerMetaData ref, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ if (localName.equals("handler-name"))
+ {
+ ref.setHandlerName(value);
+ }
+ else if (localName.equals("handler-class"))
+ {
+ ref.setHandlerClass(value);
+ }
+ else if (localName.equals("soap-header"))
+ {
+ ref.addSoapHeader(navigator.resolveQName(value));
+ }
+ else if (localName.equals("soap-role"))
+ {
+ ref.addSoapRole(value);
+ }
+ else if (localName.equals("port-name"))
+ {
+ ref.addPortName(value);
+ }
+ }
+
+ private Object newChild(UnifiedHandlerMetaData ref, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("init-param"))
+ {
+ child = new UnifiedInitParamMetaData();
+ ref.addInitParam((UnifiedInitParamMetaData)child);
+ }
+ return child;
+ }
+
+ private void setValue(UnifiedInitParamMetaData ref, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ if (localName.equals("param-name"))
+ {
+ ref.setParamName(value);
+ }
+ else if (localName.equals("param-value"))
+ {
+ ref.setParamValue(value);
+ }
+ }
+
+ private void setValue(UnifiedCallPropertyMetaData ref, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ if (localName.equals("prop-name"))
+ {
+ ref.setPropName(value);
+ }
+ else if (localName.equals("prop-value"))
+ {
+ ref.setPropValue(value);
+ }
+ }
+
+ private void setValue(UnifiedStubPropertyMetaData ref, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ if (localName.equals("prop-name"))
+ {
+ ref.setPropName(value);
+ }
+ else if (localName.equals("prop-value"))
+ {
+ ref.setPropValue(value);
+ }
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceRefHandlerJAXRPC.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceRefHandlerJAXRPC.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceRefHandlerJAXRPC.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxrpc.client;
+
+// $Id$
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+
+/**
+ * Binds a JAXRPC Service object in the client's ENC for every service-ref element in
the
+ * deployment descriptor.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Nov-2006
+ */
+public class ServiceRefHandlerJAXRPC
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceRefHandlerJAXRPC.class);
+
+ /**
+ * Binds a Service into the callers ENC for every service-ref element
+ */
+ public void setupServiceRef(Context encCtx, String encName, UnifiedServiceRefMetaData
serviceRef) throws NamingException
+ {
+ String externalName = encCtx.getNameInNamespace() + "/" + encName;
+ log.info("setupServiceRef [jndi=" + externalName + "]");
+
+ // Do not use rebind, the binding should be unique
+ ServiceReferenceable ref = new ServiceReferenceable(serviceRef);
+ Util.bind(encCtx, encName, ref);
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxrpc/client/ServiceRefHandlerJAXRPC.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws.client;
+
+// $Id$
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jws.HandlerChain;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+
+/**
+ * Binds a JAXWS Service object in the client's ENC
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 17-Jan-2007
+ */
+public class ServiceRefHandlerJAXWS
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceRefHandlerJAXWS.class);
+
+ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement
anElement, UnifiedServiceRefMetaData serviceRef) throws NamingException
+ {
+ WebServiceRef wsref = null;
+
+ // Build the list of @WebServiceRef relevant annotations
+ List<WebServiceRef> wsrefList = new ArrayList<WebServiceRef>();
+ if (anElement != null)
+ {
+ for (Annotation an : anElement.getAnnotations())
+ {
+ if (an instanceof WebServiceRef)
+ wsrefList.add((WebServiceRef)an);
+
+ if (an instanceof WebServiceRefs)
+ {
+ WebServiceRefs wsrefs = (WebServiceRefs)an;
+ for (WebServiceRef aux : wsrefs.value())
+ wsrefList.add(aux);
+ }
+ }
+ }
+
+ // Use the single @WebServiceRef
+ if (wsrefList.size() == 1)
+ {
+ wsref = wsrefList.get(0);
+ }
+ else
+ {
+ for (WebServiceRef aux : wsrefList)
+ {
+ if (encName.endsWith("/" + aux.name()))
+ {
+ wsref = aux;
+ break;
+ }
+ }
+ }
+
+ Class targetClass = null;
+ if (anElement instanceof Field)
+ targetClass = ((Field)anElement).getType();
+ else if (anElement instanceof Method)
+ targetClass = ((Method)anElement).getParameterTypes()[0];
+
+ String targetClassName = (targetClass != null ? targetClass.getName() : null);
+ String externalName = encCtx.getNameInNamespace() + "/" + encName;
+ log.info("setupServiceRef [jndi=" + externalName + ",target=" +
targetClassName + "]");
+
+ String serviceImplClass = null;
+
+ // #1 Use the explicit @WebServiceRef.value
+ if (wsref != null && wsref.value() != Object.class)
+ serviceImplClass = wsref.value().getName();
+
+ // #2 Use the target ref type
+ if (serviceImplClass == null && targetClass != null &&
Service.class.isAssignableFrom(targetClass))
+ serviceImplClass = targetClass.getName();
+
+ // #3 Use javax.xml.ws.Service
+ if (serviceImplClass == null)
+ serviceImplClass = Service.class.getName();
+
+ // #1 Use the explicit @WebServiceRef.type
+ if (wsref != null && wsref.type() != Object.class)
+ targetClassName = wsref.type().getName();
+
+ // #2 Use the target ref type
+ if (targetClassName == null && targetClass != null &&
Service.class.isAssignableFrom(targetClass) == false)
+ targetClassName = targetClass.getName();
+
+ // Set the wsdlLocation if there is no override already
+ if (serviceRef.getWsdlOverride() == null && wsref != null &&
wsref.wsdlLocation().length() > 0)
+ serviceRef.setWsdlOverride(wsref.wsdlLocation());
+
+ // Set the handlerChain from @HandlerChain on the annotated element
+ String handlerChain = serviceRef.getHandlerChain();
+ if (anElement != null)
+ {
+ HandlerChain anHandlerChain = anElement.getAnnotation(HandlerChain.class);
+ if (handlerChain == null && anHandlerChain != null &&
anHandlerChain.file().length() > 0)
+ handlerChain = anHandlerChain.file();
+ }
+
+ // Resolve path to handler chain
+ if (handlerChain != null)
+ {
+ try
+ {
+ new URL(handlerChain);
+ }
+ catch (MalformedURLException ex)
+ {
+ Class declaringClass = null;
+ if (anElement instanceof Field)
+ declaringClass = ((Field)anElement).getDeclaringClass();
+ else if (anElement instanceof Method)
+ declaringClass = ((Method)anElement).getDeclaringClass();
+ else if (anElement instanceof Class)
+ declaringClass = (Class)anElement;
+
+ handlerChain = declaringClass.getPackage().getName().replace('.',
'/') + "/" + handlerChain;
+ }
+
+ serviceRef.setHandlerChain(handlerChain);
+ }
+
+ // Do not use rebind, the binding should be unique
+ // [JBWS-1499] - Revisit WebServiceRefHandler JNDI rebind
+ Util.rebind(encCtx, encName, new ServiceReferenceable(serviceImplClass,
targetClassName, serviceRef));
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefElement.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefElement.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefElement.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration;
+
+// $Id$
+
+import java.io.Serializable;
+
+/**
+ * A marker for all <service-ref> related objects.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 08-Mar-2007
+ */
+public abstract class ServiceRefElement implements Serializable
+{
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefElement.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefHandler.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefHandler.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefHandler.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration;
+
+// $Id$
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * An implementation of this interface handles all service-ref binding concerns
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 05-May-2004
+ */
+public interface ServiceRefHandler
+{
+ String BEAN_NAME = "ServiceRefHandler";
+
+ ServiceRefMetaData newServiceRefMetaData();
+
+ Object newChild(ServiceRefElement ref, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs);
+
+ void setValue(ServiceRefElement ref, UnmarshallingContext navigator, String
namespaceURI, String localName, String value);
+
+ void bindServiceRef(Context encCtx, String encName, UnifiedVirtualFile vfsRoot,
ServiceRefMetaData sref) throws NamingException;
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.integration;
+
+// $Id$
+
+import java.io.Serializable;
+import java.lang.reflect.AnnotatedElement;
+
+import org.w3c.dom.Element;
+
+/**
+ * An abstract service-ref meta data object.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 08-Mar-2007
+ */
+public abstract class ServiceRefMetaData extends ServiceRefElement implements
Serializable
+{
+ public abstract String getServiceRefName();
+
+ public abstract void setServiceRefName(String name);
+
+ public abstract AnnotatedElement getAnnotatedElement();
+
+ public abstract void setAnnotatedElement(AnnotatedElement anElement);
+
+ public abstract boolean isProcessed();
+
+ public abstract void setProcessed(boolean flag);
+
+ public abstract void importStandardXml(Element element);
+
+ public abstract void importJBossXml(Element element);
+
+ public abstract void merge(ServiceRefMetaData targetRef);
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/integration/ServiceRefMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,162 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * A JBossXB factory for jsr181 the HandlerChain annotation
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 15-Oct-2005
+ */
+public class HandlerChainsObjectFactory implements ObjectModelFactory
+{
+ // provide logging
+ private static final Logger log = Logger.getLogger(HandlerChainsObjectFactory.class);
+
+ public HandlerChainsObjectFactory()
+ {
+ }
+
+ /**
+ * This method is called on the factory by the object model builder when the parsing
starts.
+ *
+ * @return the root of the object model.
+ */
+ public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
+ {
+ UnifiedHandlerChainsMetaData handlerConfigMetaData = new
UnifiedHandlerChainsMetaData(HandlerType.ENDPOINT);
+ return handlerConfigMetaData;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
+ {
+ return root;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(UnifiedHandlerChainsMetaData handlerConfig,
UnmarshallingContext navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("handler-chain".equals(localName))
+ return new UnifiedHandlerChainMetaData(handlerConfig);
+ else
+ return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(UnifiedHandlerChainsMetaData handlerConfig,
UnifiedHandlerChainMetaData handlerChain, UnmarshallingContext navigator, String
namespaceURI, String localName)
+ {
+ handlerConfig.addHandlerChain(handlerChain);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(UnifiedHandlerChainMetaData chainConfig, UnmarshallingContext
navigator, String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("handler".equals(localName))
+ return new UnifiedHandlerMetaData(chainConfig);
+ else
+ return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(UnifiedHandlerChainMetaData handlerConfig, UnifiedHandlerMetaData
handler, UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ handlerConfig.addHandler(handler);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
+ {
+ if ("init-param".equals(localName))
+ return new UnifiedInitParamMetaData();
+ else return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(UnifiedHandlerMetaData handler, UnifiedInitParamMetaData param,
UnmarshallingContext navigator, String namespaceURI, String localName)
+ {
+ handler.addInitParam(param);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML
content.
+ */
+ public void setValue(UnifiedHandlerChainMetaData handlerChain, UnmarshallingContext
navigator, String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedHandlerChainMetaData setValue: nuri=" + namespaceURI
+ " localName=" + localName + " value=" + value);
+
+ if (localName.equals("protocol-bindings"))
+ handlerChain.setProtocolBindings(value);
+ else if (localName.equals("service-name-pattern"))
+ handlerChain.setServiceNamePattern(navigator.resolveQName(value));
+ else if (localName.equals("port-name-pattern"))
+ handlerChain.setPortNamePattern(navigator.resolveQName(value));
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML
content.
+ */
+ public void setValue(UnifiedHandlerMetaData handler, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedHandlerMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
+
+ if (localName.equals("handler-name"))
+ handler.setHandlerName(value);
+ else if (localName.equals("handler-class"))
+ handler.setHandlerClass(value);
+ }
+
+ /**
+ * Called when a new simple child element with text value was read from the XML
content.
+ */
+ public void setValue(UnifiedInitParamMetaData param, UnmarshallingContext navigator,
String namespaceURI, String localName, String value)
+ {
+ if (log.isTraceEnabled())
+ log.trace("UnifiedInitParamMetaData setValue: nuri=" + namespaceURI +
" localName=" + localName + " value=" + value);
+
+ if (localName.equals("param-name"))
+ param.setParamName(value);
+ else if (localName.equals("param-value"))
+ param.setParamValue(value);
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/HandlerChainsObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/ServiceRefMetaDataParser.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/ServiceRefMetaDataParser.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/ServiceRefMetaDataParser.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,200 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.xb.QNameBuilder;
+import org.w3c.dom.Element;
+
+/**
+ * The metdata data from service-ref element in web.xml, ejb-jar.xml, and
+ * application-client.xml.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class ServiceRefMetaDataParser
+{
+ public void importStandardXml(Element root, UnifiedServiceRefMetaData sref)
+ {
+ sref.setServiceRefName(getElementContent(root, "service-ref-name"));
+ sref.setServiceInterface(getOptionalElementContent(root,
"service-interface"));
+ sref.setWsdlFile(getOptionalElementContent(root, "wsdl-file"));
+ sref.setMappingFile(getOptionalElementContent(root,
"jaxrpc-mapping-file"));
+
+ Element child = DOMUtils.getFirstChildElement(root, "service-qname");
+ if (child != null)
+ sref.setServiceQName(QNameBuilder.buildQName(child, getTextContent(child)));
+
+ // Parse the port-component-ref elements
+ Iterator iterator = DOMUtils.getChildElements(root,
"port-component-ref");
+ while (iterator.hasNext())
+ {
+ Element pcrefElement = (Element)iterator.next();
+ UnifiedPortComponentRefMetaData pcrefMetaData = new
UnifiedPortComponentRefMetaData(sref);
+ pcrefMetaData.importStandardXml(pcrefElement);
+ sref.addPortComponentRef(pcrefMetaData);
+ }
+
+ // Parse the handler elements
+ iterator = DOMUtils.getChildElements(root, "handler");
+ while (iterator.hasNext())
+ {
+ Element handlerElement = (Element)iterator.next();
+ UnifiedHandlerMetaData handlerMetaData = new UnifiedHandlerMetaData();
+ handlerMetaData.importStandardXml(handlerElement);
+ sref.addHandler(handlerMetaData);
+ }
+ }
+
+ public void importJBossXml(Element root, UnifiedServiceRefMetaData sref)
+ {
+ sref.setConfigName(getOptionalElementContent(root, "config-name"));
+ sref.setConfigFile(getOptionalElementContent(root, "config-file"));
+ sref.setWsdlOverride(getOptionalElementContent(root, "wsdl-override"));
+
+ // Parse the port-component-ref elements
+ Iterator iterator = DOMUtils.getChildElements(root,
"port-component-ref");
+ while (iterator.hasNext())
+ {
+ Element pcrefElement = (Element)iterator.next();
+ String seiName = getOptionalElementContent(pcrefElement,
"service-endpoint-interface");
+ if (seiName != null)
+ {
+ UnifiedPortComponentRefMetaData pcref = sref.getPortComponentRef(seiName);
+ if (pcref == null)
+ {
+ // Its ok to only have the <port-component-ref> in jboss.xml and not
in ejb-jar.xml
+ pcref = new UnifiedPortComponentRefMetaData(sref);
+ pcref.importStandardXml(pcrefElement);
+ sref.addPortComponentRef(pcref);
+ }
+ pcref.importJBossXml(pcrefElement);
+ }
+ }
+
+ // Parse the call-property elements
+ iterator = DOMUtils.getChildElements(root, "call-property");
+ while (iterator.hasNext())
+ {
+ Element propElement = (Element)iterator.next();
+ String name = getElementContent(propElement, "prop-name");
+ String value = getElementContent(propElement, "prop-value");
+ sref.addCallProperty(new UnifiedCallPropertyMetaData(name, value));
+ }
+ }
+
+ public void importStandardXml(Element root, UnifiedPortComponentRefMetaData pcref)
+ {
+ pcref.setServiceEndpointInterface(getOptionalElementContent(root,
"service-endpoint-interface"));
+ pcref.setPortComponentLink(getOptionalElementContent(root,
"port-component-link"));
+ }
+
+ public void importJBossXml(Element root, UnifiedPortComponentRefMetaData pcref)
+ {
+ // Look for call-property elements
+ Iterator iterator = DOMUtils.getChildElements(root, "call-property");
+ while (iterator.hasNext())
+ {
+ Element propElement = (Element)iterator.next();
+ String name = getElementContent(propElement, "prop-name");
+ String value = getElementContent(propElement, "prop-value");
+ pcref.addCallProperty(new UnifiedCallPropertyMetaData(name, value));
+ }
+ }
+
+ public void importStandardXml(Element root, UnifiedHandlerMetaData href)
+ {
+ href.setHandlerName(getElementContent(root, "handler-name"));
+ href.setHandlerClass(getElementContent(root, "handler-class"));
+
+ // Parse the init-param elements
+ Iterator iterator = DOMUtils.getChildElements(root, "init-param");
+ while (iterator.hasNext())
+ {
+ Element paramElement = (Element)iterator.next();
+ UnifiedInitParamMetaData param = new UnifiedInitParamMetaData();
+ param.setParamName(getElementContent(paramElement, "param-name"));
+ param.setParamValue(getElementContent(paramElement, "param-value"));
+ href.addInitParam(param);
+ }
+
+ // Parse the soap-header elements
+ iterator = DOMUtils.getChildElements(root, "soap-header");
+ while (iterator.hasNext())
+ {
+ Element headerElement = (Element)iterator.next();
+ String content = getTextContent(headerElement);
+ QName qname = QNameBuilder.buildQName(headerElement, content);
+ href.addSoapHeader(qname);
+ }
+
+ // Parse the soap-role elements
+ iterator = DOMUtils.getChildElements(root, "soap-role");
+ while (iterator.hasNext())
+ {
+ Element roleElement = (Element)iterator.next();
+ String content = getTextContent(roleElement);
+ href.addSoapRole(content);
+ }
+
+ // Parse the port-name elements
+ iterator = DOMUtils.getChildElements(root, "port-name");
+ while (iterator.hasNext())
+ {
+ Element portElement = (Element)iterator.next();
+ String content = getTextContent(portElement);
+ href.addPortName(content);
+ }
+ }
+
+ private String getElementContent(Element element, String childName)
+ {
+ String childValue = getOptionalElementContent(element, childName);
+ if (childValue == null || childValue.length() == 0)
+ throw new IllegalStateException("Invalid null element content: " +
childName);
+
+ return childValue;
+ }
+
+ private String getOptionalElementContent(Element element, String childName)
+ {
+ return getTextContent(DOMUtils.getFirstChildElement(element, childName));
+ }
+
+ private String getTextContent(Element element)
+ {
+ String content = null;
+ if (element != null)
+ {
+ content = DOMUtils.getTextContent(element);
+ if (content != null)
+ content = content.trim();
+ }
+ return content;
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/ServiceRefMetaDataParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedCallPropertyMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedCallPropertyMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedCallPropertyMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import org.jboss.ws.integration.ServiceRefElement;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 06-May-2004
+ */
+public class UnifiedCallPropertyMetaData extends ServiceRefElement
+{
+ // The required <prop-name> element
+ private String propName;
+ // The required <prop-value> element
+ private String propValue;
+
+ public UnifiedCallPropertyMetaData(String propName, String propValue)
+ {
+ this.propName = propName;
+ this.propValue = propValue;
+ }
+
+ public UnifiedCallPropertyMetaData()
+ {
+ }
+
+ public String getPropName()
+ {
+ return propName;
+ }
+
+ public void setPropName(String paramName)
+ {
+ this.propName = paramName;
+ }
+
+ public String getPropValue()
+ {
+ return propValue;
+ }
+
+ public void setPropValue(String paramValue)
+ {
+ this.propValue = paramValue;
+ }
+
+ public String toString()
+ {
+ return "[name=" + propName + ",value=" + propValue +
"]";
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedCallPropertyMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.integration.ServiceRefElement;
+
+/** The unified metdata data for a handler chain element
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class UnifiedHandlerChainMetaData extends ServiceRefElement
+{
+ private UnifiedHandlerChainsMetaData handlerChains;
+
+ private QName serviceNamePattern;
+ private QName portNamePattern;
+ private String protocolBindings;
+ private List<UnifiedHandlerMetaData> handlers = new
ArrayList<UnifiedHandlerMetaData>();
+
+ public UnifiedHandlerChainMetaData(UnifiedHandlerChainsMetaData handlerChains)
+ {
+ this.handlerChains = handlerChains;
+ }
+
+ public UnifiedHandlerChainMetaData()
+ {
+ }
+
+ public QName getPortNamePattern()
+ {
+ return portNamePattern;
+ }
+
+ public void setPortNamePattern(QName portNamePattern)
+ {
+ this.portNamePattern = portNamePattern;
+ }
+
+ public QName getServiceNamePattern()
+ {
+ return serviceNamePattern;
+ }
+
+ public void setServiceNamePattern(QName serviceNamePattern)
+ {
+ this.serviceNamePattern = serviceNamePattern;
+ }
+
+ public String getProtocolBindings()
+ {
+ return protocolBindings;
+ }
+
+ public void setProtocolBindings(String protocolBindings)
+ {
+ this.protocolBindings = protocolBindings;
+ }
+
+ public List<UnifiedHandlerMetaData> getHandlers()
+ {
+ return handlers;
+ }
+
+ public void addHandler(UnifiedHandlerMetaData handler)
+ {
+ handlers.add(handler);
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.ws.integration.ServiceRefElement;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/** The unified metdata data for a handler chains element
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class UnifiedHandlerChainsMetaData extends ServiceRefElement
+{
+ private HandlerType handlerType;
+ private List<UnifiedHandlerChainMetaData> handlerChains = new
ArrayList<UnifiedHandlerChainMetaData>();
+
+ public UnifiedHandlerChainsMetaData(HandlerType endpoint)
+ {
+ this.handlerType = handlerType;
+ }
+
+ public UnifiedHandlerChainsMetaData()
+ {
+ }
+
+ public List<UnifiedHandlerChainMetaData> getHandlerChains()
+ {
+ return handlerChains;
+ }
+
+ public void addHandlerChain(UnifiedHandlerChainMetaData handlerChain)
+ {
+ handlerChains.add(handlerChain);
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerChainsMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedHandlerMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.integration.ServiceRefElement;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXRPC;
+import org.jboss.ws.metadata.umdm.HandlerMetaDataJAXWS;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+import org.w3c.dom.Element;
+
+/** The unified metdata data for a handler element
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @version $Revision$
+ */
+public class UnifiedHandlerMetaData extends ServiceRefElement
+{
+ private UnifiedHandlerChainMetaData handlerChain;
+
+ // The required <handler-name> element
+ private String handlerName;
+ // The required <handler-class> element
+ private String handlerClass;
+ // The optional <init-param> elements
+ private List<UnifiedInitParamMetaData> initParams = new
ArrayList<UnifiedInitParamMetaData>();
+ // The optional <soap-header> elements
+ private Set<QName> soapHeaders = new HashSet<QName>();
+ // The optional <soap-role> elements
+ private Set<String> soapRoles = new HashSet<String>();
+ // The optional <port-name> elements, these only apply to webserve clients
+ private Set<String> portNames = new HashSet<String>();
+
+ public UnifiedHandlerMetaData(UnifiedHandlerChainMetaData handlerChain)
+ {
+ this.handlerChain = handlerChain;
+ }
+
+ public UnifiedHandlerMetaData()
+ {
+ }
+
+ public void setHandlerName(String value)
+ {
+ this.handlerName = value;
+ }
+
+ public String getHandlerName()
+ {
+ return handlerName;
+ }
+
+ public void setHandlerClass(String handlerClass)
+ {
+ this.handlerClass = handlerClass;
+ }
+
+ public String getHandlerClass()
+ {
+ return handlerClass;
+ }
+
+ public void addInitParam(UnifiedInitParamMetaData param)
+ {
+ initParams.add(param);
+ }
+
+ public List<UnifiedInitParamMetaData> getInitParams()
+ {
+ return initParams;
+ }
+
+ public void addSoapHeader(QName qName)
+ {
+ soapHeaders.add(qName);
+ }
+
+ public Set<QName> getSoapHeaders()
+ {
+ return soapHeaders;
+ }
+
+ public void addSoapRole(String value)
+ {
+ soapRoles.add(value);
+ }
+
+ public Set<String> getSoapRoles()
+ {
+ return soapRoles;
+ }
+
+ public Set<String> getPortNames()
+ {
+ return portNames;
+ }
+
+ public void addPortName(String value)
+ {
+ portNames.add(value);
+ }
+
+ public HandlerMetaDataJAXRPC getHandlerMetaDataJAXRPC (EndpointMetaData epMetaData,
HandlerType type)
+ {
+ HandlerMetaDataJAXRPC hmd = new HandlerMetaDataJAXRPC(epMetaData, type);
+ hmd.setHandlerName(getHandlerName());
+ hmd.setHandlerClassName(getHandlerClass());
+ hmd.seiInitParams(getInitParams());
+ hmd.setSoapHeaders(getSoapHeaders());
+ hmd.setSoapRoles(getSoapRoles());
+ hmd.setPortNames(getPortNames());
+ return hmd;
+ }
+
+ public HandlerMetaDataJAXWS getHandlerMetaDataJAXWS (EndpointMetaData epMetaData,
HandlerType type)
+ {
+ HandlerMetaDataJAXWS hmd = new HandlerMetaDataJAXWS(epMetaData, type);
+ hmd.setHandlerName(getHandlerName());
+ hmd.setHandlerClassName(getHandlerClass());
+ hmd.seiInitParams(getInitParams());
+ if (handlerChain != null)
+ {
+ hmd.setProtocolBindings(handlerChain.getProtocolBindings());
+ hmd.setServiceNamePattern(handlerChain.getServiceNamePattern());
+ hmd.setPortNamePattern(handlerChain.getPortNamePattern());
+ }
+ return hmd;
+ }
+
+ public void importStandardXml(Element root)
+ {
+ new ServiceRefMetaDataParser().importStandardXml(root, this);
+ }
+}
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import org.jboss.ws.integration.ServiceRefElement;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 06-May-2004
+ */
+public class UnifiedInitParamMetaData extends ServiceRefElement
+{
+ // The required <param-name> element
+ private String paramName;
+ // The required <param-value> element
+ private String paramValue;
+
+ public String getParamName()
+ {
+ return paramName;
+ }
+
+ public void setParamName(String paramName)
+ {
+ this.paramName = paramName;
+ }
+
+ public String getParamValue()
+ {
+ return paramValue;
+ }
+
+ public void setParamValue(String paramValue)
+ {
+ this.paramValue = paramValue;
+ }
+
+ public String toString()
+ {
+ return "[name=" + paramName + ",value=" + paramValue +
"]";
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedInitParamMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedPortComponentRefMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,191 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.integration.ServiceRefElement;
+import org.w3c.dom.Element;
+
+/** The metdata data from service-ref/port-component-ref element in web.xml, ejb-jar.xml,
and application-client.xml.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class UnifiedPortComponentRefMetaData extends ServiceRefElement
+{
+ // The parent service-ref
+ private UnifiedServiceRefMetaData serviceRefMetaData;
+
+ // The required <service-endpoint-interface> element
+ private String serviceEndpointInterface;
+ // The optional <enable-mtom> element
+ private Boolean enableMTOM;
+ // The optional <port-component-link> element
+ private String portComponentLink;
+ // The optional <port-qname> element
+ private QName portQName;
+ // Arbitrary proxy properties given by <call-property>
+ private List<UnifiedCallPropertyMetaData> callProperties = new
ArrayList<UnifiedCallPropertyMetaData>();
+ // Arbitrary proxy properties given by <stub-property>
+ private List<UnifiedStubPropertyMetaData> stubProperties = new
ArrayList<UnifiedStubPropertyMetaData>();
+ // The optional JBossWS config-name
+ private String configName;
+ // The optional JBossWS config-file
+ private String configFile;
+
+ public UnifiedPortComponentRefMetaData(UnifiedServiceRefMetaData serviceRefMetaData)
+ {
+ this.serviceRefMetaData = serviceRefMetaData;
+ }
+
+ public void merge(UnifiedPortComponentRefMetaData pcref)
+ {
+ portQName = pcref.portQName;
+ configName = pcref.configName;
+ configFile = pcref.configFile;
+ callProperties = pcref.callProperties;
+ stubProperties = pcref.stubProperties;
+ }
+
+ public UnifiedServiceRefMetaData getServiceRefMetaData()
+ {
+ return serviceRefMetaData;
+ }
+
+ public Boolean getEnableMTOM()
+ {
+ return enableMTOM;
+ }
+
+ public void setEnableMTOM(Boolean enableMTOM)
+ {
+ this.enableMTOM = enableMTOM;
+ }
+
+ /**
+ * The port-component-link element links a port-component-ref
+ * to a specific port-component required to be made available
+ * by a service reference.
+ *
+ * The value of a port-component-link must be the
+ * port-component-name of a port-component in the same module
+ * or another module in the same application unit. The syntax
+ * for specification follows the syntax defined for ejb-link
+ * in the EJB 2.0 specification.
+ */
+ public String getPortComponentLink()
+ {
+ return portComponentLink;
+ }
+
+ public void setPortComponentLink(String portComponentLink)
+ {
+ this.portComponentLink = portComponentLink;
+ }
+
+ public String getServiceEndpointInterface()
+ {
+ return serviceEndpointInterface;
+ }
+
+ public void setServiceEndpointInterface(String serviceEndpointInterface)
+ {
+ this.serviceEndpointInterface = serviceEndpointInterface;
+ }
+
+ public QName getPortQName()
+ {
+ return portQName;
+ }
+
+ public void setPortQName(QName portQName)
+ {
+ this.portQName = portQName;
+ }
+
+ public List<UnifiedCallPropertyMetaData> getCallProperties()
+ {
+ return callProperties;
+ }
+
+ public void setCallProperties(List<UnifiedCallPropertyMetaData> callProps)
+ {
+ callProperties = callProps;
+ }
+
+ public void addCallProperty(UnifiedCallPropertyMetaData callProp)
+ {
+ callProperties.add(callProp);
+ }
+
+ public List<UnifiedStubPropertyMetaData> getStubProperties()
+ {
+ return stubProperties;
+ }
+
+ public void setStubProperties(List<UnifiedStubPropertyMetaData> stubProps)
+ {
+ stubProperties = stubProps;
+ }
+
+ public void addStubProperty(UnifiedStubPropertyMetaData stubProp)
+ {
+ stubProperties.add(stubProp);
+ }
+
+ public String getConfigFile()
+ {
+ return configFile;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ this.configFile = configFile;
+ }
+
+ public String getConfigName()
+ {
+ return configName;
+ }
+
+ public void setConfigName(String configName)
+ {
+ this.configName = configName;
+ }
+
+ public void importStandardXml(Element root)
+ {
+ new ServiceRefMetaDataParser().importStandardXml(root, this);
+ }
+
+ public void importJBossXml(Element root)
+ {
+ new ServiceRefMetaDataParser().importJBossXml(root, this);
+ }
+}
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,399 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import java.lang.reflect.AnnotatedElement;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.integration.ServiceRefMetaData;
+import org.jboss.ws.integration.UnifiedVirtualFile;
+import org.jboss.xb.QNameBuilder;
+import org.w3c.dom.Element;
+
+/**
+ * The metdata data from service-ref element in web.xml, ejb-jar.xml, and
+ * application-client.xml.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ */
+public class UnifiedServiceRefMetaData extends ServiceRefMetaData
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(UnifiedServiceRefMetaData.class);
+
+ private UnifiedVirtualFile vfsRoot;
+
+ // Standard properties
+
+ // The required <service-ref-name> element
+ private String serviceRefName;
+ // The JAXRPC required <service-interface> element
+ private String serviceInterface;
+ // service-res-type
+ private String serviceRefType;
+ // The optional <wsdl-file> element
+ private String wsdlFile;
+ // The optional <jaxrpc-mapping-file> element
+ private String mappingFile;
+ // The optional <service-qname> element
+ private QName serviceQName;
+ // The LinkedHashMap<String, PortComponentRefMetaData> for
<port-component-ref> elements
+ private Map<String, UnifiedPortComponentRefMetaData> portComponentRefs = new
LinkedHashMap<String, UnifiedPortComponentRefMetaData>();
+ // The optional <handler> elements. JAX-RPC handlers declared in the standard
J2EE1.4 descriptor
+ private List<UnifiedHandlerMetaData> handlers = new
ArrayList<UnifiedHandlerMetaData>();
+ // The optional <handler-chains> elements. JAX-WS handlers declared in the
standard JavaEE5 descriptor
+ private UnifiedHandlerChainsMetaData handlerChains;
+
+ // JBoss properties
+
+ // The optional <service-impl-class> element
+ private String serviceImplClass;
+ // The optional JBossWS config-name
+ private String configName;
+ // The optional JBossWS config-file
+ private String configFile;
+ // The optional URL of the actual WSDL to use, <wsdl-override>
+ private String wsdlOverride;
+ // The optional <handler-chain> element. JAX-WS handler chain declared in the
JBoss JavaEE5 descriptor
+ private String handlerChain;
+ // Arbitrary proxy properties given by <call-property>
+ private List<UnifiedCallPropertyMetaData> callProperties = new
ArrayList<UnifiedCallPropertyMetaData>();
+
+ private transient AnnotatedElement anElement;
+ private transient boolean processed;
+
+ public UnifiedServiceRefMetaData(UnifiedVirtualFile vfRoot)
+ {
+ this.vfsRoot = vfRoot;
+ }
+
+ public UnifiedServiceRefMetaData()
+ {
+ }
+
+ @Override
+ public void merge(ServiceRefMetaData sref)
+ {
+ UnifiedServiceRefMetaData sourceRef = (UnifiedServiceRefMetaData)sref;
+ serviceImplClass = sourceRef.serviceImplClass;
+ configName = sourceRef.configName;
+ configFile = sourceRef.configFile;
+ wsdlOverride = sourceRef.wsdlOverride;
+ handlerChain = sourceRef.handlerChain;
+ callProperties = sourceRef.callProperties;
+
+ if (serviceQName == null && sourceRef.serviceQName != null)
+ serviceQName = sourceRef.serviceQName;
+
+ for (UnifiedPortComponentRefMetaData pcref : sourceRef.getPortComponentRefs())
+ {
+ String seiName = pcref.getServiceEndpointInterface();
+ if (seiName == null)
+ {
+ log.warn("Ignore <port-component-ref> with null
<service-endpoint-interface>");
+ continue;
+ }
+
+ UnifiedPortComponentRefMetaData targetPCRef = portComponentRefs.get(seiName);
+ if (targetPCRef == null)
+ {
+ log.warn("Cannot find port component ref with SEI name: " +
seiName);
+ addPortComponentRef(pcref);
+ targetPCRef = pcref;
+ }
+
+ targetPCRef.merge(pcref);
+ }
+ }
+
+ public UnifiedVirtualFile getVfsRoot()
+ {
+ return vfsRoot;
+ }
+
+ public void setVfsRoot(UnifiedVirtualFile vfsRoot)
+ {
+ this.vfsRoot = vfsRoot;
+ }
+
+ public String getServiceRefName()
+ {
+ return serviceRefName;
+ }
+
+ public void setServiceRefName(String serviceRefName)
+ {
+ this.serviceRefName = serviceRefName;
+ }
+
+ public String getMappingFile()
+ {
+ return mappingFile;
+ }
+
+ public void setMappingFile(String mappingFile)
+ {
+ this.mappingFile = mappingFile;
+ }
+
+ public URL getMappingLocation()
+ {
+ URL mappingURL = null;
+ if (mappingFile != null)
+ {
+ try
+ {
+ mappingURL = vfsRoot.findChild(mappingFile).toURL();
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot find jaxrcp-mapping-file: " +
mappingFile, e);
+ }
+ }
+ return mappingURL;
+ }
+
+ public Collection<UnifiedPortComponentRefMetaData> getPortComponentRefs()
+ {
+ return portComponentRefs.values();
+ }
+
+ public UnifiedPortComponentRefMetaData getPortComponentRef(String seiName)
+ {
+ UnifiedPortComponentRefMetaData ref = portComponentRefs.get(seiName);
+ return ref;
+ }
+
+ public void addPortComponentRef(UnifiedPortComponentRefMetaData pcRef)
+ {
+ portComponentRefs.put(pcRef.getServiceEndpointInterface(), pcRef);
+ }
+
+ public List<UnifiedHandlerMetaData> getHandlers()
+ {
+ return handlers;
+ }
+
+ public void addHandler(UnifiedHandlerMetaData handler)
+ {
+ handlers.add(handler);
+ }
+
+ public String getServiceInterface()
+ {
+ return serviceInterface;
+ }
+
+ public void setServiceInterface(String serviceInterface)
+ {
+ this.serviceInterface = serviceInterface;
+ }
+
+ public String getServiceImplClass()
+ {
+ return serviceImplClass;
+ }
+
+ public void setServiceImplClass(String serviceImplClass)
+ {
+ this.serviceImplClass = serviceImplClass;
+ }
+
+ public QName getServiceQName()
+ {
+ return serviceQName;
+ }
+
+ public void setServiceQName(QName serviceQName)
+ {
+ this.serviceQName = serviceQName;
+ }
+
+ public String getServiceRefType()
+ {
+ return serviceRefType;
+ }
+
+ public void setServiceRefType(String serviceResType)
+ {
+ this.serviceRefType = serviceResType;
+ }
+
+ public String getWsdlFile()
+ {
+ return wsdlFile;
+ }
+
+ public void setWsdlFile(String wsdlFile)
+ {
+ this.wsdlFile = wsdlFile;
+ }
+
+ public URL getWsdlLocation()
+ {
+ URL wsdlLocation = null;
+ if (wsdlOverride != null)
+ {
+ try
+ {
+ wsdlLocation = new URL(wsdlOverride);
+ }
+ catch (MalformedURLException e1)
+ {
+ try
+ {
+ wsdlLocation = vfsRoot.findChild(wsdlOverride).toURL();
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot find wsdl-override: " +
wsdlOverride, e);
+ }
+ }
+ }
+
+ if (wsdlLocation == null && wsdlFile != null)
+ {
+ try
+ {
+ wsdlLocation = vfsRoot.findChild(wsdlFile).toURL();
+ }
+ catch (Exception e)
+ {
+ throw new WSException("Cannot find wsdl-file: " + wsdlFile, e);
+ }
+ }
+
+ return wsdlLocation;
+ }
+
+ public String getConfigFile()
+ {
+ return configFile;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ this.configFile = configFile;
+ }
+
+ public String getConfigName()
+ {
+ return configName;
+ }
+
+ public void setConfigName(String configName)
+ {
+ this.configName = configName;
+ }
+
+ public String getWsdlOverride()
+ {
+ return wsdlOverride;
+ }
+
+ public void setWsdlOverride(String wsdlOverride)
+ {
+ this.wsdlOverride = wsdlOverride;
+ }
+
+ public List<UnifiedCallPropertyMetaData> getCallProperties()
+ {
+ return callProperties;
+ }
+
+ public void setCallProperties(List<UnifiedCallPropertyMetaData> callProps)
+ {
+ callProperties = callProps;
+ }
+
+ public void addCallProperty(UnifiedCallPropertyMetaData callProp)
+ {
+ callProperties.add(callProp);
+ }
+
+ public UnifiedHandlerChainsMetaData getHandlerChains()
+ {
+ return handlerChains;
+ }
+
+ public void setHandlerChains(UnifiedHandlerChainsMetaData handlerChains)
+ {
+ this.handlerChains = handlerChains;
+ }
+
+ public String getHandlerChain()
+ {
+ return handlerChain;
+ }
+
+ public void setHandlerChain(String handlerChain)
+ {
+ this.handlerChain = handlerChain;
+ }
+
+ public AnnotatedElement getAnnotatedElement()
+ {
+ return anElement;
+
+ }
+
+ public boolean isProcessed()
+ {
+ return processed;
+ }
+
+ public void setProcessed(boolean flag)
+ {
+ this.processed = flag;
+ }
+
+ public void setAnnotatedElement(AnnotatedElement anElement)
+ {
+ this.anElement = anElement;
+ }
+
+ @Override
+ public void importStandardXml(Element root)
+ {
+ new ServiceRefMetaDataParser().importStandardXml(root, this);
+ }
+
+ @Override
+ public void importJBossXml(Element root)
+ {
+ new ServiceRefMetaDataParser().importJBossXml(root, this);
+ }
+}
Added:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java 2007-03-09
14:14:08 UTC (rev 2572)
@@ -0,0 +1,63 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.ws.metadata.j2ee.serviceref;
+
+// $Id$
+
+import org.jboss.ws.integration.ServiceRefElement;
+
+/**
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 06-May-2004
+ */
+public class UnifiedStubPropertyMetaData extends ServiceRefElement
+{
+ // The required <prop-name> element
+ private String propName;
+ // The required <prop-value> element
+ private String propValue;
+
+ public String getPropName()
+ {
+ return propName;
+ }
+
+ public void setPropName(String paramName)
+ {
+ this.propName = paramName;
+ }
+
+ public String getPropValue()
+ {
+ return propValue;
+ }
+
+ public void setPropValue(String paramValue)
+ {
+ this.propValue = paramValue;
+ }
+
+ public String toString()
+ {
+ return "[name=" + propName + ",value=" + propValue +
"]";
+ }
+}
Property changes on:
branches/jbossws-1.2.0/jbossws-core/src/java/org/jboss/ws/metadata/j2ee/serviceref/UnifiedStubPropertyMetaData.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF