From c2ec416cbea72c8fa8f8dc9f51ae8238d6a22006 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 12 May 2009 23:10:51 +0000 Subject: Move node configuration to node-api git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@774126 13f79535-47bb-0310-9956-ffa450edef68 --- .../node/configuration/BindingConfiguration.java | 48 ------ .../configuration/ContributionConfiguration.java | 71 -------- .../DefaultNodeConfigurationFactory.java | 28 --- .../node/configuration/DeploymentComposite.java | 78 --------- .../sca/node/configuration/NodeConfiguration.java | 63 ------- .../configuration/NodeConfigurationFactory.java | 49 ------ .../impl/BindingConfigurationImpl.java | 48 ------ .../impl/ContributionConfigurationImpl.java | 85 --------- .../impl/DeploymentCompositeImpl.java | 67 -------- .../impl/NodeConfigurationFactoryImpl.java | 62 ------- .../configuration/impl/NodeConfigurationImpl.java | 63 ------- .../xml/NodeConfigurationProcessor.java | 190 --------------------- .../tuscany/sca/node/configuration/node1.xml | 46 ----- .../tuscany/sca/node/configuration/node2.xml | 33 ---- 14 files changed, 931 deletions(-) delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/BindingConfiguration.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/ContributionConfiguration.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DefaultNodeConfigurationFactory.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DeploymentComposite.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfigurationFactory.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/BindingConfigurationImpl.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/ContributionConfigurationImpl.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/DeploymentCompositeImpl.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationFactoryImpl.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java delete mode 100644 java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java delete mode 100644 java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml delete mode 100644 java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node2.xml (limited to 'java/sca/modules/implementation-node') 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 deleted file mode 100644 index 489a3fd2e3..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/BindingConfiguration.java +++ /dev/null @@ -1,48 +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.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(); - - /** - * Set the type of the binding - * @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 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 deleted file mode 100644 index 7d75cb32ac..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/ContributionConfiguration.java +++ /dev/null @@ -1,71 +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.node.configuration; - -import java.util.List; - -import org.apache.tuscany.sca.contribution.Contribution; - -/** - * 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); - - /** - * Get the contribution - * @return - */ - Contribution getContribution(); - - /** - * Set the contribution - * @param contribution - */ - void setContribution(Contribution contribution); - - /** - * Get the list of deployment composites that are attached to the contribution - * @return - */ - List getDeploymentComposites(); -} diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DefaultNodeConfigurationFactory.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DefaultNodeConfigurationFactory.java deleted file mode 100644 index a14a4ac9eb..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DefaultNodeConfigurationFactory.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.node.configuration; - -import org.apache.tuscany.sca.node.configuration.impl.NodeConfigurationFactoryImpl; - -/** - * Default NodeConfigurationFactory - */ -public class DefaultNodeConfigurationFactory extends NodeConfigurationFactoryImpl { -} 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 deleted file mode 100644 index 09bf3ee0ef..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/DeploymentComposite.java +++ /dev/null @@ -1,78 +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.node.configuration; - -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.Contribution; - -/** - * 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(); - - /** - * Set the XML content for the composite - * @param compositeXML - */ - void setContent(String compositeXML); - - /** - * Get the composite - * @return - */ - Composite getComposite(); - - /** - * Set the composite - * @param composite - */ - void setComposite(Composite composite); - - /** - * Get the contribution that this deployment composite is attached to - * @return - */ - Contribution getContribution(); - - /** - * Set the contribution that this deployment composite is attached to - * @param contribution - */ - void setContribution(Contribution contribution); - -} 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 deleted file mode 100644 index f1eeb868ff..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java +++ /dev/null @@ -1,63 +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.node.configuration; - -import java.util.List; - -/** - * The configuration for a Node which represents the deployment of an SCA composite application - */ -public interface NodeConfiguration { - /** - * Get the URI of the SCA domain that manages the composite application - * @return The URI of the SCA domain - */ - String getDomainURI(); - - /** - * Set the URI of the SCA domain - * @param domainURI The URI of the SCA domain - */ - void setDomainURI(String domainURI); - - /** - * Get the URI of the node. It uniquely identifies a node within the SCA domain - * @return The URI of the node - */ - String getURI(); - - /** - * Set the URI of the node - * @param uri The URI of the node - */ - void setURI(String uri); - - /** - * Get a list of confiurations for SCA contributions - * @return A list of configurations for SCA contributions - */ - List getContributions(); - - /** - * Get a list of configurations for SCA bindings - * @return A list of configurations for SCA bindings - */ - List 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 deleted file mode 100644 index ca1afee923..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfigurationFactory.java +++ /dev/null @@ -1,49 +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.node.configuration; - -/** - * The factory to create java models related to the node configuration - */ -public interface NodeConfigurationFactory { - /** - * Create a new instance of NodeConfiguration - * @return - */ - NodeConfiguration createNodeConfiguration(); - - /** - * Create a new instance of ContributionConfiguration - * @return - */ - ContributionConfiguration createContributionConfiguration(); - - /** - * Create a new instance of BindingConfiguration - * @return - */ - BindingConfiguration createBindingConfiguration(); - - /** - * Create a new instance of DeploymentComposite - * @return - */ - DeploymentComposite createDeploymentComposite(); -} diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/BindingConfigurationImpl.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/BindingConfigurationImpl.java deleted file mode 100644 index eb5ac2915b..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/BindingConfigurationImpl.java +++ /dev/null @@ -1,48 +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.node.configuration.impl; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.node.configuration.BindingConfiguration; - -/** - * - */ -class BindingConfigurationImpl implements BindingConfiguration { - private QName type; - private List baseURIs = new ArrayList(); - - public List getBaseURIs() { - return baseURIs; - } - - public QName getBindingType() { - return type; - } - - public void setBindingType(QName type) { - this.type = type; - } - -} diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/ContributionConfigurationImpl.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/ContributionConfigurationImpl.java deleted file mode 100644 index 1793a99cc1..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/ContributionConfigurationImpl.java +++ /dev/null @@ -1,85 +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.node.configuration.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.node.configuration.ContributionConfiguration; -import org.apache.tuscany.sca.node.configuration.DeploymentComposite; - -/** - * Configuration for an SCA contribution used by the SCA node - */ -class ContributionConfigurationImpl implements ContributionConfiguration { - private List deploymentComposites = new ArrayList(); - private Contribution contribution; - private String uri; - private String location; - - public Contribution getContribution() { - return contribution; - } - - public void setContribution(Contribution contribution) { - this.contribution = contribution; - } - - /** - * Get the URI of the contribution - * @return The URI of the contribution - */ - public String getURI() { - return uri; - } - - /** - * Set the URI of the contribution - * @param uri The URI of the contribution - */ - public void setURI(String uri) { - this.uri = uri; - } - - /** - * Get the location of the contribution - * @return The location of the contribution - */ - public String getLocation() { - return location; - } - - /** - * Set the location of the contribution - * @param location The location of the contribution - */ - public void setLocation(String location) { - this.location = location; - } - - /** - * Get the list of deployment composites that are attached to the contribution - * @return - */ - public List getDeploymentComposites() { - return deploymentComposites; - } -} diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/DeploymentCompositeImpl.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/DeploymentCompositeImpl.java deleted file mode 100644 index 7113ad0d36..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/DeploymentCompositeImpl.java +++ /dev/null @@ -1,67 +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.node.configuration.impl; - -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.node.configuration.DeploymentComposite; - -/** - * Configuration for a deployment composite - */ -class DeploymentCompositeImpl implements DeploymentComposite { - private String location; - private String content; - private Composite composite; - private Contribution contribution; - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public Composite getComposite() { - return composite; - } - - public void setComposite(Composite composite) { - this.composite = composite; - } - - public Contribution getContribution() { - return contribution; - } - - public void setContribution(Contribution contribution) { - this.contribution = contribution; - } - -} diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationFactoryImpl.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationFactoryImpl.java deleted file mode 100644 index 96ca3e6199..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationFactoryImpl.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.node.configuration.impl; - -import org.apache.tuscany.sca.node.configuration.BindingConfiguration; -import org.apache.tuscany.sca.node.configuration.ContributionConfiguration; -import org.apache.tuscany.sca.node.configuration.DeploymentComposite; -import org.apache.tuscany.sca.node.configuration.NodeConfigurationFactory; - -/** - * The factory to create java models related to the node configuration - */ -public abstract class NodeConfigurationFactoryImpl implements NodeConfigurationFactory { - /** - * Create a new instance of NodeConfiguration - * @return - */ - public NodeConfigurationImpl createNodeConfiguration() { - return new NodeConfigurationImpl(); - } - - /** - * Create a new instance of ContributionConfiguration - * @return - */ - public ContributionConfiguration createContributionConfiguration() { - return new ContributionConfigurationImpl(); - } - - /** - * Create a new instance of BindingConfiguration - * @return - */ - public BindingConfiguration createBindingConfiguration() { - return new BindingConfigurationImpl(); - } - - /** - * Create a new instance of DeploymentComposite - * @return - */ - public DeploymentComposite createDeploymentComposite() { - return new DeploymentCompositeImpl(); - } -} diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java deleted file mode 100644 index 4f13959ced..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java +++ /dev/null @@ -1,63 +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.node.configuration.impl; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.tuscany.sca.node.configuration.BindingConfiguration; -import org.apache.tuscany.sca.node.configuration.ContributionConfiguration; -import org.apache.tuscany.sca.node.configuration.NodeConfiguration; - -/** - * - */ -class NodeConfigurationImpl implements NodeConfiguration { - private String uri; - private String domainURI; - private List contributions = new ArrayList(); - private List bindings = new ArrayList(); - - public String getURI() { - return uri; - } - - public void setURI(String uri) { - this.uri = uri; - } - - public String getDomainURI() { - return domainURI; - } - - public void setDomainURI(String domainURI) { - this.domainURI = domainURI; - } - - public List getContributions() { - return contributions; - } - - public List getBindings() { - return bindings; - } - - -} diff --git a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java b/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java deleted file mode 100644 index 1d79062c0d..0000000000 --- a/java/sca/modules/implementation-node/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java +++ /dev/null @@ -1,190 +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.node.configuration.xml; - -import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; - -import java.util.StringTokenizer; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.ContributionReadException; -import org.apache.tuscany.sca.contribution.processor.ContributionResolveException; -import org.apache.tuscany.sca.contribution.processor.ContributionWriteException; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.node.configuration.BindingConfiguration; -import org.apache.tuscany.sca.node.configuration.ContributionConfiguration; -import org.apache.tuscany.sca.node.configuration.DeploymentComposite; -import org.apache.tuscany.sca.node.configuration.NodeConfiguration; -import org.apache.tuscany.sca.node.configuration.NodeConfigurationFactory; - -/** - * Implements a StAX artifact processor for node implementations. - * - * @version $Rev: 750323 $ $Date: 2009-03-04 21:52:01 -0800 (Wed, 04 Mar 2009) $ - */ -public class NodeConfigurationProcessor extends BaseStAXArtifactProcessor implements - StAXArtifactProcessor { - private static final String SCA11_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.1"; - private static final QName NODE = new QName(SCA11_TUSCANY_NS, "node"); - private static final QName CONTRIBUTION = new QName(SCA11_TUSCANY_NS, "contribution"); - private static final QName BINDING = new QName(SCA11_TUSCANY_NS, "binding"); - private static final QName DEPLOYMENT_COMPOSITE = new QName(SCA11_TUSCANY_NS, "deploymentComposite"); - - private static final String SCA11_NS = "http://docs.oasis-open.org/ns/opencsa/sca/200903"; - private static final QName COMPOSITE = new QName(SCA11_NS, "composite"); - - private StAXArtifactProcessor processor; - private AssemblyFactory assemblyFactory; - private NodeConfigurationFactory nodeConfigurationFactory; - - public NodeConfigurationProcessor(FactoryExtensionPoint modelFactories, - StAXArtifactProcessor processor, - Monitor monitor) { - this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - this.nodeConfigurationFactory = modelFactories.getFactory(NodeConfigurationFactory.class); - this.processor = processor; - } - - public QName getArtifactType() { - // Returns the QName of the XML element processed by this processor - return NODE; - } - - public Class getModelType() { - // Returns the type of model processed by this processor - return NodeConfiguration.class; - } - - public NodeConfiguration read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { - - NodeConfiguration node = null; - ContributionConfiguration contribution = null; - DeploymentComposite composite = null; - - // Skip to end element - while (true) { - int event = reader.getEventType(); - switch (event) { - case XMLStreamConstants.START_ELEMENT: - QName name = reader.getName(); - if (NODE.equals(name)) { - node = nodeConfigurationFactory.createNodeConfiguration(); - node.setURI(reader.getAttributeValue(null, "uri")); - node.setDomainURI(reader.getAttributeValue(null, "domain")); - } else if (CONTRIBUTION.equals(name)) { - contribution = nodeConfigurationFactory.createContributionConfiguration(); - contribution.setURI(reader.getAttributeValue(null, "uri")); - contribution.setLocation(reader.getAttributeValue(null, "location")); - node.getContributions().add(contribution); - } else if (BINDING.equals(name)) { - BindingConfiguration binding = nodeConfigurationFactory.createBindingConfiguration(); - binding.setBindingType(getQName(reader, "name")); - String baseURIs = reader.getAttributeValue(null, "baseURIs"); - if (baseURIs != null) { - StringTokenizer tokenizer = new StringTokenizer(baseURIs); - while (tokenizer.hasMoreTokens()) { - binding.getBaseURIs().add(tokenizer.nextToken()); - } - } - node.getBindings().add(binding); - } else if (DEPLOYMENT_COMPOSITE.equals(name)) { - composite = nodeConfigurationFactory.createDeploymentComposite(); - composite.setLocation(reader.getAttributeValue(null, "location")); - if (contribution != null) { - contribution.getDeploymentComposites().add(composite); - } - } else if (COMPOSITE.equals(name)) { - Object model = processor.read(reader); - if (model instanceof Composite) { - composite.setComposite((Composite)model); - } - } - break; - - case END_ELEMENT: - name = reader.getName(); - if (NODE.equals(name)) { - return node; - } else if (CONTRIBUTION.equals(name)) { - contribution = null; - } - } - if (reader.hasNext()) { - reader.next(); - } else { - break; - } - } - - return node; - } - - public void resolve(NodeConfiguration node, ModelResolver resolver) throws ContributionResolveException { - } - - public void write(NodeConfiguration node, XMLStreamWriter writer) throws ContributionWriteException, - XMLStreamException { - - writeStart(writer, - NODE.getNamespaceURI(), - NODE.getLocalPart(), - new XAttr("uri", node.getURI()), - new XAttr("domain", node.getDomainURI())); - - for (ContributionConfiguration c : node.getContributions()) { - writeStart(writer, - CONTRIBUTION.getNamespaceURI(), - CONTRIBUTION.getLocalPart(), - new XAttr("uri", c.getURI()), - new XAttr("location", c.getLocation())); - writeEnd(writer); - } - - for (BindingConfiguration b : node.getBindings()) { - StringBuffer uris = new StringBuffer(); - for (String uri : b.getBaseURIs()) { - uris.append(uri).append(' '); - } - if (uris.length() > 0) { - uris.deleteCharAt(uris.length() - 1); // Remove the trailing space - } else { - uris = null; - } - writeStart(writer, - BINDING.getNamespaceURI(), - BINDING.getLocalPart(), - new XAttr("name", b.getBindingType()), - new XAttr("baseURIs", uris.toString())); - writeEnd(writer); - } - - writeEnd(writer); - } -} 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 deleted file mode 100644 index e4d7925efe..0000000000 --- a/java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - \ 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 deleted file mode 100644 index d8781f1b8c..0000000000 --- a/java/sca/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/node/configuration/node2.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - \ No newline at end of file -- cgit v1.2.3