diff options
Diffstat (limited to 'tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder')
28 files changed, 0 insertions, 1386 deletions
diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.java deleted file mode 100644 index c2402d9141..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderConfigException.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.builder; - -/** - * Represents an error processing an assembly model - * - * @version $Rev$ $Date$ - */ -public class BuilderConfigException extends BuilderException { - - public BuilderConfigException() { - super(); - } - - public BuilderConfigException(String message) { - super(message); - } - - public BuilderConfigException(String message, Throwable cause) { - super(message, cause); - } - - public BuilderConfigException(Throwable cause) { - super(cause); - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java deleted file mode 100644 index 246f188988..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderException.java +++ /dev/null @@ -1,41 +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.builder; - -import org.apache.tuscany.core.context.CoreRuntimeException; - -/** - * The root exception for the builder package. Builder exceptions denote a non-recoverable failure. - * - * @version $Rev$ $Date$ - */ -public abstract class BuilderException extends CoreRuntimeException { - - public BuilderException() { - super(); - } - - public BuilderException(String message) { - super(message); - } - - public BuilderException(String message, Throwable cause) { - super(message, cause); - } - - public BuilderException(Throwable cause) { - super(cause); - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java deleted file mode 100644 index cd57eaf7ab..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/BuilderInitException.java +++ /dev/null @@ -1,39 +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.builder; - -/** - * Denotes an exception initializing a builder - * - * @version $Rev$ $Date$ - */ -public class BuilderInitException extends BuilderException { - - public BuilderInitException() { - super(); - } - - public BuilderInitException(String message, Throwable cause) { - super(message, cause); - } - - public BuilderInitException(String message) { - super(message); - } - - public BuilderInitException(Throwable cause) { - super(cause); - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java deleted file mode 100644 index 24b526371d..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextCreationException.java +++ /dev/null @@ -1,41 +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.builder; - - -/** - * Denotes an exception creating an instance context - * - * @version $Rev$ $Date$ - */ -public class ContextCreationException extends BuilderException { - - public ContextCreationException() { - super(); - } - - public ContextCreationException(String message) { - super(message); - } - - public ContextCreationException(String message, Throwable cause) { - super(message, cause); - } - - public ContextCreationException(Throwable cause) { - super(cause); - } - -} - diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java deleted file mode 100644 index ccef8024e8..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactory.java +++ /dev/null @@ -1,123 +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.builder; - -import org.apache.tuscany.core.context.CompositeContext; -import org.apache.tuscany.core.context.Context; -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; - -/** - * Implementations create {@link org.apache.tuscany.core.context.Context}s based on an assembly configuration. - * <p/> - * Context factories are "built" in two phases. {@link ContextFactoryBuilder}s analyze an assembly, producing - * <code>ContextFactory</code>s for {@link org.apache.tuscany.model.assembly.Component}s, {@link - * org.apache.tuscany.model.assembly.EntryPoint}s, and {@link org.apache.tuscany.model.assembly.ExternalService}s. During this - * phase, {@link org.apache.tuscany.core.wire.WireFactory}s for source- and target-side wires are produced for the - * <code>ContextFactory</code>s. Ê - * <p/> - * The second build phase connects the source- and target-side <code>WireFactories</code>, thereby completing wire configuration. - * <p/> - * At runtime, <code>ContextFactory</code>s are called to create new <code>Context</code>s when a new implementation instance is - * required for a component, entry point, or external service. The <code>Context</code> is then responsible for instantiating and - * managing the actual implementation instance. When a <code>Context</code> creates a new instance, the previously configured - * <code>WireFactory</code>s are used to create wires to and from the instance. A wire is a collection of stateless invocation - * chains that are managed by the <code>Context</code>'s <code>ContextFactory</code>. - * - * @version $Rev: 385747 $ $Date: 2006-03-13 22:12:53 -0800 (Mon, 13 Mar 2006) $ - */ -public interface ContextFactory<T extends Context> { - - /** - * Creates a <code>Context</code> based on configuration supplied by a logical model assembly - * - * @return a new instance context - * @throws ContextCreationException if an error occurs creating the context - */ - public T createContext() throws ContextCreationException; - - /** - * Returns the scope identifier associated with the type of contexts produced by the current factory - */ - public Scope getScope(); - - /** - * Returns the name of the <code>Context</code> produced by the current factory - */ - public String getName(); - - /** - * Adds a property to the context - */ - public void addProperty(String propertyName, Object value); - - /** - * Adds a target-side wire factory for the given service name. Target-side wire factories contain the invocation chains - * associated with the destination service of a wire and are responsible for generating proxies - */ - public void addTargetWireFactory(String serviceName, TargetWireFactory factory); - - /** - * Returns the target-side wire factory associated with the given service name - */ - public TargetWireFactory getTargetWireFactory(String serviceName); - - /** - * Returns a collection of target-side wire factories keyed by service name - */ - public Map<String, TargetWireFactory> getTargetWireFactories(); - - /** - * Adds a source-side wire factory for the given reference. Source-side wire factories contain the invocation chains for a - * reference in the implementation associated with the instance context created by this configuration. Source-side wire - * factories also produce proxies that are injected on a reference in a component implementation. - * - * @param referenceName - * @param factory - */ - public void addSourceWireFactory(String referenceName, SourceWireFactory factory); - - /** - * Adds a set of source-side wire factories for the given reference. Source-side wire factories contain the invocation chains - * for a reference in the implementation associated with the instance context created by this configuration. Source-side wire - * factories also produce proxies that are injected on a reference in a component implementation. - * - * @param referenceName - * @param referenceInterface - * @param factory - * @param multiplicity - */ - public void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity); - - /** - * Returns a collection of source-side wire factories for references. There may 1..n wire factories per reference. - */ - public List<SourceWireFactory> getSourceWireFactories(); - - /** - * Called to signal to the configuration that its parent context has been activated and that it shoud perform any required - * initialization steps - * - * @param parent the parent context - */ - public void prepare(CompositeContext parent); - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java deleted file mode 100644 index 786298809e..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilder.java +++ /dev/null @@ -1,50 +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.builder; - -import org.apache.tuscany.model.assembly.AssemblyObject; - -/** - * The extension point for component types in the runtime. Implementations perform the first phase of converting an assembly model - * into a series of runtime artifacts. Specifically, <code>ContextFactoryBuilder</code>s are responsible for analyzing the - * assembly model and producing {@link ContextFactory}s that are used to generate executable artifacts such as an {@link - * org.apache.tuscany.core.context.Context}. In the case of components, the <code>ContextFactory</code> will typically contain - * configuration for instantiating implementation instances with injected properties and references. - * <p/> - * As the assembly model is analyzed, <code>ContextFactoryBuilder</code>s are guaranteed to be called first and are expected to - * decorate the assembly model with <code>ContextFactory</code>s. - * <p/> - * The second phase uses {@link WireBuilder}s to connect the source and target wire chains held in these - * <code>ContextFactory</code>s to form a completed wire. <code>WireBuilder<code>s may use a similar delegation strategy and - * perform various optimizations. - * - * @version $Rev$ $Date$ - * @see ContextFactory - * @see WireBuilder - */ -public interface ContextFactoryBuilder { - - /** - * Creates or updates a context factory based on configuration contained in the given model object. The model object is - * decorated with the factory. - * - * @param object the logical configuration model node - * @throws BuilderException - */ - public void build(AssemblyObject object) throws BuilderException; - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java deleted file mode 100644 index a002627c2e..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextFactoryBuilderRegistry.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * - * Copyright 2006 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.builder; - -/** - * System wide registry for ContextFactoryBuilder implementations. - * - * @version $Rev$ $Date$ - */ -public interface ContextFactoryBuilderRegistry { - /** - * Register a builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - void register(ContextFactoryBuilder builder); -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.java deleted file mode 100644 index 5c99d6dd43..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ContextResolver.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.builder; - -import org.apache.tuscany.core.context.CompositeContext; - -/** - * Implementations are responsible for resolving the current composite context - * - * @version $Rev$ $Date$ - */ -public interface ContextResolver { - - /** - * Returns the current composite context - */ - CompositeContext getCurrentContext(); -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.java deleted file mode 100644 index ace34a1ad5..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/HierarchicalWireBuilder.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.builder; - -/** - * A wire builder that delegates to child wire builders - * - * @version $Rev$ $Date$ - */ -public interface HierarchicalWireBuilder extends WireBuilder{ - - /** - * Registers a child wire builder - */ - public void addWireBuilder(WireBuilder builder); - -} - diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java deleted file mode 100644 index 34b6294638..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/NoAccessorException.java +++ /dev/null @@ -1,39 +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.builder; - -/** - * Denotes an attempt to access a non-existent field or method - * - * @version $Rev$ $Date$ - */ -public class NoAccessorException extends BuilderException { - - public NoAccessorException() { - super(); - } - - public NoAccessorException(String message) { - super(message); - } - - public NoAccessorException(String message, Throwable cause) { - super(message, cause); - } - - public NoAccessorException(Throwable cause) { - super(cause); - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java deleted file mode 100644 index ab2cfd9bac..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/ObjectFactory.java +++ /dev/null @@ -1,35 +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.builder; - -import org.apache.tuscany.core.injection.ObjectCreationException; - -/** - * Implementations create new instances of a particular type - * - * @version $Rev$ $Date$ - */ -public interface ObjectFactory<T> { - - /** - * Return a instance of the type that this factory creates. - * - * @return a instance from this factory - */ - T getInstance() throws ObjectCreationException; - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java deleted file mode 100644 index 489541a213..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyBuilder.java +++ /dev/null @@ -1,28 +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.builder; - -/** - * A marker for policy extensions in the runtime. Implementations evaluate wire-related policy metadata on a {@link - * org.apache.tuscany.model.assembly.ConfiguredReference} or {@link org.apache.tuscany.model.assembly.ConfiguredService} and - * contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link org.apache.tuscany.core.wire.MessageHandler}s - * implementing a policy to {@link org.apache.tuscany.core.wire.InvocationConfiguration}s that are part of a {@link - * org.apache.tuscany.core.wire.WireConfiguration}. The contributed <code>Interceptor</code>s or <code>Handler</code>s will be - * called as part of an invocation over a wire. - * - * @version $$Rev$$ $$Date$$ - */ -public interface PolicyBuilder { - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java deleted file mode 100644 index 1038b6e878..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/PolicyOrderer.java +++ /dev/null @@ -1,26 +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.builder; - -/** - * A marker for implementations that order source- or target-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or - * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. - * - * @see SourcePolicyOrderer - * @see TargetPolicyOrderer - * @version $$Rev$$ $$Date$$ - */ -public interface PolicyOrderer { - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java deleted file mode 100644 index 76a376e3d5..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyBuilder.java +++ /dev/null @@ -1,31 +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.builder; - -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.model.assembly.ConfiguredReference; - -import java.util.List; - -/** - * Implementations contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link - * org.apache.tuscany.core.wire.MessageHandler}s that handle source-side policy on a wire. - * - * @version $$Rev$$ $$Date$$ - */ -public interface SourcePolicyBuilder extends PolicyBuilder { - - public void build(ConfiguredReference reference, List<WireSourceConfiguration> configurations) throws BuilderException; - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.java deleted file mode 100644 index 6bc3bcda6e..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/SourcePolicyOrderer.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.builder; - -import org.apache.tuscany.core.wire.WireSourceConfiguration; - -/** - * Implementations order source-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or - * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. - * - * @version $$Rev$$ $$Date$$ - */ -public interface SourcePolicyOrderer extends PolicyOrderer{ - - public void order(WireSourceConfiguration configuration); - - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.java deleted file mode 100644 index 10c34751e2..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyBuilder.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.builder; - -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.apache.tuscany.core.wire.WireTargetConfiguration; - -/** - * Implementations contribute {@link org.apache.tuscany.core.wire.Interceptor}s or {@link - * org.apache.tuscany.core.wire.MessageHandler}s that handle target-side policy on a wire. - * - * @version $$Rev$$ $$Date$$ - */ -public interface TargetPolicyBuilder extends PolicyBuilder{ - - public void build(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException; - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java deleted file mode 100644 index 4b596bfdc1..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/TargetPolicyOrderer.java +++ /dev/null @@ -1,28 +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.builder; - -import org.apache.tuscany.core.wire.WireTargetConfiguration; - -/** - * Implementation order target-side policy {@link org.apache.tuscany.core.wire.Interceptor}s or - * {@link org.apache.tuscany.core.wire.MessageHandler}s in a {@link org.apache.tuscany.core.wire.WireConfiguration}. - - * @version $$Rev$$ $$Date$$ - */ -public interface TargetPolicyOrderer { - - public void order(WireTargetConfiguration configuration); - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.java deleted file mode 100644 index 24c1fa24ff..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/UnknownTypeException.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.builder; - -/** - * Denotes an unknown configuration parameter type - * - * @version $Rev$ $Date$ - */ -public class UnknownTypeException extends BuilderException { - - public UnknownTypeException() { - super(); - } - - public UnknownTypeException(String message) { - super(message); - } - - public UnknownTypeException(String message, Throwable cause) { - super(message, cause); - } - - public UnknownTypeException(Throwable cause) { - super(cause); - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java deleted file mode 100644 index 54f2ff4b4e..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/WireBuilder.java +++ /dev/null @@ -1,71 +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.builder; - -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.TargetWireFactory; - -/** - * Implementations perform the second phase of converting a logical model representing an assembly into a series of - * runtime or executable artifacts. Specifically, they are responsible for finalizing target-side proxy factories and - * bridging {@link org.apache.tuscany.core.wire.InvocationConfiguration}s held by source- and target-side proxy - * factories. <code>WireBuilder</code>s generally operate by target implementation type. In other words, for a wire - * from a Java source to a JavaScript target, the Javascript <code>WireBuilder</code> will complete the wire. This is - * necessary as a <code>WireBuilder</code> must set a {@link org.apache.tuscany.core.wire.TargetInvoker} that is - * responsible for dispatching to an implementation on the source side of the wire. - * <p> - * Runtimes are generally configured with a {@link org.apache.tuscany.core.builder.impl.DefaultWireBuilder} as a - * top-most wire builder, which delegates to other builders wired to it as part of a system configuration. - * <p> - * Wire builders may optimize the wire chains based on certain characteristics of th wire, such as source and - * target scopes. - * - * @see org.apache.tuscany.core.builder.ContextFactoryBuilder - * @see org.apache.tuscany.core.builder.impl.DefaultWireBuilder - * @version $Rev$ $Date$ - */ -public interface WireBuilder { - - /** - * Connects wire configurations of the source proxy factory to corresponding ones in the target proxy to - * factory - * - * @param sourceFactory the proxy factory used in constructing the source side of the wire chain - * @param targetFactory the proxy factory used in constructing the target side of the wire chain - * @param targetType the context type of the target. Used to determine if a paricular wire builder should construct - * the wire - * @param downScope true if the component containing the reference (source side) is of a lesser scope than the - * target service - * @param targetScopeContext the scope context responsible for managing intance contexts of the target component - * type - * @throws BuilderConfigException if an error occurs during the wire buildSource process - */ - public void connect(SourceWireFactory<?> sourceFactory, TargetWireFactory<?> targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) throws BuilderConfigException; - - /** - * Finishes processing the target side wire chain. For example, a - * {@link org.apache.tuscany.core.wire.TargetInvoker} used by target-side proxies is usually set during this - * phase. - * - * @param targetFactory the target-side proxy factory - * @param targetType the target context type - * @param targetScopeContext the target scope - * @throws BuilderConfigException if an error occurs during the wire buildSource process - */ - public void completeTargetChain(TargetWireFactory<?> targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException; - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java deleted file mode 100644 index 8f0cbbf91b..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ArrayMultiplicityObjectFactory.java +++ /dev/null @@ -1,49 +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.builder.impl; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.injection.ObjectCreationException; - -import java.lang.reflect.Array; -import java.util.List; - -/** - * Resolves targets configured in a multiplicity by delegating to object factories and returning an - * <code>Array</code> containing object instances - * - * @version $Rev$ $Date$ - */ -public class ArrayMultiplicityObjectFactory implements ObjectFactory<Object> { - - private ObjectFactory[] factories; - - private Class interfaceType; - - public ArrayMultiplicityObjectFactory(Class interfaceType, List<ObjectFactory> factories) { - assert (interfaceType != null) : "Interface type was null"; - assert (factories != null) : "Object factories were null"; - this.interfaceType = interfaceType; - this.factories = factories.toArray(new ObjectFactory[factories.size()]); - } - - public Object getInstance() throws ObjectCreationException { - Object array = Array.newInstance(interfaceType, factories.length); - for (int i = 0; i < factories.length; i++) { - Array.set(array, i, factories[i].getInstance()); - } - return array; - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java deleted file mode 100644 index 178d3d4de6..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/AssemblyVisitorImpl.java +++ /dev/null @@ -1,63 +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.builder.impl; - -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.model.assembly.AssemblyObject; -import org.apache.tuscany.model.assembly.AssemblyVisitor; -import org.apache.tuscany.model.assembly.ContextFactoryHolder; - -import java.util.List; - -/** - * Decorates an assembly object graph with runtime configurations using a set of builders - * - * @version $Rev: 392146 $ $Date: 2006-04-06 18:11:28 -0700 (Thu, 06 Apr 2006) $ - */ -public class AssemblyVisitorImpl implements AssemblyVisitor { - - private List<ContextFactoryBuilder> builders; - - /** - * Constructs a visitor - * - * @param builders the collection of builders for creating context factories - */ - public AssemblyVisitorImpl(List<ContextFactoryBuilder> builders) { - this.builders = builders; - } - - /** - * Initiate walking the object graph - */ - public boolean start(AssemblyObject modelObject) { - return modelObject.accept(this); - } - - /** - * Callback when walking the graph - */ - public boolean visit(AssemblyObject modelObject) { - if (modelObject instanceof ContextFactoryHolder){ - if (((ContextFactoryHolder)modelObject).getContextFactory() != null){ - return true; // HACK FIX for TUSCANY 249 - } - } - for (ContextFactoryBuilder builder : builders) { - builder.build(modelObject); - } - return true; - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java deleted file mode 100644 index d500b2e503..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ContextFactoryBuilderRegistryImpl.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * - * Copyright 2006 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.builder.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.core.builder.ContextFactoryBuilderRegistry; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; - -/** - * @version $Rev$ $Date$ - */ -public class ContextFactoryBuilderRegistryImpl implements ContextFactoryBuilderRegistry { - - private final List<ContextFactoryBuilder> builders = new ArrayList<ContextFactoryBuilder>(); - - public void register(ContextFactoryBuilder builder) { - builders.add(builder); - } - - public List<ContextFactoryBuilder> getBuilders() { - return builders; - } -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.java deleted file mode 100644 index 5243c2a8cd..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/DefaultWireBuilder.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.builder.impl; - -import org.apache.tuscany.core.builder.BuilderConfigException; -import org.apache.tuscany.core.builder.HierarchicalWireBuilder; -import org.apache.tuscany.core.builder.WireBuilder; -import org.apache.tuscany.core.context.ScopeContext; -import org.apache.tuscany.core.wire.TargetInvocationConfiguration; -import org.apache.tuscany.core.wire.SourceInvocationConfiguration; -import org.apache.tuscany.core.wire.TargetWireFactory; -import org.apache.tuscany.core.wire.SourceWireFactory; -import org.apache.tuscany.core.wire.impl.InvokerInterceptor; -import org.apache.tuscany.core.wire.impl.MessageChannelImpl; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * The top-most <code>WireBuilder</code> configured in a runtime. Responsible for constructing wires from source and target chains, - * this implementation first bridges the chains and then delegates to any other wire builders. - * - * @version $Rev$ $Date$ - */ -public class DefaultWireBuilder implements HierarchicalWireBuilder { - - // collection configured wire builders - private List<WireBuilder> builders = new ArrayList<WireBuilder>(); - - public DefaultWireBuilder() { - } - - /** - * Adds a wire builder to delegate to - */ - public void addWireBuilder(WireBuilder builder) { - builders.add(builder); - } - - public void connect(SourceWireFactory<?> sourceFactory, TargetWireFactory<?> targetFactory, Class targetType, boolean downScope, - ScopeContext targetScopeContext) { - // get the proxy chain for the target - if (targetFactory != null) { - // if null, the target side has no interceptors or handlers - Map<Method, TargetInvocationConfiguration> targetInvocationConfigs = targetFactory.getConfiguration().getInvocationConfigurations(); - for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration() - .getInvocationConfigurations().values()) { - // match wire chains - TargetInvocationConfiguration targetInvocationConfig = targetInvocationConfigs.get(sourceInvocationConfig.getMethod()); - if (targetInvocationConfig == null){ - BuilderConfigException e= new BuilderConfigException("Incompatible source and target interface types for reference"); - //FIXME xcv - e.setIdentifier(sourceFactory.getConfiguration().getReferenceName()); - throw e; - } - // if handler is configured, add that - if (targetInvocationConfig.getRequestHandlers() != null) { - sourceInvocationConfig.setTargetRequestChannel(new MessageChannelImpl(targetInvocationConfig - .getRequestHandlers())); - sourceInvocationConfig.setTargetResponseChannel(new MessageChannelImpl(targetInvocationConfig - .getResponseHandlers())); - } else { - // no handlers, just connect interceptors - if (targetInvocationConfig.getHeadInterceptor() == null) { - BuilderConfigException e = new BuilderConfigException("No target handler or interceptor for operation"); - e.setIdentifier(targetInvocationConfig.getMethod().getName()); - throw e; - } - //xcv if (!(sourceInvocationConfig.getLastTargetInterceptor() instanceof InvokerInterceptor && targetInvocationConfig - if (!(sourceInvocationConfig.getTailInterceptor() instanceof InvokerInterceptor && targetInvocationConfig - .getHeadInterceptor() instanceof InvokerInterceptor)) { - // check that we do not have the case where the only interceptors are invokers since we just need one - sourceInvocationConfig.setTargetInterceptor(targetInvocationConfig.getHeadInterceptor()); - } - } - } - } - // delegate to other wire builders - for (WireBuilder builder : builders) { - builder.connect(sourceFactory, targetFactory, targetType, downScope, targetScopeContext); - } - // signal that wire buildSource process is complete - for (SourceInvocationConfiguration sourceInvocationConfig : sourceFactory.getConfiguration().getInvocationConfigurations() - .values()) { - sourceInvocationConfig.build(); - // TODO optimize if no proxy needed using NullWireFactory - } - } - - public void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) - throws BuilderConfigException { - // delegate to other wire builders - for (WireBuilder builder : builders) { - builder.completeTargetChain(targetFactory, targetType, targetScopeContext); - } - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java deleted file mode 100644 index ffab32bd37..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/HierarchicalBuilder.java +++ /dev/null @@ -1,57 +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.builder.impl; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.ContextFactoryBuilder; -import org.apache.tuscany.model.assembly.AssemblyObject; - -import java.util.Collections; -import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; - -/** - * A builder that contains nested builders. Used for synchronizing parts of the buildSource process, such as references. - * - * @version $Rev$ $Date$ - */ -public class HierarchicalBuilder implements ContextFactoryBuilder { - private List<ContextFactoryBuilder> builders = new CopyOnWriteArrayList<ContextFactoryBuilder>(); - - private List<ContextFactoryBuilder> readOnlyBuilders = Collections.unmodifiableList(builders); - - public HierarchicalBuilder() { - } - - public void addBuilder(ContextFactoryBuilder builder) { - builders.add(builder); - } - - public void removeBuilder(ContextFactoryBuilder builder){ - builders.remove(builder); - } - - public List getBuilders(){ - return readOnlyBuilders; - } - - public void build(AssemblyObject object) throws BuilderException { - for (ContextFactoryBuilder builder : builders) { - builder.build(object); - } - - } - - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java deleted file mode 100644 index 5d37eb8e89..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ListMultiplicityObjectFactory.java +++ /dev/null @@ -1,45 +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.builder.impl; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.injection.ObjectCreationException; - -import java.util.ArrayList; -import java.util.List; - -/** - * Resolves targets configured in a multiplicity by delegating to object factories and returning an - * <code>List</code> containing object instances - * - * @version $Rev$ $Date$ - */ -public class ListMultiplicityObjectFactory implements ObjectFactory<List> { - - private ObjectFactory[] factories; - - public ListMultiplicityObjectFactory(List<ObjectFactory> factories) { - assert (factories != null) : "Object factories were null"; - this.factories = factories.toArray(new ObjectFactory[factories.size()]); - } - - public List getInstance() throws ObjectCreationException { - List<Object> list = new ArrayList<Object>(); - for (ObjectFactory factory : factories) { - list.add(factory.getInstance()); - } - return list; - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.java deleted file mode 100644 index 1dc6627306..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/impl/ProxyObjectFactory.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.builder.impl; - -import org.apache.tuscany.core.builder.ObjectFactory; -import org.apache.tuscany.core.injection.ObjectCreationException; -import org.apache.tuscany.core.wire.ProxyCreationException; -import org.apache.tuscany.core.wire.WireFactory; - -/** - * Uses a proxy factory to return an object instance - * - * @version $Rev$ $Date$ - */ -public class ProxyObjectFactory implements ObjectFactory { - - private WireFactory factory; - - public ProxyObjectFactory(WireFactory factory) { - this.factory = factory; - } - - public Object getInstance() throws ObjectCreationException { - try { - return factory.createProxy(); - } catch (ProxyCreationException e) { - throw new ObjectCreationException(e); - } - } - -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.java deleted file mode 100644 index 4c53a2c830..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/DefaultPolicyBuilderRegistry.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.builder.system; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.SourcePolicyBuilder; -import org.apache.tuscany.core.builder.SourcePolicyOrderer; -import org.apache.tuscany.core.builder.TargetPolicyBuilder; -import org.apache.tuscany.core.builder.TargetPolicyOrderer; -import org.apache.tuscany.core.system.annotation.Autowire; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; -import org.osoa.sca.annotations.Scope; -import org.osoa.sca.annotations.Service; - -import java.util.ArrayList; -import java.util.List; - -/** - * A system service that serves as the default implementation of a policy builder registry - * - * @version $$Rev$$ $$Date$$ - */ - -@Scope("MODULE") -@Service(interfaces = {PolicyBuilderRegistry.class}) -public class DefaultPolicyBuilderRegistry implements PolicyBuilderRegistry { - - private final List<SourcePolicyBuilder> sourceBuilders = new ArrayList<SourcePolicyBuilder>(); - private final List<TargetPolicyBuilder> targetBuilders = new ArrayList<TargetPolicyBuilder>(); - - private TargetPolicyOrderer targetOrderer; - - private SourcePolicyOrderer sourceOrderer; - - @Autowire - public void setTargetOrderer(TargetPolicyOrderer orderer) { - this.targetOrderer = orderer; - } - - @Autowire - public void setSourceOrderer(SourcePolicyOrderer orderer) { - this.sourceOrderer = orderer; - } - - public void registerTargetBuilder(TargetPolicyBuilder builder) { - targetBuilders.add(builder); - } - - public void unregisterTargetBuilder(TargetPolicyBuilder builder) { - targetBuilders.remove(builder); - } - - public void registerSourceBuilder(SourcePolicyBuilder builder) { - sourceBuilders.add(builder); - } - - public void unregisterSourceBuilder(SourcePolicyBuilder builder) { - sourceBuilders.remove(builder); - } - - public List<TargetPolicyBuilder> getTargetBuilders() { - return targetBuilders; - } - - public List<SourcePolicyBuilder> getSourceBuilders() { - return sourceBuilders; - } - - public void buildSource(ConfiguredReference reference, List<WireSourceConfiguration> configurations) throws BuilderException { - for (SourcePolicyBuilder builder : sourceBuilders) { - builder.build(reference, configurations); - } - if (sourceOrderer != null) { - for (WireSourceConfiguration configuration : configurations) { - sourceOrderer.order(configuration); - } - } - } - - public void buildTarget(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException { - for (TargetPolicyBuilder builder : targetBuilders) { - builder.build(service, configuration); - } - if (targetOrderer != null) { - targetOrderer.order(configuration); - } - } -} diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java deleted file mode 100644 index fb9b0b25db..0000000000 --- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/builder/system/PolicyBuilderRegistry.java +++ /dev/null @@ -1,92 +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.builder.system; - -import org.apache.tuscany.core.builder.BuilderException; -import org.apache.tuscany.core.builder.SourcePolicyBuilder; -import org.apache.tuscany.core.builder.TargetPolicyBuilder; -import org.apache.tuscany.core.wire.WireSourceConfiguration; -import org.apache.tuscany.core.wire.WireTargetConfiguration; -import org.apache.tuscany.model.assembly.ConfiguredReference; -import org.apache.tuscany.model.assembly.ConfiguredService; - -import java.util.List; - -/** - * A System registry for {@link org.apache.tuscany.core.builder.PolicyBuilder}s. <code>PolicyBuilder</code>s will be invoked when - * a {@link org.apache.tuscany.core.wire.WireFactory} is constructed by the {@link org.apache.tuscany.core.wire.WireFactory} - * service. - * <p/> - * <code>PolicyBuilder</code>s operate on either a source- or target-side wire and typically are registered by runtime extensions - * through {@link #registerTargetBuilder} or {@link #registerSourceBuilder} - * - * @version $Rev$ $Date$ - */ -public interface PolicyBuilderRegistry { - - /** - * Registers a target-side policy builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - public void registerTargetBuilder(TargetPolicyBuilder builder); - - /** - * De-registers a target-side builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - public void unregisterTargetBuilder(TargetPolicyBuilder builder); - - /** - * Registers a source-side policy builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - public void registerSourceBuilder(SourcePolicyBuilder builder); - - /** - * De-registers a source-side builder. Called by extensions to register their builders. - * - * @param builder the builder to register - */ - public void unregisterSourceBuilder(SourcePolicyBuilder builder); - - /** - * Returns the list of registered target-side builders - */ - public List<TargetPolicyBuilder> getTargetBuilders(); - - /** - * Returns the list of registered source-side builders - */ - public List<SourcePolicyBuilder> getSourceBuilders(); - - /** - * Evaluates source-side policy metadata for configured reference and updates the curresponding collection of wire configurations - * - * @throws BuilderException - */ - public void buildSource(ConfiguredReference reference, List<WireSourceConfiguration> configurations) throws BuilderException; - - /** - * Evaluates target-side policy metadata for configured reference and updates the curresponding collection of wire configurations - * - * @throws BuilderException - */ - public void buildTarget(ConfiguredService service, WireTargetConfiguration configuration) throws BuilderException; -} |