diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-20 15:07:53 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-20 15:07:53 +0000 |
commit | b272cfd554a84b0537fe0de5dbfde41f8da3f688 (patch) | |
tree | fa6351e48c704693e605fcfc9e57bed57a9f5099 /java/sca/modules/core-spi | |
parent | fce6ad4c30b15b4284a94e7a00e084bf18748cf2 (diff) |
Remove the old Endpoint support. It has been replaced by Endpoint2/EndpointReference2. The old EndpointReference is still waiting to be removed.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@756512 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/core-spi')
5 files changed, 1 insertions, 355 deletions
diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java deleted file mode 100644 index b2d0639a16..0000000000 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java +++ /dev/null @@ -1,180 +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.endpointresolver; - -import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Endpoint; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.extensibility.ServiceDeclaration; -import org.apache.tuscany.sca.extensibility.ServiceDiscovery; - -/** - * Default implementation of a provider factory extension point. - * - * @version $Rev$ $Date$ - */ -public class DefaultEndpointResolverFactoryExtensionPoint implements EndpointResolverFactoryExtensionPoint { - - private ExtensionPointRegistry registry; - private final Map<Class<?>, EndpointResolverFactory> endpointResolverFactories = new HashMap<Class<?>, EndpointResolverFactory>(); - private boolean loaded; - - /** - * The default constructor. Does nothing. - * - */ - public DefaultEndpointResolverFactoryExtensionPoint(ExtensionPointRegistry registry) { - this.registry = registry; - } - - /** - * Add an endpoint resolver factory. - * - * @param endpointResolverFactory The resolver factory - */ - public void addEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory){ - endpointResolverFactories.put(endpointResolverFactory.getModelType(), endpointResolverFactory); - } - - /** - * Remove a endpoint resolver factory. - * - * @param endpointResolverFactory The endpoint resolver factory - */ - public void removeEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory){ - endpointResolverFactories.remove(endpointResolverFactory.getModelType()); - } - - /** - * Returns the provider factory associated with the given model type. - * @param modelType A model type - * @return The provider factory associated with the given model type - */ - public EndpointResolverFactory getEndpointResolverFactory(Class<?> modelType) { - loadProviderFactories(); - - Class<?>[] classes = modelType.getInterfaces(); - for (Class<?> c : classes) { - EndpointResolverFactory factory = endpointResolverFactories.get(c); - if (factory != null) { - return factory; - } - } - return endpointResolverFactories.get(modelType); - } - - - /** - * Load provider factories declared under META-INF/services. - * @param registry - */ - private synchronized void loadProviderFactories() { - if (loaded) - return; - - // Get the provider factory service declarations - Set<ServiceDeclaration> factoryDeclarations; - ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance(); - try { - factoryDeclarations = serviceDiscovery.getServiceDeclarations(EndpointResolverFactory.class.getName()); - } catch (Exception e) { - throw new IllegalStateException(e); - } - - // Get the extension point - EndpointResolverFactoryExtensionPoint factoryExtensionPoint = - registry.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class); - List<EndpointResolverFactory> factories = new ArrayList<EndpointResolverFactory>(); - - for (ServiceDeclaration factoryDeclaration : factoryDeclarations) { - Map<String, String> attributes = factoryDeclaration.getAttributes(); - - // Find the model type that identifies this resolver - String modelTypeName = attributes.get("model"); - - // Create a provider factory wrapper and register it - EndpointResolverFactory factory = - new LazyEndpointResolverFactory(registry, modelTypeName, factoryDeclaration); - factoryExtensionPoint.addEndpointResolverFactory(factory); - factories.add(factory); - } - - loaded = true; - } - - /** - * A wrapper around an endpoint provider factory allowing lazy - * loading and initialization of endpoint providers. - */ - private class LazyEndpointResolverFactory implements EndpointResolverFactory { - private ExtensionPointRegistry registry; - private String modelTypeName; - private ServiceDeclaration providerClass; - private EndpointResolverFactory factory; - private Class<?> modelType; - - private LazyEndpointResolverFactory(ExtensionPointRegistry registry, - String modelTypeName, - ServiceDeclaration providerClass) { - this.registry = registry; - this.modelTypeName = modelTypeName; - this.providerClass = providerClass; - } - - @SuppressWarnings("unchecked") - private EndpointResolverFactory getFactory() { - if (factory == null) { - try { - Class<EndpointResolverFactory> factoryClass = (Class<EndpointResolverFactory>)providerClass.loadClass(); - Constructor<EndpointResolverFactory> constructor = - factoryClass.getConstructor(ExtensionPointRegistry.class); - factory = constructor.newInstance(registry); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - return factory; - } - - public EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding) { - return getFactory().createEndpointResolver(endpoint, binding); - } - - public Class<?> getModelType() { - if (modelType == null) { - try { - modelType = providerClass.loadClass(modelTypeName); - } catch (Exception e) { - throw new IllegalStateException(e); - } - } - return modelType; - } - - } - -} diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java deleted file mode 100644 index 79a10f6d84..0000000000 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java +++ /dev/null @@ -1,55 +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.endpointresolver; - - -/** - * A reference binding implementation can options implement this - * interface to tie into the Tuscany SCA runtime - * - * @version $Rev$ $Date$ - */ -public interface EndpointResolver { - - /** - * This method will be invoked when the endpoint is - * activated. It gives the resolver the opportunity - * to do any set up ready for when it is asked to - * resolve the endpoint when a message arrives - */ - void start(); - - /** - * This method will be invoked when the endpoint is - * to be resolved. The resolver will attempt to resolve the - * endpoint against available services. The resolvers extending - * this interface will provide environment or binding specific - * resolution processing - */ - void resolve(); - - /** - * This method will be invoked when the endpont is - * deactivated. It gives the resolver the opportunity - * to take and required resolver shutdown actions - */ - void stop(); - -} diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java deleted file mode 100644 index fdd304a9c7..0000000000 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java +++ /dev/null @@ -1,44 +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.endpointresolver; - -import org.apache.tuscany.sca.assembly.Binding; -import org.apache.tuscany.sca.assembly.Endpoint; - -/** - * A factory for creating the runtime artifacts that resolve endpoints. - * - * @version $Rev$ $Date$ - */ -public interface EndpointResolverFactory <M>{ - - /** - * Creates a new endpoint resolver for the given component, - * reference and binding. - * - * @param component The runtime component - * @param reference The reference on the runtime component - * @param enpoint The endpoint assembly model object - * @return The endpoint provider - */ - EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding); - - Class<M> getModelType(); -} diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java deleted file mode 100644 index 9d5c2e950b..0000000000 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java +++ /dev/null @@ -1,56 +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.endpointresolver; - - - -/** - * An extension point for resolver factories. Holds all of the resolver - * factories from loaded extension points. Allows a resolver factory - * to be located based on a given model type. Hence the runtime can - * generate endpoint resolvers from the in memory assembly model. - * - * @version $Rev$ $Date$ - */ -public interface EndpointResolverFactoryExtensionPoint { - - - /** - * Add an endpoint resolver factory. - * - * @param endpointResolverFactory The resolver factory - */ - void addEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory); - - /** - * Remove a endpoint resolver factory. - * - * @param endpointResolverFactory The endpoint resolver factory - */ - void removeEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory); - - /** - * Returns the endpoint resolver factory associated with the given binding type. - * @param bindingType A binding type - * @return The endpoint resolver factory associated with the given binding type - */ - EndpointResolverFactory getEndpointResolverFactory(Class<?> bindingType); - -} diff --git a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java index 84e2f4588b..a2a6f03b08 100644 --- a/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java +++ b/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java @@ -23,9 +23,7 @@ import java.util.List; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.EndpointReference2; -import org.apache.tuscany.sca.endpointresolver.EndpointResolver; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.invocation.Invoker; import org.apache.tuscany.sca.provider.PolicyProvider; @@ -78,24 +76,7 @@ public interface RuntimeComponentReference extends ComponentReference { * @param bindingProvider The runtime reference binding provider */ void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider); - - /** - * Returns the endpoint resolver associated with this - * component reference and the given endpoint. - * - * @param endpont The assembly model endpoint - * @return The enpoint resolver - */ - EndpointResolver getEndpointResolver(Endpoint endpoint); - - /** - * Sets the endpoint resolver associated with this - * component reference and the given endpoint. - * - * @param binding The assembly model binding - * @param bindingProvider The runtime reference binding provider - */ - void setEndpointResolver(Endpoint endpoint, EndpointResolver endpointResolver); + /** * Add a policy provider for the given binding to the reference |