You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/06/13 20:55:01 UTC
svn commit: r547001 - in /incubator/tuscany/java/sca/modules/topology/src:
main/java/org/ main/java/org/apache/ main/java/org/apache/tuscany/
main/java/org/apache/tuscany/sca/ main/java/org/apache/tuscany/sca/topology/
main/java/org/apache/tuscany/sca/...
Author: jsdelfino
Date: Wed Jun 13 11:54:59 2007
New Revision: 547001
URL: http://svn.apache.org/viewvc?view=rev&rev=547001
Log:
Strawman of a minimal topology model.
Added:
incubator/tuscany/java/sca/modules/topology/src/main/java/org/
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/ProcessorImplementation.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ProcessorImplementationImpl.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java (with props)
incubator/tuscany/java/sca/modules/topology/src/test/java/org/
incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/
incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/
incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/
incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/
incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java (with props)
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java?view=auto&rev=547001
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java Wed Jun 13 11:54:59 2007
@@ -0,0 +1,31 @@
+/*
+ * 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.topology;
+
+import org.apache.tuscany.sca.topology.impl.TopologyFactoryImpl;
+
+/**
+ * A default factory for the topology model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultTopologyFactory extends TopologyFactoryImpl implements TopologyFactory {
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/ProcessorImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/ProcessorImplementation.java?view=auto&rev=547001
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/ProcessorImplementation.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/ProcessorImplementation.java Wed Jun 13 11:54:59 2007
@@ -0,0 +1,41 @@
+/*
+ * 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.topology;
+
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * Represents an SCA processor implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface ProcessorImplementation extends Implementation {
+
+ /**
+ * A list containing the SCA components allocated to this processor.
+ * @return a list of SCA components allocated to this processor
+ */
+
+ List<Component> getComponents();
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/ProcessorImplementation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/ProcessorImplementation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java?view=auto&rev=547001
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java Wed Jun 13 11:54:59 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.topology;
+
+/**
+ * A factory for the topology model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TopologyFactory {
+
+ /**
+ * Creates a new processor implementation.
+ * @return
+ */
+ ProcessorImplementation createProcessorImplementation();
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ProcessorImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ProcessorImplementationImpl.java?view=auto&rev=547001
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ProcessorImplementationImpl.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ProcessorImplementationImpl.java Wed Jun 13 11:54:59 2007
@@ -0,0 +1,110 @@
+/*
+ * 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.topology.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.topology.ProcessorImplementation;
+
+/**
+ * Represents an SCA processor component implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ProcessorImplementationImpl implements ProcessorImplementation {
+
+ private List<Component> components = new ArrayList<Component>();
+ private List<Property> properties = new ArrayList<Property>();
+ private List<Service> services = new ArrayList<Service>();
+ private List<Reference> references = new ArrayList<Reference>();
+ private ConstrainingType constrainingType;
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<Object> extensions = new ArrayList<Object>();
+ private boolean unresolved;
+ private String uri;
+
+ /**
+ * Constructs a new processor implementation.
+ */
+ protected ProcessorImplementationImpl() {
+ }
+
+ public List<Component> getComponents() {
+ return components;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public List<Reference> getReferences() {
+ return references;
+ }
+
+ public String getURI() {
+ return uri;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ public boolean isUnresolved() {
+ return unresolved;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ this.unresolved = unresolved;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ProcessorImplementationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ProcessorImplementationImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java?view=auto&rev=547001
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java Wed Jun 13 11:54:59 2007
@@ -0,0 +1,36 @@
+/*
+ * 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.topology.impl;
+
+import org.apache.tuscany.sca.topology.ProcessorImplementation;
+import org.apache.tuscany.sca.topology.TopologyFactory;
+
+/**
+ * A factory for the topology model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TopologyFactoryImpl implements TopologyFactory {
+
+ public ProcessorImplementation createProcessorImplementation() {
+ return new ProcessorImplementationImpl();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java?view=auto&rev=547001
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java Wed Jun 13 11:54:59 2007
@@ -0,0 +1,102 @@
+/*
+ * 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.topology;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+
+import junit.framework.TestCase;
+
+
+/**
+ * Test building of assembly model instances using the assembly factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TopologyFactoryTestCase extends TestCase {
+
+ TopologyFactory factory;
+ AssemblyFactory assemblyFactory;
+
+ Component calculatorServiceComponent;
+ Component addServiceComponent;
+ Component subtractServiceComponent;
+
+ public void setUp() throws Exception {
+ factory = new DefaultTopologyFactory();
+ assemblyFactory = new DefaultAssemblyFactory();
+
+ // Create test components, they would normally be given from an SCA domain
+ calculatorServiceComponent = assemblyFactory.createComponent();
+ calculatorServiceComponent.setName("CalculatorServiceComponent");
+ addServiceComponent = assemblyFactory.createComponent();
+ addServiceComponent.setName("AddServiceComponent");
+ subtractServiceComponent = assemblyFactory.createComponent();
+ subtractServiceComponent.setName("SubtractServiceComponent");
+ }
+
+ public void tearDown() throws Exception {
+ factory = null;
+ assemblyFactory = null;
+ calculatorServiceComponent = null;
+ addServiceComponent = null;
+ subtractServiceComponent = null;
+ }
+
+ public void testCreateTopology() {
+
+ // Create a new topology composition
+ Composite topology = assemblyFactory.createComposite();
+ topology.setName(new QName("http://my.network", "MyTopology"));
+
+ // Create SCA processor A implementation
+ // Configure it to run CalculatorServiceComponent
+ ProcessorImplementation implA = factory.createProcessorImplementation();
+ implA.getComponents().add(calculatorServiceComponent);
+
+ // Create SCA processor B implementation
+ // Configure it to run Add and SubtractServiceComponent
+ ProcessorImplementation implB = factory.createProcessorImplementation();
+ implB.getComponents().add(addServiceComponent);
+ implB.getComponents().add(subtractServiceComponent);
+
+ // Create SCA processor A
+ Component processorA = assemblyFactory.createComponent();
+ processorA.setName("ProcessorA");
+ processorA.setImplementation(implA);
+ topology.getComponents().add(processorA);
+
+// // Create SCA processor APrime
+// Component processorAPrime = assemblyFactory.createComponent();
+// processorAPrime.setName("ProcessorAPrime");
+// processorAPrime.setImplementation(implA);
+// topology.getComponents().add(processorAPrime);
+
+ // Create SCA processor B
+ Component processorB = assemblyFactory.createComponent();
+ processorB.setName("ProcessorB");
+ processorB.setImplementation(implB);
+ topology.getComponents().add(processorB);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org