summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-05-08 23:54:51 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-05-08 23:54:51 +0000
commit4d42c3077b596356b97d0c917e0bd69f7a8360ae (patch)
tree546cf3b1a514dbdb3035ef18dbc465224fe2f002
parent473e839056faac141fa644f61dca0fd2ccdc89f5 (diff)
Start to experiment a new way to provide the node configuration
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@773135 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/BindingConfiguration.java48
-rw-r--r--java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/ContributionConfiguration.java49
-rw-r--r--java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DeploymentComposite.java59
-rw-r--r--java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java39
-rw-r--r--java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfigurationFactory.java33
-rw-r--r--java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml45
-rw-r--r--java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node2.xml34
7 files changed, 307 insertions, 0 deletions
diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/BindingConfiguration.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/BindingConfiguration.java
new file mode 100644
index 0000000000..ecd6ec513f
--- /dev/null
+++ b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/BindingConfiguration.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.node.configuration;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Configuration for bindings used by an SCA node
+ */
+public interface BindingConfiguration {
+ /**
+ * Get the QName of the binding
+ * @return
+ */
+ QName getBindingType();
+
+ /**
+ *
+ * @param type
+ */
+ void setBindingType(QName type);
+
+ /**
+ * Get a list of base URIs for the binding. For each protocol supported by the binding,
+ * one base URI can be configured
+ * @return A list of base URIs
+ */
+ List<String> getBaseURIs();
+}
diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/ContributionConfiguration.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/ContributionConfiguration.java
new file mode 100644
index 0000000000..a408ae0716
--- /dev/null
+++ b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/ContributionConfiguration.java
@@ -0,0 +1,49 @@
+/*
+ * 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.node.configuration;
+
+/**
+ * Configuration for an SCA contribution used by the SCA node
+ */
+public interface ContributionConfiguration {
+ /**
+ * Get the URI of the contribution
+ * @return The URI of the contribution
+ */
+ String getURI();
+
+ /**
+ * Set the URI of the contribution
+ * @param uri The URI of the contribution
+ */
+ void setURI(String uri);
+
+ /**
+ * Get the location of the contribution
+ * @return The location of the contribution
+ */
+ String getLocation();
+
+ /**
+ * Set the location of the contribution
+ * @param location The location of the contribution
+ */
+ void setLocation(String location);
+}
diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DeploymentComposite.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DeploymentComposite.java
new file mode 100644
index 0000000000..d94c70a759
--- /dev/null
+++ b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DeploymentComposite.java
@@ -0,0 +1,59 @@
+/*
+ * 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.node.configuration;
+
+/**
+ * Configuration for a deployment composite
+ */
+public interface DeploymentComposite {
+ /**
+ * Get the location of the deployment composite, it can be relative to the owning
+ * contribution or an external resource
+ * @return
+ */
+ String getLocation();
+
+ /**
+ * Set the location of the deployment composite
+ * @param location
+ */
+ void setLocation(String location);
+
+ /**
+ * Get string content of the deployment composite (XML)
+ * @return
+ */
+ String getContent();
+
+ void setContent(String compositeXML);
+
+ /**
+ * Get the URI of the owning contribution
+ * @return
+ */
+ String getContributionURI();
+
+ /**
+ * Set the URI of the owning contribution
+ * @param contributionURI
+ */
+ void setContributionURI(String contributionURI);
+
+}
diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java
new file mode 100644
index 0000000000..bd1d9aebb0
--- /dev/null
+++ b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java
@@ -0,0 +1,39 @@
+/*
+ * 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.node.configuration;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface NodeConfiguration {
+ String getDomainURI();
+
+ void setDomainURI(String domainURI);
+
+ DeploymentComposite getDeploymentComposite();
+
+ void setDeploymentComposite(DeploymentComposite deploymentComposite);
+
+ List<ContributionConfiguration> getContributions();
+
+ List<BindingConfiguration> getBindings();
+}
diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfigurationFactory.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfigurationFactory.java
new file mode 100644
index 0000000000..e20fef27c1
--- /dev/null
+++ b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfigurationFactory.java
@@ -0,0 +1,33 @@
+/*
+ * 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.node.configuration;
+
+/**
+ * The factory to create java models related to the node configuration
+ */
+public interface NodeConfigurationFactory {
+ NodeConfiguration createNodeConfiguration();
+
+ ContributionConfiguration createContributionConfiguration();
+
+ BindingConfiguration createBindingConfiguration();
+
+ DeploymentComposite createDeploymentComposite();
+}
diff --git a/java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml b/java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
new file mode 100644
index 0000000000..cba4ef378b
--- /dev/null
+++ b/java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+ xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://sample/node"
+ name="TestNode1"
+ domain="http://domain1">
+
+ <!-- The deployment composite is optional -->
+ <!-- The deployment composite can be defined inline or referenced using a URI -->
+ <!-- Should we make it a child of contribution element? -->
+ <!-- Can we have more than one deployment composites -->
+ <deploymentComposite contribution="http://c2" location="test/Test.composite">
+ <sca:composite>
+ </sca:composite>
+ </deploymentComposite>
+
+ <!-- Configure the base URIs for a given binding -->
+ <!-- Each base URI is for a protocol supported by the binding -->
+ <binding name="sca:binding.ws" baseURIs="http://localhost:8080/ws https://localhost:8081/ws">
+ <binding name="tuscany:binding.rmi" baseURIs="rmi://localhost:8080/rmi">
+
+ <!-- Configure a list of contributions -->
+ <contribution uri="http://c1" location="file:///a.jar"/>
+ <contribution uri="http://c2" location="http://locahost/repo/b.jar"/>
+ <contribution uri="http://c3" location="http://locahost/repo/c.jar"/>
+</node> \ No newline at end of file
diff --git a/java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node2.xml b/java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node2.xml
new file mode 100644
index 0000000000..ae47e70cc1
--- /dev/null
+++ b/java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node2.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+ xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ targetNamespace="http://sample/node"
+ name="TestNode2"
+ domain="http://domain1"
+ >
+ <deploymentComposite contribution="http://c1" location="test/Test.composite">
+ </deploymentComposite>
+
+ <binding name="sca:binding.ws" baseURIs="http://localhost:8080/ws https://localhost:8081/ws">
+ <binding name="tuscany:binding.rmi" baseURIs="rmi://localhost:8080/rmi">
+ <contribution uri="http://c1" location="file:///a.jar"/>
+ <contribution uri="http://c4" location="http://locahost/repo/d.jar"/>
+</node> \ No newline at end of file