You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2007/06/09 13:10:06 UTC

svn commit: r545729 [1/3] - in /incubator/tuscany/java/sca/modules/binding-ejb: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/binding/ src/main/java/org/...

Author: antelder
Date: Sat Jun  9 04:10:04 2007
New Revision: 545729

URL: http://svn.apache.org/viewvc?view=rev&rev=545729
Log:
TUSCANY-1126, at long last get Rashmi Hunt's ejb binding contrabution committed

Added:
    incubator/tuscany/java/sca/modules/binding-ejb/   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/pom.xml   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingBuilder.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingDefinition.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingLoader.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBReferenceBinding.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBServiceBinding.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBTargetInvoker.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeMode.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ClassType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ConstantType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ContainerType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ExceptionType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLUtil.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLViolationException.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/InterfaceType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/Java2IDL.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/Java2IDLUtil.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/OperationType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ParameterType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/PrimitiveType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ValueMemberType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ValueType.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/EJBHandler.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/EJBLocator.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/EJBObjectFactory.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/EJBStubHelper.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/InterfaceInfo.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/JavaReflectionAdapter.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/MethodInfo.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/util/NamingEndpoint.java   (with props)
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/META-INF/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/META-INF/services/
    incubator/tuscany/java/sca/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.spi.BindingActivator

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Jun  9 04:10:04 2007
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/java/sca/modules/binding-ejb/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/pom.xml?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/pom.xml (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/pom.xml Sat Jun  9 04:10:04 2007
@@ -0,0 +1,65 @@
+<?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>
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-modules</artifactId>
+        <version>1.0-incubating-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>tuscany-binding-ejb</artifactId>
+    <name>Apache Tuscany Binding for Stateless Session Bean</name>
+    <description>Implementation of Stateless Session Bean binding</description>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-extension-helper</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-ejb_2.1_spec</artifactId>
+            <version>1.0.1</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>                                      
+            <artifactId>junit</artifactId>
+            <version>3.8.1</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.easymock</groupId>
+            <artifactId>easymock</artifactId>
+            <version>2.2</version>
+            <scope>test</scope>
+        </dependency>
+
+    </dependencies>
+
+</project>

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingBuilder.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingBuilder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingBuilder.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.tuscany.binding.ejb;
+
+import org.apache.tuscany.spi.builder.BuilderException;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.component.ReferenceBinding;
+import org.apache.tuscany.spi.component.ServiceBinding;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.BindingBuilderExtension;
+import org.apache.tuscany.spi.model.BoundReferenceDefinition;
+import org.apache.tuscany.spi.model.BoundServiceDefinition;
+
+public class EJBBindingBuilder extends BindingBuilderExtension<EJBBindingDefinition> {
+    public ServiceBinding build(CompositeComponent parent,
+                                BoundServiceDefinition serviceDefinition,
+                                EJBBindingDefinition bindingDefinition,
+                                DeploymentContext deploymentcontext) throws BuilderException {
+        EJBServiceBinding ejbService = new EJBServiceBinding(serviceDefinition.getName(), parent);
+        return ejbService;
+    }
+
+    public ReferenceBinding build(CompositeComponent parent,
+                                  BoundReferenceDefinition boundReferenceDefinition,
+                                  EJBBindingDefinition bindingDefinition,
+                                  DeploymentContext deploymentcontext) throws BuilderException {
+        return new EJBReferenceBinding(boundReferenceDefinition.getName(), parent, bindingDefinition);
+    }
+
+    public Class<EJBBindingDefinition> getBindingType() {
+        return EJBBindingDefinition.class;
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingDefinition.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingDefinition.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingDefinition.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,104 @@
+/*
+ * 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.tuscany.binding.ejb;
+
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.model.BindingDefinition;
+
+/**
+ * An implementation of EJBBinding.
+ */
+public class EJBBindingDefinition extends BindingDefinition {
+    public static final QName BINDING_EJB = new QName(XML_NAMESPACE_1_0, "binding.ejb");
+    /**
+     * corba location For exmaple,
+     * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome"
+     */
+    private String uri;
+
+    /**
+     * homeInterface. remote or local
+     */
+    private String homeInterface;
+
+    /**
+     * The ejb-link-name attribute allows a SCA client to bind to an EJB that is
+     * packaged in the same JEE EAR file as the SCA client. This is functionally
+     * equivalent to using the <ejb-link/> subelement of the <ejb-ref/> element
+     * in s EJB deployment descriptor. Used only for Service binding
+     */
+    private String ejbLinkName;
+
+    /**
+     * Gets the homeInterface.
+     * 
+     * @return home interface of the service binding
+     */
+    public String getHomeInterface() {
+        return homeInterface;
+    }
+
+    /**
+     * Set homeInterface
+     * 
+     * @param homeInterface
+     */
+    public void setHomeInterface(String homeInterface) {
+        this.homeInterface = homeInterface;
+    }
+
+    /**
+     * get ejb-link-name
+     * 
+     * @return ejb-link-name
+     */
+    public String getEjbLinkName() {
+        return ejbLinkName;
+    }
+
+    /**
+     * Set ejb-link-name
+     * 
+     * @param ejb-link-name
+     */
+    public void setEjbLinkName(String ejbLinkName) {
+        this.ejbLinkName = ejbLinkName;
+    }
+
+    /**
+     * Sets binding URI.
+     * 
+     * @param value the binding uri
+     */
+    public void setURI(String value) {
+        this.uri = value;
+    }
+
+    /**
+     * gets binding URI.
+     * 
+     * @return value the binding uri
+     */
+    public String getURI() {
+        return uri;
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingDefinition.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingDefinition.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingLoader.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingLoader.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingLoader.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,54 @@
+/*
+ * 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.tuscany.binding.ejb;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.spi.annotation.Autowire;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+import org.apache.tuscany.spi.extension.LoaderExtension;
+import org.apache.tuscany.spi.loader.LoaderException;
+import org.apache.tuscany.spi.loader.LoaderRegistry;
+import org.apache.tuscany.spi.model.ModelObject;
+
+public class EJBBindingLoader extends LoaderExtension {
+    public QName getXMLType() {
+        return EJBBindingDefinition.BINDING_EJB;
+    }
+
+    public EJBBindingLoader(@Autowire
+    LoaderRegistry registry) {
+        super(registry);
+    }
+
+    public EJBBindingDefinition load(CompositeComponent composite,
+                           ModelObject object,
+                           XMLStreamReader reader,
+                           DeploymentContext deploymentContext) throws XMLStreamException, LoaderException {
+        // construct EJBBinding model in memory
+        EJBBindingDefinition binding = new EJBBindingDefinition();
+        binding.setURI(reader.getAttributeValue(null, "uri"));
+        binding.setHomeInterface(reader.getAttributeValue(null, "homeInterface"));
+        binding.setEjbLinkName(reader.getAttributeValue(null, "ejb-link-name"));
+        return binding;
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBBindingLoader.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBReferenceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBReferenceBinding.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBReferenceBinding.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBReferenceBinding.java Sat Jun  9 04:10:04 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.tuscany.binding.ejb;
+
+import java.lang.reflect.Method;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ReferenceBindingExtension;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.model.ServiceContract;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * EJBReference
+ */
+public class EJBReferenceBinding<T> extends ReferenceBindingExtension {
+    private EJBBindingDefinition ejbBinding;
+
+    @SuppressWarnings("unchecked")
+    public EJBReferenceBinding(String theName,
+                        CompositeComponent parent,
+                        EJBBindingDefinition ejbBinding) {
+        super(theName, parent);
+        this.ejbBinding = ejbBinding;
+    }
+
+    public TargetInvoker createTargetInvoker(ServiceContract serviceContract, Operation operation) {
+        return new EJBTargetInvoker(ejbBinding, serviceContract.getInterfaceClass(), operation);
+    }
+
+    public TargetInvoker createTargetInvoker(Method operation) {
+        return new EJBTargetInvoker(operation);
+    }
+
+    public QName getBindingType() {
+        return EJBBindingDefinition.BINDING_EJB;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBReferenceBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBReferenceBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBServiceBinding.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBServiceBinding.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBServiceBinding.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBServiceBinding.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,49 @@
+/*
+ * 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.tuscany.binding.ejb;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.extension.ServiceBindingExtension;
+import org.osoa.sca.annotations.Destroy;
+
+/**
+ * An implementation of a {@link ServiceExtension} configured with the EJB
+ * binding
+ */
+public class EJBServiceBinding<T> extends ServiceBindingExtension {
+
+    public EJBServiceBinding(String theName, CompositeComponent parent) {
+        super(theName, parent);
+    }
+
+    public void start() {
+        super.start();
+    }
+
+    @Destroy
+    public void stop() {
+        super.stop();
+    }
+
+    public QName getBindingType() {
+        return EJBBindingDefinition.BINDING_EJB;
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBServiceBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBServiceBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBTargetInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBTargetInvoker.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBTargetInvoker.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBTargetInvoker.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,117 @@
+/*
+ * 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.tuscany.binding.ejb;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.binding.ejb.util.EJBHandler;
+import org.apache.tuscany.binding.ejb.util.NamingEndpoint;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.InvocationRuntimeException;
+import org.apache.tuscany.spi.wire.Message;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+/**
+ * EJBTargetInvoker
+ */
+public class EJBTargetInvoker implements TargetInvoker {
+
+    private Operation operation;
+    private String location;
+    private Class serviceInterface;
+    private String homeInterface;
+    private String ejbLinkName;
+
+    // is this needed
+    private Method method;
+
+    public EJBTargetInvoker(EJBBindingDefinition ejbBinding, Class serviceInterface, Operation operation) {
+        this.serviceInterface = serviceInterface;
+        this.location = ejbBinding.getURI();
+        this.homeInterface = ejbBinding.getHomeInterface();
+        this.ejbLinkName = ejbBinding.getEjbLinkName();
+        this.operation = operation;
+    }
+
+    public EJBTargetInvoker(Method method) {
+        this.method = method;
+    }
+
+    /**
+     * Invoke a EJB operation
+     * 
+     * @param payload
+     * @return
+     * @throws InvocationTargetException
+     */
+    public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
+
+        // construct NamingendPoint
+        NamingEndpoint endpoint = getNamingEndpoint();
+
+        // lookup home and ejb stub
+        EJBHandler ejbHandler = new EJBHandler(endpoint, serviceInterface);
+
+        String methodName = operation.getName();
+
+        // invoke business method on ejb
+        Object response = ejbHandler.invoke(methodName, (Object[])payload);
+
+        return response;
+    }
+
+    protected NamingEndpoint getNamingEndpoint() {
+
+        return new NamingEndpoint(location);
+    }
+
+    public Message invoke(Message msg) throws InvocationRuntimeException {
+        try {
+            Object resp = invokeTarget(msg.getBody(), NONE);
+            msg.setBody(resp);
+        } catch (Throwable e) {
+            e.printStackTrace();
+            msg.setBody(e);
+        }
+        return msg;
+    }
+
+    public EJBTargetInvoker clone() throws CloneNotSupportedException {
+        try {
+            return (EJBTargetInvoker)super.clone();
+        } catch (CloneNotSupportedException e) {
+            // will not happen
+            return null;
+        }
+    }
+
+    public boolean isCacheable() {
+        return true;
+    }
+
+    public void setCacheable(boolean cacheable) {
+
+    }
+
+    public boolean isOptimizable() {
+        return false;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBTargetInvoker.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/EJBTargetInvoker.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeMode.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeMode.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeMode.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeMode.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.tuscany.binding.ejb.java2idl;
+
+import java.io.ObjectStreamException;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * Mode of an IDL attribute
+ */
+public final class AttributeMode implements IDLEntity {
+    private static final long serialVersionUID = 4193442157999151834L;
+
+    private int value;
+
+    public static final int _ATTR_NORMAL = 0;
+
+    public static final AttributeMode ATTR_NORMAL = new AttributeMode(_ATTR_NORMAL);
+
+    public static final int _ATTR_READONLY = 1;
+
+    public static final AttributeMode ATTR_READONLY = new AttributeMode(_ATTR_READONLY);
+
+    public int value() {
+        return value;
+    }
+
+    public static AttributeMode from_int(int i) {
+        switch (i) {
+            case _ATTR_NORMAL:
+                return ATTR_NORMAL;
+            case _ATTR_READONLY:
+                return ATTR_READONLY;
+        }
+        throw new BAD_PARAM();
+    }
+
+    private AttributeMode(int i) {
+        value = i;
+    }
+
+    Object readResolve() throws ObjectStreamException {
+        return from_int(value());
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeMode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeMode.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeType.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeType.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeType.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,136 @@
+/*
+ * 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.tuscany.binding.ejb.java2idl;
+
+import java.lang.reflect.Method;
+import java.rmi.Remote;
+
+/**
+ * IDL Attribute
+ */
+public class AttributeType extends IDLType {
+
+    /**
+     * Attribute mode.
+     */
+    private AttributeMode mode;
+
+    /**
+     * Read Method.
+     */
+    private Method readMethod = null;
+    /**
+     * Write Method. This is null for read-only attributes.
+     */
+    private Method writeMethod = null;
+    /**
+     * Read method type.
+     */
+    private OperationType readOperationType = null;
+    /**
+     * Write method type. This is null for read-only attributes.
+     */
+    private OperationType writeOperationType = null;
+
+    /**
+     * Create an attribute type.
+     */
+    private AttributeType(String javaName, AttributeMode mode, Method readMethod, Method writeMethod) {
+        super(IDLUtil.javaToIDLName(javaName), javaName);
+        this.mode = mode;
+        // this.cls = readMethod.getReturnType();
+        this.readMethod = readMethod;
+        this.writeMethod = writeMethod;
+        // Only do operation type if the attribute is in a remote interface.
+        if (readMethod.getDeclaringClass().isInterface() && Remote.class.isAssignableFrom(readMethod
+            .getDeclaringClass())) {
+            readOperationType = new OperationType(readMethod);
+            if (writeMethod != null)
+                writeOperationType = new OperationType(writeMethod);
+            setIDLName(getIDLName()); // Fixup operation names
+        }
+    }
+
+    /**
+     * Create an attribute type for a read-only attribute.
+     */
+    AttributeType(String javaName, Method accessor) {
+        this(javaName, AttributeMode.ATTR_READONLY, accessor, null);
+    }
+
+    /**
+     * Create an attribute type for a read-write attribute.
+     */
+    AttributeType(String javaName, Method accessor, Method mutator) {
+        this(javaName, AttributeMode.ATTR_NORMAL, accessor, mutator);
+    }
+
+    /**
+     * Return the attribute mode.
+     */
+    public AttributeMode getMode() {
+        return mode;
+    }
+
+    /**
+     * Return the accessor method
+     */
+    public Method getReadMethod() {
+        return readMethod;
+    }
+
+    /**
+     * Return the mutator method
+     */
+    public Method getWriteMethod() {
+        return writeMethod;
+    }
+
+    /**
+     * Return the accessor operation type
+     */
+    public OperationType getReadOperationType() {
+        return readOperationType;
+    }
+
+    /**
+     * Return the mutator operation type
+     */
+    public OperationType getWriteOperationType() {
+        return writeOperationType;
+    }
+
+    /**
+     * Set the unqualified IDL name. This also sets the names of the associated
+     * operations.
+     */
+    void setIDLName(String idlName) {
+        super.setIDLName(idlName);
+        // If the first char is an uppercase letter and the second char is not
+        // an uppercase letter, then convert the first char to lowercase.
+        char ch0 = idlName.charAt(0);
+        if (Character.isUpperCase(ch0) && (idlName.length() <= 1 || (!Character.isUpperCase(idlName.charAt(1))))) {
+            idlName = Character.toLowerCase(ch0) + idlName.substring(1);
+        }
+        if (readOperationType != null)
+            readOperationType.setIDLName("_get_" + idlName);
+        if (writeOperationType != null)
+            writeOperationType.setIDLName("_set_" + idlName);
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/AttributeType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ClassType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ClassType.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ClassType.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ClassType.java Sat Jun  9 04:10:04 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.tuscany.binding.ejb.java2idl;
+
+/**
+ * IDL types.
+ */
+public class ClassType extends IDLType {
+
+    /**
+     * java class.
+     */
+    protected Class javaClass;
+
+    private static String getJavaName(Class cls) {
+        if (cls == null)
+            throw new IllegalArgumentException("Class cannot be null.");
+        String s = cls.getName();
+        int index = s.lastIndexOf('.');
+        if (index == -1)
+            return s;
+        else
+            return s.substring(index + 1);
+    }
+
+    public ClassType(Class cls, String idlName, String javaName) {
+        super(idlName, javaName);
+        this.javaClass = cls;
+    }
+
+    public ClassType(Class cls, String javaName) {
+        this(cls, IDLUtil.javaToIDLName(javaName), javaName);
+    }
+
+    public ClassType(Class cls) {
+        this(cls, getJavaName(cls));
+    }
+
+    /**
+     * Return java class.
+     */
+    public Class getJavaClass() {
+        return javaClass;
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ClassType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ClassType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ConstantType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ConstantType.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ConstantType.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ConstantType.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,68 @@
+/*
+ * 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.tuscany.binding.ejb.java2idl;
+
+import org.omg.CORBA.Any;
+
+/**
+ * IDL Constant
+ */
+public class ConstantType extends IDLType {
+
+    /**
+     * Java type of constant.
+     */
+    private Class type;
+    /**
+     * The value of the constant.
+     */
+    private Object value;
+
+    ConstantType(String javaName, Class type, Object value) {
+        super(javaName);
+        if (type == void.class || (!type.isPrimitive()) && type != java.lang.String.class)
+            throw new IllegalArgumentException("Illegal type for constant: " + type.getName());
+        this.type = type;
+        this.value = value;
+    }
+
+    /**
+     * Return my Java type.
+     */
+    public Class getType() {
+        return type;
+    }
+
+    /**
+     * Return my value.
+     */
+    public Object getValue() {
+        return value;
+    }
+
+    /**
+     * Insert the constant value into the argument Any.
+     */
+    public void insertValue(Any any) {
+        if (type == String.class)
+            any.insert_wstring((String)value); // 1.3.5.10 Map to wstring
+        else
+            IDLUtil.insertAnyPrimitive(any, value);
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ConstantType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ConstantType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ContainerType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ContainerType.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ContainerType.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ContainerType.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,791 @@
+/*
+ * 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.tuscany.binding.ejb.java2idl;
+
+import java.io.Externalizable;
+import java.io.ObjectStreamClass;
+import java.io.Serializable;
+import java.lang.ref.SoftReference;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * Common base class of ValueType and InterfaceType.
+ */
+public abstract class ContainerType extends ClassType {
+
+    /** Flags a method as overloaded. */
+    protected final byte M_OVERLOADED = 1;
+    /** Flags a method as the accessor of a read-write property. */
+    protected final byte M_READ = 2;
+    /** Flags a method as the mutator of a read-write property. */
+    protected final byte M_WRITE = 4;
+    /** Flags a method as the accessor of a read-only property. */
+    protected final byte M_READONLY = 8;
+    /** Flags a method as being inherited. */
+    protected final byte M_INHERITED = 16;
+    /**
+     * Flags a method as being the writeObject() method used for serialization.
+     */
+    protected final byte M_WRITEOBJECT = 32;
+    /** Flags a field as being a constant (public final static). */
+    protected final byte F_CONSTANT = 1;
+    /**
+     * Flags a field as being the special <code> public final static
+     *  java.io.ObjectStreamField[] serialPersistentFields</code>
+     * field.
+     */
+    protected final byte F_SPFFIELD = 2;
+
+    /**
+     * Array of all java methods.
+     */
+    protected Method[] methods;
+    /**
+     * Array with flags for all java methods.
+     */
+    protected byte[] m_flags;
+    /**
+     * Index of the mutator for read-write attributes. Only entries
+     * <code>i</code> where <code>(m_flags[i]&M_READ) != 0</code> are used.
+     * These entries contain the index of the mutator method corresponding to
+     * the accessor method.
+     */
+    protected int[] setters;
+    /**
+     * Array of all java fields.
+     */
+    protected Field[] fields;
+    /**
+     * Array with flags for all java fields.
+     */
+    protected byte[] f_flags;
+    /**
+     * The class hash code, as specified in "The Common Object Request Broker:
+     * Architecture and Specification" (01-02-33), section 10.6.2.
+     */
+    protected long classHashCode = 0;
+    /**
+     * The repository ID. This is in the RMI hashed format, like
+     * "RMI:java.util.Hashtable:C03324C0EA357270:13BB0F25214AE4B8".
+     */
+    protected String repositoryId;
+    /**
+     * The prefix and postfix of members repository ID. These are used to
+     * calculate member repository IDs and are like "RMI:java.util.Hashtable."
+     * and ":C03324C0EA357270:13BB0F25214AE4B8".
+     */
+    protected String memberPrefix, memberPostfix;
+    /**
+     * Array of type of the interfaces implemented/extended here.
+     */
+    protected InterfaceType[] interfaces;
+    /**
+     * Array of type of the abstract base valuetypes implemented/extended here.
+     */
+    protected ValueType[] abstractBaseValuetypes;
+    /**
+     * Array of attributes.
+     */
+    protected AttributeType[] attributes;
+    /**
+     * Array of Constants.
+     */
+    protected ConstantType[] constants;
+    /**
+     * Array of operations.
+     */
+    protected OperationType[] operations;
+
+    /**
+     * A cache for the fully qualified IDL name of the IDL module we belong to.
+     */
+    private String idlModuleName = null;
+
+    protected ContainerType(Class cls) {
+        super(cls);
+        if (cls == java.lang.Object.class || cls == java.io.Serializable.class || cls == java.io.Externalizable.class)
+            throw new IllegalArgumentException("Cannot parse special class: " + cls.getName());
+        this.javaClass = cls;
+    }
+
+    protected void parse() {
+        parseInterfaces();
+        parseMethods();
+        parseFields();
+        calculateClassHashCode();
+        calculateRepositoryId();
+        parseAttributes();
+        parseConstants();
+        parseOperations();
+        fixupOverloadedOperationNames();
+    }
+
+    /**
+     * Return the interfaces.
+     */
+    public InterfaceType[] getInterfaces() {
+        return (InterfaceType[])interfaces.clone();
+    }
+
+    /**
+     * Return the abstract base valuetypes.
+     */
+    public ValueType[] getAbstractBaseValuetypes() {
+        return (ValueType[])abstractBaseValuetypes.clone();
+    }
+
+    /**
+     * Return the attributes.
+     */
+    public AttributeType[] getAttributes() {
+        return (AttributeType[])attributes.clone();
+    }
+
+    /**
+     * Return the constants.
+     */
+    public ConstantType[] getConstants() {
+        return (ConstantType[])constants.clone();
+    }
+
+    /**
+     * Return the operations.
+     */
+    public OperationType[] getOperations() {
+        return (OperationType[])operations.clone();
+    }
+
+    /**
+     * Return the repository ID.
+     */
+    public String getRepositoryId() {
+        return repositoryId;
+    }
+
+    /**
+     * Return a repository ID for a member.
+     * 
+     * @param memberName The Java name of the member.
+     */
+    public String getMemberRepositoryId(String memberName) {
+        return memberPrefix + escapeIRName(memberName) + memberPostfix;
+    }
+
+    /**
+     * Return the fully qualified IDL module name that this type should be
+     * placed in.
+     */
+    public String getIDLModuleName() {
+        if (idlModuleName == null) {
+            String pkgName = javaClass.getPackage().getName();
+            StringBuffer b = new StringBuffer();
+            while (!"".equals(pkgName)) {
+                int idx = pkgName.indexOf('.');
+                String n = (idx == -1) ? pkgName : pkgName.substring(0, idx);
+                b.append("::").append(IDLUtil.javaToIDLName(n));
+                pkgName = (idx == -1) ? "" : pkgName.substring(idx + 1);
+            }
+            idlModuleName = b.toString();
+        }
+        return idlModuleName;
+    }
+
+    // Protected -----------------------------------------------------
+    /**
+     * Convert an integer to a 16-digit hex string.
+     */
+    protected String toHexString(int i) {
+        String s = Integer.toHexString(i).toUpperCase();
+        if (s.length() < 8)
+            return "00000000".substring(0, 8 - s.length()) + s;
+        else
+            return s;
+    }
+
+    /**
+     * Convert a long to a 16-digit hex string.
+     */
+    protected String toHexString(long l) {
+        String s = Long.toHexString(l).toUpperCase();
+        if (s.length() < 16)
+            return "0000000000000000".substring(0, 16 - s.length()) + s;
+        else
+            return s;
+    }
+
+    /**
+     * Check if a method is an accessor.
+     */
+    protected boolean isReadMethod(Method m) {
+        Class returnType = m.getReturnType();
+        if (!m.getName().startsWith("get"))
+            if (!m.getName().startsWith("is") || !(returnType == boolean.class))
+                return false;
+        if (returnType == void.class)
+            return false;
+        if (m.getParameterTypes().length != 0)
+            return false;
+        return hasNonAppExceptions(m);
+    }
+
+    /**
+     * Check if a method is a mutator.
+     */
+    protected boolean isWriteMethod(Method m) {
+        if (!m.getName().startsWith("set"))
+            return false;
+        if (m.getReturnType() != void.class)
+            return false;
+        if (m.getParameterTypes().length != 1)
+            return false;
+        return hasNonAppExceptions(m);
+    }
+
+    private static boolean isCheckedException(Class type) {
+        /*
+         * Is a checked exception
+         */
+        if (!Throwable.class.isAssignableFrom(type))
+            return false;
+
+        if (Error.class.isAssignableFrom(type))
+            return false;
+
+        if (RuntimeException.class.isAssignableFrom(type))
+            return false;
+        return true;
+    }
+
+    /**
+     * Check if a method throws anything checked other than
+     * java.rmi.RemoteException and its subclasses.
+     */
+    protected boolean hasNonAppExceptions(Method m) {
+        Class[] ex = m.getExceptionTypes();
+        for (int i = 0; i < ex.length; ++i) {
+            if (!isCheckedException(ex[i]))
+                continue;
+            if (!RemoteException.class.isAssignableFrom(ex[i]))
+                return false;
+        }
+        return true;
+    }
+
+    /**
+     * Analyse the fields of the class. This will fill in the
+     * <code>fields</code> and <code>f_flags</code> arrays.
+     */
+    protected void parseFields() {
+        fields = javaClass.getDeclaredFields();
+        f_flags = new byte[fields.length];
+        for (int i = 0; i < fields.length; ++i) {
+            int mods = fields[i].getModifiers();
+            if (Modifier.isFinal(mods) && Modifier.isStatic(mods) && Modifier.isPublic(mods))
+                f_flags[i] |= F_CONSTANT;
+        }
+    }
+
+    /**
+     * Analyse the interfaces of the class. This will fill in the
+     * <code>interfaces</code> array.
+     */
+    protected void parseInterfaces() {
+        Class[] intfs = javaClass.getInterfaces();
+        ArrayList a = new ArrayList();
+        ArrayList b = new ArrayList();
+        for (int i = 0; i < intfs.length; ++i) {
+            // Ignore java.rmi.Remote
+            if (intfs[i] == java.rmi.Remote.class)
+                continue;
+            // Ignore java.io.Serializable
+            if (intfs[i] == java.io.Serializable.class)
+                continue;
+            // Ignore java.io.Externalizable
+            if (intfs[i] == java.io.Externalizable.class)
+                continue;
+            if (!Java2IDLUtil.isAbstractValueType(intfs[i])) {
+                a.add(InterfaceType.getInterfaceType(intfs[i]));
+            } else {
+                b.add(ValueType.getValueType(intfs[i]));
+            }
+        }
+        interfaces = new InterfaceType[a.size()];
+        interfaces = (InterfaceType[])a.toArray(interfaces);
+        abstractBaseValuetypes = new ValueType[b.size()];
+        abstractBaseValuetypes = (ValueType[])b.toArray(abstractBaseValuetypes);
+    }
+
+    /**
+     * Analyse the methods of the class. This will fill in the
+     * <code>methods</code> and <code>m_flags</code> arrays.
+     */
+    protected void parseMethods() {
+        // The dynamic stub and skeleton strategy generation mechanism
+        // requires the inclusion of inherited methods in the type of
+        // remote interfaces. To speed things up, inherited methods are
+        // not considered in the type of a class or non-remote interface.
+        if (javaClass.isInterface() && java.rmi.Remote.class.isAssignableFrom(javaClass))
+            methods = javaClass.getMethods();
+        else
+            methods = javaClass.getDeclaredMethods();
+        m_flags = new byte[methods.length];
+        setters = new int[methods.length];
+        // Find read-write properties
+        for (int i = 0; i < methods.length; ++i)
+            setters[i] = -1; // no mutator here
+        for (int i = 0; i < methods.length; ++i) {
+            if (isReadMethod(methods[i]) && (m_flags[i] & M_READ) == 0) {
+                String attrName = attributeReadName(methods[i].getName());
+                Class iReturn = methods[i].getReturnType();
+                for (int j = i + 1; j < methods.length; ++j) {
+                    if (isWriteMethod(methods[j]) && (m_flags[j] & M_WRITE) == 0
+                        && attrName.equals(attributeWriteName(methods[j].getName()))) {
+                        Class[] jParams = methods[j].getParameterTypes();
+                        if (jParams.length == 1 && jParams[0] == iReturn) {
+                            m_flags[i] |= M_READ;
+                            m_flags[j] |= M_WRITE;
+                            setters[i] = j;
+                            break;
+                        }
+                    }
+                }
+            } else if (isWriteMethod(methods[i]) && (m_flags[i] & M_WRITE) == 0) {
+                String attrName = attributeWriteName(methods[i].getName());
+                Class[] iParams = methods[i].getParameterTypes();
+                for (int j = i + 1; j < methods.length; ++j) {
+                    if (isReadMethod(methods[j]) && (m_flags[j] & M_READ) == 0
+                        && attrName.equals(attributeReadName(methods[j].getName()))) {
+                        Class jReturn = methods[j].getReturnType();
+                        if (iParams.length == 1 && iParams[0] == jReturn) {
+                            m_flags[i] |= M_WRITE;
+                            m_flags[j] |= M_READ;
+                            setters[j] = i;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+        // Find read-only properties
+        for (int i = 0; i < methods.length; ++i)
+            if ((m_flags[i] & (M_READ | M_WRITE)) == 0 && isReadMethod(methods[i]))
+                m_flags[i] |= M_READONLY;
+        // Check for overloaded and inherited methods
+        for (int i = 0; i < methods.length; ++i) {
+            if ((m_flags[i] & (M_READ | M_WRITE | M_READONLY)) == 0) {
+                String iName = methods[i].getName();
+                for (int j = i + 1; j < methods.length; ++j) {
+                    if (iName.equals(methods[j].getName())) {
+                        m_flags[i] |= M_OVERLOADED;
+                        m_flags[j] |= M_OVERLOADED;
+                    }
+                }
+            }
+            if (methods[i].getDeclaringClass() != javaClass)
+                m_flags[i] |= M_INHERITED;
+        }
+    }
+
+    /**
+     * Convert an attribute read method name in Java format to an attribute name
+     * in Java format.
+     */
+    protected String attributeReadName(String name) {
+        if (name.startsWith("get"))
+            name = name.substring(3);
+        else if (name.startsWith("is"))
+            name = name.substring(2);
+        else
+            throw new IllegalArgumentException("Not an accessor: " + name);
+        return name;
+    }
+
+    /**
+     * Convert an attribute write method name in Java format to an attribute
+     * name in Java format.
+     */
+    protected String attributeWriteName(String name) {
+        if (name.startsWith("set"))
+            name = name.substring(3);
+        else
+            throw new IllegalArgumentException("Not an accessor: " + name);
+        return name;
+    }
+
+    /**
+     * Analyse constants. This will fill in the <code>constants</code> array.
+     */
+    protected void parseConstants() {
+        ArrayList a = new ArrayList();
+        for (int i = 0; i < fields.length; ++i) {
+            if ((f_flags[i] & F_CONSTANT) == 0)
+                continue;
+            Class type = fields[i].getType();
+            // Only map primitives and java.lang.String
+            if (!type.isPrimitive() && type != java.lang.String.class) {
+                // It is an RMI/IIOP violation for interfaces.
+                if (javaClass.isInterface())
+                    throw new IDLViolationException("Field \"" + fields[i].getName()
+                        + "\" of interface \""
+                        + javaClass.getName()
+                        + "\" is a constant, but not of one "
+                        + "of the primitive types, or String.", "1.2.3");
+                continue;
+            }
+            String name = fields[i].getName();
+            Object value;
+            try {
+                value = fields[i].get(null);
+            } catch (Exception ex) {
+                throw new RuntimeException(ex.toString());
+            }
+            a.add(new ConstantType(name, type, value));
+        }
+        constants = new ConstantType[a.size()];
+        constants = (ConstantType[])a.toArray(constants);
+    }
+
+    /**
+     * Analyse attributes. This will fill in the <code>attributes</code>
+     * array.
+     */
+    protected void parseAttributes() {
+        ArrayList a = new ArrayList();
+        for (int i = 0; i < methods.length; ++i) {
+            // if ((m_flags[i]&M_INHERITED) != 0)
+            // continue;
+            if ((m_flags[i] & (M_READ | M_READONLY)) != 0) {
+                // Read method of an attribute.
+                String name = attributeReadName(methods[i].getName());
+                if ((m_flags[i] & M_READONLY) != 0)
+                    a.add(new AttributeType(name, methods[i]));
+                else
+                    a.add(new AttributeType(name, methods[i], methods[setters[i]]));
+            }
+        }
+
+        attributes = new AttributeType[a.size()];
+        attributes = (AttributeType[])a.toArray(attributes);
+    }
+
+    /**
+     * Analyse operations. This will fill in the <code>operations</code>
+     * array. This implementation just creates an empty array; override in
+     * subclasses for a real type.
+     */
+    protected void parseOperations() {
+        operations = new OperationType[0];
+    }
+
+    /**
+     * Fixup overloaded operation names. As specified in section 1.3.2.6.
+     */
+    protected void fixupOverloadedOperationNames() {
+        for (int i = 0; i < methods.length; ++i) {
+            if ((m_flags[i] & M_OVERLOADED) == 0)
+                continue;
+            // Find the operation
+            OperationType oa = null;
+            for (int opIdx = 0; oa == null && opIdx < operations.length; ++opIdx)
+                if (operations[opIdx].getMethod().equals(methods[i]))
+                    oa = operations[opIdx];
+            if (oa == null)
+                continue; // This method is not mapped.
+            // Calculate new IDL name
+            ParameterType[] parms = oa.getParameters();
+            StringBuffer b = new StringBuffer(oa.getIDLName());
+            if (parms.length == 0)
+                b.append("__");
+            for (int j = 0; j < parms.length; ++j) {
+                String s = parms[j].getTypeIDLName();
+                if (s.startsWith("::"))
+                    s = s.substring(2);
+                b.append('_');
+                while (!"".equals(s)) {
+                    int idx = s.indexOf("::");
+                    b.append('_');
+                    if (idx == -1) {
+                        b.append(s);
+                        s = "";
+                    } else {
+                        b.append(s.substring(0, idx));
+                        s = s.substring(idx + 2);
+                    }
+                }
+            }
+            // Set new IDL name
+            oa.setIDLName(b.toString());
+        }
+    }
+
+    /**
+     * Fixup names differing only in case. As specified in section 1.3.2.7.
+     */
+    protected void fixupCaseNames() {
+        ArrayList entries = getContainedEntries();
+        boolean[] clash = new boolean[entries.size()];
+        String[] upperNames = new String[entries.size()];
+        for (int i = 0; i < entries.size(); ++i) {
+            IDLType aa = (IDLType)entries.get(i);
+            clash[i] = false;
+            upperNames[i] = aa.getIDLName().toUpperCase();
+            for (int j = 0; j < i; ++j) {
+                if (upperNames[i].equals(upperNames[j])) {
+                    clash[i] = true;
+                    clash[j] = true;
+                }
+            }
+        }
+        for (int i = 0; i < entries.size(); ++i) {
+            if (!clash[i])
+                continue;
+            IDLType aa = (IDLType)entries.get(i);
+            boolean noUpper = true;
+            String name = aa.getIDLName();
+            StringBuffer b = new StringBuffer(name);
+            b.append('_');
+            for (int j = 0; j < name.length(); ++j) {
+                if (!Character.isUpperCase(name.charAt(j)))
+                    continue;
+                if (noUpper)
+                    noUpper = false;
+                else
+                    b.append('_');
+                b.append(j);
+            }
+            aa.setIDLName(b.toString());
+        }
+    }
+
+    /**
+     * Return a list of all the entries contained here.
+     * 
+     * @param entries The list of entries contained here. Entries in this list
+     *            must be subclasses of <code>AbstractType</code>.
+     */
+    abstract protected ArrayList getContainedEntries();
+
+    /**
+     * Return the class hash code, as specified in "The Common Object Request
+     * Broker: Architecture and Specification" (01-02-33), section 10.6.2.
+     */
+    protected void calculateClassHashCode() {
+        // The simple cases
+        if (javaClass.isInterface())
+            classHashCode = 0;
+        else if (!Serializable.class.isAssignableFrom(javaClass))
+            classHashCode = 0;
+        else if (Externalizable.class.isAssignableFrom(javaClass))
+            classHashCode = 1;
+        else
+            // Go ask Util class for the hash code
+            classHashCode = IDLUtil.getClassHashCode(javaClass);
+    }
+
+    /**
+     * Escape non-ISO characters for an IR name.
+     */
+    protected String escapeIRName(String name) {
+        StringBuffer b = new StringBuffer();
+        for (int i = 0; i < name.length(); ++i) {
+            char c = name.charAt(i);
+            if (c < 256)
+                b.append(c);
+            else
+                b.append("\\U").append(toHexString((int)c));
+        }
+        return b.toString();
+    }
+
+    /**
+     * Return the IR global ID of the given class or interface. This is
+     * described in section 1.3.5.7. The returned string is in the RMI hashed
+     * format, like "RMI:java.util.Hashtable:C03324C0EA357270:13BB0F25214AE4B8".
+     */
+    protected void calculateRepositoryId() {
+        if (javaClass.isArray() || javaClass.isPrimitive())
+            throw new IllegalArgumentException("Not a class or interface.");
+        if (javaClass.isInterface() && org.omg.CORBA.Object.class.isAssignableFrom(javaClass)
+            && org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(javaClass)) {
+            StringBuffer b = new StringBuffer("IDL:");
+            b.append(javaClass.getPackage().getName().replace('.', '/'));
+            b.append('/');
+            String base = javaClass.getName();
+            base = base.substring(base.lastIndexOf('.') + 1);
+            b.append(base).append(":1.0");
+            repositoryId = b.toString();
+        } else {
+            StringBuffer b = new StringBuffer("RMI:");
+            b.append(escapeIRName(javaClass.getName()));
+            memberPrefix = b.toString() + ".";
+            String hashStr = toHexString(classHashCode);
+            b.append(':').append(hashStr);
+            ObjectStreamClass osClass = ObjectStreamClass.lookup(javaClass);
+            if (osClass != null) {
+                long serialVersionUID = osClass.getSerialVersionUID();
+                String SVUID = toHexString(serialVersionUID);
+                if (classHashCode != serialVersionUID)
+                    b.append(':').append(SVUID);
+                memberPostfix = ":" + hashStr + ":" + SVUID;
+            } else
+                memberPostfix = ":" + hashStr;
+            repositoryId = b.toString();
+        }
+    }
+
+    /**
+     * A simple aggregate of work-in-progress, and the thread doing the work.
+     */
+    private static class Task {
+        ContainerType type;
+        Thread thread;
+
+        Task(ContainerType type, Thread thread) {
+            this.type = type;
+            this.thread = thread;
+        }
+    }
+
+    /**
+     * Instances of this class cache the most complex types. The types cached
+     * are:
+     * <ul>
+     * <li><code>InterfaceType</code> for interfaces.</li>
+     * <li><code>ValueType</code> for value types.</li>
+     * <li><code>ExceptionType</code> for exceptions.</li>
+     * </ul>
+     * Besides caching work already done, this caches work in progress, as we
+     * need to know about this to handle cyclic graphs of parses. When a thread
+     * re-enters the <code>getType()</code> metohd, an unfinished type will be
+     * returned if the same thread is already working on this type.
+     */
+    protected static class WorkCache {
+        /**
+         * The type constructor of our type class. This constructor takes a
+         * single argument of type <code>Class</code>.
+         */
+        private Constructor constructor;
+
+        /**
+         * This maps the classes of completely done parses to soft references of
+         * their type.
+         */
+        private Map workDone;
+
+        /**
+         * This maps the classes of parses in progress to their type.
+         */
+        private Map workInProgress;
+
+        /**
+         * Create a new work cache manager.
+         * 
+         * @param containerType The class of the type type we cache here.
+         */
+        WorkCache(Class containerType) {
+            // Find the constructor and initializer.
+            try {
+                constructor = containerType.getDeclaredConstructor(new Class[] {Class.class});
+            } catch (NoSuchMethodException ex) {
+                throw new IllegalArgumentException("Bad Class: " + ex.toString());
+            }
+            workDone = new WeakHashMap();
+            workInProgress = new HashMap();
+        }
+
+        /**
+         * Returns an type. If the calling thread is currently doing an type of
+         * this class, an unfinished type is returned.
+         */
+        ContainerType getType(Class cls) {
+            ContainerType ret;
+            synchronized (this) {
+                ret = lookupDone(cls);
+                if (ret != null)
+                    return ret;
+                // is it work-in-progress?
+                Task inProgress = (Task)workInProgress.get(cls);
+                if (inProgress != null) {
+                    if (inProgress.thread == Thread.currentThread())
+                        return inProgress.type; // return unfinished
+                    // Do not wait for the other thread: We may deadlock
+                    // Double work is better than deadlock...
+                }
+                ret = createTask(cls);
+            }
+            // Do the work
+            parse(cls, ret);
+            // We did it
+            synchronized (this) {
+                workInProgress.remove(cls);
+                workDone.put(cls, new SoftReference(ret));
+                notifyAll();
+            }
+            return ret;
+        }
+
+        /**
+         * Lookup an type in the fully done map.
+         */
+        private ContainerType lookupDone(Class cls) {
+            SoftReference ref = (SoftReference)workDone.get(cls);
+            if (ref == null)
+                return null;
+            ContainerType ret = (ContainerType)ref.get();
+            if (ret == null)
+                workDone.remove(cls); // clear map entry if soft ref. was
+            // cleared.
+            return ret;
+        }
+
+        /**
+         * Create new work-in-progress.
+         */
+        private ContainerType createTask(Class cls) {
+            try {
+                ContainerType type = (ContainerType)constructor.newInstance(new Object[] {cls});
+                workInProgress.put(cls, new Task(type, Thread.currentThread()));
+                return type;
+            } catch (Exception ex) {
+                // Ignore it
+                return null;
+            }
+        }
+
+        private void parse(Class cls, ContainerType ret) {
+            try {
+                ret.parse();
+            } finally {
+                synchronized (this) {
+                    workInProgress.remove(cls);
+                }
+            }
+        }
+
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ContainerType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ContainerType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ExceptionType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ExceptionType.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ExceptionType.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ExceptionType.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,73 @@
+/*
+ * 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.tuscany.binding.ejb.java2idl;
+
+import java.util.StringTokenizer;
+
+/**
+ * IDL Exception
+ */
+public class ExceptionType extends ValueType {
+
+    private static WorkCache cache = new WorkCache(ExceptionType.class);
+
+    private String repositoryId;
+
+    public static ExceptionType getExceptionType(Class cls) {
+        return (ExceptionType)cache.getType(cls);
+    }
+
+    protected ExceptionType(Class cls) {
+        super(cls);
+    }
+
+    protected void parse() {
+        super.parse();
+        if (!Exception.class.isAssignableFrom(javaClass) || RuntimeException.class.isAssignableFrom(javaClass))
+            throw new IDLViolationException("Exception type " + javaClass.getName() + " must be a checked exception.",
+                                            "1.2.6");
+        // calculate exceptionRepositoryId
+        StringBuffer b = new StringBuffer("IDL:");
+        String base = javaClass.getName();
+        if (base.endsWith("Exception"))
+            base = base.substring(0, base.length() - 9);
+        StringTokenizer tokenizer = new StringTokenizer(base, ".");
+        while (tokenizer.hasMoreTokens()) {
+            String token = tokenizer.nextToken();
+            if (tokenizer.hasMoreTokens()) {
+                // Defect 281395
+                b.append(IDLUtil.javaToIDLName(token));
+                b.append('/');
+            } else {
+                b.append(IDLUtil.javaToIDLName(token + "Ex"));
+            }
+        }
+        b.append(":1.0");
+        repositoryId = b.toString();
+    }
+
+    /**
+     * Return the repository ID for the mapping of this analysis to an
+     * exception.
+     */
+    public String getExceptionRepositoryId() {
+        return repositoryId;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ExceptionType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/ExceptionType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLType.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLType.java?view=auto&rev=545729
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLType.java (added)
+++ incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLType.java Sat Jun  9 04:10:04 2007
@@ -0,0 +1,65 @@
+/*
+ * 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.tuscany.binding.ejb.java2idl;
+
+/**
+ * Abstract base class for all IDL types.
+ */
+abstract class IDLType {
+
+    /**
+     * Unqualified IDL name.
+     */
+    protected String idlName;
+    /**
+     * Unqualified java name.
+     */
+    protected String javaName;
+
+    IDLType(String idlName, String javaName) {
+        this.idlName = idlName;
+        this.javaName = javaName;
+    }
+
+    IDLType(String javaName) {
+        this(IDLUtil.javaToIDLName(javaName), javaName);
+    }
+
+    /**
+     * Return my unqualified IDL name.
+     */
+    public String getIDLName() {
+        return idlName;
+    }
+
+    /**
+     * Return unqualified java name.
+     */
+    public String getJavaName() {
+        return javaName;
+    }
+
+    /**
+     * Set unqualified IDL name.
+     */
+    void setIDLName(String idlName) {
+        this.idlName = idlName;
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/binding-ejb/src/main/java/org/apache/tuscany/binding/ejb/java2idl/IDLType.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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