Author: jim.ma
Date: 2010-04-15 00:06:24 -0400 (Thu, 15 Apr 2010)
New Revision: 11991
Added:
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/AddressMetaData.java
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointMetaData.java
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointsFactory.java
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointsMetaData.java
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/JMSAddressMetaData.java
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/JMSDestinationMetaData.java
Log:
[JBWS-2971]:Add EndpointsMetaData
Added:
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/AddressMetaData.java
===================================================================
---
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/AddressMetaData.java
(rev 0)
+++
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/AddressMetaData.java 2010-04-15
04:06:24 UTC (rev 11991)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.metadata.endpoints;
+
+/**
+ * AddressMetaData.
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public abstract class AddressMetaData
+{
+
+}
Added:
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointMetaData.java
===================================================================
---
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointMetaData.java
(rev 0)
+++
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointMetaData.java 2010-04-15
04:06:24 UTC (rev 11991)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.metadata.endpoints;
+
+/**
+ * Meta data class contains the implementor and address information
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class EndpointMetaData
+{
+ //Endpoint name
+ private String name;
+
+ //Service name
+ private String serviceName = "";
+
+ //port name
+ private String portName = "";
+
+ //implementor class
+ private String implementor = "";
+
+ //wsdl location
+ private String wsdlLocation = "";
+
+ //endpoint address information
+ private AddressMetaData addressMetaData = null;
+
+ //parent component
+ private EndpointsMetaData endpointsMetaData = null;
+
+ public EndpointMetaData(EndpointsMetaData endpoints)
+ {
+ endpointsMetaData = endpoints;
+ }
+
+ public void addAddressMetaData(AddressMetaData address)
+ {
+ this.addressMetaData = address;
+ }
+
+ public AddressMetaData getAddressMetaData()
+ {
+ return addressMetaData;
+ }
+
+ public EndpointsMetaData getEndpointsMetaData()
+ {
+ return endpointsMetaData;
+ }
+
+ public String getImplementor()
+ {
+ return implementor;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getPortName()
+ {
+ return portName;
+ }
+
+ public String getServiceName()
+ {
+ return serviceName;
+ }
+
+ public String getWsdlLocation()
+ {
+ return wsdlLocation;
+ }
+
+ public void setImplementor(String implementor)
+ {
+ this.implementor = implementor;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setPortName(String portName)
+ {
+ this.portName = portName;
+ }
+
+ public void setServiceName(String serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+
+ public void setWsdlLocation(String wsdlLocation)
+ {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+}
Added:
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointsFactory.java
===================================================================
---
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointsFactory.java
(rev 0)
+++
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointsFactory.java 2010-04-15
04:06:24 UTC (rev 11991)
@@ -0,0 +1,233 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.metadata.endpoints;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.spi.deployment.UnifiedVirtualFile;
+import org.jboss.wsf.spi.metadata.endpoints.jms.JMSAddressMetaData;
+import org.jboss.wsf.spi.metadata.endpoints.jms.JMSDestinationMetaData;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * Endpoints OjbectModelFactory
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class EndpointsFactory implements ObjectModelFactory
+{
+ public static final String DESCRIPTOR_FILE = "jbossws-endpoints.xml";
+
+ private static final Logger log = Logger.getLogger(EndpointsFactory.class);
+
+ // The URL to the jbossws-endpoints.xml descriptor
+ private URL descriptorURL;
+
+ public EndpointsFactory(URL descriptorURL)
+ {
+ this.descriptorURL = descriptorURL;
+ }
+
+ /**
+ * Load jbossws-endpoints.xml under META-INF/
+ * , WEB-INF or /
+ *
+ * @param root virtual file root
+ * @return EndpointMetaData or <code>null</code> if it cannot be found
+ */
+ public static EndpointsMetaData loadFromVFSRoot(UnifiedVirtualFile root)
+ {
+ EndpointsMetaData endpoints = null;
+
+ UnifiedVirtualFile endpointsDD = null;
+ try
+ {
+ endpointsDD = root.findChild("META-INF/" + DESCRIPTOR_FILE);
+ }
+ catch (IOException e)
+ {
+ //
+ }
+
+ if (null == endpointsDD)
+ {
+ try
+ {
+ endpointsDD = root.findChild("WEB-INF/" + DESCRIPTOR_FILE);
+ }
+ catch (IOException e)
+ {
+ //
+ }
+ }
+
+ if (null == endpointsDD)
+ {
+ try
+ {
+ endpointsDD = root.findChild(DESCRIPTOR_FILE);
+ }
+ catch (IOException e)
+ {
+ //
+ }
+ }
+
+ if (endpointsDD != null)
+ {
+
+ URL endpointsUrl = endpointsDD.toURL();
+ try
+ {
+ InputStream is = endpointsUrl.openStream();
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+ ObjectModelFactory factory = new EndpointsFactory(endpointsUrl);
+ endpoints = (EndpointsMetaData) unmarshaller.unmarshal(is, factory, null);
+ is.close();
+ }
+ catch (Exception e)
+ {
+ log.error("Failed to unmarshall " + DESCRIPTOR_FILE);
+ throw new WebServiceException("Failed to unmarshall " +
DESCRIPTOR_FILE + "," + e.getMessage());
+ }
+ }
+
+ return endpoints;
+ }
+
+ /**
+ * 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)
+ {
+ EndpointsMetaData endpointsMetaData = new EndpointsMetaData(descriptorURL);
+ return endpointsMetaData;
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
+ {
+ return root;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(EndpointsMetaData endpoints, UnmarshallingContext navigator,
String namespaceURI,
+ String localName, Attributes attrs)
+ {
+ if ("endpoint".equals(localName))
+ {
+ EndpointMetaData endpoint = new EndpointMetaData(endpoints);
+ endpoint.setName(attrs.getValue("name"));
+ endpoint.setImplementor(attrs.getValue("implementor"));
+ endpoint.setPortName(attrs.getValue("portName"));
+ endpoint.setServiceName(attrs.getValue("serviceName"));
+ endpoint.setWsdlLocation(attrs.getValue("wsdlLocation"));
+ return endpoint;
+
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(EndpointsMetaData endpoints, EndpointMetaData endpoint,
UnmarshallingContext navigator,
+ String namespaceURI, String localName)
+ {
+ endpoints.addEndpointMetaData(endpoint);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(EndpointMetaData endpoint, UnmarshallingContext navigator,
String namespaceURI,
+ String localName, Attributes attrs)
+ {
+ if (JMSAddressMetaData.NAMESPACE_URI.equals(namespaceURI)
+ && JMSAddressMetaData.ADDRESS_LOCAL_NAME.equals(localName))
+ {
+ return new JMSAddressMetaData(endpoint);
+ }
+
+ else
+ return null;
+ }
+
+ /**
+ * Called when parsing character is complete.
+ */
+ public void addChild(EndpointMetaData endpoint, JMSAddressMetaData jmsAddress,
UnmarshallingContext navigator,
+ String namespaceURI, String localName)
+ {
+ endpoint.addAddressMetaData(jmsAddress);
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(JMSAddressMetaData jmsAddress, UnmarshallingContext navigator,
String namespaceURI,
+ String localName, Attributes attrs)
+ {
+ if ("requestDestination".equals(localName))
+ {
+ JMSDestinationMetaData requestDest = new JMSDestinationMetaData();
+ requestDest.setName(attrs.getValue("name"));
+ jmsAddress.setRequestDestination(requestDest);
+ return requestDest;
+ }
+ else if ("replyDestination".equals(localName))
+ {
+ JMSDestinationMetaData replyDest = new JMSDestinationMetaData();
+ replyDest.setName(attrs.getValue("name"));
+ jmsAddress.setReplyDestination(replyDest);
+ return replyDest;
+ }
+ else
+ return null;
+ }
+
+ /**
+ * Called when parsing of a new element started.
+ */
+ public Object newChild(JMSDestinationMetaData jmsDestination, UnmarshallingContext
navigator, String namespaceURI,
+ String localName, Attributes attrs)
+ {
+ if ("property".equals(localName))
+ jmsDestination.setProperty(attrs.getValue("name"),
attrs.getValue("value"));
+ return null;
+ }
+
+}
Added:
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointsMetaData.java
===================================================================
---
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointsMetaData.java
(rev 0)
+++
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/EndpointsMetaData.java 2010-04-15
04:06:24 UTC (rev 11991)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.metadata.endpoints;
+
+import java.net.URL;
+import java.util.ArrayList;
+
+/**
+ * <p>Stack independent top level meta data class from jbossws-endpoints.xml.
</p>
+ * <p>This class contains the following example xml content : </p>
+ * <pre>
+ * <jaxws:endpoints
xmlns:jaxws="http://jbossws.jboss.org/jaxws"
+ *
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ *
xmlns:jms="http://jbossws.jboss.org/jaxws/transport/jms"
+ *
xsi:schemaLocation="http://jbossws.jboss.org/jaxws jaxws.xsd
http://jbossws.jboss.org/jaxws/transport/jms jms.xsd">
+ * <jaxws:endpoint implementor="" name=""
portName=""
+ * serviceName="" wsdlLocation="">
+ * <jms:Address>
+ * <jms:requestDestination name="test">
+ * <jms:property name="" value="" />
+ * <jms:property name="" value="" />
+ * </jms:requestDestination>
+
+ * <jms:replyDestination name="test">
+ * <jms:property name="" value="" />
+ * <jms:property name="" value="" />
+ * </jms:replyDestination>
+ * </jms:Address>
+ * </jaxws:endpoint>
+ * </jaxws:endpoints>
+ * </pre>
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+
+public class EndpointsMetaData
+{
+ //The endpoints list
+ private ArrayList<EndpointMetaData> endpointsMetaData = new
ArrayList<EndpointMetaData>();
+
+ //The jbossws-endpoint.xml location
+ private URL descriptorURL;
+
+ public EndpointsMetaData()
+ {
+ }
+
+ public EndpointsMetaData(URL descriptorURL)
+ {
+ this.descriptorURL = descriptorURL;
+ }
+
+ public URL getDescriptorURL()
+ {
+ return descriptorURL;
+ }
+
+ public void addEndpointMetaData(EndpointMetaData endpointMetaData)
+ {
+ endpointsMetaData.add(endpointMetaData);
+ }
+}
Added:
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/JMSAddressMetaData.java
===================================================================
---
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/JMSAddressMetaData.java
(rev 0)
+++
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/JMSAddressMetaData.java 2010-04-15
04:06:24 UTC (rev 11991)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.metadata.endpoints.jms;
+
+import org.jboss.wsf.spi.metadata.endpoints.AddressMetaData;
+import org.jboss.wsf.spi.metadata.endpoints.EndpointMetaData;
+
+/**
+ * JMSAddressMetaData.
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class JMSAddressMetaData extends AddressMetaData
+{
+ public static final String NAMESPACE_URI =
"http://jbossws.jboss.org/jaxws/transport/jms";
+
+ public static final String ADDRESS_LOCAL_NAME = "Address";
+
+ private EndpointMetaData endpoint;
+
+ private JMSDestinationMetaData requestDestination;
+
+ private JMSDestinationMetaData replyDestination;
+
+ public JMSAddressMetaData(EndpointMetaData endpoint)
+ {
+ this.endpoint = endpoint;
+ }
+
+ public EndpointMetaData getEndpoint()
+ {
+ return endpoint;
+ }
+
+ public JMSDestinationMetaData getReplyDestination()
+ {
+ return replyDestination;
+ }
+
+ public JMSDestinationMetaData getRequestDestination()
+ {
+ return requestDestination;
+ }
+
+ public void setReplyDestination(JMSDestinationMetaData replyDestination)
+ {
+ this.replyDestination = replyDestination;
+ }
+
+ public void setRequestDestination(JMSDestinationMetaData requestDestination)
+ {
+ this.requestDestination = requestDestination;
+ }
+}
Added:
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/JMSDestinationMetaData.java
===================================================================
---
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/JMSDestinationMetaData.java
(rev 0)
+++
spi/branches/jms-integration/src/main/java/org/jboss/wsf/spi/metadata/endpoints/jms/JMSDestinationMetaData.java 2010-04-15
04:06:24 UTC (rev 11991)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.wsf.spi.metadata.endpoints.jms;
+
+import java.util.Properties;
+
+/**
+ * JMSDestinationMetaData.
+ *
+ * @author <a href="ema(a)redhat.com">Jim Ma</a>
+ */
+public class JMSDestinationMetaData
+{
+ private String name;
+
+ private Properties properties = new Properties();;
+
+ public JMSDestinationMetaData()
+ {
+
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public void setProperty(String name, String value)
+ {
+ properties.put(name, value);
+ }
+
+ public String getProperty(String name) {
+ return (String)properties.get(name);
+ }
+
+ public Properties getProperties() {
+ return properties;
+ }
+}