diff options
Diffstat (limited to 'sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main')
11 files changed, 730 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java new file mode 100644 index 0000000000..512fa19645 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Component.java @@ -0,0 +1,63 @@ +/* + * 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 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); +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java new file mode 100644 index 0000000000..ddeeac9a93 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/DefaultTopologyFactory.java @@ -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 { + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java new file mode 100644 index 0000000000..a44e998e43 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Node.java @@ -0,0 +1,73 @@ +/* + * 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 java.util.Set; + +/** + * 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); + + /** + * Get domain names + * + * @return + */ + public Set<String> getDomainNames(); + + /** + * 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); + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java new file mode 100644 index 0000000000..7775a3878f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Runtime.java @@ -0,0 +1,48 @@ +/* + * 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(); + + /** + * Get a node by node name + * + * @param nodeName the name of the node to return + * @return the node + */ + public Node getNode(String nodeName); +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java new file mode 100644 index 0000000000..794e43e8a6 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/Scheme.java @@ -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); +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java new file mode 100644 index 0000000000..020b15ea17 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/TopologyFactory.java @@ -0,0 +1,55 @@ +/* + * 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 runtime. + * @return + */ + public Runtime createRuntime(); + + /** + * Creates a new node. + * @return + */ + public Node createNode(); + + /** + * Creates a new scheme. + * @return + */ + public Scheme createScheme(); + + /** + * Creates a new component. + * @return + */ + public Component createComponent(); + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java new file mode 100644 index 0000000000..68364e3420 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/ComponentImpl.java @@ -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.impl; + +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; + } + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java new file mode 100644 index 0000000000..0200376caa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/NodeImpl.java @@ -0,0 +1,120 @@ +/* + * 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 java.util.Set; + +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, DomainContainer> nodeDomain = new HashMap<String, DomainContainer>(); + private String name; + + public class DomainContainer { + private List<Scheme> schemes = new ArrayList<Scheme>(); + private List<Component> components = new ArrayList<Component>(); + + public List<Scheme> getSchemes() { + return schemes; + } + + public List<Component> getComponents() { + return components; + } + } + + /** + * 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; + } + + /** + * Get domain names + * + * @return + */ + public Set<String> getDomainNames() { + return nodeDomain.keySet(); + } + + /** + * Return the Scheme/base URL pairs that this node uses for the + * specified domain. + * + * @param domainName + * @return + */ + public List<Scheme> getSchemes(String domainName) { + DomainContainer container = nodeDomain.get(domainName); + + if (container == null) { + container = new DomainContainer(); + nodeDomain.put(domainName, container); + } + return container.getSchemes(); + } + + /** + * Return the list of components that this node will run for the + * specified domain + * + * @param domainName + * @return + */ + public List<Component> getComponents(String domainName) { + DomainContainer container = nodeDomain.get(domainName); + + if (container == null) { + container = new DomainContainer(); + nodeDomain.put(domainName, container); + } + return container.getComponents(); + } +}
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java new file mode 100644 index 0000000000..9a4568deee --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/RuntimeImpl.java @@ -0,0 +1,55 @@ +/* + * 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; + } + + public Node getNode(String nodeName){ + Node returnNode = null; + + for(Node node : getNodes()){ + if ( node.getName().equals(nodeName)){ + returnNode = node; + break; + } + } + + return returnNode; + } + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java new file mode 100644 index 0000000000..ffd08cef92 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/SchemeImpl.java @@ -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; + } + +} diff --git a/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java new file mode 100644 index 0000000000..793ed4a06d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-0.99/modules/topology/src/main/java/org/apache/tuscany/sca/topology/impl/TopologyFactoryImpl.java @@ -0,0 +1,50 @@ +/* + * 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.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; + +/** + * A factory for the topology model. + * + * @version $Rev$ $Date$ + */ +public class TopologyFactoryImpl implements TopologyFactory { + + public Runtime createRuntime() { + return new RuntimeImpl(); + } + + public Node createNode() { + return new NodeImpl(); + } + + public Scheme createScheme() { + return new SchemeImpl(); + } + + public Component createComponent() { + return new ComponentImpl(); + } +} |