diff options
Diffstat (limited to 'branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java')
12 files changed, 0 insertions, 581 deletions
diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java deleted file mode 100644 index 28a5ecdc24..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/AssemblyBuilder.java +++ /dev/null @@ -1,37 +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.dsl; - - -public interface AssemblyBuilder { - - CompositeBuilder composite(String name); - - ComponentBuilder component(String name); - - ComponentReferenceBuilder reference(String name); - - ComponentServiceBuilder service(String name); - - ComponentPropertyBuilder property(String name); - - CompositeBuilder domain(String uri); - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java deleted file mode 100644 index 98f247e5cc..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentBuilder.java +++ /dev/null @@ -1,34 +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.dsl; - -public interface ComponentBuilder { - - ComponentBuilder implementedBy(Class clazz); - - ComponentBuilder implementedBy(CompositeBuilder composite); - - public ComponentBuilder uses(ComponentReferenceBuilder... componentReferences); - - public ComponentBuilder provides(ComponentServiceBuilder... componentServices); - - public ComponentBuilder declares(ComponentPropertyBuilder...componentProperties); - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java deleted file mode 100644 index 7f3c89fd2f..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentPropertyBuilder.java +++ /dev/null @@ -1,28 +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.dsl; - -public interface ComponentPropertyBuilder { - - ComponentPropertyBuilder ofType(String type); - - ComponentPropertyBuilder configuredTo(Object value); - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java deleted file mode 100644 index 8966a4be9d..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentReferenceBuilder.java +++ /dev/null @@ -1,36 +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.dsl; - -public interface ComponentReferenceBuilder { - - ComponentReferenceBuilder wiredTo(String target); - - ComponentReferenceBuilder wiredTo(ComponentServiceBuilder target); - - ComponentReferenceBuilder typedBy(Class interfaceClass); - - ComponentReferenceBuilder promotedAs(String promoted); - - ComponentReferenceBuilder promoted(); - - ComponentReferenceBuilder boundTo(String uri); - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java deleted file mode 100644 index f3e36e8c38..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/ComponentServiceBuilder.java +++ /dev/null @@ -1,32 +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.dsl; - -public interface ComponentServiceBuilder { - - ComponentServiceBuilder typedBy(Class interfaceClass); - - ComponentServiceBuilder promotedAs(String promoted); - - ComponentServiceBuilder promoted(); - - ComponentServiceBuilder boundTo(String uri); - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java deleted file mode 100644 index e2108b5ef8..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/CompositeBuilder.java +++ /dev/null @@ -1,29 +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.dsl; - - -public interface CompositeBuilder { - - CompositeBuilder contains(ComponentBuilder... components); - - CompositeBuilder includes(CompositeBuilder... includes); - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java deleted file mode 100644 index 0968310548..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/AssemblyBuilderImpl.java +++ /dev/null @@ -1,70 +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.dsl.impl; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; -import org.apache.tuscany.sca.assembly.dsl.AssemblyBuilder; -import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder; -import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder; -import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder; -import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder; -import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder; - -public class AssemblyBuilderImpl extends DefaultAssemblyFactory implements AssemblyBuilder { - - public ComponentBuilder component(String name) { - ComponentBuilderImpl component = new ComponentBuilderImpl(); - component.setName(name); - return component; - } - - public CompositeBuilder composite(String name) { - CompositeBuilderImpl composite = new CompositeBuilderImpl(); - //TODO handle namespace - composite.setName(new QName("", name)); - return composite; - } - - public CompositeBuilder domain(String uri) { - CompositeBuilderImpl composite = new CompositeBuilderImpl(); - composite.setName(new QName(uri, "")); - return composite; - } - - public ComponentPropertyBuilder property(String name) { - ComponentPropertyBuilderImpl property = new ComponentPropertyBuilderImpl(); - property.setName(name); - return property; - } - - public ComponentReferenceBuilder reference(String name) { - ComponentReferenceBuilderImpl reference = new ComponentReferenceBuilderImpl(this); - reference.setName(name); - return reference; - } - - public ComponentServiceBuilder service(String name) { - ComponentServiceBuilderImpl service = new ComponentServiceBuilderImpl(this); - service.setName(name); - return service; - } - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java deleted file mode 100644 index 9022b9d9e6..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentBuilderImpl.java +++ /dev/null @@ -1,74 +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.dsl.impl; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder; -import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder; -import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder; -import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder; -import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder; -import org.apache.tuscany.sca.assembly.impl.ComponentImpl; - -public class ComponentBuilderImpl extends ComponentImpl implements ComponentBuilder { - - public ComponentBuilderImpl() { - } - - public ComponentBuilder implementedBy(Class clazz) { - //FIXME support Java implementations - return this; - } - - public ComponentBuilder implementedBy(CompositeBuilder composite) { - setImplementation((Composite)composite); - return this; - } - - public ComponentBuilder uses(ComponentReferenceBuilder... componentReferences) { - List<ComponentReference> references = getReferences(); - for (ComponentReferenceBuilder componentReference: componentReferences) { - references.add((ComponentReference)componentReference); - } - return this; - } - - public ComponentBuilder provides(ComponentServiceBuilder... componentServices) { - List<ComponentService> services = getServices(); - for (ComponentServiceBuilder componentService: componentServices) { - services.add((ComponentService)componentService); - } - return this; - } - - public ComponentBuilder declares(ComponentPropertyBuilder...componentProperties) { - List<ComponentProperty> properties = getProperties(); - for (ComponentPropertyBuilder componentProperty: componentProperties) { - properties.add((ComponentProperty)componentProperty); - } - return this; - } - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java deleted file mode 100644 index 49f7cd46b2..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentPropertyBuilderImpl.java +++ /dev/null @@ -1,40 +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.dsl.impl; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.dsl.ComponentPropertyBuilder; -import org.apache.tuscany.sca.assembly.impl.ComponentPropertyImpl; - -public class ComponentPropertyBuilderImpl extends ComponentPropertyImpl implements ComponentPropertyBuilder { - - public ComponentPropertyBuilderImpl ofType(String type) { - //TODO handle namespace - this.setXSDType(new QName("", type)); - return this; - } - - public ComponentPropertyBuilderImpl configuredTo(Object value) { - this.setValue(value); - return this; - } - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java deleted file mode 100644 index d9aab9de22..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentReferenceBuilderImpl.java +++ /dev/null @@ -1,77 +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.dsl.impl; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.dsl.ComponentReferenceBuilder; -import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder; -import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl; -import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl; - -public class ComponentReferenceBuilderImpl extends ComponentReferenceImpl implements ComponentReferenceBuilder { - - private CompositeReference compositeReference; - private AssemblyFactory assemblyFactory; - - protected ComponentReferenceBuilderImpl(AssemblyFactory assemblyFactory) { - this.assemblyFactory = assemblyFactory; - } - - public ComponentReferenceBuilder wiredTo(String target) { - ComponentService componentService = assemblyFactory.createComponentService(); - componentService.setUnresolved(true); - componentService.setName(target); - getTargets().add(componentService); - return this; - } - - public ComponentReferenceBuilder wiredTo(ComponentServiceBuilder target) { - getTargets().add((ComponentServiceImpl)target); - return this; - } - - public ComponentReferenceBuilderImpl typedBy(Class interfaceClass) { - //FIXME support for Java interfaces - return this; - } - - public ComponentReferenceBuilderImpl promotedAs(String promoted) { - compositeReference = assemblyFactory.createCompositeReference(); - compositeReference.setName(promoted); - return this; - } - - public ComponentReferenceBuilderImpl promoted() { - compositeReference = assemblyFactory.createCompositeReference(); - compositeReference.setName(getName()); - return this; - } - - public ComponentReferenceBuilder boundTo(String uri) { - //TODO support bindings - return this; - } - - CompositeReference getCompositeReference() { - return compositeReference; - } -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java deleted file mode 100644 index 379429d17e..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/ComponentServiceBuilderImpl.java +++ /dev/null @@ -1,62 +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.dsl.impl; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.dsl.ComponentServiceBuilder; -import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl; - -public class ComponentServiceBuilderImpl extends ComponentServiceImpl implements ComponentServiceBuilder { - - private CompositeService compositeService; - private AssemblyFactory assemblyFactory; - - protected ComponentServiceBuilderImpl(AssemblyFactory assemblyFactory) { - this.assemblyFactory = assemblyFactory; - } - - public ComponentServiceBuilderImpl typedBy(Class interfaceClass) { - //FIXME support for Java interfaces - return this; - } - - public ComponentServiceBuilderImpl promotedAs(String promoted) { - compositeService = assemblyFactory.createCompositeService(); - compositeService.setName(promoted); - return this; - } - - public ComponentServiceBuilderImpl promoted() { - compositeService = assemblyFactory.createCompositeService(); - compositeService.setName(getName()); - return this; - } - - public ComponentServiceBuilder boundTo(String uri) { - // TODO support bindings - return this; - } - - CompositeService getCompositeService() { - return compositeService; - } - -} diff --git a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java b/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java deleted file mode 100644 index 709562cd72..0000000000 --- a/branches/sca-java-1.2/modules/assembly-java-dsl/src/main/java/org/apache/tuscany/sca/assembly/dsl/impl/CompositeBuilderImpl.java +++ /dev/null @@ -1,62 +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.dsl.impl; - -import java.util.List; - -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.dsl.ComponentBuilder; -import org.apache.tuscany.sca.assembly.dsl.CompositeBuilder; -import org.apache.tuscany.sca.assembly.impl.CompositeImpl; - -public class CompositeBuilderImpl extends CompositeImpl implements CompositeBuilder { - - public CompositeBuilder contains(ComponentBuilder... componentBuilders) { - List<Component> components = getComponents(); - for (ComponentBuilder componentBuilder: componentBuilders) { - Component component = (Component)componentBuilder; - components.add(component); - - for (ComponentService componentService: component.getServices()) { - ComponentServiceBuilderImpl builder = (ComponentServiceBuilderImpl)componentService; - if (builder.getCompositeService() != null) - getServices().add(builder.getCompositeService()); - } - for (ComponentReference componentReference: component.getReferences()) { - ComponentReferenceBuilderImpl builder = (ComponentReferenceBuilderImpl)componentReference; - if (builder.getCompositeReference() != null) - getReferences().add(builder.getCompositeReference()); - } - } - return this; - } - - public CompositeBuilder includes(CompositeBuilder... compositeBuilders) { - List<Composite> list = getIncludes(); - for (CompositeBuilder composite: compositeBuilders) { - list.add((Composite)composite); - } - return this; - } - -} |