summaryrefslogtreecommitdiffstats
path: root/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config')
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java208
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java99
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java23
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java110
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java34
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java98
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java53
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java58
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java54
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java90
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java69
-rw-r--r--tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java72
12 files changed, 0 insertions, 968 deletions
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java
deleted file mode 100644
index 2e4a2916ce..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemContextFactory.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.system.config;
-
-import org.apache.tuscany.common.TuscanyRuntimeException;
-import org.apache.tuscany.core.builder.ContextCreationException;
-import org.apache.tuscany.core.builder.ContextFactory;
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.config.ConfigurationException;
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.context.Context;
-import org.apache.tuscany.core.injection.EventInvoker;
-import org.apache.tuscany.core.injection.Injector;
-import org.apache.tuscany.core.injection.PojoObjectFactory;
-import org.apache.tuscany.core.wire.SourceWireFactory;
-import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.core.system.context.SystemAtomicContext;
-import org.apache.tuscany.model.assembly.Module;
-import org.apache.tuscany.model.assembly.Scope;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A <code>ContextFactory</code> that handles system component implementation types, which may be either simple, leaf
- * types or an composites.
- * <p>
- * For composite types, this factory delegates to an {@link org.apache.tuscany.core.builder.ObjectFactory} to create an
- * instance of the composite implementation and perform injection of configuration and references. Once an composite
- * instance is created, the factory will register the composite's children. This process may be done recursively in a
- * lazy fashion, descending down an composite hierarchy as a child composite is instantiated.
- *
- * @version $Rev$ $Date$
- */
-public class SystemContextFactory implements ContextFactory<Context>, ContextResolver {
-
- // the component name as configured in the hosting module
- private String name;
-
- // if this factory produces composites, the module will be the logical model associated with its children
- private Module module;
-
- private CompositeContext parentContext;
-
- // the implementation type constructor
- private Constructor ctr;
-
- // injectors for properties, references and other metadata values such as @Context
- private List<Injector> setters;
-
- // an invoker for a method decorated with @Init
- private EventInvoker init;
-
- // whether the component should be eagerly initialized when its scope starts
- private boolean eagerInit;
-
- // an invoker for a method decorated with @Destroy
- private EventInvoker destroy;
-
- // the scope of the implementation instance
- private Scope scope;
-
- // if the component implementation scope is stateless
- private boolean stateless;
-
- // if the component implementation is an composite context
- private boolean isComposite;
-
- /**
- * Creates the runtime configuration
- *
- * @param name the SCDL name of the component the context refers to
- * @param ctr the implementation type constructor
- * @param scope the scope of the component implementation type
- */
- public SystemContextFactory(String name, Constructor ctr, Scope scope) {
- this(name, null, ctr, scope);
- }
-
- /**
- * Creates the runtime configuration
- *
- * @param name the SCDL name of the component the context refers to
- * @param module if this factory produces aggregagtes, the logical model associated with its children; otherwise
- * null
- * @param ctr the implementation type constructor
- * @param scope the scope of the component implementation type
- */
- public SystemContextFactory(String name, Module module, Constructor ctr, Scope scope) {
- assert (name != null) : "Name was null";
- assert (ctr != null) : "Constructor was null";
- this.name = name;
- this.module = module;
- this.ctr = ctr;
- this.isComposite = CompositeContext.class.isAssignableFrom(ctr.getDeclaringClass());
- this.scope = scope;
- if (isComposite) {
- scope = Scope.AGGREGATE;
- } else {
- stateless = (scope == Scope.INSTANCE);
- }
- }
-
- public String getName() {
- return name;
- }
-
- public void addProperty(String propertyName, Object value) {
-
- }
-
- public Scope getScope() {
- return scope;
- }
-
- public Context createContext() throws ContextCreationException {
- if (isComposite) {
- try {
- // composite context types are themselves an instance context
- PojoObjectFactory<CompositeContext> objectFactory = new PojoObjectFactory<CompositeContext>(ctr, null, setters);
- CompositeContext ctx = objectFactory.getInstance();
- ctx.setName(name);
- // the composite has been created, now register its children
- if (module != null) {
- try {
- ctx.registerModelObject(module);
- } catch (ConfigurationException e) {
- ContextCreationException cce = new ContextCreationException("Error creating context", e);
- cce.setIdentifier(getName());
- throw cce;
- }
-
- }
- return ctx;
- } catch (TuscanyRuntimeException e) {
- e.addContextName(name);
- throw e;
- }
- } else {
- PojoObjectFactory objectFactory = new PojoObjectFactory(ctr, null, setters);
- return new SystemAtomicContext(name, objectFactory, eagerInit, init, destroy, stateless);
- }
- }
-
- public void addTargetWireFactory(String serviceName, TargetWireFactory factory) {
- throw new UnsupportedOperationException();
- }
-
- public TargetWireFactory getTargetWireFactory(String serviceName) {
- return null;
- }
-
- public Map<String, TargetWireFactory> getTargetWireFactories() {
- return null;
- }
-
- 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 null;
- }
-
- public void setSetters(List<Injector> setters) {
- this.setters = setters;
- }
-
- public void setEagerInit(boolean val) {
- eagerInit = val;
- }
-
- public void setInitInvoker(EventInvoker invoker) {
- init = invoker;
- }
-
- public void setDestroyInvoker(EventInvoker invoker) {
- destroy = invoker;
- }
-
- public void prepare(CompositeContext parent) {
- parentContext = parent;
- }
-
- public CompositeContext getCurrentContext() {
- return parentContext;
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java
deleted file mode 100644
index c9cfeccd6b..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemEntryPointContextFactory.java
+++ /dev/null
@@ -1,99 +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.system.config;
-
-import org.apache.tuscany.core.builder.ContextCreationException;
-import org.apache.tuscany.core.builder.ContextFactory;
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.context.EntryPointContext;
-import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.core.wire.SourceWireFactory;
-import org.apache.tuscany.core.system.context.SystemEntryPointContext;
-import org.apache.tuscany.model.assembly.Scope;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Creates {@link SystemEntryPointContext} instances based on an entry point configuration in an assembly model
- *
- * @version $Rev$ $Date$
- */
-public class SystemEntryPointContextFactory implements ContextFactory<EntryPointContext>, ContextResolver {
-
- // the name of the entry point
- private String name;
-
- private CompositeContext parentContext;
-
- private String targetName;
-
- private Class serviceInterface;
-
- public SystemEntryPointContextFactory(String name, String targetName, Class serviceInterface) {
- this.name = name;
- this.targetName = targetName;
- this.serviceInterface = serviceInterface;
- }
-
- public EntryPointContext createContext() throws ContextCreationException {
- return new SystemEntryPointContext(name, targetName, serviceInterface, this);
- }
-
- public Scope getScope() {
- return Scope.MODULE;
- }
-
- public String getName() {
- return name;
- }
-
-
- public void addTargetWireFactory(String serviceName, TargetWireFactory pFactory) {
- throw new UnsupportedOperationException();
- }
-
- public TargetWireFactory getTargetWireFactory(String serviceName) {
- return null;
- }
-
- public Map<String, TargetWireFactory> getTargetWireFactories() {
- return null;
- }
-
- public void addSourceWireFactory(String referenceName, SourceWireFactory pFactory) {
- throw new UnsupportedOperationException();
- }
-
- public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity) {
- throw new UnsupportedOperationException();
- }
- public void addProperty(String propertyName, Object value) {
-
- }
-
- public List<SourceWireFactory> getSourceWireFactories() {
- return null;
- }
-
- public void prepare(CompositeContext parent) {
- this.parentContext = parent;
- }
-
- public CompositeContext getCurrentContext() {
- return parentContext;
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.java
deleted file mode 100644
index 14655c2393..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExtensibilityElement.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.system.config;
-
-/**
- * Base marker for system metadata extensions
- *
- * @version $$Rev$$ $$Date$$
- */
-public interface SystemExtensibilityElement {
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java
deleted file mode 100644
index d62afa4425..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemExternalServiceContextFactory.java
+++ /dev/null
@@ -1,110 +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.system.config;
-
-import org.apache.tuscany.core.builder.ContextCreationException;
-import org.apache.tuscany.core.builder.ContextFactory;
-import org.apache.tuscany.core.builder.ContextResolver;
-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.injection.InterCompositeReferenceFactory;
-import org.apache.tuscany.core.system.context.SystemExternalServiceContext;
-import org.apache.tuscany.core.system.injection.AutowireObjectFactory;
-import org.apache.tuscany.core.wire.SourceWireFactory;
-import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.model.assembly.Scope;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Creates system type external service contexts
- *
- * @version $Rev$ $Date$
- * @see org.apache.tuscany.core.context.ExternalServiceContext
- * @see org.apache.tuscany.core.system.context.SystemExternalServiceContext
- */
-public class SystemExternalServiceContextFactory implements ContextFactory<ExternalServiceContext>, ContextResolver {
-
- // the name of the external service
- private String name;
-
- // the factory for returning a reference to the implementation instance of the component represented by the external
- // service
- private ObjectFactory factory;
-
- private CompositeContext parentContext;
-
- public SystemExternalServiceContextFactory(String name, ObjectFactory factory) {
- assert (name != null) : "Name was null";
- assert (factory != null) : "Object factory was null";
- this.name = name;
- this.factory = factory;
- }
-
- public Scope getScope() {
- return Scope.MODULE;
- }
-
- public String getName() {
- return name;
- }
-
- public void addProperty(String propertyName, Object value) {
- throw new UnsupportedOperationException();
- }
-
- public ExternalServiceContext createContext() throws ContextCreationException {
- return new SystemExternalServiceContext(name, factory);
- }
-
- public void addTargetWireFactory(String serviceName, TargetWireFactory pFactory) {
- throw new UnsupportedOperationException();
- }
-
- public TargetWireFactory getTargetWireFactory(String serviceName) {
- return null;
- }
-
- public Map<String, TargetWireFactory> getTargetWireFactories() {
- return null;
- }
-
- public void addSourceWireFactory(String referenceName, SourceWireFactory pFactory) {
- throw new UnsupportedOperationException();
- }
-
- public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity) {
-
- }
-
- public List<SourceWireFactory> getSourceWireFactories() {
- return null;
- }
-
- public void prepare(CompositeContext parent) {
- parentContext = parent;
- if (factory instanceof InterCompositeReferenceFactory) {
- ((InterCompositeReferenceFactory) factory).setContextResolver(this);
- } else if (factory instanceof AutowireObjectFactory) {
- ((AutowireObjectFactory) factory).setContextResolver(this);
- }
- }
-
- public CompositeContext getCurrentContext() {
- return parentContext;
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java
deleted file mode 100644
index 7fca219399..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemInjectorExtensibilityElement.java
+++ /dev/null
@@ -1,34 +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.system.config;
-
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.injection.Injector;
-
-/**
- * An extensiblity element which provides {@link org.apache.tuscany.core.injection.Injector}s based on
- * component type metadata specific to system services
- *
- * @version $$Rev$$ $$Date$$
- */
-public interface SystemInjectorExtensibilityElement {
- /**
- * 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/system/config/SystemObjectContextFactory.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java
deleted file mode 100644
index d4a21dd427..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/SystemObjectContextFactory.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.system.config;
-
-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.Context;
-import org.apache.tuscany.core.injection.SingletonObjectFactory;
-import org.apache.tuscany.core.wire.WireFactory;
-import org.apache.tuscany.core.wire.SourceWireFactory;
-import org.apache.tuscany.core.wire.TargetWireFactory;
-import org.apache.tuscany.core.system.context.SystemAtomicContext;
-import org.apache.tuscany.model.assembly.Scope;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * A ContextFactory that contains the configuration needed to convert a simple
- * Java Object into a component. The object is assumed to be fully initialized and
- * will always be added with MODULE scope.
- *
- * @version $Rev$ $Date$
- */
-public class SystemObjectContextFactory implements ContextFactory {
- private final String name;
- private final ObjectFactory<?> objectFactory;
-
- /**
- * Construct a ContextFactory for the supplied Java Object.
- *
- * @param name the name to be assigned to the resulting component
- * @param instance the Java Object that provides the implementation
- */
- public SystemObjectContextFactory(String name, Object instance) {
- this.name = name;
- objectFactory = new SingletonObjectFactory<Object>(instance);
- }
-
- public Context createContext() throws ContextCreationException {
- return new SystemAtomicContext(name, objectFactory, false, null, null, false);
- }
-
- public Scope getScope() {
- return Scope.MODULE;
- }
-
- public String getName() {
- return name;
- }
-
- public void addProperty(String propertyName, Object value) {
-
- }
-
- public void addTargetWireFactory(String serviceName, TargetWireFactory factory) {
- throw new UnsupportedOperationException();
- }
-
- public TargetWireFactory getTargetWireFactory(String serviceName) {
- throw new UnsupportedOperationException();
- }
-
- public Map getTargetWireFactories() {
- throw new UnsupportedOperationException();
- }
-
- public void addSourceWireFactory(String referenceName, SourceWireFactory factory) {
- throw new UnsupportedOperationException();
- }
-
- public void addSourceWireFactories(String referenceName, Class referenceInterface, List factory, boolean multiplicity) {
-
- }
-
- public List<WireFactory> getSourceWireFactories() {
- throw new UnsupportedOperationException();
- }
-
- public void prepare(CompositeContext parent) {
- }
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java
deleted file mode 100644
index 42d3151c78..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/AutowireExtensibilityElement.java
+++ /dev/null
@@ -1,53 +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.system.config.extensibility;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.injection.FieldInjector;
-import org.apache.tuscany.core.injection.Injector;
-import org.apache.tuscany.core.injection.MethodInjector;
-import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement;
-import org.apache.tuscany.core.system.injection.AutowireObjectFactory;
-
-/**
- * A metadata extensbility element for autowires; creates injectors which return the target of an autowire
- *
- * @version $$Rev$$ $$Date$$
- */
-public class AutowireExtensibilityElement implements SystemInjectorExtensibilityElement {
-
- private Method method;
- private Field field;
-
- public AutowireExtensibilityElement(Method m) {
- assert(m == null || m.getParameterTypes().length == 1): "Illegal number of parameters";
- method = m;
- }
-
- public AutowireExtensibilityElement(Field f) {
- field = f;
- }
-
- @SuppressWarnings("unchecked")
- public Injector<?> getInjector(ContextResolver resolver) {
- if (method != null) {
- return new MethodInjector(method, new AutowireObjectFactory(method.getParameterTypes()[0], resolver));
- } else {
- return new FieldInjector(field, new AutowireObjectFactory(field.getType(), resolver));
- }
- }
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java
deleted file mode 100644
index 61c89d991b..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/MonitorExtensibilityElement.java
+++ /dev/null
@@ -1,58 +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.system.config.extensibility;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Field;
-
-import org.apache.tuscany.core.system.config.SystemExtensibilityElement;
-import org.apache.tuscany.core.injection.Injector;
-import org.apache.tuscany.core.injection.MethodInjector;
-import org.apache.tuscany.core.injection.ContextObjectFactory;
-import org.apache.tuscany.core.injection.FieldInjector;
-import org.apache.tuscany.core.injection.SingletonObjectFactory;
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.common.monitor.MonitorFactory;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class MonitorExtensibilityElement implements SystemExtensibilityElement {
-
- private Method method;
- private Field field;
-
- public MonitorExtensibilityElement(Method m) {
- assert(m.getParameterTypes().length == 1): "Illegal number of parameters";
- method = m;
- }
-
- public MonitorExtensibilityElement(Field f) {
- field = f;
- }
-
- public Injector<?> getInjector(MonitorFactory factory) {
- if (method != null) {
- Object monitor = factory.getMonitor(method.getParameterTypes()[0]);
- return new MethodInjector(method, new SingletonObjectFactory<Object>(monitor));
- } else {
- Object monitor = factory.getMonitor(field.getType());
- return new FieldInjector(field, new SingletonObjectFactory<Object>(monitor));
- }
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java
deleted file mode 100644
index b95b87c8de..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/extensibility/ParentContextExtensibilityElement.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.system.config.extensibility;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.injection.ContextObjectFactory;
-import org.apache.tuscany.core.injection.FieldInjector;
-import org.apache.tuscany.core.injection.Injector;
-import org.apache.tuscany.core.injection.MethodInjector;
-import org.apache.tuscany.core.system.config.SystemInjectorExtensibilityElement;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class ParentContextExtensibilityElement implements SystemInjectorExtensibilityElement {
-
- private Method method;
- private Field field;
-
- public ParentContextExtensibilityElement(Method m) {
- assert(m.getParameterTypes().length == 1): "Illegal number of parameters";
- method = m;
- }
-
- public ParentContextExtensibilityElement(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/system/config/processor/AutowireProcessor.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java
deleted file mode 100644
index 1885a5eaaa..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/AutowireProcessor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.system.config.processor;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.apache.tuscany.core.config.ConfigurationLoadException;
-import org.apache.tuscany.core.config.InvalidSetterException;
-import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport;
-import org.apache.tuscany.core.system.annotation.Autowire;
-import org.apache.tuscany.core.system.config.extensibility.AutowireExtensibilityElement;
-import org.apache.tuscany.core.context.SystemCompositeContext;
-import org.apache.tuscany.core.context.ConfigurationContext;
-import org.apache.tuscany.core.context.AutowireContext;
-import org.apache.tuscany.core.runtime.RuntimeContext;
-import org.apache.tuscany.core.builder.BuilderConfigException;
-import org.apache.tuscany.model.assembly.ComponentType;
-import org.apache.tuscany.common.monitor.MonitorFactory;
-
-/**
- * Processes {@link Autowire} annotations
- *
- * @version $$Rev$$ $$Date$$
- */
-public class AutowireProcessor extends ImplementationProcessorSupport {
-
- @Override
- public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException {
- Autowire annotation = method.getAnnotation(Autowire.class);
- if (annotation != null) {
- if (!Modifier.isPublic(method.getModifiers())) {
- InvalidSetterException e = new InvalidSetterException("Autowire setter method is not public");
- e.setIdentifier(method.toString());
- throw e;
- }
- if (method.getParameterTypes().length != 1){
- InvalidSetterException e = new InvalidSetterException("Autowire setter method must have one parameter");
- e.setIdentifier(method.toString());
- throw e;
- }
- checkAutowireType(method.getParameterTypes()[0],method.getDeclaringClass());
- type.getExtensibilityElements().add(new AutowireExtensibilityElement(method));
- }
- }
-
- @Override
- public void visitField(Field field, ComponentType type) throws ConfigurationLoadException {
- checkAutowireType(field.getType(),field.getDeclaringClass());
- int modifiers = field.getModifiers();
- Autowire annotation = field.getAnnotation(Autowire.class);
- if (annotation != null) {
- if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
- InvalidSetterException e = new InvalidSetterException("Autowire field is not public or protected");
- e.setIdentifier(field.getName());
- throw e;
- }
- type.getExtensibilityElements().add(new AutowireExtensibilityElement(field));
- }
- }
-
-
-
- private void checkAutowireType(Class paramClass, Class declaringClass) throws BuilderConfigException{
- if (SystemCompositeContext.class.isAssignableFrom(declaringClass)
- && !(paramClass.equals(ConfigurationContext.class)
- || paramClass.equals(MonitorFactory.class)
- || paramClass.equals(RuntimeContext.class) || paramClass.equals(
- AutowireContext.class))) {
- BuilderConfigException e = new BuilderConfigException("Illegal autowire type for system context");
- e.setIdentifier(paramClass.getName());
- throw e;
- }
- }
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java
deleted file mode 100644
index 9d7f535cc8..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/MonitorProcessor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.system.config.processor;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.apache.tuscany.core.config.ConfigurationLoadException;
-import org.apache.tuscany.core.config.InvalidSetterException;
-import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport;
-import org.apache.tuscany.core.system.annotation.Monitor;
-import org.apache.tuscany.core.system.config.extensibility.MonitorExtensibilityElement;
-import org.apache.tuscany.model.assembly.ComponentType;
-
-/**
- * Processes {@link org.apache.tuscany.core.system.annotation.Autowire} annotations
- *
- * @version $$Rev$$ $$Date$$
- */
-public class MonitorProcessor extends ImplementationProcessorSupport {
-
- @Override
- public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException {
- Monitor annotation = method.getAnnotation(Monitor.class);
- if (annotation != null) {
- if (!Modifier.isPublic(method.getModifiers())) {
- InvalidSetterException e = new InvalidSetterException("Monitor setter method is not public");
- e.setIdentifier(method.toString());
- throw e;
- }
- if (method.getParameterTypes().length != 1) {
- InvalidSetterException e = new InvalidSetterException("Monitor setter method must have one parameter");
- e.setIdentifier(method.toString());
- throw e;
- }
- type.getExtensibilityElements().add(new MonitorExtensibilityElement(method));
- }
- }
-
- @Override
- public void visitField(Field field, ComponentType type) throws ConfigurationLoadException {
- int modifiers = field.getModifiers();
- Monitor annotation = field.getAnnotation(Monitor.class);
- if (annotation != null) {
- if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
- InvalidSetterException e = new InvalidSetterException("Monitor field is not public or protected");
- e.setIdentifier(field.getName());
- throw e;
- }
- type.getExtensibilityElements().add(new MonitorExtensibilityElement(field));
- }
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java b/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java
deleted file mode 100644
index 1ddc68e3e8..0000000000
--- a/tags/java-M1-20060518/java/sca/core/src/main/java/org/apache/tuscany/core/system/config/processor/ParentContextProcessor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation
- *
- * 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.system.config.processor;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.apache.tuscany.core.config.ConfigurationLoadException;
-import org.apache.tuscany.core.config.InvalidSetterException;
-import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport;
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.system.annotation.ParentContext;
-import org.apache.tuscany.core.system.config.extensibility.ParentContextExtensibilityElement;
-import org.apache.tuscany.model.assembly.ComponentType;
-
-/**
- * Processes {@link org.apache.tuscany.core.system.annotation.Autowire} annotations
- *
- * @version $$Rev$$ $$Date$$
- */
-public class ParentContextProcessor extends ImplementationProcessorSupport {
-
- @Override
- public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException {
- ParentContext annotation = method.getAnnotation(ParentContext.class);
- if (annotation != null) {
- if (!Modifier.isPublic(method.getModifiers())) {
- InvalidSetterException e = new InvalidSetterException("ParentContext setter method is not public");
- e.setIdentifier(method.toString());
- throw e;
- }
- if (method.getParameterTypes().length != 1
- && !CompositeContext.class.isAssignableFrom(method.getParameterTypes()[0])) {
- InvalidSetterException e = new InvalidSetterException("ParentContext setter method must have one parameter of type " + CompositeContext.class.getName());
- e.setIdentifier(method.toString());
- throw e;
- }
- type.getExtensibilityElements().add(new ParentContextExtensibilityElement(method));
- }
- }
-
- @Override
- public void visitField(Field field, ComponentType type) throws ConfigurationLoadException {
- int modifiers = field.getModifiers();
- ParentContext annotation = field.getAnnotation(ParentContext.class);
- if (annotation != null) {
- if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
- InvalidSetterException e = new InvalidSetterException("ParentContext field is not public or protected");
- e.setIdentifier(field.getName());
- throw e;
- }
- type.getExtensibilityElements().add(new ParentContextExtensibilityElement(field));
- }
- }
-
-
-}