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/10/04 15:40:56 UTC
svn commit: r581897 [2/4] - in /incubator/tuscany/java/sca:
distribution/webapp/src/main/java/org/apache/tuscany/sca/webapp/
itest/callablereferences/src/test/java/org/apache/tuscany/sca/itest/callableref/
modules/ modules/binding-sca-axis2/src/main/ja...
Modified: 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=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java (original)
+++ incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomain.java Thu Oct 4 06:40:50 2007
@@ -19,99 +19,96 @@
package org.apache.tuscany.sca.domain;
-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 java.net.URL;
+
+import javax.xml.namespace.QName;
import org.osoa.sca.CallableReference;
import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
/**
- * A handle to an SCA domain.
+ * Represents an SCA domain.
*
- * @version $Rev: 556897 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
*/
-public abstract class SCADomain {
-
-
- final static String LOCAL_DOMAIN_URI = "standalonedomain";
- final static String LOCAL_NODE_URI = "standalonenode";
+public interface SCADomain {
-
/**
- * Returns a new instance of a local SCA domain.
- *
- * @return
+ * Start the SCA domain service.
*/
- public static SCADomain newInstance() {
- return createNewInstance(LOCAL_DOMAIN_URI, LOCAL_NODE_URI, null);
- }
-
+ public void start()
+ throws DomainException;
+
/**
- * Returns a new instance of a local SCA domain. The specified deployable
- * composite will be included in the SCA domain.
+ * Stop the SCA domain service.
+ */
+ public void stop()
+ throws DomainException;
+
+ /**
+ * Returns the URI of the SCA Domain. That URI is the endpoint of the
+ * SCA domain administration service.
*
- * @param composite the deployable composite to include in the SCA domain.
- * @return
+ * @return the URI of the SCA Domain
+ */
+ public String getURI();
+
+ /**
+ * Add an SCA contribution to the domain.
+ *
+ * @param uri the URI of the contribution
+ * @param url the URL of the contribution
*/
- public static SCADomain newInstance(String composite) {
- return createNewInstance(LOCAL_DOMAIN_URI, LOCAL_NODE_URI, "/", composite);
- }
+ public void addContribution(String uri, URL url)
+ throws DomainException;
/**
- * Returns a new instance of a local SCA domain. The specified deployable
- * composites will be included in the SCA domain.
+ * Remove a contribution from the 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
+ * @param url the URL of the contribution
*/
- public static SCADomain newInstance(String domainURI, String nodeURI, String contributionLocation, String... composites) {
- return createNewInstance(domainURI, nodeURI, contributionLocation, composites);
- }
+ public void removeContribution(String uri)
+ throws DomainException;
/**
- * Removes the specified local SCA Domain instance
+ * Add a deployable composite to the domain.
*
- * @param domainInstance the instance to be removed
+ * @param qname the QName of the composite
*/
- // FIXME: Adding this as temporary support for the "connect" API
- // public static void removeInstance(SCADomain domainInstance) {
- // }
-
+ public void addComposite(QName qname)
+ throws DomainException;
+
/**
- * Returns an SCADomain representing a remote SCA domain.
+ * Remove a deployable composite from the domain.
*
- * @param domainURI the URI of the SCA domain
- * @return
+ * @param qname the QName of the composite.
*/
- // FIXME : this is a temporary implementation to get the capability working
- // public static SCADomain connect(String domainURI) {
- // return null;
- // }
-
+ public void removeComposite(QName qname)
+ throws DomainException;
+
/**
- * Close the SCA domain.
+ * Start a composite. The domain is responsible for starting all the
+ * components in the composite. It may decompose the composite into
+ * one ore more smaller composites and load these composites into
+ * different SCA nodes.
+ *
+ * @param qname The QName of the composite.
*/
- public abstract void close();
-
+ public void startComposite(QName qname)
+ throws DomainException;
+
/**
- * Returns the URI of the SCA Domain.
+ * Stop a composite. The domain will stop all the components from the
+ * specified composite.
*
- * @return the URI of the SCA Domain
+ * @param qname The QName of the composite.
*/
- public abstract String getURI();
-
+ public void stopComposite(QName qname)
+ throws DomainException;
+
/**
- * Cast a type-safe reference to a CallableReference. Converts a type-safe
+ * Cast a type-safe reference to a CallahbleReference. 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.
@@ -123,7 +120,7 @@
* @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;
+ public <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.
@@ -134,7 +131,7 @@
* @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);
+ public <B> B getService(Class<B> businessInterface, String serviceName);
/**
* Returns a ServiceReference for a service provided by a component in the
@@ -146,109 +143,6 @@
* @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);
+ public <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;
- // }
-}
+}
\ No newline at end of file
Added: incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomainFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomainFactory.java?rev=581897&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomainFactory.java (added)
+++ incubator/tuscany/java/sca/modules/domain-api/src/main/java/org/apache/tuscany/sca/domain/SCADomainFactory.java Thu Oct 4 06:40:50 2007
@@ -0,0 +1,77 @@
+/*
+ * 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.lang.reflect.Constructor;
+
+import org.osoa.sca.ServiceRuntimeException;
+
+/**
+ * A factory for SCA domains.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public abstract class SCADomainFactory {
+
+
+ /**
+ * Returns a new SCA domain factory instance.
+ *
+ * @return a new SCA domain factory
+ */
+ public static SCADomainFactory newInstance() {
+
+ SCADomainFactory scaDomainFactory = null;
+
+ try {
+ final ClassLoader classLoader = SCADomainFactory.class.getClassLoader();
+ String className = "org.apache.tuscany.sca.domain.impl.SCADomainFactoryImpl";
+
+ Class cls = Class.forName(className, true, classLoader);
+
+ Constructor<?> constructor = null;
+
+ try {
+ constructor = cls.getConstructor();
+ } catch (NoSuchMethodException e) {
+ // ignore
+ }
+
+ if (constructor != null) {
+ scaDomainFactory = (SCADomainFactory)constructor.newInstance();
+ }
+
+ return scaDomainFactory;
+
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+ /**
+ * Creates a new SCA domain.
+ *
+ * @param domainURI the URI of the domain, this is the endpoint
+ * URI of the domain administration service
+ * @return a new SCA domain
+ */
+ public abstract SCADomain createSCADomain(String domainURI) throws DomainException;
+
+}
Modified: incubator/tuscany/java/sca/modules/domain-impl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/pom.xml?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/pom.xml Thu Oct 4 06:40:50 2007
@@ -58,9 +58,27 @@
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-domain</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
- </dependency>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-node-api</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java?rev=581897&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/DomainManagerNodeImpl.java Thu Oct 4 06:40:50 2007
@@ -0,0 +1,187 @@
+ /*
+ * 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.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+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.xml.Constants;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.resolver.impl.ModelResolverImpl;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.NodeInfo;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+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.SCADomainFinder;
+import org.apache.tuscany.sca.node.SCANode;
+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;
+
+/**
+ * A local representation of the sca domain running on a single node
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class DomainManagerNodeImpl implements SCANode {
+
+ private final static Logger logger = Logger.getLogger(DomainManagerNodeImpl.class.getName());
+
+ private String nodeEndpoint;
+ private SCADomain scaDomain = new DomainManagerDomainImpl();
+
+ class DomainManagerDomainImpl implements SCADomainSPI {
+ public String addNode(String nodeURI, String nodeURL){
+ return null;
+ }
+
+ public String removeNode(String nodeURI){
+ return null;
+ }
+
+ public List<NodeInfo> getNodeInfo(){
+ return null;
+ }
+
+ public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+ return null;
+ }
+
+ public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
+ return null;
+ }
+
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+ return nodeEndpoint;
+ }
+
+ public ServiceInfo getServiceInfo(){
+ return null;
+ }
+
+
+ // SCADomain API methods
+
+ public void start() throws DomainException {
+ }
+
+ public void stop() throws DomainException {
+ }
+
+ public String getURI(){
+ return null;
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws DomainException {
+ }
+
+ public void removeContribution(String uri) throws DomainException {
+ }
+
+ public void addComposite(QName compositeName) throws DomainException {
+ }
+
+ public void removeComposite(QName qname) throws DomainException {
+ }
+
+ public void startComposite(QName compositeName) throws DomainException {
+ }
+
+ public void stopComposite(QName qname) throws DomainException {
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+
+ return null;
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return null;
+ }
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+ return null;
+ }
+
+ }
+
+ public DomainManagerNodeImpl() {
+ }
+
+ public void setNodeEndpoint(String nodeEndpoint) {
+ this.nodeEndpoint = nodeEndpoint;
+ }
+
+ // API methods
+
+ public void start() throws NodeException {
+ }
+
+ public void stop() throws NodeException {
+
+ }
+
+ public String getURI(){
+ return null;
+ }
+
+ public SCADomain getDomain(){
+ return scaDomain;
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws NodeException {
+ }
+
+
+ public void startComposite(QName compositeName) throws NodeException {
+
+ }
+
+
+}
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=581897&r1=581896&r2=581897&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 Oct 4 06:40:50 2007
@@ -19,16 +19,16 @@
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.DomainManagerInitService;
import org.apache.tuscany.sca.domain.DomainManagerService;
import org.apache.tuscany.sca.domain.NodeInfo;
-import org.apache.tuscany.sca.domain.SCADomainService;
-import org.osoa.sca.annotations.Reference;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.ServiceInfo;
import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
/**
@@ -37,58 +37,49 @@
* @version $Rev: 552343 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
*/
@Scope("COMPOSITE")
-public class DomainManagerServiceImpl implements DomainManagerService{
+@Service(interfaces = {DomainManagerService.class, DomainManagerInitService.class})
+public class DomainManagerServiceImpl implements DomainManagerService, DomainManagerInitService {
private final static Logger logger = Logger.getLogger(DomainManagerServiceImpl.class.getName());
- @Reference
- public SCADomainService scaDomainService;
-
- List<NodeInfo> nodes = new ArrayList<NodeInfo>();
+ private SCADomainSPI scaDomain;
- 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);
- logger.log(Level.INFO, "Registered node: " + nodeUri);
- return nodeUri;
- }
-
- public String removeNode(String domainUri, String nodeUri){
-
- List<NodeInfo> nodesToRemove = new ArrayList<NodeInfo>();
-
- for(NodeInfo node : nodes){
- if ( node.match(domainUri, nodeUri)){
- nodesToRemove.add(node);
- }
- }
-
- for(NodeInfo nodeToRemove : nodesToRemove){
- nodes.remove(nodeToRemove);
- logger.log(Level.INFO, "Removed node: " + nodeUri);
- }
-
-
- return nodeUri;
+ // DomainManagerInitService methods
+ public void setDomain(SCADomainSPI scaDomain) {
+ this.scaDomain = scaDomain;
+ }
+
+ // DomainManagerService methods
+
+ public String registerNode(String nodeURI, String nodeURL){
+ return scaDomain.addNode(nodeURI, nodeURL);
+ }
+
+ public String removeNode(String nodeURI){
+ return scaDomain.removeNode(nodeURI);
}
public List<NodeInfo> getNodeInfo(){
-
- // get the nodeManagerUrl for each node
- for(NodeInfo node : nodes){
- String url = scaDomainService.findServiceEndpoint(node.getDomainUri(),
- node.getNodeUri() + "NodeManagerService",
- "");
-
- if (url != null) {
- node.setNodeManagerUrl(url);
- }
- }
-
- return nodes;
+ return scaDomain.getNodeInfo();
}
+
+
+ public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL){
+ return scaDomain.registerServiceEndpoint(domainUri, nodeUri, serviceName, bindingName, URL);
+ }
+
+ public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
+ return scaDomain.removeServiceEndpoint(domainUri, nodeUri, serviceName, bindingName);
+ }
+
+
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+ return scaDomain.findServiceEndpoint(domainUri, serviceName, bindingName);
+ }
+
+
+ public ServiceInfo getServiceInfo(){
+ return scaDomain.getServiceInfo();
+ }
}
Modified: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/NodeInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/NodeInfoImpl.java?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/NodeInfoImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/NodeInfoImpl.java Thu Oct 4 06:40:50 2007
@@ -20,6 +20,11 @@
package org.apache.tuscany.sca.domain.impl;
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.NodeInfo;
@@ -30,41 +35,65 @@
*/
public class NodeInfoImpl implements NodeInfo, Serializable {
- private String domainUri;
- private String nodeUri;
- private String nodeManagerUrl;
-
- public NodeInfoImpl(String domainUri, String nodeUri){
- this.domainUri = domainUri;
- this.nodeUri = nodeUri;
+ static final long serialVersionUID = 7669181086005969428L;
+
+ private String nodeURI;
+ private String nodeURL;
+ private String contributionURI;
+ private URL contributionURL;
+ private List<QName> compositeNames = new ArrayList<QName>();
+
+ public NodeInfoImpl(String nodeURI){
+ this.nodeURI = nodeURI;
}
- public boolean match (String domainUri, String nodeUri){
- return ((this.domainUri.equals(domainUri)) &&
- (this.nodeUri.equals(nodeUri)));
+ public boolean match (String nodeURI){
+ return (this.nodeURI.equals(nodeURI));
}
- public String getDomainUri(){
- return domainUri;
+ public String getNodeURI(){
+ return nodeURI;
}
- public String getNodeUri(){
- return nodeUri;
+ public String getNodeURL(){
+ return nodeURL;
}
- public void setNodeManagerUrl(String nodeManagerUrl){
- this.nodeManagerUrl = nodeManagerUrl;
+ public void setNodeURL(String nodeURL){
+ this.nodeURL = nodeURL;
+ }
+
+ public String getContributionURI(){
+ return contributionURI;
+ }
+
+ public void setContributionURI(String contributionURI){
+ this.contributionURI = contributionURI;
+ }
+
+ public URL getContributionURL(){
+ return contributionURL;
+ }
+
+ public void setContributionURL(URL contributionURL){
+ this.contributionURL = contributionURL;
+ }
+
+ public List<QName> getCompositeNames(){
+ return compositeNames;
}
- public String getNodeManagerUrl(){
- return nodeManagerUrl;
+ public void addCompositeName(QName compositeName){
+ this.compositeNames.add(compositeName);
}
@Override
public String toString (){
return "[" +
- domainUri + " " +
- nodeUri +
+ nodeURI + " " +
+ nodeURL + " " +
+ contributionURI + " " +
+ compositeNames.toString() + " " +
"]";
}
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java?rev=581897&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainFactoryImpl.java Thu Oct 4 06:40:50 2007
@@ -0,0 +1,54 @@
+/*
+ * 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 org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+import org.apache.tuscany.sca.domain.SCADomainFactory;
+
+/**
+ * A finder for SCA domains.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public class SCADomainFactoryImpl extends SCADomainFactory {
+
+
+ /**
+ * Returns a new SCA domain finder instance.
+ *
+ * @return a new SCA domain finder
+ */
+ public SCADomainFactoryImpl() {
+
+ }
+
+ /**
+ * Finds an existing SCA domain.
+ *
+ * @param domainURI the URI of the domain, this is the endpoint
+ * URI of the domain administration service
+ * @return the SCA domain
+ */
+ public SCADomain createSCADomain(String domainURI) throws DomainException {
+ return new SCADomainImpl(domainURI);
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java?rev=581897&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainImpl.java Thu Oct 4 06:40:50 2007
@@ -0,0 +1,545 @@
+ /*
+ * 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.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+
+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.xml.Constants;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionService;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.DomainManagerInitService;
+import org.apache.tuscany.sca.domain.NodeInfo;
+import org.apache.tuscany.sca.domain.SCADomainSPI;
+import org.apache.tuscany.sca.domain.ServiceInfo;
+import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.node.NodeManagerService;
+import org.apache.tuscany.sca.node.NodeFactoryImpl;
+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 implementation. In Tuscany we currently have a model of the
+ * SCA Domain that relies on a central domain manager this class provides that
+ * central manager.
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-09 23:54:46 +0100 (Sun, 09 Sep 2007) $
+ */
+public class SCADomainImpl implements SCADomainSPI {
+
+ private final static Logger logger = Logger.getLogger(SCADomainImpl.class.getName());
+
+ // class loader used to get the runtime going
+ private ClassLoader domainClassLoader;
+
+ // management runtime
+ private ReallySmallRuntime domainManagementRuntime;
+ private Composite domainManagementComposite;
+ private DomainManagerNodeImpl domainManagerNode = new DomainManagerNodeImpl();
+
+ // management services
+ private DomainManagerInitService domainManagerInitService;
+
+ // dummy runtime to give access to sca references that are part of the domain.
+ private ReallySmallRuntime domainRuntime;
+
+ // the state of the domain
+ private String domainURI;
+ private URL domainURL;
+
+ private List<NodeInfo> nodes = new ArrayList<NodeInfo>();
+ private List<ServiceInfo> services = new ArrayList<ServiceInfo>();
+
+ /**
+ * Create a domain giving the URI for the domain.
+ *
+ * @param domainUri - identifies what host and port the domain service is running on, e.g. http://localhost:8081
+ * @param nodeUri - if this is a url it is assumed that this will be used as root url for management components, e.g. http://localhost:8082
+ * @throws ActivationException
+ */
+ public SCADomainImpl(String domainURI) throws DomainException {
+ this.domainURI = domainURI;
+ this.domainClassLoader = SCADomainImpl.class.getClassLoader();
+ init();
+ }
+
+ /**
+ * Create the domain management runtime etc
+ */
+ private void init() throws DomainException {
+ try {
+ // check whether domain uri is a url
+ URI tmpURI;
+ try {
+ tmpURI = new URI(domainURI);
+ if (tmpURI.isAbsolute()){
+ domainURL = tmpURI.toURL();
+ }
+ } catch(Exception ex) {
+ throw new ActivationException("domain uri " +
+ domainURI +
+ "must be a valid url");
+ }
+
+ // create a runtime for the domain management services to run on
+ domainManagementRuntime = new ReallySmallRuntime(domainClassLoader);
+ domainManagementRuntime.start();
+
+ // Create an in-memory domain level composite
+ AssemblyFactory assemblyFactory = domainManagementRuntime.getAssemblyFactory();
+ domainManagementComposite = assemblyFactory.createComposite();
+ domainManagementComposite.setName(new QName(Constants.SCA10_NS, "domainManagement"));
+ domainManagementComposite.setURI(domainURI);
+
+ // Set up the domain so that we can push in the node endpoint before we
+ // call a node
+ ModelFactoryExtensionPoint factories = domainManagementRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ NodeFactoryImpl domainFactory = new NodeFactoryImpl(domainManagerNode);
+ factories.addFactory(domainFactory);
+
+ // Find the composite that will configure the domain
+ String domainCompositeName = "domain.composite";
+ URL contributionURL = SCADomainUtil.findContributionFromComposite(domainClassLoader, domainCompositeName);
+
+ if ( contributionURL != null ){
+ logger.log(Level.INFO, "Domain management configured from " + contributionURL);
+
+ // add node composite to the management domain
+ ContributionService contributionService = domainManagementRuntime.getContributionService();
+ Contribution contribution = null;
+
+ contribution = contributionService.contribute(domainURI,
+ contributionURL,
+ false);
+
+ if (contribution.getDeployables().size() != 0) {
+ Composite composite = contribution.getDeployables().get(0);
+
+ domainManagementComposite.getIncludes().add(composite);
+ domainManagementRuntime.getCompositeBuilder().build(composite);
+
+ // TODO fix up the domain manager URI to match the provided
+ // domain uri
+
+ domainManagementRuntime.getCompositeActivator().activate(composite);
+ domainManagementRuntime.getCompositeActivator().start(composite);
+
+ // get the management components out of the domain so that they
+ // can be configured/used.
+ domainManagerInitService = getService(DomainManagerInitService.class,
+ "DomainManagerComponent/DomainManagerInitService",
+ domainManagementRuntime,
+ domainManagementComposite);
+ domainManagerInitService.setDomain((SCADomainSPI)this);
+
+
+ } else {
+ throw new ActivationException("Domain management contribution " +
+ contributionURL +
+ " found but could not be loaded");
+ }
+ } else {
+ throw new ActivationException("Domain management contribution " +
+ domainCompositeName +
+ " not found on the classpath");
+ }
+
+ } catch(Exception ex) {
+ throw new DomainException(ex);
+ }
+ }
+
+ public Component getComponent(String componentName) {
+ for (Composite composite: domainManagementComposite.getIncludes()) {
+ for (Component component: composite.getComponents()) {
+ if (component.getName().equals(componentName)) {
+ return component;
+ }
+ }
+ }
+ return null;
+ }
+
+ // SCADomain SPI methods
+
+ public String addNode(String nodeURI, String nodeURL){
+ // try and remove it first just in case it's already registered
+ removeNode(nodeURI);
+
+ NodeInfo nodeInfo = new NodeInfoImpl(nodeURI);
+ nodeInfo.setNodeURL(nodeURL);
+ nodes.add(nodeInfo);
+ logger.log(Level.INFO, "Registered node: " +
+ nodeURI +
+ " at endpoint " +
+ nodeURL);
+
+ return "DummyReturn";
+ }
+
+ public String removeNode(String nodeURI){
+
+ List<NodeInfo> nodesToRemove = new ArrayList<NodeInfo>();
+
+ for(NodeInfo node : nodes){
+ if ( node.match(nodeURI)){
+ nodesToRemove.add(node);
+ }
+ }
+
+ for(NodeInfo nodeToRemove : nodesToRemove){
+ nodes.remove(nodeToRemove);
+ logger.log(Level.INFO, "Removed node: " + nodeURI);
+ }
+
+ return "DummyReturn";
+ }
+
+ public List<NodeInfo> getNodeInfo(){
+ return nodes;
+ }
+
+ 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;
+ }
+
+
+ ServiceInfoImpl serviceEndpoint = new ServiceInfoImpl (domainUri, nodeUri, modifiedServiceName, bindingName, URL);
+ services.add(serviceEndpoint);
+ logger.log(Level.INFO, "Registered service: " + serviceEndpoint.toString());
+ return "";
+ }
+
+ public String removeServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName){
+
+ List<ServiceInfo> serviceEndpointsToRemove = new ArrayList<ServiceInfo>();
+
+ for(ServiceInfo serviceEndpoint : services){
+ if ( serviceEndpoint.match(domainUri, serviceName, bindingName)){
+ serviceEndpointsToRemove.add(serviceEndpoint);
+ }
+ }
+
+ for(ServiceInfo serviceEndpointToRemove : serviceEndpointsToRemove){
+ services.remove(serviceEndpointToRemove);
+ logger.log(Level.INFO, "Removed service: " + serviceName );
+ }
+
+ return "";
+ }
+
+ public String findServiceEndpoint(String domainUri, String serviceName, String bindingName){
+ logger.log(Level.INFO, "Finding service: [" +
+ domainUri + " " +
+ serviceName + " " +
+ bindingName +
+ "]");
+
+ String url = "";
+
+ for(ServiceInfo serviceEndpoint : services){
+ 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(){
+ return services.get(0);
+ }
+
+
+ // SCADomain API methods
+
+ public void start() throws DomainException {
+ // TODO
+ }
+
+
+ public void stop() throws DomainException {
+ try {
+ // Stop the node
+ domainManagementRuntime.stop();
+
+ } catch(ActivationException ex) {
+ throw new DomainException(ex);
+ }
+
+ }
+
+ public String getURI(){
+ return domainURI;
+ }
+
+ public void addContribution(String contributionURI, URL contributionURL) throws DomainException {
+ // find a node without a contribution and add it to it
+
+ boolean foundFreeNode = false;
+
+ for (NodeInfo nodeInfo : nodes) {
+ if (nodeInfo.getContributionURI() == null) {
+ foundFreeNode = true;
+ nodeInfo.setContributionURI(contributionURI);
+ nodeInfo.setContributionURL(contributionURL);
+ break;
+ }
+ }
+
+ if (foundFreeNode == false){
+ throw new DomainException("No free node available for contribution " +
+ contributionURI);
+ }
+ }
+
+ public void removeContribution(String uri) throws DomainException {
+ // TODO
+ }
+
+ public void addComposite(QName compositeName) throws DomainException {
+ // find the nodes with this composite and add it. Currently we add it to
+ // all nodes and let the node worry about whether it has the composite
+ for (NodeInfo nodeInfo : nodes) {
+ nodeInfo.addCompositeName(compositeName);
+ }
+ }
+
+ public void removeComposite(QName qname) throws DomainException {
+ // TODO
+ }
+
+ public void startComposite(QName compositeName) throws DomainException {
+ // Start all nodes with this composite
+ for (NodeInfo nodeInfo : getNodeInfo()) {
+
+ boolean startNode = false;
+
+ for (QName nodeCompositeName : nodeInfo.getCompositeNames()){
+ if (compositeName.equals(nodeCompositeName) ) {
+ startNode = true;
+ }
+ }
+
+ if (startNode = true){
+ // get the endpoint of the node in question and set it into the
+ // domain manager node in order to flip the node reference to
+ // the correct endpoint
+ String nodeURL = nodeInfo.getNodeURL();
+ domainManagerNode.setNodeEndpoint(nodeURL);
+
+
+ // get a ode manager service reference. This will have to have its
+ // physical enpoint set by the domain node manage we have just
+ // configured
+ NodeManagerService nodeManagerService = getService(NodeManagerService.class,
+ "NodeManagerComponent/NodeManagerService",
+ domainManagementRuntime,
+ domainManagementComposite);
+
+ // add contribution
+ nodeManagerService.addContribution(nodeInfo.getContributionURI(),
+ nodeInfo.getContributionURL().toString());
+
+ // start composite
+ nodeManagerService.startComposite(compositeName.toString());
+
+ // start node
+ nodeManagerService.start();
+ }
+ nodeInfo.addCompositeName(compositeName);
+ }
+
+ }
+
+ public void stopComposite(QName qname) throws DomainException {
+ // TODO
+ }
+
+ public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
+ /*
+ return (R)nodeRuntime.getProxyFactory().cast(target);
+ */
+ return null;
+ }
+
+ public <B> B getService(Class<B> businessInterface, String serviceName) {
+ return null;
+ }
+
+ private <B> B getService(Class<B> businessInterface, String serviceName, ReallySmallRuntime runtime, Composite domainComposite) {
+
+ ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName, runtime, domainComposite);
+ if (serviceReference == null) {
+ throw new ServiceRuntimeException("Service not found: " + serviceName);
+ }
+ return serviceReference.getService();
+ }
+
+ private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
+ return null;
+ }
+
+
+ private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI, ReallySmallRuntime runtime, Composite domainComposite) {
+ try {
+
+ AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
+ Composite composite = assemblyFactory.createComposite();
+ composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
+ RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
+ component.setName("default");
+ component.setURI("default");
+ runtime.getCompositeActivator().configureComponentContext(component);
+ composite.getComponents().add(component);
+ RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
+ reference.setName("default");
+ ModelFactoryExtensionPoint factories =
+ runtime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
+ JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
+ InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
+ reference.setInterfaceContract(interfaceContract);
+ component.getReferences().add(reference);
+ reference.setComponent(component);
+ SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
+ SCABinding binding = scaBindingFactory.createSCABinding();
+ binding.setURI(targetURI);
+ reference.getBindings().add(binding);
+ return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, runtime
+ .getProxyFactory(), runtime.getCompositeActivator());
+ } catch (Exception e) {
+ throw new ServiceRuntimeException(e);
+ }
+ }
+
+
+
+ public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
+ return null;
+ }
+
+
+ private <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name, ReallySmallRuntime runtime, Composite domainComposite) {
+
+ // Extract the component name
+ String componentName;
+ String serviceName;
+ int i = name.indexOf('/');
+ if (i != -1) {
+ componentName = name.substring(0, i);
+ serviceName = name.substring(i + 1);
+
+ } else {
+ componentName = name;
+ serviceName = null;
+ }
+
+ // Lookup the component
+ Component component = null;
+
+ for (Composite composite: domainComposite.getIncludes()) {
+ for (Component compositeComponent: composite.getComponents()) {
+ if (compositeComponent.getName().equals(componentName)) {
+ component = compositeComponent;
+ }
+ }
+ }
+
+ if (component == null) {
+ // The component is not local in the partition, try to create a remote service ref
+ return createServiceReference(businessInterface, name, runtime, domainComposite);
+ }
+ RuntimeComponentContext componentContext = null;
+
+ // If the component is a composite, then we need to find the
+ // non-composite component that provides the requested service
+ if (component.getImplementation() instanceof Composite) {
+ for (ComponentService componentService : component.getServices()) {
+ if (serviceName == null || serviceName.equals(componentService.getName())) {
+ CompositeService compositeService = (CompositeService)componentService.getService();
+ if (compositeService != null) {
+ if (serviceName != null) {
+ serviceName = "$promoted$." + serviceName;
+ }
+ componentContext =
+ ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
+ return componentContext.createSelfReference(businessInterface, compositeService
+ .getPromotedService());
+ }
+ break;
+ }
+ }
+ // No matching service is found
+ throw new ServiceRuntimeException("Composite service not found: " + name);
+ } else {
+ componentContext = ((RuntimeComponent)component).getComponentContext();
+ if (serviceName != null) {
+ return componentContext.createSelfReference(businessInterface, serviceName);
+ } else {
+ return componentContext.createSelfReference(businessInterface);
+ }
+ }
+ }
+
+}
Added: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainUtil.java?rev=581897&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainUtil.java (added)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/SCADomainUtil.java Thu Oct 4 06:40:50 2007
@@ -0,0 +1,86 @@
+/*
+ * 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.io.IOException;
+import java.net.InetAddress;
+import java.net.MalformedURLException;
+import java.net.ServerSocket;
+import java.net.URI;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.List;
+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.ComponentReference;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.core.assembly.ActivationException;
+
+
+/**
+ * Some utility methods for the Domain implementation
+ *
+ * @version $Rev: 556897 $ $Date: 2007-09-07 12:41:52 +0100 (Fri, 07 Sep 2007) $
+ */
+public class SCADomainUtil {
+ private final static Logger logger = Logger.getLogger(SCADomainUtil.class.getName());
+
+ /**
+ * Given the name of a composite this method finds the contribution that it belongs to
+ * this could be either a local directory of a jar file.
+ *
+ * @param classLoader
+ * @param compositeString
+ * @return the contribution URL
+ * @throws MalformedURLException
+ */
+ public static URL findContributionFromComposite(ClassLoader classLoader, String compositeString)
+ throws MalformedURLException {
+
+ URL contributionURL = classLoader.getResource(compositeString);
+
+ if ( contributionURL != null ){
+ String contributionURLString = contributionURL.toExternalForm();
+ String protocol = contributionURL.getProtocol();
+
+ if ("file".equals(protocol)) {
+ // directory contribution
+ if (contributionURLString.endsWith(compositeString)) {
+ String location = contributionURLString.substring(0, contributionURLString.lastIndexOf(compositeString));
+ // workaround from evil url/uri form maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+
+ } else if ("jar".equals(protocol)) {
+ // jar contribution
+ String location = contributionURLString.substring(4, contributionURLString.lastIndexOf("!/"));
+ // workaround for evil url/uri from maven
+ contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
+ }
+ }
+
+ return contributionURL;
+ }
+}
\ No newline at end of file
Modified: incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/ServiceInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/ServiceInfoImpl.java?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/ServiceInfoImpl.java (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/java/org/apache/tuscany/sca/domain/impl/ServiceInfoImpl.java Thu Oct 4 06:40:50 2007
@@ -30,6 +30,8 @@
*/
public class ServiceInfoImpl implements ServiceInfo, Serializable {
+ static final long serialVersionUID = 3638558958675695163L;
+
private String domainUri;
private String nodeUri;
private String serviceName;
Modified: 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=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite (original)
+++ incubator/tuscany/java/sca/modules/domain-impl/src/main/resources/domain.composite Thu Oct 4 06:40:50 2007
@@ -32,22 +32,16 @@
<component name="DomainManagerComponent">
<implementation.java class="org.apache.tuscany.sca.domain.impl.DomainManagerServiceImpl"/>
+ <service name="DomainManagerInitService">
+ <interface.java interface="org.apache.tuscany.sca.domain.DomainManagerInitService"/>
+ <binding.sca/>
+ </service>
<service name="DomainManagerService">
<interface.java interface="org.apache.tuscany.sca.domain.DomainManagerService"/>
+ <binding.sca uri="http://localhost:8877/SCADomainComponent/DomainManagerSCA"/>
<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>
+ </component>
</composite>
Modified: incubator/tuscany/java/sca/modules/domain/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/pom.xml?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/domain/pom.xml Thu Oct 4 06:40:50 2007
@@ -55,6 +55,12 @@
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-domain-api</artifactId>
+ <version>1.1-incubating-SNAPSHOT</version>
+ </dependency>
+
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerInitService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerInitService.java?rev=581897&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerInitService.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerInitService.java Thu Oct 4 06:40:50 2007
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+
+
+/**
+ * Connects the domain to the domain manager service
+ *
+ * @version $Rev: 552343 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
+ */
+public interface DomainManagerInitService {
+
+ /**
+ * Set the node object into the NodeManagement component so that is can manage it
+ *
+ * @param node
+ */
+ public void setDomain(SCADomainSPI node);
+
+}
Modified: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java (original)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/DomainManagerService.java Thu Oct 4 06:40:50 2007
@@ -43,7 +43,7 @@
* @param nodeUri the string uri for the current node
* @param nodeManagementUrl the endpoint for the nodes management service
*/
- public String registerNode(String domainUri, String nodeUri);
+ public String registerNode(String nodeURI, String nodeURL);
/**
* A node registers with the distributed domain manager. The mechanism whereby this
@@ -54,27 +54,52 @@
* @param nodeUri the string uri for the current node
* @param nodeManagementUrl the endpoint for the nodes management service
*/
- public String removeNode(String domainUri, String nodeUri);
+ public String removeNode(String nodeURI);
/**
- * Retrieve the configuration for the specified node. The return type is interesting
- * here. There are many ways in which all of the information that comprises a
- * configuration can be provisioned onto a node, for example, shared file system,
- * ftp, http. The return value is the url of where to look for the configuration
- * information. From a management point of view it is convenient to maintain all
- * current and previous node configurations. This can easily be achieved by providing
- * a different URL each time the configuration is changed.
- *
+ * Retrieve a list of all of the registered nodes
+ *
+ * @return the list of node information
+ */
+ public List<NodeInfo> getNodeInfo();
+
+ /**
+ * 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
- * @return the URL from where the configuration can be retrieved
+ * @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 getDomainNodeConfiguration(String domainUri, String nodeUri);
+ public String registerServiceEndpoint(String domainUri, String nodeUri, String serviceName, String bindingName, String URL);
+
/**
- * Retrieve a list of all of the registered nodes
+ * Removes information about a service endpoint
*
- * @return the list of node information
+ * @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 List<NodeInfo> getNodeInfo();
+ public ServiceInfo getServiceInfo();
}
Modified: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/NodeInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/NodeInfo.java?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/NodeInfo.java (original)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/NodeInfo.java Thu Oct 4 06:40:50 2007
@@ -19,6 +19,11 @@
package org.apache.tuscany.sca.domain;
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
/**
* A collection of info for a registered node
@@ -32,33 +37,38 @@
*
* @return domain uri
*/
- public String getDomainUri();
+ public String getNodeURI();
/**
* Retrieve the node uri
*
* @return node uri
*/
- public String getNodeUri();
-
+ public String getNodeURL();
+
/**
- * Ser the node manager url
+ * Ser the node url
*
- * @param nodeManagerUrl
+ * @param nodeURL
*/
- public void setNodeManagerUrl(String nodeManagerUrl);
+ public void setNodeURL(String nodeURL);
+
+ public String getContributionURI();
- /**
- * Retrieve the node manager url
- *
- * @return node manager url
- */
- public String getNodeManagerUrl();
+ public void setContributionURI(String contributionURI);
+
+ public URL getContributionURL();
+
+ public void setContributionURL(URL contributionURL);
+
+ public List<QName> getCompositeNames();
+
+ public void addCompositeName(QName compositeName);
/**
* Returns true if this node info object matches the provided data
*/
- public boolean match(String domainUri, String nodeUri);
+ public boolean match(String nodeURI);
/**
* Returns a string representation of the information for a service
Added: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java?rev=581897&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java (added)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/SCADomainSPI.java Thu Oct 4 06:40:50 2007
@@ -0,0 +1,101 @@
+/*
+ * 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.util.List;
+
+import org.apache.tuscany.sca.domain.DomainException;
+import org.apache.tuscany.sca.domain.SCADomain;
+
+/**
+ * Represents an SCA domain.
+ *
+ * @version $Rev: 580520 $ $Date: 2007-09-29 00:50:25 +0100 (Sat, 29 Sep 2007) $
+ */
+public interface SCADomainSPI extends SCADomain {
+
+ /**
+ * Add information about a node in the domain
+ *
+ * @param nodeURI
+ * @param nodeURL
+ * @return
+ */
+ public String addNode(String nodeURI, String nodeURL);
+
+ /**
+ * Remove information about a node in a domain
+ *
+ * @param nodeURI
+ * @param nodeURL
+ * @return
+ */
+ public String removeNode(String nodeURI);
+
+ /**
+ * Return information about all the nodes in the domain
+ *
+ * @return
+ */
+ public List<NodeInfo> getNodeInfo();
+
+ /**
+ * 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();
+
+}
\ No newline at end of file
Modified: incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/ServiceInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/ServiceInfo.java?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/ServiceInfo.java (original)
+++ incubator/tuscany/java/sca/modules/domain/src/main/java/org/apache/tuscany/sca/domain/ServiceInfo.java Thu Oct 4 06:40:50 2007
@@ -29,6 +29,24 @@
*/
@Remotable
public interface ServiceInfo {
+
+ /**
+ * Compare this service info against the data provided and return true if it matches
+ * return false otherwise
+ *
+ * @param domainUri
+ * @param serviceName
+ * @param bindingName
+ * @return
+ */
+ public boolean match(String domainUri, String serviceName, String bindingName);
+
+ /**
+ * Get the URL of this service.
+ *
+ * @return
+ */
+ public String getUrl();
/**
* Returns a string representation of the information for a service
Modified: incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java (original)
+++ incubator/tuscany/java/sca/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java Thu Oct 4 06:40:50 2007
@@ -184,7 +184,7 @@
} else {
factory = bindingActivator.createInvokerFactory(rc, rcr, b, b);
}
- if (factory instanceof ComponentLifecycle) {
+ if ( (factory != null) && (factory instanceof ComponentLifecycle)) {
((ComponentLifecycle)factory).start();
}
// for (InvokerProxy invoker : invokers) {
Modified: incubator/tuscany/java/sca/modules/host-embedded/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/pom.xml?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/pom.xml Thu Oct 4 06:40:50 2007
@@ -70,19 +70,18 @@
<artifactId>tuscany-contribution-impl</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
</dependency>
-
+
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-databinding</artifactId>
+ <artifactId>tuscany-policy-xml</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
- <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml</artifactId>
+ <artifactId>tuscany-node-api</artifactId>
<version>1.1-incubating-SNAPSHOT</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultLauncher.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultLauncher.java?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultLauncher.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultLauncher.java Thu Oct 4 06:40:50 2007
@@ -21,7 +21,11 @@
import java.io.IOException;
-import org.apache.tuscany.sca.domain.SCADomain;
+import javax.xml.namespace.QName;
+
+//import org.apache.tuscany.sca.domain.SCADomain;
+//import org.apache.tuscany.sca.node.SCANode;
+//import org.apache.tuscany.sca.node.SCANodeFactory;
public class DefaultLauncher {
@@ -31,7 +35,20 @@
public static void main(String[] args) {
System.out.println("Tuscany starting...");
System.out.println("Composite: " + args[0]);
- SCADomain.newInstance(args[0]);
+
+/*
+ try {
+ ClassLoader cl = DefaultLauncher.class.getClassLoader();
+ SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
+ SCANode node = nodeFactory.createSCANode("node", null);
+ node.addContribution("node", cl.getResource(args[0]));
+ node.startComposite(new QName("??", "??"));
+ node.start();
+ } catch (Exception ex) {
+ System.err.println("Exception starting node " + ex.toString());
+ }
+*/
+
System.out.println("Ready...");
System.out.println("Press enter to shutdown");
try {
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java?rev=581897&r1=581896&r2=581897&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java Thu Oct 4 06:40:50 2007
@@ -57,6 +57,7 @@
import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.policy.Policy;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
@@ -95,6 +96,9 @@
this.composites = composites;
// Create and start the runtime
+ System.out.println("Test " + ReallySmallRuntime.class.getCanonicalName());
+ //IntentAttachPointTypeFactory iaptf;
+ Policy policy;
runtime = new ReallySmallRuntime(runtimeClassLoader);
try {
runtime.start();
Propchange: incubator/tuscany/java/sca/modules/node-api/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 4 06:40:50 2007
@@ -0,0 +1,4 @@
+.settings
+target
+.classpath
+.project
Added: incubator/tuscany/java/sca/modules/node-api/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node-api/DISCLAIMER?rev=581897&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/node-api/DISCLAIMER (added)
+++ incubator/tuscany/java/sca/modules/node-api/DISCLAIMER Thu Oct 4 06:40:50 2007
@@ -0,0 +1,8 @@
+Apache Tuscany is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
+required of all newly accepted projects until a further review indicates that
+the infrastructure, communications, and decision making process have stabilized
+in a manner consistent with other successful ASF projects. While incubation
+status is not necessarily a reflection of the completeness or stability of the
+code, it does indicate that the project has yet to be fully endorsed by the ASF.
+
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org