You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2007/09/20 15:53:52 UTC
svn commit: r577748 [2/4] - in /incubator/tuscany/java/sca: ./
itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/
itest/databindings/sdogen/
itest/databindings/sdogen/src/main/resources/generate/
itest/interop-soap-client/...
Added: incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java (added)
+++ incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java Thu Sep 20 06:53:40 2007
@@ -0,0 +1,256 @@
+/*
+ * 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;
+
+import java.net.URL;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ServiceReference;
+import org.osoa.sca.ServiceRuntimeException;
+
+
+/**
+ * A handle to an SCA domain.
+ *
+ * @version $Rev: 556897 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public abstract class SCADomain {
+
+
+ final static String LOCAL_DOMAIN_URI = "standalonedomain";
+ final static String LOCAL_NODE_URI = "standalonenode";
+
+
+ /**
+ * Returns a new instance of a local SCA domain.
+ *
+ * @return
+ */
+ public static SCADomain newInstance() {
+ return createNewInstance(LOCAL_DOMAIN_URI, LOCAL_NODE_URI, null);
+ }
+
+ /**
+ * Returns a new instance of a local SCA domain. The specified deployable
+ * composite will be included in the SCA domain.
+ *
+ * @param composite the deployable composite to include in the SCA domain.
+ * @return
+ */
+ public static SCADomain newInstance(String composite) {
+ return createNewInstance(LOCAL_DOMAIN_URI, LOCAL_NODE_URI, "/", composite);
+ }
+
+ /**
+ * Returns a new instance of a local SCA domain. The specified deployable
+ * composites will be included in the SCA domain.
+ *
+ * @param domainURI the URI of the SCA domain identifies where the domain service is running
+ * @param nodeURI the URI of the node - either a URL used to describe the node endpoints or a URI just used identify the node
+ * @param contributionLocation the location of an SCA contribution
+ * @param composites the deployable composites to include in the SCA domain.
+ * @return
+ */
+ public static SCADomain newInstance(String domainURI, String nodeURI, String contributionLocation, String... composites) {
+ return createNewInstance(domainURI, nodeURI, contributionLocation, composites);
+ }
+
+ /**
+ * Removes the specified local SCA Domain instance
+ *
+ * @param domainInstance the instance to be removed
+ */
+ // FIXME: Adding this as temporary support for the "connect" API
+ // public static void removeInstance(SCADomain domainInstance) {
+ // }
+
+ /**
+ * Returns an SCADomain representing a remote SCA domain.
+ *
+ * @param domainURI the URI of the SCA domain
+ * @return
+ */
+ // FIXME : this is a temporary implementation to get the capability working
+ // public static SCADomain connect(String domainURI) {
+ // return null;
+ // }
+
+ /**
+ * Close the SCA domain.
+ */
+ public abstract void close();
+
+ /**
+ * Returns the URI of the SCA Domain.
+ *
+ * @return the URI of the SCA Domain
+ */
+ public abstract String getURI();
+
+ /**
+ * Cast a type-safe reference to a CallableReference. Converts a type-safe
+ * reference to an equivalent CallableReference; if the target refers to a
+ * service then a ServiceReference will be returned, if the target refers to
+ * a callback then a CallableReference will be returned.
+ *
+ * @param target a reference proxy provided by the SCA runtime
+ * @param <B> the Java type of the business interface for the reference
+ * @param <R> the type of reference to be returned
+ * @return a CallableReference equivalent for the proxy
+ * @throws IllegalArgumentException if the supplied instance is not a
+ * reference supplied by the SCA runtime
+ */
+ public abstract <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
+
+ /**
+ * Returns a proxy for a service provided by a component in the SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return an object that implements the business interface
+ */
+ public abstract <B> B getService(Class<B> businessInterface, String serviceName);
+
+ /**
+ * Returns a ServiceReference for a service provided by a component in the
+ * SCA domain.
+ *
+ * @param businessInterface the interface that will be used to invoke the
+ * service
+ * @param serviceName the name of the service
+ * @param <B> the Java type of the business interface for the service
+ * @return a ServiceReference for the designated service
+ */
+ public abstract <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+
+ /**
+ * Read the service name from a configuration file
+ *
+ * @param classLoader
+ * @param name The name of the service class
+ * @return A class name which extends/implements the service class
+ * @throws IOException
+ */
+ private static String getServiceName(ClassLoader classLoader, String name) throws IOException {
+ InputStream is = classLoader.getResourceAsStream("META-INF/services/" + name);
+ if (is == null) {
+ return null;
+ }
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new InputStreamReader(is));
+ while (true) {
+ String line = reader.readLine();
+ if (line == null) {
+ break;
+ } else if (!line.startsWith("#")) {
+ return line.trim();
+ }
+ }
+ } finally {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns an SCADomain instance. If the system property
+ * "org.apache.tuscany.sca.host.embedded.SCADomain" is set, its value is used as
+ * the name of the implementation class. Otherwise, if the resource
+ * "META-INF/services/org.apache.tuscany.sca.host.embedded.SCADomain" can be
+ * loaded from the supplied classloader. Otherwise, it will use
+ * "org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain" as the default.
+ * The named class is loaded from the supplied classloader.
+ *
+ * @param classLoader
+ * @param domainURI
+ * @param contributionLocation
+ * @param composites
+ * @return
+ */
+ static SCADomain createNewInstance(String domainURI, String nodeURI, String contributionLocation, String... composites) {
+
+ SCADomain node = null;
+
+ try {
+ // Determine the runtime and application classloader
+ final ClassLoader runtimeClassLoader = SCADomain.class.getClassLoader();
+ final ClassLoader applicationClassLoader = Thread.currentThread().getContextClassLoader();
+
+ // Discover the SCADomain implementation
+ final String name = SCADomain.class.getName();
+ String className = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ return System.getProperty(name);
+ }
+ });
+
+ if (className == null) {
+ className = getServiceName(runtimeClassLoader, name);
+ }
+
+ if (className == null) {
+ className = "org.apache.tuscany.sca.node.impl.SCANodeImpl";
+ }
+
+ // Create an instance of the discovered SCA domain implementation
+ Class cls = Class.forName(className, true, runtimeClassLoader);
+ Constructor<?> constructor = null;
+ try {
+ constructor = cls.getConstructor(String.class,
+ String.class,
+ ClassLoader.class,
+ ClassLoader.class,
+ String.class,
+ String[].class);
+ } catch (NoSuchMethodException e) {}
+
+ if (constructor != null) {
+ node = (SCADomain)constructor.newInstance(domainURI,
+ nodeURI,
+ runtimeClassLoader,
+ applicationClassLoader,
+ contributionLocation,
+ composites);
+ }
+
+ return node;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ // public ComponentManager getComponentManager() {
+ // return null;
+ // }
+}
Modified: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerServiceImpl.java Thu Sep 20 06:53:40 2007
@@ -21,12 +21,12 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
-import org.apache.tuscany.sca.assembly.SCABinding;
import org.apache.tuscany.sca.domain.DomainManagerService;
import org.apache.tuscany.sca.domain.NodeInfo;
-import org.apache.tuscany.sca.domain.ServiceDiscoveryService;
-import org.apache.tuscany.sca.domain.impl.ServiceDiscoveryServiceImpl.ServiceEndpoint;
+import org.apache.tuscany.sca.domain.SCADomainService;
import org.osoa.sca.annotations.Reference;
import org.osoa.sca.annotations.Scope;
@@ -39,31 +39,38 @@
@Scope("COMPOSITE")
public class DomainManagerServiceImpl implements DomainManagerService{
+ private final static Logger logger = Logger.getLogger(DomainManagerServiceImpl.class.getName());
+
@Reference
- public ServiceDiscoveryService serviceDiscovery;
+ public SCADomainService scaDomainService;
List<NodeInfo> nodes = new ArrayList<NodeInfo>();
public String registerNode(String domainUri, String nodeUri){
+ // try and remove it first just in case it's already registered
+ removeNode(domainUri, nodeUri);
+
NodeInfo nodeInfo = new NodeInfoImpl(domainUri, nodeUri);
nodes.add(nodeInfo);
- System.err.println("Registering node: " + nodeUri);
+ logger.log(Level.INFO, "Registered node: " + nodeUri);
return nodeUri;
}
public String removeNode(String domainUri, String nodeUri){
- NodeInfo nodeToRemove = null;
+ List<NodeInfo> nodesToRemove = new ArrayList<NodeInfo>();
for(NodeInfo node : nodes){
if ( node.match(domainUri, nodeUri)){
- nodeToRemove = node;
- break;
+ nodesToRemove.add(node);
}
}
- nodes.remove(nodeToRemove);
- System.err.println("Removed node: " + nodeUri);
+ for(NodeInfo nodeToRemove : nodesToRemove){
+ nodes.remove(nodeToRemove);
+ logger.log(Level.INFO, "Removed node: " + nodeUri);
+ }
+
return nodeUri;
}
@@ -72,11 +79,10 @@
// get the nodeManagerUrl for each node
for(NodeInfo node : nodes){
- String url = serviceDiscovery.findServiceEndpoint(node.getDomainUri(),
+ String url = scaDomainService.findServiceEndpoint(node.getDomainUri(),
node.getNodeUri() + "NodeManagerService",
"");
-
if (url != null) {
node.setNodeManagerUrl(url);
}
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainServiceImpl.java?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainServiceImpl.java Thu Sep 20 06:53:40 2007
@@ -0,0 +1,200 @@
+/*
+ * 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.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.domain.SCADomainService;
+import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Scope("COMPOSITE")
+public class SCADomainServiceImpl implements SCADomainService {
+
+ private final static Logger logger = Logger.getLogger(SCADomainServiceImpl.class.getName());
+
+ List<ServiceEndpoint> serviceEndpoints = new ArrayList<ServiceEndpoint>();
+
+ public class ServiceEndpoint {
+ public String domainUri;
+ public String nodeUri;
+ public String serviceName;
+ public String bindingName;
+ public String url;
+
+ public ServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+ this.domainUri = domainUri;
+ this.nodeUri = nodeUri;
+ this.serviceName = serviceName;
+ this.bindingName = bindingName;
+ this.url = URL;
+ }
+
+ public boolean match(String domainUri, String serviceName, String bindingName) {
+ // trap the case where the we are trying to map
+ // ComponentName/Service name with a registered ComponentName - this is OK
+ // ComponentName with a registered ComponentName/ServiceName - this should fail
+
+ boolean serviceNameMatch = false;
+
+ if (this.serviceName.equals(serviceName)) {
+ serviceNameMatch = true;
+ } else {
+ int s = serviceName.indexOf('/');
+ if ((s != -1) &&
+ (this.serviceName.equals(serviceName.substring(0, s)))){
+ serviceNameMatch = true;
+ }
+ }
+
+ return ((this.domainUri.equals(domainUri)) &&
+ (serviceNameMatch) &&
+ (this.bindingName.equals(bindingName)));
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ @Override
+ public String toString (){
+ return "[" +
+ domainUri + " " +
+ nodeUri + " " +
+ serviceName + " " +
+ bindingName + " " +
+ url +
+ "]";
+ }
+ }
+
+ /**
+ * Accepts information about a service endpoint and holds onto it
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param nodeUri the string uri for the current node
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that is providing the endpoint
+ * @param url the enpoint url
+ */
+ public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+ // if the service name ends in a "/" remove it
+ String modifiedServiceName = null;
+ if ( serviceName.endsWith("/") ) {
+ modifiedServiceName = serviceName.substring(0, serviceName.length() - 1);
+ } else {
+ modifiedServiceName = serviceName;
+ }
+
+
+ ServiceEndpoint serviceEndpoint = new ServiceEndpoint (domainUri, nodeUri, modifiedServiceName, bindingName, URL);
+ serviceEndpoints.add(serviceEndpoint);
+ logger.log(Level.INFO, "Registered service: " + serviceEndpoint.toString());
+ return "";
+ }
+
+ /**
+ * Removes information about a service endpoint
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param nodeUri the string uri for the current node
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that is providing the endpoint
+ */
+ public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
+
+ List<ServiceEndpoint> serviceEndpointsToRemove = new ArrayList<ServiceEndpoint>();
+
+ for(ServiceEndpoint serviceEndpoint : serviceEndpoints){
+ if ( serviceEndpoint.match(domainUri, serviceName, bindingName)){
+ serviceEndpointsToRemove.add(serviceEndpoint);
+ }
+ }
+
+ for(ServiceEndpoint serviceEndpointToRemove : serviceEndpointsToRemove){
+ serviceEndpoints.remove(serviceEndpointToRemove);
+ logger.log(Level.INFO, "Removed service: " + serviceName );
+ }
+
+ return "";
+ }
+
+ /**
+ * Locates information about a service endpoint
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that we want to find an endpoint for
+ * @return url the endpoint url
+ */
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+ logger.log(Level.INFO, "Finding service: [" +
+ domainUri + " " +
+ serviceName + " " +
+ bindingName +
+ "]");
+
+ String url = "";
+
+ for(ServiceEndpoint serviceEndpoint : serviceEndpoints){
+ if ( serviceEndpoint.match(domainUri, serviceName, bindingName)){
+ url = serviceEndpoint.getUrl();
+ // if you want to temporarily modify the registered port
+ // numbers for debugging uncomment this line
+ //url = replacePort(url, "8085", "8086");
+ logger.log(Level.INFO, "Found service url: " + url);
+ }
+ }
+ return url;
+ }
+
+ /**
+ * Converts a port number to something else to allow for debugging using a
+ * HTTP sniffer
+ * @param url
+ * @param fromPort the port to look for
+ * @param toPort the port to replace it with
+ * @return the new url
+ */
+ private String replacePort(String url, String fromPort, String toPort) {
+ return url.replace(fromPort, toPort);
+ }
+
+ public ServiceInfo getServiceInfo(){
+
+ ServiceEndpoint serviceEndpoint = serviceEndpoints.get(0);
+
+ return new ServiceInfoImpl(serviceEndpoint.domainUri,
+ serviceEndpoint.nodeUri,
+ serviceEndpoint.serviceName,
+ serviceEndpoint.bindingName,
+ serviceEndpoint.url);
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/META-INF/sca-contribution.xml?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/META-INF/sca-contribution.xml (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/META-INF/sca-contribution.xml Thu Sep 20 06:53:40 2007
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample">
+ <deployable composite="sample:Domain"/>
+</contribution>
\ No newline at end of file
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite Thu Sep 20 06:53:40 2007
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample"
+ xmlns:sample="http://sample"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+ name="Domain">
+
+ <component name="domain">
+ <tuscany:implementation.resource location="webroot"/>
+ <service name="Resource">
+ <tuscany:binding.http uri="http://localhost:8877/domain"/>
+ </service>
+ </component>
+
+ <component name="DomainManagerComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.impl.DomainManagerServiceImpl"/>
+ <service name="DomainManagerService">
+ <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerService"/>
+ <binding.ws uri="http://localhost:8877/DomainManagerComponent/DomainManager"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8877/DomainManagerComponent/DomainManagerJson"/>
+ </service>
+ <reference name="scaDomainService" target="SCADomainComponent"/>
+ </component>
+
+ <component name="SCADomainComponent">
+ <implementation.java class="org.apache.tuscany.sca.domain.impl.SCADomainServiceImpl" />
+ <service name="SCADomainService">
+ <interface.java interface="org.apache.tuscany.sca.domain.SCADomainService"/>
+ <binding.sca uri="http://localhost:8877/SCADomainComponent/SCADomainServiceSCA"/>
+ <binding.ws uri="http://localhost:8877/SCADomainComponent/SCADomainService"/>
+ <tuscany:binding.jsonrpc uri="http://localhost:8877/SCADomainComponent/SCADomainServiceJson"/>
+ </service>
+ </component>
+
+</composite>
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/domain.png
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/domain.png?rev=577748&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/domain.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/index.html Thu Sep 20 06:53:40 2007
@@ -0,0 +1,94 @@
+<html>
+<!--
+ * 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.
+ -->
+<head>
+<title>Apache Tuscany Domain</TITLE>
+
+ <script type="text/javascript" src="../SCADomain/scaDomain.js"></script>
+
+ <script language="JavaScript">
+
+ domainManager = new JSONRpcClient("../DomainManagerComponent/DomainManagerJson");
+
+ function getNodeInfo() {
+ domainManager.DomainManagerService.getNodeInfo(handleGetNodeInfo);
+ }
+
+ function handleGetNodeInfo(result) {
+
+ var text = ""
+
+ for (var i in result.list){
+ var node = result.list[i];
+
+ text = text + "<table>";
+ text = text + "<TR CLASS='source_1' >";
+ text = text + " <TD>";
+ text = text + " <IMG SRC='node.png'/> " + node.domainUri;
+ text = text + " </TD>";
+
+ var noProtocol = node.nodeManagerUrl.substring(7);
+ var colonPos = noProtocol.indexOf(':')
+ var nodeManagerWebUrl = noProtocol.substring(0, colonPos + 6);
+ nodeManagerWebUrl = "http://" + nodeManagerWebUrl + "node/index.html";
+
+ text = text + " <TD CLASS='clickable link' ONCLICK=\"showNode('" + nodeManagerWebUrl + "')\">" + node.nodeUri + "</TD>";
+ text = text + "</TR>";
+ text = text + "</table>";
+ }
+
+ document.getElementById('domainInfo').innerHTML=text;
+ }
+
+ function showNode(url)
+ {
+ document.getElementById("nodePage").innerHTML="<IFRAME CLASS='alert_data' SRC='"+url+"'/>";
+ window.location="#data";
+ return;
+ }
+
+ </script>
+
+ <link rel="stylesheet" type="text/css" href="style.css" />
+</head>
+
+<body onload="getNodeInfo()">
+
+<h1 id="top">Apache Tuscany Domain</h1>
+<div id="errors"></div>
+
+<table>
+<TR>
+<TD>
+DomainURI
+</TD>
+<TD>
+NodeURI
+</TD>
+</TR>
+</table>
+
+<div id="domainInfo"></div>
+
+<p /><input type="button" value="Refresh" onclick="getNodeInfo()" />
+
+<div id="nodePage"></div>
+
+</body>
+</html>
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/node.png
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/node.png?rev=577748&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/node.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/style.css
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/style.css?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/style.css (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/webroot/style.css Thu Sep 20 06:53:40 2007
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+
+p,table,li,h1,h2,h3
+{
+font-family: verdana, arial, 'sans serif';
+}
+
+p, h1, h2, h3, table, li, hr
+{
+margin-left: 10pt;
+}
+
+table
+{
+border-color: black;
+border-collapse: separate;
+border-spacing: 0px 1px;
+
+margin-right: 10pt;
+margin-left: 10pt;
+width: 800px;
+}
+
+.sourceDetailsTable
+{
+width: 600px;
+}
+
+tr, td
+{
+margin-left: 0pt;
+margin-right: 0pt;
+padding-left: 10pt;
+font-size: 90%;
+}
+
+p,li,th
+{
+font-size: 90%;
+margin-left: 10pt;
+}
+
+pre
+{
+margin-left: 10pt;
+}
+
+body
+{
+#ffffff;
+}
+
+h1,h2,h3,hr
+{
+color: firebrick;
+}
+
+a:link {COLOR: firebrick;}
+a:visited {COLOR: firebrick;}
+a:active {COLOR: navy;}
+
+.link
+{
+COLOR: firebrick;
+text-decoration: underline;
+}
+
+.clickable
+{
+cursor: pointer
+}
+
+.unread_title
+{
+font-weight: bold;
+}
+
+.read_title
+{
+font-weight: normal;
+}
+
+.summary
+{
+color: DimGrey;
+}
+
+.hidden
+{
+display: none;
+}
+
+.source_name
+{
+width: 600px;
+}
+
+.alert_text
+{
+width: 600px;
+}
+
+.alert_data
+{
+margin-left: 10px;
+width: 800px;
+height: 800px;
+}
+
+.source_0
+{
+background-color: LightGreen;
+}
+
+.source_1
+{
+background-color: LightSkyBlue;
+}
+
+.source_2
+{
+background-color: Khaki;
+}
+
+.source_3
+{
+background-color: LightPink;
+}
+
+.source_4
+{
+background-color: Orange;
+}
+
+.source_5
+{
+background-color: LightCoral;
+}
+
+.source_6
+{
+background-color: Orchid;
+}
+
+.source_7
+{
+background-color: Peru;
+}
+
+.source_8
+{
+background-color: SpringGreen;
+}
+
+.source_9
+{
+background-color: LightGrey;
+}
+
Modified: incubator/tuscany/java/sca/modules/domain/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/domain/pom.xml Thu Sep 20 06:53:40 2007
@@ -33,7 +33,7 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainService.java?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainService.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainService.java Thu Sep 20 06:53:40 2007
@@ -0,0 +1,78 @@
+/*
+ * 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;
+
+import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.osoa.sca.annotations.Remotable;
+
+
+/**
+ * Provides a mechanism whereby service endoints can be shared amongst the
+ * nodes of a domain.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Remotable
+public interface SCADomainService {
+
+ /**
+ * Accepts information about a service endpoint and holds onto it
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param nodeUri the string uri for the current node
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that is providing the endpoint
+ * @param url the enpoint url
+ * @return TBD - information about the registration
+ */
+ public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL);
+
+
+ /**
+ * Removes information about a service endpoint
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param nodeUri the string uri for the current node
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that is providing the endpoint
+ */
+ public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName);
+
+
+ /**
+ * Locates information about a service endpoint
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that we want to find an endpoint for
+ * @return url the endpoint url
+ */
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName);
+
+
+
+ /**
+ * Returns information for all registered services
+ * @return
+ */
+ public ServiceInfo getServiceInfo();
+
+
+}
Modified: incubator/tuscany/java/sca/modules/implementation-bpel/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-bpel/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-bpel/pom.xml Thu Sep 20 06:53:40 2007
@@ -55,7 +55,7 @@
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
@@ -405,4 +405,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: incubator/tuscany/java/sca/modules/implementation-das/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-das/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-das/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-das/pom.xml Thu Sep 20 06:53:40 2007
@@ -69,7 +69,7 @@
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
Modified: incubator/tuscany/java/sca/modules/implementation-data/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-data/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-data/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-data/pom.xml Thu Sep 20 06:53:40 2007
@@ -69,7 +69,7 @@
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
Modified: incubator/tuscany/java/sca/modules/implementation-java/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-java/pom.xml Thu Sep 20 06:53:40 2007
@@ -43,7 +43,7 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
</dependencies>
Modified: incubator/tuscany/java/sca/modules/implementation-notification/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-notification/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-notification/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-notification/pom.xml Thu Sep 20 06:53:40 2007
@@ -32,7 +32,7 @@
<dependencies>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
Modified: incubator/tuscany/java/sca/modules/implementation-osgi/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/pom.xml Thu Sep 20 06:53:40 2007
@@ -47,7 +47,7 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
Modified: incubator/tuscany/java/sca/modules/implementation-script/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-script/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-script/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-script/pom.xml Thu Sep 20 06:53:40 2007
@@ -40,7 +40,7 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
@@ -60,6 +60,12 @@
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
<version>1.2.5</version>
</dependency>
Modified: incubator/tuscany/java/sca/modules/implementation-spring/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/pom.xml Thu Sep 20 06:53:40 2007
@@ -56,7 +56,7 @@
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
Modified: incubator/tuscany/java/sca/modules/interface-java/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/interface-java/pom.xml Thu Sep 20 06:53:40 2007
@@ -43,7 +43,7 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
</dependencies>
Modified: incubator/tuscany/java/sca/modules/java2wsdl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/java2wsdl/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/java2wsdl/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/java2wsdl/pom.xml Thu Sep 20 06:53:40 2007
@@ -37,7 +37,7 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>sca-api</artifactId>
+ <artifactId>tuscany-sca-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
@@ -74,6 +74,12 @@
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ </exclusion>
+ </exclusions>
<version>1.2.5</version>
</dependency>
Modified: incubator/tuscany/java/sca/modules/node-impl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/pom.xml?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/node-impl/pom.xml Thu Sep 20 06:53:40 2007
@@ -52,13 +52,13 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-domain</artifactId>
+ <artifactId>tuscany-node</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node</artifactId>
+ <artifactId>tuscany-domain-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
@@ -83,7 +83,7 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
+ <artifactId>tuscany-host-tomcat</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
<scope>test</scope>
</dependency>
@@ -101,6 +101,26 @@
<version>1.1-incubating-SNAPSHOT</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-jsonrpc</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-http</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-resource</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ComponentManagerServiceImpl.java Thu Sep 20 06:53:40 2007
@@ -29,8 +29,6 @@
import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
import org.apache.tuscany.sca.node.ComponentListener;
import org.apache.tuscany.sca.node.ComponentManager;
-import org.apache.tuscany.sca.domain.Domain;
-import org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain;
import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
public class ComponentManagerServiceImpl implements ComponentManager {
Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ContributionManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ContributionManagerImpl.java?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ContributionManagerImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/ContributionManagerImpl.java Thu Sep 20 06:53:40 2007
@@ -25,17 +25,22 @@
import java.util.HashMap;
import java.util.Map;
+import javax.xml.namespace.QName;
+
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionException;
import org.apache.tuscany.sca.contribution.service.ContributionService;
import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.node.CompositeManager;
import org.apache.tuscany.sca.node.ContributionManager;
import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.osoa.sca.ServiceRuntimeException;
-public class ContributionManagerImpl implements ContributionManager {
+public class ContributionManagerImpl implements ContributionManager, CompositeManager {
protected String domainURI;
protected String nodeName;
@@ -45,6 +50,7 @@
private ModelResolver modelResolver;
+ private Map<String, Composite> compositeArtifacts = new HashMap<String, Composite>();
private Map<URL, Contribution> contributions = new HashMap<URL, Contribution>();
public ContributionManagerImpl(String domainURI, String nodeName, Composite nodeComposite, ReallySmallRuntime nodeRuntime, ClassLoader classLoader, ModelResolver modelResolver) {
@@ -56,91 +62,227 @@
this.modelResolver = modelResolver;
}
- public void addContribution(URL contributionLocation)
+ public void addContribution(URL contributionURL)
throws ActivationException, ContributionException, IOException, CompositeBuilderException {
- if (contributionLocation != null) {
+ if (contributionURL != null) {
// Get ready to add contributions to the domain
ContributionService contributionService = nodeRuntime.getContributionService();
// Contribute the SCA application
- Contribution contribution = contributionService.contribute(contributionLocation.toExternalForm(),
- contributionLocation,
+ Contribution contribution = contributionService.contribute(contributionURL.toExternalForm(),
+ contributionURL,
modelResolver,
false);
- contributions.put(contributionLocation, contribution);
-
- // Add the composites to the top level domain
- for(Composite composite: contribution.getDeployables()) {
- nodeComposite.getIncludes().add(composite);
- nodeRuntime.getCompositeBuilder().build(composite);
- }
+ contributions.put(contributionURL, contribution);
- // activate all of the composites just loaded
- for(Composite composite: contribution.getDeployables()) {
- nodeRuntime.getCompositeActivator().activate(composite);
- }
+ for (DeployedArtifact artifact : contribution.getArtifacts()) {
+ if (artifact.getModel() instanceof Composite) {
+ compositeArtifacts.put(artifact.getURI(), (Composite)artifact.getModel());
+ }
+ }
+
+ } else {
+ throw new ActivationException("Contribution " + contributionURL + " not found");
+ }
+ }
+
+ /**
+ * Add all composite in a contribution
+ *
+ * @param contributionURL
+ */
+ public void addAllComposites(URL contributionURL)
+ throws ActivationException, ContributionException, IOException, CompositeBuilderException {
+ Contribution contribution = contributions.get(contributionURL);
+
+ if ( contribution != null) {
+ // Add the composites to the top level domain
+ for(Composite composite: contribution.getDeployables()) {
+ nodeComposite.getIncludes().add(composite);
+ nodeRuntime.getCompositeBuilder().build(composite);
+ }
+
+ // activate all of the composites just loaded
+ for(Composite composite: contribution.getDeployables()) {
+ nodeRuntime.getCompositeActivator().activate(composite);
+ }
} else {
- throw new ActivationException("Contribution " + contributionLocation + " not found");
+ throw new ActivationException("Contribution " + contributionURL + " not found");
}
+ }
+
+ /**
+ * adds a named composite
+ *
+ * @param compositeName the name of the composite to be added
+ */
+ public void addComposite(QName compositeName){
+ //TODO
+ }
+
+ /**
+ * adds a named composite
+ *
+ * @param compositePath the path to the composite to be added
+ */
+ public void addComposite(String compositePath)
+ throws ActivationException, ContributionException, IOException, CompositeBuilderException {
+
+ Composite composite = compositeArtifacts.get(compositePath);
+
+ if (composite == null) {
+ throw new ServiceRuntimeException("Composite not found: " + compositePath);
+ }
+
+ nodeComposite.getIncludes().add(composite);
+ nodeRuntime.getCompositeBuilder().build(composite);
+ nodeRuntime.getCompositeActivator().activate(composite);
+ }
+
+ /**
+ * Starts all composites in a contribution
+ *
+ * @param contributionURL
+ */
+ public void startAllComposites(URL contributionURL)
+ throws ActivationException {
+ Contribution contribution = contributions.get(contributionURL);
+
+ if (contribution != null) {
+ for(Composite composite: contribution.getDeployables()) {
+ nodeRuntime.getCompositeActivator().start(composite);
+ }
+ } else {
+ throw new ActivationException("Contribution " + contributionURL+ " not started");
+ }
}
+
+ /**
+ * Starts a named composite
+ *
+ * @param compositeName the name of the composite to be started
+ */
+ public void startComposite(QName compositeName){
+
+ }
+
+ /**
+ * Starts a named composite
+ *
+ * @param compositePath the path to the composite to be started
+ */
+ public void startComposite(String compositePath)
+ throws ActivationException {
+ Composite composite = compositeArtifacts.get(compositePath);
+
+ if (composite == null) {
+ throw new ServiceRuntimeException("Composite not found: " + compositePath);
+ }
+
+ nodeRuntime.getCompositeActivator().start(composite);
+ }
+
+ /**
+ * Stops a all composites in a contribution
+ *
+ * @param compositeURL
+ */
+ public void stopAllComposites(URL contributionURL)
+ throws ActivationException {
+ Contribution contribution = contributions.get(contributionURL);
+
+ if (contribution != null) {
+ for(Composite composite: contribution.getDeployables()) {
+ nodeRuntime.getCompositeActivator().stop(composite);
+ }
+ } else {
+ throw new ActivationException("Contribution " + contributionURL+ " not stopped");
+ }
+ }
+
+ /**
+ * Stops a named composite
+ *
+ * @param compositeName the name of the composite to be stopped
+ */
+ public void stopComposite(QName compositeName){
+
+ }
+
+ /**
+ * Stops a named composite
+ *
+ * @param compositeName the name of the composite to be stopped
+ */
+ public void stopComposite(String compositePath){
+
+ }
+
- public void removeContribution(URL contributionLocation)
+ public void removeContribution(URL contributionURL)
throws ActivationException, ContributionException {
- Contribution contribution = contributions.get(contributionLocation);
-
- stopContribution(contributionLocation);
-
+ // Remove contribution
+ nodeRuntime.getContributionService().remove(contributionURL.toExternalForm());
+ }
+
+ /**
+ * Removes all composites
+ *
+ * @param compositeName the name of the composite to be added
+ */
+ public void removeAllComposites(URL contributionURL)
+ throws ActivationException {
+ Contribution contribution = contributions.get(contributionURL);
+
+ stopAllComposites(contributionURL);
+
// Deactivate the composites
- for(Composite composite: contribution.getDeployables()) {
+ for(Composite composite: contribution.getDeployables()) {
nodeRuntime.getCompositeActivator().deactivate(composite);
}
// Remove the composites
- for(Composite composite: contribution.getDeployables()) {
+ for(Composite composite: contribution.getDeployables()) {
nodeComposite.getIncludes().remove(composite);
}
-
- // Remove contribution
- nodeRuntime.getContributionService().remove(contributionLocation.toExternalForm());
- }
-
- public void startContribution(URL contributionLocation)
- throws ActivationException, ContributionException, IOException, CompositeBuilderException {
+
+ contributions.remove(contributionURL);
+ }
+
+ /**
+ * Removes a named composite
+ *
+ * @param compositeName the name of the composite to be added
+ */
+ public void removeComposite(QName compositeName){
- Contribution contribution = contributions.get(contributionLocation);
-
- if (contribution == null){
- addContribution(contributionLocation);
- }
-
- contribution = contributions.get(contributionLocation);
-
- if (contribution != null) {
- for(Composite composite: contribution.getDeployables()) {
- nodeRuntime.getCompositeActivator().start(composite);
- }
- } else {
- throw new ActivationException("Contribution " + contributionLocation + " not added");
- }
}
- public void stopContribution(URL contributionLocation)
- throws ActivationException {
-
- Contribution contribution = contributions.get(contributionLocation);
+ /**
+ * Removes a named composite
+ *
+ * @param compositeName the name of the composite to be added
+ */
+ public void removeComposite(String compositePath){
- if (contribution != null) {
- for(Composite composite: contribution.getDeployables()) {
- nodeRuntime.getCompositeActivator().stop(composite);
- }
- } else {
- throw new ActivationException("Contribution " + contributionLocation + " not added");
- }
+ }
+
+
+ /**
+ * Stop and remove everything
+ */
+ public void stop()
+ throws ActivationException, ContributionException {
+ for (URL contributionURL : contributions.keySet()){
+ stopAllComposites(contributionURL);
+ removeContribution(contributionURL);
+ }
}
-
+
+/*
public void addContributionJAR(URL contributionJar) throws CompositeBuilderException, ActivationException {
ContributionService contributionService = nodeRuntime.getContributionService();
@@ -186,4 +328,5 @@
}
return contribution;
}
+ */
}
Added: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/DomainManagerServiceImpl.java Thu Sep 20 06:53:40 2007
@@ -0,0 +1,85 @@
+/*
+ * 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.impl;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.domain.DomainManagerService;
+import org.apache.tuscany.sca.domain.NodeInfo;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+@Scope("COMPOSITE")
+public class DomainManagerServiceImpl implements DomainManagerService{
+
+ private final static Logger logger = Logger.getLogger(DomainManagerServiceImpl.class.getName());
+
+ @Property
+ protected int retryCount = 100;
+
+ @Property
+ protected int retryInterval = 5000; //ms
+
+ @Reference
+ protected DomainManagerService domainManager;
+
+ public String registerNode(String domainUri, String nodeUri) {
+
+ String returnValue = null;
+
+ for (int i =0; i < retryCount; i++){
+ try {
+ returnValue = domainManager.registerNode(domainUri, nodeUri);
+ break;
+ } catch(UndeclaredThrowableException ex) {
+ logger.log(Level.INFO, "Trying to regsiter node " +
+ nodeUri +
+ " with domain " +
+ domainUri);
+
+ }
+
+ try {
+ Thread.sleep(retryInterval);
+ } catch(InterruptedException ex) {
+ }
+ }
+
+ return returnValue;
+ }
+
+ public String removeNode(String domainUri, String nodeUri) {
+ return domainManager.removeNode(domainUri, nodeUri);
+ }
+
+ public List<NodeInfo> getNodeInfo(){
+ return domainManager.getNodeInfo();
+ }
+}
Added: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java Thu Sep 20 06:53:40 2007
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.node.impl;
+
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.node.SCANode;
+
+
+/**
+ * A factory that always returns the same domain object
+ *
+ * @version $Rev: 556897 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class NodeFactoryImpl implements NodeFactory {
+
+ SCANode node = null;
+
+ public NodeFactoryImpl(SCANode node){
+ this.node = node;
+ }
+
+ /**
+ * Returns the domain object
+ *
+ * @return the domain
+ */
+ public SCANode getNode(){
+ return node;
+ }
+
+}
Modified: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java?rev=577748&r1=577747&r2=577748&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeManagerServiceImpl.java Thu Sep 20 06:53:40 2007
@@ -26,7 +26,7 @@
import org.apache.tuscany.sca.core.assembly.ActivationException;
import org.apache.tuscany.sca.node.ComponentInfo;
import org.apache.tuscany.sca.node.ComponentManagerService;
-import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.SCANode;
import org.apache.tuscany.sca.node.NodeManagerInitService;
import org.apache.tuscany.sca.node.NodeManagerService;
import org.osoa.sca.annotations.Scope;
@@ -41,14 +41,14 @@
@Service(interfaces = {NodeManagerService.class, NodeManagerInitService.class, ComponentManagerService.class})
public class NodeManagerServiceImpl implements NodeManagerService, NodeManagerInitService, ComponentManagerService {
- private Node node;
+ private SCANode node;
public String getNodeUri() {
- return node.getNodeUri();
+ return node.getNodeURI();
}
// NodeManagerInitService
- public void setNode(Node node) {
+ public void setNode(SCANode node) {
this.node = node;
}
Added: incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainServiceImpl.java?rev=577748&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainServiceImpl.java (added)
+++ incubator/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/SCADomainServiceImpl.java Thu Sep 20 06:53:40 2007
@@ -0,0 +1,158 @@
+/*
+ * 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.impl;
+
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.domain.SCADomainService;
+import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
+
+
+/**
+ * Stores details of services exposed and retrieves details of remote services
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class SCADomainServiceImpl implements SCADomainService{
+
+ private final static Logger logger = Logger.getLogger(SCADomainServiceImpl.class.getName());
+
+ @Property
+ protected int retryCount = 100;
+
+ @Property
+ protected int retryInterval = 5000; //ms
+
+
+ @Reference
+ protected SCADomainService scaDomainService;
+
+ /**
+ * Accepts information about a service endpoint and holds onto it
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param nodeUri the string uri for the current node
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that is providing the endpoint
+ * @param url the endpoint url
+ * @return dummy values just so that we don't have a void return which doesn't work
+ */
+ public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+
+ String dummy = null;
+
+ for (int i =0; i < retryCount; i++){
+ try {
+ dummy = scaDomainService.registerServiceEndpoint(domainUri, nodeUri, serviceName, bindingName, URL);
+ break;
+ } catch(UndeclaredThrowableException ex) {
+ logger.log(Level.INFO, "Trying to connect to domain " +
+ domainUri +
+ " to register service " +
+ serviceName);
+
+ }
+
+ try {
+ Thread.sleep(retryInterval);
+ } catch(InterruptedException ex) {
+ }
+ }
+
+ return dummy;
+ }
+
+ /**
+ * Removes information about a service endpoint
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param nodeUri the string uri for the current node
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that is providing the endpoint
+ * @return dummy values just so that we don't have a void return which doesn't work
+ */
+ public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
+
+ String dummy = null;
+
+ for (int i =0; i < retryCount; i++){
+ try {
+ dummy = scaDomainService.removeServiceEndpoint(domainUri, nodeUri, serviceName, bindingName);
+ break;
+ } catch(UndeclaredThrowableException ex) {
+ logger.log(Level.INFO, "Trying to connect to domain " +
+ domainUri +
+ " to remove service " +
+ serviceName);
+
+ }
+
+ try {
+ Thread.sleep(retryInterval);
+ } catch(InterruptedException ex) {
+ }
+ }
+
+ return dummy;
+ }
+
+ /**
+ * Locates information about a service endpoint
+ *
+ * @param domainUri the string uri for the distributed domain
+ * @param serviceName the name of the service that is exposed and the provided endpoint
+ * @param bindingName the remote binding that we want to find an endpoint for
+ * @return url the endpoint url
+ */
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+
+
+ String url = null;
+
+ for (int i =0; i < retryCount; i++){
+ try {
+ url = scaDomainService.findServiceEndpoint(domainUri, serviceName, bindingName);
+ break;
+ } catch(UndeclaredThrowableException ex) {
+ logger.log(Level.INFO, "Trying to connect to domain " +
+ domainUri +
+ " to find service " +
+ serviceName);
+
+ }
+
+ try {
+ Thread.sleep(retryInterval);
+ } catch(InterruptedException ex) {
+ }
+ }
+
+ return url;
+ }
+
+ public ServiceInfo getServiceInfo(){
+ return scaDomainService.getServiceInfo();
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org