summaryrefslogtreecommitdiffstats
path: root/sandbox/slaws/modules/domain-rework/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/slaws/modules/domain-rework/src/main/java')
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/BindingURICalculator.java35
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/BindingURICalculatorExtensionPoint.java52
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/DefaultBindingURICalculatorExtensionPoint.java124
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/feed/atom/AtomBindingURICalculator.java41
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingURICalculator.java40
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingURICalculator.java41
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingURICalculator.java41
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingURICalculator.java41
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/ArtifactImpl.java57
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainService.java37
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainServiceImpl.java638
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainServiceInit.java43
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/Launcher.java225
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/NodeService.java34
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/workspace/configuration/impl/NodeAssigner.java300
-rw-r--r--sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/workspace/configuration/impl/NodeInfo.java63
16 files changed, 0 insertions, 1812 deletions
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/BindingURICalculator.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/BindingURICalculator.java
deleted file mode 100644
index c37188a5dd..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/BindingURICalculator.java
+++ /dev/null
@@ -1,35 +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.binding;
-
-import org.apache.tuscany.sca.assembly.Binding;
-
-/**
- * A class with binding specific functions related to binding URI calculation
- *
- * @version $Rev$ $Date$
- */
-public interface BindingURICalculator {
-
- public String getBindingType();
-
- public String getProtocol(Binding binding);
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/BindingURICalculatorExtensionPoint.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/BindingURICalculatorExtensionPoint.java
deleted file mode 100644
index d0148381d6..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/BindingURICalculatorExtensionPoint.java
+++ /dev/null
@@ -1,52 +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.binding;
-
-import org.apache.tuscany.sca.assembly.Binding;
-
-/**
- * An extension point for binding URI calculators
- *
- * @version $Rev$ $Date$
- */
-public interface BindingURICalculatorExtensionPoint {
-
- /**
- * Add a BindingURICalculator using the contribution type as the key.
- *
- * @param bindingURICalculator The binding URI calculator
- */
- void addBindingURICalculator(BindingURICalculator bindingURICalculator);
-
- /**
- * Remove a BindingURICalculator.
- *
- * @param bindingURICalculator The binding URI calculator
- */
- void removeBindingURICalculator(BindingURICalculator bindingURICalculator);
-
- /**
- * Returns the BindingURICalculator for the given contribution type.
- *
- * @param binding The binding for which the URI calculator is required
- * @return The binding URI calculator
- */
- BindingURICalculator getBindingURICalculator(Binding binding);
-
-} \ No newline at end of file
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/DefaultBindingURICalculatorExtensionPoint.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/DefaultBindingURICalculatorExtensionPoint.java
deleted file mode 100644
index ae8b33a006..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/DefaultBindingURICalculatorExtensionPoint.java
+++ /dev/null
@@ -1,124 +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.binding;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.util.ServiceDeclaration;
-import org.apache.tuscany.sca.contribution.util.ServiceDiscovery;
-
-/**
- * Default implementation of a binding URI calculator extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultBindingURICalculatorExtensionPoint implements BindingURICalculatorExtensionPoint {
-
- private Map<String, BindingURICalculator> bindingURICalculators = new HashMap<String, BindingURICalculator>();
- private boolean loaded;
-
- public DefaultBindingURICalculatorExtensionPoint() {
- }
-
- public void addBindingURICalculator(BindingURICalculator bindingURICalculator) {
- bindingURICalculators.put(bindingURICalculator.getBindingType(), bindingURICalculator);
- }
-
- public void removeBindingURICalculator(BindingURICalculator bindingURICalculator) {
- bindingURICalculators.remove(bindingURICalculator.getBindingType());
- }
-
- public BindingURICalculator getBindingURICalculator(Binding binding) {
- loadbindingURICalculators();
- return bindingURICalculators.get(binding.getClass().getName());
- }
-
- private void loadbindingURICalculators() {
- if (loaded)
- return;
-
- // Get the bindingURICalculator service declarations
- Set<ServiceDeclaration> bindingURICalculatorDeclarations;
- try {
- bindingURICalculatorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(BindingURICalculator.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- for (ServiceDeclaration bindingURICalculatorDeclaration: bindingURICalculatorDeclarations) {
- Map<String, String> attributes = bindingURICalculatorDeclaration.getAttributes();
-
- // Load a URL artifact bindingURICalculator
- String bindingType = attributes.get("binding");
-
- // Create a bindingURICalculator wrapper and register it
- BindingURICalculator bindingURICalculator = new LazyBindingURICalculator(bindingType, bindingURICalculatorDeclaration);
- addBindingURICalculator(bindingURICalculator);
- }
-
- loaded = true;
- }
-
- /**
- * A facade for contribution bindingURICalculators.
- */
- private static class LazyBindingURICalculator implements BindingURICalculator {
-
- private ServiceDeclaration bindingURICalculatorDeclaration;
- private String bindingType;
- private BindingURICalculator bindingURICalculator;
-
- private LazyBindingURICalculator(String contributionType, ServiceDeclaration bindingURICalculatorDeclaration) {
- this.bindingURICalculatorDeclaration = bindingURICalculatorDeclaration;
- this.bindingType = contributionType;
- }
-
- public String getBindingType() {
- return bindingType;
- }
-
- public String getProtocol(Binding binding) {
- return getbindingURICalculator().getProtocol(binding);
- }
-
- private BindingURICalculator getbindingURICalculator() {
- if (bindingURICalculator == null) {
- try {
- Class<BindingURICalculator> bindingURICalculatorClass = (Class<BindingURICalculator>)bindingURICalculatorDeclaration.loadClass();
- Constructor<BindingURICalculator> constructor = bindingURICalculatorClass.getConstructor();
- bindingURICalculator = constructor.newInstance();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return bindingURICalculator;
- }
- }
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/feed/atom/AtomBindingURICalculator.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/feed/atom/AtomBindingURICalculator.java
deleted file mode 100644
index 97aa08f744..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/feed/atom/AtomBindingURICalculator.java
+++ /dev/null
@@ -1,41 +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.binding.feed.atom;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.BindingURICalculator;
-import org.apache.tuscany.sca.binding.feed.AtomBinding;
-
-/**
- * A class with binding specific functions related to binding URI calculation
- *
- * @version $Rev$ $Date$
- */
-public class AtomBindingURICalculator implements BindingURICalculator {
-
- public String getBindingType(){
- return AtomBinding.class.getName();
- }
-
- public String getProtocol(Binding binding){
- return "http";
- }
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingURICalculator.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingURICalculator.java
deleted file mode 100644
index 7d0f8fbc26..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingURICalculator.java
+++ /dev/null
@@ -1,40 +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.binding.http;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.BindingURICalculator;
-
-/**
- * A class with binding specific functions related to binding URI calculation
- *
- * @version $Rev$ $Date$
- */
-public class HTTPBindingURICalculator implements BindingURICalculator {
-
- public String getBindingType(){
- return HTTPBinding.class.getName();
- }
-
- public String getProtocol(Binding binding){
- return "http";
- }
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingURICalculator.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingURICalculator.java
deleted file mode 100644
index 1debd96286..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingURICalculator.java
+++ /dev/null
@@ -1,41 +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.binding.jsonrpc;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.BindingURICalculator;
-
-
-/**
- * A class with binding specific functions related to binding URI calculation
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCBindingURICalculator implements BindingURICalculator {
-
- public String getBindingType(){
- return JSONRPCBinding.class.getName();
- }
-
- public String getProtocol(Binding binding){
- return "http";
- }
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingURICalculator.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingURICalculator.java
deleted file mode 100644
index 60b693f96b..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingURICalculator.java
+++ /dev/null
@@ -1,41 +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.binding.sca;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.BindingURICalculator;
-
-/**
- * A class with binding specific functions related to binding URI calculation
- *
- * @version $Rev$ $Date$
- */
-public class SCABindingURICalculator implements BindingURICalculator {
-
- public String getBindingType(){
- return SCABinding.class.getName();
- }
-
- public String getProtocol(Binding binding){
- return "http";
- }
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingURICalculator.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingURICalculator.java
deleted file mode 100644
index 515188b011..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingURICalculator.java
+++ /dev/null
@@ -1,41 +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.binding.ws.axis2;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.BindingURICalculator;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-
-/**
- * A class with binding specific functions related to binding URI calculation
- *
- * @version $Rev$ $Date$
- */
-public class Axis2BindingURICalculator implements BindingURICalculator {
-
- public String getBindingType(){
- return WebServiceBinding.class.getName();
- }
-
- public String getProtocol(Binding binding){
- return "http";
- }
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/ArtifactImpl.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/ArtifactImpl.java
deleted file mode 100644
index ceff209344..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/ArtifactImpl.java
+++ /dev/null
@@ -1,57 +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.domain.rework;
-
-import java.io.Serializable;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.domain.management.ContributionInfo;
-/**
- * Information relating to an exposed artifact in the contribution or composite
- *
- * @version $Rev$ $Date$
- */
-public class ArtifactImpl implements Serializable {
-
- static final long serialVersionUID = 7669181086005969428L;
-
- private String name;
- private String URL;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name){
- this.name = name;
- }
-
- public String getURL() {
- return URL;
- }
-
- public void setURL(String URL){
- this.URL = URL;
- }
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainService.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainService.java
deleted file mode 100644
index 62dbe2c77b..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainService.java
+++ /dev/null
@@ -1,37 +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.domain.rework;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Domain level operations
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface DomainService {
-
- public List<ArtifactImpl> getContributions();
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainServiceImpl.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainServiceImpl.java
deleted file mode 100644
index 876e1be73a..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainServiceImpl.java
+++ /dev/null
@@ -1,638 +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.domain.rework;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-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.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
-import org.apache.tuscany.sca.contribution.processor.ExtensiblePackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
-import org.apache.tuscany.sca.contribution.service.TypeDescriber;
-import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
-import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
-import org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
-import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.workspace.DefaultWorkspaceFactory;
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.WorkspaceFactory;
-import org.apache.tuscany.sca.workspace.configuration.impl.NodeAssigner;
-import org.apache.tuscany.sca.workspace.configuration.impl.NodeInfo;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * Stores details of services exposed and retrieves details of remote services
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces = {DomainServiceInit.class, DomainService.class})
-public class DomainServiceImpl implements DomainServiceInit, DomainService {
-
- private final static Logger logger = Logger.getLogger(DomainServiceImpl.class.getName());
-
- private ReallySmallRuntime runtime;
- private String domainURI;
-
- private File uploaded;
- private File repository;
-
- private ExtensionPointRegistry registry;
-
- private ContributionFactory contributionFactory;
- private ContributionRepository contributionRepository;
-
- private WorkspaceFactory workspaceFactory;
- private Workspace contributionWorkspace;
-
- private XMLInputFactory xmlFactory;
- private XMLOutputFactory xmlOutputFactory;
-
- private PackageProcessor packageProcessor;
-
- private ExtensibleURLArtifactProcessor artifactProcessor;
-
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
- private ExtensibleContributionListener contributionListener;
-
- private ModelResolverExtensionPoint modelResolvers;
-
- private ModelFactoryExtensionPoint modelFactories;
-
- private AssemblyFactory assemblyFactory;
-
- private ModelResolver domainModelResolver;
-
- private CompositeBuilder compositeBuilder;
-
- private CompositeProcessor compositeProcessor;
-
- private PolicyFactory policyFactory;
-
- private DocumentBuilder documentBuilder;
-
- private Composite domainComposite;
-
- @Property
- protected String repositoryLocation;
-
- //@Reference
- //protected Collection<NodeService> nodes;
-
- public DomainServiceImpl(){
- }
-
- // from tuscany-runtime
- private List<URL> getJARsInFolder(File repository) {
-
- String[] jarNames = repository.list(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return name.endsWith(".jar");
- }
- });
-
- List<URL> contributionJars = new ArrayList<URL>();
- if (jarNames != null) {
- for (String jar : jarNames) {
- try {
- contributionJars.add(new File(repository, jar).toURL());
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- return contributionJars;
- }
-
- // from domain impl
- private String getComposite(Composite composite){
- ExtensionPointRegistry registry = runtime.getExtensionPointRegistry();
-
- StAXArtifactProcessorExtensionPoint staxProcessors =
- registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- try {
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- //outputFactory.setProperty("javax.xml.stream.isPrefixDefaulting",Boolean.TRUE);
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
-
- processor.write(composite, writer);
- writer.flush();
- writer.close();
- } catch (Exception ex) {
- System.out.println(ex.toString());
- }
-
- String compositeString = bos.toString();
-
- return compositeString;
- }
-
- // from ContributionService
- private void findContributionArtifacts(Contribution contribution){
- try {
- // read contribution meta data
- URL contributionURL = new URL(contribution.getLocation());
- URL[] clUrls = {contributionURL};
- URLClassLoader cl = new URLClassLoader(clUrls, null);
-
- ContributionMetadataDocumentProcessor metadataDocumentProcessor =
- new ContributionMetadataDocumentProcessor(staxProcessor, xmlFactory);
-
- for (String path: new String[]{
- Contribution.SCA_CONTRIBUTION_GENERATED_META,
- Contribution.SCA_CONTRIBUTION_META}) {
- URL url = cl.getResource(path);
- if (url != null) {
- Contribution tmpContribution = metadataDocumentProcessor.read(contributionURL, URI.create(path), url);
- contribution.getImports().addAll(tmpContribution.getImports());
- contribution.getExports().addAll(tmpContribution.getExports());
- contribution.getDeployables().addAll(tmpContribution.getDeployables());
- }
- }
-
- // set the model resolver
- ModelResolver modelResolver = new ExtensibleModelResolver(contribution, modelResolvers, modelFactories, domainModelResolver);
- contribution.setModelResolver(modelResolver);
-
- // find all the contribution artifacts
- InputStream contributionStream = contributionURL.openStream();
- List<URI> contributionArtifacts = this.packageProcessor.getArtifacts(contributionURL, contributionStream);
-
- // add the artifacts to the contribution model
- for (URI anArtifactUri : contributionArtifacts) {
- URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), anArtifactUri);
- System.out.println(" Artifact URL: " + artifactURL.toString());
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(anArtifactUri.toString());
- artifact.setLocation(artifactURL.toString());
- contribution.getArtifacts().add(artifact);
- modelResolver.addModel(artifact);
- }
-
- } catch(Exception ex){
- logger.warning(ex.toString());
- }
- }
-
- private void readContributionArtifacts(Contribution contribution){
- try {
- // add the artifacts to the contribution model
- for (Artifact artifact : contribution.getArtifacts()) {
- Object model = null;
-
- // WARNING - I've missed out Venkat's "applies to" function to make life a
- // little clearer
- model = artifactProcessor.read(new URL(contribution.getLocation()),
- new URI(artifact.getURI()),
- new URL(artifact.getLocation()));
-
- if (model != null) {
- artifact.setModel(model);
-
- // Add the loaded model to the model resolver
- contribution.getModelResolver().addModel(model);
-
- if ( model instanceof Composite) {
- ((Composite)model).setURI(artifact.getURI());
- }
-
- /*
- if ( model instanceof SCADefinitions ) {
- contributionSCADefinitions.add((SCADefinitions)model);
- updatePolicySetMap((SCADefinitions)model);
- }
- */
- }
-
- }
-
- } catch(Exception ex){
- logger.warning(ex.toString());
- }
- }
-
- private void resolveContributionArtifacts(Contribution contribution){
- try {
- for (Artifact artifact : contribution.getArtifacts()) {
- // resolve the model object
- if (/*(artifact.getURI().endsWith(".composite") == false) &&*/ (artifact.getModel() != null)) {
- artifactProcessor.resolve(artifact.getModel(), contribution.getModelResolver());
- }
- }
- } catch(Exception ex){
- logger.warning(ex.toString());
- }
- }
-
- /*
- private void resolveComposite(Contribution contribution, Composite composite){
- try {
- artifactProcessor.resolve(composite, contribution.getModelResolver());
- } catch(Exception ex){
- logger.warning(ex.toString());
- }
- }
- */
-
-
-
-
- /**
- * A test method to fire up the various steps in the process of handling contributions
- * So I can get to the stage of being able to process contributions
- * TODO - replace with real workspace that Sebastien is working on
- */
- public void test(){
-
- try {
- // set up the repository where contributions will be stored
- repository = new File(repositoryLocation);
-
- if ((!repository.exists()) || (!repository.isDirectory())){
- logger.warning("Can't find repository - " + repositoryLocation);
- }
-
- // set up the dummy location where contributions are uploaded to
- String uploadedLocation = repository.getParent() + "/uploaded";
- uploaded = new File(uploadedLocation);
-
- if ((!uploaded.exists()) || (!uploaded.isDirectory())){
- logger.warning("Can't find uploaded dir");
- }
-
- // create the repository and the workspace
- contributionRepository = new ContributionRepositoryImpl(repositoryLocation,
- XMLInputFactory.newInstance());
- contributionWorkspace = workspaceFactory.createWorkspace();
-
-
- // pretend that contributions are being added by reading the list of jars in the
- // uploaded dir
- List<URL> contributionJars = getJARsInFolder(uploaded);
-
- // copy uploaded contributions to the repository
- // TODO - no clear how this relates to the workspace. Need more info on workspace
- // but for now just create a contribution model and add to the workspace
- for (URL contributionURL : contributionJars){
- String contributionName = new File(contributionURL.toURI()).getName();
- System.out.println("Processing: " + contributionName);
-
- contributionRepository.store(contributionName, contributionURL);
-
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI(contributionName);
- contribution.setLocation(contributionURL.toString());
-
- contributionWorkspace.getContributions().add(contribution);
- }
-
- // find the artifacts in the contributions in the workspace
- for (Contribution contribution : contributionWorkspace.getContributions()){
- findContributionArtifacts(contribution);
- }
-
- // read the artifacts in the contributions in the workspace
- for (Contribution contribution : contributionWorkspace.getContributions()){
- readContributionArtifacts(contribution);
- }
-
- // resolve the artifacts in the contributions in the workspace
- for (Contribution contribution : contributionWorkspace.getContributions()){
- resolveContributionArtifacts(contribution);
- }
-
- /*
- // parse the contributions into a model
- for (URL contributionURL : contributions){
-
- Contribution contribution = runtime.getContributionService().contribute(new File(contributionURL.toURI()).getName(),
- contributionURL,
- false);
- // workspace or repository?
- //contributionRepository.addContribution(contribution);
- contributionWorkspace.getContributions().add(contribution);
- }
- */
-
- // For interest look at contribution contents
- for (Contribution contribution : contributionWorkspace.getContributions()){
- System.out.println("Contribution URI: " + contribution.getURI());
-
- for (Artifact artifact : contribution.getArtifacts()){
- System.out.println(" Artifact URI: " + artifact.getURI().toString());
- }
-
- // report which contribution satisfies which import
- for (Import anImport : contribution.getImports()){
- if (anImport instanceof JavaImport){
- System.out.println(" Java Import: " + ((JavaImport)anImport).getPackage());
- }
- if (anImport instanceof NamespaceImport){
- System.out.println(" Namespace Import: " + ((NamespaceImport)anImport).getNamespace());
- }
- /*
- for (Contribution importContribution : anImport.getExportContributions()){
- System.out.println(" Import contribution: " + importContribution.getURI().toString());
- }
- */
- }
-
- for (Export anExport : contribution.getExports()){
- if (anExport instanceof JavaExport){
- System.out.println(" Java Export: " + ((JavaExport)anExport).getPackage());
- }
- if (anExport instanceof NamespaceExport){
- System.out.println(" Namespace Export: " + ((NamespaceExport)anExport).getNamespace());
- }
- }
-
- for (Composite composite : contribution.getDeployables()){
- System.out.println(" Deployable Composite URI: " + composite.getName().toString());
- }
- }
-
- // create a domain level virtual composite
- AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
- domainComposite = assemblyFactory.createComposite();
- domainComposite.setName(new QName(Constants.SCA10_NS, "domainComposite"));
- domainComposite.setURI(domainURI);
-
- // Use the deployable composite list to find the composites to load into the domain
- // TODO - there will be some selection process here
- for (Contribution contribution : contributionWorkspace.getContributions()){
- for (Composite deployableComposite : contribution.getDeployables()) {
- Composite deployable = contribution.getModelResolver().resolveModel(Composite.class, deployableComposite);
- domainComposite.getIncludes().add(deployable);
- }
- }
-
-
- System.out.println("\nVANILLA");
- System.out.println("========================================================================");
- writeComposite(domainComposite);
- for (Composite composite : domainComposite.getIncludes()){
- writeComposite(composite);
- }
-
- // assign individual deployed composites to nodes
- // Use the node model on disc to do this in lieu of user input
- URL contributionURL = DomainServiceImpl.class.getClassLoader().getResource("domain/nodes.composite");
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI("nodes");
- String contributionURLString = contributionURL.toString();
- contribution.setLocation(contributionURLString.substring(0, contributionURLString.lastIndexOf("nodes.composite")));
-
- findContributionArtifacts(contribution);
- readContributionArtifacts(contribution);
- resolveContributionArtifacts(contribution);
-
- // find node.composite
- Artifact nodeArtifact = null;
- for (Artifact artifact : contribution.getArtifacts()){
- System.out.println(" Artifact URI: " + artifact.getURI());
- if (artifact.getURI().equals("nodes.composite")){
- nodeArtifact = artifact;
- }
- }
-
- Composite nodes = (Composite)nodeArtifact.getModel();
-
- // Configure the endpoints of services based on the defaults found in the
- // nodes configuration
- NodeAssigner nodeAssigner = new NodeAssigner(registry);
-
- for (Component node : nodes.getComponents()){
- QName compositeName = ((NodeImplementation)node.getImplementation()).getComposite().getName();
-
- Composite compositeModel = null;
-
- // find the named composite in the domain
- for (Composite deployable : domainComposite.getIncludes()){
- if (deployable.getName().equals(compositeName)){
- compositeModel = deployable;
- break;
- }
- }
-
- if (compositeModel != null){
- // configure the composite
-
- NodeInfo nodeInfo = new NodeInfo(node);
- nodeAssigner.assignEndpointsToServiceBinding(nodeInfo, compositeModel, null);
- }
- }
-
- System.out.println("\nAFTER ENDPOINT INITIALIZATION");
- System.out.println("========================================================================");
- writeComposite(domainComposite);
- for (Composite composite : domainComposite.getIncludes()){
- writeComposite(composite);
- }
-
- // build the domain composite
- compositeBuilder.build(domainComposite);
-
- // print out the domain composite
- System.out.println("\nAFTER BUILDING");
- System.out.println("========================================================================");
- writeComposite(domainComposite);
- for (Composite composite : domainComposite.getIncludes()){
- writeComposite(composite);
- }
-
- // remove the contributions from the repository
- for (URL jarURL : contributionJars){
- contributionRepository.remove(new File(jarURL.toURI()).getName());
- }
-
- } catch (Exception ex) {
- logger.warning(ex.toString());
- }
-
- }
-
- private void writeComposite(Composite composite) throws Exception {
- // First write to a byte stream
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLStreamWriter writer = xmlOutputFactory.createXMLStreamWriter(bos);
- compositeProcessor.write(composite, writer);
-
- // Parse again to pretty format the document
- Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
-
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- format.setIndent(2);
-
- // Write to domain.composite
- //FileOutputStream os = new FileOutputStream(new File(compositeFileName));
- XMLSerializer serializer = new XMLSerializer(System.out, format);
- serializer.serialize(document);
-
- }
-
- // DomainServiceInit methods
- public void setDomainURI(String domainURI){
- this.domainURI = domainURI;
- }
-
- // We use an existing runtime to save much repeated work in this test class
- // TODO - look at how we get hold of these things for real
- public void setRuntime(ReallySmallRuntime domainRuntime){
- try {
- this.runtime = domainRuntime;
-
- registry = runtime.getExtensionPointRegistry();
-
- xmlFactory = XMLInputFactory.newInstance();
-
- TypeDescriber describer = new PackageTypeDescriberImpl();
- packageProcessor = new ExtensiblePackageProcessor(registry.getExtensionPoint(PackageProcessorExtensionPoint.class), describer);
-
- artifactProcessor = new ExtensibleURLArtifactProcessor(registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class));
-
- staxProcessor = new ExtensibleStAXArtifactProcessor(registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class), xmlFactory, XMLOutputFactory.newInstance());
-
- contributionListener = new ExtensibleContributionListener(registry.getExtensionPoint(ContributionListenerExtensionPoint.class));
-
- modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
-
- modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- assemblyFactory = runtime.getAssemblyFactory();
-
- contributionFactory = new DefaultContributionFactory();
-
- workspaceFactory = new DefaultWorkspaceFactory();
-
- URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- SCADefinitionsDocumentProcessor definitionsDocumentProcessor = (SCADefinitionsDocumentProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- domainModelResolver = definitionsDocumentProcessor.getSCADefinitionsResolver();
-
- compositeBuilder = runtime.getCompositeBuilder();
-
- policyFactory = modelFactories.getFactory(PolicyFactory.class);
- compositeProcessor = new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory, staxProcessor);
-
- xmlOutputFactory = modelFactories.getFactory(XMLOutputFactory.class);
-
- documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-
- /*
- this.domainResolver = domainResolver;
- this.systemSCADefinitions = scaDefinitions;
- */
-
- } catch (Exception ex) {
- System.out.println("Exception setting runtime on domain service " + ex.toString());
- }
- }
-
- // DomainService methods
- public List<ArtifactImpl> getContributions(){
- List<ArtifactImpl> artifacts = new ArrayList<ArtifactImpl>();
-
- for (Contribution contribution : contributionWorkspace.getContributions()){
- ArtifactImpl artifact = new ArtifactImpl();
-
- artifact.setName(contribution.getURI());
- artifact.setURL(contribution.getLocation());
- artifacts.add(artifact);
- }
-
- return artifacts;
- }
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainServiceInit.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainServiceInit.java
deleted file mode 100644
index 1df7cf1e57..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/DomainServiceInit.java
+++ /dev/null
@@ -1,43 +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.domain.rework;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.domain.DomainException;
-import org.apache.tuscany.sca.domain.management.DomainInfo;
-import org.apache.tuscany.sca.domain.management.NodeInfo;
-import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Domain configuration operations
- *
- * @version $Rev$ $Date$
- */
-public interface DomainServiceInit {
-
- public void setRuntime(ReallySmallRuntime domainRuntime);
- public void setDomainURI(String domainURI);
-
-
- public void test();
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/Launcher.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/Launcher.java
deleted file mode 100644
index 2ec8d23222..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/Launcher.java
+++ /dev/null
@@ -1,225 +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.domain.rework;
-
-import java.io.ByteArrayOutputStream;
-import java.io.Externalizable;
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.DomainBuilder;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.DeployedArtifact;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
-import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
-import org.apache.tuscany.sca.domain.DomainException;
-import org.apache.tuscany.sca.domain.SCADomain;
-import org.apache.tuscany.sca.domain.SCADomainEventService;
-import org.apache.tuscany.sca.domain.SCADomainSPI;
-import org.apache.tuscany.sca.domain.management.SCADomainManagerInitService;
-import org.apache.tuscany.sca.domain.model.CompositeModel;
-import org.apache.tuscany.sca.domain.model.ContributionModel;
-import org.apache.tuscany.sca.domain.model.DomainModel;
-import org.apache.tuscany.sca.domain.model.DomainModelFactory;
-import org.apache.tuscany.sca.domain.model.NodeModel;
-import org.apache.tuscany.sca.domain.model.ServiceModel;
-import org.apache.tuscany.sca.domain.model.NodeModel.LifecyleState;
-import org.apache.tuscany.sca.domain.model.impl.DomainModelFactoryImpl;
-import org.apache.tuscany.sca.domain.model.impl.NodeModelImpl;
-import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.node.NodeException;
-import org.apache.tuscany.sca.node.NodeFactoryImpl;
-import org.apache.tuscany.sca.node.util.SCAContributionUtil;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * The SCA domain repository that manages domain contributions
- *
- * @version $Rev$ $Date$
- */
-public class Launcher {
-
- private final static Logger logger = Logger.getLogger(Launcher.class.getName());
-
-
- // class loader used to get the runtime going
- private ClassLoader domainClassLoader;
-
- // domain management application runtime
- private ReallySmallRuntime domainRepositoryRuntime;
- private ContributionService domainRepositoryContributionService;
- private Contribution domainRepositoryContribution;
- private Composite domainRepositoryComposite;
-
- // domain service
- private DomainServiceInit domainService;
-
- // Implementation methods
-
- /**
- * Create a domain giving the URI for the domain.
- *
- * @throws DomainException
- */
- public Launcher() throws DomainException {
- this.domainClassLoader = Launcher.class.getClassLoader();
- init();
- }
-
- /**
- * Create a runtime for the repository app
- * TODO: we need a better wrapper for this that isn't an SCADomain - too confusing!
- */
- protected void init() throws DomainException {
- try {
-
- // create a runtime for the domain repository services to run on
- domainRepositoryRuntime = new ReallySmallRuntime(domainClassLoader);
- domainRepositoryRuntime.start();
-
- // Create an in-memory domain level management composite
- AssemblyFactory assemblyFactory = domainRepositoryRuntime.getAssemblyFactory();
- domainRepositoryComposite = assemblyFactory.createComposite();
- domainRepositoryComposite.setName(new QName(Constants.SCA10_NS, "domainManagement"));
- domainRepositoryComposite.setURI("domainManagement");
-
- // Find the composite that will configure the domain
- String domainCompositeName = "domain/domain.composite";
- URL contributionURL = SCAContributionUtil.findContributionFromResource(domainClassLoader, domainCompositeName);
-
-
- if ( contributionURL != null ){
- logger.log(Level.INFO, "Domain configured from " + contributionURL);
-
- // add domain.composite to the management domain
- domainRepositoryContributionService = domainRepositoryRuntime.getContributionService();
- Contribution contribution = null;
- contribution = domainRepositoryContributionService.contribute("domainRepository",
- contributionURL,
- false);
-
- // update the runtime for all SCA Definitions processed from the contribution.
- // so that the policyset determination done during 'build' has the all the defined
- // intents and policysets from the management contribution
- domainRepositoryRuntime.updateSCADefinitions(domainRepositoryContributionService.getContributionSCADefinitions());
-
- Composite composite = null;
- for (Artifact artifact: contribution.getArtifacts()) {
- if (domainCompositeName.equals(artifact.getURI())) {
- composite = (Composite)artifact.getModel();
- }
- }
-
- if (composite != null) {
-
- domainRepositoryRuntime.buildComposite(composite);
- domainRepositoryRuntime.getCompositeActivator().activate(composite);
- domainRepositoryRuntime.getCompositeActivator().start(composite);
-
- // find the domain service
- Component component = null;
-
- for (Component compositeComponent: composite.getComponents()) {
- if (compositeComponent.getName().equals("DomainService")) {
- component = compositeComponent;
- }
- }
-
- RuntimeComponentContext componentContext = ((RuntimeComponent)component).getComponentContext();
- domainService = componentContext.createSelfReference(DomainServiceInit.class, "DomainServiceInit").getService();
-
- // set up the domain service. Could work out what the URI
- // is by looking at the service URL or could put it in the
- // config file
- domainService.setDomainURI("http://localhost:8080");
- domainService.setRuntime(domainRepositoryRuntime);
-
- } else {
- throw new ActivationException("Domain repository contribution " +
- contributionURL +
- " found but could not be loaded");
- }
- } else {
- throw new ActivationException("Domain repository contribution " +
- domainCompositeName +
- " not found on the classpath");
- }
-
-
- } catch(Exception ex) {
- throw new DomainException(ex);
- }
- }
-
- public static void main(String[] args) throws Exception {
- System.out.println("Starting ...");
-
- Launcher domainLauncher = new Launcher();
-
- System.out.println("domain repository started");
-
- // start contribution processing
- domainLauncher.domainService.test();
-
- System.out.println("Running ...");
- // System.in.read();
-
-
- System.out.println("Stopping ...");
- }
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/NodeService.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/NodeService.java
deleted file mode 100644
index 564cdeca65..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/domain/rework/NodeService.java
+++ /dev/null
@@ -1,34 +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.domain.rework;
-
-import org.apache.tuscany.sca.domain.management.DomainInfo;
-import org.apache.tuscany.sca.domain.management.NodeInfo;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Node configuration operations
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface NodeService {
-
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/workspace/configuration/impl/NodeAssigner.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/workspace/configuration/impl/NodeAssigner.java
deleted file mode 100644
index 13de5db234..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/workspace/configuration/impl/NodeAssigner.java
+++ /dev/null
@@ -1,300 +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.workspace.configuration.impl;
-
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.binding.BindingURICalculator;
-import org.apache.tuscany.sca.binding.DefaultBindingURICalculatorExtensionPoint;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.ServletMappingException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.workspace.Workspace;
-
-/**
- * Changes the configuration of a composite to effect assignment to a node
- *
- * @version $Rev$ $Date$
- */
-public class NodeAssigner {
-
- private final static Logger logger = Logger.getLogger(NodeAssigner.class.getName());
-
- SCABindingFactory scaBindingFactory;
- IntentAttachPointTypeFactory intentAttachPointTypeFactory;
- DefaultBindingURICalculatorExtensionPoint bindingURICalcualtorExtensionPoint;
-
- /**
- * Constructs a new NodeAssigner
- */
- public NodeAssigner(ExtensionPointRegistry registry) {
-
- //Get factory extension point
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- scaBindingFactory = factories.getFactory(SCABindingFactory.class);
- IntentAttachPointTypeFactory intentAttachPointTypeFactory = factories.getFactory(IntentAttachPointTypeFactory.class);
-
- //InterfaceContractMapper mapper = new InterfaceContractMapperImpl();
-
- bindingURICalcualtorExtensionPoint = new DefaultBindingURICalculatorExtensionPoint();
- }
-
-
- public void assignEndpointsToServiceBinding(NodeInfo nodeInfo, Composite composite, String uri){
-
- String parentComponentURI = uri;
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
-
- // Initialize component URI
- String componentURI;
- if (parentComponentURI == null) {
- componentURI = component.getName();
- } else {
- componentURI = URI.create(parentComponentURI + '/').resolve(component.getName()).toString();
- }
- component.setURI(componentURI);
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // Process nested composite
- assignEndpointsToServiceBinding(nodeInfo, (Composite)implementation, componentURI);
- }
- }
-
- // Initialize composite service binding URIs
- List<Service> compositeServices = composite.getServices();
- for (Service service : compositeServices) {
- // Set default binding names
-
- // Create default SCA binding
- if (service.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- service.getBindings().add(scaBinding);
- }
-
- // Initialize binding names and URIs
- for (Binding binding : service.getBindings()) {
- constructBindingName(service, binding);
- constructBindingURI(parentComponentURI, composite, service, binding, nodeInfo);
- }
- }
-
- // Initialize component service binding URIs
- for (Component component : composite.getComponents()) {
- for (ComponentService service : component.getServices()) {
-
- // Create default SCA binding
- if (service.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- service.getBindings().add(scaBinding);
- }
-
- // Initialize binding names and URIs
- for (Binding binding : service.getBindings()) {
-
- constructBindingName(service, binding);
- constructBindingURI(component, service, binding, nodeInfo);
- }
- }
- }
- }
-
- private SCABinding createSCABinding() {
- SCABinding scaBinding = scaBindingFactory.createSCABinding();
- IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
- bindingType.setName(Constants.BINDING_SCA_QNAME);
- bindingType.setUnresolved(true);
- ((PolicySetAttachPoint)scaBinding).setType(bindingType);
-
- return scaBinding;
- }
-
- private void constructBindingName(Service service, Binding binding){
-
- // set the default binding name if one is required
- // if there is no name on the binding then set it to the service name
- if (binding.getName() == null){
- binding.setName(service.getName());
-
- // if multiple bindings don't have a name raise an error as
- // binding must be uniquely named
- for (Binding serviceBinding : service.getBindings()){
- if ((!binding.equals(serviceBinding)) &&
- (serviceBinding.getName().equals(service.getName()))){
- // TODO collate errors
- logger.warning("Multiple bindings for service " + service.getName() + " have no name");
- }
- }
- }
- }
-
- /**
- * URI construction from Assembly spec section 1.7.2
- * @return
- */
- private void constructBindingURI(String parentComponentURI, Composite composite, Service service, Binding binding, NodeInfo nodeInfo ) {
- // This is a composite service so there is no component to provide a component URI
- // The path to this composite (through nested composites) is used.
- constructBindingURI(parentComponentURI, service, binding, composite.getServices().size() > 1, nodeInfo);
- }
-
- private void constructBindingURI(Component component, Service service, Binding binding, NodeInfo nodeInfo ) {
- String componentURIString = null;
-
- // if a URI is specified on the component use it otherwise use the component name
- if (component.getURI() != null){
- componentURIString = component.getURI();
- } else {
- componentURIString = component.getName();
- }
-
- constructBindingURI(componentURIString, service, binding, component.getServices().size() > 1, nodeInfo);
- }
-
- private void constructBindingURI(String componentURIString, Service service, Binding binding, boolean includeServiceBindingURI, NodeInfo nodeInfo ){
-
- try {
- URI baseURI = null;
- URI componentURI = null;
- URI serviceBindingURI = null;
-
- // calculate the service binding URI
- if (binding.getURI() == null){
- serviceBindingURI = new URI(binding.getName());
- } else {
- serviceBindingURI = new URI(binding.getURI());
- }
-
- // if the user has provided an absolute binding URI then use it
- if (serviceBindingURI != null && serviceBindingURI.isAbsolute()){
- binding.setURI(serviceBindingURI.toString());
- return;
- }
-
- // calculate the component URI
- if (componentURIString != null) {
- componentURI = new URI(componentURIString);
- } else {
- componentURI = null;
- }
-
- // if the user has provided an absolute component URI then use it
- if (componentURI != null && componentURI.isAbsolute()){
- binding.setURI(concatenateModelURI(null, componentURI, serviceBindingURI, includeServiceBindingURI).toString());
- return;
- }
-
- // calculate the base URI
-
- // get the protocol for this binding/URI
- BindingURICalculator uriCalculator = bindingURICalcualtorExtensionPoint.getBindingURICalculator(binding);
-
- if (uriCalculator != null){
- logger.warning("Binding calculator found for binding " + binding.getName() + " " + binding.getClass().getName());
- String protocol = uriCalculator.getProtocol(binding);
-
- // find the default binding with the right protocol
- Binding defaultBinding = nodeInfo.getBindingDefault(binding, protocol);
-
- if (defaultBinding != null){
- baseURI = new URI(defaultBinding.getURI());
- } else {
- baseURI = null;
- }
-
- } else {
- logger.warning("Binding calculator not found for binding " + binding.getName() + " " + binding.getClass().getName());
- baseURI = null;
- }
-
- binding.setURI(concatenateModelURI(baseURI, componentURI, serviceBindingURI,includeServiceBindingURI).toString());
- } catch (Exception ex){
- // TODO collate errors
- logger.warning("Error during URL creation " + ex.toString());
- }
- }
-
- private URI concatenateModelURI(URI baseURI, URI componentURI, URI serviceBindingURI, boolean includeServiceBindingURI){
-
- if (baseURI == null){
- if (componentURI == null){
- return serviceBindingURI;
- } else {
- if (includeServiceBindingURI){
- return componentURI.resolve("/").resolve(serviceBindingURI);
- } else {
- return componentURI;
- }
- }
- } else {
- if (componentURI == null){
- if (includeServiceBindingURI){
- return baseURI.resolve("/").resolve(serviceBindingURI);
- } else {
- return baseURI;
- }
- } else {
- if (includeServiceBindingURI){
- return baseURI.resolve("/").resolve(componentURI).resolve("/").resolve(serviceBindingURI);
- } else {
- return baseURI.resolve("/").resolve(componentURI);
- }
- }
- }
- }
-}
diff --git a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/workspace/configuration/impl/NodeInfo.java b/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/workspace/configuration/impl/NodeInfo.java
deleted file mode 100644
index 71a45a5558..0000000000
--- a/sandbox/slaws/modules/domain-rework/src/main/java/org/apache/tuscany/sca/workspace/configuration/impl/NodeInfo.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.workspace.configuration.impl;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-
-/**
- * A class which wraps a node component and provides helper methods
- *
- * @version $Rev$ $Date$
- */
-public class NodeInfo {
-
- private Component node;
- private Map<String, Binding> defaultBindings = new HashMap<String, Binding>();
-
- public NodeInfo(Component node) throws URISyntaxException {
-
- this.node = node;
-
- // Cache the default binding info for the node
- ComponentService defaultService = node.getServices().get(0);
- for (Binding binding : defaultService.getBindings()){
-
- if (binding.getURI() != null){
- // get the schema from the binding URI
- URI bindingURI = new URI(binding.getURI());
-
- // store the binding away indexed on type and scheme
- defaultBindings.put(binding.getClass().getName() + ":" + bindingURI.getScheme(), binding);
- }
- }
- }
-
- public Binding getBindingDefault(Binding binding, String protocol){
- return defaultBindings.get(binding.getClass().getName() + ":" + protocol);
- }
-
-}