You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ews-dev@ws.apache.org by gu...@apache.org on 2005/08/08 14:42:47 UTC
svn commit: r230793 [6/12] - in /webservices/ews/trunk/ws4j2ee: ./ docs/
docs/images/ docs/src/ samples/ samples/clients/ samples/ejb/
samples/ejb/bookquote/ samples/ejb/bookquote/META-INF/
samples/ejb/bookquote/com/ samples/ejb/bookquote/com/jwsbook/ ...
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFHandlerImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFHandlerImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFHandlerImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFHandlerImpl.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.IconType;
+import com.sun.java.xml.ns.j2Ee.ParamValueType;
+import com.sun.java.xml.ns.j2Ee.PortComponentHandlerType;
+import com.sun.java.xml.ns.j2Ee.XsdQNameType;
+import org.apache.ws.ews.context.webservices.server.impl.AbstractWSCFHandler;
+import org.apache.ws.ews.context.webservices.server.WSCFHandler;
+import org.apache.ws.ews.context.webservices.server.WSCFInitParam;
+
+/**
+ * This encapsulates the layer 3 handler element of the webservices.xml. This
+ * is also the concrete implementation of the WSCFHandler.
+ */
+public class WSCFHandlerImpl extends AbstractWSCFHandler implements WSCFHandler {
+ public WSCFHandlerImpl(PortComponentHandlerType handler) {
+ this.description = XMLBeansUtils.getStringValue(handler.getDescriptionArray());
+ this.displayName = XMLBeansUtils.getStringValue(handler.getDisplayNameArray());
+ IconType[] icons = handler.getIconArray();
+ if (icons.length > 0) {
+ this.smallIcon = XMLBeansUtils.getStringValue(icons[0].getSmallIcon());
+ this.largeIcon = XMLBeansUtils.getStringValue(icons[0].getLargeIcon());
+ }
+ this.handlerName = XMLBeansUtils.getStringValue(handler.getHandlerName());
+ this.handlerClass = XMLBeansUtils.getStringValue(handler.getHandlerName());
+ ParamValueType[] list = handler.getInitParamArray();
+ for (int i = 0; i < list.length; i++) {
+ WSCFInitParam initParameters = new WSCFInitParamImpl(list[i]);
+ this.initParam.put(initParameters.getParamName(), initParameters);
+ }
+ XsdQNameType[] list2 = handler.getSoapHeaderArray();
+ for (int i = 0; i < list2.length; i++) {
+ this.soapHeader.add(new WSCFSOAPHeaderImpl(list2[i]));
+ }
+ com.sun.java.xml.ns.j2Ee.String[] list3 = handler.getSoapRoleArray();
+ for (int i = 0; i < list3.length; i++) {
+ this.soapRole.add(XMLBeansUtils.getStringValue(list3[i]));
+ }
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFInitParamImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFInitParamImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFInitParamImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFInitParamImpl.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.ParamValueType;
+import org.apache.ws.ews.context.webservices.server.impl.AbstractWSCFInitParam;
+import org.apache.ws.ews.context.webservices.server.WSCFInitParam;
+
+/**
+ * This will encapsulate the init parameter element and the information will be able access
+ * using the interface published.
+ */
+public class WSCFInitParamImpl extends AbstractWSCFInitParam implements WSCFInitParam {
+
+ public WSCFInitParamImpl(ParamValueType param) {
+ this.paramName = XMLBeansUtils.getStringValue(param.getParamName());
+ this.paramValue = XMLBeansUtils.getStringValue(param.getParamValue());
+ this.description = XMLBeansUtils.getStringValue(param.getDescriptionArray());
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFPortComponentImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFPortComponentImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFPortComponentImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFPortComponentImpl.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.IconType;
+import com.sun.java.xml.ns.j2Ee.PortComponentHandlerType;
+import com.sun.java.xml.ns.j2Ee.PortComponentType;
+import org.apache.ws.ews.context.webservices.server.impl.AbstractWSCFPortComponent;
+import org.apache.ws.ews.context.webservices.server.WSCFHandler;
+import org.apache.ws.ews.context.webservices.server.WSCFPortComponent;
+
+/**
+ * This encapsulates the level 2 Elemenr PortComponent which is a child element of the webservice-description element.
+ * It is also the concrete implmentation of the WSCFPortComponent.
+ */
+public class WSCFPortComponentImpl extends AbstractWSCFPortComponent implements WSCFPortComponent {
+
+ public WSCFPortComponentImpl(PortComponentType pc) {
+// /////////////assigning the values //////////////
+ this.description = XMLBeansUtils.getStringValue(pc.getDescription());
+ this.displayName = XMLBeansUtils.getStringValue(pc.getDisplayName());
+ IconType icon = pc.getIcon();
+ if (icon != null) {
+ this.smallIcon = XMLBeansUtils.getStringValue(icon.getSmallIcon());
+ this.largeIcon = XMLBeansUtils.getStringValue(icon.getLargeIcon());
+ }
+ this.portComponentName = XMLBeansUtils.getStringValue(pc.getPortComponentName());
+ this.serviceEndpointInterface = XMLBeansUtils.getStringValue(pc.getServiceEndpointInterface());
+ this.wsdlPort = new WSCFWSDLPortImpl(pc.getWsdlPort());
+ this.serviceImplBean = new WSCFServiceImplBeanImpl(pc.getServiceImplBean());
+ PortComponentHandlerType[] list = pc.getHandlerArray();
+ for (int i = 0; i < list.length; i++) {
+ WSCFHandler handler = new WSCFHandlerImpl(list[i]);
+ this.handlers.put(handler.getHandlerName(), handler);
+ }
+ }
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFSOAPHeaderImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFSOAPHeaderImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFSOAPHeaderImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFSOAPHeaderImpl.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.XsdQNameType;
+import org.apache.ws.ews.context.webservices.server.impl.AbstractWSCFSOAPHeader;
+import org.apache.ws.ews.context.webservices.server.WSCFSOAPHeader;
+
+/**
+ * This encapsulates the soap header of the handler element. The information about this element can be accessed uaing the interface published.
+ * Basically this is a Qname
+ */
+public class WSCFSOAPHeaderImpl extends AbstractWSCFSOAPHeader implements WSCFSOAPHeader {
+ public WSCFSOAPHeaderImpl(XsdQNameType header) {
+ if (null != header.getQNameValue()) {
+ this.localpart = header.getQNameValue().getLocalPart();
+ this.namespaceURI = header.getQNameValue().getNamespaceURI();
+ }
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFServiceImplBeanImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFServiceImplBeanImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFServiceImplBeanImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFServiceImplBeanImpl.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.ServiceImplBeanType;
+import org.apache.ws.ews.context.webservices.server.impl.AbstractWSCFServiceImplBean;
+import org.apache.ws.ews.context.webservices.server.WSCFServiceImplBean;
+
+/**
+ * This encapsulates the Service Implementation bean element whih is a level 3 elemet. This is the concrete implementation of teh
+ * WSCFServiceImplBean
+ */
+public class WSCFServiceImplBeanImpl extends AbstractWSCFServiceImplBean implements WSCFServiceImplBean {
+ public WSCFServiceImplBeanImpl(ServiceImplBeanType implbean) {
+ if (null == implbean) {
+ return;
+ }
+ this.ejblink = XMLBeansUtils.getStringValue(implbean.getEjbLink());
+ this.servletlink = XMLBeansUtils.getStringValue(implbean.getServletLink());
+ }
+
+ /**
+ * Gets the ejblink elemet of the service implementation bean element
+ *
+ * @return ejb link
+ */
+ public String getEjblink() {
+ return ejblink;
+ }
+
+ /**
+ * @return
+ */
+ public String getServletlink() {
+ return servletlink;
+ }
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWSDLPortImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWSDLPortImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWSDLPortImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWSDLPortImpl.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.XsdQNameType;
+import org.apache.ws.ews.context.webservices.server.impl.AbstractWSCFWSDLPort;
+import org.apache.ws.ews.context.webservices.server.WSCFWSDLPort;
+
+/**
+ * This encapsulates the Qname wsdlport name and this is the concrete implementation of the WSCFWSDLPort
+ */
+public class WSCFWSDLPortImpl extends AbstractWSCFWSDLPort implements WSCFWSDLPort {
+
+ public WSCFWSDLPortImpl(XsdQNameType wsdlport) {
+ if (null == wsdlport) {
+ return;
+ }
+ if (null != wsdlport.getQNameValue()) {
+ this.localpart = wsdlport.getQNameValue().getLocalPart();
+ this.namespaceURI = wsdlport.getQNameValue().getNamespaceURI();
+ }
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWebserviceDescriptionImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWebserviceDescriptionImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWebserviceDescriptionImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWebserviceDescriptionImpl.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.IconType;
+import com.sun.java.xml.ns.j2Ee.PortComponentType;
+import org.apache.ws.ews.context.webservices.server.impl.AbstractWSCFWebserviceDescription;
+import org.apache.ws.ews.context.webservices.server.impl.WSCFException;
+import org.apache.ws.ews.context.webservices.server.WSCFPortComponent;
+import org.apache.ws.ews.context.webservices.server.WSCFWebserviceDescription;
+
+/**
+ * This represents a level 1 element in the Element tree :webservice-description. This is the concrete implementation of the
+ * WSCFWebServiceDescription interface
+ */
+public class WSCFWebserviceDescriptionImpl extends AbstractWSCFWebserviceDescription implements WSCFWebserviceDescription {
+ public WSCFWebserviceDescriptionImpl(com.sun.java.xml.ns.j2Ee.WebserviceDescriptionType wsdes) throws WSCFException {
+ this.description = XMLBeansUtils.getStringValue(wsdes.getDescription());
+ this.displayName = XMLBeansUtils.getStringValue(wsdes.getDisplayName());
+ IconType icon = wsdes.getIcon();
+ if (icon != null) {
+ this.smallIcon = XMLBeansUtils.getStringValue(icon.getSmallIcon());
+ this.largeIcon = XMLBeansUtils.getStringValue(icon.getLargeIcon());
+ }
+ this.webserviceDescriptionName = XMLBeansUtils.getStringValue(wsdes.getWebserviceDescriptionName());
+ this.wsdlFile = XMLBeansUtils.getStringValue(wsdes.getWsdlFile());
+ this.jaxrpcMappingFile = XMLBeansUtils.getStringValue(wsdes.getJaxrpcMappingFile());
+ ;
+ PortComponentType[] list = wsdes.getPortComponentArray();
+ if (0 == list.length) {
+ throw new WSCFException("At least one port-component element should exist in the " + this.description + " webservices element.");
+ }
+ for (int i = 0; i < list.length; i++) {
+ WSCFPortComponent portComponent = new WSCFPortComponentImpl(list[i]);
+ this.portComponent.put(portComponent.getPortComponentName(), portComponent);
+ }
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWebservicesImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWebservicesImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWebservicesImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/WSCFWebservicesImpl.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.IconType;
+import com.sun.java.xml.ns.j2Ee.WebserviceDescriptionType;
+import com.sun.java.xml.ns.j2Ee.WebservicesType;
+import org.apache.ws.ews.context.webservices.server.impl.AbstractWSCFWebservices;
+import org.apache.ws.ews.context.webservices.server.impl.WSCFException;
+import org.apache.ws.ews.context.webservices.server.WSCFWebserviceDescription;
+import org.apache.ws.ews.context.webservices.server.WSCFWebservices;
+
+/**
+ * This is the class that will represent the webservices element in the runtime.
+ * This is the root element of the webservices.xml file. The parsing of elements will be initiated from here and will be
+ * parsed in a depth first manner
+ */
+public class WSCFWebservicesImpl extends AbstractWSCFWebservices implements WSCFWebservices {
+ /**
+ * Constructor
+ * This is the constructor that was written to make the code jaxb complient. THis class
+ * basically wrap the jaxb webservides element.
+ */
+ public WSCFWebservicesImpl(WebservicesType webservices) throws WSCFException {
+ this.description = XMLBeansUtils.getStringValue(webservices.getDescriptionArray());
+ this.displayName = XMLBeansUtils.getStringValue(webservices.getDisplayNameArray());
+ IconType[] icons = webservices.getIconArray();
+ if (icons.length > 0) {
+ this.smallIcon = XMLBeansUtils.getStringValue(icons[0].getSmallIcon());
+ this.largeIcon = XMLBeansUtils.getStringValue(icons[0].getLargeIcon());
+ }
+ WebserviceDescriptionType[] wsdes = webservices.getWebserviceDescriptionArray();
+ if (0 == wsdes.length) {
+ throw new WSCFException("The webservices description element does not exist");
+ }
+ for (int i = 0; i < wsdes.length; i++) {
+ WSCFWebserviceDescription webservicesDescription = new WSCFWebserviceDescriptionImpl(wsdes[i]);
+ this.webServiceDescriptions.put(webservicesDescription.getDisplayName(), webservicesDescription);
+ }
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/XMLBeansUtils.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/XMLBeansUtils.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/XMLBeansUtils.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/webservices/server/impl/xmlbeans/XMLBeansUtils.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.ews.ws4j2ee.context.webservices.server.impl.xmlbeans;
+
+import com.sun.java.xml.ns.j2Ee.XsdStringType;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class XMLBeansUtils {
+ public static String getStringValue(XsdStringType[] invalue) {
+ if (invalue.length > 0) {
+ return invalue[0].getStringValue();
+ } else {
+ return null;
+ }
+ }
+
+ public static String getStringValue(com.sun.java.xml.ns.j2Ee.String[] invalue) {
+ if (invalue.length > 0) {
+ return invalue[0].getStringValue();
+ } else {
+ return null;
+ }
+ }
+
+ public static String getStringValue(com.sun.java.xml.ns.j2Ee.String invalue) {
+ if (invalue != null) {
+ return invalue.getStringValue();
+ } else {
+ return null;
+ }
+ }
+
+ public static String getStringValue(XsdStringType invalue) {
+ if (invalue != null) {
+ return invalue.getStringValue();
+ } else {
+ return null;
+ }
+ }
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/ElementInfo.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/ElementInfo.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/ElementInfo.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/ElementInfo.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.context.wsdl;
+
+import javax.xml.namespace.QName;
+
+/**
+ * <p>This is basically the org.apache.axis.ElementDecl (code cut and pasted).
+ * this represent a <element> entry in the schema.</p>
+ */
+public class ElementInfo {
+ /* name of the element */
+ private QName name;
+ /* type of the element can be from anonymous|type|ref */
+ private QName type;
+
+ private int minOccurs = 0;
+ private int maxOccurs = 1;
+
+ private boolean nillable = false;
+
+ // Indicate if the ElementDecl represents
+ // an xsd:any element
+ private boolean anyElement = false;
+
+ public ElementInfo() {
+ }
+
+ public ElementInfo(QName name, QName type) {
+ this.type = type;
+ this.name = name;
+ }
+
+ public QName getType() {
+ return type;
+ }
+
+ public void setType(QName type) {
+ this.type = type;
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public void setName(QName name) {
+ this.name = name;
+ }
+
+ public boolean getMinOccursIs0() {
+ return (minOccurs == 0);
+ }
+
+ public void setNillable(boolean nillable) {
+ this.nillable = nillable;
+ }
+
+ public boolean getNillable() {
+ return nillable;
+ }
+
+ /**
+ * @return
+ */
+ public int getMaxOccurs() {
+ return maxOccurs;
+ }
+
+ /**
+ * @return
+ */
+ public int getMinOccurs() {
+ return minOccurs;
+ }
+
+ /**
+ * @param i
+ */
+ public void setMaxOccurs(int i) {
+ maxOccurs = i;
+ }
+
+ /**
+ * @param i
+ */
+ public void setMinOccurs(int i) {
+ minOccurs = i;
+ }
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/WSDLContext.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/WSDLContext.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/WSDLContext.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/WSDLContext.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.context.wsdl;
+
+import org.apache.axis.wsdl.symbolTable.BindingEntry;
+import org.apache.axis.wsdl.symbolTable.Element;
+import org.apache.axis.wsdl.symbolTable.PortEntry;
+import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
+import org.apache.axis.wsdl.symbolTable.ServiceEntry;
+import org.apache.axis.wsdl.symbolTable.TypeEntry;
+import org.apache.geronimo.ews.ws4j2ee.context.wsdl.type.SchemaType;
+
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * <p>This interface expose the information contains in the WSDL.
+ * This interface exposed the information. It does not expose how the
+ * the information is parsed.</p>
+ * <p>This interface and related interfaces has both getter and setter methods
+ * but who ever implements this interface might not need the both.
+ * e.g. there can be two concreate implementations for this class
+ * for the cases</p>
+ * <ul>
+ * <li>have WSDL</li>
+ * <li>do not have WSDL</li>
+ * </ul>
+ * <p>if some method is not requried please throw java.lang.UnsupportedOperationException</p>
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public interface WSDLContext {
+ /**
+ * @return all the ports define in the WSDL
+ */
+ public Collection getPortTypes();
+
+ /**
+ * @param portname
+ * @return PortType whose name is equal to portname.
+ * return null if no PortType with this name.
+ */
+ public PortTypeEntry getPortType(QName portname);
+
+ /**
+ * @return all the bindings define in the WSDL
+ */
+ public Collection getBindings();
+
+ /**
+ * @param bindingname
+ * @return Binding whose name is equal to bindingname.
+ * return null if no Binding with this name.
+ */
+ public BindingEntry getBinding(QName bindingname);
+
+ /**
+ * @return all the ports define in the WSDL
+ */
+ public Collection getServices();
+
+ /**
+ * @param servicename
+ * @return Service whose name is equal to servicename.
+ * return null if no Service with this name.
+ */
+ public ServiceEntry getService(QName servicename);
+
+ /**
+ * add Service information
+ *
+ * @param service
+ */
+ public void addService(Service service);
+
+ /**
+ * @return all the Types define in the WSDL
+ */
+ public Map getTypes();
+
+ /**
+ * @param typename
+ * @return Type whose name is equal to typename.
+ * return null if no Type with this name.
+ */
+ public TypeEntry getType(QName typename);
+
+ /**
+ * add a Type
+ *
+ * @param type
+ */
+ public void addType(SchemaType type);
+
+ public Element getElement(QName name);
+
+ public PortEntry getPort(QName name);
+
+ public String getTargetNSURI();
+
+ /**
+ * WSDL artifacts correponds to the current WSCF port.
+ * If one element is in the wsdl theu are used. How to select them
+ * if there is more than one is still to do.
+ *
+ * @return
+ */
+ public ServiceEntry gettargetService();
+
+ public void settargetService(ServiceEntry service);
+
+ public BindingEntry gettargetBinding();
+
+ public void settargetBinding(BindingEntry binding);
+
+ public PortTypeEntry getTargetPortType();
+
+ public void setTargetPortType(PortTypeEntry port);
+
+ public void setTargetPort(Port port);
+
+ public Port getTargetPort();
+
+ public void validate();
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AbstractWSDLContext.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AbstractWSDLContext.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AbstractWSDLContext.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AbstractWSDLContext.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.context.wsdl.impl;
+
+import org.apache.axis.wsdl.symbolTable.BindingEntry;
+import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
+import org.apache.axis.wsdl.symbolTable.ServiceEntry;
+import org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
+
+import javax.wsdl.Port;
+
+/**
+ * @author hemapani@opensource.lk
+ */
+public abstract class AbstractWSDLContext implements WSDLContext {
+ private ServiceEntry service;
+ private BindingEntry binding;
+ private PortTypeEntry portType;
+ private Port port;
+
+ public BindingEntry gettargetBinding() {
+ return binding;
+ }
+
+ public PortTypeEntry getTargetPortType() {
+ return portType;
+ }
+
+ public ServiceEntry gettargetService() {
+ return service;
+ }
+
+ public void settargetBinding(BindingEntry binding) {
+ this.binding = binding;
+ }
+
+ public void setTargetPortType(PortTypeEntry port) {
+ this.portType = port;
+ }
+
+ public void settargetService(ServiceEntry service) {
+ this.service = service;
+ }
+
+ public Port getTargetPort() {
+ return port;
+ }
+
+ public void setTargetPort(Port port) {
+ this.port = port;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#validate()
+ */
+ public void validate() {
+ if (portType == null || binding == null
+ ) {
+ throw new UnrecoverableGenerationFault("validation of MiscInfo failed");
+ }
+ }
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AxisEmitterBasedWSDLContext.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AxisEmitterBasedWSDLContext.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AxisEmitterBasedWSDLContext.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AxisEmitterBasedWSDLContext.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,183 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001-2004 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.context.wsdl.impl;
+
+import org.apache.axis.wsdl.symbolTable.BindingEntry;
+import org.apache.axis.wsdl.symbolTable.Element;
+import org.apache.axis.wsdl.symbolTable.PortEntry;
+import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
+import org.apache.axis.wsdl.symbolTable.ServiceEntry;
+import org.apache.axis.wsdl.symbolTable.TypeEntry;
+import org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext;
+import org.apache.geronimo.ews.ws4j2ee.context.wsdl.type.SchemaType;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p>This Class is a wrapper fo the Axis SymbolTable. Since SymbolTable is parsed
+ * completly it is not editable so the methods will throw the
+ * UnsupportedOperationException.</p>
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext
+ */
+public class AxisEmitterBasedWSDLContext extends AbstractWSDLContext implements WSDLContext {
+ private Definition definition;
+ private HashMap services;
+ private HashMap bindings;
+ private HashMap portetypes;
+ private HashMap ports;
+
+ public AxisEmitterBasedWSDLContext(Definition definition) {
+ this.definition = definition;
+ }
+
+ /**
+ * Symbol table can't be edited
+ */
+ public void addService(Service service) {
+ throw new UnsupportedOperationException("Symboltable can't be edited");
+ }
+
+ /**
+ * Symbol table can't be edited
+ */
+ public void addType(SchemaType type) {
+ throw new UnsupportedOperationException("Symboltable can't be edited");
+ }
+
+ /**
+ *
+ */
+ public BindingEntry getBinding(QName bindingname) {
+ return new BindingEntry(definition.getBinding(bindingname));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getBindings()
+ */
+ public Collection getBindings() {
+ return definition.getBindings().values();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getPortType(org.apache.xml.utils.QName)
+ */
+ public PortTypeEntry getPortType(QName portname) {
+ return new PortTypeEntry(definition.getPortType(portname));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getPortTypes()
+ */
+ public Collection getPortTypes() {
+ return definition.getBindings().values();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getService(org.apache.xml.utils.QName)
+ */
+ public ServiceEntry getService(QName servicename) {
+ return new ServiceEntry(definition.getService(servicename));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getServices()
+ */
+ public Collection getServices() {
+ return definition.getServices().values();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getType(org.apache.xml.utils.QName)
+ */
+ public TypeEntry getType(QName typename) {
+ throw new UnsupportedOperationException("Symboltable can't be edited");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getTypes()
+ */
+ public Map getTypes() {
+ throw new UnsupportedOperationException("Symboltable can't be edited");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getElement(javax.xml.namespace.QName)
+ */
+ public Element getElement(QName name) {
+ throw new UnsupportedOperationException("Symboltable can't be edited");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getPort()
+ */
+ public PortEntry getPort(QName name) {
+ throw new UnsupportedOperationException("Symboltable can't be edited");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getTargetNSURI()
+ */
+ public String getTargetNSURI() {
+ return definition.getTargetNamespace();
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AxisWSDLContext.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AxisWSDLContext.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AxisWSDLContext.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/impl/AxisWSDLContext.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,230 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001-2004 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.context.wsdl.impl;
+
+import org.apache.axis.wsdl.symbolTable.BindingEntry;
+import org.apache.axis.wsdl.symbolTable.Element;
+import org.apache.axis.wsdl.symbolTable.PortEntry;
+import org.apache.axis.wsdl.symbolTable.PortTypeEntry;
+import org.apache.axis.wsdl.symbolTable.ServiceEntry;
+import org.apache.axis.wsdl.symbolTable.SymTabEntry;
+import org.apache.axis.wsdl.symbolTable.SymbolTable;
+import org.apache.axis.wsdl.symbolTable.TypeEntry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext;
+import org.apache.geronimo.ews.ws4j2ee.context.wsdl.type.SchemaType;
+
+import javax.wsdl.Binding;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+/**
+ * <p>This Class is a wrapper fo the Axis SymbolTable. Since SymbolTable is parsed
+ * completly it is not editable so the methods will throw the
+ * UnsupportedOperationException.</p>
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext
+ */
+public class AxisWSDLContext extends AbstractWSDLContext implements WSDLContext {
+ protected static Log log =
+ LogFactory.getLog(AxisWSDLContext.class.getName());
+ private SymbolTable symbolTable;
+ private HashMap services;
+ private HashMap bindings;
+ private HashMap portetypes;
+ private HashMap ports;
+
+ private boolean verbose = false;
+
+ public AxisWSDLContext(SymbolTable axisSymbltable) {
+ this.symbolTable = axisSymbltable;
+ this.services = new HashMap();
+ this.bindings = new HashMap();
+ this.portetypes = new HashMap();
+ this.ports = new HashMap();
+ Iterator it = symbolTable.getHashMap().values().iterator();
+ while (it.hasNext()) {
+ Vector v = (Vector) it.next();
+ for (int i = 0; i < v.size(); ++i) {
+ SymTabEntry entry = (SymTabEntry) v.elementAt(i);
+ if (entry instanceof ServiceEntry) {
+ Service service = ((ServiceEntry) entry).getService();
+ this.services.put(service.getQName(), entry);
+ } else if (entry instanceof BindingEntry) {
+ Binding binding = ((BindingEntry) entry).getBinding();
+ this.bindings.put(binding.getQName(), entry);
+ } else if (entry instanceof PortTypeEntry) {
+ PortType portType = ((PortTypeEntry) entry).getPortType();
+ this.portetypes.put(portType.getQName(), entry);
+ } else if (entry instanceof PortEntry) {
+ PortEntry port = ((PortEntry) entry);
+ this.ports.put(port.getQName().getLocalPart(), entry);
+ }
+ }
+ }
+ }
+
+ /**
+ * Symbol table can't be edited
+ */
+ public void addService(Service service) {
+ throw new UnsupportedOperationException("Symboltable can't be edited");
+ }
+
+ /**
+ * Symbol table can't be edited
+ */
+ public void addType(SchemaType type) {
+ throw new UnsupportedOperationException("Symboltable can't be edited");
+ }
+
+ /**
+ *
+ */
+ public BindingEntry getBinding(QName bindingname) {
+ if (bindingname == null) {
+ //if binding not specified the first one will return
+ Iterator values = this.bindings.values().iterator();
+ if (values.hasNext())
+ return (BindingEntry) values.next();
+ }
+ return (BindingEntry) this.bindings.get(bindingname);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getBindings()
+ */
+ public Collection getBindings() {
+ return this.bindings.values();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getPortType(org.apache.xml.utils.QName)
+ */
+ public PortTypeEntry getPortType(QName portname) {
+ return (PortTypeEntry) this.portetypes.get(portname);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getPortTypes()
+ */
+ public Collection getPortTypes() {
+ return this.portetypes.values();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getService(org.apache.xml.utils.QName)
+ */
+ public ServiceEntry getService(QName servicename) {
+ return (ServiceEntry) this.services.get(servicename);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getServices()
+ */
+ public Collection getServices() {
+ return this.services.values();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getType(org.apache.xml.utils.QName)
+ */
+ public TypeEntry getType(QName typename) {
+ // TODO Auto-generated method stub
+ return symbolTable.getType(typename);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getTypes()
+ */
+ public Map getTypes() {
+ return symbolTable.getTypeIndex();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getElement(javax.xml.namespace.QName)
+ */
+ public Element getElement(QName name) {
+ return this.symbolTable.getElement(name);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.context.wsdl.WSDLContext#getPort()
+ */
+ public PortEntry getPort(QName name) {
+ if (verbose)
+ log.info("getting port type " + name);
+ Object obj = this.ports.get(name);
+ //when Symbol table populates the URI of the port is given as ""
+ //so we have to cheat
+ if (obj == null) {
+ obj = this.ports.get(name.getLocalPart());
+ }
+ return (PortEntry) obj;
+ }
+
+ public String getTargetNSURI() {
+ return symbolTable.getDefinition().getTargetNamespace();
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/type/SchemaType.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/type/SchemaType.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/type/SchemaType.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/context/wsdl/type/SchemaType.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,103 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 2001-2004 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Axis" and "Apache Software Foundation" must
+ * not be used to endorse or promote products derived from this
+ * software without prior written permission. For written
+ * permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * nor may "Apache" appear in their name, without prior written
+ * permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.context.wsdl.type;
+
+import org.apache.geronimo.ews.ws4j2ee.context.wsdl.ElementInfo;
+import org.apache.geronimo.ews.ws4j2ee.parsers.ParserFault;
+
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * ,p>This class represent a Schema Type.</p>
+ */
+public interface SchemaType {
+ public static final QName ARRAY_TYPE = new QName("arrayType");
+ public static final QName SIMPLE_CONTENT = new QName("simpleContent");
+
+ public void addAttributes(QName name, QName type);
+
+ public QName getAttributeTypeByName(QName name);
+
+ public Iterator getAttributeNames();
+
+ public void addElement(ElementInfo elementInfo);
+
+ public ElementInfo getElementTypeByName(QName name);
+
+ public Iterator getElementNames();
+
+ public boolean isArray();
+
+ public void setArray(boolean b);
+
+ /**
+ * @return the restricion base of this type or return null.
+ * @throws SAXException
+ */
+ public QName getRestrictionBase() throws ParserFault;
+
+ /**
+ * @return get the extension type if this is extended or null
+ * @throws SAXException
+ */
+ public QName getExtentionBase() throws ParserFault;
+
+ public QName getArrayType();
+
+ public boolean isSimpleTypeOrSimpleContent();
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/AbstractModule.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/AbstractModule.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/AbstractModule.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/AbstractModule.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.module;
+
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public abstract class AbstractModule implements Module {
+ protected InputStream wscfFile;
+ protected InputStream webddfile;
+ protected InputStream ejbJarfile;
+ protected InputStream wsdlfile;
+ protected InputStream jaxrpcfile;
+ protected ZipFile zip;
+ protected ClassLoader parentCL;
+
+ public AbstractModule(String jarFile, ClassLoader parentCL) throws GenerationFault {
+ try {
+ this.parentCL = parentCL;
+ zip = new JarFile(jarFile);
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ public InputStream getInputStreamForJarEntry(String path)
+ throws GenerationFault {
+ try {
+ ZipEntry zentry = zip.getEntry(path);
+ if (zentry != null) {
+ return zip.getInputStream(zentry);
+ } else {
+ return null;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ public InputStream getInputStreamForJarEntry(String jarFile, String path)
+ throws GenerationFault {
+ try {
+ ZipEntry zentry = zip.getEntry(path);
+ if (zentry != null) {
+ return zip.getInputStream(zentry);
+ } else {
+ return null;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ public void loadtheClassesInJarFile() throws GenerationFault {
+ }
+
+ /**
+ * @return
+ */
+ public InputStream getEjbJarfile() {
+ return ejbJarfile;
+ }
+
+ /**
+ * @return
+ */
+ public InputStream getWebddfile() {
+ return webddfile;
+ }
+
+ /**
+ * @return
+ */
+ public InputStream getWscfFile() {
+ return wscfFile;
+ }
+
+ /**
+ * @param stream
+ */
+ public void setEjbJarfile(InputStream stream) {
+ ejbJarfile = stream;
+ }
+
+ /**
+ * @param stream
+ */
+ public void setWebddfile(InputStream stream) {
+ webddfile = stream;
+ }
+
+ /**
+ * @param stream
+ */
+ public void setWscfFile(InputStream stream) {
+ wscfFile = stream;
+ }
+
+ public InputStream findFileInModule(String path) throws GenerationFault {
+ return getInputStreamForJarEntry(path);
+ }
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/DirModule.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/DirModule.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/DirModule.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/DirModule.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.module;
+
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class DirModule implements Module {
+ protected InputStream wscfFile;
+ protected InputStream webddfile;
+ protected InputStream ejbJarfile;
+ private String location;
+ private ClassLoader parentCL;
+
+ /**
+ * @param jarFile
+ * @throws GenerationFault
+ */
+ public DirModule(String location, ClassLoader parentCL)
+ throws GenerationFault {
+ File file = null;
+ this.parentCL = parentCL;
+ this.location = location;
+ try {
+ file = new File(location + "/WEB-INF/webservices.xml");
+ if (file.exists()) {
+ wscfFile = new FileInputStream(file);
+ } else {
+ file = new File(location + "/META-INF/webservices.xml");
+ if (file.exists()) {
+ wscfFile = new FileInputStream(file);
+ } else {
+ wscfFile = new FileInputStream(new File(location + "/webservices.xml"));
+ }
+ }
+ findDDs();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ /**
+ * @param jarFile
+ * @throws GenerationFault
+ */
+ public DirModule(File wscfDDFile)
+ throws GenerationFault {
+ try {
+ wscfFile = new FileInputStream(wscfDDFile);
+ File parent = wscfDDFile.getParentFile();
+ String parentName = parent.getAbsolutePath();
+ if (parentName.endsWith("WEB-INF")
+ || parentName.endsWith("WEB-INF/")
+ || parentName.endsWith("WEB-INF")
+ || parentName.endsWith("META-INF/")) {
+ this.location = parent.getParentFile().getAbsolutePath();
+ } else {
+ this.location = parent.getAbsolutePath();
+ }
+ findDDs();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ public void findDDs() throws GenerationFault {
+ try {
+ File file = new File(location + "/META-INF/ejb-jar.xml");
+ if (file.exists()) {
+ ejbJarfile = new FileInputStream(file);
+ } else {
+ file = new File(location + "/ejb-jar.xml");
+ if (file.exists()) {
+ ejbJarfile = new FileInputStream(file);
+ }
+ }
+ file = new File(location + "WEB-INF/web.xml");
+ if (file.exists()) {
+ webddfile = new FileInputStream(file);
+ } else {
+ file = new File(location + "/web.xml");
+ if (file.exists()) {
+ webddfile = new FileInputStream(file);
+ }
+ }
+ if (wscfFile == null)
+ throw new GenerationFault("wscf file must not be null");
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ public ClassLoader getClassLoaderWithPackageLoaded() throws GenerationFault {
+ try {
+ File file = new File(location);
+ return new URLClassLoader(new URL[]{file.toURL()}, parentCL);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ public ArrayList getClassPathElements() throws GenerationFault {
+ ArrayList elements = new ArrayList();
+ elements.add(new File(location));
+ return elements;
+ }
+
+ public InputStream getEjbJarfile() throws GenerationFault {
+ return ejbJarfile;
+ }
+
+ public InputStream getWebddfile() throws GenerationFault {
+ return webddfile;
+ }
+
+ public InputStream getWscfFile() throws GenerationFault {
+ return wscfFile;
+ }
+
+ public void setEjbJarfile(InputStream stream) throws GenerationFault {
+ this.ejbJarfile = stream;
+ }
+
+ public void setWebddfile(InputStream stream) throws GenerationFault {
+ this.webddfile = stream;
+ }
+
+ public void setWscfFile(InputStream stream) throws GenerationFault {
+ this.wscfFile = stream;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModule#findFileInModule(java.lang.String)
+ */
+ public InputStream findFileInModule(String path) throws GenerationFault {
+ try {
+ File file = new File(location + "/" + path);
+ if (file.exists())
+ new FileInputStream(file);
+ return null;
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/EARModule.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/EARModule.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/EARModule.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/EARModule.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.module;
+
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.utils.FileUtils;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * @author hemapani@opensource.lk
+ */
+public class EARModule implements Module {
+ private Module pkgModule;
+ private Vector classPathElements;
+ private ClassLoader parentCL;
+
+ /**
+ * @param jarFile
+ * @throws GenerationFault
+ */
+ public EARModule(String jarFile,File outDir)
+ throws GenerationFault {
+ try {
+ ZipFile earFile = new ZipFile(jarFile);
+ Enumeration enumeration = earFile.entries();
+ int index = 0;
+ while (enumeration.hasMoreElements()) {
+ index++;
+ ZipEntry entry = (ZipEntry) enumeration.nextElement();
+ if (entry.getName().endsWith(".war") || entry.getName().endsWith(".jar")) {
+ File outWar = new File(new File(outDir,String.valueOf(index)), entry.getName());
+ FileUtils.uncompressFile(earFile.getInputStream(entry), outWar);
+ pkgModule = ModuleFactory.createPackageModule(outWar.getAbsolutePath(),new File(outDir,String.valueOf(index)));
+ }
+ }
+ } catch (UnrecoverableGenerationFault e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ /**
+ * @return
+ * @throws GenerationFault
+ */
+ public ClassLoader getClassLoaderWithPackageLoaded() throws GenerationFault {
+ return pkgModule.getClassLoaderWithPackageLoaded();
+ }
+
+ /**
+ * @return
+ * @throws GenerationFault
+ */
+ public ArrayList getClassPathElements() throws GenerationFault {
+ return pkgModule.getClassPathElements();
+ }
+
+ public boolean equals(Object obj) {
+ return pkgModule.equals(obj);
+ }
+
+ /**
+ * @param path
+ * @return
+ * @throws GenerationFault
+ */
+ public InputStream findFileInModule(String path) throws GenerationFault {
+ return pkgModule.findFileInModule(path);
+ }
+
+ /**
+ * @return
+ * @throws GenerationFault
+ */
+ public InputStream getEjbJarfile() throws GenerationFault {
+ return pkgModule.getEjbJarfile();
+ }
+
+ /**
+ * @return
+ * @throws GenerationFault
+ */
+ public InputStream getWebddfile() throws GenerationFault {
+ return pkgModule.getWebddfile();
+ }
+
+ /**
+ * @return
+ * @throws GenerationFault
+ */
+ public InputStream getWscfFile() throws GenerationFault {
+ return pkgModule.getWscfFile();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return pkgModule.hashCode();
+ }
+
+ /**
+ * @param stream
+ * @throws GenerationFault
+ */
+ public void setEjbJarfile(InputStream stream) throws GenerationFault {
+ pkgModule.setEjbJarfile(stream);
+ }
+
+ /**
+ * @param stream
+ * @throws GenerationFault
+ */
+ public void setWebddfile(InputStream stream) throws GenerationFault {
+ pkgModule.setWebddfile(stream);
+ }
+
+ /**
+ * @param stream
+ * @throws GenerationFault
+ */
+ public void setWscfFile(InputStream stream) throws GenerationFault {
+ pkgModule.setWscfFile(stream);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return pkgModule.toString();
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/JarModule.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/JarModule.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/JarModule.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/JarModule.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.module;
+
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class JarModule extends AbstractModule {
+ private ClassLoader cl;
+ private ArrayList list = new ArrayList(1);
+
+ /**
+ * @param jarFile
+ * @throws GenerationFault
+ */
+ public JarModule(String jarFile, ClassLoader parentCL)
+ throws GenerationFault {
+ super(jarFile, parentCL);
+ try {
+ this.parentCL = parentCL;
+ list.add(new File(jarFile));
+ cl = new URLClassLoader(new URL[]{(new File(jarFile)).toURL()}, parentCL);
+ wscfFile = getInputStreamForJarEntry(jarFile, "META-INF/webservices.xml");
+ if (wscfFile == null) {
+ wscfFile =
+ getInputStreamForJarEntry(jarFile, "META-INF/webservice.xml");
+ }
+ if (wscfFile == null) {
+ wscfFile = getInputStreamForJarEntry(jarFile, "webservice.xml");
+ }
+ webddfile = getInputStreamForJarEntry(jarFile, "META-INF/web.xml");
+ if (wscfFile == null) {
+ webddfile = getInputStreamForJarEntry(jarFile, "web.xml");
+ }
+ ejbJarfile = getInputStreamForJarEntry(jarFile, "META-INF/ejb-jar.xml");
+ if (wscfFile == null)
+ throw new GenerationFault("wscf file must not be null");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModule#getClassLoaderWithPackageLoaded()
+ */
+ public ClassLoader getClassLoaderWithPackageLoaded() {
+ return cl;
+ }
+
+ public ArrayList getClassPathElements() {
+ return list;
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/Module.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/Module.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/Module.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/Module.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.module;
+
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+
+/**
+ * <p>This reprsents a packaged module jar,WAR,EAR file. the implementation
+ * classes of this interface should provide the acsses to the DD files and give
+ * a class loader that load the class files in the jar file.</p>
+ *
+ * @author hemapani
+ */
+public interface Module {
+ public InputStream getEjbJarfile() throws GenerationFault;
+
+ public InputStream getWebddfile() throws GenerationFault;
+
+ public InputStream getWscfFile() throws GenerationFault;
+
+ public void setEjbJarfile(InputStream stream) throws GenerationFault;
+
+ public void setWebddfile(InputStream stream) throws GenerationFault;
+
+ public void setWscfFile(InputStream stream) throws GenerationFault;
+
+ public ClassLoader getClassLoaderWithPackageLoaded() throws GenerationFault;
+
+ public ArrayList getClassPathElements() throws GenerationFault;
+
+ public InputStream findFileInModule(String path) throws GenerationFault;
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/ModuleFactory.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/ModuleFactory.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/ModuleFactory.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/ModuleFactory.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.module;
+
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
+
+import java.io.File;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class ModuleFactory {
+
+ /**
+ * @param path - path to the package
+ * @param firstmodule - is it the first module or a module inside other module
+ * @return
+ * @throws GenerationFault
+ */
+ public static Module createPackageModule(String path,File outDir) throws UnrecoverableGenerationFault {
+ return createPackageModule(path, Thread.currentThread().getContextClassLoader(),outDir);
+ }
+
+ public static Module createPackageModule(String path,
+ ClassLoader parentCL,File outDir) throws UnrecoverableGenerationFault {
+ try {
+ if (path != null) {
+ File file = new File(path);
+ if (!file.exists())
+ throw new UnrecoverableGenerationFault("file not found " + file.getAbsolutePath());
+ if (file.isDirectory()) {
+ return new DirModule(path, parentCL);
+ } else if (path.endsWith(".jar") || path.endsWith(".JAR"))
+ return new JarModule(path, parentCL);
+ else if (path.endsWith(".war") || path.endsWith(".WAR"))
+ return new WARModule(path, parentCL,outDir);
+ else if (path.endsWith(".ear") || path.endsWith(".EAR"))
+ return new EARModule(path,outDir);
+ else if (path.endsWith(".xml"))
+ return new DirModule(new File(path));
+ else
+ throw new UnrecoverableGenerationFault("unknown type of file");
+ }
+ } catch (GenerationFault e) {
+ throw new UnrecoverableGenerationFault(path + " not found ", e);
+ }
+ throw new UnrecoverableGenerationFault("path is null");
+ }
+}
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/WARModule.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/WARModule.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/WARModule.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/module/WARModule.java Mon Aug 8 05:40:25 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.ews.ws4j2ee.module;
+
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.utils.FileUtils;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class WARModule extends AbstractModule {
+ private ArrayList urls;
+ private ClassLoader cl;
+
+ /**
+ * @param jarFile
+ * @throws GenerationFault
+ */
+ public WARModule(String jarFile, ClassLoader parentCL,File outDir)
+ throws GenerationFault {
+ super(jarFile, parentCL);
+ try {
+ urls = FileUtils.uncompressWar(new File(outDir,"unpacked"), new File(zip.getName()));
+ URL[] aurls = new URL[urls.size()];
+ for (int i = 0; i < aurls.length; i++) {
+ aurls[i] = ((File) urls.get(i)).toURL();
+ System.out.println(aurls[i]);
+ }
+ cl = new URLClassLoader(aurls, Thread.currentThread().getContextClassLoader());
+ wscfFile = getInputStreamForJarEntry(jarFile, "WEB-INF/webservices.xml");
+ if (wscfFile == null) {
+ wscfFile = getInputStreamForJarEntry(jarFile, "webservices.xml");
+ }
+ webddfile = getInputStreamForJarEntry(jarFile, "WEB-INF/web.xml");
+ if (webddfile == null)
+ webddfile = getInputStreamForJarEntry(jarFile, "web.xml");
+ if (wscfFile == null)
+ throw new GenerationFault("wscf file must not be null");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ } catch (GenerationFault e) {
+ e.printStackTrace();
+ throw GenerationFault.createGenerationFault(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.ews.ws4j2ee.utils.packager.load.PackageModule#getClassLoaderWithPackageLoaded()
+ */
+ public ClassLoader getClassLoaderWithPackageLoaded() throws GenerationFault {
+ return cl;
+ }
+
+ public ArrayList getClassPathElements() {
+ return urls;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: ews-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: ews-dev-help@ws.apache.org