You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/06/19 15:50:01 UTC
svn commit: r548726 - in /incubator/tuscany/java/sca/modules/topology/src:
main/java/org/apache/tuscany/sca/topology/
main/java/org/apache/tuscany/sca/topology/impl/
test/java/org/apache/tuscany/sca/topology/
Author: slaws
Date: Tue Jun 19 06:49:59 2007
New Revision: 548726
URL: http://svn.apache.org/viewvc?view=rev&rev=548726
Log:
Add the model that describes how schemes and components are assigned to nodes
TUSCANY-1338
Added:
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java (with props)
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java (with props)
Removed:
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/NodeImplementation.java
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImplementationImpl.java
Modified:
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java
incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java
incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java?view=auto&rev=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java Tue Jun 19 06:49:59 2007
@@ -0,0 +1,66 @@
+/*
+ * 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;
+
+/**
+ * Represents an SCA component and is used to represent which components
+ * will run on a node
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Component {
+
+ /**
+ * Get the compoent name
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Set the compoent name
+ *
+ * @param name
+ */
+ public void setName(String name);
+
+ /**
+ * Get the name of the domain that this scheme belongs to
+ * Not sure in this case whether the domain name should
+ * be part of the component name but am keeping it
+ * separate for now
+ *
+ * @return
+ */
+ public String getDomainName();
+
+ /**
+ * Set the name of the domain that this scheme belongs to
+ * Not sure in this case whether the domain name should
+ * be part of the component name but am keeping it
+ * separate for now
+ *
+ * @param name
+ */
+ public void setDomainName(String domainName);
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java?view=auto&rev=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java Tue Jun 19 06:49:59 2007
@@ -0,0 +1,65 @@
+/*
+ * 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;
+
+/**
+ * Represents an SCA node implementation. An SCA node is a running instance
+ * of a program able to run SCA assemblies. A distributes runtime contains
+ * main nodes
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Node {
+
+ /**
+ * Get the node name
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Set the node name
+ *
+ * @param name
+ */
+ public void setName(String name);
+
+ /**
+ * Return the Scheme/base URL pairs that this node uses for the
+ * specified domain.
+ *
+ * @param domainName
+ * @return
+ */
+ public List<Scheme> getSchemes(String domainName);
+
+ /**
+ * Return the list of components that this node will run for the
+ * specified domain
+ *
+ * @param domainName
+ * @return
+ */
+ public List<Component> getComponents(String domainName);
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java?view=auto&rev=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java Tue Jun 19 06:49:59 2007
@@ -0,0 +1,40 @@
+/*
+ * 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;
+
+
+/**
+ * Represents an SCA runtime.
+ *
+ * TBD - just a place holder at the moment
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Runtime {
+
+ /**
+ * Returns the list of nodes that form this runtime
+ *
+ * @return
+ */
+ public List<Node> getNodes();
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java?view=auto&rev=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java Tue Jun 19 06:49:59 2007
@@ -0,0 +1,72 @@
+/*
+ * 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;
+
+
+/**
+ * Represents an SCA scheme. This holds the base URL that a runtime node
+ * will use by default to expose services
+ *
+ * @version $Rev$ $Date$
+ */
+public interface Scheme {
+
+ /**
+ * Get the scheme name
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ * Set the scheme name
+ *
+ * @param name
+ */
+ public void setName(String name);
+
+ /**
+ * Get the scheme base URL
+ *
+ * @return
+ */
+ public String getBaseURL();
+
+ /**
+ * Set the scheme base URL
+ *
+ * @param name
+ */
+ public void setBaseURL(String urlString);
+
+ /**
+ * Get the name of the domain that this scheme belongs to
+ *
+ * @return
+ */
+ public String getDomainName();
+
+ /**
+ * Set the name of the domain that this scheme belongs to
+ *
+ * @param name
+ */
+ public void setDomainName(String domainName);
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: 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=diff&rev=548726&r1=548725&r2=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java (original)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java Tue Jun 19 06:49:59 2007
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.topology;
+
/**
* A factory for the topology model.
*
@@ -26,10 +27,29 @@
*/
public interface TopologyFactory {
+
+ /**
+ * Creates a new runtime.
+ * @return
+ */
+ public Runtime createRuntime();
+
+ /**
+ * Creates a new node.
+ * @return
+ */
+ public Node createNode();
+
+ /**
+ * Creates a new scheme.
+ * @return
+ */
+ public Scheme createScheme();
+
/**
- * Creates a new node implementation.
+ * Creates a new component.
* @return
*/
- NodeImplementation createNodeImplementation();
+ public Component createComponent();
}
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java?view=auto&rev=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java Tue Jun 19 06:49:59 2007
@@ -0,0 +1,74 @@
+/*
+ * 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 javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.topology.Component;
+
+/**
+ * Represents the scheme defintion for a domain.
+ *
+ * TBD - just a place holder at the moment
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentImpl implements Component {
+
+ private String name;
+ private String domainName;
+
+ /**
+ * Get the component name
+ *
+ * @return
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Set the component name
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the name of the domain that this component belongs to
+ *
+ * @return
+ */
+ public String getDomainName() {
+ return domainName;
+ }
+
+ /**
+ * Set the name of the domain that this component belongs to
+ *
+ * @param name
+ */
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java?view=auto&rev=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java Tue Jun 19 06:49:59 2007
@@ -0,0 +1,98 @@
+/*
+ * 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.HashMap;
+import java.util.List;
+
+import org.apache.tuscany.sca.topology.Node;
+import org.apache.tuscany.sca.topology.Scheme;
+import org.apache.tuscany.sca.topology.Component;
+
+/**
+ * Represents an SCA node implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class NodeImpl implements Node {
+ private HashMap<String, List<Scheme>> schemeBaseURLs = new HashMap<String, List<Scheme>>();
+ private HashMap<String, List<Component>> components = new HashMap<String, List<Component>>();
+ private String name;
+
+ /**
+ * Constructs a new node.
+ */
+ protected NodeImpl() {
+ }
+
+ /**
+ * Get the node name
+ *
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Set the node name
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Return the Scheme/base URL pairs that this node uses for the
+ * specified domain.
+ *
+ * @param domainName
+ * @return
+ */
+ public List<Scheme> getSchemes(String domainName) {
+ List<Scheme> schemeList = schemeBaseURLs.get(domainName);
+
+ if (schemeList == null) {
+ schemeList = new ArrayList<Scheme>();
+ schemeBaseURLs.put(domainName, schemeList);
+ }
+ return schemeList;
+ }
+
+ /**
+ * Return the list of components that this node will run for the
+ * specified domain
+ *
+ * @param domainName
+ * @return
+ */
+ public List<Component> getComponents(String domainName) {
+ List<Component> componentList = components.get(domainName);
+
+ if (componentList == null) {
+ componentList = new ArrayList<Component>();
+ components.put(domainName, componentList);
+ }
+ return componentList;
+ }
+}
\ No newline at end of file
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java?view=auto&rev=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java Tue Jun 19 06:49:59 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.topology.Runtime;
+import org.apache.tuscany.sca.topology.Node;
+
+/**
+ * Represents an SCA runtime.
+ *
+ * TBD - just a place holder at the moment
+ *
+ * @version $Rev$ $Date$
+ */
+public class RuntimeImpl implements Runtime {
+ private List<Node> nodes = new ArrayList<Node>();
+
+ public List<Node> getNodes() {
+ return nodes;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java?view=auto&rev=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java (added)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java Tue Jun 19 06:49:59 2007
@@ -0,0 +1,91 @@
+/*
+ * 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.Scheme;
+
+/**
+ * Represents the scheme defintion for a domain.
+ *
+ * TBD - just a place holder at the moment
+ *
+ * @version $Rev$ $Date$
+ */
+public class SchemeImpl implements Scheme {
+
+ private String name;
+ private String baseURL;
+ private String domainName;
+
+ /**
+ * Get the scheme name
+ *
+ * @return
+ */
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Set the scheme name
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the scheme base URL
+ *
+ * @return
+ */
+ public String getBaseURL() {
+ return baseURL;
+ }
+
+ /**
+ * Set the scheme base URL
+ *
+ * @param name
+ */
+ public void setBaseURL(String urlString) {
+ this.baseURL = urlString;
+ }
+
+ /**
+ * Get the name of the domain that this scheme belongs to
+ *
+ * @return
+ */
+ public String getDomainName() {
+ return domainName;
+ }
+
+ /**
+ * Set the name of the domain that this scheme belongs to
+ *
+ * @param name
+ */
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: 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=diff&rev=548726&r1=548725&r2=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java Tue Jun 19 06:49:59 2007
@@ -19,7 +19,10 @@
package org.apache.tuscany.sca.topology.impl;
-import org.apache.tuscany.sca.topology.NodeImplementation;
+import org.apache.tuscany.sca.topology.Component;
+import org.apache.tuscany.sca.topology.Node;
+import org.apache.tuscany.sca.topology.Runtime;
+import org.apache.tuscany.sca.topology.Scheme;
import org.apache.tuscany.sca.topology.TopologyFactory;
/**
@@ -29,8 +32,19 @@
*/
public class TopologyFactoryImpl implements TopologyFactory {
- public NodeImplementation createNodeImplementation() {
- return new NodeImplementationImpl();
+ public Runtime createRuntime() {
+ return new RuntimeImpl();
}
+ public Node createNode() {
+ return new NodeImpl();
+ }
+
+ public Scheme createScheme() {
+ return new SchemeImpl();
+ }
+
+ public Component createComponent() {
+ return new ComponentImpl();
+ }
}
Modified: 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=diff&rev=548726&r1=548725&r2=548726
==============================================================================
--- incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/topology/src/test/java/org/apache/tuscany/sca/topology/TopologyFactoryTestCase.java Tue Jun 19 06:49:59 2007
@@ -18,12 +18,9 @@
*/
package org.apache.tuscany.sca.topology;
-import javax.xml.namespace.QName;
+import java.util.List;
-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 javax.xml.namespace.QName;
import junit.framework.TestCase;
@@ -35,38 +32,74 @@
*/
public class TopologyFactoryTestCase extends TestCase {
- TopologyFactory factory;
- AssemblyFactory assemblyFactory;
+ TopologyFactory topologyFactory;
public void setUp() throws Exception {
- factory = new DefaultTopologyFactory();
- assemblyFactory = new DefaultAssemblyFactory();
+ topologyFactory = new DefaultTopologyFactory();
}
public void tearDown() throws Exception {
- factory = null;
- assemblyFactory = null;
+ topologyFactory = null;
}
- public void testCreateTopology() {
+ public void testCreateRuntime() {
+ Runtime runtime = topologyFactory.createRuntime();
- // Create a new topology composition
- Composite topology = assemblyFactory.createComposite();
- topology.setName(new QName("http://my.network", "MyTopology"));
-
- // Create SCA node A
- Component nodeA = assemblyFactory.createComponent();
- nodeA.setName("NodeA");
- NodeImplementation implA = factory.createNodeImplementation();
- nodeA.setImplementation(implA);
- topology.getComponents().add(nodeA);
-
- // Create SCA node B
- Component nodeB = assemblyFactory.createComponent();
- nodeB.setName("NodeB");
- NodeImplementation implB = factory.createNodeImplementation();
- nodeB.setImplementation(implB);
- topology.getComponents().add(nodeB);
+ List<Node> nodeList = runtime.getNodes();
+ assertNotNull(nodeList);
}
+ public void testCreateNode() {
+ Node node = topologyFactory.createNode();
+
+ node.setName("nodeA");
+ assertEquals(node.getName(), "nodeA");
+
+ List<Scheme> schemeList = node.getSchemes("domainA");
+ assertNotNull(schemeList);
+
+ List<Component> componentList = node.getComponents("domainA");
+ assertNotNull(componentList);
+ }
+
+ public void testCreateScheme() {
+ Scheme scheme = topologyFactory.createScheme();
+
+ scheme.setName("http");
+ assertEquals(scheme.getName(), "http");
+
+ scheme.setBaseURL("http://localhost:8080");
+ assertEquals(scheme.getBaseURL(), "http://localhost:8080");
+
+ scheme.setDomainName("domainA");
+ assertEquals(scheme.getDomainName(), "domainA");
+
+ Node node = topologyFactory.createNode();
+ List<Scheme> schemeList = node.getSchemes("domainA");
+ schemeList.add(scheme);
+ List<Scheme> schemeList1 = node.getSchemes("domainA");
+ Scheme scheme1 = schemeList1.get(0);
+
+ assertEquals(scheme1.getName(), "http");
+
+ }
+
+ public void testCreateComponent() {
+ Component component = topologyFactory.createComponent();
+
+ component.setName("componentA");
+ assertEquals(component.getName(), "componentA");
+
+ component.setDomainName("domainA");
+ assertEquals(component.getDomainName(), "domainA");
+
+ Node node = topologyFactory.createNode();
+ List<Component> componentList = node.getComponents("domainA");
+ componentList.add(component);
+ List<Component> componentList1 = node.getComponents("domainA");
+ Component component1 = componentList1.get(0);
+
+ assertEquals(component1.getName(), "componentA");
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org