ws-ews-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guilla...@apache.org
Subject svn commit: r230793 [9/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/ ...
Date Mon, 08 Aug 2005 12:42:47 GMT
Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/SessionBeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/SessionBeanWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/SessionBeanWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/SessionBeanWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,174 @@
+/*
+ * 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.toWs.ejb;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.context.SEIOperation;
+import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.JavaClassWriter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * <p>This class can be used to write the appropriate SessionBean
+ * class for the given port type.
+ * A Stateless Session Bean, as defined by the Enterprise JavaBeans specification,
+ * can be used to implement a Web service to be deployed in the EJB container.
+ * A Stateless Session Bean does not have to worry about multi-threaded access.
+ * The EJB container is required to serialize request flow through any particular
+ * instance of a Service Implementation Bean. The requirements for creating a Service
+ * Implementation Bean as a Stateless Session EJB are repeated in part here.</p>
+ * <ol>
+ * <li>The Service Implementation Bean must have a default public constructor.</li>
+ * <li>The Service Implementation Bean may implement the Service Endpoint Interface,
+ * but it is not required to do so. The bean must implement all the method
+ * signatures of the SEI.<li>
+ * <li>The Service Implementation Bean methods are not required to throw
+ * javax.rmi.RemoteException. The business methods of the bean must be public
+ * and must not be final or static. It may implement other methods in addition
+ * to those defined by the SEI.</li>
+ * <li>A Service Implementation Bean must be a stateless object.
+ * A Service Implementation Bean must not save client specific state
+ * across method calls either within the bean instance’s data members or
+ * external to the instance.</li>
+ * <li>The class must be public, must not be final and must not be abstract.</li>
+ * <li>The class must not define the finalize() method.</li>
+ * <li>Currently, it must implement the ejbCreate() and ejbRemove() methods which
+ * take no arguments. This is a requirement of the EJB container, but generally
+ * can be stubbed out with an empty implementation.</li>
+ * <li>Currently, a Stateless Session Bean must implement the javax.ejb.SessionBean
+ * interface either directly or indirectly. This interface allows the container to notify the Service Implementation Bean of impending changes in its state. The full requirements of this interface are defined in the Enterprise JavaBeans specification section 7.5.1.</li>
+ * <li>The Enterprise JavaBeans specification section 7.8.2 defines the allowed
+ * container service access requirements.</li>
+ * </ol>
+ * <h5>Exposing an existing EJB</h5>
+ * <p>An existing Enterprise JavaBean may be used as a Service Implementation Bean if it meets the following requirements:</p>
+ * <ol>
+ * <li>The business methods of the EJB bean class that are exposed on the SEI must meet the Service</li>
+ * <li>Implementation Bean requirements defined in section 5.3.1.</li>
+ * <li>The SEI must meet the requirements described in the JAX-RPC specification for Service Endpoint Interfaces.</li>
+ * <li>The transaction attributes of the SEI methods must not include Mandatory.</li>
+ * <li>The developer must package the Web service as described in section 5.4 and must specify an ejb-link from the port in the Web services deployment descriptor to the existing EJB.</li>
+ * <ol>
+ *
+ * @author Rajith Priyanga
+ * @author Srinath Perera
+ * @date Nov 26, 2003
+ */
+public class SessionBeanWriter extends JavaClassWriter {
+    private String name;
+    protected EJBContext ejbcontext;
+
+    /**
+     * Constructs a SessionBeanWriter.
+     *
+     * @param portType The port type which contains the details.
+     * @throws GenerationFault
+     */
+    public SessionBeanWriter(J2EEWebServiceContext context, EJBContext ejbcontext) throws GenerationFault {
+        super(context, ejbcontext.getImplBean());
+        this.ejbcontext = ejbcontext;
+    }
+
+    protected void writeAttributes() throws GenerationFault {
+    }
+
+    protected void writeConstructors() throws GenerationFault {
+    }
+
+    protected void writeMethods() throws GenerationFault {
+        String parmlistStr = "";
+        ArrayList operations = j2eewscontext.getMiscInfo().getSEIOperations();
+        for (int i = 0; i < operations.size(); i++) {
+            SEIOperation op = (SEIOperation) operations.get(i);
+            String returnType = op.getReturnType();
+            returnType = (returnType == null) ? "void" : returnType;
+            out.write("\tpublic " + returnType + " " + op.getMethodName() + "(");
+            Iterator pas = op.getParameterNames().iterator();
+            boolean first = true;
+            while (pas.hasNext()) {
+                String name = (String) pas.next();
+                String type = (String) op.getParameterType(name);
+                if (first) {
+                    first = false;
+                    out.write(type + " " + name);
+                    parmlistStr = parmlistStr + name;
+                } else {
+                    out.write("," + type + " " + name);
+                    parmlistStr = "," + name;
+                }
+            }
+            out.write(")");
+//			out.write(") throws java.rmi.RemoteException");
+//			ejb giving problems deploying check this            
+//			  ArrayList faults = op.getFaults();
+//			  for (int j = 0; j < faults.size(); j++) {
+//				  out.write("," + (String) faults.get(i));
+//			  }
+            out.write("{\n");
+            if ("int".equals(returnType)) {
+                out.write("\t\t\treturn 12;\n");
+            } else if ("float".equals(returnType)) {
+                out.write("\t\t\treturn 0.0f;\n");
+            } else if ("double".equals(returnType)) {
+                out.write("\t\t\treturn 0.0d;\n");
+            } else if ("short".equals(returnType)) {
+                out.write("\t\t\treturn (short)0.0;\n");
+            } else if ("boolean".equals(returnType)) {
+                out.write("\t\t\treturn false;\n");
+            } else if ("byte".equals(returnType)) {
+                out.write("\t\t\treturn (byte)24;\n");
+            } else if ("long".equals(returnType)) {
+                out.write("\t\t\treturn (long)0.0l;\n");
+            } else if ("char".equals(returnType)) {
+                out.write("\t\t\treturn 'w';\n");
+            } else if ("void".equals(returnType)) {
+            } else {
+                out.write("\t\t\treturn null;\n");
+            }
+            out.write("\t}\n");
+        }
+        out.write("\tpublic javax.naming.Context getInitialContext()throws javax.naming.NamingException{\n");
+        out.write("\t	java.util.Properties env = new java.util.Properties();\n");
+        out.write("\t	env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,\"org.jnp.interfaces.NamingContextFactory\");\n");
+        out.write("\t	env.put(javax.naming.Context.PROVIDER_URL, \"127.0.0.1:1099\");\n");
+        out.write("\t	return new javax.naming.InitialContext(env);\n");
+        out.write("\t}\n");
+        out.write("\tpublic void ejbCreate() {}\n");
+        out.write("\tpublic void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException {}\n");
+        out.write("\tpublic void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException {}\n");
+        out.write("\tpublic void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException {}\n");
+        out.write("\tpublic void setSessionContext(javax.ejb.SessionContext arg0)throws javax.ejb.EJBException, java.rmi.RemoteException {}\n");
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ews.ws4j2ee.toWs.JavaClassWriter#getimplementsPart()
+     */
+    protected String getimplementsPart() {
+        return " implements javax.ejb.SessionBean";
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter#isOverWrite()
+     */
+    protected boolean isOverWrite() {
+        return false;
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/handlers/HandlerGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/handlers/HandlerGenerator.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/handlers/HandlerGenerator.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/handlers/HandlerGenerator.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,67 @@
+/*
+ * 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.toWs.handlers;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.ws.ews.context.webservices.server.WSCFHandler;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
+
+import java.util.HashMap;
+
+/**
+ * <p>Genarate the signature of the handlers as given by the webservices.xml file.</p>
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class HandlerGenerator implements Generator {
+    private J2EEWebServiceContext j2eewscontext;
+    private Writer[] writers = new Writer[0];
+
+    private static HashMap handlermap = new HashMap();
+
+    static {
+        handlermap.put("org.apache.ws.axis.security.CheckPoint4J2EEHandler",
+                "org.apache.ws.axis.security.CheckPoint4J2EEHandler");
+    };
+
+
+    public HandlerGenerator(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
+        this.j2eewscontext = j2eewscontext;
+        WSCFHandler[] handlers = j2eewscontext.getMiscInfo().getHandlers();
+        if (handlers != null) {
+            writers = new Writer[handlers.length];
+            for (int i = 0; i < handlers.length; i++) {
+                if (!handlermap.containsKey(handlers[i].getHandlerClass())) {
+                    writers[i] = new HandlerWriter(j2eewscontext, handlers[i]);
+                }
+            }
+        }
+    }
+
+    /**
+     * genarate the handlers
+     */
+    public void generate() throws GenerationFault {
+        for (int i = 0; i < writers.length; i++) {
+            if (writers[i] != null) {
+                writers[i].write();
+            }
+        }
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/handlers/HandlerWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/handlers/HandlerWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/handlers/HandlerWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/handlers/HandlerWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,83 @@
+/*
+ * 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.toWs.handlers;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.ws.ews.context.webservices.server.WSCFHandler;
+import org.apache.ws.ews.context.webservices.server.WSCFSOAPHeader;
+import org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
+
+/**
+ * <p>Simpley print the Handler without much mess.</p>
+ *
+ * @author Srinath perera(hemapani@opensource.lk)
+ */
+public class HandlerWriter extends AbstractWriter {
+    private WSCFHandler handler;
+    private String className = null;
+    private String packageName = null;
+
+    /**
+     * @param j2eewscontext
+     * @throws GenerationFault
+     */
+    public HandlerWriter(J2EEWebServiceContext j2eewscontext, WSCFHandler handler)
+            throws GenerationFault {
+        super(j2eewscontext, j2eewscontext.getMiscInfo().getOutPutPath()
+                + "/" + handler.getHandlerClass().replace('.', '/') + ".java");
+        this.handler = handler;
+        className = Utils.getClassNameFromQuallifiedName(handler.getHandlerClass());
+        packageName = Utils.getPackageNameFromQuallifiedName(handler.getHandlerClass());
+    }
+
+    public String getFileName() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * just print it out
+     */
+    public void writeCode() throws GenerationFault {
+        if (out == null)
+            return;
+        out.write("package " + packageName + ";\n");
+        out.write("import org.apache.axis.AxisFault;\n");
+        out.write("import org.apache.axis.MessageContext;\n");
+        out.write("public class " + className + " extends org.apache.axis.handlers.BasicHandler{\n");
+        out.write("\tpublic " + className + "(){\n");
+        out.write("\t\tsetName(\"" + handler.getHandlerName() + "\");\n");
+        out.write("\t}\n");
+        out.write("\tpublic void init(){}\n");
+        out.write("\tpublic void cleanup(){}\n");
+        out.write("\tpublic void onFault(MessageContext msgContext){}\n");
+        out.write("\tpublic void invoke(MessageContext msgContext) throws AxisFault{\n");
+        out.write("\t\t//write your implementation here\n");
+        out.write("\t}\n");
+        out.write("\tpublic java.util.List getUnderstoodHeaders() {\n");
+        out.write("\t\t	java.util.List list = new java.util.ArrayList();\n");
+        WSCFSOAPHeader[] headers = handler.getSoapHeader();
+        for (int i = 0; i < headers.length; i++) {
+            out.write("\t\tjavax.xml.namespace.QName name" + i + " = new javax.xml.namespace.QName(\"" + headers[i].getNamespaceURI() + "\",\"" + headers[i].getNamespaceURI() + "\");\n");
+            out.write("\t\tlist.add(name" + i + ");\n");
+        }
+        out.write("\t\treturn list;\n");
+        out.write("\t}\n");
+        out.write("}");
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/GenerationFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/GenerationFactoryImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/GenerationFactoryImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/GenerationFactoryImpl.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,122 @@
+/*
+ * 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.toWs.impl;
+
+import org.apache.axis.wsdl.fromJava.Emitter;
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeDeployContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.dd.J2EEContainerSpecificDDGenerator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.dd.JaxrpcMapperGenerator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.dd.WebContainerDDGenerator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBDDWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBGenerator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBHomeWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBLocalHomeWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBRemoteWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.SessionBeanWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.handlers.HandlerGenerator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.misc.BuildFileConfigurer;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.WrapperWsGenerator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.ws.ClientSideWsGenerator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.ws.ServerSideWsGenerator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wsdl.WSDLGenerator;
+
+/**
+ * @author hemapani@opensource.lk
+ */
+public class GenerationFactoryImpl
+        implements org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFactory {
+    public Writer createEJBWriter(J2EEWebServiceContext j2eewscontext,
+                                  EJBContext ejbcontext,
+                                  int writerType)
+            throws GenerationFault {
+        if (GenerationConstants.EJB_DD_WRITER == writerType)
+            return new EJBDDWriter(j2eewscontext, ejbcontext);
+        else if (GenerationConstants.EJB_HOME_INTERFACE_WRITER == writerType)
+            return new EJBHomeWriter(j2eewscontext, ejbcontext);
+        else if (GenerationConstants.EJB_REMOTE_INTERFACE_WRITER == writerType)
+            return new EJBRemoteWriter(j2eewscontext, ejbcontext);
+        else if (
+                GenerationConstants.EJB_LOCAL_HOME_INTERFACE_WRITER == writerType)
+            return new EJBLocalHomeWriter(j2eewscontext, ejbcontext);
+        else if (GenerationConstants.EJB_LOCAL_INTERFACE_WRITER == writerType)
+            return new EJBLocalHomeWriter(j2eewscontext, ejbcontext);
+        else if (
+                GenerationConstants.EJB_IMPLEMENTATION_BEAN_WRITER == writerType)
+            return new SessionBeanWriter(j2eewscontext, ejbcontext);
+        else
+            throw new GenerationFault("the writer not found");
+    }
+
+    public Generator createEJBGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new EJBGenerator(j2eewscontext);
+    }
+
+    public Generator createWrapperWsGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new WrapperWsGenerator(j2eewscontext);
+    }
+
+    public Generator createClientSideWsGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new ClientSideWsGenerator(j2eewscontext);
+    }
+
+    public Generator createWSDLGenerator(J2EEWebServiceContext wscontext,
+                                         Emitter emitter,
+                                         Ws4J2eeDeployContext clparser)
+            throws GenerationFault {
+        return new WSDLGenerator(wscontext, emitter, clparser);
+    }
+
+    public Generator createServerSideWsGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new ServerSideWsGenerator(j2eewscontext);
+    }
+
+    public Generator createHandlerGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new HandlerGenerator(j2eewscontext);
+    }
+
+    public Generator createJaxrpcMapperGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new JaxrpcMapperGenerator(j2eewscontext);
+    }
+
+    public Generator createContainerSpecificDDGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new J2EEContainerSpecificDDGenerator(j2eewscontext);
+    }
+
+    public Generator createBuildFileGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new BuildFileConfigurer(j2eewscontext);
+    }
+
+    public Generator createWebContainerDDGenerator(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        return new WebContainerDDGenerator(j2eewscontext);
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/Ws4J2eeDeployContextImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/Ws4J2eeDeployContextImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/Ws4J2eeDeployContextImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/Ws4J2eeDeployContextImpl.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,170 @@
+/*
+ * 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.toWs.impl;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.axis.wsdl.fromJava.Emitter;
+import org.apache.geronimo.ews.ws4j2ee.module.Module;
+import org.apache.geronimo.ews.ws4j2ee.module.ModuleFactory;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeDeployContext;
+
+/**
+ * @author hemapani@opensource.lk
+ */
+public class Ws4J2eeDeployContextImpl implements Ws4J2eeDeployContext {
+    protected String implStyle = GenerationConstants.USE_INTERNALS;
+    protected HashMap map;
+    protected String j2eeContainer = GenerationConstants.GERONIMO_CONTAINER;
+
+    protected boolean compile = false;
+    /**
+     * Field module
+     */
+    protected Module module;
+
+    /**
+     * Field moduleLocation
+     */
+    protected String moduleLocation;
+
+    /**
+     * Field outputLocation
+     */
+    protected String outputLocation;
+
+    /**
+     * Constructor GeronimoWsDeployContext
+     *
+     * @param moduleLocation
+     * @param outputLocation
+     */
+    public Ws4J2eeDeployContextImpl(String moduleLocation,
+                            String outputLocation,
+                            ClassLoader parentCL,
+                            String implStyle,
+                            String j2eeContiner,HashMap map) {
+        module =
+                ModuleFactory.createPackageModule(moduleLocation, parentCL,new File(outputLocation) );
+        this.moduleLocation = moduleLocation;
+        this.outputLocation = outputLocation;
+        this.implStyle = implStyle;
+        this.j2eeContainer = j2eeContiner;
+        this.map = map;
+    }
+
+    /**
+     * Constructor GeronimoWsDeployContext
+     *
+     * @param moduleLocation
+     * @param outputLocation
+     */
+    public Ws4J2eeDeployContextImpl(String moduleLocation,
+                            String outputLocation,
+                            ClassLoader parentCL) {
+        module =
+                ModuleFactory.createPackageModule(moduleLocation, 
+                parentCL,new File(outputLocation));
+        this.moduleLocation = moduleLocation;
+        this.outputLocation = outputLocation;
+    }
+
+    /**
+     * Method getMode
+     *
+     * @return
+     */
+    public int getMode() {
+        return Emitter.MODE_ALL;
+    }
+
+    /**
+     * Method getWsdlImplFilename
+     *
+     * @return
+     */
+    public String getWsdlImplFilename() {
+        return null;
+    }
+
+    /**
+     * Method getModule
+     *
+     * @return
+     */
+    public Module getModule() {
+        return module;
+    }
+
+    /**
+     * Method getModuleLocation
+     *
+     * @return
+     */
+    public String getModuleLocation() {
+        return moduleLocation;
+    }
+
+    /**
+     * Method getContanier
+     *
+     * @return
+     */
+    public String getContanier() {
+        return j2eeContainer;
+    }
+
+    /**
+     * Method getImplStyle
+     *
+     * @return
+     */
+    public String getImplStyle() {
+        return implStyle;
+    }
+
+    /**
+     * Method getOutPutLocation
+     *
+     * @return
+     */
+    public String getOutPutLocation() {
+        return outputLocation;
+    }
+
+    /**
+     * @return
+     */
+    public boolean isCompile() {
+        return compile;
+    }
+
+    public Map getProperties() {
+        return map;
+    }
+
+    /**
+     * @param b
+     */
+    public void setCompile(boolean b) {
+        compile = b;
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/Ws4J2eeFactoryImpl.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/Ws4J2eeFactoryImpl.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/Ws4J2eeFactoryImpl.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/impl/Ws4J2eeFactoryImpl.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,41 @@
+/*
+ * 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.toWs.impl;
+
+import org.apache.geronimo.ews.ws4j2ee.context.ContextFactory;
+import org.apache.geronimo.ews.ws4j2ee.context.impl.ContextFactoryImpl;
+import org.apache.geronimo.ews.ws4j2ee.parsers.ParserFactory;
+import org.apache.geronimo.ews.ws4j2ee.parsers.impl.ParserFactoryImpl;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFactory;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeFactory;
+
+/**
+ * @author hemapani@opensource.lk
+ */
+public class Ws4J2eeFactoryImpl implements Ws4J2eeFactory {
+    public ContextFactory getContextFactory() {
+        return new ContextFactoryImpl();
+    }
+
+    public GenerationFactory getGenerationFactory() {
+        return new GenerationFactoryImpl();
+    }
+
+    public ParserFactory getParserFactory() {
+        return new ParserFactoryImpl();
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileConfigurer.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileConfigurer.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileConfigurer.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileConfigurer.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,144 @@
+/*
+ * 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.toWs.misc;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.ews.ws4j2ee.context.InputOutputFile;
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.dd.JaxrpcMapperGenerator;
+import org.apache.geronimo.ews.ws4j2ee.utils.FileUtils;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class BuildFileConfigurer implements Generator {
+    private J2EEWebServiceContext j2eewscontext;
+
+    protected static Log log =
+            LogFactory.getLog(JaxrpcMapperGenerator.class.getName());
+
+    public BuildFileConfigurer(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
+        this.j2eewscontext = j2eewscontext;
+    }
+
+    public void generate() throws GenerationFault {
+        try {
+            InputStream is = this.getClass().getClassLoader().getResourceAsStream("common.xml");
+            OutputStream os = new FileOutputStream(new File(j2eewscontext.getMiscInfo().getOutPutPath() + "/common.xml"));
+            FileUtils.copyFile(is, os);
+
+            String buildfile = j2eewscontext.getMiscInfo().getOutPutPath() + "/build.xml";
+            if (j2eewscontext.getMiscInfo().isVerbose())
+                log.info("genarating " + buildfile + ".................");
+            PrintWriter out = new PrintWriter(new FileWriter(buildfile));
+            
+            
+            out.write("<?xml version=\"1.0\"?>\n");
+            out.write("<!DOCTYPE project [\n");
+            out.write("        <!ENTITY properties SYSTEM \"file:common.xml\">\n");
+            out.write("]>\n");
+            out.write("<project basedir=\".\" default=\"dist\">\n");
+            
+            out.write("\t&properties;\n");
+            
+            writeproperty("mapping.file",j2eewscontext.getMiscInfo().getJaxrpcfile(), out);
+            writeproperty("wsdl.file",j2eewscontext.getMiscInfo().getWsdlFile(), out);
+            writeproperty("webservice.file",j2eewscontext.getMiscInfo().getWsconffile(), out);
+
+            out.write("	<path id=\"local.classpath\" >\n");
+            File file = new File(".");
+            File tempfile = new File(file,"target/classes");
+            if(tempfile.exists()){
+                out.write("     <pathelement location=\""+tempfile.getCanonicalPath()+"\"/>\n");
+            }
+            
+            tempfile = new File(file,"target/test-classes");
+            if(tempfile.exists()){
+                out.write("     <pathelement location=\""+tempfile.getCanonicalPath()+"\"/>\n");
+            }
+
+            ArrayList classpathelements = j2eewscontext.getMiscInfo().getClasspathElements();
+            if (classpathelements != null) {
+                for (int i = 0; i < classpathelements.size(); i++) {
+                    File pathFile = (File) classpathelements.get(i);
+                    System.out.println(pathFile.getName());
+                    out.write("		<pathelement location=\""
+                            + pathFile.getCanonicalPath() + "\"/>\n");
+                }
+            }
+            out.write("	</path>\n");
+
+
+
+
+            out.write("\t<target name=\"copy-j2ee-resources\">\n");
+               
+
+
+            for (int i = 0; i < classpathelements.size(); i++) {
+                File pathelement = (File) classpathelements.get(i);
+                if(pathelement.isFile() ){
+                    out.write("    <unzip src=\""+pathelement.getCanonicalPath()+"\" dest=\"${build.classes}\"></unzip>\n");
+                }else{
+                    out.write("    <copy todir=\"${build.classes}\">\n");
+                    out.write("       <fileset dir=\""+pathelement.getCanonicalPath()+"\">\n");
+                    out.write("           <include name=\"**/*.class\"/>\n");
+                    out.write("           <include name=\"**/*.xml\"/>\n");
+                    out.write("           <include name=\"**/*.wsdl\"/>\n");                    
+                    out.write("       </fileset>\n");
+                    out.write("    </copy>\n");
+                }
+                
+            }
+            out.write("\t</target>\n");
+            
+            			
+            out.write("</project>\n");
+            out.close();
+        } catch (IOException e) {
+            log.error(e);
+            throw GenerationFault.createGenerationFault(e);
+        }
+    }
+
+    private StringTokenizer getClasspathComponets() {
+        String classpath = System.getProperty("java.class.path");
+        String spearator = System.getProperties().getProperty("path.separator");
+        return new StringTokenizer(classpath, spearator);
+    }
+
+    private void writeproperty(String property, InputOutputFile file, PrintWriter out) throws GenerationFault {
+        try {
+            if (file != null) {
+                String fileName = file.fileName();
+                if (fileName != null) {
+                    File absFile = new File(fileName);
+                    if (absFile.exists())
+                        out.write("<property  name=\""+property+"\" value=\""+absFile.getCanonicalPath()+"\"/>\n");
+                }
+            }
+        } catch (Exception e) {
+        }
+    }
+}

