diff options
Diffstat (limited to 'tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension')
17 files changed, 0 insertions, 1332 deletions
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java deleted file mode 100644 index 57fcffc2b2..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ComponentTargetInvoker.java +++ /dev/null @@ -1,122 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.core.extension;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.core.context.AtomicContext;
-import org.apache.tuscany.core.context.Context;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.context.ScopeContext;
-import org.apache.tuscany.core.context.TargetException;
-import org.apache.tuscany.core.message.Message;
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.TargetInvoker;
-
-/**
- * Responsible for invoking an external service
- * TODO: virtualy identical to ExternalServiceTargetInvoker
- * @version $Rev$ $Date$
- */
-public class ComponentTargetInvoker implements TargetInvoker {
-
- private QualifiedName serviceName;
-
- private String esName;
-
- private Method method;
-
- private ScopeContext container;
-
- private AtomicContext context;
-
- /**
- * Constructs a new ExternalWebServiceTargetInvoker.
- *
- * @param container
- */
- public ComponentTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) {
- assert serviceName != null : "No service name specified";
- assert method != null : "No method specified";
- assert container != null : "No scope container specified";
- this.serviceName = serviceName;
- this.esName = serviceName.getPartName();
- this.method = method;
- this.container = container;
- }
-
- public Object invokeTarget(Object payload) throws InvocationTargetException {
- if (context == null) {
- Context iContext = container.getContext(esName);
- if (!(iContext instanceof AtomicContext)) {
- TargetException te = new TargetException("Unexpected target context type");
- te.setIdentifier(iContext.getClass().getName());
- te.addContextName(iContext.getName());
- throw te;
- }
- context = (AtomicContext) iContext;
- }
-
- ExternalServiceInvoker invoker = (ExternalServiceInvoker) context.getTargetInstance();
- if (payload != null) {
- return doInvoke(invoker, (Object[]) payload);
- } else {
- return doInvoke(invoker, null);
- }
- }
-
- protected Object doInvoke(ExternalServiceInvoker invoker, Object[] args) {
- return invoker.invoke(method.getName(), args);
- }
-
- public boolean isCacheable() {
- return false;
- }
-
- public Message invoke(Message msg) {
- try {
- Object resp = invokeTarget(msg.getBody());
- msg.setBody(resp);
- } catch (InvocationTargetException e) {
- msg.setBody(e.getCause());
- } catch (Throwable e) {
- msg.setBody(e);
- }
- return msg;
- }
-
- public void setNext(Interceptor next) {
- throw new UnsupportedOperationException();
- }
-
- public Object clone() throws CloneNotSupportedException {
- try {
- ComponentTargetInvoker invoker = (ComponentTargetInvoker) super.clone();
- invoker.container = container;
- invoker.context = this.context;
- invoker.esName = this.esName;
- invoker.method = this.method;
- invoker.serviceName = this.serviceName;
- return invoker;
- } catch (CloneNotSupportedException e) {
- // will not happen
- return null;
- }
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java deleted file mode 100644 index 81770d49b8..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ContextFactoryBuilderSupport.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Component; -import org.apache.tuscany.model.assembly.ConfiguredProperty; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.Implementation; -import org.apache.tuscany.model.assembly.Multiplicity; -import org.apache.tuscany.model.assembly.Scope; -import org.apache.tuscany.model.assembly.Service; -import org.osoa.sca.annotations.Init; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.List; - -/** - * A runtime extension point for component types. Subclasses must be genericized according to the model implementation type they - * handle, i.e. a subclass of {@link Implementation}, and implement {@link #createContextFactory}. - * - * @version $Rev: 368822 $ $Date: 2006-01-13 10:54:38 -0800 (Fri, 13 Jan 2006) $ - * @see org.apache.tuscany.core.builder.ContextFactory - */ -@org.osoa.sca.annotations.Scope("MODULE") -public abstract class ContextFactoryBuilderSupport<T extends Implementation> implements ContextFactoryBuilder { - - protected ContextFactoryBuilderRegistry builderRegistry; - - protected WireFactoryService wireFactoryService; - - protected Class implementationClass; - - /** - * Default constructor - */ - public ContextFactoryBuilderSupport() { - // reflect the generic type of the subclass - Type type = this.getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - implementationClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } else { - throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); - } - } - - /** - * Constructs a new instance - * - * @param wireFactoryService the system service responsible for creating wire factories - */ - public ContextFactoryBuilderSupport(WireFactoryService wireFactoryService) { - this(); - this.wireFactoryService = wireFactoryService; - } - - @Init(eager = true) - public void init() { - builderRegistry.register(this); - } - - @Autowire - public void setBuilderRegistry(ContextFactoryBuilderRegistry builderRegistry) { - this.builderRegistry = builderRegistry; - } - - /** - * Sets the system service used to construct wire factories - */ - @Autowire - public void setWireFactoryService(WireFactoryService wireFactoryService) { - this.wireFactoryService = wireFactoryService; - } - - public void build(AssemblyObject modelObject) throws BuilderException { - if (!(modelObject instanceof Component)) { - return; - } - Component nonGenricComponent = (Component) modelObject; - if (!implementationClass.isAssignableFrom(nonGenricComponent.getImplementation().getClass())) { - return; - } - Component<T> component = (Component<T>) modelObject; - List<Service> services = component.getImplementation().getComponentType().getServices(); - Scope previous = null; - Scope scope = Scope.INSTANCE; - for (Service service : services) { - // calculate and validate the scope of the component; ensure that all service scopes are the same unless stateless - Scope current = service.getServiceContract().getScope(); - if (previous != null && current != null && current != previous - && (current != Scope.INSTANCE && previous != Scope.INSTANCE)) { - BuilderException e = new BuilderConfigException("Incompatible scopes specified for services on component"); - e.setIdentifier(component.getName()); - throw e; - } - if (scope != null && current != Scope.INSTANCE) { - scope = current; - } - } - ContextFactory contextFactory; - try { - contextFactory = createContextFactory(component.getName(), component.getImplementation(), scope); - // create target-side wire invocation chains for each service offered by the implementation - for (ConfiguredService configuredService : component.getConfiguredServices()) { - Service service = configuredService.getPort(); - TargetWireFactory wireFactory = wireFactoryService.createTargetFactory(configuredService); - contextFactory.addTargetWireFactory(service.getName(), wireFactory); - } - // handle properties - List<ConfiguredProperty> configuredProperties = component.getConfiguredProperties(); - if (configuredProperties != null) { - for (ConfiguredProperty property : configuredProperties) { - contextFactory.addProperty(property.getName(), property.getValue()); - } - } - // handle references and source side reference chains - List<ConfiguredReference> configuredReferences = component.getConfiguredReferences(); - if (configuredReferences != null) { - for (ConfiguredReference reference : configuredReferences) { - if (reference.getPort().getMultiplicity() == Multiplicity.ZERO_N || reference.getPort().getMultiplicity() == Multiplicity.ZERO_ONE){ - if (reference.getTargetConfiguredServices().size() < 1 && reference.getTargets().size() <1 ){ - continue; // not required, not configured fix TUSCANY-299 - } - } - List<SourceWireFactory> wireFactories = wireFactoryService.createSourceFactory(reference); - String refName = reference.getPort().getName(); - Class refClass = reference.getPort().getServiceContract().getInterface(); - boolean multiplicity = reference.getPort().getMultiplicity() == Multiplicity.ONE_N - || reference.getPort().getMultiplicity() == Multiplicity.ZERO_N; - contextFactory.addSourceWireFactories(refName, refClass, wireFactories, multiplicity); - } - } - component.setContextFactory(contextFactory); - } catch (BuilderException e) { - e.addContextName(component.getName()); - throw e; - } - } - - /** - * Subclasses must implement, returning a context factory appropriate to the component implementation - * - * @param componentName the name of the component - * @param implementation the component implementation - * @param scope the component implementation scope - */ - protected abstract ContextFactory createContextFactory(String componentName, T implementation, Scope scope); - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java deleted file mode 100644 index 58d7a626a6..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointBuilderSupport.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.EntryPoint; -import org.apache.tuscany.model.assembly.Service; -import org.osoa.sca.annotations.Init; - -/** - * A base class for a {@link ContextFactoryBuilder} that creates {@link org.apache.tuscany.core.context.EntryPointContext}s - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class EntryPointBuilderSupport<T extends Binding> implements ContextFactoryBuilder { - - protected ContextFactoryBuilderRegistry builderRegistry; - protected WireFactoryService wireService; - protected MessageFactory messageFactory; - protected Class bindingClass; - - public EntryPointBuilderSupport() { - // reflect the generic type of the subclass - Type type = this.getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - bindingClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } else { - throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); - } - } - - @Init(eager = true) - public void init() throws Exception { - builderRegistry.register(this); - } - - @Autowire - public void setBuilderRegistry(ContextFactoryBuilderRegistry registry) { - builderRegistry = registry; - } - - @Autowire - public void setWireService(WireFactoryService wireService) { - this.wireService = wireService; - } - - /** - * Sets the factory used to construct wire messages - * - * @param msgFactory - */ - @Autowire - public void setMessageFactory(MessageFactory msgFactory) { - this.messageFactory = msgFactory; - } - - public void build(AssemblyObject object) throws BuilderException { - if (!(object instanceof EntryPoint)) { - return; - } - EntryPoint entryPoint = (EntryPoint) object; - if (entryPoint.getBindings().size() < 1) { - return; - } - if (!bindingClass.isAssignableFrom(entryPoint.getBindings().get(0).getClass())) { - return; - } - - EntryPointContextFactory contextFactory = createEntryPointContextFactory(entryPoint, messageFactory); - ConfiguredService configuredService = entryPoint.getConfiguredService(); - Service service = configuredService.getPort(); - SourceWireFactory wireFactory = wireService.createSourceFactory(entryPoint.getConfiguredReference()).get(0); - contextFactory.addSourceWireFactory(service.getName(), wireFactory); - entryPoint.setContextFactory(contextFactory); - } - - /** - * Callback to create the specific <code>ContextFactory</code> type associated with the extending - * implementation - * - * @param entryPoint the entry point being processed - * @param msgFactory the message factory to be used by <code>EntryPointContext</code> when flowing - * invocations - */ - protected abstract EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory); - - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java deleted file mode 100644 index bb4d1207d4..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/EntryPointContextFactory.java +++ /dev/null @@ -1,111 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.EntryPointContext; -import org.apache.tuscany.core.context.impl.EntryPointContextImpl; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.message.MessageFactory; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -/** - * Default factory for contexts that represent entry points. - * - * @version $Rev$ $Date$ - */ -public abstract class EntryPointContextFactory implements ContextFactory<EntryPointContext> { - - private String name; - - private SourceWireFactory sourceWireFactory; - - private MessageFactory msgFactory; - - private List<SourceWireFactory> sourceProxyFactories; - - public EntryPointContextFactory(String name, MessageFactory msgFactory) { - assert (name != null) : "Entry point name was null"; - assert (msgFactory != null) : "Message factory was null"; - this.name = name; - this.msgFactory = msgFactory; - } - - public EntryPointContext createContext() throws ContextCreationException { - return new EntryPointContextImpl(name, sourceWireFactory, msgFactory); - } - - public Scope getScope() { - return Scope.MODULE; - } - - public String getName() { - return name; - } - - public void prepare() { - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - // no wires to an entry point from within a composite - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - // no wires to an entry point from within a composite - return null; - } - - public Map<String, TargetWireFactory> getTargetWireFactories() { - // no wires to an entry point from within a composite - return Collections.emptyMap(); - } - - public void addSourceWireFactory(String refName, SourceWireFactory factory) { - assert (refName != null) : "No reference name specified"; - assert (factory != null) : "Proxy factory was null"; - this.sourceWireFactory = factory; - } - - public List<SourceWireFactory> getSourceWireFactories() { - if (sourceProxyFactories == null) { - sourceProxyFactories = new ArrayList<SourceWireFactory>(1); - sourceProxyFactories.add(sourceWireFactory); - } - return sourceProxyFactories; - } - - public void addProperty(String propertyName, Object value) { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factories, boolean multiplicity) { - if (factories.size() >1){ - throw new UnsupportedOperationException("Multiple wires for an entry point not allowed"); - }else if(factories.size() <1){ - throw new AssertionError("Empty wire factory list"); - } - this.sourceWireFactory = factories.get(0); - } - - public void prepare(CompositeContext parent) { - } -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java deleted file mode 100644 index 7c030324f1..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceBuilderSupport.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.service.WireFactoryService; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.Binding; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.model.assembly.ExternalService; -import org.apache.tuscany.model.assembly.Service; -import org.osoa.sca.annotations.Init; - -/** - * A base class for a {@link ContextFactoryBuilder} that creates {@link org.apache.tuscany.core.context.ExternalServiceContext}s - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class ExternalServiceBuilderSupport<T extends Binding> implements ContextFactoryBuilder { - - private ContextFactoryBuilderRegistry builderRegistry; - private WireFactoryService wireService; - protected Class bindingClass; - - public ExternalServiceBuilderSupport() { - // reflect the generic type of the subclass - Type type = this.getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - bindingClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } else { - throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); - } - } - - public ExternalServiceBuilderSupport(WireFactoryService wireService) { - this(); - this.wireService = wireService; - } - - @Init(eager = true) - public void init() throws Exception { - builderRegistry.register(this); - } - - @Autowire - public void setBuilderRegistry(ContextFactoryBuilderRegistry registry) { - builderRegistry = registry; - } - - @Autowire - public void setWireService(WireFactoryService wireService) { - this.wireService = wireService; - } - - public void build(AssemblyObject object) throws BuilderException { - if (!(object instanceof ExternalService)) { - return; - } - ExternalService externalService = (ExternalService) object; - if (externalService.getBindings().size() < 1) { - // || !(handlesBindingType(externalService.getBindings().get(0)))) { - return; - } - if (!bindingClass.isAssignableFrom(externalService.getBindings().get(0).getClass())) { - return; - } - - ExternalServiceContextFactory contextFactory - = createExternalServiceContextFactory(externalService); - - ConfiguredService configuredService = externalService.getConfiguredService(); - Service service = configuredService.getPort(); - TargetWireFactory wireFactory = wireService.createTargetFactory(configuredService); - contextFactory.addTargetWireFactory(service.getName(), wireFactory); - externalService.setContextFactory(contextFactory); - } - - /** - * Returns true if an extending implementation can process the given binding element - */ - //protected abstract boolean handlesBindingType(Binding binding); - - /** - * Callback to create the specific <code>ContextFactory</code> type associated with the extending - * implementation - * - * @param externalService the external service being processed - */ - protected abstract ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService); - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java deleted file mode 100644 index 396da3d39e..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceContextFactory.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import org.apache.tuscany.core.builder.ContextCreationException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.ExternalServiceContext; -import org.apache.tuscany.core.context.impl.ExternalServiceContextImpl; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.model.assembly.Scope; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * A template implementation that creates instances of {@link org.apache.tuscany.core.context.ExternalServiceContext} - * configured with the appropriate wire chains and bindings. This class is intended to be subclassed when - * contributing new bindings to the runtime. The subclass serves as a marker so the binding {@link org.apache.tuscany.core.builder.WireBuilder - * - * - * - * } - * responsible for setting the proper {@link org.apache.tuscany.core.wire.TargetInvoker} on the wire chains - * can be notified. - * - * @version $Rev$ $Date$ - */ -public abstract class ExternalServiceContextFactory implements ContextFactory<ExternalServiceContext> { - - private String name; - - private TargetWireFactory targetWireFactory; - - private ObjectFactory objectFactory; - - private String targetServiceName; - - private Map<String, TargetWireFactory> targetProxyFactories; - - public ExternalServiceContextFactory(String name, ObjectFactory objectFactory) { - assert (name != null) : "Name was null"; - assert (objectFactory != null) : "Object factory was null"; - this.name = name; - this.objectFactory = objectFactory; - } - - public ExternalServiceContext createContext() throws ContextCreationException { - return new ExternalServiceContextImpl(name, targetWireFactory, objectFactory); - } - - public Scope getScope() { - return Scope.MODULE; - } - - public String getName() { - return name; - } - - public void prepare() { - } - - public void addTargetWireFactory(String serviceName, TargetWireFactory factory) { - assert (serviceName != null) : "No service name specified"; - assert (factory != null) : "Proxy factory was null"; - this.targetServiceName = serviceName; // external services are configured with only one service - this.targetWireFactory = factory; - } - - public TargetWireFactory getTargetWireFactory(String serviceName) { - if (this.targetServiceName.equals(serviceName)) { - return targetWireFactory; - } else { - return null; - } - } - - public Map<String,TargetWireFactory> getTargetWireFactories() { - if (targetProxyFactories == null) { - targetProxyFactories = new HashMap<String, TargetWireFactory> (1); - targetProxyFactories.put(targetServiceName, targetWireFactory); - } - return targetProxyFactories; - } - - public void addSourceWireFactory(String referenceName, SourceWireFactory factory) { - throw new UnsupportedOperationException(); - } - - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity) { - - } - - public List<SourceWireFactory> getSourceWireFactories() { - return Collections.emptyList(); - } - - public void addProperty(String propertyName, Object value) { - throw new UnsupportedOperationException(); - } - - public void prepare(CompositeContext parent) { - //parentContext = parent; - } - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java deleted file mode 100644 index 0424bf5de6..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceInvoker.java +++ /dev/null @@ -1,23 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.core.extension;
-
-public interface ExternalServiceInvoker {
-
- public Object invoke(String methodName, Object[] args);
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java deleted file mode 100644 index 0d664e0207..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/ExternalServiceTargetInvoker.java +++ /dev/null @@ -1,122 +0,0 @@ -/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tuscany.core.extension;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.core.context.Context;
-import org.apache.tuscany.core.context.ExternalServiceContext;
-import org.apache.tuscany.core.context.QualifiedName;
-import org.apache.tuscany.core.context.ScopeContext;
-import org.apache.tuscany.core.context.TargetException;
-import org.apache.tuscany.core.message.Message;
-import org.apache.tuscany.core.wire.Interceptor;
-import org.apache.tuscany.core.wire.TargetInvoker;
-
-/**
- * Responsible for invoking an external service
- *
- * @version $Rev$ $Date$
- */
-public class ExternalServiceTargetInvoker implements TargetInvoker {
-
- private QualifiedName serviceName;
-
- private String esName;
-
- private Method method;
-
- private ScopeContext container;
-
- private ExternalServiceContext context;
-
- /**
- * Constructs a new ExternalWebServiceTargetInvoker.
- *
- * @param container
- */
- public ExternalServiceTargetInvoker(QualifiedName serviceName, Method method, ScopeContext container) {
- assert serviceName != null : "No service name specified";
- assert method != null : "No method specified";
- assert container != null : "No scope container specified";
- this.serviceName = serviceName;
- this.esName = serviceName.getPartName();
- this.method = method;
- this.container = container;
- }
-
- public Object invokeTarget(Object payload) throws InvocationTargetException {
- if (context == null) {
- Context iContext = container.getContext(esName);
- if (!(iContext instanceof ExternalServiceContext)) {
- TargetException te = new TargetException("Unexpected target context type");
- te.setIdentifier(iContext.getClass().getName());
- te.addContextName(iContext.getName());
- throw te;
- }
- context = (ExternalServiceContext) iContext;
- }
-
- ExternalServiceInvoker invoker = (ExternalServiceInvoker) context.getHandler();
- if (payload != null) {
- return doInvoke(invoker, (Object[]) payload);
- } else {
- return doInvoke(invoker, null);
- }
- }
-
- protected Object doInvoke(ExternalServiceInvoker invoker, Object[] args) {
- return invoker.invoke(method.getName(), args);
- }
-
- public boolean isCacheable() {
- return false;
- }
-
- public Message invoke(Message msg) {
- try {
- Object resp = invokeTarget(msg.getBody());
- msg.setBody(resp);
- } catch (InvocationTargetException e) {
- msg.setBody(e.getCause());
- } catch (Throwable e) {
- msg.setBody(e);
- }
- return msg;
- }
-
- public void setNext(Interceptor next) {
- throw new UnsupportedOperationException();
- }
-
- public Object clone() throws CloneNotSupportedException {
- try {
- ExternalServiceTargetInvoker invoker = (ExternalServiceTargetInvoker) super.clone();
- invoker.container = container;
- invoker.context = this.context;
- invoker.esName = this.esName;
- invoker.method = this.method;
- invoker.serviceName = this.serviceName;
- return invoker;
- } catch (CloneNotSupportedException e) {
- // will not happen
- return null;
- }
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java deleted file mode 100644 index 5b2d9de0e3..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/WireBuilderSupport.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension; - -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.ContextFactory; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.context.QualifiedName; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.runtime.RuntimeContext; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetInvoker; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.osoa.sca.annotations.Init; - -/** - * A base class for {@link WireBuilder} implementations - * - * @version $$Rev$$ $$Date$$ - */ -public abstract class WireBuilderSupport<T extends ContextFactory<?>> implements WireBuilder { - - protected RuntimeContext runtimeContext; - protected Class targetClass; - - @Autowire - public void setRuntimeContext(RuntimeContext context) { - runtimeContext = context; - } - - public WireBuilderSupport() { - // reflect the generic type of the subclass - Type type = this.getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - targetClass = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } else { - throw new AssertionError("Subclasses of " + ContextFactoryBuilderSupport.class.getName() + " must be genericized"); - } - } - - @Init(eager = true) - public void init() throws Exception { - runtimeContext.addBuilder(this); - } - - public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException { - if (!targetClass.isAssignableFrom(targetType)) { - return; - } - - for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations() - .values()) { - TargetInvoker invoker = createInvoker(sourceFactory.getConfiguration() - .getTargetName(), sourceInvocationConfig.getMethod(), targetScopeContext, downScope); - sourceInvocationConfig.setTargetInvoker(invoker); - } - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - - if (!targetClass.isAssignableFrom(targetType)) { - return; - } - for (TargetInvocationConfiguration targetInvocationConfig : targetFactory.getConfiguration().getInvocationConfigurations() - .values()) { - Method method = targetInvocationConfig.getMethod(); - TargetInvoker invoker = createInvoker(targetFactory.getConfiguration().getTargetName(), method, targetScopeContext, false); - targetInvocationConfig.setTargetInvoker(invoker); - } - } - - /** - * Callback to create the specific <code>TargetInvoker</code> type for dispatching to the target type - * - * @param targetName the fully qualified name of the wire target - * @param operation the operation the invoker will be associated with - * @param context the scope context that manages the target context - * @param downScope whether the wire source scope is "longer" than the target - */ - protected abstract TargetInvoker createInvoker(QualifiedName targetName, Method operation, ScopeContext context, boolean downScope); - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java deleted file mode 100644 index b464a7f00f..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/ImplementationProcessor.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension.config; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.model.assembly.ComponentType; -import org.apache.tuscany.core.config.ConfigurationLoadException; - -/** - * Implementations process a Java class and contribute to a {@link org.apache.tuscany.model.assembly.ComponentType} - * or provide some validation function. Implementations may contribute to defined <code>ComponentType</code> - * metadata, a general <code>ComponentType</code> extensibility element, or a more specific Java extensibility - * element, which is associated with {@link org.apache.tuscany.core.extension.config.JavaExtensibilityElement} and - * stored in the <code>ComponentType</code>'s extensibility collection. Processors will typically use {@link - * JavaExtensibilityHelper#getExtensibilityElement(org.apache.tuscany.model.assembly.Extensible)}, which - * provides methods for retrieving the Java extensibility element. - * <p/> - * In the runtime, a {@link org.apache.tuscany.core.config.ComponentTypeIntrospector} system service introspects component implementation - * types when an assembly is loaded, calling out to registered processors in the order defined by {@link - * ComponentTypeIntrospector#introspect(Class<?>)}. Generally, processors are also system services which - * register themeselves with a <code>ComponentTypeIntrospector</code>. For convenience, a processor - * implementation can extend <@link org.apache.tuscany.core.config.processor.ImplementationProcessorSupport}, - * which provides mechanisms for doing this. - * <p/> - * There are a series of bootsrap, or primordial, processors configured in the runtime, and they serve as - * examples of how an <code>ImplementationProcessor</code> can be implemented. - * - * @see org.apache.tuscany.core.config.processor.PropertyProcessor - * @see org.apache.tuscany.core.config.processor.ReferenceProcessor - * @see org.apache.tuscany.core.config.processor.InitProcessor - * @see org.apache.tuscany.core.config.processor.DestroyProcessor - * @see org.apache.tuscany.core.config.processor.ComponentNameProcessor - * - * @version $$Rev$$ $$Date$$ - * @see org.apache.tuscany.core.config.processor.ImplementationProcessorSupport - */ -public interface ImplementationProcessor { - - public void visitClass(Class<?> clazz, ComponentType type) throws ConfigurationLoadException; - - public void visitSuperClass(Class<?> clazz, ComponentType type) throws ConfigurationLoadException; - - public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException; - - public void visitConstructor(Constructor<?> constructor, ComponentType type) throws ConfigurationLoadException; - - public void visitField(Field field, ComponentType type) throws ConfigurationLoadException; - - public void visitEnd(Class<?> clazz, ComponentType type) throws ConfigurationLoadException; - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java deleted file mode 100644 index 50818d1ac0..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/InjectorExtensibilityElement.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension.config; - -import org.apache.tuscany.core.builder.ContextResolver; -import org.apache.tuscany.core.injection.Injector; - -/** - * An extensiblity element which provides {@link Injector}s based on component type metadata - * - * @version $$Rev$$ $$Date$$ - */ -public interface InjectorExtensibilityElement extends JavaExtensibilityElement { - - /** - * Creates an injector - * @param resolver that returns the current composite context - */ - public Injector<?> getInjector(ContextResolver resolver); - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java deleted file mode 100644 index fba57d8254..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/JavaExtensibilityElement.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ -package org.apache.tuscany.core.extension.config; - -/** - * Serves as a marker for a metadata extensibility point. For example, {@link ImplementationProcessor}s may - * create extensibility elements which are responsible for implementing injection functionality prescribed by - * a Java source annotation. - * - * @version $$Rev$$ $$Date$$ - */ -public interface JavaExtensibilityElement { - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java deleted file mode 100644 index e04ca34da6..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ComponentNameExtensibilityElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.SingletonObjectFactory; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ComponentNameExtensibilityElement implements JavaExtensibilityElement { - - private Method method; - private Field field; - - public ComponentNameExtensibilityElement(Method m) { - method = m; - } - - public ComponentNameExtensibilityElement(Field f) { - field = f; - } - - public Injector<?> getEventInvoker(String name) { - if (method != null) { - return new MethodInjector(method, new SingletonObjectFactory<Object>(name)); - }else{ - return new FieldInjector(field, new SingletonObjectFactory<Object>(name)); - } - } - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java deleted file mode 100644 index 9099132e36..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/ContextExtensibilityElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; -import org.apache.tuscany.core.injection.Injector; -import org.apache.tuscany.core.injection.MethodInjector; -import org.apache.tuscany.core.injection.FieldInjector; -import org.apache.tuscany.core.injection.ContextObjectFactory; -import org.apache.tuscany.core.builder.ContextResolver; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class ContextExtensibilityElement implements JavaExtensibilityElement { - - private Method method; - private Field field; - - public ContextExtensibilityElement(Method m) { - method = m; - } - - public ContextExtensibilityElement(Field f) { - field = f; - } - - public Injector<?> getInjector(ContextResolver resolver) { - if (method != null) { - return new MethodInjector(method, new ContextObjectFactory(resolver)); - } else { - return new FieldInjector(field, new ContextObjectFactory(resolver)); - } - } -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java deleted file mode 100644 index 9952f507b2..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/DestroyInvokerExtensibilityElement.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Method; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class DestroyInvokerExtensibilityElement extends InvokerExtensibilityElement{ - - public DestroyInvokerExtensibilityElement(Method m) { - super(m); - } -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java deleted file mode 100644 index 4c542b4b5d..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InitInvokerExtensibilityElement.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Method; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class InitInvokerExtensibilityElement extends InvokerExtensibilityElement{ - - private boolean eager; - - public InitInvokerExtensibilityElement(Method m, boolean eager) { - super(m); - this.eager = eager; - } - - public boolean isEager() { - return eager; - } - -} diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java deleted file mode 100644 index a87acd16cc..0000000000 --- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/extension/config/extensibility/InvokerExtensibilityElement.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.core.extension.config.extensibility; - -import java.lang.reflect.Method; - -import org.apache.tuscany.core.extension.config.JavaExtensibilityElement; -import org.apache.tuscany.core.injection.MethodEventInvoker; - -/** - * @version $$Rev$$ $$Date$$ - */ -public class InvokerExtensibilityElement implements JavaExtensibilityElement { - - private Method method; - private MethodEventInvoker invoker; - - public InvokerExtensibilityElement(Method m) { - method = m; - } - - public MethodEventInvoker getEventInvoker() { - if (invoker == null) { - invoker = new MethodEventInvoker(method); - } - return invoker; - } -} |