You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2007/09/04 14:39:45 UTC
svn commit: r572651 [1/6] - in /webservices/axis2/trunk/java: ./
modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/ modules/corba/
modules/corba/src/ modules/corba/src/org/ modules/corba/src/org/apache/
modules/corba/src/org/apache/axis2/ module...
Author: deepal
Date: Tue Sep 4 05:39:42 2007
New Revision: 572651
URL: http://svn.apache.org/viewvc?rev=572651&view=rev
Log:
applying corba patch , thx Eranga for your patch
- please go though the commit and see whether I have missed anything
-Fixing the build break in windows
Added:
webservices/axis2/trunk/java/modules/corba/
webservices/axis2/trunk/java/modules/corba/pom.xml
webservices/axis2/trunk/java/modules/corba/src/
webservices/axis2/trunk/java/modules/corba/src/org/
webservices/axis2/trunk/java/modules/corba/src/org/apache/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaConstants.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaException.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaInvocationException.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/IDLProcessorException.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/IDLProcessor.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/parser/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/parser/IDLLexer.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/parser/IDLParser.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/parser/IDLTokenTypes.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/parser/IDLVisitor.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/parser/idl.g
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/AbstractCollectionType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/ArrayType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/CompositeDataType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/DataType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/EnumType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/ExceptionType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/IDL.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/Interface.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/Member.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/Operation.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/PrimitiveDataType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/SequenceType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/Struct.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/Typedef.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/UnionMember.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/UnionType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/types/ValueType.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/AbstractCollectionValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/AbstractValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/AliasValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/ArrayValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/EnumValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/ExceptionValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/ObjectByValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/SequenceValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/StreamableValueFactory.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/StructValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/values/UnionValue.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/CorbaInOnlyMessageReceiver.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/CorbaInOutAsyncMessageReceiver.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/CorbaInvoker.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/CorbaInvokerFactory.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/CorbaMessageReceiver.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/CorbaUtil.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/Invoker.java
webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/receivers/InvokerFactory.java
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
webservices/axis2/trunk/java/modules/distribution/src/main/assembly/bin-assembly.xml
webservices/axis2/trunk/java/modules/distribution/src/main/assembly/src-assembly.xml
webservices/axis2/trunk/java/modules/documentation/pom.xml
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
webservices/axis2/trunk/java/modules/webapp/pom.xml
webservices/axis2/trunk/java/pom.xml
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java?rev=572651&r1=572650&r2=572651&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/WSDL11Writer.java Tue Sep 4 05:39:42 2007
@@ -101,7 +101,7 @@
wsdlLocation = wsdlImport.getDefinition().getDocumentBaseURI();
// we have to process this wsdl file only if it has not been processed earlier
if (!baseURIwsdlNameMap.containsKey(wsdlLocation)) {
- wsdlName = wsdlLocation.substring(wsdlLocation.lastIndexOf(File.separator) + 1);
+ wsdlName = wsdlLocation.substring(wsdlLocation.lastIndexOf('/') + 1);
//trim the wsdl part
wsdlName = wsdlName.substring(0, wsdlName.indexOf(".wsdl"));
Added: webservices/axis2/trunk/java/modules/corba/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/corba/pom.xml?rev=572651&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/corba/pom.xml (added)
+++ webservices/axis2/trunk/java/modules/corba/pom.xml Tue Sep 4 05:39:42 2007
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-parent</artifactId>
+ <version>SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>axis2-corba</artifactId>
+ <name>Apache Axis 2.0 - CORBA</name>
+ <description>Axis2 CORBA module</description>
+ <dependencies>
+ <dependency>
+ <groupId>antlr</groupId>
+ <artifactId>antlr</artifactId>
+ <version>2.7.6</version>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.yoko</groupId>
+ <artifactId>yoko-core</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.yoko</groupId>
+ <artifactId>yoko-spec-corba</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency-->
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-metadata</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <!--dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-dom</artifactId>
+ <version>1.2.2</version>
+ </dependency-->
+ </dependencies>
+ <build>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ <testResources>
+ <testResource>
+ <directory>test-resources</directory>
+ </testResource>
+ </testResources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaConstants.java?rev=572651&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaConstants.java (added)
+++ webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaConstants.java Tue Sep 4 05:39:42 2007
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axis2.corba.deployer;
+
+public interface CorbaConstants {
+ // Constants for Service DD XML
+ String IDL_FILE = "idlFile";
+
+ // To use a custom ORB
+ String ORB_CLASS = "orbClass";
+ String ORB_SINGLETON_CLASS = "orbSingletonClass";
+
+ // One of the following is required to locate the CORBA service
+ String NAMING_SERVICE_URL = "namingServiceUrl";
+ String IOR_FILE_PATH = "iorFilePath";
+ String IOR_STRING = "iorString";
+
+ // Required only if namingServiceUrl is provided
+ String OBJECT_NAME = "objectName";
+
+ // Name of the CORBA interface
+ String INTERFACE_NAME = "interfaceName";
+
+ // Constants for processing the corba web services
+ String ORB_LITERAL = "orb";
+ String IDL_LITERAL = "idl";
+ String RETURN_WRAPPER = "return";
+ String VOID = "void";
+ String RESPONSE = "Response";
+ String FAULT = "Fault";
+ String ARRAY_ITEM = "item";
+ String ORG_OMG_CORBA_ORBCLASS = "org.omg.CORBA.ORBClass";
+ String DEFAULR_ORB_CLASS = "org.apache.yoko.orb.CORBA.ORB";
+ String ORG_OMG_CORBA_ORBSINGLETON_CLASS = "org.omg.CORBA.ORBSingletonClass";
+ String DEFAULT_ORBSINGLETON_CLASS = "org.apache.yoko.orb.CORBA.ORBSingleton";
+
+ String NAME_SPACE_PREFIX = "ax2"; // axis2 name space
+ String HTTP = "http://";
+ char PACKAGE_CLASS_DELIMITER = '.';
+ String SCHEMA_NAMESPACE_EXTN = "/xsd";
+ String DEFAULT_SCHEMA_NAMESPACE_PREFIX = "xs";
+ String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
+ String FORM_DEFAULT_UNQUALIFIED = "unqualified";
+}
Added: webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java?rev=572651&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java (added)
+++ webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java Tue Sep 4 05:39:42 2007
@@ -0,0 +1,573 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axis2.corba.deployer;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.corba.idl.types.*;
+import org.apache.axis2.corba.receivers.CorbaUtil;
+import org.apache.axis2.deployment.*;
+import org.apache.axis2.deployment.repository.util.DeploymentFileData;
+import org.apache.axis2.deployment.util.PhasesInfo;
+import org.apache.axis2.description.*;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.util.Loader;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.description.java2wsdl.TypeTable;
+import org.omg.CORBA_2_3.ORB;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import java.io.*;
+import java.net.MalformedURLException;
+import java.util.*;
+
+public class CorbaDeployer implements Deployer, DeploymentConstants, CorbaConstants {
+ private static final Log log = LogFactory.getLog(CorbaDeployer.class);
+ private AxisConfiguration axisConfig;
+ private ConfigurationContext configCtx;
+
+ public void init(ConfigurationContext configCtx) {
+ this.configCtx = configCtx;
+ this.axisConfig = this.configCtx.getAxisConfiguration();
+ }
+
+ public void deploy(DeploymentFileData deploymentFileData) throws DeploymentException {
+ try {
+ deploymentFileData.setClassLoader(axisConfig.getServiceClassLoader());
+ AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig);
+ serviceGroup.setServiceGroupClassLoader(deploymentFileData.getClassLoader());
+ ArrayList serviceList = processService(deploymentFileData, serviceGroup, configCtx);
+ DeploymentEngine.addServiceGroup(serviceGroup, serviceList, deploymentFileData.getFile().toURL(), deploymentFileData, axisConfig);
+ log.info("Deploying " + deploymentFileData.getName());
+ } catch (AxisFault axisFault) {
+ axisFault.printStackTrace();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private ArrayList processService(DeploymentFileData deploymentFileData, AxisServiceGroup serviceGroup, ConfigurationContext configCtx) throws Exception {
+ String filename = deploymentFileData.getAbsolutePath();
+ File file = new File(filename);
+ serviceGroup.setServiceGroupName(deploymentFileData.getName());
+ String serviceName = DescriptionBuilder.getShortFileName(deploymentFileData.getName());
+
+ AxisService axisService = new AxisService();
+ axisService.setName(serviceName);
+ axisService.setParent(serviceGroup);
+ axisService.setClassLoader(deploymentFileData.getClassLoader());
+
+ InputStream in = null;
+ try {
+ in = new FileInputStream(file);
+ DescriptionBuilder builder = new DescriptionBuilder(in, configCtx);
+ OMElement rootElement = builder.buildOM();
+ String elementName = rootElement.getLocalName();
+ if (TAG_SERVICE.equals(elementName)) {
+ populateService(axisService, rootElement, file.getParent());
+ } else {
+ throw new AxisFault("Invalid " + deploymentFileData.getAbsolutePath() + " found");
+ }
+ } catch (FileNotFoundException e) {
+ throw new DeploymentException(Messages.getMessage(
+ DeploymentErrorMsgs.FILE_NOT_FOUND, e.getMessage()));
+ } catch (XMLStreamException e) {
+ throw new DeploymentException(Messages.getMessage(
+ DeploymentErrorMsgs.XML_STREAM_EXCEPTION, e.getMessage()));
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ log.info(Messages.getMessage("errorininputstreamclose"));
+ }
+ }
+ }
+
+ ArrayList serviceList = new ArrayList();
+ serviceList.add(axisService);
+ return serviceList;
+ }
+
+ private void populateService(AxisService service, OMElement service_element, String directory)
+ throws DeploymentException {
+ try {
+ // Processing service level parameters
+ Iterator itr = service_element.getChildrenWithName(new QName(TAG_PARAMETER));
+ processParameters(itr, service, service.getParent());
+
+ // process service description
+ OMElement descriptionElement = service_element.getFirstChildWithName(new QName(TAG_DESCRIPTION));
+ if (descriptionElement != null) {
+ OMElement descriptionValue = descriptionElement.getFirstElement();
+ if (descriptionValue != null) {
+ StringWriter writer = new StringWriter();
+ descriptionValue.build();
+ descriptionValue.serialize(writer);
+ writer.flush();
+ service.setDocumentation(writer.toString());
+ } else {
+ service.setDocumentation(descriptionElement.getText());
+ }
+ } else {
+ OMAttribute serviceNameatt = service_element.getAttribute(new QName(ATTRIBUTE_NAME));
+
+ if (serviceNameatt != null) {
+ if (!"".equals(serviceNameatt.getAttributeValue().trim())) {
+ service.setDocumentation(serviceNameatt.getAttributeValue());
+ }
+ }
+ }
+ OMAttribute serviceNameatt = service_element.getAttribute(new QName(ATTRIBUTE_NAME));
+
+ // If the service name is explicitly specified in the services.xml
+ // then use that as the service name
+ if (serviceNameatt != null) {
+ if (!"".equals(serviceNameatt.getAttributeValue().trim())) {
+ service.setName(serviceNameatt.getAttributeValue());
+ // To be on the safe side
+ if (service.getDocumentation() == null) {
+ service.setDocumentation(serviceNameatt.getAttributeValue());
+ }
+ }
+ }
+
+ // Process WS-Addressing flag attribute
+ OMAttribute addressingRequiredatt = service_element.getAttribute(new QName(
+ ATTRIBUTE_WSADDRESSING));
+ if (addressingRequiredatt != null) {
+ String addressingRequiredString = addressingRequiredatt.getAttributeValue();
+ service.setWSAddressingFlag(addressingRequiredString);
+ }
+
+ // Setting service target namespace if any
+ OMAttribute targetNameSpace = service_element.getAttribute(new QName(TARGET_NAME_SPACE));
+ if (targetNameSpace != null) {
+ String nameSpeceVale = targetNameSpace.getAttributeValue();
+ if (nameSpeceVale != null && !"".equals(nameSpeceVale)) {
+ service.setTargetNamespace(nameSpeceVale);
+ }
+ } else {
+ if (service.getTargetNamespace() == null || "".equals(service.getTargetNamespace())) {
+ service.setTargetNamespace(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE);
+ }
+ }
+
+ // Setting schema namespece if any
+ OMElement schemaElement = service_element.getFirstChildWithName(new QName(SCHEMA));
+ if (schemaElement != null) {
+ OMAttribute schemaNameSpace = schemaElement.getAttribute(new QName(SCHEMA_NAME_SPACE));
+ if (schemaNameSpace != null) {
+ String nameSpeceVale = schemaNameSpace.getAttributeValue();
+ if (nameSpeceVale != null && !"".equals(nameSpeceVale)) {
+ service.setSchemaTargetNamespace(nameSpeceVale);
+ }
+ }
+ OMAttribute elementFormDefault = schemaElement.getAttribute(new QName(
+ SCHEMA_ELEMENT_QUALIFIED));
+ if (elementFormDefault != null) {
+ String value = elementFormDefault.getAttributeValue();
+ if ("true".equals(value)) {
+ service.setElementFormDefault(true);
+ } else if ("false".equals(value)) {
+ service.setElementFormDefault(false);
+ }
+ }
+ }
+
+ // Removing exclude operations
+ OMElement excludeOperations = service_element.getFirstChildWithName(new QName(TAG_EXCLUDE_OPERATIONS));
+ ArrayList excludeops = null;
+ if (excludeOperations != null) {
+ excludeops = new ArrayList();
+ Iterator excludeOp_itr = excludeOperations.getChildrenWithName(new QName(TAG_OPERATION));
+ while (excludeOp_itr.hasNext()) {
+ OMElement opName = (OMElement) excludeOp_itr.next();
+ excludeops.add(opName.getText().trim());
+ }
+ }
+ if (excludeops == null) {
+ excludeops = new ArrayList();
+ }
+
+ // processing service-wide modules which required to engage globally
+ Iterator moduleRefs = service_element.getChildrenWithName(new QName(TAG_MODULE));
+ while (moduleRefs.hasNext()) {
+ OMElement moduleref = (OMElement) moduleRefs.next();
+ OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE));
+ String refName = moduleRefAttribute.getAttributeValue();
+ axisConfig.addGlobalModuleRef(refName);
+ }
+
+ OMElement messageReceiver = service_element.getFirstChildWithName(
+ new QName(TAG_MESSAGE_RECEIVERS));
+ ClassLoader loader = service.getClassLoader();
+
+ // Set default message recievers
+ service.addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-only",
+ loadMessageReceiver(loader, "org.apache.axis2.corba.receivers.CorbaInOnlyMessageReceiver"));
+ service.addMessageReceiver("http://www.w3.org/2004/08/wsdl/robust-in-only",
+ loadMessageReceiver(loader, "org.apache.axis2.corba.receivers.CorbaInOnlyMessageReceiver"));
+ service.addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-out",
+ loadMessageReceiver(loader, "org.apache.axis2.corba.receivers.CorbaMessageReceiver"));
+ service.addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-opt-out",
+ loadMessageReceiver(loader, "org.apache.axis2.corba.receivers.CorbaInOutAsyncMessageReceiver"));
+
+ if (messageReceiver != null) {
+ HashMap mrs = processMessageReceivers(loader, messageReceiver);
+ Iterator keys = mrs.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = (String) keys.next();
+ service.addMessageReceiver(key, (MessageReceiver) mrs.get(key));
+ }
+ }
+
+ // processing transports
+ OMElement transports = service_element.getFirstChildWithName(new QName(TAG_TRANSPORTS));
+ if (transports != null) {
+ Iterator transport_itr = transports.getChildrenWithName(new QName(TAG_TRANSPORT));
+ ArrayList trs = new ArrayList();
+ while (transport_itr.hasNext()) {
+ OMElement trsEle = (OMElement) transport_itr.next();
+ String tarnsportName = trsEle.getText().trim();
+ trs.add(tarnsportName);
+ }
+ service.setExposedTransports(trs);
+ }
+
+ // processing operations
+ processOperations(service, axisConfig, excludeops, null, directory);
+ Iterator operationsIterator = service.getOperations();
+ while (operationsIterator.hasNext()) {
+ AxisOperation operationDesc = (AxisOperation) operationsIterator.next();
+ ArrayList wsamappings = operationDesc.getWSAMappingList();
+ if (wsamappings == null) {
+ continue;
+ }
+ if (service.getOperation(operationDesc.getName()) == null) {
+ service.addOperation(operationDesc);
+ }
+ for (int j = 0; j < wsamappings.size(); j++) {
+ String mapping = (String) wsamappings.get(j);
+ if (mapping.length() > 0) {
+ service.mapActionToOperation(mapping, operationDesc);
+ }
+ }
+ }
+
+ for (int i = 0; i < excludeops.size(); i++) {
+ String opName = (String) excludeops.get(i);
+ service.removeOperation(new QName(opName));
+ }
+ } catch (XMLStreamException e) {
+ throw new DeploymentException(e);
+ } catch (AxisFault axisFault) {
+ throw new DeploymentException(Messages.getMessage(
+ DeploymentErrorMsgs.OPERATION_PROCESS_ERROR, axisFault.getMessage()), axisFault);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected HashMap processMessageReceivers(ClassLoader loader, OMElement element) throws DeploymentException {
+ HashMap meps = new HashMap();
+ Iterator iterator = element.getChildrenWithName(new QName(TAG_MESSAGE_RECEIVER));
+ while (iterator.hasNext()) {
+ OMElement receiverElement = (OMElement) iterator.next();
+ OMAttribute receiverName = receiverElement.getAttribute(new QName(TAG_CLASS_NAME));
+ String className = receiverName.getAttributeValue();
+ MessageReceiver receiver = loadMessageReceiver(loader, className);
+ OMAttribute mepAtt = receiverElement.getAttribute(new QName(TAG_MEP));
+ meps.put(mepAtt.getAttributeValue(), receiver);
+ }
+ return meps;
+ }
+
+ protected MessageReceiver loadMessageReceiver(ClassLoader loader, String className) throws DeploymentException {
+ MessageReceiver receiver = null;
+ try {
+ Class messageReceiver;
+ if ((className != null) && !"".equals(className)) {
+ messageReceiver = Loader.loadClass(loader, className);
+ receiver = (MessageReceiver) messageReceiver.newInstance();
+ }
+ } catch (ClassNotFoundException e) {
+ throw new DeploymentException(org.apache.axis2.i18n.Messages.getMessage(
+ DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER,
+ "ClassNotFoundException", className), e);
+ } catch (IllegalAccessException e) {
+ throw new DeploymentException(org.apache.axis2.i18n.Messages.getMessage(
+ DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER,
+ "IllegalAccessException", className), e);
+ } catch (InstantiationException e) {
+ throw new DeploymentException(org.apache.axis2.i18n.Messages.getMessage(
+ DeploymentErrorMsgs.ERROR_IN_LOADING_MESSAGE_RECEIVER,
+ "InstantiationException", className), e);
+ }
+
+ return receiver;
+ }
+
+ private void processParameters(Iterator parameters, ParameterInclude parameterInclude,
+ ParameterInclude parent) throws DeploymentException {
+ while (parameters.hasNext()) {
+ // this is to check whether some one has locked the parmeter at the
+ // top level
+ OMElement parameterElement = (OMElement) parameters.next();
+ Parameter parameter = new Parameter();
+ // setting parameterElement
+ parameter.setParameterElement(parameterElement);
+ // setting parameter Name
+ OMAttribute paramName = parameterElement.getAttribute(new QName(ATTRIBUTE_NAME));
+ if (paramName == null) {
+ throw new DeploymentException(Messages.getMessage(
+ DeploymentErrorMsgs.BAD_PARAMETER_ARGUMENT, parameterElement.toString()));
+ }
+ parameter.setName(paramName.getAttributeValue());
+ // setting parameter Value (the child element of the parameter)
+ OMElement paramValue = parameterElement.getFirstElement();
+ if (paramValue != null) {
+ parameter.setValue(parameterElement);
+ parameter.setParameterType(Parameter.OM_PARAMETER);
+ } else {
+ String paratextValue = parameterElement.getText();
+
+ parameter.setValue(paratextValue);
+ parameter.setParameterType(Parameter.TEXT_PARAMETER);
+ }
+ // setting locking attribute
+ OMAttribute paramLocked = parameterElement.getAttribute(new QName(ATTRIBUTE_LOCKED));
+ Parameter parentParam = null;
+ if (parent != null) {
+ parentParam = parent.getParameter(parameter.getName());
+ }
+ if (paramLocked != null) {
+ String lockedValue = paramLocked.getAttributeValue();
+ if (BOOLEAN_TRUE.equals(lockedValue)) {
+ // if the parameter is locked at some level parameter value
+ // replace by that
+ if ((parent != null) && parent.isParameterLocked(parameter.getName())) {
+ throw new DeploymentException(Messages.getMessage(
+ DeploymentErrorMsgs.CONFIG_NOT_FOUND, parameter.getName()));
+ } else {
+ parameter.setLocked(true);
+ }
+ } else {
+ parameter.setLocked(false);
+ }
+ }
+ try {
+ if (parent != null) {
+ if ((parentParam == null) || !parent.isParameterLocked(parameter.getName())) {
+ parameterInclude.addParameter(parameter);
+ }
+ } else {
+ parameterInclude.addParameter(parameter);
+ }
+ } catch (AxisFault axisFault) {
+ throw new DeploymentException(axisFault);
+ }
+ }
+ }
+
+ private void processOperations(AxisService axisService,
+ AxisConfiguration axisConfig,
+ ArrayList excludeOperations,
+ ArrayList nonRpcMethods, String dirName) throws Exception {
+ ORB orb = CorbaUtil.getORB(axisService);
+ IDL idl = CorbaUtil.getIDL(axisService, orb, dirName);
+
+ Parameter orbParam = new Parameter(ORB_LITERAL, orb);
+ Parameter idlParam = new Parameter(IDL_LITERAL, idl);
+ axisService.addParameter(orbParam);
+ axisService.addParameter(idlParam);
+
+ // adding name spaces
+ NamespaceMap map = new NamespaceMap();
+ map.put(Java2WSDLConstants.AXIS2_NAMESPACE_PREFIX, Java2WSDLConstants.AXIS2_XSD);
+ map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX, Java2WSDLConstants.URI_2001_SCHEMA_XSD);
+ axisService.setNameSpacesMap(map);
+
+ Parameter interfaceNameParam = axisService.getParameter(INTERFACE_NAME);
+ String interfaceName = (String) ((interfaceNameParam==null) ? null : interfaceNameParam.getValue());
+ SchemaGenerator schemaGenerator = new SchemaGenerator(idl, interfaceName,
+ axisService.getSchematargetNamespace(),
+ axisService.getSchemaTargetNamespacePrefix());
+ schemaGenerator.setExcludeMethods(excludeOperations);
+ schemaGenerator.setNonRpcMethods(nonRpcMethods);
+ if (!axisService.isElementFormDefault()) {
+ schemaGenerator.setElementFormDefault(Java2WSDLConstants.FORM_DEFAULT_UNQUALIFIED);
+ }
+ // package to namespace map
+ schemaGenerator.setPkg2nsmap(axisService.getP2nMap());
+ Collection schemas = schemaGenerator.generateSchema();
+ axisService.addSchema(schemas);
+ axisService.setSchemaTargetNamespace(schemaGenerator.getSchemaTargetNameSpace());
+ axisService.setTypeTable(schemaGenerator.getTypeTable());
+ if (Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE.equals(
+ axisService.getTargetNamespace())) {
+ axisService.setTargetNamespace(schemaGenerator.getTargetNamespace());
+ }
+
+ Interface intf = (Interface) idl.getInterfaces().get(interfaceName);
+ Operation[] operations = intf.getOperations();
+
+ TypeTable table = schemaGenerator.getTypeTable();
+ PhasesInfo pinfo = axisConfig.getPhasesInfo();
+
+ for (int i = 0; i < operations.length; i++) {
+ Operation corbaOperation = operations[i];
+ String opName = corbaOperation.getName();
+ if (excludeOperations != null && excludeOperations.contains(opName)) {
+ continue;
+ }
+ AxisOperation operation = axisService.getOperation(new QName(opName));
+ // if the operation there in services.xml then try to set it schema element name
+ if (operation != null) {
+ AxisMessage inMessage = operation.getMessage(
+ WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ if (inMessage != null) {
+ inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
+ QName complexSchemaType = table.getComplexSchemaType(opName);
+ inMessage.setElementQName(complexSchemaType);
+ if (complexSchemaType != null) {
+ axisService.addMessageElementQNameToOperationMapping(complexSchemaType,
+ operation);
+ }
+ }
+ DataType returnType = corbaOperation.getReturnType();
+ if (returnType != null && !CorbaUtil.getQualifiedName(returnType).equals(VOID)) {
+ AxisMessage outMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ QName qNamefortheType = table.getQNamefortheType(opName + RESPONSE);
+ outMessage.setElementQName(qNamefortheType);
+ if (qNamefortheType != null) {
+ axisService.addMessageElementQNameToOperationMapping(qNamefortheType, operation);
+ }
+ outMessage.setName(opName + RESPONSE);
+ }
+ if (corbaOperation.hasRaises()) {
+ List extypes = corbaOperation.getRaises();
+ for (int j = 0; j < extypes.size(); j++) {
+ AxisMessage faultMessage = new AxisMessage();
+ ExceptionType extype = (ExceptionType) extypes.get(j);
+ String exname = extype.getName() ;
+ if(extypes.size()>1){
+ faultMessage.setName(opName + FAULT + j);
+ } else{
+ faultMessage.setName(opName + FAULT);
+ }
+ faultMessage.setElementQName(
+ table.getComplexSchemaType(exname + FAULT));
+ operation.setFaultMessages(faultMessage);
+ }
+
+ }
+ } else {
+ operation = getAxisOperationforCorbaOperation(corbaOperation, table);
+ MessageReceiver mr = axisService.getMessageReceiver(
+ operation.getMessageExchangePattern());
+ if (mr != null) {
+ operation.setMessageReceiver(mr);
+ } else {
+ mr = axisConfig.getMessageReceiver(operation.getMessageExchangePattern());
+ operation.setMessageReceiver(mr);
+ }
+ pinfo.setOperationPhases(operation);
+ axisService.addOperation(operation);
+ }
+ if (operation.getInputAction() == null) {
+ operation.setSoapAction("urn:" + opName);
+ }
+ }
+ }
+
+ private AxisOperation getAxisOperationforCorbaOperation(Operation corbaOperation,
+ TypeTable table) throws AxisFault {
+ AxisOperation operation;
+ String opName = corbaOperation.getName();
+ DataType returnType = corbaOperation.getReturnType();
+ if (returnType == null || CorbaUtil.getQualifiedName(returnType).equals(VOID)) {
+ if (corbaOperation.hasRaises()) {
+ operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT);
+ AxisMessage outMessage = operation.getMessage(
+ WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ outMessage.setElementQName(table.getQNamefortheType(opName + RESPONSE));
+ outMessage.setName(opName + RESPONSE);
+ } else {
+ operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_ONLY);
+ }
+ } else {
+ operation = AxisOperationFactory.getAxisOperation(WSDLConstants.MEP_CONSTANT_IN_OUT);
+ AxisMessage outMessage = operation.getMessage(
+ WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+ outMessage.setElementQName(table.getQNamefortheType(opName + RESPONSE));
+ outMessage.setName(opName + RESPONSE);
+ }
+ if (corbaOperation.hasRaises()) {
+ List extypes = corbaOperation.getRaises();
+ for (int j= 0 ; j < extypes.size() ; j++) {
+ AxisMessage faultMessage = new AxisMessage();
+ ExceptionType extype = (ExceptionType) extypes.get(j);
+ String exname = extype.getName() ;
+ if(extypes.size() >1){
+ faultMessage.setName(opName + FAULT + j);
+ } else {
+ faultMessage.setName(opName + FAULT);
+ }
+ faultMessage.setElementQName(
+ table.getComplexSchemaType(exname + FAULT));
+ operation.setFaultMessages(faultMessage);
+ }
+ }
+ operation.setName(new QName(opName));
+ AxisMessage inMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+ if (inMessage != null) {
+ inMessage.setElementQName(table.getComplexSchemaType(opName));
+ inMessage.setName(opName + Java2WSDLConstants.MESSAGE_SUFFIX);
+ }
+ return operation;
+ }
+
+ public void setDirectory(String directory) {
+ }
+
+ public void setExtension(String extension) {
+ }
+
+ public void unDeploy(String fileName) throws DeploymentException {
+ try {
+ axisConfig.removeServiceGroup(fileName);
+ log.info(Messages.getMessage(DeploymentErrorMsgs.SERVICE_REMOVED, fileName));
+ } catch (AxisFault axisFault) {
+ axisConfig.removeFaultyService(fileName);
+ }
+ }
+}
Added: webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java?rev=572651&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java (added)
+++ webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java Tue Sep 4 05:39:42 2007
@@ -0,0 +1,700 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axis2.corba.deployer;
+
+import org.apache.ws.commons.schema.*;
+import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.apache.axis2.description.java2wsdl.TypeTable;
+import org.apache.axis2.description.java2wsdl.NamespaceGenerator;
+import org.apache.axis2.description.java2wsdl.DefaultNamespaceGenerator;
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+
+import javax.xml.namespace.QName;
+import java.util.*;
+
+import org.apache.axis2.corba.idl.types.*;
+import org.apache.axis2.corba.receivers.CorbaUtil;
+
+public class SchemaGenerator implements CorbaConstants {
+ private static int prefixCount = 1;
+ protected Map targetNamespacePrefixMap = new Hashtable();
+ protected Map schemaMap = new Hashtable();
+ protected XmlSchemaCollection xmlSchemaCollection = new XmlSchemaCollection();
+ private IDL idl;
+ private String interfaceName;
+ private TypeTable typeTable = new TypeTable();
+ private String schemaTargetNameSpace;
+ private String schema_namespace_prefix;
+ private String attrFormDefault = null;
+ private String elementFormDefault = null;
+ private ArrayList excludeMethods = new ArrayList();
+ private ArrayList extraClasses = null;
+ private boolean useWSDLTypesNamespace = false;
+ private Map pkg2nsmap = null;
+ private NamespaceGenerator nsGen = null;
+ private String targetNamespace = null;
+ private ArrayList nonRpcMethods = new ArrayList();
+
+ public NamespaceGenerator getNsGen() throws Exception {
+ if ( nsGen == null ) {
+ nsGen = new DefaultNamespaceGenerator();
+ }
+ return nsGen;
+ }
+
+ public void setNsGen(NamespaceGenerator nsGen) {
+ this.nsGen = nsGen;
+ }
+
+ public SchemaGenerator(IDL idl,
+ String interfaceName, String schematargetNamespace,
+ String schematargetNamespacePrefix)
+ throws Exception {
+ this.idl = idl;
+ this.interfaceName = interfaceName;
+
+ StringBuffer stringBuffer = namespaceFromModuleName(interfaceName, getNsGen());
+ if (stringBuffer.length() == 0) {
+ stringBuffer.append(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE);
+ }
+ this.targetNamespace = stringBuffer.toString();
+
+ if (schematargetNamespace != null
+ && schematargetNamespace.trim().length() != 0) {
+ this.schemaTargetNameSpace = schematargetNamespace;
+ } else {
+ stringBuffer = namespaceFromModuleName(interfaceName, getNsGen());
+ if (stringBuffer.length() == 0) {
+ stringBuffer.append(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE);
+ }
+ stringBuffer.append(SCHEMA_NAMESPACE_EXTN);
+ this.schemaTargetNameSpace = stringBuffer.toString();
+ }
+
+ if (schematargetNamespacePrefix != null
+ && schematargetNamespacePrefix.trim().length() != 0) {
+ this.schema_namespace_prefix = schematargetNamespacePrefix;
+ } else {
+ this.schema_namespace_prefix = Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX;
+ }
+ }
+
+ private static StringBuffer namespaceFromModuleName(String interfaceName,
+ NamespaceGenerator nsGen) throws Exception {
+ String moduleName = null;
+ if (interfaceName != null) {
+ int i = interfaceName.lastIndexOf("::");
+ if (i > 0)
+ moduleName = interfaceName.substring(0, i);
+ }
+
+ if (moduleName==null) {
+ return new StringBuffer();
+ } else {
+ return nsGen.namespaceFromPackageName(moduleName);
+ }
+ }
+
+ /**
+ * Generates schema for all the parameters in method. First generates schema for all different
+ * parameter type and later refers to them.
+ *
+ * @return Returns XmlSchema.
+ * @throws Exception if failed
+ */
+ public Collection generateSchema() throws Exception {
+ Map interfaces = idl.getInterfaces();
+ Interface intf = (Interface) interfaces.get(interfaceName);
+ /**
+ * Schema genertaion done in two stage 1. Load all the methods and
+ * create type for methods parameters (if the parameters are Beans
+ * then it will create Complex types for those , and if the
+ * parameters are simple type which decribe in SimpleTypeTable
+ * nothing will happen) 2. In the next stage for all the methods
+ * messages and port types will be creteated
+ */
+
+ Operation[] operations = intf.getOperations();
+
+ // since we do not support overload
+ HashMap uniqueMethods = new HashMap();
+ XmlSchemaComplexType methodSchemaType;
+ XmlSchemaSequence sequence = null;
+ List processedExs = new ArrayList();
+ for (int i = 0; i < operations.length; i++) {
+ Operation operation = operations[i];
+ String operationName = operation.getName();
+ if (excludeMethods.contains(operationName)) {
+ continue;
+ }
+
+ if (uniqueMethods.get(operationName) != null) {
+ throw new Exception(
+ " Sorry we don't support methods overloading !!!! ");
+ }
+
+ if (operation.hasRaises()) {
+ List extypes = operation.getRaises();
+ for (int j = 0; j < extypes.size(); j++) {
+ ExceptionType extype = (ExceptionType) extypes.get(j);
+ if (processedExs.contains(extype.getName()))
+ continue;
+ processedExs.add(extype.getName());
+ methodSchemaType = createSchemaTypeForMethodPart(extype.getName()+ "Fault");
+ sequence = new XmlSchemaSequence();
+ generateSchemaForType(sequence, extype, extype.getName());
+ methodSchemaType.setParticle(sequence);
+ }
+ }
+ uniqueMethods.put(operationName, operation);
+ //create the schema type for the method wrapper
+ List paras = operation.getParams();
+ if (paras != null && paras.size() > 0) {
+ sequence = new XmlSchemaSequence();
+ methodSchemaType = createSchemaTypeForMethodPart(operationName);
+ methodSchemaType.setParticle(sequence);
+ }
+
+ List outparas = null;
+ if (paras != null) {
+ for (int j = 0; j < paras.size(); j++) {
+ Member param = (Member) paras.get(j);
+ String parameterName = param.getName();
+ DataType paraType = param.getDataType();
+ if (Member.MODE_INOUT.equals(param.getMode())) {
+ if (outparas==null)
+ outparas = new ArrayList();
+ outparas.add(param);
+ } else if (Member.MODE_OUT.equals(param.getMode())) {
+ if (outparas==null)
+ outparas = new ArrayList();
+ outparas.add(param);
+ continue;
+ }
+ if(nonRpcMethods.contains(operationName)){
+ generateSchemaForType(sequence, null, operationName);
+ break;
+ } else {
+ generateSchemaForType(sequence, paraType, parameterName);
+ }
+ }
+ }
+
+ DataType returnType = operation.getReturnType();
+
+ if ((returnType != null && !CorbaUtil.getQualifiedName(returnType).equals(VOID)) || outparas!=null) {
+ methodSchemaType = createSchemaTypeForMethodPart(operationName + RESPONSE);
+ sequence = new XmlSchemaSequence();
+ methodSchemaType.setParticle(sequence);
+
+ if (returnType != null && !CorbaUtil.getQualifiedName(returnType).equals(VOID)) {
+ String returnName ="return";
+ if(nonRpcMethods.contains(operationName)){
+ generateSchemaForType(sequence, null, returnName);
+ } else {
+ generateSchemaForType(sequence, returnType, returnName);
+ }
+ }
+
+ if (outparas != null) {
+ for (int j = 0; j < outparas.size(); j++) {
+ Member param = (Member) outparas.get(j);
+ String parameterName = param.getName();
+ DataType paraType = param.getDataType();
+ if(nonRpcMethods.contains(operationName)){
+ generateSchemaForType(sequence, null, operationName);
+ break;
+ } else {
+ generateSchemaForType(sequence, paraType, parameterName);
+ }
+ }
+ }
+ }
+
+ }
+ /*} else {
+ //generate the schema type for extra classes
+ extraSchemaTypeName = typeTable.getSimpleSchemaTypeName(getQualifiedName(jclass));
+ if (extraSchemaTypeName == null) {
+ generateSchema(jclass);
+ }*/
+ return schemaMap.values();
+ }
+
+ /**
+ * JAM convert first name of an attribute into UpperCase as an example if there is a instance
+ * variable called foo in a bean , then Jam give that as Foo so this method is to correct that
+ * error
+ *
+ * @param wrongName wrong name
+ * @return the right name, using english as the locale for case conversion
+ */
+ public static String getCorrectName(String wrongName) {
+ if (wrongName.length() > 1) {
+ return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH)
+ + wrongName.substring(1, wrongName.length());
+ } else {
+ return wrongName.substring(0, 1).toLowerCase(Locale.ENGLISH);
+ }
+ }
+
+ /**
+ * Generate schema construct for given type
+ *
+ * @param dataType object
+ * @return Qname
+ * @throws Exception if fails
+ */
+ //private QName generateSchema(JClass dataType) throws Exception {
+ private QName generateSchema(CompositeDataType dataType) throws Exception {
+ String name = CorbaUtil.getQualifiedName(dataType);
+ QName schemaTypeName = typeTable.getComplexSchemaType(name);
+ if (schemaTypeName == null) {
+ String simpleName = getSimpleName(dataType);
+
+ String packageName = getModuleName(dataType);
+ String targetNameSpace = resolveSchemaNamespace(packageName);
+
+ XmlSchema xmlSchema = getXmlSchema(targetNameSpace);
+ String targetNamespacePrefix = (String) targetNamespacePrefixMap.get(targetNameSpace);
+ schemaTypeName = new QName(targetNameSpace, simpleName, targetNamespacePrefix);
+
+ if (dataType instanceof EnumType) {
+ XmlSchemaSimpleType simpleType = new XmlSchemaSimpleType(xmlSchema);
+ XmlSchemaSimpleTypeRestriction restriction = new XmlSchemaSimpleTypeRestriction();
+ restriction.setBaseTypeName(typeTable.getSimpleSchemaTypeName("java.lang.String"));
+ simpleType.setContent(restriction);
+ simpleType.setName(simpleName);
+
+ XmlSchemaObjectCollection facets = restriction.getFacets();
+ EnumType enumType = (EnumType) dataType;
+ List enumMembers = enumType.getEnumMembers();
+ for (int i = 0; i < enumMembers.size(); i++) {
+ facets.add(new XmlSchemaEnumerationFacet(enumMembers.get(i), false));
+ }
+
+ XmlSchemaElement eltOuter = new XmlSchemaElement();
+ eltOuter.setName(simpleName);
+ eltOuter.setQName(schemaTypeName);
+
+ xmlSchema.getItems().add(eltOuter);
+ xmlSchema.getElements().add(schemaTypeName, eltOuter);
+ eltOuter.setSchemaTypeName(simpleType.getQName());
+
+ xmlSchema.getItems().add(simpleType);
+ xmlSchema.getSchemaTypes().add(schemaTypeName, simpleType);
+
+ // adding this type to the table
+ typeTable.addComplexSchema(name, eltOuter.getQName());
+ } else if (dataType instanceof UnionType) {
+ XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
+ XmlSchemaChoice choice = new XmlSchemaChoice();
+ XmlSchemaObjectCollection items = choice.getItems();
+
+ UnionType unionType = (UnionType) dataType;
+ Member[] members = unionType.getMembers();
+ for (int i = 0; i < members.length; i++) {
+ items.add(generateSchemaforFieldsandProperties(xmlSchema, members[i].getDataType(),
+ members[i].getName(), true));
+ }
+
+ complexType.setParticle(choice);
+ complexType.setName(simpleName);
+
+ XmlSchemaElement eltOuter = new XmlSchemaElement();
+ eltOuter.setName(simpleName);
+ eltOuter.setQName(schemaTypeName);
+
+ xmlSchema.getItems().add(eltOuter);
+ xmlSchema.getElements().add(schemaTypeName, eltOuter);
+ eltOuter.setSchemaTypeName(complexType.getQName());
+ xmlSchema.getItems().add(complexType);
+ xmlSchema.getSchemaTypes().add(schemaTypeName, complexType);
+
+ typeTable.addComplexSchema(name, eltOuter.getQName());
+ } else {
+ XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
+ XmlSchemaSequence sequence = new XmlSchemaSequence();
+ XmlSchemaElement eltOuter = new XmlSchemaElement();
+ eltOuter.setName(simpleName);
+ eltOuter.setQName(schemaTypeName);
+ complexType.setParticle(sequence);
+ complexType.setName(simpleName);
+
+ xmlSchema.getItems().add(eltOuter);
+ xmlSchema.getElements().add(schemaTypeName, eltOuter);
+ eltOuter.setSchemaTypeName(complexType.getQName());
+
+ xmlSchema.getItems().add(complexType);
+ xmlSchema.getSchemaTypes().add(schemaTypeName, complexType);
+
+ // adding this type to the table
+ typeTable.addComplexSchema(name, eltOuter.getQName());
+ if (dataType instanceof Typedef) {
+ Typedef typedef = (Typedef) dataType;
+ DataType aliasType = typedef.getDataType();
+ sequence.getItems().add(generateSchemaforFieldsandProperties(xmlSchema, aliasType, "item", false));
+ } else {
+ //Set propertiesNames = new HashSet() ;
+ Member[] members = dataType.getMembers();
+ for (int i = 0; i < members.length; i++) {
+ Member member = members[i];
+ String propertyName = member.getName();
+ DataType propertyType = member.getDataType();
+ //String propname = getCorrectName(property.getSimpleName()) ;
+ //propertiesNames.add(propertyName) ;
+ sequence.getItems().add(generateSchemaforFieldsandProperties(xmlSchema, propertyType,
+ propertyName, false));
+ }
+ }
+ }
+ }
+ return schemaTypeName;
+ }
+
+
+ // moved code common to Fields & properties out of above method
+ private XmlSchemaElement generateSchemaforFieldsandProperties(XmlSchema xmlSchema,
+ DataType type,
+ String name, boolean forceNotNillable) throws Exception {
+ boolean isArryType = false;
+ long maxOccurs = 0;
+ long minOccurs = 0;
+ if (type instanceof AbstractCollectionType) {
+ AbstractCollectionType collectionType = (AbstractCollectionType) type;
+ type = collectionType.getDataType();
+ isArryType = true;
+ int elementCount = collectionType.getElementCount();
+ if (collectionType.isArray()) {
+ minOccurs = maxOccurs = elementCount;
+ } else if (collectionType.isSequence()) {
+ minOccurs = 0;
+ maxOccurs = (elementCount == 0) ? Long.MAX_VALUE : elementCount;
+ }
+ if (type instanceof AbstractCollectionType) {
+ AbstractCollectionType child = (AbstractCollectionType) type;
+ Typedef typedef = new Typedef();
+ typedef.setDataType(type);
+ typedef.setModule(child.getElementModule());
+ typedef.setName("_" + (child.getDepth() - 1) + "_" + child.getElementName());
+ type = typedef;
+ }
+ }
+
+ String propertyTypeName = CorbaUtil.getQualifiedName(type);
+
+ if(isArryType&&"byte".equals(propertyTypeName)){
+ propertyTypeName = "base64Binary";
+ }
+
+ XmlSchemaElement elt1 = new XmlSchemaElement();
+ elt1.setName(name);
+
+ if (isArryType && (!propertyTypeName.equals("base64Binary"))){
+ elt1.setMaxOccurs(maxOccurs);
+ elt1.setMinOccurs(minOccurs);
+ }
+
+ if(isNillable(type) && !forceNotNillable)
+ elt1.setNillable(true) ;
+
+ if (typeTable.isSimpleType(propertyTypeName)) {
+ elt1.setSchemaTypeName(typeTable.getSimpleSchemaTypeName(propertyTypeName));
+
+ } else if (type instanceof CompositeDataType) {
+ generateSchema((CompositeDataType) type);
+ elt1.setSchemaTypeName(typeTable.getComplexSchemaType(propertyTypeName));
+
+ if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values().
+ contains(typeTable.getComplexSchemaType(propertyTypeName).getNamespaceURI())) {
+ XmlSchemaImport importElement = new XmlSchemaImport();
+ importElement.setNamespace(
+ typeTable.getComplexSchemaType(propertyTypeName).getNamespaceURI());
+ xmlSchema.getItems().add(importElement);
+ ((NamespaceMap) xmlSchema.getNamespaceContext()).
+ put(generatePrefix(),
+ typeTable.getComplexSchemaType(propertyTypeName).getNamespaceURI());
+ }
+ } else {
+ throw new Exception("Unsupported type:" + type);
+ }
+ return elt1;
+ }
+
+ private boolean isNillable(DataType type) {
+ if (type instanceof CompositeDataType) {
+ return true;
+ } else if (type instanceof PrimitiveDataType) {
+ PrimitiveDataType primitiveDataType = (PrimitiveDataType) type;
+ if (primitiveDataType.getTypeName().equals("java.lang.String"))
+ return true;
+ }
+ return false;
+ }
+
+
+ private QName generateSchemaForType(XmlSchemaSequence sequence, DataType type, String partName)
+ throws Exception {
+
+ boolean isArrayType = false;
+ if(type!=null){
+ isArrayType = (type instanceof ArrayType);
+ }
+ if (isArrayType) {
+ ArrayType arrayType = (ArrayType) type;
+ type = arrayType.getDataType();
+ }
+ String classTypeName;
+ if(type==null){
+ classTypeName = "java.lang.Object";
+ } else {
+ classTypeName = CorbaUtil.getQualifiedName(type);
+ }
+ if (isArrayType && "byte".equals(classTypeName)) {
+ classTypeName = "base64Binary";
+ isArrayType = false;
+ }
+ if("javax.activation.DataHandler".equals(classTypeName)){
+ classTypeName = "base64Binary";
+ }
+ QName schemaTypeName = typeTable.getSimpleSchemaTypeName(classTypeName);
+ if (schemaTypeName == null && type instanceof CompositeDataType) {
+ schemaTypeName = generateSchema((CompositeDataType) type);
+ addContentToMethodSchemaType(sequence,
+ schemaTypeName,
+ partName,
+ isArrayType);
+ String schemaNamespace;
+ schemaNamespace = resolveSchemaNamespace(getModuleName(type));
+ addImport(getXmlSchema(schemaNamespace), schemaTypeName);
+
+ } else {
+ addContentToMethodSchemaType(sequence,
+ schemaTypeName,
+ partName,
+ isArrayType);
+ }
+
+ return schemaTypeName;
+ }
+
+ private void addContentToMethodSchemaType(XmlSchemaSequence sequence,
+ QName schemaTypeName,
+ String paraName,
+ boolean isArray) {
+ XmlSchemaElement elt1 = new XmlSchemaElement();
+ elt1.setName(paraName);
+ elt1.setSchemaTypeName(schemaTypeName);
+ sequence.getItems().add(elt1);
+
+ if (isArray) {
+ elt1.setMaxOccurs(Long.MAX_VALUE);
+ elt1.setMinOccurs(1);
+ }
+ elt1.setNillable(true);
+ }
+
+ private XmlSchemaComplexType createSchemaTypeForMethodPart(String localPartName) {
+ XmlSchema xmlSchema = getXmlSchema(schemaTargetNameSpace);
+ QName elementName =
+ new QName(this.schemaTargetNameSpace, localPartName, this.schema_namespace_prefix);
+ XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema);
+
+ XmlSchemaElement globalElement = new XmlSchemaElement();
+ globalElement.setSchemaType(complexType);
+ globalElement.setName(localPartName);
+ globalElement.setQName(elementName);
+ xmlSchema.getItems().add(globalElement);
+ xmlSchema.getElements().add(elementName, globalElement);
+
+ typeTable.addComplexSchema(localPartName, elementName);
+
+ return complexType;
+ }
+
+ private XmlSchema getXmlSchema(String targetNamespace) {
+ XmlSchema xmlSchema;
+
+ if ((xmlSchema = (XmlSchema) schemaMap.get(targetNamespace)) == null) {
+ String targetNamespacePrefix;
+
+ if ( targetNamespace.equals(schemaTargetNameSpace) &&
+ schema_namespace_prefix != null ) {
+ targetNamespacePrefix = schema_namespace_prefix;
+ } else {
+ targetNamespacePrefix = generatePrefix();
+ }
+
+
+ xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection);
+ xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting());
+ xmlSchema.setElementFormDefault(getElementFormDefaultSetting());
+
+
+ targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix);
+ schemaMap.put(targetNamespace, xmlSchema);
+
+ NamespaceMap prefixmap = new NamespaceMap();
+ prefixmap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD);
+ prefixmap.put(targetNamespacePrefix, targetNamespace);
+ xmlSchema.setNamespaceContext(prefixmap);
+ }
+ return xmlSchema;
+ }
+
+ public TypeTable getTypeTable() {
+ return typeTable;
+ }
+
+ private String generatePrefix() {
+ return NAME_SPACE_PREFIX + prefixCount++;
+ }
+
+ public void setExcludeMethods(ArrayList excludeMethods) {
+ if (excludeMethods == null) excludeMethods = new ArrayList();
+ this.excludeMethods = excludeMethods;
+ }
+
+ public String getSchemaTargetNameSpace() {
+ return schemaTargetNameSpace;
+ }
+
+ private void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
+ if (!((NamespaceMap) xmlSchema.getNamespaceContext()).values().
+ contains(schemaTypeName.getNamespaceURI())) {
+ XmlSchemaImport importElement = new XmlSchemaImport();
+ importElement.setNamespace(schemaTypeName.getNamespaceURI());
+ xmlSchema.getItems().add(importElement);
+ ((NamespaceMap) xmlSchema.getNamespaceContext()).
+ put(generatePrefix(), schemaTypeName.getNamespaceURI());
+ }
+ }
+
+ public String getAttrFormDefault() {
+ return attrFormDefault;
+ }
+
+ public void setAttrFormDefault(String attrFormDefault) {
+ this.attrFormDefault = attrFormDefault;
+ }
+
+ public String getElementFormDefault() {
+ return elementFormDefault;
+ }
+
+ public void setElementFormDefault(String elementFormDefault) {
+ this.elementFormDefault = elementFormDefault;
+ }
+
+ private XmlSchemaForm getAttrFormDefaultSetting() {
+ if (FORM_DEFAULT_UNQUALIFIED.equals(getAttrFormDefault())) {
+ return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+ } else {
+ return new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ }
+ }
+
+ private XmlSchemaForm getElementFormDefaultSetting() {
+ if (FORM_DEFAULT_UNQUALIFIED.equals(getElementFormDefault())) {
+ return new XmlSchemaForm(XmlSchemaForm.UNQUALIFIED);
+ } else {
+ return new XmlSchemaForm(XmlSchemaForm.QUALIFIED);
+ }
+ }
+
+ public ArrayList getExtraClasses() {
+ if (extraClasses == null) {
+ extraClasses = new ArrayList();
+ }
+ return extraClasses;
+ }
+
+ public void setExtraClasses(ArrayList extraClasses) {
+ this.extraClasses = extraClasses;
+ }
+
+ private String resolveSchemaNamespace(String packageName) throws Exception {
+ if (useWSDLTypesNamespace) {
+ return (String) pkg2nsmap.get("all");
+ } else {
+ if (pkg2nsmap != null && !pkg2nsmap.isEmpty()) {
+ //if types should go into namespaces that are mapped against the package name for the type
+ if (pkg2nsmap.get(packageName) != null) {
+ //return that mapping
+ return (String) pkg2nsmap.get(packageName);
+ } else {
+ return getNsGen().schemaNamespaceFromPackageName(packageName).toString();
+ }
+ } else {
+ // if pkg2nsmap is null and if not default schema ns found for the custom bean
+ return getNsGen().schemaNamespaceFromPackageName(packageName).toString();
+ }
+ }
+ }
+
+ public boolean isUseWSDLTypesNamespace() {
+ return useWSDLTypesNamespace;
+ }
+
+ public void setUseWSDLTypesNamespace(boolean useWSDLTypesNamespace) {
+ this.useWSDLTypesNamespace = useWSDLTypesNamespace;
+ }
+
+ public Map getPkg2nsmap() {
+ return pkg2nsmap;
+ }
+
+ public void setPkg2nsmap(Map pkg2nsmap) {
+ this.pkg2nsmap = pkg2nsmap;
+ }
+
+ public String getTargetNamespace() {
+ return targetNamespace;
+ }
+
+ protected String getSimpleName(DataType type){
+ if (type instanceof CompositeDataType) {
+ CompositeDataType compositeType = (CompositeDataType) type;
+ return compositeType.getName();
+ } else {
+ return CorbaUtil.getQualifiedName(type);
+ }
+ }
+
+ public void setNonRpcMethods(ArrayList nonRpcMethods) {
+ if(nonRpcMethods!=null){
+ this.nonRpcMethods = nonRpcMethods;
+ }
+ }
+
+ private String getModuleName(DataType type) {
+ if (type instanceof CompositeDataType) {
+ CompositeDataType compositeType = (CompositeDataType) type;
+ String module = compositeType.getModule();
+ module = module.replaceAll("::", ".");
+ if (module.endsWith(".")) {
+ module = module.substring(0, module.length() - 1);
+ }
+ return module;
+ } else {
+ return "";
+ }
+ }
+}
Added: webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaException.java?rev=572651&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaException.java (added)
+++ webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaException.java Tue Sep 4 05:39:42 2007
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axis2.corba.exceptions;
+
+public class CorbaException extends Exception {
+ public CorbaException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public CorbaException() {
+ super();
+ }
+
+ public CorbaException(String message) {
+ super(message);
+ }
+
+ public CorbaException(Throwable cause) {
+ super(cause);
+ }
+}
Added: webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaInvocationException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaInvocationException.java?rev=572651&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaInvocationException.java (added)
+++ webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/CorbaInvocationException.java Tue Sep 4 05:39:42 2007
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axis2.corba.exceptions;
+
+public class CorbaInvocationException extends CorbaException {
+ public CorbaInvocationException() {
+ super();
+ }
+
+ public CorbaInvocationException(String message) {
+ super(message);
+ }
+
+ public CorbaInvocationException(Throwable cause) {
+ super(cause);
+ }
+
+ public CorbaInvocationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/IDLProcessorException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/IDLProcessorException.java?rev=572651&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/IDLProcessorException.java (added)
+++ webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/exceptions/IDLProcessorException.java Tue Sep 4 05:39:42 2007
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axis2.corba.exceptions;
+
+public class IDLProcessorException extends CorbaException {
+ public IDLProcessorException() {
+ super();
+ }
+
+ public IDLProcessorException(String message) {
+ super(message);
+ }
+
+ public IDLProcessorException(Throwable cause) {
+ super(cause);
+ }
+
+ public IDLProcessorException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/IDLProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/IDLProcessor.java?rev=572651&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/IDLProcessor.java (added)
+++ webservices/axis2/trunk/java/modules/corba/src/org/apache/axis2/corba/idl/IDLProcessor.java Tue Sep 4 05:39:42 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axis2.corba.idl;
+
+import antlr.collections.AST;
+//import antlr.DumpASTVisitor;
+import org.apache.axis2.corba.idl.parser.IDLLexer;
+import org.apache.axis2.corba.idl.parser.IDLParser;
+import org.apache.axis2.corba.exceptions.IDLProcessorException;
+import org.apache.axis2.corba.idl.parser.IDLVisitor;
+import org.apache.axis2.corba.idl.types.IDL;
+
+import java.io.InputStream;
+
+public class IDLProcessor {
+
+ protected InputStream stream;
+
+ public IDLProcessor(InputStream stream) {
+ this.stream = stream;
+ }
+
+ public IDL process() throws IDLProcessorException {
+ IDL idl;
+ try {
+ IDLParser parser = new IDLParser(new IDLLexer(stream));
+ parser.specification();
+ AST idlTree = parser.getAST();
+
+ // new DumpASTVisitor().visit(idlTree); // print the AST structure
+
+ IDLVisitor visitor = new IDLVisitor();
+ visitor.visit(idlTree);
+ idl = visitor.getIDL();
+ } catch (Exception ex) {
+ throw new IDLProcessorException(ex.getMessage(), ex);
+ }
+ return idl;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org