summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder')
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java50
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderContext.java106
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderExtensionPoint.java118
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java51
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java45
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java400
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ImplementationBuilder.java49
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Messages.java30
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/PolicyBuilder.java73
-rw-r--r--java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/WireBuilder.java39
10 files changed, 0 insertions, 961 deletions
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java
deleted file mode 100644
index 973bc987c7..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Contract;
-
-/**
- * A builder that handles any build-time configuration needed by bindings.
- *
- * @version $Rev$ $Date$
- */
-public interface BindingBuilder<B extends Binding> {
-
- /**
- * Configure a binding.
- *
- * @param component The component for the binding's service or reference
- * @param contract The binding's service or reference
- * @param context The context for the builder
- */
- void build(Component component, Contract contract, B binding, BuilderContext context);
-
- /**
- * Get QName of the binding type
- * @return The binding type
- */
- QName getBindingType();
-
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderContext.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderContext.java
deleted file mode 100644
index 7deca4486a..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderContext.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.definitions.Definitions;
-import org.apache.tuscany.sca.monitor.DefaultMonitorFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-
-/**
- * Context for builders
- */
-public class BuilderContext {
- protected Definitions definitions;
- protected Map<QName, List<String>> bindingBaseURIs = Collections.emptyMap();
- protected Monitor monitor;
-
- /**
- * @param definitions
- * @param bindingBaseURIs
- * @param monitor
- */
- public BuilderContext(Definitions definitions, Map<QName, List<String>> bindingBaseURIs, Monitor monitor) {
- super();
- this.definitions = definitions;
- if (bindingBaseURIs != null) {
- this.bindingBaseURIs = bindingBaseURIs;
- }
- this.monitor = monitor;
- }
-
- /**
- * Create a builder context with the monitor
- * @param monitor
- */
- public BuilderContext(Monitor monitor) {
- super();
- this.monitor = monitor;
- }
-
- /**
- * Create a builder context with the extension point registry
- * @param registry
- */
- public BuilderContext(ExtensionPointRegistry registry) {
- super();
- MonitorFactory monitorFactory =
- registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(MonitorFactory.class);
- this.monitor = monitorFactory.createMonitor();
- }
-
- /**
- * Create a builder context with a default monitor
- */
- public BuilderContext() {
- super();
- this.monitor = new DefaultMonitorFactory().createMonitor();
- }
-
- public Monitor getMonitor() {
- return monitor;
- }
-
- public Monitor setMonitor(Monitor monitor) {
- Monitor old = this.monitor;
- this.monitor = monitor;
- return old;
- }
-
- public Definitions getDefinitions() {
- return definitions;
- }
-
- public Map<QName, List<String>> getBindingBaseURIs() {
- return bindingBaseURIs;
- }
-
- public void setDefinitions(Definitions definitions) {
- this.definitions = definitions;
- }
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderExtensionPoint.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderExtensionPoint.java
deleted file mode 100644
index ae526b92a1..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BuilderExtensionPoint.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-
-/**
- * An extension point for Composite builders.
- *
- * @version $Rev$ $Date$
- */
-public interface BuilderExtensionPoint {
-
- /**
- * Adds a composite builder.
- *
- * @param compositeBuilder
- */
- void addCompositeBuilder(CompositeBuilder compositeBuilder);
-
- /**
- * Removes a composite builder.
- *
- * @param compositeBuilder
- */
- void removeCompositeBuilder(CompositeBuilder compositeBuilder);
-
- /**
- * Returns the composite builder with the given id.
- *
- * @param id
- * @return
- */
- CompositeBuilder getCompositeBuilder(String id);
-
- /**
- * Add a binding builder
- * @param bindingBuilder
- */
- void addBindingBuilder(BindingBuilder<?> bindingBuilder);
-
- /**
- * Look up a binding builder by the binding type
- * @param <B>
- * @param bindingType
- * @return
- */
- <B extends Binding> BindingBuilder<B> getBindingBuilder(QName bindingType);
-
- /**
- * Remove a binding builder
- * @param <B>
- * @param builder
- */
- <B extends Binding> void removeBindingBuilder(BindingBuilder<B> builder);
-
- /**
- * Add an implementation builder
- * @param implementationBuilder
- */
- void addImplementationBuilder(ImplementationBuilder<?> implementationBuilder);
-
- /**
- * Look up an implementation builder by implementation type
- * @param <I>
- * @param implementationType
- * @return
- */
- <I extends Implementation> ImplementationBuilder<I> getImplementationBuilder(QName implementationType);
-
- /**
- * Remove an implementation builder
- * @param <I>
- * @param builder
- */
- <I extends Implementation> void removeImplementationBuilder(ImplementationBuilder<I> builder);
-
- /**
- * Add a policy builder
- * @param policyBuilder
- */
- void addPolicyBuilder(PolicyBuilder<?> policyBuilder);
-
- /**
- * Look up a Policy builder by the Policy type
- * @param <P>
- * @param policyType
- * @return
- */
- <P> PolicyBuilder<P> getPolicyBuilder(QName policyType);
-
- /**
- * Remove a Policy builder
- * @param <P>
- * @param builder
- */
- <P> void removePolicyBuilder(PolicyBuilder<P> builder);
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
deleted file mode 100644
index 50bf10f54a..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import org.apache.tuscany.sca.assembly.Composite;
-
-/**
- * A builder that handles the configuration of the components inside a
- * composite and the wiring of component references to component services.
- *
- * @version $Rev$ $Date$
- */
-public interface CompositeBuilder {
-
- /**
- * Returns the ID of the builder.
- *
- * @return An ID that identifies the builder
- */
- String getID();
-
- /**
- * Build a composite.
- *
- * @param composite The composite
- * @param context The builder context
- * @return The composite built from the original one. In most cases, it is the same as the orginal one as
- * most builders only change the content of the composite.
- *
- * @throws CompositeBuilderException
- */
- Composite build(Composite composite, BuilderContext context) throws CompositeBuilderException;
-
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
deleted file mode 100644
index 5a2015f55e..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-/**
- * Reports a composite builder exception.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeBuilderException extends Exception {
- private static final long serialVersionUID = -8916323176803443856L;
-
- public CompositeBuilderException() {
- }
-
- public CompositeBuilderException(String message) {
- super(message);
- }
-
- public CompositeBuilderException(Throwable cause) {
- super(cause);
- }
-
- public CompositeBuilderException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java
deleted file mode 100644
index 2d0a4b91ee..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultBuilderExtensionPoint.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import java.lang.reflect.Constructor;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.core.LifeCycleListener;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDeclarationParser;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-
-/**
- * Default implementation of a provider factory extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultBuilderExtensionPoint implements BuilderExtensionPoint, LifeCycleListener {
-
- private ExtensionPointRegistry registry;
- private final Map<String, CompositeBuilder> builders = new HashMap<String, CompositeBuilder>();
- private final Map<QName, BindingBuilder> bindingBuilders = new HashMap<QName, BindingBuilder>();
- private final Map<QName, ImplementationBuilder> implementationBuilders =
- new HashMap<QName, ImplementationBuilder>();
- private final Map<QName, PolicyBuilder> policyBuilders = new HashMap<QName, PolicyBuilder>();
-
- private boolean loaded;
-
- public DefaultBuilderExtensionPoint(ExtensionPointRegistry registry) {
- this.registry = registry;
- }
-
- public void start() {
- }
-
- public void stop() {
- builders.clear();
- bindingBuilders.clear();
- implementationBuilders.clear();
- loaded = false;
- }
-
- public void addCompositeBuilder(CompositeBuilder builder) {
- builders.put(builder.getID(), builder);
- }
-
- public void removeCompositeBuilder(CompositeBuilder builder) {
- builders.remove(builder.getID());
- }
-
- public CompositeBuilder getCompositeBuilder(String id) {
- loadBuilders();
- return builders.get(id);
- }
-
- /**
- * Load builders declared under META-INF/services.
- */
- private synchronized void loadBuilders() {
- if (loaded)
- return;
-
- FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
-
- UtilityExtensionPoint utils = registry.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utils.getUtility(InterfaceContractMapper.class);
-
- // Get the provider factory service declarations
- Collection<ServiceDeclaration> builderDeclarations;
- ServiceDiscovery serviceDiscovery = registry.getServiceDiscovery();
- try {
- builderDeclarations = serviceDiscovery.getServiceDeclarations(CompositeBuilder.class.getName());
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
-
- for (ServiceDeclaration builderDeclaration : builderDeclarations) {
- Map<String, String> attributes = builderDeclaration.getAttributes();
- String id = attributes.get("id");
-
- CompositeBuilder builder = new LazyCompositeBuilder(id, builderDeclaration, this, factories, mapper);
- builders.put(id, builder);
- }
-
- try {
- builderDeclarations = serviceDiscovery.getServiceDeclarations(BindingBuilder.class);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
-
- for (ServiceDeclaration builderDeclaration : builderDeclarations) {
- BindingBuilder<?> builder = new LazyBindingBuilder(builderDeclaration);
- bindingBuilders.put(builder.getBindingType(), builder);
- }
-
- try {
- builderDeclarations = serviceDiscovery.getServiceDeclarations(ImplementationBuilder.class);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
-
- for (ServiceDeclaration builderDeclaration : builderDeclarations) {
- ImplementationBuilder<?> builder = new LazyImplementationBuilder(builderDeclaration);
- implementationBuilders.put(builder.getImplementationType(), builder);
- }
-
- try {
- builderDeclarations = serviceDiscovery.getServiceDeclarations(PolicyBuilder.class);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
-
- for (ServiceDeclaration builderDeclaration : builderDeclarations) {
- PolicyBuilder<?> builder = new LazyPolicyBuilder(builderDeclaration);
- policyBuilders.put(builder.getPolicyType(), builder);
- }
-
-
- loaded = true;
-
- }
-
- public void addBindingBuilder(BindingBuilder<?> bindingBuilder) {
- bindingBuilders.put(bindingBuilder.getBindingType(), bindingBuilder);
- }
-
- public <B extends Binding> BindingBuilder<B> getBindingBuilder(QName bindingType) {
- loadBuilders();
- return (BindingBuilder<B>)bindingBuilders.get(bindingType);
- }
-
- public <B extends Binding> void removeBindingBuilder(BindingBuilder<B> builder) {
- bindingBuilders.remove(builder.getBindingType());
- }
-
- public void addImplementationBuilder(ImplementationBuilder<?> implementationBuilder) {
- implementationBuilders.put(implementationBuilder.getImplementationType(), implementationBuilder);
- }
-
- public <I extends Implementation> ImplementationBuilder<I> getImplementationBuilder(QName implementationType) {
- loadBuilders();
- return (ImplementationBuilder<I>)implementationBuilders.get(implementationType);
- }
-
- public <I extends Implementation> void removeImplementationBuilder(ImplementationBuilder<I> builder) {
- implementationBuilders.remove(builder.getImplementationType());
- }
-
- public void addPolicyBuilder(PolicyBuilder<?> policyBuilder) {
- policyBuilders.put(policyBuilder.getPolicyType(), policyBuilder);
- }
-
- public <B> PolicyBuilder<B> getPolicyBuilder(QName policyType) {
- loadBuilders();
- return (PolicyBuilder<B>)policyBuilders.get(policyType);
- }
-
- public <B> void removePolicyBuilder(PolicyBuilder<B> builder) {
- policyBuilders.remove(builder.getPolicyType());
- }
-
- /**
- * A wrapper around a composite builder allowing lazy
- * loading and initialization of implementation providers.
- */
- private class LazyCompositeBuilder implements CompositeBuilder {
-
- private FactoryExtensionPoint factories;
- private InterfaceContractMapper mapper;
- private String id;
- private ServiceDeclaration builderDeclaration;
- private CompositeBuilder builder;
- private BuilderExtensionPoint builders;
-
- private LazyCompositeBuilder(String id,
- ServiceDeclaration factoryDeclaration,
- BuilderExtensionPoint builders,
- FactoryExtensionPoint factories,
- InterfaceContractMapper mapper) {
- this.id = id;
- this.builderDeclaration = factoryDeclaration;
- this.builders = builders;
- this.factories = factories;
- this.mapper = mapper;
- }
-
- public String getID() {
- return id;
- }
-
- public Composite build(Composite composite, BuilderContext context)
- throws CompositeBuilderException {
- return getBuilder().build(composite, context);
- }
-
- private CompositeBuilder getBuilder() {
- if (builder == null) {
- try {
- Class<CompositeBuilder> builderClass = (Class<CompositeBuilder>)builderDeclaration.loadClass();
- try {
- Constructor<CompositeBuilder> constructor =
- builderClass.getConstructor(FactoryExtensionPoint.class, InterfaceContractMapper.class);
- builder = constructor.newInstance(factories, mapper);
- } catch (NoSuchMethodException e) {
- try {
- Constructor<CompositeBuilder> constructor =
- builderClass.getConstructor(BuilderExtensionPoint.class,
- FactoryExtensionPoint.class,
- InterfaceContractMapper.class);
- builder = constructor.newInstance(builders, factories, mapper);
- } catch (NoSuchMethodException ex) {
- Constructor<CompositeBuilder> constructor =
- builderClass.getConstructor(ExtensionPointRegistry.class);
- builder = constructor.newInstance(registry);
- }
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return builder;
- }
-
- }
-
- private class LazyBindingBuilder implements BindingBuilder {
- private ServiceDeclaration sd;
- private BindingBuilder<?> builder;
- private QName qname;;
-
- /**
- * @param sd
- */
- public LazyBindingBuilder(ServiceDeclaration sd) {
- super();
- this.sd = sd;
- this.qname = ServiceDeclarationParser.getQName(sd.getAttributes().get("qname"));
- }
-
- public void build(Component component, Contract contract, Binding binding, BuilderContext context) {
- getBuilder().build(component, contract, binding, context);
- }
-
- public QName getBindingType() {
- return qname;
- }
-
-
- private synchronized BindingBuilder getBuilder() {
- if (builder == null) {
- try {
- Class<?> builderClass = sd.loadClass();
- try {
- Constructor<?> constructor = builderClass.getConstructor(ExtensionPointRegistry.class);
- builder = (BindingBuilder)constructor.newInstance(registry);
- } catch (NoSuchMethodException e) {
- Constructor<?> constructor = builderClass.getConstructor();
- builder = (BindingBuilder)constructor.newInstance();
-
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return builder;
- }
-
- }
-
- private class LazyImplementationBuilder implements ImplementationBuilder {
- private ServiceDeclaration sd;
- private ImplementationBuilder<?> builder;
- private QName qname;;
-
- /**
- * @param sd
- */
- public LazyImplementationBuilder(ServiceDeclaration sd) {
- super();
- this.sd = sd;
- this.qname = ServiceDeclarationParser.getQName(sd.getAttributes().get("qname"));
- }
-
- public void build(Component component, Implementation implementation, BuilderContext context) {
- getBuilder().build(component, implementation, context);
- }
-
- public QName getImplementationType() {
- return qname;
- }
-
- private synchronized ImplementationBuilder getBuilder() {
- if (builder == null) {
- try {
- Class<?> builderClass = sd.loadClass();
- try {
- Constructor<?> constructor = builderClass.getConstructor(ExtensionPointRegistry.class);
- builder = (ImplementationBuilder)constructor.newInstance(registry);
- } catch (NoSuchMethodException e) {
- Constructor<?> constructor = builderClass.getConstructor();
- builder = (ImplementationBuilder)constructor.newInstance();
-
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return builder;
- }
-
- }
-
- private class LazyPolicyBuilder implements PolicyBuilder {
- private ServiceDeclaration sd;
- private PolicyBuilder<?> builder;
- private QName qname;;
-
- /**
- * @param sd
- */
- public LazyPolicyBuilder(ServiceDeclaration sd) {
- super();
- this.sd = sd;
- this.qname = ServiceDeclarationParser.getQName(sd.getAttributes().get("qname"));
- }
-
- public boolean build(Component component, Implementation implementation, BuilderContext context) {
- return getBuilder().build(component, implementation, context);
- }
-
- public QName getPolicyType() {
- return qname;
- }
-
- private synchronized PolicyBuilder getBuilder() {
- if (builder == null) {
- try {
- Class<?> builderClass = sd.loadClass();
- try {
- Constructor<?> constructor = builderClass.getConstructor(ExtensionPointRegistry.class);
- builder = (PolicyBuilder)constructor.newInstance(registry);
- } catch (NoSuchMethodException e) {
- Constructor<?> constructor = builderClass.getConstructor();
- builder = (PolicyBuilder)constructor.newInstance();
-
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return builder;
- }
-
- public boolean build(Endpoint endpoint, BuilderContext context) {
- return getBuilder().build(endpoint, context);
- }
-
- public boolean build(org.apache.tuscany.sca.assembly.EndpointReference endpointReference, BuilderContext context) {
- return getBuilder().build(endpointReference, context);
- }
-
- public boolean build(EndpointReference endpointReference, Endpoint endpoint, BuilderContext context) {
- return getBuilder().build(endpointReference, endpoint, context);
- }
-
- }
-
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ImplementationBuilder.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ImplementationBuilder.java
deleted file mode 100644
index b1e22e195d..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ImplementationBuilder.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Implementation;
-
-/**
- * A builder that handles any build-time configuration needed by implementations.
- *
- * @version $Rev$ $Date$
- */
-public interface ImplementationBuilder<I extends Implementation> {
-
- /**
- * Configure a component implementation.
- *
- * @param component The component
- * @param context TODO
- * @param contract The implementation
- */
- void build(Component component, I implmentation, BuilderContext context);
-
- /**
- * Get the QName of the implementation type
- * @return
- */
- QName getImplementationType();
-
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Messages.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Messages.java
deleted file mode 100644
index d40d72ae98..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/Messages.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-/**
- * Constants for resource bundle names
- */
-public interface Messages {
- String RESOURCE_PACKAGE = "org.apache.tuscany.sca.assembly.builder.";
- String ASSEMBLY_VALIDATION = RESOURCE_PACKAGE + "assembly-validation-messages";
- String ASSEMBLY_CONFORMANCE = RESOURCE_PACKAGE + "assembly-conformance-messages";
- String DEFINITIONS_VALIDATION = RESOURCE_PACKAGE + "definitions-validation-messages";
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/PolicyBuilder.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/PolicyBuilder.java
deleted file mode 100644
index 56cf1f5590..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/PolicyBuilder.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-import org.apache.tuscany.sca.assembly.Implementation;
-
-/**
- * A builder that is contributed by a specific policy languange to validate the configurations
- * for SCA endpoints, endpoint references and component implementations
- */
-public interface PolicyBuilder<T> {
- /**
- * Get the policy type
- * @return
- */
- QName getPolicyType();
-
- /**
- * Build (and validate) the policy settings on the endpoint
- * @param endpoint
- * @param monitor
- * @return true if the policy setting is compatible
- */
- boolean build(Endpoint endpoint, BuilderContext context);
-
- /**
- * Build (and validate) the policy settings on the endpoint reference
- * @param endpointReference
- * @param monitor
- * @return true if the policy setting is compatible
- */
- boolean build(EndpointReference endpointReference, BuilderContext context);
-
- /**
- * Build (and validate) the policy settings on the component implementation
- * @param component
- * @param implementation
- * @param monitor
- * @return true if the policy setting is compatible
- */
- boolean build(Component component, Implementation implementation, BuilderContext context);
-
- /**
- * Build (and validate) the policy settings on the endpoint reference is compatible with the endpoint
- * @param endpointReference
- * @param endpoint
- * @param context
- * @return if the policy setting is compatible
- */
- boolean build(EndpointReference endpointReference, Endpoint endpoint, BuilderContext context);
-}
diff --git a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/WireBuilder.java b/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/WireBuilder.java
deleted file mode 100644
index 2bfbe85664..0000000000
--- a/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/WireBuilder.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointReference;
-
-/**
- * A builder that connects an endpoint reference to an endpoint
- */
-public interface WireBuilder {
- /**
- * Build the endpoint reference against the endpoint. If the endpoint is a valid target for the
- * endpoint reference, the wire buidler can populate some information from the endpoint into the
- * endpoint reference (such as targetEndpoint, policySets or requiredIntents)
- * @param endpointReference
- * @param endpoint
- * @param context
- * @return true if the endpoint is a valid target for the endpoint reference
- */
- boolean build(EndpointReference endpointReference, Endpoint endpoint, BuilderContext context);
-}