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 [8/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/Ws4J2eeProperties.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeProperties.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeProperties.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeProperties.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,87 @@
+/*
+ * 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;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Properties;
+
+/**
+ * @author hemapani@opensource.lk
+ */
+public class Ws4J2eeProperties {
+    private Properties properties;
+    /**
+     * these a properties of the files or dir
+     * they are checked are they really exists
+     */
+    private ArrayList properitesToCheck;
+
+    public Ws4J2eeProperties() {
+        properties = new Properties();
+        properitesToCheck = new ArrayList();
+        properitesToCheck.add(GenerationConstants.AXIS_WEBAPPS_LIB);
+        properitesToCheck.add(GenerationConstants.EJB_DEPLOY_DIR);
+        properitesToCheck.add(GenerationConstants.MAVEN_LOCAL_REPOSITARY);
+        loadProperties();
+        checkProperties();
+    }
+
+    public String getProperty(String key) {
+        return properties.getProperty(key);
+    }
+
+    private void checkProperties() {
+        for (int i = 0; i < properitesToCheck.size(); i++) {
+            String key = (String) properitesToCheck.get(i);
+            String value = properties.getProperty(key);
+            if (value != null) {
+                File file = new File(value);
+                if (!file.exists()) {
+                    properties.remove(key);
+                }
+            }
+        }
+    }
+
+    private void loadProperties() {
+        InputStream proIn = null;
+        proIn = GenerationConstants.class.getResourceAsStream(GenerationConstants.WS4J2EE_PROPERTY_FILE);
+        try {
+            if (proIn == null) {
+                File file = new File("conf/" + GenerationConstants.WS4J2EE_PROPERTY_FILE);
+                if (file.exists()) {
+                    proIn = new FileInputStream(file);
+                }
+            }
+            if (proIn == null) {
+                proIn = GenerationConstants.class.getResourceAsStream("META-INF/" + GenerationConstants.WS4J2EE_PROPERTY_FILE);
+            }
+            if (proIn == null) {
+                proIn = new FileInputStream(GenerationConstants.WS4J2EE_PROPERTY_FILE);
+            }
+            if (proIn != null) {
+                properties.load(proIn);
+            }
+        } catch (Exception e) {
+            throw new UnrecoverableGenerationFault(e);
+        }
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeServerCLOptionParser.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeServerCLOptionParser.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeServerCLOptionParser.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/Ws4J2eeServerCLOptionParser.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,739 @@
+/*
+ * 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;
+
+import org.apache.axis.encoding.DefaultSOAPEncodingTypeMappingImpl;
+import org.apache.axis.encoding.DefaultTypeMappingImpl;
+import org.apache.axis.i18n.Messages;
+import org.apache.axis.utils.CLArgsParser;
+import org.apache.axis.utils.CLOption;
+import org.apache.axis.utils.CLOptionDescriptor;
+import org.apache.axis.utils.CLUtil;
+import org.apache.axis.utils.ClassUtils;
+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.axis.encoding.TypeMappingRegistryImpl;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author hemapani
+ */
+public class Ws4J2eeServerCLOptionParser implements Ws4J2eeDeployContext {
+    private Module module;
+    private String outPutLocation;
+    private String moduleLocation = null;
+    private String implStyle = GenerationConstants.USE_LOCAL_AND_REMOTE;
+    private String container = GenerationConstants.JBOSS_CONTAINER;
+
+    private String[] args;
+    private int indexToChange = -1;
+
+    /**
+     * @return
+     */
+    public String getOutPutLocation() {
+        return outPutLocation;
+    }
+
+    /**
+     * @param string
+     */
+    public void setOutPutLocation(String string) {
+        outPutLocation = string;
+    }
+    ///////////////////////////////////////////////////////////////////
+//	Define our short one-letter option identifiers.
+
+    /**
+     * Field INHERITED_CLASS_OPT
+     */
+    protected static final int INHERITED_CLASS_OPT = 'a';
+
+    /**
+     * Field SOAPACTION_OPT
+     */
+    protected static final int SOAPACTION_OPT = 'A';
+
+    /**
+     * Field BINDING_NAME_OPT
+     */
+    protected static final int BINDING_NAME_OPT = 'b';
+
+    /**
+     * Field STOP_CLASSES_OPT
+     */
+    protected static final int STOP_CLASSES_OPT = 'c';
+
+    /**
+     * Field IMPORT_SCHEMA_OPT
+     */
+    protected static final int IMPORT_SCHEMA_OPT = 'C';
+
+    /**
+     * Field EXTRA_CLASSES_OPT
+     */
+    protected static final int EXTRA_CLASSES_OPT = 'e';
+
+    /**
+     * Field HELP_OPT
+     */
+    protected static final int HELP_OPT = 'h';
+
+    /**
+     * Field IMPL_CLASS_OPT
+     */
+    protected static final int IMPL_CLASS_OPT = 'i';
+
+    /**
+     * Field INPUT_OPT
+     */
+    protected static final int INPUT_OPT = 'I';
+
+    /**
+     * Field LOCATION_OPT
+     */
+    protected static final int LOCATION_OPT = 'l';
+
+    /**
+     * Field LOCATION_IMPORT_OPT
+     */
+    protected static final int LOCATION_IMPORT_OPT = 'L';
+
+    /**
+     * Field METHODS_ALLOWED_OPT
+     */
+    protected static final int METHODS_ALLOWED_OPT = 'm';
+
+    /**
+     * Field NAMESPACE_OPT
+     */
+    protected static final int NAMESPACE_OPT = 'n';
+
+    /**
+     * Field NAMESPACE_IMPL_OPT
+     */
+    protected static final int NAMESPACE_IMPL_OPT = 'N';
+
+    /**
+     * Field OUTPUT_OPT
+     */
+    protected static final int OUTPUT_OPT = 'o';
+
+    /**
+     * Field OUTPUT_IMPL_OPT
+     */
+    protected static final int OUTPUT_IMPL_OPT = 'O';
+
+    /**
+     * Field PACKAGE_OPT
+     */
+    protected static final int PACKAGE_OPT = 'p';
+
+    /**
+     * Field PORTTYPE_NAME_OPT
+     */
+    protected static final int PORTTYPE_NAME_OPT = 'P';
+
+    /**
+     * Field SERVICE_PORT_NAME_OPT
+     */
+    protected static final int SERVICE_PORT_NAME_OPT = 's';
+
+    /**
+     * Field SERVICE_ELEMENT_NAME_OPT
+     */
+    protected static final int SERVICE_ELEMENT_NAME_OPT = 'S';
+
+    /**
+     * Field TYPEMAPPING_OPT
+     */
+    protected static final int TYPEMAPPING_OPT = 'T';
+
+    /**
+     * Field USE_OPT
+     */
+    protected static final int USE_OPT = 'u';
+
+    /**
+     * Field OUTPUT_WSDL_MODE_OPT
+     */
+    protected static final int OUTPUT_WSDL_MODE_OPT = 'w';
+
+    /**
+     * Field METHODS_NOTALLOWED_OPT
+     */
+    protected static final int METHODS_NOTALLOWED_OPT = 'x';
+
+    protected static final int CLASSPATH_OPT = 'X';
+
+    /**
+     * Field STYLE_OPT
+     */
+    protected static final int STYLE_OPT = 'y';
+
+    protected static final int IMPL_STYLE_OPT = 'E';
+    protected static final int CONTAINER_OPT = 'J';
+
+    /**
+     * Define the understood options. Each CLOptionDescriptor contains:
+     * - The "long" version of the option. Eg, "help" means that "--help" will
+     * be recognised.
+     * - The option flags, governing the option's argument(s).
+     * - The "short" version of the option. Eg, 'h' means that "-h" will be
+     * recognised.
+     * - A description of the option for the usage message
+     */
+    protected CLOptionDescriptor[] options = new CLOptionDescriptor[]{
+        new CLOptionDescriptor("help", CLOptionDescriptor.ARGUMENT_DISALLOWED,
+                HELP_OPT, Messages.getMessage("j2wopthelp00")),
+        new CLOptionDescriptor("input", CLOptionDescriptor.ARGUMENT_REQUIRED,
+                INPUT_OPT, Messages.getMessage("j2woptinput00")),
+        new CLOptionDescriptor("output", CLOptionDescriptor.ARGUMENT_REQUIRED,
+                OUTPUT_OPT,
+                Messages.getMessage("j2woptoutput00")),
+        new CLOptionDescriptor("location",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                LOCATION_OPT,
+                Messages.getMessage("j2woptlocation00")),
+        new CLOptionDescriptor("portTypeName",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                PORTTYPE_NAME_OPT,
+                Messages.getMessage("j2woptportTypeName00")),
+        new CLOptionDescriptor("bindingName",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                BINDING_NAME_OPT,
+                Messages.getMessage("j2woptbindingName00")),
+        new CLOptionDescriptor("serviceElementName", CLOptionDescriptor.ARGUMENT_REQUIRED,
+                SERVICE_ELEMENT_NAME_OPT,
+                Messages.getMessage("j2woptserviceElementName00")),
+        new CLOptionDescriptor("servicePortName",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                SERVICE_PORT_NAME_OPT,
+                Messages.getMessage("j2woptservicePortName00")),
+        new CLOptionDescriptor("namespace",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                NAMESPACE_OPT,
+                Messages.getMessage("j2woptnamespace00")),
+        new CLOptionDescriptor("PkgtoNS",
+                CLOptionDescriptor.DUPLICATES_ALLOWED
+            + CLOptionDescriptor.ARGUMENTS_REQUIRED_2,
+                PACKAGE_OPT,
+                Messages.getMessage("j2woptPkgtoNS00")),
+        new CLOptionDescriptor("methods",
+                CLOptionDescriptor.DUPLICATES_ALLOWED
+            + CLOptionDescriptor.ARGUMENT_REQUIRED,
+                METHODS_ALLOWED_OPT,
+                Messages.getMessage("j2woptmethods00")),
+        new CLOptionDescriptor("all", CLOptionDescriptor.ARGUMENT_DISALLOWED,
+                INHERITED_CLASS_OPT,
+                Messages.getMessage("j2woptall00")),
+        new CLOptionDescriptor("outputWsdlMode",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                OUTPUT_WSDL_MODE_OPT,
+                Messages.getMessage("j2woptoutputWsdlMode00")),
+        new CLOptionDescriptor("locationImport",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                LOCATION_IMPORT_OPT,
+                Messages.getMessage("j2woptlocationImport00")),
+        new CLOptionDescriptor("namespaceImpl",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                NAMESPACE_IMPL_OPT,
+                Messages.getMessage("j2woptnamespaceImpl00")),
+        new CLOptionDescriptor("outputImpl",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                OUTPUT_IMPL_OPT,
+                Messages.getMessage("j2woptoutputImpl00")),
+        new CLOptionDescriptor("implClass",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                IMPL_CLASS_OPT,
+                Messages.getMessage("j2woptimplClass00")),
+        new CLOptionDescriptor("exclude",
+                CLOptionDescriptor.DUPLICATES_ALLOWED
+            + CLOptionDescriptor.ARGUMENT_REQUIRED,
+                METHODS_NOTALLOWED_OPT,
+                Messages.getMessage("j2woptexclude00")),
+        new CLOptionDescriptor("stopClasses",
+                CLOptionDescriptor.DUPLICATES_ALLOWED
+            + CLOptionDescriptor.ARGUMENT_REQUIRED,
+                STOP_CLASSES_OPT,
+                Messages.getMessage("j2woptstopClass00")),
+        new CLOptionDescriptor("typeMappingVersion",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                TYPEMAPPING_OPT,
+                Messages.getMessage("j2wopttypeMapping00")),
+        new CLOptionDescriptor("soapAction",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                SOAPACTION_OPT,
+                Messages.getMessage("j2woptsoapAction00")),
+        new CLOptionDescriptor("style", CLOptionDescriptor.ARGUMENT_REQUIRED,
+                STYLE_OPT, Messages.getMessage("j2woptStyle00")),
+        new CLOptionDescriptor("use", CLOptionDescriptor.ARGUMENT_REQUIRED,
+                USE_OPT, Messages.getMessage("j2woptUse00")),
+        new CLOptionDescriptor("extraClasses",
+                CLOptionDescriptor.DUPLICATES_ALLOWED
+            + CLOptionDescriptor.ARGUMENT_REQUIRED,
+                EXTRA_CLASSES_OPT,
+                Messages.getMessage("j2woptExtraClasses00")),
+        new CLOptionDescriptor("importSchema",
+                CLOptionDescriptor.ARGUMENT_OPTIONAL,
+                IMPORT_SCHEMA_OPT,
+                Messages.getMessage("j2woptImportSchema00")),
+        new CLOptionDescriptor("classpath",
+                CLOptionDescriptor.ARGUMENT_OPTIONAL,
+                CLASSPATH_OPT,
+                Messages.getMessage("optionClasspath")),
+        new CLOptionDescriptor("implStyle",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                IMPL_STYLE_OPT,
+                "impelemtation Style"),
+        new CLOptionDescriptor("container",
+                CLOptionDescriptor.ARGUMENT_REQUIRED,
+                CONTAINER_OPT,
+                "the J2EE contianer")
+    };
+
+    /**
+     * Field emitter
+     */
+    protected Emitter emitter;
+
+    /**
+     * Field className
+     */
+    protected String className = null;
+
+    /**
+     * Field wsdlFilename
+     */
+    protected String wsdlFilename = null;
+
+    /**
+     * Field wsdlImplFilename
+     */
+    protected String wsdlImplFilename = null;
+
+    /**
+     * Field namespaceMap
+     */
+    protected HashMap namespaceMap = new HashMap();
+
+    /**
+     * Field mode
+     */
+    protected int mode = Emitter.MODE_ALL;
+
+    /**
+     * Field locationSet
+     */
+    boolean locationSet = false;
+
+    /**
+     * Instantiate a Java2WSDL emitter.
+     */
+    public Ws4J2eeServerCLOptionParser(String[] args, Emitter emitter) {
+        this.emitter = emitter;
+        // Parse the arguments
+        CLArgsParser argsParser = new CLArgsParser(args, options);
+
+        // Print parser errors, if any
+        if (null != argsParser.getErrorString()) {
+            System.err.println(Messages.getMessage("j2werror00", argsParser.getErrorString()));
+            printUsage();
+            return;
+        }
+
+        // Get a list of parsed options
+        List clOptions = argsParser.getArguments();
+        int size = clOptions.size();
+        // Parse the options and configure the emitter as appropriate.
+        for (int i = 0; i < size; i++) {
+            if (parseOption((CLOption) clOptions.get(i)) == false) {
+                return;
+            }
+        }
+        module = ModuleFactory.createPackageModule(moduleLocation,new File(outPutLocation));
+
+        // validate argument combinations
+        if (validateOptions() == false) {
+            return;
+        }
+
+        // Set the namespace map
+        if (!namespaceMap.isEmpty()) {
+            emitter.setNamespaceMap(namespaceMap);
+        }
+    }    // ctor
+
+    public Ws4J2eeServerCLOptionParser(Emitter emitter) {
+        this.emitter = emitter;
+        emitter.setLocationUrl("http://127.0.0.1");
+    }
+
+    /**
+     * addOptions
+     * Add option descriptions to the tool.  Allows
+     * extended classes to add additional options.
+     *
+     * @param newOptions CLOptionDescriptor[] the options
+     */
+    protected void addOptions(CLOptionDescriptor[] newOptions) {
+        if ((newOptions != null) && (newOptions.length > 0)) {
+            CLOptionDescriptor[] allOptions =
+                    new CLOptionDescriptor[options.length + newOptions.length];
+            System.arraycopy(options, 0, allOptions, 0, options.length);
+            System.arraycopy(newOptions, 0, allOptions, options.length,
+                    newOptions.length);
+            options = allOptions;
+        }
+    }
+
+    /**
+     * Parse an option
+     *
+     * @param option CLOption is the option
+     * @return
+     */
+    protected boolean parseOption(CLOption option) {
+        String value;
+        boolean status = true;
+        switch (option.getId()) {
+            case CLOption.TEXT_ARGUMENT:
+                if (moduleLocation != null) {
+                    System.out.println(Messages.getMessage("j2wDuplicateClass00", className,
+                            option.getArgument()));
+                    printUsage();
+                    status = false;    // error
+                }
+                moduleLocation = option.getArgument();
+
+                break;
+            case METHODS_ALLOWED_OPT:
+                emitter.setAllowedMethods(option.getArgument());
+                break;
+            case INHERITED_CLASS_OPT:
+                emitter.setUseInheritedMethods(true);
+                break;
+            case IMPL_CLASS_OPT:
+                emitter.setImplCls(option.getArgument());
+                break;
+            case HELP_OPT:
+                printUsage();
+                status = false;
+                break;
+            case OUTPUT_WSDL_MODE_OPT:
+                String modeArg = option.getArgument();
+                if ("All".equalsIgnoreCase(modeArg)) {
+                    mode = Emitter.MODE_ALL;
+                } else if ("Interface".equalsIgnoreCase(modeArg)) {
+                    mode = Emitter.MODE_INTERFACE;
+                } else if ("Implementation".equalsIgnoreCase(modeArg)) {
+                    mode = Emitter.MODE_IMPLEMENTATION;
+                } else {
+                    mode = Emitter.MODE_ALL;
+                    System.err.println(Messages.getMessage("j2wmodeerror",
+                            modeArg));
+                }
+                break;
+            case OUTPUT_OPT:
+                outPutLocation = option.getArgument();
+                wsdlFilename = option.getArgument();
+                break;
+            case INPUT_OPT:
+                emitter.setInputWSDL(option.getArgument());
+                break;
+            case OUTPUT_IMPL_OPT:
+                wsdlImplFilename = option.getArgument();
+                break;
+            case PACKAGE_OPT:
+                String packageName = option.getArgument(0);
+                String namespace = option.getArgument(1);
+                namespaceMap.put(packageName, namespace);
+                break;
+            case NAMESPACE_OPT:
+                emitter.setIntfNamespace(option.getArgument());
+                break;
+            case NAMESPACE_IMPL_OPT:
+                emitter.setImplNamespace(option.getArgument());
+                break;
+            case SERVICE_ELEMENT_NAME_OPT:
+                emitter.setServiceElementName(option.getArgument());
+                break;
+            case SERVICE_PORT_NAME_OPT:
+                emitter.setServicePortName(option.getArgument());
+                break;
+            case LOCATION_OPT:
+                emitter.setLocationUrl(option.getArgument());
+                locationSet = true;
+                break;
+            case LOCATION_IMPORT_OPT:
+                emitter.setImportUrl(option.getArgument());
+                break;
+            case METHODS_NOTALLOWED_OPT:
+                emitter.setDisallowedMethods(option.getArgument());
+                break;
+            case PORTTYPE_NAME_OPT:
+                emitter.setPortTypeName(option.getArgument());
+                break;
+            case BINDING_NAME_OPT:
+                emitter.setBindingName(option.getArgument());
+                break;
+            case STOP_CLASSES_OPT:
+                emitter.setStopClasses(option.getArgument());
+                break;
+            case TYPEMAPPING_OPT:
+                value = option.getArgument();
+                TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
+                tmr.doRegisterFromVersion(value);
+                emitter.setTypeMappingRegistry(tmr);
+                break;
+            case SOAPACTION_OPT:
+                value = option.getArgument();
+                if (value.equalsIgnoreCase("DEFAULT")) {
+                    emitter.setSoapAction("DEFAULT");
+                } else if (value.equalsIgnoreCase("OPERATION")) {
+                    emitter.setSoapAction("OPERATION");
+                } else if (value.equalsIgnoreCase("NONE")) {
+                    emitter.setSoapAction("NONE");
+                } else {
+                    System.out.println(Messages.getMessage("j2wBadSoapAction00"));
+                    status = false;
+                }
+                break;
+            case STYLE_OPT:
+                value = option.getArgument();
+                if (value.equalsIgnoreCase("DOCUMENT")
+                        || value.equalsIgnoreCase("RPC")
+                        || value.equalsIgnoreCase("WRAPPED")) {
+                    emitter.setStyle(value);
+                } else {
+                    System.out.println(Messages.getMessage("j2woptBadStyle00"));
+                    status = false;
+                }
+                break;
+            case USE_OPT:
+                value = option.getArgument();
+                if (value.equalsIgnoreCase("LITERAL")
+                        || value.equalsIgnoreCase("ENCODED")) {
+                    emitter.setUse(value);
+                } else {
+                    System.out.println(Messages.getMessage("j2woptBadUse00"));
+                    status = false;
+                }
+                break;
+            case EXTRA_CLASSES_OPT:
+                try {
+                    emitter.setExtraClasses(option.getArgument());
+                } catch (ClassNotFoundException e) {
+                    System.out.println(Messages.getMessage("j2woptBadClass00",
+                            e.toString()));
+                    status = false;
+                }
+                break;
+            case IMPORT_SCHEMA_OPT:
+                emitter.setInputSchema(option.getArgument());
+                break;
+            case CLASSPATH_OPT:
+                ClassUtils.setDefaultClassLoader(ClassUtils.createClassLoader(option.getArgument(),
+                        this.getClass().getClassLoader()));
+                break;
+            case IMPL_STYLE_OPT:
+                this.implStyle = option.getArgument();
+                break;
+            case CONTAINER_OPT:
+                this.container = option.getArgument();
+                break;
+            default :
+                break;
+        }
+        return status;
+    }
+
+    /**
+     * validateOptions
+     * This method is invoked after the options are set to validate
+     * the option settings.
+     *
+     * @return
+     */
+    protected boolean validateOptions() {
+//		 // Can't proceed without a class name
+//		 if ((className == null)) {
+//			 System.out.println(Messages.getMessage("j2wMissingClass00"));
+//			 printUsage();
+//
+//			 return false;
+//		 }
+
+//		 if (!locationSet
+//				 && ((mode == Emitter.MODE_ALL)
+//				 || (mode == Emitter.MODE_IMPLEMENTATION))) {
+//			 System.out.println(Messages.getMessage("j2wMissingLocation00"));
+//			 printUsage();
+//
+//			 return false;
+//		 }
+
+        // Default to SOAP 1.2 JAX-RPC mapping
+        TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
+        tmr.doRegisterFromVersion("1.2");
+        emitter.setTypeMappingRegistry(tmr);
+        return true;    // a-OK
+    }
+
+    /**
+     * printUsage
+     * print usage information and quit.
+     */
+    protected void printUsage() {
+        String lSep = System.getProperty("line.separator");
+        StringBuffer msg = new StringBuffer();
+        msg.append("Java2WSDL "
+                + Messages.getMessage("j2wemitter00")).append(lSep);
+        msg.append(Messages.getMessage("j2wusage00",
+                "java " + getClass().getName()
+                + " [options] class-of-portType")).append(lSep);
+        msg.append(Messages.getMessage("j2woptions00")).append(lSep);
+        msg.append(CLUtil.describeOptions(options).toString());
+        msg.append(Messages.getMessage("j2wdetails00")).append(lSep);
+        System.out.println(msg.toString());
+    }
+
+    /**
+     * @return
+     */
+    public String getWsdlFilename() {
+        return wsdlFilename;
+    }
+
+    /**
+     * @param string
+     */
+    public void setWsdlFilename(String string) {
+        wsdlFilename = string;
+    }
+
+    /**
+     * @return
+     */
+    public String getClassName() {
+        return className;
+    }
+
+    /**
+     * @param string
+     */
+    public void setClassName(String string) {
+        className = string;
+    }
+
+    /**
+     * @return
+     */
+    public int getMode() {
+        return mode;
+    }
+
+    /**
+     * @return
+     */
+    public String getWsdlImplFilename() {
+        return wsdlImplFilename;
+    }
+
+    /**
+     * @param i
+     */
+    public void setMode(int i) {
+        mode = i;
+    }
+
+    /**
+     * @param string
+     */
+    public void setWsdlImplFilename(String string) {
+        wsdlImplFilename = string;
+    }
+
+    /**
+     * @return
+     */
+    public Module getModule() {
+        return module;
+    }
+
+    /**
+     * @return
+     */
+    public String getModuleLocation() {
+        return moduleLocation;
+    }
+
+    /**
+     * @param module
+     */
+    public void setModule(Module module) {
+        this.module = module;
+    }
+
+    /**
+     * @param string
+     */
+    public void setModuleLocation(String string) {
+        moduleLocation = string;
+    }
+
+    /**
+     * @return
+     */
+    public String getContanier() {
+        return container;
+    }
+
+    /**
+     * @return
+     */
+    public String getImplStyle() {
+        return implStyle;
+    }
+
+    /**
+     * @param string
+     */
+    public void setContanier(String string) {
+        container = string;
+    }
+
+    /**
+     * @param string
+     */
+    public void setImplStyle(String string) {
+        implStyle = string;
+    }
+
+    public boolean isCompile() {
+        return true;
+    }
+
+    public Map getProperties() {
+        return new HashMap();
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/J2EEContainerSpecificDDGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/J2EEContainerSpecificDDGenerator.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/J2EEContainerSpecificDDGenerator.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/J2EEContainerSpecificDDGenerator.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.toWs.dd;
+
+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.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.dd.geronimo.GeronimoDDWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.dd.jboss.JBossDDWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.dd.jonas.JOnASDDWriter;
+
+/**
+ * @author Srinath perera(hemapani@opesnource.lk)
+ */
+public class J2EEContainerSpecificDDGenerator implements Generator {
+    private J2EEWebServiceContext j2eewscontext;
+    private Writer writer;
+    protected static Log log =
+            LogFactory.getLog(JaxrpcMapperGenerator.class.getName());
+
+    public J2EEContainerSpecificDDGenerator(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
+        this.j2eewscontext = j2eewscontext;
+        if (GenerationConstants.JBOSS_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer()))
+            writer = new JBossDDWriter(j2eewscontext);
+        else if (GenerationConstants.JONAS_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer()))
+            writer = new JOnASDDWriter(j2eewscontext);
+        else if (GenerationConstants.GERONIMO_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer()))
+            writer = new GeronimoDDWriter(j2eewscontext);
+        else
+            new GenerationFault("unsupported j2ee container " + j2eewscontext.getMiscInfo().getTargetJ2EEContainer());
+    }
+
+    public void generate() throws GenerationFault {
+        if (writer != null)
+            writer.write();
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/JaxRpcMappingFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/JaxRpcMappingFileWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/JaxRpcMappingFileWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/JaxRpcMappingFileWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,253 @@
+/*
+ * 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.toWs.dd;
+
+import org.apache.axis.encoding.SerializationContext;
+import org.apache.axis.wsdl.fromJava.Emitter;
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+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.utils.Utils;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class JaxRpcMappingFileWriter implements Writer {
+    private SerializationContext sc;
+    private String ns = "http://java.sun.com/xml/ns/j2ee";
+    private Emitter emitter;
+    private J2EEWebServiceContext j2eewscontext;
+
+    public JaxRpcMappingFileWriter(java.io.Writer out,
+                                   Emitter emitter,
+                                   J2EEWebServiceContext j2eewscontext) {
+        if (out == null) {
+            throw new UnrecoverableGenerationFault(out + " The writer is null");
+        }
+        sc = new SerializationContext(out);
+        sc.setPretty(true);
+        this.emitter = emitter;
+        this.j2eewscontext = j2eewscontext;
+    }
+
+    private void writePackageMapping() throws IOException {
+        String jaxrpcsei = j2eewscontext.getMiscInfo().getJaxrpcSEI();
+        Map map = emitter.getNamespaceMap();
+        String val = null;
+        if (map != null) {
+            Iterator packages = map.keySet().iterator();
+            while (packages.hasNext()) {
+                String pkg = (String) packages.next();
+                if (pkg == null) {
+                    //TODO this is temporrary work around to make sure 
+                    //the mapping is defined.
+                    String pkgName = Utils.getPackageNameFromQuallifiedName(jaxrpcsei);
+                    val = (String) map.get(pkgName);
+                    if (val == null) {
+                        val = Utils.javapkgToURI(pkgName);
+                    } else {
+                        continue;
+                    }
+                } else if (pkg.equals(jaxrpcsei)) {
+                    continue;
+                } else {
+                    val = (String) map.get(pkg);
+                }
+                //TODO FIX this code to simplfy. 
+                if (pkg != null) {
+                    sc.startElement(new QName(ns, "package-mapping"), null);//package-mapping
+                    sc.startElement(new QName(ns, "package-type"), null);
+                    sc.writeString(pkg);
+                    sc.endElement();
+                    sc.startElement(new QName(ns, "namespaceURI"), null);
+                    sc.writeString(val);
+                    sc.endElement();
+                    sc.endElement();//package-mapping                            
+                }
+            }
+        }
+    }
+
+    public void writeServiceMapping() throws IOException {
+        Service service = j2eewscontext.getWSDLContext().gettargetService().getService();
+        sc.startElement(new QName(ns, "service-interface-mapping"), null);//service-interface-mapping   
+        String name = emitter.getCls().getName();
+        int index = name.lastIndexOf('.');
+        String packageName = "";
+        if (index > 0)
+            packageName = name.substring(0, index + 1);
+        sc.startElement(new QName(ns, "service-interface"), null);
+        sc.writeString(packageName + emitter.getServiceElementName());
+        sc.endElement();
+        sc.registerPrefixForURI("ns1", service.getQName().getNamespaceURI());
+        sc.startElement(new QName(ns, "wsdl-service-name"), null);
+        sc.writeString("ns1:" + service.getQName().getLocalPart());
+        sc.endElement();
+            
+        //port mapping
+        Port wsdlport = j2eewscontext.getWSDLContext().getTargetPort();
+        sc.startElement(new QName(ns, "port-mapping"), null);//port-mapping
+        sc.startElement(new QName(ns, "port-name"), null);
+        sc.writeString(wsdlport.getName());
+        sc.endElement();
+        sc.startElement(new QName(ns, "java-port-name"), null);
+        sc.writeString(emitter.getServicePortName());
+        sc.endElement();
+        sc.endElement();//port-mapping
+        sc.endElement();//service-interface-mapping       
+    }
+
+    private void writeReturnTypes(HashMap methods, Operation op) throws IOException {
+        //set return type
+        Method mtd = (Method) methods.get(op.getName());
+        Class ret = mtd.getReturnType();
+        if (ret != null && !("void".equals(ret.toString()))) {
+            //set return type info
+            Map parts = op.getOutput().getMessage().getParts();
+            if (parts != null) {
+                Iterator partIt = parts.values().iterator();
+                while (partIt.hasNext()) {
+                    //set wsdl message type
+                    QName messagename = op.getOutput().getMessage().getQName();
+                        
+                    //set wsdl message part type
+                    sc.startElement(new QName(ns, "wsdl-return-value-mapping"), null);
+                    sc.startElement(new QName(ns, "method-return-value"), null);
+                    sc.writeString(ret.getName());
+                    sc.endElement();
+                    sc.registerPrefixForURI("ns1", messagename.getNamespaceURI());
+                    sc.startElement(new QName(ns, "wsdl-message"), null);
+                    sc.writeString("ns1:" + messagename.getLocalPart());
+                    sc.endElement();
+                    sc.startElement(new QName(ns, "wsdl-message-part-name"), null);
+                    sc.writeString(((Part) partIt.next()).getName());
+                    sc.endElement();
+                    sc.endElement();//wsdl-return-value-mapping
+                }
+            }
+        }
+    }
+
+    private void writeParametParts(HashMap methods, Operation op) throws IOException {
+        int position = 0;
+        Class[] params = ((Method) methods.get(op.getName())).getParameterTypes();
+        Iterator parmIt = null;
+        Map parameters = op.getInput().getMessage().getParts();
+        if (parameters != null) {
+            parmIt = parameters.values().iterator();
+        }
+        while (parmIt != null && parmIt.hasNext()) {
+            Part part = (Part) parmIt.next();
+            sc.startElement(new QName(ns, "method-param-parts-mapping"), null);
+
+            //set parameter position
+            sc.startElement(new QName(ns, "param-position"), null);
+            sc.writeString(Integer.toString(position));
+            sc.endElement();
+            //set parameter java typr
+            sc.startElement(new QName(ns, "param-type"), null);
+            sc.writeString(params[position].getName());
+            sc.endElement();
+                
+            //set message mapping
+            sc.startElement(new QName(ns, "wsdl-message-mapping"), null);
+            QName messagename = op.getInput().getMessage().getQName();
+            sc.registerPrefixForURI("ns1", messagename.getNamespaceURI());
+            sc.startElement(new QName(ns, "wsdl-message"), null);
+            sc.writeString(messagename.getLocalPart());
+            sc.endElement();
+            sc.startElement(new QName(ns, "wsdl-message-part-name"), null);
+            sc.writeString(part.getName());
+            sc.endElement();
+            sc.startElement(new QName(ns, "parameter-mode"), null);
+            sc.writeString("IN");
+            sc.endElement();
+            sc.endElement();//wsdl-message-mapping
+            sc.endElement();//method-param-parts-mapping
+        }
+    }
+
+    private void writeMethodMapping(Binding binding) throws IOException {
+        //add the operation mappings
+        Iterator ops = binding.getPortType().getOperations().iterator();
+        while (ops.hasNext()) {
+            Operation op = (Operation) ops.next();
+            sc.startElement(new QName(ns, "service-endpoint-method-mapping"), null);//service-endpoint-method-mapping
+
+            //set the java method name
+            sc.startElement(new QName(ns, "java-method-name"), null);
+            sc.writeString(op.getName());
+            sc.endElement();
+            sc.startElement(new QName(ns, "wsdl-operation"), null);
+            sc.writeString(op.getName());
+            sc.endElement();
+            HashMap methods = new HashMap();
+            Method[] javamethods = emitter.getCls().getMethods();
+            for (int i = 0; i < javamethods.length; i++) {
+                methods.put(javamethods[i].getName(), javamethods[i]);
+            }
+            writeReturnTypes(methods, op);
+            //create method param parts mappings    
+            sc.endElement();//service-endpoint-method-mapping
+        }
+    }
+
+    public void write() throws GenerationFault {
+        try {
+            sc.startElement(new QName(ns, "java-wsdl-mapping"), null);
+            writePackageMapping();
+            writeServiceMapping();
+            //port mapping
+            Port wsdlport = j2eewscontext.getWSDLContext().getTargetPort();
+            Binding binding = wsdlport.getBinding();
+            if (binding == null)
+                throw new UnrecoverableGenerationFault("no port discription not match with the wsdl file");
+            sc.startElement(new QName(ns, "service-endpoint-interface-mapping"), null);
+            sc.startElement(new QName(ns, "service-endpoint-interface"), null);
+            sc.writeString(emitter.getCls().getName());
+            sc.endElement();
+            sc.registerPrefixForURI("ns2", binding.getQName().getNamespaceURI());
+            sc.startElement(new QName(ns, "wsdl-binding"), null);
+            sc.writeString("ns2:" + binding.getQName().getLocalPart());
+            sc.endElement();
+            QName ptName = binding.getPortType().getQName();
+            sc.registerPrefixForURI("ns3", ptName.getNamespaceURI());
+            sc.startElement(new QName(ns, "wsdl-port-type"), null);
+            sc.writeString("ns3:" + ptName.getLocalPart());
+            sc.endElement();
+            writeMethodMapping(binding);
+            sc.endElement(); //service-endpoint-interface-mapping   
+            sc.endElement();//java-wsdl-mapping
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/JaxrpcMapperGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/JaxrpcMapperGenerator.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/JaxrpcMapperGenerator.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/JaxrpcMapperGenerator.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,61 @@
+/*
+ * 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.dd;
+
+import org.apache.axis.wsdl.Java2WSDL;
+import org.apache.axis.wsdl.fromJava.Emitter;
+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 java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+
+/**
+ * <p>This genarated theWrapper WS required in the
+ * Axis.</p>
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class JaxrpcMapperGenerator extends Java2WSDL implements Generator {
+    private J2EEWebServiceContext j2eewscontext;
+
+    protected static Log log =
+            LogFactory.getLog(JaxrpcMapperGenerator.class.getName());
+
+    public JaxrpcMapperGenerator(J2EEWebServiceContext j2eewscontext) {
+        this.j2eewscontext = j2eewscontext;
+    }
+
+    public void generate() throws GenerationFault {
+        InputOutputFile outfile = j2eewscontext.getMiscInfo().getJaxrpcfile();
+        PrintWriter pw =
+                new PrintWriter(new OutputStreamWriter(outfile.getOutStream()));
+        this.j2eewscontext.getJAXRPCMappingContext().serialize(pw);
+        pw.close();
+        if (j2eewscontext.getMiscInfo().isVerbose())
+            log.info(outfile.fileName() + " genarated .................");
+    }
+
+    public Emitter getEmmiter() {
+        return emitter;
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/WebContainerDDGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/WebContainerDDGenerator.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/WebContainerDDGenerator.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/WebContainerDDGenerator.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.dd;
+
+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;
+
+/**
+ * @author Srinath perera(hemapani@opesnource.lk)
+ */
+public class WebContainerDDGenerator implements Generator {
+    private J2EEWebServiceContext j2eewscontext;
+    private Writer writer;
+    protected static Log log =
+            LogFactory.getLog(JaxrpcMapperGenerator.class.getName());
+
+    public WebContainerDDGenerator(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
+    }
+
+    public void generate() throws GenerationFault {
+        System.out.println("code to generatre web.xml");
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/geronimo/GeronimoDDWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/geronimo/GeronimoDDWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/geronimo/GeronimoDDWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/geronimo/GeronimoDDWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,105 @@
+/*
+ * 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.dd.geronimo;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+/**
+ * @author hemapani
+ */
+public class GeronimoDDWriter extends AbstractWriter {
+    public GeronimoDDWriter(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
+        super(j2eewscontext, j2eewscontext.getMiscInfo().getOutPutPath() +
+                "/META-INF/" + GenerationConstants.GERONIMO_DD);
+    }
+
+    public void writeCode() throws GenerationFault {
+        writeEJBDD();
+    }
+	
+//	<?xml version="1.0"?>
+//	<openejb-jar
+//		xmlns="http://www.openejb.org/xml/ns/openejb-jar"
+//		configId="your/domain/name/Example"
+//		parentId="org/apache/geronimo/Server">
+//
+//		<enterprise-beans>
+//			<session>
+//				<ejb-name>SimpleStatelessSession</ejb-name>
+//				<jndi-name>client/test/simple/SimpleStatelessSessionHome</jndi-name>
+//			</session>
+//		</enterprise-beans>
+//	</openejb-jar>
+    public void writeEJBDD() {
+        String ejbname = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
+        int index = ejbname.lastIndexOf(".");
+        if (index > 0) {
+            ejbname = ejbname.substring(index + 1);
+        }
+        out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+        out.write("<openejb-jar\n");
+        out.write("    xmlns=\"http://www.openejb.org/xml/ns/openejb-jar\"\n");
+        out.write("    configId=\"j2ee/geronimo/ews/" + ejbname + "\"\n");
+        out.write("    parentId=\"org/apache/geronimo/Server\">\n");
+        out.write("    <enterprise-beans>\n");
+        out.write("        <session>\n");
+        out.write("            <ejb-name>" + ejbname + "</ejb-name>\n");
+        String implStyle = j2eewscontext.getMiscInfo().getImplStyle();
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_REMOTE.equals(implStyle)) {
+            out.write("	  <jndi-name>" + "ejb/" + ejbname + "</jndi-name>\n");
+        }
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_LOCAL.equals(implStyle)) {
+            out.write("	  <local-jndi-name>" + "ejb/" + ejbname + "Local" + "</local-jndi-name>\n");
+        }
+        out.write("         </session>\n");
+        out.write("     </enterprise-beans>\n");
+        out.write("</openejb-jar>\n");
+        out.flush();
+    }
+	
+
+//	<?xml version="1.0" encoding="UTF-8"?>
+//	<web-app
+//		xmlns="http://geronimo.apache.org/xml/ns/web/jetty"
+//		configId="your/domain/name/Example"
+//		parentId="org/apache/geronimo/Server"
+//		>
+//		<context-root>/debug-tool</context-root>
+//		<context-priority-classloader>false</context-priority-classloader>
+//	</web-app>
+    public void writeWebDD() {
+        String ejbname = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
+        int index = ejbname.lastIndexOf(".");
+        if (index > 0) {
+            ejbname = ejbname.substring(index + 1);
+        }
+        out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+        out.write("<web-app\n");
+        out.write("    xmlns=\"http://www.openejb.org/xml/ns/openejb-jar\"\n");
+        out.write("    configId=\"j2ee/geronimo/ews/" + ejbname + "\"\n");
+        out.write("    parentId=\"org/apache/geronimo/Server\">\n");
+        out.write("    <context-root>/axis</context-root>");
+        out.write("    <context-priority-classloader>false</context-priority-classloader>");
+        out.write("</web-app>");
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/jboss/JBossDDWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/jboss/JBossDDWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/jboss/JBossDDWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/jboss/JBossDDWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,58 @@
+/*
+ * 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.dd.jboss;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+/**
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class JBossDDWriter extends AbstractWriter {
+    public JBossDDWriter(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
+        super(j2eewscontext, j2eewscontext.getMiscInfo().getOutPutPath() +
+                "/META-INF/jboss.xml");
+    }
+
+    public void writeCode() throws GenerationFault {
+        if (out == null)
+            return;
+        String ejbname = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
+        int index = ejbname.lastIndexOf(".");
+        if (index > 0) {
+            ejbname = ejbname.substring(index + 1);
+        }
+        out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+        out.write("<jboss>\n");
+        out.write("  <enterprise-beans>\n");
+        out.write("	<session>\n");
+        out.write("	  <ejb-name>" + ejbname + "</ejb-name>\n");
+        String implStyle = j2eewscontext.getMiscInfo().getImplStyle();
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_REMOTE.equals(implStyle)) {
+            out.write("	  <jndi-name>" + "ejb/" + ejbname + "</jndi-name>\n");
+        }
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_LOCAL.equals(implStyle)) {
+            out.write("	  <local-jndi-name>" + "ejb/" + ejbname + "Local" + "</local-jndi-name>\n");
+        }
+        out.write("	</session>\n");
+        out.write("  </enterprise-beans>\n");
+        out.write("</jboss>\n");
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/jonas/JOnASDDWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/jonas/JOnASDDWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/jonas/JOnASDDWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/dd/jonas/JOnASDDWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,58 @@
+/*
+ * 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.dd.jonas;
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+/**
+ * @author sauthieg
+ */
+public class JOnASDDWriter extends AbstractWriter {
+    public JOnASDDWriter(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
+        super(j2eewscontext, j2eewscontext.getMiscInfo().getOutPutPath() +
+                "/ejb/META-INF/JonAs.xml");
+    }
+
+    public void writeCode() throws GenerationFault {
+        String ejbname = j2eewscontext.getWSDLContext().getTargetPortType().getName().toLowerCase();
+        int index = ejbname.lastIndexOf(".");
+        if (index > 0) {
+            ejbname = ejbname.substring(index + 1);
+        }
+        out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+        out.write("<jonas-ejb-jar xmlns=\"http://www.objectweb.org/jonas/ns\"\n");
+        out.write("               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
+        out.write("               xsi:schemaLocation=\"http://www.objectweb.org/jonas/ns\"\n");
+        out.write("                                    http://www.objectweb.org/jonas/ns/jonas-ejb-jar_4_0.xsd\">\n");
+        out.write("	<jonas-session>\n");
+        out.write("	  <ejb-name>" + j2eewscontext.getMiscInfo().getJ2eeComponetLink() + "</ejb-name>\n");
+        String implStyle = j2eewscontext.getMiscInfo().getImplStyle();
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_REMOTE.equals(implStyle)) {
+            out.write("	  <jndi-name>" + j2eewscontext.getMiscInfo().getJ2eeComponetLink() + "</jndi-name>\n");
+        }
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_LOCAL.equals(implStyle)) {
+            //TODO fill this what is the correct tag for JonAs	
+            //out.write("	  <local-jndi-name>" + "ejb/" +ejbname+ "Local"+"</local-jndi-name>\n");
+        }
+        out.write("	</jonas-session>\n");
+        out.write("</jonas-ejb-jar>\n");
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBDDWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBDDWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBDDWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBDDWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,105 @@
+/*
+ * 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 javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.PropertyException; */
+
+import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
+import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.AbstractWriter;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+
+/**
+ * We plan to use the JAXB to genarate and parse the
+ * ejb-jar.xml file. This code is here just to get a simple
+ * DD created
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class EJBDDWriter extends AbstractWriter {
+    protected EJBContext ejbcontext;
+
+    /**
+     * @param j2eewscontext
+     * @throws GenerationFault
+     */
+    public EJBDDWriter(J2EEWebServiceContext j2eewscontext, EJBContext ejbcontext)
+            throws GenerationFault {
+        super(j2eewscontext, j2eewscontext.getMiscInfo().getOutPutPath() + "/META-INF/ejb-jar.xml");
+        this.ejbcontext = ejbcontext;
+    }
+
+    public void writeCode() throws GenerationFault {
+        if (out != null)
+            writeSessionDD();
+    }
+
+    public void writeSessionDD() throws GenerationFault {
+        String ejbname = j2eewscontext.getWSCFContext().getWscfport().getServiceImplBean().getEjblink();
+        if (ejbname == null || ejbname.equals("")) {
+        	throw new GenerationFault("Error reading ejbname from webservices.xml.");
+        }
+        String version = GenerationConstants.J2EE_VERSION_1_4;
+        out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+        out.write("<ejb-jar xmlns=\"http://java.sun.com/xml/ns/j2ee\"\n");
+        out.write("		 xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
+        out.write("		 xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee\n");
+        out.write("		 http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd\"\n");
+        out.write("		 version=\"2.1\">\n");
+
+        out.write("\t<enterprise-beans>\n");
+        out.write("\t\t<session>\n");
+        out.write("\t\t\t<display-name>" + j2eewscontext.getWSCFContext().getDisplayName() + "</display-name>\n");
+        out.write("\t\t\t<ejb-name>" + ejbname + "</ejb-name>\n");
+        String implStyle = j2eewscontext.getMiscInfo().getImplStyle();
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_INTERNALS.equals(implStyle)) {
+            out.write("\t\t\t<home>" + ejbcontext.getEjbhomeInterface() + "</home>\n");
+            out.write("\t\t\t<remote>" + ejbcontext.getEjbRemoteInterface() + "</remote>\n");
+        }
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_LOCAL.equals(implStyle)) {
+            out.write("\t\t\t<local-home>" + ejbcontext.getEjbLocalHomeInterfce() + "</local-home>\n");
+            out.write("\t\t\t<local>" + ejbcontext.getEjbLocalInterface() + "</local>\n");
+        }
+        out.write("\t\t\t<ejb-class>" + ejbcontext.getImplBean() + "</ejb-class>\n");
+        out.write("\t\t\t<session-type>Stateless</session-type>\n");
+        out.write("\t\t\t<transaction-type>Bean</transaction-type>\n");
+        out.write("\t\t\t<security-identity>\n");
+        out.write("\t\t\t\t<description></description>\n");
+        out.write("\t\t\t\t<use-caller-identity></use-caller-identity>\n");
+        out.write("\t\t\t</security-identity>\n");
+        out.write("\t\t</session>\n");
+        out.write("\t</enterprise-beans>\n");
+        out.write("\t<assembly-descriptor>\n");
+        out.write("\t    <method-permission>\n");
+        out.write("\t        <unchecked/>\n");
+        out.write("\t        <method>\n");
+        out.write("\t		     <ejb-name>" + ejbname + "</ejb-name>\n");
+        out.write("\t			 <method-name>*</method-name>\n");
+        out.write("\t		</method>\n");
+        out.write("\t     </method-permission>\n");
+        out.write("\t</assembly-descriptor>\n");
+        out.write("</ejb-jar>\n");
+    }
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBGenerator.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBGenerator.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBGenerator.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,88 @@
+/*
+ * 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.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.UnrecoverableGenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
+import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeFactory;
+
+/**
+ * <p>This class crete the nessacsaary EJB artifacts</p>
+ *
+ * @author Srinath Perera(hemapani@opensource.lk)
+ */
+public class EJBGenerator implements Generator {
+    private J2EEWebServiceContext context;
+    private Writer homewriter;
+    private Writer remotewriter;
+    private Writer beanwriter;
+    private Writer ddwriter;
+    private Writer localwriter;
+    private Writer localhomewriter;
+    protected EJBContext ejbcontext;
+    private Ws4J2eeFactory factory;
+
+    public EJBGenerator(J2EEWebServiceContext context) throws GenerationFault {
+        this.context = context;
+        ejbcontext = context.getEJBDDContext();
+        if (ejbcontext == null) {
+            throw new UnrecoverableGenerationFault("for ejbbased Impl" +
+                    " the EJBDDContext must not be null");
+        }
+        factory = context.getFactory();
+        String implStyle = context.getMiscInfo().getImplStyle();
+        if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_REMOTE.equals(implStyle)) {
+            homewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_HOME_INTERFACE_WRITER);
+            remotewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_REMOTE_INTERFACE_WRITER);
+        } else if (GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)
+                || GenerationConstants.USE_LOCAL.equals(implStyle)) {
+            localhomewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_LOCAL_HOME_INTERFACE_WRITER);
+            localwriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_LOCAL_INTERFACE_WRITER);
+        } else if (GenerationConstants.USE_INTERNALS.equals(implStyle)) {
+            homewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_HOME_INTERFACE_WRITER);
+            remotewriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_REMOTE_INTERFACE_WRITER);
+        }
+        if (!context.getMiscInfo().isImplAvalible()) {
+            beanwriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_IMPLEMENTATION_BEAN_WRITER);
+        }
+        ddwriter = factory.getGenerationFactory().createEJBWriter(context, ejbcontext, GenerationConstants.EJB_DD_WRITER);
+    }
+
+    public void generate() throws GenerationFault {
+        if (homewriter != null)
+            homewriter.write();
+        if (remotewriter != null)
+            remotewriter.write();
+        if (beanwriter != null)
+            beanwriter.write();
+        if (ddwriter != null)
+            ddwriter.write();
+        if (localwriter != null) {
+            localwriter.write();
+        }
+        if (localhomewriter != null) {
+            localhomewriter.write();
+        }
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBHomeWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBHomeWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBHomeWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBHomeWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,70 @@
+/*
+ * 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.j2eeDD.EJBContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.JavaInterfaceWriter;
+
+/**
+ * This class can be used to write the appropriate EJB Home interface
+ * class for the given port type.
+ *
+ * @author Rajith Priyanga
+ * @author Srinath Perera
+ * @date Nov 26, 2003
+ */
+public class EJBHomeWriter extends JavaInterfaceWriter {
+    private String name;
+    protected EJBContext ejbcontext;
+
+    /**
+     * Constructs a EJBHomeWriter.
+     *
+     * @param portType The port type which contains the details.
+     * @throws GenerationFault
+     */
+    public EJBHomeWriter(J2EEWebServiceContext context, EJBContext ejbcontext) throws GenerationFault {
+        super(context, ejbcontext.getEjbhomeInterface());
+        this.ejbcontext = ejbcontext;
+    }
+//TODO
+//	/**
+//	 * Returns the complete file name of the source code file which is
+//	 * generated by the writer.
+//	 */
+//	public String getFileName() {
+//		name = ejbcontext.getEjbhomeInterface();
+//		String outdir = j2eewscontext.getMiscInfo().getOutPutPath();
+//		if (!outdir.endsWith("/"))
+//			outdir = outdir + "/";
+//
+//		return outdir + name.replace('.', '/') + ".java";
+//	}
+
+    protected void writeAttributes() throws GenerationFault {
+    }
+
+    protected void writeMethods() throws GenerationFault {
+        out.write("\tpublic " + ejbcontext.getEjbRemoteInterface() + " create()throws java.rmi.RemoteException,javax.ejb.CreateException;\n");
+    }
+
+    protected String getExtendsPart() {
+        return " extends javax.ejb.EJBHome";
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBLocalHomeWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBLocalHomeWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBLocalHomeWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBLocalHomeWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,57 @@
+/*
+ * 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.j2eeDD.EJBContext;
+import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
+import org.apache.geronimo.ews.ws4j2ee.toWs.JavaInterfaceWriter;
+
+/**
+ * This class can be used to write the appropriate EJB LocalHome interface
+ * class for the given port type.
+ *
+ * @author Rajith Priyanga
+ * @author Srinath Perera
+ * @date Nov 26, 2003
+ */
+public class EJBLocalHomeWriter extends JavaInterfaceWriter {
+    private String name;
+    protected EJBContext ejbcontext;
+
+    /**
+     * Constructs a EJBLocalHomeWriter.
+     *
+     * @param portType The port type which contains the details.
+     * @throws GenerationFault
+     */
+    public EJBLocalHomeWriter(J2EEWebServiceContext context, EJBContext ejbcontext) throws GenerationFault {
+        super(context, ejbcontext.getEjbLocalHomeInterfce());
+        this.ejbcontext = ejbcontext;
+    }
+
+    protected void writeAttributes() throws GenerationFault {
+    }
+
+    protected void writeMethods() throws GenerationFault {
+        out.write("\tpublic " + ejbcontext.getEjbLocalInterface() + " create()throws javax.ejb.CreateException;\n");
+    }
+
+    protected String getExtendsPart() {
+        return " extends javax.ejb.EJBLocalHome ";
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBLocalWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBLocalWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBLocalWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBLocalWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,90 @@
+/*
+ * 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.JavaInterfaceWriter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * This class can be used to write the appropriate EJB Remote interface
+ * class for the given port type.
+ *
+ * @author Rajith Priyanga
+ * @author Srinath Perera
+ * @date Nov 26, 2003
+ */
+public class EJBLocalWriter extends JavaInterfaceWriter {
+    private String name;
+    protected EJBContext ejbcontext;
+
+    /**
+     * Constructs a EJBRemoteWriter.
+     *
+     * @param portType The port type which contains the details.
+     * @throws GenerationFault
+     */
+    public EJBLocalWriter(J2EEWebServiceContext context, EJBContext ejbcontext) throws GenerationFault {
+        super(context, ejbcontext.getEjbLocalInterface());
+        this.ejbcontext = ejbcontext;
+    }
+
+    protected String getExtendsPart() {
+        return " extends javax.ejb.EJBLocalObject";
+    }
+
+    protected void writeAttributes() 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();
+            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 = (String) op.getParameterType(name);
+                if (first) {
+                    first = false;
+                    out.write(type + " " + name);
+                    parmlistStr = parmlistStr + name;
+                } else {
+                    out.write("," + type + " " + name);
+                    parmlistStr = "," + name;
+                }
+            }
+            out.write(")");
+//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");
+        }
+    }
+
+}

Added: webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBRemoteWriter.java
URL: http://svn.apache.org/viewcvs/webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBRemoteWriter.java?rev=230793&view=auto
==============================================================================
--- webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBRemoteWriter.java (added)
+++ webservices/ews/trunk/ws4j2ee/src/java/org/apache/geronimo/ews/ws4j2ee/toWs/ejb/EJBRemoteWriter.java Mon Aug  8 05:40:25 2005
@@ -0,0 +1,91 @@
+/*
+ * 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.JavaInterfaceWriter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * This class can be used to write the appropriate EJB Remote interface
+ * class for the given port type.
+ *
+ * @author Rajith Priyanga
+ * @author Srinath Perera
+ * @date Nov 26, 2003
+ */
+public class EJBRemoteWriter extends JavaInterfaceWriter {
+    private String name;
+    protected EJBContext ejbcontext;
+
+    /**
+     * Constructs a EJBRemoteWriter.
+     *
+     * @param portType The port type which contains the details.
+     * @throws GenerationFault
+     */
+    public EJBRemoteWriter(J2EEWebServiceContext context, EJBContext ejbcontext) throws GenerationFault {
+        super(context, ejbcontext.getEjbRemoteInterface());
+        this.ejbcontext = ejbcontext;
+    }
+
+    protected String getExtendsPart() {
+        return " extends javax.ejb.EJBObject";
+    }
+
+    protected void writeAttributes() 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();
+            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 = (String) op.getParameterType(name);
+                if (first) {
+                    first = false;
+                    out.write(type + " " + name);
+                    parmlistStr = parmlistStr + name;
+                } else {
+                    out.write("," + type + " " + name);
+                    parmlistStr = "," + name;
+                }
+            }
+            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");
+        }
+    }
+
+}



---------------------------------------------------------------------
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