summaryrefslogtreecommitdiffstats
path: root/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding')
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProviderFactory.java70
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java89
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java100
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java92
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/CorbaException.java34
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/RequestConfigurationException.java43
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java253
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaResponse.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java70
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java65
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/ComponentInvocationProxy.java120
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java137
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationException.java43
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationProxy.java46
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/OperationTypes.java51
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/AnnotationAttributes.java46
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/NodeType.java28
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTree.java50
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java497
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeNode.java75
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java59
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ArrayTypeHelper.java53
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/BooleanTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ByteTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/CharTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/DoubleTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java41
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/FloatTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/IntTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/LongTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ReferenceTypeHelper.java42
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/SequenceTypeHelper.java70
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ShortTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StringTypeHelper.java39
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java69
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelper.java47
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java119
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java92
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java40
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java97
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java578
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaArray.java34
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java37
-rw-r--r--sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java28
44 files changed, 0 insertions, 3705 deletions
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProviderFactory.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProviderFactory.java
deleted file mode 100644
index 99c9d7736e..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProviderFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.sca.binding.corba.impl;
-
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint;
-import org.apache.tuscany.sca.host.corba.ExtensibleCorbaHost;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaBindingProviderFactory implements BindingProviderFactory<CorbaBinding> {
-
- private CorbaHostExtensionPoint chep;
- private ExtensibleCorbaHost host;
-
- public CorbaBindingProviderFactory(ExtensionPointRegistry registry) {
- chep = registry.getExtensionPoint(CorbaHostExtensionPoint.class);
- host = new ExtensibleCorbaHost(chep);
- }
- /**
- * @see org.apache.tuscany.sca.provider.BindingProviderFactory#createReferenceBindingProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- CorbaBinding binding) {
- return new CorbaReferenceBindingProvider(binding, host, reference);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.BindingProviderFactory#createServiceBindingProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- CorbaBinding binding) {
- return new CorbaServiceBindingProvider(binding, host, service);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class<CorbaBinding> getModelType() {
- return CorbaBinding.class;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java
deleted file mode 100644
index 1577184b48..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.sca.binding.corba.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaRequest;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaResponse;
-import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.omg.CORBA.Object;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaInvoker implements Invoker {
-
- private Object remoteObject;
- private Class<?> referenceClass;
- private Map<Method, String> operationsMap;
- private Map<Operation, Method> operationMethodMapping;
-
- public CorbaInvoker(RuntimeComponentReference reference, Object remoteObject, Class<?> referenceClass, Map<Method, String> operationsMap) {
- this.remoteObject = remoteObject;
- this.referenceClass = referenceClass;
- this.operationsMap = operationsMap;
- this.operationMethodMapping = OperationMapper.mapOperationToMethod(reference.getInterfaceContract().getInterface().getOperations(), referenceClass);
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
- */
- public Message invoke(Message msg) {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(remoteObject, msg.getOperation().getName());
- request.setReferenceClass(referenceClass);
- request.setOperationsMap(operationsMap);
- if (msg.getOperation().getOutputType() != null) {
- Annotation[] notes = operationMethodMapping.get(msg.getOperation()).getAnnotations();
- request.setOutputType(msg.getOperation().getOutputType().getPhysical(), notes);
- }
- java.lang.Object[] args = msg.getBody();
- if (args != null) {
- Annotation[][] notes = operationMethodMapping.get(msg.getOperation()).getParameterAnnotations();
- for (int i = 0; i < args.length; i++) {
- request.addArgument(args[i], notes[i]);
- }
- }
- if (msg.getOperation().getFaultTypes() != null) {
- for (DataType<?> type : msg.getOperation().getFaultTypes()) {
- request.addExceptionType(type.getPhysical());
- }
- }
- DynaCorbaResponse response = request.invoke();
- msg.setBody(response.getContent());
- } catch (RequestConfigurationException e) {
- throw new ServiceRuntimeException(e);
- } catch (Exception e) {
- msg.setFaultBody(e);
- }
- return msg;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
deleted file mode 100644
index 43bf984440..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.sca.binding.corba.impl;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaReferenceBindingProvider implements ReferenceBindingProvider {
-
- private static final Logger logger = Logger.getLogger(CorbaReferenceBindingProvider.class.getName());
- private CorbaBinding binding;
- private CorbaHost host;
- private RuntimeComponentReference reference;
- private Object remoteObject;
- private Class<?> referenceClass;
- private Map<Method, String> operationsMap = null;
-
- public CorbaReferenceBindingProvider(CorbaBinding binding, CorbaHost host, RuntimeComponentReference reference) {
- this.binding = binding;
- this.host = host;
- this.reference = reference;
- this.referenceClass = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
- operationsMap = OperationMapper.mapMethodToOperationName(referenceClass);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#createInvoker(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Invoker createInvoker(Operation operation) {
- try {
- if (remoteObject == null) {
- remoteObject = host.lookup(binding.getCorbaname());
- }
- return new CorbaInvoker(reference, remoteObject, referenceClass, operationsMap);
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during creating CORBA invoker", e);
- }
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#getBindingInterfaceContract()
- */
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#start()
- */
- public void start() {
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#stop()
- */
- public void stop() {
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#supportsOneWayInvocation()
- */
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java
deleted file mode 100644
index 0465dbe7e9..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.sca.binding.corba.impl;
-
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-import org.apache.tuscany.sca.binding.corba.impl.service.ComponentInvocationProxy;
-import org.apache.tuscany.sca.binding.corba.impl.service.DynaCorbaServant;
-import org.apache.tuscany.sca.binding.corba.impl.service.InvocationProxy;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaServiceBindingProvider implements ServiceBindingProvider {
-
- private CorbaBinding binding;
- private CorbaHost host;
- private RuntimeComponentService service;
- private DynaCorbaServant servant;
-
- public CorbaServiceBindingProvider(CorbaBinding binding, CorbaHost host, RuntimeComponentService service) {
- this.binding = binding;
- this.host = host;
- this.service = service;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#getBindingInterfaceContract()
- */
- public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#start()
- */
- public void start() {
- try {
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(binding), javaClass);
- servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- servant.setIds(new String[] {binding.getId()});
- host.registerServant(binding.getCorbaname(), servant);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#stop()
- */
- public void stop() {
- try {
- host.unregisterServant(binding.getCorbaname());
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#supportsOneWayInvocation()
- */
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/CorbaException.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/CorbaException.java
deleted file mode 100644
index 6e54556a2c..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/CorbaException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.exceptions;
-
-/**
- * @version $Rev$ $Date$
- * Represents CORBA SystemException
- */
-public class CorbaException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public CorbaException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/RequestConfigurationException.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/RequestConfigurationException.java
deleted file mode 100644
index 9a11d205f2..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/RequestConfigurationException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.exceptions;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RequestConfigurationException extends Exception {
-
- private static final long serialVersionUID = 1L;
- private String objectId;
-
- public RequestConfigurationException(String message, String objectId) {
- super(message + ", object id was: " + objectId);
- this.objectId = objectId;
- }
-
- public RequestConfigurationException(String message) {
- super(message);
- }
-
- public String getType() {
- return objectId;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java
deleted file mode 100644
index 3936bed9f6..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.reference;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.CorbaException;
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.TypeHelpersProxy;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
-import org.apache.tuscany.sca.binding.corba.impl.util.MethodFinder;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.ObjectImpl;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$ Represents single CORBA request
- */
-public class DynaCorbaRequest {
-
- private TypeTree returnTree;
- private Map<String, TypeTree> exceptions = new HashMap<String, TypeTree>();
- private InputStream inputStream;
- private ObjectImpl remoteObject;
- private String operation;
- private List<java.lang.Object> arguments = new ArrayList<java.lang.Object>();
- private List<TypeTree> argumentsTypes = new ArrayList<TypeTree>();
- private Class<?> referenceClass;
- private Map<Method, String> operationsMap;
-
- /**
- * Creates request.
- *
- * @param ObjectremoteObject remote object reference
- * @param operation operation to invoke
- * @param scaBindingRules apply SCA default binding mapping rules
- */
- public DynaCorbaRequest(Object remoteObject, String operation) {
- this.remoteObject = (ObjectImpl)remoteObject;
- this.operation = operation;
- }
-
- /**
- * Sets class which will be backed by this reference request
- * @param referenceClass
- */
- public void setReferenceClass(Class<?> referenceClass) {
- this.referenceClass = referenceClass;
- }
-
- /**
- * Sets method to operation names mapping
- * @param operationsMap
- */
- public void setOperationsMap(Map<Method, String> operationsMap) {
- this.operationsMap = operationsMap;
- }
-
- /**
- * Adds operation argument - stores arguments and caches its TypeTree. Annotations will be set to null by default.
- *
- * @param argument
- */
- public void addArgument(java.lang.Object argument) throws RequestConfigurationException {
- addArgument(argument, null);
- }
-
- /**
- * Adds operation argument - stores arguments and caches its TypeTree
- *
- * @param argument
- */
- public void addArgument(java.lang.Object argument, Annotation[] notes) throws RequestConfigurationException {
- TypeTree tree = TypeTreeCreator.createTypeTree(argument.getClass(), notes);
- argumentsTypes.add(tree);
- arguments.add(argument);
- }
-
- /**
- * Passing stored arguments to CORBA communication output stream
- *
- * @param outputStream
- * @throws RequestConfigurationException
- */
- private void passArguments(OutputStream outputStream) throws RequestConfigurationException {
- for (int i = 0; i < arguments.size(); i++) {
- TypeTree tree = argumentsTypes.get(i);
- TypeHelpersProxy.write(tree.getRootNode(), outputStream, arguments.get(i));
- }
- }
-
- /**
- * Sets return type for operation. Annotations will be set to null by default.
- *
- * @param forClass
- */
- public void setOutputType(Class<?> forClass) throws RequestConfigurationException {
- setOutputType(forClass, null);
- }
-
- /**
- * Sets return type for operation
- *
- * @param forClass
- */
- public void setOutputType(Class<?> forClass, Annotation[] notes) throws RequestConfigurationException {
- returnTree = TypeTreeCreator.createTypeTree(forClass, notes);
- }
-
- /**
- * Configures possible exceptions
- *
- * @param forClass
- */
- public void addExceptionType(Class<?> forClass) throws RequestConfigurationException {
- TypeTree tree = TypeTreeCreator.createTypeTree(forClass, null);
- String exceptionId = Utils.getTypeId(forClass);
- exceptions.put(exceptionId, tree);
- }
-
- /**
- * Handles application excpeition.
- *
- * @param ae occured exception
- * @throws Exception
- */
- private void handleApplicationException(ApplicationException ae) throws Exception {
- try {
- if (exceptions.size() == 0) {
- RequestConfigurationException exception =
- new RequestConfigurationException(
- "ApplicationException occured, but no exception type was specified.",
- ae.getId());
- throw exception;
- }
- InputStream is = ae.getInputStream();
- String exceptionId = is.read_string();
- TypeTree tree = exceptions.get(exceptionId);
- if (tree == null) {
- RequestConfigurationException exception =
- new RequestConfigurationException(
- "ApplicationException occured, but no such exception was defined",
- ae.getId());
- throw exception;
- } else {
- Exception ex = (Exception)TypeHelpersProxy.read(tree.getRootNode(), is);
- throw ex;
- }
- } catch (Exception e) {
- throw e;
- }
- }
-
- /**
- * Handles exceptions generated by CORBA API
- *
- * @param se
- */
- private void handleSystemException(SystemException se) throws Exception {
- if (se instanceof BAD_OPERATION) {
- throw new CorbaException("Bad operation name: " + operation, se);
- } else if (se instanceof BAD_PARAM) {
- throw new CorbaException("Bad parameter", se);
- } else {
- // TODO: handle more system exception types
- throw new CorbaException(se.getMessage(), se);
- }
- }
-
- /**
- * Gets operation name which is includes mapping rules
- * @return
- */
- private String getFinalOperationName() {
- String result = operation;
- if (referenceClass != null) {
- Class<?>[] argumentTypes = new Class<?>[arguments.size()];
- for (int i = 0; i < arguments.size(); i++) {
- argumentTypes[i] = arguments.get(i).getClass();
- }
- Method method = MethodFinder.findMethod(referenceClass, operation, argumentTypes);
- String newOperation = (String)operationsMap.get(method);
- if (newOperation != null) {
- result = newOperation;
- }
- }
- return result;
- }
-
- /**
- * Invokes previously configured request
- *
- * @return
- */
- public DynaCorbaResponse invoke() throws Exception {
- DynaCorbaResponse response = new DynaCorbaResponse();
- String finalOperationName = getFinalOperationName();
- OutputStream outputStream = ((ObjectImpl)remoteObject)._request(finalOperationName, true);
- passArguments(outputStream);
- try {
- inputStream = remoteObject._invoke(outputStream);
- if (inputStream != null && returnTree != null) {
- response.setContent(TypeHelpersProxy.read(returnTree.getRootNode(), inputStream));
- }
- } catch (ApplicationException ae) {
- handleApplicationException(ae);
- } catch (SystemException se) {
- handleSystemException(se);
- } catch (Exception e) {
- throw e;
- } finally {
- release();
- }
- return response;
- }
-
- /**
- * Releases request resources
- */
- private void release() {
- remoteObject._releaseReply(inputStream);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaResponse.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaResponse.java
deleted file mode 100644
index 25463a7a8a..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaResponse.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.reference;
-
-/**
- * @version $Rev$ $Date$
- * Holder for content returned from DynaCorbaRequest
- *
- */
-public class DynaCorbaResponse {
-
- private Object content;
-
- public Object getContent() {
- return content;
- }
-
- public void setContent(Object content) {
- this.content = content;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java
deleted file mode 100644
index 514d7055a8..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.reference;
-
-import java.lang.reflect.Method;
-
-import net.sf.cglib.proxy.Callback;
-import net.sf.cglib.proxy.CallbackFilter;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.NoOp;
-
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- */
-public class InterfaceInstanceCreator {
-
- private static final CallbackFilter FILTER = new CallbackFilter() {
- public int accept(Method method) {
- return 1;
- }
- };
-
- /**
- * Dynamically creates instance of user defined interface. Instance is
- * enhanced by RemoteMethodInterceptor
- *
- * @param reference
- * CORBA reference
- * @param forClass
- * user defined interface
- * @return dynamic implementation instance
- */
- public static java.lang.Object createInstance(Object reference, Class<?> forClass) {
- java.lang.Object result = null;
- try {
- Enhancer enhancer = new Enhancer();
- enhancer.setInterfaces(new Class[] {forClass});
- enhancer.setCallbackFilter(FILTER);
- enhancer.setCallbackTypes(new Class[] {NoOp.class, MethodInterceptor.class});
- Class<?> newClass = enhancer.createClass();
- Enhancer.registerStaticCallbacks(newClass, new Callback[] {NoOp.INSTANCE,
- new InterfaceMethodInterceptor(reference, forClass)});
- result = newClass.newInstance();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java
deleted file mode 100644
index 7fba091b41..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.reference;
-
-import java.lang.reflect.Method;
-
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- * Interceptor for CORBA reference methods
- */
-public class InterfaceMethodInterceptor implements MethodInterceptor {
-
- private Object reference;
- private Class<?> javaClass;
-
- public InterfaceMethodInterceptor(Object reference, Class<?> javaClass) {
- this.reference = reference;
- this.javaClass = javaClass;
- }
-
- /**
- * Create and execute DynaCorbaRequest instance, basing on intercepted
- * method arguments, return types, exceptions
- */
- public java.lang.Object intercept(java.lang.Object object,
- Method method,
- java.lang.Object[] arguments,
- MethodProxy arg3) throws Throwable {
- DynaCorbaRequest request = new DynaCorbaRequest(reference, method.getName());
- request.setReferenceClass(javaClass);
- for (int i = 0; i < arguments.length; i++) {
- request.addArgument(arguments[i]);
- }
- request.setOutputType(method.getReturnType());
- Class<?>[] exceptions = method.getExceptionTypes();
- for (int i = 0; i < exceptions.length; i++) {
- request.addExceptionType(exceptions[i]);
- }
- DynaCorbaResponse response = request.invoke();
- return response.getContent();
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/ComponentInvocationProxy.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/ComponentInvocationProxy.java
deleted file mode 100644
index ff4732cfdb..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/ComponentInvocationProxy.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.service;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
-import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * @version $Rev$ $Date$
- * Invocation proxy for SCA components
- */
-public class ComponentInvocationProxy implements InvocationProxy {
-
- private RuntimeWire wire;
- private Map<Method, Operation> methodOperationMapping;
- private Map<Operation, Method> operationMethodMapping;
- private Map<String, Method> operationsMap;
- private Map<Operation, OperationTypes> operationsCache = new HashMap<Operation, OperationTypes>();
-
- public ComponentInvocationProxy(RuntimeComponentService service, RuntimeWire wire, Class<?> javaClass)
- throws RequestConfigurationException {
- this.wire = wire;
- operationsMap = OperationMapper.mapOperationNameToMethod(javaClass);
- operationMethodMapping = OperationMapper.mapOperationToMethod(service.getInterfaceContract().getInterface().getOperations(), javaClass);
- methodOperationMapping = OperationMapper.mapMethodToOperation(service.getInterfaceContract().getInterface().getOperations(), javaClass);
- cacheOperationTypes(service.getInterfaceContract().getInterface().getOperations());
- }
-
- /**
- * Caches TypeTree for every operation in backed component
- *
- * @param operations
- * @throws RequestConfigurationException
- */
- private void cacheOperationTypes(List<Operation> operations) throws RequestConfigurationException {
- for (Operation operation : operations) {
- try {
- OperationTypes operationTypes = new OperationTypes();
- List<TypeTree> inputInstances = new ArrayList<TypeTree>();
- // cache output type tree
- if (operation.getOutputType() != null && operation.getOutputType().getPhysical() != null
- && !operation.getOutputType().getPhysical().equals(void.class)) {
- Annotation[] notes = operationMethodMapping.get(operation).getAnnotations();
- TypeTree outputType =
- TypeTreeCreator.createTypeTree(operation.getOutputType().getPhysical(), notes);
- operationTypes.setOutputType(outputType);
- }
- // cache input types trees
- if (operation.getInputType() != null) {
- Method method = operationMethodMapping.get(operation);
- Annotation[][] notes = method.getParameterAnnotations();
- int i = 0;
- for (DataType<List<DataType<?>>> type : operation.getInputType().getLogical()) {
- Class<?> forClass = type.getPhysical();
- TypeTree inputType = TypeTreeCreator.createTypeTree(forClass, notes[i]);
- inputInstances.add(inputType);
- i++;
- }
-
- }
- operationTypes.setInputType(inputInstances);
- operationsCache.put(operation, operationTypes);
- } catch (RequestConfigurationException e) {
- throw e;
- }
- }
- }
-
- private Operation getOperation4Name(String operationName) {
- Method method = operationsMap.get(operationName);
- return methodOperationMapping.get(method);
- }
-
- public OperationTypes getOperationTypes(String operationName) {
- return operationsCache.get(getOperation4Name(operationName));
- }
-
- public Object invoke(String operationName, List<Object> arguments) throws InvocationException {
- Object result = null;
- try {
- result = wire.invoke(getOperation4Name(operationName), arguments.toArray());
- } catch (InvocationTargetException e) {
- InvocationException exception = new InvocationException(e.getCause());
- throw exception;
- }
- return result;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
deleted file mode 100644
index 2a032f5d25..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.service;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.TypeHelpersProxy;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.InvokeHandler;
-import org.omg.CORBA.portable.ObjectImpl;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.portable.ResponseHandler;
-
-/**
- * @version $Rev$ $Date$
- * General servant which provides target component implementation via CORBA
- */
-public class DynaCorbaServant extends ObjectImpl implements InvokeHandler {
-
- private static final Logger logger = Logger.getLogger(DynaCorbaServant.class.getName());
-
- private String[] ids;
- private InvocationProxy invocationProxy;
- private String typeId;
-
- /**
- * Creates servant object
- * @param invocationProxy
- * @param typeId
- * @throws RequestConfigurationException
- */
- public DynaCorbaServant(InvocationProxy invocationProxy, String typeId) throws RequestConfigurationException {
- this.invocationProxy = invocationProxy;
- this.typeId = typeId;
- setDefaultIds();
- }
-
- /**
- * Sets CORBA object ID
- * @param ids
- */
- public void setIds(String[] ids) {
- for (int i = 0; i < ids.length; i++) {
- if (ids[i] == null || ids[i].length() == 0) {
- // if invalid id was passed then set to default
- setDefaultIds();
- return;
- }
- }
- this.ids = ids;
- }
-
- public OutputStream _invoke(String operationName, InputStream in, ResponseHandler rh) {
- OperationTypes types = invocationProxy.getOperationTypes(operationName);
- if (types == null) {
- // operation wasn't found
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- } else {
- List<Object> inputInstances = new ArrayList<Object>();
- try {
- // retrieving in arguments
- for (TypeTree tree : types.getInputType()) {
- Object o = TypeHelpersProxy.read(tree.getRootNode(), in);
- inputInstances.add(o);
- }
- } catch (MARSHAL e) {
- // parameter passed by user was not compatible with Java to
- // Corba mapping
- throw new org.omg.CORBA.BAD_PARAM(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
- try {
- // invocation and sending result
- Object result = invocationProxy.invoke(operationName, inputInstances);
- OutputStream out = rh.createReply();
- if (types.getOutputType() != null) {
- TypeTree tree = types.getOutputType();
- TypeHelpersProxy.write(tree.getRootNode(), out, result);
- }
- return out;
- } catch (InvocationException ie) {
- // handling user exception
- try {
- OutputStream out = rh.createExceptionReply();
- Class<?> exceptionClass = ie.getTargetException().getClass();
- TypeTree tree = TypeTreeCreator.createTypeTree(exceptionClass, null);
- String exceptionId = Utils.getTypeId(exceptionClass);
- out.write_string(exceptionId);
- TypeHelpersProxy.write(tree.getRootNode(), out, ie.getTargetException());
- return out;
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during handling invocation exception", e);
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Unexpected exception during sending CORBA result to client", e);
- }
- }
- return null;
- }
-
- @Override
- public String[] _ids() {
- return ids;
- }
-
- /**
- * Sets servant ID to default, based on Java class name
- */
- private void setDefaultIds() {
- this.ids = new String[] {typeId};
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationException.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationException.java
deleted file mode 100644
index a82e43e42e..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.service;
-
-/**
- * @version $Rev$ $Date$
- * Wrapper for exception thrown during target invocation
- */
-public class InvocationException extends Exception {
-
- private static final long serialVersionUID = 1L;
- private Throwable targetException;
-
- public InvocationException(Throwable targetException) {
- this.targetException = targetException;
- }
-
- public Throwable getTargetException() {
- return targetException;
- }
-
- public void setTargetException(Throwable target) {
- this.targetException = target;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationProxy.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationProxy.java
deleted file mode 100644
index 5ad9068b8d..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationProxy.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.service;
-
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- * Target proxy interface for service bindings
- */
-public interface InvocationProxy {
-
- /**
- * Gets operations types for target
- * @param operationName
- * @return
- */
- public OperationTypes getOperationTypes(String operationName);
-
- /**
- * Invokes target operation
- * @param operationName
- * @param arguments
- * @return
- * @throws InvocationException
- */
- public Object invoke(String operationName, List<Object> arguments) throws InvocationException;
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/OperationTypes.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/OperationTypes.java
deleted file mode 100644
index d93036d6d9..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/OperationTypes.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.service;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-
-/**
- * @version $Rev$ $Date$
- * Holder for Java type trees for one method
- */
-public class OperationTypes {
-
- private TypeTree outputType;
- private List<TypeTree> inputType;
-
- public TypeTree getOutputType() {
- return outputType;
- }
-
- public void setOutputType(TypeTree outputType) {
- this.outputType = outputType;
- }
-
- public List<TypeTree> getInputType() {
- return inputType;
- }
-
- public void setInputType(List<TypeTree> inputType) {
- this.inputType = inputType;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/AnnotationAttributes.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/AnnotationAttributes.java
deleted file mode 100644
index d2b48d22c7..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/AnnotationAttributes.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types;
-
-/**
- * Holds information retrieved from objects annotations
- */
-public class AnnotationAttributes {
-
- private boolean corbaArray;
- private int[] corbaArrayLength;
-
- public boolean isCorbaArray() {
- return corbaArray;
- }
-
- public void setCorbaArray(boolean isCorbaArray) {
- this.corbaArray = isCorbaArray;
- }
-
- public int[] getCorbaArrayLength() {
- return corbaArrayLength;
- }
-
- public void setCorbaArrayLength(int[] corbaArrayLength) {
- this.corbaArrayLength = corbaArrayLength;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/NodeType.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/NodeType.java
deleted file mode 100644
index 4080a836bc..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/NodeType.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types;
-
-/**
- * @version $Rev$ $Date$
- * Types of CORBA objects.
- */
-public enum NodeType {
- primitive, struct, union, array, sequence, reference, idl_enum, exception
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTree.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTree.java
deleted file mode 100644
index b8c4f88324..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTree.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types;
-
-/**
- * @version $Rev$ $Date$
- * Helper tree for Java object hierarchy. It's closer to CORBA types
- * structure than plain Java hierarchy - it helps reading and writing
- * complex structures.
- */
-public class TypeTree {
-
- private TypeTreeNode rootNode;
-
- /**
- * Returns root node.
- *
- * @return root of type tree
- */
- public TypeTreeNode getRootNode() {
- return rootNode;
- }
-
- /**
- * Sets root of the type tree.
- *
- * @param rootNode root node.
- */
- public void setRootNode(TypeTreeNode rootNode) {
- this.rootNode = rootNode;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java
deleted file mode 100644
index e8441ed177..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-/**
- * @version $Rev$ $Date$
- * Creator of types tree.
- */
-public class TypeTreeCreator {
-
- /**
- * Helps to determine if type is a primitive.
- */
- private static List<Class<?>> primitives = new ArrayList<Class<?>>();
-
- static {
- primitives.add(boolean.class);
- primitives.add(byte.class);
- primitives.add(short.class);
- primitives.add(int.class);
- primitives.add(long.class);
- primitives.add(double.class);
- primitives.add(float.class);
- primitives.add(char.class);
- primitives.add(String.class);
- primitives.add(Boolean.class);
- primitives.add(Byte.class);
- primitives.add(Short.class);
- primitives.add(Integer.class);
- primitives.add(Long.class);
- primitives.add(Double.class);
- primitives.add(Float.class);
- primitives.add(Character.class);
- }
-
- /**
- * Creates class for given string argument.
- *
- * @param name name of type
- * @return type
- */
- private static Class<?> createClassFromString(String name) {
- Class<?> result = null;
- try {
- if (name.length() == 1) {
- // primitives
- switch (name.charAt(0)) {
- case 'Z':
- result = boolean.class;
- break;
- case 'C':
- result = char.class;
- break;
- case 'B':
- result = byte.class;
- break;
- case 'S':
- result = short.class;
- break;
- case 'I':
- result = int.class;
- break;
- case 'J':
- result = long.class;
- break;
- case 'F':
- result = float.class;
- break;
- case 'D':
- result = double.class;
- break;
- }
- } else {
- // class
- name = name.substring(1, name.length() - 1);
- result = Class.forName(name);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- /**
- * Reduces dimension of array.
- *
- * @param forClass array class
- * @return reduced array
- */
- private static Class<?> reduceArrayDimension(Class<?> forClass) {
- String name = forClass.getName();
- try {
- String reduced = name.substring(1, name.length());
- if (reduced.startsWith("[")) {
- // reduced class is still an array
- return Class.forName(reduced);
- } else {
- // reduced class may be primitive or class
- return createClassFromString(reduced);
- }
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * Return given array without first element
- *
- * @param array
- * @return
- */
- private static int[] removeFirstElement(int[] array) {
- int[] result = new int[array.length - 1];
- System.arraycopy(array, 1, result, 0, result.length);
- return result;
- }
-
- /**
- * Converts objects annotations to structure which will be used by this
- * class
- *
- * @param notes
- * @return
- */
- private static AnnotationAttributes createAnnotationAttributes(Annotation[] notes) {
- AnnotationAttributes attrs = new AnnotationAttributes();
- for (int i = 0; notes != null && i < notes.length; i++) {
- if (notes[i].annotationType().equals(CorbaArray.class)) {
- attrs.setCorbaArray(true);
- attrs.setCorbaArrayLength(((CorbaArray)notes[i]).value());
- }
- }
- return attrs;
- }
-
- /**
- * Creates tree for given type.
- *
- * @param forClass
- * @return type tree
- */
- public static TypeTree createTypeTree(Class<?> forClass, Annotation[] notes) throws RequestConfigurationException {
- TypeTree tree = new TypeTree();
- TypeTreeNode rootNode = null;
- AnnotationAttributes attrs = createAnnotationAttributes(notes);
- rootNode = inspectClassHierarchy(forClass, attrs, tree);
- tree.setRootNode(rootNode);
- return tree;
-
- }
-
- /**
- * Recurrent method which builds type tree.
- *
- * @param forClass
- * @param tree
- * @return
- */
- private static TypeTreeNode inspectClassHierarchy(Class<?> forClass, AnnotationAttributes attributes, TypeTree tree)
- throws RequestConfigurationException {
-
- TypeTreeNode node = null;
- node = createTypeNode(forClass, attributes);
-
- NodeType nodeType = node.getNodeType();
- TypeTreeNode[] children = null;
-
- if (nodeType.equals(NodeType.primitive)) {
- // stop condition for recurrent method
- } else if (nodeType.equals(NodeType.array)) {
- Class<?> reduced = reduceArrayDimension(node.getJavaClass());
- children = new TypeTreeNode[1];
- int[] newLengths = removeFirstElement(attributes.getCorbaArrayLength());
- attributes.setCorbaArrayLength(newLengths);
- children[0] = inspectClassHierarchy(reduced, attributes, tree);
- } else if (nodeType.equals(NodeType.sequence)) {
- // reducing sequence dimension
- Class<?> reduced = reduceArrayDimension(node.getJavaClass());
- children = new TypeTreeNode[1];
- children[0] = inspectClassHierarchy(reduced, attributes, tree);
- // System.arraycopy(src, srcPos, dest, destPos, length)
- } else if (nodeType.equals(NodeType.struct) || nodeType.equals(NodeType.exception)) {
- // inspect types for every structure member
- Field[] fields = node.getJavaClass().getFields();
- children = new TypeTreeNode[fields.length];
- for (int i = 0; i < fields.length; i++) {
- Class<?> field = fields[i].getType();
- AnnotationAttributes fAttrs = createAnnotationAttributes(fields[i].getAnnotations());
- TypeTreeNode child = inspectClassHierarchy(field, fAttrs, tree);
- child.setName(fields[i].getName());
- children[i] = child;
- }
- } else if (nodeType.equals(NodeType.idl_enum)) {
-
- } else if (nodeType.equals(NodeType.union)) {
- // inspect types for every structure member
- Field[] fields = node.getJavaClass().getDeclaredFields();
- children = new TypeTreeNode[fields.length];
- for (int i = 0; i < fields.length; i++) {
- Class<?> field = fields[i].getType();
- AnnotationAttributes fAttrs = createAnnotationAttributes(fields[i].getAnnotations());
- TypeTreeNode child = inspectClassHierarchy(field, fAttrs, tree);
- child.setName(fields[i].getName());
- children[i] = child;
- }
- } else if (nodeType.equals(NodeType.reference)) {
- // TODO: CORBA references
- }
-
- node.setChildren(children);
- return node;
- }
-
- /**
- * Creating and configuring TypeTreeNode for given class.
- *
- * @param forClass class
- * @return node
- * @throws RequestConfigurationException
- */
- private static TypeTreeNode createTypeNode(Class<?> forClass, AnnotationAttributes attributes)
- throws RequestConfigurationException {
- TypeTreeNode node = new TypeTreeNode();
- if (forClass.isArray() && !attributes.isCorbaArray()) {
- node.setNodeType(NodeType.sequence);
- node.setJavaClass(forClass);
- } else if (forClass.isArray() && attributes.isCorbaArray()) {
- node.setNodeType(NodeType.array);
- node.setJavaClass(forClass);
- try {
- // set the actual array size for further use by ArrayTypeHelper
- node.setAttributes(attributes.getCorbaArrayLength()[0]);
- } catch (ArrayIndexOutOfBoundsException e) {
- RequestConfigurationException exc =
- new RequestConfigurationException("Annotated array size doesn't match declared arrays size");
- throw exc;
- }
- } else if (primitives.contains(forClass)) {
- node.setNodeType(NodeType.primitive);
- node.setJavaClass(forClass);
- node.setChildren(null);
- } else if (forClass.isInterface()) {
- node.setNodeType(NodeType.reference);
- node.setJavaClass(forClass);
- node.setChildren(null);
- } else if (isStructType(forClass)) {
- node.setNodeType(NodeType.struct);
- node.setJavaClass(forClass);
- } else if (isEnumType(forClass)) {
- node.setNodeType(NodeType.idl_enum);
- node.setJavaClass(forClass);
- } else if (isUserException(forClass)) {
- node.setNodeType(NodeType.exception);
- node.setJavaClass(forClass);
- } else if (isUnionType(forClass)) {
- node.setNodeType(NodeType.union);
- node.setJavaClass(forClass);
- node.setAttributes(getUnionAttributes(forClass));
- } else {
- RequestConfigurationException e =
- new RequestConfigurationException("User defined type which cannot be handled: " + forClass
- .getCanonicalName());
- throw e;
- }
- return node;
- }
-
- /**
- * Tells whether given class is structure
- *
- * @param forClass
- * @return
- */
- private static boolean isStructType(Class<?> forClass) {
- int classMods = forClass.getModifiers();
- if (!Modifier.isFinal(classMods)) {
- return false;
- }
- boolean areCtorsValid = false;
- Class<?>[] fieldsTypes = null;
- Constructor<?>[] ctors = forClass.getConstructors();
- /*
- * Do we have 2 ctors and one of them is null ctor?
- */
- if (ctors.length != 2) {
- return false;
- }
- for (int i = 0; i < ctors.length; i++) {
- Class<?>[] params = ctors[i].getParameterTypes();
- if (params.length == 0) {
- areCtorsValid = true;
- } else {
- fieldsTypes = params;
- }
- }
- if (!areCtorsValid) {
- return false;
- }
- /*
- * Are constructor args declared as class fields?
- */
- Field[] fields = forClass.getFields();
- Set<Class<?>> fieldsSet = new HashSet<Class<?>>(Arrays.asList(fieldsTypes));
- for (int i = 0; i < fields.length && !fieldsSet.isEmpty(); i++) {
- int mods = fields[i].getModifiers();
- if (Modifier.isPublic(mods) && !Modifier.isStatic(mods) && !Modifier.isFinal(mods)) {
- fieldsSet.remove(fields[i].getType());
- }
-
- }
- return fieldsSet.isEmpty();
- }
-
- /**
- * Tells whether given class is enum
- *
- * @param forClass
- * @return
- */
- private static boolean isEnumType(Class<?> forClass) {
- boolean isValueMethod = false;
- boolean isFromIntMethod = false;
- /*
- * enum type should have value and from_int methods
- */
- try {
- Method valueMet = forClass.getMethod("value", new Class[] {});
- int modValueMet = valueMet.getModifiers();
- if (valueMet.getReturnType().equals(int.class) && Modifier.isPublic(modValueMet)) {
- isValueMethod = true;
- }
- Method fromIntMet = forClass.getMethod("from_int", new Class[] {int.class});
- int modFromIntMet = fromIntMet.getModifiers();
- if ((fromIntMet.getReturnType().equals(forClass) && Modifier.isPublic(modFromIntMet) && Modifier
- .isStatic(modFromIntMet))) {
- isFromIntMethod = true;
- }
- } catch (NoSuchMethodException e) {
- }
- if (!isFromIntMethod || !isValueMethod) {
- return false;
- }
- /*
- * enum type should also contain minimum one pair of fields: EnumType
- * field and int _field
- */
- int enumCount = 0;
- Field[] fields = forClass.getFields();
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].getType().equals(forClass)) {
- int modifiers = fields[i].getModifiers();
- if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers) && Modifier.isFinal(modifiers)) {
- try {
- Field field = forClass.getField("_" + fields[i].getName());
- if (field.getType().equals(int.class)) {
- enumCount++;
- }
- } catch (NoSuchFieldException e) {
- }
-
- }
- }
- }
- return enumCount > 0;
- }
-
- /**
- * Tells whether given class is CORBA user exception
- *
- * @param forClass
- * @return
- */
- private static boolean isUserException(Class<?> forClass) {
- do {
- if (forClass.equals(Exception.class)) {
- return true;
- } else {
- forClass = forClass.getSuperclass();
- }
- } while (forClass != null && !forClass.equals(Object.class));
- return false;
- }
-
- /**
- * Tells whether given class is CORBA union. This method validates usage of
- * unions annotations.
- *
- * @param forClass
- * @return
- * @throws RequestConfigurationException
- */
- private static boolean isUnionType(Class<?> forClass) throws RequestConfigurationException {
- int classMods = forClass.getModifiers();
- if (!Modifier.isFinal(classMods)) {
- return false;
- }
- boolean atLeastOneOption = false;
- boolean discriminatorPresent = false;
- for (int i = 0; i < forClass.getDeclaredFields().length; i++) {
- CorbaUnionElement note = forClass.getDeclaredFields()[i].getAnnotation(CorbaUnionElement.class);
- if (note != null) {
- int fieldMod = forClass.getDeclaredFields()[i].getModifiers();
- if (Modifier.isPrivate(fieldMod) && !Modifier.isFinal(fieldMod) && !Modifier.isStatic(fieldMod)) {
- if (note.type().equals(CorbaUnionElementType.discriminator)) {
- if (discriminatorPresent) {
- throw new RequestConfigurationException(
- "More than one discriminators declared on: " + forClass);
- }
- discriminatorPresent = true;
- } else {
- atLeastOneOption = true;
- }
- } else {
- throw new RequestConfigurationException(
- "Annotated union field should be private, not final and no static on class: " + forClass);
- }
- }
- }
- if (atLeastOneOption && !discriminatorPresent) {
- throw new RequestConfigurationException("No discriminator annotation found on: " + forClass);
- } else if (!atLeastOneOption && discriminatorPresent) {
- throw new RequestConfigurationException("No union option found on: " + forClass);
- } else if (discriminatorPresent && atLeastOneOption) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Gets union attributes - discriminator field name, option fields etc. This
- * method relies that previously scanned class is valid (method isUnionType)
- *
- * @param forClass
- * @return
- * @throws RequestConfigurationException
- */
- private static UnionAttributes getUnionAttributes(Class<?> forClass) throws RequestConfigurationException {
- UnionAttributes attributes = new UnionAttributes();
- for (int i = 0; i < forClass.getDeclaredFields().length; i++) {
- CorbaUnionElement note = forClass.getDeclaredFields()[i].getAnnotation(CorbaUnionElement.class);
- if (note != null) {
- if (note.type().equals(CorbaUnionElementType.discriminator)) {
- attributes.setDiscriminatorName(forClass.getDeclaredFields()[i].getName());
- } else if (note.type().equals(CorbaUnionElementType.defaultOption)) {
- attributes.setDefaultOptionName(forClass.getDeclaredFields()[i].getName());
- } else if (note.type().equals(CorbaUnionElementType.option)) {
- if (attributes.getOptionsMapping().containsKey(note.optionNumber())) {
- throw new RequestConfigurationException("In " + forClass
- + ": field \""
- + forClass.getDeclaredFields()[i].getName()
- + "\" uses already used option id: "
- + note.optionNumber());
- } else {
- attributes.getOptionsMapping().put(note.optionNumber(),
- forClass.getDeclaredFields()[i].getName());
- }
- }
- }
- }
- return attributes;
- }
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeNode.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeNode.java
deleted file mode 100644
index 7d2183fb01..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeNode.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types;
-
-/**
- * @version $Rev$ $Date$
- * Represents single tree node.
- *
- */
-public class TypeTreeNode {
-
- private NodeType nodeType;
- private TypeTreeNode[] children;
- private Class<?> javaClass;
- private String name;
- private Object attributes;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public NodeType getNodeType() {
- return nodeType;
- }
-
- public void setNodeType(NodeType nodeType) {
- this.nodeType = nodeType;
- }
-
- public TypeTreeNode[] getChildren() {
- return children;
- }
-
- public void setChildren(TypeTreeNode[] children) {
- this.children = children;
- }
-
- public Class<?> getJavaClass() {
- return javaClass;
- }
-
- public void setJavaClass(Class<?> javaClass) {
- this.javaClass = javaClass;
- }
-
- public Object getAttributes() {
- return attributes;
- }
-
- public void setAttributes(Object attributes) {
- this.attributes = attributes;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java
deleted file mode 100644
index df6358d118..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- * Stores attributes for previously scanned CORBA union type
- */
-public class UnionAttributes {
-
- public String discriminatorName;
- public String defaultOptionName;
- public Map<Integer, String> optionsMapping = new HashMap<Integer, String>();
-
- public String getDiscriminatorName() {
- return discriminatorName;
- }
-
- public void setDiscriminatorName(String discriminatorName) {
- this.discriminatorName = discriminatorName;
- }
-
- public String getDefaultOptionName() {
- return defaultOptionName;
- }
-
- public void setDefaultOptionName(String defaultOptionName) {
- this.defaultOptionName = defaultOptionName;
- }
-
- public Map<Integer, String> getOptionsMapping() {
- return optionsMapping;
- }
-
- public void setOptionsMapping(Map<Integer, String> optionsMapping) {
- this.optionsMapping = optionsMapping;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ArrayTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ArrayTypeHelper.java
deleted file mode 100644
index 6dbeda3b7c..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ArrayTypeHelper.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Array;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ArrayTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- Object array = null;
- try {
- int size = (Integer)node.getAttributes();
- array = Array.newInstance(node.getChildren()[0].getJavaClass(), size);
- for (int i = 0; i < size; i++) {
- Array.set(array, i, TypeHelpersProxy.read(node.getChildren()[0], is));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return array;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- for (int i = 0; i < (Integer)node.getAttributes(); i++) {
- TypeHelpersProxy.write(node.getChildren()[0], os, Array.get(data, i));
- }
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/BooleanTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/BooleanTypeHelper.java
deleted file mode 100644
index 87d3e93d22..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/BooleanTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BooleanTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_boolean();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_boolean((Boolean)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ByteTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ByteTypeHelper.java
deleted file mode 100644
index eb02f1cbcb..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ByteTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ByteTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_octet();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_octet((Byte)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/CharTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/CharTypeHelper.java
deleted file mode 100644
index 71f8fbfc47..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/CharTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CharTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_char();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_char((Character)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/DoubleTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/DoubleTypeHelper.java
deleted file mode 100644
index c5019c5c0b..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/DoubleTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DoubleTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_double();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_double((Double)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java
deleted file mode 100644
index 30c3ac3a8a..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Method;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EnumTypeHelper implements TypeHelper {
-
- private static final Logger logger = Logger.getLogger(EnumTypeHelper.class.getName());
-
- public Object read(TypeTreeNode node, InputStream is) {
- int value = is.read_long();
- Object result = null;
- try {
- Method method = node.getJavaClass().getMethod("from_int", new Class[] {int.class});
- result = method.invoke(null, new Object[] {value});
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during reading CORBA enum data", e);
- e.printStackTrace();
- }
- return result;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- int value = 0;
- try {
- Method method = data.getClass().getMethod("value", new Class[] {});
- value = (Integer)method.invoke(data, new Object[] {});
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during writing CORBA enum data", e);
- }
- os.write_long(value);
- }
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/FloatTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/FloatTypeHelper.java
deleted file mode 100644
index 3214f8b30d..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/FloatTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class FloatTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_float();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_float((Float)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/IntTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/IntTypeHelper.java
deleted file mode 100644
index b11175064c..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/IntTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class IntTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_long();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_long((Integer)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/LongTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/LongTypeHelper.java
deleted file mode 100644
index 7b4300a1da..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/LongTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class LongTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_longlong();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_longlong((Long)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ReferenceTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ReferenceTypeHelper.java
deleted file mode 100644
index 4e0c2893d2..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ReferenceTypeHelper.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.reference.InterfaceInstanceCreator;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReferenceTypeHelper implements TypeHelper {
-
- public java.lang.Object read(TypeTreeNode node, InputStream is) {
- Object reference = is.read_Object();
- return (java.lang.Object)InterfaceInstanceCreator.createInstance(reference, node.getJavaClass());
- }
-
- public void write(TypeTreeNode node, OutputStream os, java.lang.Object data) {
- os.write_Object((Object)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/SequenceTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/SequenceTypeHelper.java
deleted file mode 100644
index 5862838cd5..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/SequenceTypeHelper.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SequenceTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- Object sequence = null;
- try {
- int size = is.read_long();
- sequence = Array.newInstance(node.getChildren()[0].getJavaClass(), size);
- for (int i = 0; i < size; i++) {
- Array.set(sequence, i, TypeHelpersProxy.read(node.getChildren()[0], is));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return sequence;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- int sum = 0;
- // determine length of array
- List<Object> array = new ArrayList<Object>();
- while (true) {
- try {
- array.add(Array.get(data, sum));
- sum++;
- } catch (ArrayIndexOutOfBoundsException e) {
- break;
- }
- }
- os.write_long(sum);
- Iterator<Object> iter = array.iterator();
- while (iter.hasNext()) {
- Object elem = iter.next();
- TypeHelpersProxy.write(node.getChildren()[0], os, elem);
- }
-
- }
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ShortTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ShortTypeHelper.java
deleted file mode 100644
index 9130db65e4..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ShortTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ShortTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_short();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_short((Short)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StringTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StringTypeHelper.java
deleted file mode 100644
index 4d782efcc5..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StringTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class StringTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_string();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_string((String)data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java
deleted file mode 100644
index 365d62fb73..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Field;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class StructTypeHelper implements TypeHelper {
-
- private static final Logger logger = Logger.getLogger(StructTypeHelper.class.getName());
-
- public Object read(TypeTreeNode node, InputStream is) {
- TypeTreeNode[] children = node.getChildren();
- Object result = null;
- if (children != null) {
- try {
- result = node.getJavaClass().newInstance();
- for (int i = 0; i < children.length; i++) {
- Object childResult = TypeHelpersProxy.read(children[i], is);
- Field childField = result.getClass().getField(children[i].getName());
- childField.set(result, childResult);
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during reading CORBA struct data", e);
- }
- }
- return result;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- TypeTreeNode[] children = node.getChildren();
- if (children != null) {
- try {
- for (int i = 0; i < children.length; i++) {
- Field childField = node.getJavaClass().getField(children[i].getName());
- TypeHelpersProxy.write(children[i], os, childField.get(data));
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during writing CORBA struct data", e);
- }
- }
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelper.java
deleted file mode 100644
index c9d0dd263f..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelper.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface TypeHelper {
-
- /**
- * Reads CORBA object
- * @param node
- * @param is
- * @return
- */
- Object read(TypeTreeNode node, InputStream is);
-
- /**
- * Writes CORBA object
- * @param node
- * @param os
- * @param data
- */
- void write(TypeTreeNode node, OutputStream os, Object data);
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java
deleted file mode 100644
index 72e4ccc6fb..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.NodeType;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- * Proxies getType(), write(), read() methods to appropriate TypeHelper implementation.
- */
-public class TypeHelpersProxy {
-
- /**
- * Maps primitive types to its TypeHelper implementations
- */
- private static Map<Class<?>, TypeHelper> primitiveTypes = null;
-
- /**
- * Maps other types to its TypeHelper implementations
- */
- private static Map<NodeType, TypeHelper> complexTypes = null;
-
- static {
- // initiate type helpers
- primitiveTypes = new HashMap<Class<?>, TypeHelper>();
- complexTypes = new HashMap<NodeType, TypeHelper>();
-
- primitiveTypes.put(boolean.class, new BooleanTypeHelper());
- primitiveTypes.put(char.class, new CharTypeHelper());
- primitiveTypes.put(byte.class, new ByteTypeHelper());
- primitiveTypes.put(short.class, new ShortTypeHelper());
- primitiveTypes.put(int.class, new IntTypeHelper());
- primitiveTypes.put(long.class, new LongTypeHelper());
- primitiveTypes.put(float.class, new FloatTypeHelper());
- primitiveTypes.put(double.class, new DoubleTypeHelper());
- primitiveTypes.put(String.class, new StringTypeHelper());
- primitiveTypes.put(Boolean.class, primitiveTypes.get(boolean.class));
- primitiveTypes.put(Character.class, primitiveTypes.get(char.class));
- primitiveTypes.put(Byte.class, primitiveTypes.get(byte.class));
- primitiveTypes.put(Short.class, primitiveTypes.get(short.class));
- primitiveTypes.put(Integer.class, primitiveTypes.get(int.class));
- primitiveTypes.put(Long.class, primitiveTypes.get(long.class));
- primitiveTypes.put(Float.class, primitiveTypes.get(float.class));
- primitiveTypes.put(Double.class, primitiveTypes.get(double.class));
- primitiveTypes.put(String.class, primitiveTypes.get(String.class));
- complexTypes.put(NodeType.array, new ArrayTypeHelper());
- complexTypes.put(NodeType.struct, new StructTypeHelper());
- complexTypes.put(NodeType.reference, new ReferenceTypeHelper());
- complexTypes.put(NodeType.sequence, new SequenceTypeHelper());
- complexTypes.put(NodeType.idl_enum, new EnumTypeHelper());
- complexTypes.put(NodeType.exception, new StructTypeHelper());
- complexTypes.put(NodeType.union, new UnionTypeHelper());
- }
-
- /**
- * Gets type helper basing on given type
- *
- * @param node
- * @return
- */
- private static TypeHelper getTypeHelper(TypeTreeNode node) {
- TypeHelper typeHelper = null;
- NodeType type = node.getNodeType();
- if (type.equals(NodeType.primitive)) {
- typeHelper = primitiveTypes.get(node.getJavaClass());
- } else {
- typeHelper = complexTypes.get(type);
- }
- return typeHelper;
- }
-
- /**
- * Proxies read method invocation to appropriate TypeHelper implementation.
- *
- * @param node
- * @param is
- * @return
- */
- public static final Object read(TypeTreeNode node, InputStream is) {
- TypeHelper helper = getTypeHelper(node);
- return helper.read(node, is);
- }
-
- /**
- * Proxies write method invocation to appropriate TypeHelper implementation.
- *
- * @param node
- * @param os
- * @param data
- */
- public static final void write(TypeTreeNode node, OutputStream os, Object data) {
- TypeHelper helper = getTypeHelper(node);
- helper.write(node, os, data);
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java
deleted file mode 100644
index 66c928acec..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Field;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.apache.tuscany.sca.binding.corba.impl.types.UnionAttributes;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class UnionTypeHelper implements TypeHelper {
-
- private static final Logger logger = Logger.getLogger(UnionTypeHelper.class.getName());
-
- public Object read(TypeTreeNode node, InputStream is) {
- Object result = null;
- try {
- int discriminator = is.read_long();
- UnionAttributes attrs = (UnionAttributes)node.getAttributes();
- String childName = attrs.getOptionsMapping().get(discriminator);
- if (childName == null) {
- // get default if option numbers field not found
- childName = attrs.getDefaultOptionName();
- }
- result = node.getJavaClass().newInstance();
- Field discField = result.getClass().getDeclaredField(attrs.getDiscriminatorName());
- discField.setAccessible(true);
- discField.set(result, discriminator);
- for (int i = 0; i < node.getChildren().length; i++) {
- if (node.getChildren()[i].getName().equals(childName)) {
- Object unionValue = TypeHelpersProxy.read(node.getChildren()[i], is);
- Field childField = result.getClass().getDeclaredField(childName);
- childField.setAccessible(true);
- childField.set(result, unionValue);
- break;
- }
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during reading CORBA union data", e);
- }
- return result;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- try {
- UnionAttributes attrs = (UnionAttributes)node.getAttributes();
- Field discriminatorField = data.getClass().getDeclaredField(attrs.getDiscriminatorName());
- discriminatorField.setAccessible(true);
- int discriminator = discriminatorField.getInt(data);
- os.write_long(discriminator);
- String childName = attrs.getOptionsMapping().get(discriminator);
- if (childName == null) {
- // get default if option numbers field not found
- childName = attrs.getDefaultOptionName();
- }
- for (int i = 0; i < node.getChildren().length; i++) {
- if (node.getChildren()[i].getName().equals(childName)) {
- Field childField = data.getClass().getDeclaredField(childName);
- childField.setAccessible(true);
- TypeHelpersProxy.write(node.getChildren()[i], os, childField.get(data));
- break;
- }
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during writing CORBA union data", e);
- }
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java
deleted file mode 100644
index 68f71b7169..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.types.util;
-
-/**
- * @version $Rev$ $Date$
- * Class for type utilities
- */
-public class Utils {
-
- /**
- * Creates CORBA id for Java class
- * @param forClass
- * @return
- */
- public static String getTypeId(Class<?> forClass) {
- String result = forClass.getName().replace('.', '/');
- result = result.replaceAll("Package", "");
- result = "IDL:" + result + ":1.0";
- return result;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java
deleted file mode 100644
index 912d355641..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.util;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- * Utility for finding method in given class.
- */
-public class MethodFinder {
-
- private static Map<Class<?>, Class<?>> boxingMapping;
-
- static {
- boxingMapping = new HashMap<Class<?>, Class<?>>();
- boxingMapping.put(boolean.class, Boolean.class);
- boxingMapping.put(byte.class, Byte.class);
- boxingMapping.put(short.class, Short.class);
- boxingMapping.put(char.class, Character.class);
- boxingMapping.put(int.class, Integer.class);
- boxingMapping.put(long.class, Long.class);
- boxingMapping.put(float.class, Float.class);
- boxingMapping.put(double.class, Double.class);
- }
-
- /**
- * Converts primitive class to its object equivalent.
- *
- * @param parameter class to convert
- * @return object equivalent for primitive type. If parameter wasn't
- * primitive then returns parameter.
- */
- private static Class<?> normalizePrimitive(Class<?> parameter) {
- Class<?> result = boxingMapping.get(parameter);
- if (result != null) {
- return result;
- } else {
- // not a primitive - no need to normalize
- return parameter;
- }
- }
-
- /**
- * Finds appropriate method. This method ignores difference between
- * primitive types and theirs object equivalents. Ie. if we want to find
- * method "get" in java.util.List with only one parameter, which type is
- * Integer then we'll obtain method get(int).
- *
- * @param forClass class which possibly contains desired method
- * @param methodName desired methods name
- * @param parameterTypes desired methods parameter types
- * @return desired method, if no method was found then null will be returned
- */
- public static Method findMethod(Class<?> forClass, String methodName, Class<?>[] parameterTypes) {
- Method[] methods = forClass.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(methodName)) {
- Class<?>[] methodPTypes = methods[i].getParameterTypes();
- if (methodPTypes.length == parameterTypes.length) {
- boolean parameterMatch = true;
- for (int j = 0; j < methodPTypes.length; j++) {
- Class<?> nMethodPType = normalizePrimitive(methodPTypes[j]);
- Class<?> nParameterType = normalizePrimitive(parameterTypes[j]);
- if (!nMethodPType.equals(nParameterType)) {
- parameterMatch = false;
- break;
- }
- }
- if (parameterMatch) {
- return methods[i];
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java
deleted file mode 100644
index a9fabcb82a..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * 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.sca.binding.corba.impl.util;
-
-import java.lang.reflect.Method;
-import java.rmi.RemoteException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.omg.CORBA.portable.IDLEntity;
-
-/**
- * @version $Rev$ $Date$
- */
-public final class OperationMapper {
-
- private static Set<Class<?>> getAllInterfaces(Class<?> intfClass) {
- Set<Class<?>> allInterfaces = new LinkedHashSet<Class<?>>();
-
- LinkedList<Class<?>> stack = new LinkedList<Class<?>>();
- stack.addFirst(intfClass);
-
- while (!stack.isEmpty()) {
- Class<?> intf = stack.removeFirst();
- allInterfaces.add(intf);
- for (Class<?> i : intf.getInterfaces()) {
- stack.add(0, i);
- }
- }
-
- return allInterfaces;
- }
-
- /**
- * Maps Java methods to operation names
- * @param intfClass
- * @return
- */
- @SuppressWarnings("unchecked")
- public static Map<Method, String> mapMethodToOperationName(Class<?> intfClass) {
- return iiopMap(intfClass, false);
- }
-
- /**
- * Maps operation names to Java methods
- * @param intfClass
- * @return
- */
- @SuppressWarnings("unchecked")
- public static Map<String, Method> mapOperationNameToMethod(Class<?> intfClass) {
- return iiopMap(intfClass, true);
- }
-
- @SuppressWarnings("unchecked")
- private static Map iiopMap(Class<?> intfClass, boolean operationToMethod) {
- Method[] methods = getAllMethods(intfClass);
-
- // find every valid getter
- Map<Method, String> getterByMethod = new HashMap<Method, String>(methods.length);
- Map<String, Method> getterByName = new HashMap<String, Method>(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- String methodName = method.getName();
-
- // no arguments allowed
- if (method.getParameterTypes().length != 0) {
- continue;
- }
-
- // must start with get or is
- String verb;
- if (methodName.startsWith("get") && methodName.length() > 3 && method.getReturnType() != void.class) {
- verb = "get";
- } else if (methodName.startsWith("is") && methodName.length() > 2 && method.getReturnType() == boolean.class) {
- verb = "is";
- } else {
- continue;
- }
-
- // must only throw Remote or Runtime Exceptions
- boolean exceptionsValid = true;
- Class[] exceptionTypes = method.getExceptionTypes();
- for (int j = 0; j < exceptionTypes.length; j++) {
- Class<?> exceptionType = exceptionTypes[j];
- if (!RemoteException.class.isAssignableFrom(exceptionType) &&
- !RuntimeException.class.isAssignableFrom(exceptionType) &&
- !Error.class.isAssignableFrom(exceptionType)) {
- exceptionsValid = false;
- break;
- }
- }
- if (!exceptionsValid) {
- continue;
- }
-
- String propertyName;
- if (methodName.length() > verb.length() + 1 && Character.isUpperCase(methodName.charAt(verb.length() + 1))) {
- propertyName = methodName.substring(verb.length());
- } else {
- propertyName = Character.toLowerCase(methodName.charAt(verb.length())) + methodName.substring(verb.length() + 1);
- }
- getterByMethod.put(method, propertyName);
- getterByName.put(propertyName, method);
- }
-
- Map<Method, String> setterByMethod = new HashMap<Method, String>(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- String methodName = method.getName();
-
- // must have exactally one arg
- if (method.getParameterTypes().length != 1) {
- continue;
- }
-
- // must return non void
- if (method.getReturnType() != void.class) {
- continue;
- }
-
- // must start with set
- if (!methodName.startsWith("set") || methodName.length() <= 3) {
- continue;
- }
-
- // must only throw Remote or Runtime Exceptions
- boolean exceptionsValid = true;
- Class<?>[] exceptionTypes = method.getExceptionTypes();
- for (int j = 0; j < exceptionTypes.length; j++) {
- Class<?> exceptionType = exceptionTypes[j];
- if (!RemoteException.class.isAssignableFrom(exceptionType) &&
- !RuntimeException.class.isAssignableFrom(exceptionType) &&
- !Error.class.isAssignableFrom(exceptionType)) {
- exceptionsValid = false;
- break;
- }
- }
- if (!exceptionsValid) {
- continue;
- }
-
- String propertyName;
- if (methodName.length() > 4 && Character.isUpperCase(methodName.charAt(4))) {
- propertyName = methodName.substring(3);
- } else {
- propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
- }
-
- // must have a matching getter
- Method getter = (Method) getterByName.get(propertyName);
- if (getter == null) {
- continue;
- }
-
- // setter property must match getter return value
- if (!method.getParameterTypes()[0].equals(getter.getReturnType())) {
- continue;
- }
- setterByMethod.put(method, propertyName);
- }
-
- // index the methods by name... used to determine which methods are overloaded
- HashMap<String, List<Method>> overloadedMethods = new HashMap<String, List<Method>>(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
- continue;
- }
- String methodName = method.getName();
- List<Method> methodList = overloadedMethods.get(methodName);
- if (methodList == null) {
- methodList = new LinkedList<Method>();
- overloadedMethods.put(methodName, methodList);
- }
- methodList.add(method);
- }
-
- // index the methods by lower case name... used to determine which methods differ only by case
- Map<String, Set<String>> caseCollisionMethods = new HashMap<String, Set<String>>(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
- continue;
- }
- String lowerCaseMethodName = method.getName().toLowerCase();
- Set<String> methodSet = caseCollisionMethods.get(lowerCaseMethodName);
- if (methodSet == null) {
- methodSet = new HashSet<String>();
- caseCollisionMethods.put(lowerCaseMethodName, methodSet);
- }
- methodSet.add(method.getName());
- }
-
- String className = getClassName(intfClass);
- Map iiopMap = new HashMap(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
-
- String iiopName = (String) getterByMethod.get(method);
- if (iiopName != null) {
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J_get_" + iiopName.substring(1);
- } else {
- iiopName = "_get_" + iiopName;
- }
- } else {
- iiopName = (String) setterByMethod.get(method);
- if (iiopName != null) {
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J_set_" + iiopName.substring(1);
- } else {
- iiopName = "_set_" + iiopName;
- }
- } else {
- iiopName = method.getName();
-
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J" + iiopName;
- }
- }
- }
-
- // if this name only differs by case add the case index to the end
- Set<String> caseCollisions = caseCollisionMethods.get(method.getName().toLowerCase());
- if (caseCollisions != null && caseCollisions.size() > 1) {
- iiopName += upperCaseIndexString(iiopName);
- }
-
- // if this is an overloaded method append the parameter string
- List<Method> overloads = overloadedMethods.get(method.getName());
- if (overloads != null && overloads.size() > 1) {
- iiopName += buildOverloadParameterString(method.getParameterTypes());
- }
-
- // if we have a leading underscore prepend with J
- iiopName = replace(iiopName, '$', "U0024");
-
- // if we have matched a keyword prepend with an underscore
- if (keywords.contains(iiopName.toLowerCase())) {
- iiopName = "_" + iiopName;
- }
-
- // if the name is the same as the class name, append an underscore
- if (iiopName.equalsIgnoreCase(className)) {
- iiopName += "_";
- }
-
- if (operationToMethod) {
- iiopMap.put(iiopName, method);
- } else {
- iiopMap.put(method, iiopName);
- }
- }
-
- return iiopMap;
- }
-
- private static Method[] getAllMethods(Class<?> intfClass) {
- List<Method> methods = new LinkedList<Method>();
- for (Iterator<Class<?>> iterator = getAllInterfaces(intfClass).iterator(); iterator.hasNext();) {
- Class<?> intf = iterator.next();
- methods.addAll(Arrays.asList(intf.getDeclaredMethods()));
- }
-
- return (Method[]) methods.toArray(new Method[methods.size()]);
- }
-
- /**
- * Return the a string containing an underscore '_' index of each uppercase
- * character in the IIOP name. This is used for distinction of names that
- * only differ by case, since CORBA does not support case sensitive names.
- */
- private static String upperCaseIndexString(String iiopName) {
- StringBuffer stringBuffer = new StringBuffer();
- for (int i = 0; i < iiopName.length(); i++) {
- char c = iiopName.charAt(i);
- if (Character.isUpperCase(c)) {
- stringBuffer.append('_').append(i);
- }
- }
- return stringBuffer.toString();
- }
-
- /**
- * Replaces any occurances of the specified "oldChar" with the new string.
- * This is used to replace occurances if '$' in CORBA names since '$' is a
- * special character
- */
- private static String replace(String source, char oldChar, String newString) {
- StringBuffer stringBuffer = new StringBuffer(source.length());
- for (int i = 0; i < source.length(); i++) {
- char c = source.charAt(i);
- if (c == oldChar) {
- stringBuffer.append(newString);
- } else {
- stringBuffer.append(c);
- }
- }
- return stringBuffer.toString();
- }
-
- /**
- * Return the a string containing a double underscore '__' list of parameter
- * types encoded using the Java to IDL rules. This is used for distinction
- * of methods that only differ by parameter lists.
- */
- private static String buildOverloadParameterString(Class<?>[] parameterTypes) {
- String name = "";
- if (parameterTypes.length == 0) {
- name += "__";
- } else {
- for (int i = 0; i < parameterTypes.length; i++) {
- Class<?> parameterType = parameterTypes[i];
- name += buildOverloadParameterString(parameterType);
- }
- }
- return name.replace('.', '_');
- }
-
- /**
- * Returns a single parameter type encoded using the Java to IDL rules.
- */
- private static String buildOverloadParameterString(Class<?> parameterType) {
- String name = "_";
-
- int arrayDimensions = 0;
- while (parameterType.isArray()) {
- arrayDimensions++;
- parameterType = parameterType.getComponentType();
- }
-
- // arrays start with org_omg_boxedRMI_
- if (arrayDimensions > 0) {
- name += "_org_omg_boxedRMI";
- }
-
- // IDLEntity types must be prefixed with org_omg_boxedIDL_
- if (IDLEntity.class.isAssignableFrom(parameterType)) {
- name += "_org_omg_boxedIDL";
- }
-
- // add package... some types have special mappings in corba
- String packageName = (String)specialTypePackages.get(parameterType.getName());
- if (packageName == null) {
- packageName = getPackageName(parameterType.getName());
- }
- if (packageName.length() > 0) {
- name += "_" + packageName;
- }
-
- // arrays now contain a dimension indicator
- if (arrayDimensions > 0) {
- name += "_" + "seq" + arrayDimensions;
- }
-
- // add the class name
- String className = (String)specialTypeNames.get(parameterType.getName());
- if (className == null) {
- className = buildClassName(parameterType);
- }
- name += "_" + className;
-
- return name;
- }
-
- /**
- * Returns a string containing an encoded class name.
- */
- private static String buildClassName(Class<?> type) {
- if (type.isArray()) {
- throw new IllegalArgumentException("type is an array: " + type);
- }
-
- // get the classname
- String typeName = type.getName();
- int endIndex = typeName.lastIndexOf('.');
- if (endIndex < 0) {
- return typeName;
- }
- StringBuffer className = new StringBuffer(typeName.substring(endIndex + 1));
-
- // for innerclasses replace the $ separator with two underscores
- // we can't just blindly replace all $ characters since class names can
- // contain the $ character
- if (type.getDeclaringClass() != null) {
- String declaringClassName = getClassName(type.getDeclaringClass());
- assert className.toString().startsWith(declaringClassName + "$");
- className.replace(declaringClassName.length(), declaringClassName.length() + 1, "__");
- }
-
- // if we have a leading underscore prepend with J
- if (className.charAt(0) == '_') {
- className.insert(0, "J");
- }
- return className.toString();
- }
-
- private static String getClassName(Class<?> type) {
- if (type.isArray()) {
- throw new IllegalArgumentException("type is an array: " + type);
- }
-
- // get the classname
- String typeName = type.getName();
- int endIndex = typeName.lastIndexOf('.');
- if (endIndex < 0) {
- return typeName;
- }
- return typeName.substring(endIndex + 1);
- }
-
- private static String getPackageName(String interfaceName) {
- int endIndex = interfaceName.lastIndexOf('.');
- if (endIndex < 0) {
- return "";
- }
- return interfaceName.substring(0, endIndex);
- }
-
- private static final Map<String, String> specialTypeNames;
- private static final Map<String, String> specialTypePackages;
- private static final Set<String> keywords;
-
- static {
- specialTypeNames = new HashMap<String, String>();
- specialTypeNames.put("boolean", "boolean");
- specialTypeNames.put("char", "wchar");
- specialTypeNames.put("byte", "octet");
- specialTypeNames.put("short", "short");
- specialTypeNames.put("int", "long");
- specialTypeNames.put("long", "long_long");
- specialTypeNames.put("float", "float");
- specialTypeNames.put("double", "double");
- specialTypeNames.put("java.lang.Class", "ClassDesc");
- specialTypeNames.put("java.lang.String", "WStringValue");
- specialTypeNames.put("org.omg.CORBA.Object", "Object");
-
- specialTypePackages = new HashMap<String, String>();
- specialTypePackages.put("boolean", "");
- specialTypePackages.put("char", "");
- specialTypePackages.put("byte", "");
- specialTypePackages.put("short", "");
- specialTypePackages.put("int", "");
- specialTypePackages.put("long", "");
- specialTypePackages.put("float", "");
- specialTypePackages.put("double", "");
- specialTypePackages.put("java.lang.Class", "javax.rmi.CORBA");
- specialTypePackages.put("java.lang.String", "CORBA");
- specialTypePackages.put("org.omg.CORBA.Object", "");
-
- keywords = new HashSet<String>();
- keywords.add("abstract");
- keywords.add("any");
- keywords.add("attribute");
- keywords.add("boolean");
- keywords.add("case");
- keywords.add("char");
- keywords.add("const");
- keywords.add("context");
- keywords.add("custom");
- keywords.add("default");
- keywords.add("double");
- keywords.add("enum");
- keywords.add("exception");
- keywords.add("factory");
- keywords.add("false");
- keywords.add("fixed");
- keywords.add("float");
- keywords.add("in");
- keywords.add("inout");
- keywords.add("interface");
- keywords.add("long");
- keywords.add("module");
- keywords.add("native");
- keywords.add("object");
- keywords.add("octet");
- keywords.add("oneway");
- keywords.add("out");
- keywords.add("private");
- keywords.add("public");
- keywords.add("raises");
- keywords.add("readonly");
- keywords.add("sequence");
- keywords.add("short");
- keywords.add("string");
- keywords.add("struct");
- keywords.add("supports");
- keywords.add("switch");
- keywords.add("true");
- keywords.add("truncatable");
- keywords.add("typedef");
- keywords.add("union");
- keywords.add("unsigned");
- keywords.add("valuebase");
- keywords.add("valuetype");
- keywords.add("void");
- keywords.add("wchar");
- keywords.add("wstring");
- }
-
- @SuppressWarnings("unchecked")
- public static Map<Operation, Method> mapOperationToMethod(List<Operation> operations, Class<?> forClass) {
- return (Map<Operation, Method>)createMethod2OperationMapping(operations, forClass, false);
- }
-
- @SuppressWarnings("unchecked")
- public static Map<Method, Operation> mapMethodToOperation(List<Operation> operations, Class<?> forClass) {
- return (Map<Method, Operation>)createMethod2OperationMapping(operations, forClass, true);
- }
-
- /**
- * Maps Java methods to Tuscany operations
- */
- @SuppressWarnings("unchecked")
- private static Map createMethod2OperationMapping(List<Operation> operations, Class<?> forClass, boolean method2operation) {
- // for every operation find all methods with the same name, then
- // compare operations and methods parameters
- Map mapping = new HashMap();
- for (Operation operation : operations) {
- List<DataType> inputTypes = operation.getInputType().getLogical();
- Method[] methods = forClass.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(operation.getName()) && inputTypes.size() == methods[i]
- .getParameterTypes().length) {
- Class<?>[] parameterTypes = methods[i].getParameterTypes();
- int j = 0;
- boolean parameterMatch = true;
- for (DataType dataType : inputTypes) {
- if (!dataType.getPhysical().equals(parameterTypes[j])) {
- parameterMatch = false;
- break;
- }
- j++;
- }
- if (parameterMatch) {
- // match found
- if (method2operation) {
- mapping.put(methods[i], operation);
- } else {
- mapping.put(operation, methods[i]);
- }
- break;
- }
- }
- }
- }
- return mapping;
- }
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaArray.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaArray.java
deleted file mode 100644
index 24661323be..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaArray.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.sca.binding.corba.meta;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * @version $Rev$ $Date$
- * Declares CORBA arrays lengths
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface CorbaArray {
-
- int[] value();
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java
deleted file mode 100644
index 101bda1ba2..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.sca.binding.corba.meta;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * @version $Rev$ $Date$ Declares CORBA union object
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface CorbaUnionElement {
-
- // number of option in switch clause
- int optionNumber() default -1;
-
- // type of element
- CorbaUnionElementType type();
-
-}
diff --git a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java b/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java
deleted file mode 100644
index 3a46fc2b5f..0000000000
--- a/sandbox/event/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.sca.binding.corba.meta;
-
-/**
- * @version $Rev$ $Date$
- * Types for union element
- */
-public enum CorbaUnionElementType {
- discriminator, defaultOption, option;
-} \ No newline at end of file