Propchange: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/BuildFileConfigurer.java
------------------------------------------------------------------------------
    svn:executable = *

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/PropertyFileGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/PropertyFileGenerator.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/PropertyFileGenerator.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/misc/PropertyFileGenerator.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,50 @@
+/*
+ * 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.toWs.misc;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
+
+import java.io.FileOutputStream;
+import java.util.Properties;
+
+/**
+ * @author hemapani@opensource.lk
+ */
+public class PropertyFileGenerator implements Generator {
+    private J2EEWebServiceContext context;
+
+    public PropertyFileGenerator(J2EEWebServiceContext context) {
+        this.context = context;
+    }
+
+    public void generate() throws GenerationFault {
+        try {
+            Properties p = new Properties();
+            String wsclass = context.getWSDLContext().gettargetBinding().getName() + "Impl";
+            p.setProperty("impl", wsclass);
+            FileOutputStream out = new FileOutputStream(context.getMiscInfo().getOutPutPath() + "/ws.properties");
+            p.store(out, "ws poperties");
+            out.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw GenerationFault.createGenerationFault(e);
+        }
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/EJBBasedWrapperClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/EJBBasedWrapperClassWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/EJBBasedWrapperClassWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/EJBBasedWrapperClassWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,73 @@
+/*
+ * 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.toWs.wrapperWs;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.JavaClassWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
+
+/**
+ * This class genarate the wrapper Webservice.
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public abstract class EJBBasedWrapperClassWriter extends JavaClassWriter {
+    protected static Log log =
+            LogFactory.getLog(WrapperWsGenerator.class.getName());
+    protected String seiName = null;
+    protected EJBContext context;
+
+    /**
+     * @param j2eewscontext
+     * @param qulifiedName
+     * @throws GenerationFault
+     */
+    public EJBBasedWrapperClassWriter(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        super(j2eewscontext, getName(j2eewscontext) + "Impl");
+        context = j2eewscontext.getEJBDDContext();
+        if (context == null) {
+            throw new UnrecoverableGenerationFault("for ejbbased Impl" +
+                    " the EJBDDContext must not be null");
+        }
+    }
+
+    private static String getName(J2EEWebServiceContext j2eewscontext) {
+        String name = j2eewscontext.getWSDLContext().gettargetBinding().getName();
+        if (name == null) {
+            name = Utils.qName2JavaName(j2eewscontext.getWSDLContext().gettargetBinding().getQName());
+        }
+        return name;
+    }
+
+    protected String getimplementsPart() {
+        return " implements " + j2eewscontext.getMiscInfo().getJaxrpcSEI() + ",org.apache.geronimo.ews.ws4j2ee.wsutils.ContextAccessible";
+    }
+
+    protected void writeAttributes() throws GenerationFault {
+        out.write("private " + seiName + " ejb = null;\n");
+        out.write("private org.apache.axis.MessageContext msgcontext;\n");
+    }
+
+    protected void writeConstructors() throws GenerationFault {
+        out.write("\tpublic " + classname + "(){}\n");
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/SimpleLocalInterfaceBasedWrapperClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/SimpleLocalInterfaceBasedWrapperClassWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/SimpleLocalInterfaceBasedWrapperClassWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/SimpleLocalInterfaceBasedWrapperClassWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,117 @@
+/*
+ * 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.toWs.wrapperWs;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.context.SEIOperation;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class SimpleLocalInterfaceBasedWrapperClassWriter extends EJBBasedWrapperClassWriter {
+
+    /**
+     * @param j2eewscontext
+     * @throws GenerationFault
+     */
+    public SimpleLocalInterfaceBasedWrapperClassWriter(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        super(j2eewscontext);
+        seiName = context.getEjbLocalInterface();
+    }
+
+    protected void writeMethods() throws GenerationFault {
+        out.write("\tpublic void setMessageContext(org.apache.axis.MessageContext msgcontext){;\n");
+        out.write("\t\tthis.msgcontext = msgcontext;\n");
+        out.write("\t}\n");
+        writeGetRemoteRef(classname);
+        String parmlistStr = null;
+        ArrayList operations = j2eewscontext.getMiscInfo().getSEIOperations();
+        for (int i = 0; i < operations.size(); i++) {
+            parmlistStr = "";
+            SEIOperation op = (SEIOperation) operations.get(i);
+            String returnType = op.getReturnType();
+            if (returnType == null)
+                returnType = "void";
+            out.write("\tpublic " + returnType + " " + op.getMethodName() + "(");
+            Iterator pas = op.getParameterNames().iterator();
+            boolean first = true;
+            while (pas.hasNext()) {
+                String name = (String) pas.next();
+                String type = op.getParameterType(name);
+                if (first) {
+                    first = false;
+                    out.write(type + " " + name);
+                    parmlistStr = parmlistStr + name;
+                } else {
+                    out.write("," + type + " " + name);
+                    parmlistStr = parmlistStr + "," + name;
+                }
+            }
+            out.write(") throws java.rmi.RemoteException");
+            ArrayList faults = op.getFaults();
+            for (int j = 0; j < faults.size(); j++) {
+                out.write("," + (String) faults.get(i));
+            }
+            out.write("{\n");
+            out.write("\t\tif(ejb ==  null)\n");
+            out.write("\t\t\tejb = getRemoteRef();\n");
+            if (!"void".equals(returnType))
+                out.write("\t\treturn ejb." + op.getMethodName() + "(" + parmlistStr + ");\n");
+            else
+                out.write("\t\tejb." + op.getMethodName() + "(" + parmlistStr + ");\n");
+            out.write("\t}\n");
+        }
+        //out.write("}\n");	
+    }
+
+    private void writeGetRemoteRef(String classname) {
+//	   out.write("\tpublic "+seiName+" getRemoteRef()throws org.apache.axis.AxisFault{\n");
+//	   out.write("\t\ttry {\n");
+//	   out.write("\t\t    javax.security.auth.callback.CallbackHandler handler\n");
+//	   out.write("\t\t        = org.apache.geronimo.ews.ws4j2ee.wsutils.security.jaasmodules.\n");
+//	   out.write("\t\t            AutenticationCallbackHandlerFactory.createCallbackHandler(msgcontext);\n");
+//	   out.write("\t\t    if(handler != null){\n");
+//	   out.write("\t\t        javax.security.auth.login.LoginContext lc\n"); 
+//	   out.write("\t\t            = new javax.security.auth.login.LoginContext(\"TestClient\", handler);\n");
+//	   out.write("\t\t        lc.login();\n");
+//	   out.write("\t\t    }\n");
+//	   out.write("\t\t}catch (javax.security.auth.login.LoginException e) {\n");
+//	   out.write("\t\t     e.printStackTrace();\n");
+//	   out.write("\t\t     throw org.apache.axis.AxisFault.makeFault(e);\n");
+//	   out.write("\t\t}\n");
+   	
+        out.write("\t\ttry{\n");
+        String ejbname = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
+        int index = ejbname.lastIndexOf(".");
+        if (index > 0) {
+            ejbname = ejbname.substring(index + 1);
+        }
+        out.write("\t\t\tjavax.naming.Context initial = new javax.naming.InitialContext();\n");
+        out.write("\t\t\tObject objref = jndiContext.lookup(\"java:comp/env/ejb/\"" + ejbname + ");\n");
+        String ejbhome = j2eewscontext.getEJBDDContext().getEjbhomeInterface();
+        out.write("\t\t\t" + ejbhome + " home = (" + ejbhome + ")objref;\n");
+        out.write("\t\t\treturn home.create();\n");
+        out.write("\t\t}catch (Exception e) {\n");
+        out.write("\t\t    throw org.apache.axis.AxisFault.makeFault(e);\n");
+        out.write("\t\t}\n");
+        out.write("\t}\n");
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/SimpleRemoteInterfaceBasedWrapperClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/SimpleRemoteInterfaceBasedWrapperClassWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/SimpleRemoteInterfaceBasedWrapperClassWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/SimpleRemoteInterfaceBasedWrapperClassWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,148 @@
+/*
+ * 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.toWs.wrapperWs;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.context.SEIOperation;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public abstract class SimpleRemoteInterfaceBasedWrapperClassWriter extends EJBBasedWrapperClassWriter {
+
+    /**
+     * @param j2eewscontext
+     * @throws GenerationFault
+     */
+    public SimpleRemoteInterfaceBasedWrapperClassWriter(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        super(j2eewscontext);
+        seiName = context.getEjbRemoteInterface();
+    }
+
+    protected abstract String getJNDIInitialContextFactory();
+
+    protected abstract String getJNDIHostAndPort();
+
+    protected String getimplementsPart() {
+        return " implements org.apache.geronimo.ews.ws4j2ee.wsutils.ContextAccessible";
+    }
+
+    protected void writeMethods() throws GenerationFault {
+        out.write("\tpublic void setMessageContext(org.apache.axis.MessageContext msgcontext){;\n");
+        out.write("\t\tthis.msgcontext = msgcontext;\n");
+        out.write("\t}\n");
+        writeGetRemoteRef(classname);
+        String parmlistStr = null;
+        ArrayList operations = j2eewscontext.getMiscInfo().getSEIOperations();
+        for (int i = 0; i < operations.size(); i++) {
+            parmlistStr = "";
+            SEIOperation op = (SEIOperation) operations.get(i);
+            String returnType = op.getReturnType();
+            if (returnType == null)
+                returnType = "void";
+            out.write("\tpublic " + returnType + " " + op.getMethodName() + "(");
+            Iterator pas = op.getParameterNames().iterator();
+            boolean first = true;
+            while (pas.hasNext()) {
+                String name = (String) pas.next();
+                String type = op.getParameterType(name);
+                if (first) {
+                    first = false;
+                    out.write(type + " " + name);
+                    parmlistStr = parmlistStr + name;
+                } else {
+                    out.write("," + type + " " + name);
+                    parmlistStr = parmlistStr + "," + name;
+                }
+            }
+            out.write(") throws java.rmi.RemoteException");
+            ArrayList faults = op.getFaults();
+            for (int j = 0; j < faults.size(); j++) {
+                out.write("," + (String) faults.get(j));
+            }
+            out.write("{\n");
+            out.write("\t\tif(ejb ==  null)\n");
+            out.write("\t\t\tejb = getRemoteRef();\n");
+            if (!"void".equals(returnType))
+                out.write("\t\treturn ejb." + op.getMethodName() + "(" + parmlistStr + ");\n");
+            else
+                out.write("\t\tejb." + op.getMethodName() + "(" + parmlistStr + ");\n");
+            out.write("\t}\n");
+        }
+        //out.write("}\n");	
+    }
+
+    private void writeGetRemoteRef(String classname) {
+        out.write("\tpublic " + seiName + " getRemoteRef()throws org.apache.axis.AxisFault{\n");
+       
+//TODO remove the security code for the time been
+//	   out.write("\t\ttry {\n");
+//	   out.write("\t\tif(msgcontext == null){\n");
+//	   out.write("\t\t		msgcontext = org.apache.axis.MessageContext.getCurrentContext();\n");
+//	   out.write("\t\t}\n");
+//	   out.write("\t\tif(msgcontext == null){\n");
+//       out.write("\t\t		throw new RuntimeException(\"Message Context can not be null\");\n");
+//	   out.write("\t\t}\n");
+//	   
+//	   out.write("\t\torg.apache.geronimo.ews.ws4j2ee.context.security.SecurityContext4J2EE seccontext =\n"); 
+//	   out.write("\t\t			   (org.apache.geronimo.ews.ws4j2ee.context.security.SecurityContext4J2EE)msgcontext\n");
+//	   out.write("\t\t.getProperty(org.apache.ws.axis.security.WSS4J2EEConstants.SEC_CONTEXT_4J2EE);\n");
+//	   out.write("\t\tif(seccontext != null){\n");
+//	   out.write("\t\t\t    javax.security.auth.callback.CallbackHandler handler\n");
+//	   out.write("\t\t\t        = seccontext.getPWDCallbackHandler4J2EE();\n");
+//	   out.write("\t\t\t    if(handler != null){\n");
+//	   out.write("\t\t\t        javax.security.auth.login.LoginContext lc\n"); 
+//	   out.write("\t\t\t            = new javax.security.auth.login.LoginContext(\"TestClient\", handler);\n");
+//	   out.write("\t\t\t        lc.login();\n");
+//	   out.write("\t\t\t    }\n");
+//	   out.write("\t\t}\n");
+//	   
+//	   out.write("\t\t}catch (javax.security.auth.login.LoginException e) {\n");
+//	   out.write("\t\t     e.printStackTrace();\n");
+//	   out.write("\t\t     throw org.apache.axis.AxisFault.makeFault(e);\n");
+//	   out.write("\t\t}\n");
+   	
+        out.write("\t\ttry{\n");
+//	   use the properties set
+//	   out.write("\t\t\tjava.util.Properties env = new java.util.Properties();\n");
+//	   out.write("\t\t\tenv.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,\""+getJNDIInitialContextFactory()+"\");\n");
+//	   out.write("\t\t\tenv.put(javax.naming.Context.PROVIDER_URL, \""+getJNDIHostAndPort()+"\");\n");
+        out.write("\t\t\tjava.util.Properties env = new java.util.Properties();\n");
+        out.write("\t\t\tenv.load(getClass().getClassLoader().getResourceAsStream(\"jndi.properties\"));\n");
+//use the propertyfile
+//       out.write("\t\t\torg.apache.geronimo.ews.ws4j2ee.wsutils.PropertyLoader ploader = new org.apache.geronimo.ews.ws4j2ee.wsutils.PropertyLoader();\n");
+//  	   out.write("\t\t\tjava.util.Properties env = " +
+//  			"ploader.loadProperties(\"jndi.properties\");\n");
+		
+        out.write("\t\t\tjavax.naming.Context initial = new javax.naming.InitialContext(env);\n");
+
+        String ejbname = j2eewscontext.getWSCFContext().getWscfport().getServiceImplBean().getEjblink();
+        out.write("\t\t\tObject objref = initial.lookup(\"ejb/" + ejbname + "\");\n");
+        String ejbhome = j2eewscontext.getEJBDDContext().getEjbhomeInterface();
+        out.write("\t\t\t" + ejbhome + " home = \n\t\t\t\t(" + ejbhome
+                + ")javax.rmi.PortableRemoteObject.narrow(objref," + ejbhome + ".class);\n");
+        out.write("\t\t\treturn home.create();\n");
+        out.write("\t\t}catch (Exception e) {\n");
+        out.write("\t\t    throw org.apache.axis.AxisFault.makeFault(e);\n");
+        out.write("\t\t}\n");
+        out.write("\t}\n");
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WebEndpointWrapperClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WebEndpointWrapperClassWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WebEndpointWrapperClassWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WebEndpointWrapperClassWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,147 @@
+/*
+ * 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.toWs.wrapperWs;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.context.SEIOperation;
+import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.WebContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.JavaClassWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * <h4>WebEndpoint Based Serivce Implementation Bean</h4>
+ * <p>The Service Implementation Bean must follow the Service Developer requirements outlined in the JAX-RPC specification and are listed below except as noted.</p>
+ * <ol>
+ * <li>?The Service Implementation Bean must have a default public constructor.</li>
+ * <li>?The Service Implementation Bean may implement the Service Endpoint
+ * Interface as defined by the JAX-RPC Servlet model. The bean must implement
+ * all the method signatures of the SEI. In addition, a Service Implementation
+ * Bean may be implemented that does not implement the SEI. This additional
+ * requirement provides the same SEI implementation flexibility as provided by
+ * EJB service endpoints. The business methods of the bean must be public and
+ * must not be static.</li>
+ * <li>If the Service Implementation Bean does not implement the SEI, the
+ * business methods must not be final. The Service Implementation Bean
+ * may implement other methods in addition to those defined by the SEI,
+ * but only the SEI methods are exposed to the client.  </li>
+ * <li>?A Service Implementation must be a stateless object. A Service
+ * Implementation Bean must not save client specific state across method
+ * calls either within the bean instance�s data members or external to
+ * the instance. A container may use any bean instance to service a request.</li>
+ * <li>?The class must be public, must not be final and must not be abstract.</li>
+ * <li>?The class must not define the finalize() method.</li>
+ * </ol>
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class WebEndpointWrapperClassWriter extends JavaClassWriter {
+    protected static Log log =
+            LogFactory.getLog(WrapperWsGenerator.class.getName());
+    protected String seiName = null;
+    private String implBean = null;
+
+    /**
+     * @param j2eewscontext
+     * @throws GenerationFault
+     */
+    public WebEndpointWrapperClassWriter(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        super(j2eewscontext, getName(j2eewscontext) + "Impl");
+        seiName = j2eewscontext.getMiscInfo().getJaxrpcSEI();
+        WebContext webcontext = j2eewscontext.getWebDDContext();
+        if (webcontext == null) {
+            throw new UnrecoverableGenerationFault("for webbased Impl" +
+                    " the WebDDContext must not be null");
+        }
+        implBean = webcontext.getServletClass();
+    }
+
+    private static String getName(J2EEWebServiceContext j2eewscontext) {
+        String name = j2eewscontext.getWSDLContext().gettargetBinding().getName();
+        if (name == null) {
+            name = j2eewscontext.getMiscInfo().getJaxrpcSEI();
+        }
+        return name;
+    }
+
+    protected String getimplementsPart() {
+        return " implements "
+                + j2eewscontext.getMiscInfo().getJaxrpcSEI() + ",org.apache.geronimo.ews.ws4j2ee.wsutils.ContextAccessible";
+    }
+
+    protected void writeAttributes() throws GenerationFault {
+        out.write("private " + implBean + " bean = null;\n");
+        out.write("private org.apache.axis.MessageContext msgcontext;\n");
+    }
+
+    protected void writeConstructors() throws GenerationFault {
+        out.write("\tpublic " + classname + "()throws org.apache.axis.AxisFault{\n");
+        out.write("\t\tbean = (" + implBean + ")org.apache.geronimo.ews.ws4j2ee.wsutils.ImplBeanPool.getImplBean(\""
+                + implBean + "\");\n");
+        out.write("\t}\n");
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ews.ws4j2ee.toWs.JavaClassWriter#writeMethods()
+     */
+    protected void writeMethods() throws GenerationFault {
+        out.write("\tpublic void setMessageContext(org.apache.axis.MessageContext msgcontext){;\n");
+        out.write("\t\tthis.msgcontext = msgcontext;\n");
+        out.write("\t}\n");
+        String parmlistStr = null;
+        ArrayList operations = j2eewscontext.getMiscInfo().getSEIOperations();
+        for (int i = 0; i < operations.size(); i++) {
+            parmlistStr = "";
+            SEIOperation op = (SEIOperation) operations.get(i);
+            String returnType = op.getReturnType();
+            if (returnType == null)
+                returnType = "void";
+            out.write("\tpublic " + returnType + " " + op.getMethodName() + "(");
+            Iterator pas = op.getParameterNames().iterator();
+            boolean first = true;
+            while (pas.hasNext()) {
+                String name = (String) pas.next();
+                String type = op.getParameterType(name);
+                if (first) {
+                    first = false;
+                    out.write(type + " " + name);
+                    parmlistStr = parmlistStr + name;
+                } else {
+                    out.write("," + type + " " + name);
+                    parmlistStr = parmlistStr + "," + name;
+                }
+            }
+            out.write(") throws java.rmi.RemoteException");
+            ArrayList faults = op.getFaults();
+            for (int j = 0; j < faults.size(); j++) {
+                out.write("," + (String) faults.get(j));
+            }
+            out.write("{\n");
+            if (!"void".equals(returnType))
+                out.write("\t\treturn bean." + op.getMethodName() + "(" + parmlistStr + ");\n");
+            else
+                out.write("\t\tbean." + op.getMethodName() + "(" + parmlistStr + ");\n");
+            out.write("\t}\n");
+        }
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WrapperClassGeneratorFactory.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WrapperClassGeneratorFactory.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WrapperClassGeneratorFactory.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WrapperClassGeneratorFactory.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,62 @@
+/*
+ * 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.toWs.wrapperWs;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.geronimo.InternalBasedWrapperClassWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.geronimo.RemoteInterfacedBasedWrapperClassWriter4Geronimo;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.jboss.RemoteInterfacedBasedWrapperClassWriter4JBoss;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.jonas.RemoteInterfacedBasedWrapperClassWriter4JOnAS;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class WrapperClassGeneratorFactory {
+    public static Writer createInstance(J2EEWebServiceContext context) throws GenerationFault {
+        String implStyle = context.getMiscInfo().getImplStyle();
+        String container = context.getMiscInfo().getTargetJ2EEContainer();
+        if (!context.getMiscInfo().isImplwithEJB()) {
+            return new WebEndpointWrapperClassWriter(context);
+        } else if (GenerationConstants.USE_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)) {
+            if (GenerationConstants.JBOSS_CONTAINER.equals(container))
+                return new RemoteInterfacedBasedWrapperClassWriter4JBoss(context);
+            else if (GenerationConstants.GERONIMO_CONTAINER.equals(container))
+                return new RemoteInterfacedBasedWrapperClassWriter4Geronimo(context);
+            else if (GenerationConstants.JONAS_CONTAINER.equals(container))
+                return new RemoteInterfacedBasedWrapperClassWriter4JOnAS(context);
+            else
+                throw new UnrecoverableGenerationFault("No proper Wrapper Class generator found");
+        } else if (GenerationConstants.USE_LOCAL.equals(implStyle)) {
+            return new SimpleLocalInterfaceBasedWrapperClassWriter(context);
+        } else if (GenerationConstants.USE_INTERNALS.equals(implStyle)) {
+            if (GenerationConstants.JBOSS_CONTAINER.equals(container)) {
+                //jboss internals
+                throw new UnrecoverableGenerationFault("This combination not supported" + implStyle + "|" + container);
+            } else if (GenerationConstants.GERONIMO_CONTAINER.equals(container)) {
+                return new InternalBasedWrapperClassWriter(context);
+            } else if (GenerationConstants.JONAS_CONTAINER.equals(container))
+                throw new UnrecoverableGenerationFault("This combination not supported" + implStyle + "|" + container);
+            else
+                throw new UnrecoverableGenerationFault("No proper Wrapper Class generator found");
+        }
+        throw new UnrecoverableGenerationFault("No proper Wrapper Class generator found for " + implStyle + "|" + container);
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WrapperWsGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WrapperWsGenerator.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WrapperWsGenerator.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/WrapperWsGenerator.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,45 @@
+/*
+ * 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.toWs.wrapperWs;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
+
+/**
+ * <p>This genarated theWrapper WS required in the
+ * Axis.</p>
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class WrapperWsGenerator implements Generator {
+    private J2EEWebServiceContext j2eewscontext;
+    private Writer writer;
+    protected static Log log =
+            LogFactory.getLog(WrapperWsGenerator.class.getName());
+
+    public WrapperWsGenerator(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
+        this.j2eewscontext = j2eewscontext;
+        writer = WrapperClassGeneratorFactory.createInstance(j2eewscontext);
+    }
+
+    public void generate() throws GenerationFault {
+        writer.write();
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/geronimo/InternalBasedWrapperClassWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/geronimo/InternalBasedWrapperClassWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/geronimo/InternalBasedWrapperClassWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/geronimo/InternalBasedWrapperClassWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,151 @@
+/*
+ * 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.toWs.wrapperWs.geronimo;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.context.SEIOperation;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.JavaClassWriter;
+import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class InternalBasedWrapperClassWriter extends JavaClassWriter {
+    protected static Log log =
+            LogFactory.getLog(InternalBasedWrapperClassWriter.class.getName());
+    protected final String seiName;
+    protected final String ejbName;
+
+    /**
+     * @param j2eewscontext
+     * @param qulifiedName
+     * @throws GenerationFault
+     */
+    public InternalBasedWrapperClassWriter(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        super(j2eewscontext, getName(j2eewscontext) + "Impl");
+        seiName = j2eewscontext.getMiscInfo().getJaxrpcSEI();
+        ejbName = j2eewscontext.getEJBDDContext().getEjbName();
+    }
+
+    private static String getName(J2EEWebServiceContext j2eewscontext) {
+        String name =
+                j2eewscontext.getWSDLContext().gettargetBinding().getName();
+        if (name == null) {
+            name = j2eewscontext.getMiscInfo().getJaxrpcSEI();
+        }
+        return name;
+    }
+
+    protected String getimplementsPart() {
+        return " implements " + j2eewscontext.getMiscInfo().getJaxrpcSEI() + "," + "org.apache.geronimo.ews.ws4j2ee.wsutils.ContextAccessible";
+    }
+
+    protected void writeAttributes() throws GenerationFault {
+        out.write("private org.apache.axis.MessageContext msgcontext;\n");
+        out.write("\tprivate " + seiName + " bean = null;\n");
+        out.write("\tprivate org.openejb.EJBContainer container;\n");
+    }
+
+    protected void writeConstructors() throws GenerationFault {
+        out.write("\tpublic " + classname + "(){\n");
+        out.write("\t}\n");
+    }
+
+    protected void writeMethods() throws GenerationFault {
+        out.write("\tpublic void setMessageContext(org.apache.axis.MessageContext msgcontext){;\n");
+        out.write("\t\tthis.msgcontext = msgcontext;\n");
+        out.write("\t}\n");
+        String parmlistStr = null;
+        ArrayList operations = j2eewscontext.getMiscInfo().getSEIOperations();
+        for (int i = 0; i < operations.size(); i++) {
+            parmlistStr = "";
+            SEIOperation op = (SEIOperation) operations.get(i);
+            String returnType = op.getReturnType();
+            if (returnType == null)
+                returnType = "void";
+            out.write("\tpublic " + returnType + " " + op.getMethodName() + "(");
+            Iterator pas = op.getParameterNames().iterator();
+            boolean first = true;
+            while (pas.hasNext()) {
+                String name = (String) pas.next();
+                String type = op.getParameterType(name);
+                if (first) {
+                    first = false;
+                    out.write(type + " " + name);
+                    parmlistStr = parmlistStr + name;
+                } else {
+                    out.write("," + type + " " + name);
+                    parmlistStr = parmlistStr + "," + name;
+                }
+            }
+            out.write(") throws java.rmi.RemoteException");
+            ArrayList faults = op.getFaults();
+            for (int j = 0; j < faults.size(); j++) {
+                out.write("," + (String) faults.get(i));
+            }
+            out.write("{\n");
+            out.write("\t\tString methodName = \"" + op.getMethodName() + "\";\n");
+            out.write("\t\tjava.lang.reflect.Method callMethod = Utils.getJavaMethod(\""
+                    + seiName
+                    + "\",methodName);\n");
+            out.write("\t\tClass[] classes = callMethod.getParameterTypes();\n");
+            out.write("\t\tObject[] arguments = new Object[]{");
+            pas = op.getParameterNames().iterator();
+            first = true;
+            while (pas.hasNext()) {
+                String name = (String) pas.next();
+                String type = op.getParameterType(name);
+                if (first) {
+                    first = false;
+                    out.write(Utils.getParameter(type, name));
+                } else {
+                    out.write("," + Utils.getParameter(type, name));
+                }
+            }
+            out.write("};\n");
+            if (!"void".equals(returnType)) {
+                out.write("\t\t\treturn "
+                        + Utils.getReturnCode(returnType, "AxisGeronimoUtils.invokeEJB(\""
+                        + ejbName
+                        + "\",methodName,classes,arguments)")
+                        + ";\n");
+            } else {
+                out.write("\t\t\tAxisGeronimoUtils.invokeEJB(\""
+                        + ejbName
+                        + "\",methodName,classes,arguments);\n");
+            }
+            out.write("\t}\n");
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.geronimo.ews.ws4j2ee.toWs.JavaClassWriter#writeImportStatements()
+     */
+    protected void writeImportStatements() throws GenerationFault {
+        out.write("import org.apache.geronimo.axis.AxisGeronimoUtils;\n");
+        out.write("import org.apache.geronimo.ews.ws4j2ee.utils.Utils;\n");
+    }
+
+}
+

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/geronimo/RemoteInterfacedBasedWrapperClassWriter4Geronimo.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/geronimo/RemoteInterfacedBasedWrapperClassWriter4Geronimo.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/geronimo/RemoteInterfacedBasedWrapperClassWriter4Geronimo.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/geronimo/RemoteInterfacedBasedWrapperClassWriter4Geronimo.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,44 @@
+/*
+ * 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.toWs.wrapperWs.geronimo;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.SimpleRemoteInterfaceBasedWrapperClassWriter;
+
+/**
+ * @author hemapani
+ */
+public class RemoteInterfacedBasedWrapperClassWriter4Geronimo extends SimpleRemoteInterfaceBasedWrapperClassWriter {
+
+    /**
+     * @param j2eewscontext
+     * @throws GenerationFault
+     */
+    public RemoteInterfacedBasedWrapperClassWriter4Geronimo(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        super(j2eewscontext);
+    }
+
+    protected String getJNDIHostAndPort() {
+        return "127.0.0.1:1099";
+    }
+
+    protected String getJNDIInitialContextFactory() {
+        return "org.jnp.interfaces.NamingContextFactory";
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/jboss/RemoteInterfacedBasedWrapperClassWriter4JBoss.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/jboss/RemoteInterfacedBasedWrapperClassWriter4JBoss.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/jboss/RemoteInterfacedBasedWrapperClassWriter4JBoss.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/jboss/RemoteInterfacedBasedWrapperClassWriter4JBoss.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,44 @@
+/*
+ * 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.toWs.wrapperWs.jboss;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.SimpleRemoteInterfaceBasedWrapperClassWriter;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class RemoteInterfacedBasedWrapperClassWriter4JBoss extends SimpleRemoteInterfaceBasedWrapperClassWriter {
+
+    /**
+     * @param j2eewscontext
+     * @throws GenerationFault
+     */
+    public RemoteInterfacedBasedWrapperClassWriter4JBoss(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        super(j2eewscontext);
+    }
+
+    protected String getJNDIHostAndPort() {
+        return "127.0.0.1:1099";
+    }
+
+    protected String getJNDIInitialContextFactory() {
+        return "org.jnp.interfaces.NamingContextFactory";
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/jonas/RemoteInterfacedBasedWrapperClassWriter4JOnAS.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/jonas/RemoteInterfacedBasedWrapperClassWriter4JOnAS.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/jonas/RemoteInterfacedBasedWrapperClassWriter4JOnAS.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/wrapperWs/jonas/RemoteInterfacedBasedWrapperClassWriter4JOnAS.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,45 @@
+/*
+ * 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.toWs.wrapperWs.jonas;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.SimpleRemoteInterfaceBasedWrapperClassWriter;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class RemoteInterfacedBasedWrapperClassWriter4JOnAS extends SimpleRemoteInterfaceBasedWrapperClassWriter {
+
+    /**
+     * @param j2eewscontext
+     * @throws GenerationFault
+     */
+    public RemoteInterfacedBasedWrapperClassWriter4JOnAS(J2EEWebServiceContext j2eewscontext)
+            throws GenerationFault {
+        super(j2eewscontext);
+    }
+
+    protected String getJNDIHostAndPort() {
+        // TODO using carol MultiOrb, port number can change from protocol to protocol (jrmp, iiop, jeremie) 
+        return "127.0.0.1:1099";
+    }
+
+    protected String getJNDIInitialContextFactory() {
+        return "org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory";
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: ews-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: ews-dev-help@ws.apache.org


Mime
View raw message