tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r951651 [7/13] - in /tuscany/sca-java-2.x/trunk/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ assembly/src/main/java/org/apache/tuscany/sca/assembly/ assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ bi...
Date Sat, 05 Jun 2010 05:17:51 GMT
Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/RuntimePropertiesImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/RuntimePropertiesImpl.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/RuntimePropertiesImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/RuntimePropertiesImpl.java Sat Jun  5 05:17:47 2010
@@ -1,38 +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.core.runtime.impl;
-
-import java.util.Properties;
-
-import org.apache.tuscany.sca.runtime.RuntimeProperties;
-
-public class RuntimePropertiesImpl implements RuntimeProperties {
-
-    private Properties properties = new Properties();
-
-    public Properties getProperties() {
-        return properties;
-    }
-
-    public void setProperties(Properties properties) {
-        this.properties = properties;
-    }
-
-}
+/*
+ * 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.core.runtime.impl;
+
+import java.util.Properties;
+
+import org.apache.tuscany.sca.runtime.RuntimeProperties;
+
+public class RuntimePropertiesImpl implements RuntimeProperties {
+
+    private Properties properties = new Properties();
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/RuntimePropertiesImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/RuntimePropertiesImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/InputStream2JSON.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/jackson/InputStream2JSON.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java Sat Jun  5 05:17:47 2010
@@ -1,107 +1,107 @@
-/*
- * 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.databinding.sdo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Base;
-
-import commonj.sdo.Type;
-
-/**
- * The model object for sdo.types
- *
- * @version $Rev: 537464 $ $Date: 2007-05-12 08:37:14 -0700 (Sat, 12 May 2007) $
- *
- * This extends the META-INF/sca-contribution.xml to register SDO types from static factory classes or WSDL/XSD files
- *
- * &lt;contribution xmlns=&quot;http://tuscany.apache.org/xmlns/sca/1.1&quot;<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;xmlns:tuscany=&quot;http://tuscany.apache.org/xmlns/sca/1.0&quot;&gt;<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&lt;tuscany:sdo.types namespace=&quot;http://helloworld&quot; location=&quot;wsdl/helloworld.wsdl&quot;/&gt;<br>
- * &lt;/contribution&gt;
- *
- */
-public class SDOTypes {
-    public static final QName SDO_TYPES = new QName(Base.SCA11_TUSCANY_NS, "sdo.types");
-
-    private String factory;
-    private String schemaLocation;
-    private String namespace;
-
-    private List<Type> types = new ArrayList<Type>();
-
-    private boolean unresolved;
-
-    public SDOTypes() {
-        super();
-        setUnresolved(true);
-    }
-
-    public boolean isUnresolved() {
-        return unresolved;
-    }
-
-    public void setUnresolved(boolean undefined) {
-        this.unresolved = undefined;
-    }
-
-    /**
-     * @return the factoryClassName
-     */
-    public String getFactory() {
-        return factory;
-    }
-
-    /**
-     * @param factoryClassName the factoryClassName to set
-     */
-    public void setFactory(String factoryClassName) {
-        this.factory = factoryClassName;
-    }
-
-    /**
-     * @return the schemaLocation
-     */
-    public String getSchemaLocation() {
-        return schemaLocation;
-    }
-
-    /**
-     * @param schemaLocation the schemaLocation to set
-     */
-    public void setSchemaLocation(String schemaLocation) {
-        this.schemaLocation = schemaLocation;
-    }
-
-    public String getNamespace() {
-        return namespace;
-    }
-
-    public void setNamespace(String namespace) {
-        this.namespace = namespace;
-    }
-
-    public List<Type> getTypes() {
-        return types;
-    }
-}
+/*
+ * 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.databinding.sdo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
+
+import commonj.sdo.Type;
+
+/**
+ * The model object for sdo.types
+ *
+ * @version $Rev$ $Date$
+ *
+ * This extends the META-INF/sca-contribution.xml to register SDO types from static factory classes or WSDL/XSD files
+ *
+ * &lt;contribution xmlns=&quot;http://tuscany.apache.org/xmlns/sca/1.1&quot;<br>
+ * &nbsp;&nbsp;&nbsp;&nbsp;xmlns:tuscany=&quot;http://tuscany.apache.org/xmlns/sca/1.0&quot;&gt;<br>
+ * &nbsp;&nbsp;&nbsp;&nbsp;&lt;tuscany:sdo.types namespace=&quot;http://helloworld&quot; location=&quot;wsdl/helloworld.wsdl&quot;/&gt;<br>
+ * &lt;/contribution&gt;
+ *
+ */
+public class SDOTypes {
+    public static final QName SDO_TYPES = new QName(Base.SCA11_TUSCANY_NS, "sdo.types");
+
+    private String factory;
+    private String schemaLocation;
+    private String namespace;
+
+    private List<Type> types = new ArrayList<Type>();
+
+    private boolean unresolved;
+
+    public SDOTypes() {
+        super();
+        setUnresolved(true);
+    }
+
+    public boolean isUnresolved() {
+        return unresolved;
+    }
+
+    public void setUnresolved(boolean undefined) {
+        this.unresolved = undefined;
+    }
+
+    /**
+     * @return the factoryClassName
+     */
+    public String getFactory() {
+        return factory;
+    }
+
+    /**
+     * @param factoryClassName the factoryClassName to set
+     */
+    public void setFactory(String factoryClassName) {
+        this.factory = factoryClassName;
+    }
+
+    /**
+     * @return the schemaLocation
+     */
+    public String getSchemaLocation() {
+        return schemaLocation;
+    }
+
+    /**
+     * @param schemaLocation the schemaLocation to set
+     */
+    public void setSchemaLocation(String schemaLocation) {
+        this.schemaLocation = schemaLocation;
+    }
+
+    public String getNamespace() {
+        return namespace;
+    }
+
+    public void setNamespace(String namespace) {
+        this.namespace = namespace;
+    }
+
+    public List<Type> getTypes() {
+        return types;
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java Sat Jun  5 05:17:47 2010
@@ -1,234 +1,234 @@
-/*
- * 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.databinding.sdo.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.databinding.sdo.SDOTypes;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.tuscany.sdo.api.SDOUtil;
-
-import commonj.sdo.Type;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XSDHelper;
-
-/**
- * SDO types model resolver that aggregates the SDO type registration for an SCA contribution
- */
-public class SDOTypesModelResolver implements ModelResolver {
-    private Contribution contribution;
-    private HelperContext helperContext;
-    private List<SDOTypes> sdoTypes = new ArrayList<SDOTypes>();
-    private ContributionFactory contributionFactory;
-    private XSDFactory xsdFactory;
-    private ProcessorContext context;
-
-    public SDOTypesModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories) {
-        super();
-        this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
-        this.xsdFactory = modelFactories.getFactory(XSDFactory.class);
-        this.contribution = contribution;
-    }
-
-    public void addModel(Object resolved, ProcessorContext context) {
-        if (helperContext == null) {
-            helperContext = SDOUtil.createHelperContext();
-        }
-        this.context = context;
-        SDOTypes types = (SDOTypes)resolved;
-        try {
-            loadSDOTypes(types, contribution.getModelResolver());
-        } catch (ContributionResolveException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-        sdoTypes.add(types);
-    }
-
-    public Object removeModel(Object resolved, ProcessorContext context) {
-        SDOTypes types = (SDOTypes)resolved;
-
-        return sdoTypes.remove(types);
-    }
-
-    public <T> T resolveModel(Class<T> modelClass, T unresolved, ProcessorContext context) {
-        SDOTypes types = (SDOTypes)unresolved;
-        String ns = types.getNamespace();
-        this.context = context;
-        for (SDOTypes t : sdoTypes) {
-            if (t.getNamespace().equals(types.getNamespace())) {
-                try {
-                    loadSDOTypes(types, contribution.getModelResolver());
-                } catch (ContributionResolveException e) {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
-                }
-                return (T)t;
-            }
-        }
-        return (T)types;
-    }
-
-    private static void register(Class<?> factoryClass, HelperContext helperContext) throws Exception {
-        Field field = factoryClass.getField("INSTANCE");
-        Object factory = field.get(null);
-        Method method = factory.getClass().getMethod("register", new Class[] {HelperContext.class});
-        method.invoke(factory, new Object[] {helperContext});
-    }
-
-    private void defineFromFactory(SDOTypes importSDO, ModelResolver resolver) throws ContributionResolveException {
-        String factoryName = importSDO.getFactory();
-        if (factoryName != null) {
-            ClassReference reference = new ClassReference(factoryName);
-            ClassReference resolved = resolver.resolveModel(ClassReference.class, reference, context);
-            if (resolved != null && !resolved.isUnresolved()) {
-                try {
-                    Class<?> factoryClass = resolved.getJavaClass();
-                    // Get the namespace
-                    Field field = factoryClass.getField("NAMESPACE_URI");
-                    importSDO.setNamespace((String)field.get(null));
-                    register(factoryClass, helperContext);
-                    importSDO.setUnresolved(false);
-                } catch (Exception e) {
-                    ContributionResolveException ce = new ContributionResolveException(e);
-                    error(context.getMonitor(), "ContributionResolveException", resolver, ce);
-                    //throw ce;
-                }
-            } else {
-                error(context.getMonitor(), "FailToResolveClass", resolver, factoryName);
-                //ContributionResolveException loaderException =
-                //new ContributionResolveException("Fail to resolve class: " + factoryName);
-                //throw loaderException;
-            }
-        }
-    }
-
-    private void defineFromXSD(SDOTypes importSDO, ModelResolver resolver) throws ContributionResolveException {
-        String location = importSDO.getSchemaLocation();
-        if (location != null) {
-            try {
-                Artifact artifact = contributionFactory.createArtifact();
-                artifact.setURI(location);
-                artifact = resolver.resolveModel(Artifact.class, artifact, context);
-                if (artifact.getLocation() != null) {
-                    String wsdlURL = artifact.getLocation();
-                    URLConnection connection = new URL(wsdlURL).openConnection();
-                    connection.setUseCaches(false);
-                    InputStream xsdInputStream = connection.getInputStream();
-                    try {
-                        XSDHelper xsdHelper = helperContext.getXSDHelper();
-                        List<Type> sdoTypes = xsdHelper.define(xsdInputStream, wsdlURL);
-                        for (Type t : sdoTypes) {
-                            importSDO.setNamespace(t.getURI());
-                            break;
-                        }
-                        importSDO.getTypes().addAll(sdoTypes);
-                    } finally {
-                        xsdInputStream.close();
-                    }
-                    importSDO.setUnresolved(false);
-                } else {
-                    error(context.getMonitor(), "FailToResolveLocation", resolver, location);
-                    //ContributionResolveException loaderException = new ContributionResolveException("Fail to resolve location: " + location);
-                    //throw loaderException;
-                }
-            } catch (IOException e) {
-                ContributionResolveException ce = new ContributionResolveException(e);
-                error(context.getMonitor(), "ContributionResolveException", resolver, ce);
-                //throw ce;
-            }
-        } else {
-            String ns = importSDO.getNamespace();
-            if (ns != null) {
-                XSDefinition xsd = xsdFactory.createXSDefinition();
-                xsd.setUnresolved(true);
-                xsd.setNamespace(ns);
-                xsd = resolver.resolveModel(XSDefinition.class, xsd, context);
-                if (!xsd.isUnresolved()) {
-                    XSDHelper xsdHelper = helperContext.getXSDHelper();
-                    xsdHelper.define(xsd.getLocation().toString());
-                }
-            }
-        }
-    }
-
-    private void loadSDOTypes(SDOTypes types, ModelResolver resolver) throws ContributionResolveException {
-        synchronized (types) {
-            if (types.isUnresolved()) {
-                defineFromFactory(types, resolver);
-                defineFromXSD(types, resolver);
-                types.setUnresolved(false);
-            }
-        }
-    }
-
-    /**
-     * Report a exception.
-     *
-     * @param problems
-     * @param message
-     * @param model
-     */
-    private void error(Monitor monitor, String message, Object model, Exception ex) {
-        if (monitor != null) {
-            Problem problem =
-                new ProblemImpl(this.getClass().getName(), "databinding-sdo-validation-messages", Severity.ERROR,
-                                message, model, message, ex);
-            monitor.problem(problem);
-        }
-    }
-
-    /**
-     * Report a error.
-     *
-     * @param problems
-     * @param message
-     * @param model
-     */
-    private void error(Monitor monitor, String message, Object model, Object... messageParameters) {
-        if (monitor != null) {
-            Problem problem =
-                new ProblemImpl(this.getClass().getName(), "databinding-sdo-validation-messages", Severity.ERROR,
-                                message, model, message, (Object[])messageParameters);
-            monitor.problem(problem);
-        }
-    }
-
-}
+/*
+ * 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.databinding.sdo.xml;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.resolver.ClassReference;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.databinding.sdo.SDOTypes;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
+import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
+import org.apache.tuscany.sca.xsd.XSDFactory;
+import org.apache.tuscany.sca.xsd.XSDefinition;
+import org.apache.tuscany.sdo.api.SDOUtil;
+
+import commonj.sdo.Type;
+import commonj.sdo.helper.HelperContext;
+import commonj.sdo.helper.XSDHelper;
+
+/**
+ * SDO types model resolver that aggregates the SDO type registration for an SCA contribution
+ */
+public class SDOTypesModelResolver implements ModelResolver {
+    private Contribution contribution;
+    private HelperContext helperContext;
+    private List<SDOTypes> sdoTypes = new ArrayList<SDOTypes>();
+    private ContributionFactory contributionFactory;
+    private XSDFactory xsdFactory;
+    private ProcessorContext context;
+
+    public SDOTypesModelResolver(Contribution contribution, FactoryExtensionPoint modelFactories) {
+        super();
+        this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
+        this.xsdFactory = modelFactories.getFactory(XSDFactory.class);
+        this.contribution = contribution;
+    }
+
+    public void addModel(Object resolved, ProcessorContext context) {
+        if (helperContext == null) {
+            helperContext = SDOUtil.createHelperContext();
+        }
+        this.context = context;
+        SDOTypes types = (SDOTypes)resolved;
+        try {
+            loadSDOTypes(types, contribution.getModelResolver());
+        } catch (ContributionResolveException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        sdoTypes.add(types);
+    }
+
+    public Object removeModel(Object resolved, ProcessorContext context) {
+        SDOTypes types = (SDOTypes)resolved;
+
+        return sdoTypes.remove(types);
+    }
+
+    public <T> T resolveModel(Class<T> modelClass, T unresolved, ProcessorContext context) {
+        SDOTypes types = (SDOTypes)unresolved;
+        String ns = types.getNamespace();
+        this.context = context;
+        for (SDOTypes t : sdoTypes) {
+            if (t.getNamespace().equals(types.getNamespace())) {
+                try {
+                    loadSDOTypes(types, contribution.getModelResolver());
+                } catch (ContributionResolveException e) {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+                return (T)t;
+            }
+        }
+        return (T)types;
+    }
+
+    private static void register(Class<?> factoryClass, HelperContext helperContext) throws Exception {
+        Field field = factoryClass.getField("INSTANCE");
+        Object factory = field.get(null);
+        Method method = factory.getClass().getMethod("register", new Class[] {HelperContext.class});
+        method.invoke(factory, new Object[] {helperContext});
+    }
+
+    private void defineFromFactory(SDOTypes importSDO, ModelResolver resolver) throws ContributionResolveException {
+        String factoryName = importSDO.getFactory();
+        if (factoryName != null) {
+            ClassReference reference = new ClassReference(factoryName);
+            ClassReference resolved = resolver.resolveModel(ClassReference.class, reference, context);
+            if (resolved != null && !resolved.isUnresolved()) {
+                try {
+                    Class<?> factoryClass = resolved.getJavaClass();
+                    // Get the namespace
+                    Field field = factoryClass.getField("NAMESPACE_URI");
+                    importSDO.setNamespace((String)field.get(null));
+                    register(factoryClass, helperContext);
+                    importSDO.setUnresolved(false);
+                } catch (Exception e) {
+                    ContributionResolveException ce = new ContributionResolveException(e);
+                    error(context.getMonitor(), "ContributionResolveException", resolver, ce);
+                    //throw ce;
+                }
+            } else {
+                error(context.getMonitor(), "FailToResolveClass", resolver, factoryName);
+                //ContributionResolveException loaderException =
+                //new ContributionResolveException("Fail to resolve class: " + factoryName);
+                //throw loaderException;
+            }
+        }
+    }
+
+    private void defineFromXSD(SDOTypes importSDO, ModelResolver resolver) throws ContributionResolveException {
+        String location = importSDO.getSchemaLocation();
+        if (location != null) {
+            try {
+                Artifact artifact = contributionFactory.createArtifact();
+                artifact.setURI(location);
+                artifact = resolver.resolveModel(Artifact.class, artifact, context);
+                if (artifact.getLocation() != null) {
+                    String wsdlURL = artifact.getLocation();
+                    URLConnection connection = new URL(wsdlURL).openConnection();
+                    connection.setUseCaches(false);
+                    InputStream xsdInputStream = connection.getInputStream();
+                    try {
+                        XSDHelper xsdHelper = helperContext.getXSDHelper();
+                        List<Type> sdoTypes = xsdHelper.define(xsdInputStream, wsdlURL);
+                        for (Type t : sdoTypes) {
+                            importSDO.setNamespace(t.getURI());
+                            break;
+                        }
+                        importSDO.getTypes().addAll(sdoTypes);
+                    } finally {
+                        xsdInputStream.close();
+                    }
+                    importSDO.setUnresolved(false);
+                } else {
+                    error(context.getMonitor(), "FailToResolveLocation", resolver, location);
+                    //ContributionResolveException loaderException = new ContributionResolveException("Fail to resolve location: " + location);
+                    //throw loaderException;
+                }
+            } catch (IOException e) {
+                ContributionResolveException ce = new ContributionResolveException(e);
+                error(context.getMonitor(), "ContributionResolveException", resolver, ce);
+                //throw ce;
+            }
+        } else {
+            String ns = importSDO.getNamespace();
+            if (ns != null) {
+                XSDefinition xsd = xsdFactory.createXSDefinition();
+                xsd.setUnresolved(true);
+                xsd.setNamespace(ns);
+                xsd = resolver.resolveModel(XSDefinition.class, xsd, context);
+                if (!xsd.isUnresolved()) {
+                    XSDHelper xsdHelper = helperContext.getXSDHelper();
+                    xsdHelper.define(xsd.getLocation().toString());
+                }
+            }
+        }
+    }
+
+    private void loadSDOTypes(SDOTypes types, ModelResolver resolver) throws ContributionResolveException {
+        synchronized (types) {
+            if (types.isUnresolved()) {
+                defineFromFactory(types, resolver);
+                defineFromXSD(types, resolver);
+                types.setUnresolved(false);
+            }
+        }
+    }
+
+    /**
+     * Report a exception.
+     *
+     * @param problems
+     * @param message
+     * @param model
+     */
+    private void error(Monitor monitor, String message, Object model, Exception ex) {
+        if (monitor != null) {
+            Problem problem =
+                new ProblemImpl(this.getClass().getName(), "databinding-sdo-validation-messages", Severity.ERROR,
+                                message, model, message, ex);
+            monitor.problem(problem);
+        }
+    }
+
+    /**
+     * Report a error.
+     *
+     * @param problems
+     * @param message
+     * @param model
+     */
+    private void error(Monitor monitor, String message, Object model, Object... messageParameters) {
+        if (monitor != null) {
+            Problem problem =
+                new ProblemImpl(this.getClass().getName(), "databinding-sdo-validation-messages", Severity.ERROR,
+                                message, model, message, (Object[])messageParameters);
+            monitor.problem(problem);
+        }
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java Sat Jun  5 05:17:47 2010
@@ -1,109 +1,109 @@
-/*
- * 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.databinding.sdo.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
-import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.sdo.SDOTypes;
-
-
-/**
- * Loader that handles &lt;import.sdo&gt; elements.
- *
- * @version $Rev: 667376 $ $Date: 2008-06-12 23:29:16 -0700 (Thu, 12 Jun 2008) $
- */
-public class SDOTypesProcessor implements StAXArtifactProcessor<SDOTypes> {
-
-    public SDOTypesProcessor(ExtensionPointRegistry registry) {
-    }
-
-    public QName getXMLType() {
-        return SDOTypes.SDO_TYPES;
-    }
-
-    public SDOTypes read(XMLStreamReader reader,ProcessorContext context) throws ContributionReadException, XMLStreamException {
-        assert SDOTypes.SDO_TYPES.equals(reader.getName());
-
-        // FIXME: How do we associate the application HelperContext with the one
-        // imported by the composite
-        SDOTypes sdoTypes = new SDOTypes();
-        String factoryName = reader.getAttributeValue(null, "factory");
-        if (factoryName != null) {
-            sdoTypes.setFactory(factoryName);
-        }
-        String location = reader.getAttributeValue(null, "location");
-        if (location != null) {
-            sdoTypes.setSchemaLocation(location);
-        }
-        String ns = reader.getAttributeValue(null, "namespace");
-        sdoTypes.setNamespace(ns);
-
-        // Skip to end element
-        while (reader.hasNext()) {
-            if (reader.next() == END_ELEMENT && SDOTypes.SDO_TYPES.equals(reader.getName())) {
-                break;
-            }
-        }
-        return sdoTypes;
-    }
-
-    public QName getArtifactType() {
-        return SDOTypes.SDO_TYPES;
-    }
-
-    public void write(SDOTypes model, XMLStreamWriter writer,ProcessorContext context) throws ContributionWriteException {
-        try {
-            writer.writeStartElement(SDOTypes.SDO_TYPES.getNamespaceURI(), SDOTypes.SDO_TYPES.getLocalPart());
-            if (model.getNamespace() != null) {
-                writer.writeAttribute("namespace", model.getNamespace());
-            }
-            if (model.getSchemaLocation() != null) {
-                writer.writeAttribute("location", model.getSchemaLocation());
-            }
-            if (model.getFactory() != null) {
-                writer.writeAttribute("factory", model.getFactory());
-            }
-            writer.writeEndElement();
-        } catch (XMLStreamException e) {
-            throw new ContributionWriteException(e);
-        }
-    }
-
-    public Class<SDOTypes> getModelType() {
-        return SDOTypes.class;
-    }
-
-    public void resolve(SDOTypes types, ModelResolver resolver,ProcessorContext context) throws ContributionResolveException {
-        // Defer the resolution to SDOTypesResolver which aggragates the type registrations into an instance of HelperContext
-        resolver.addModel(types,context);
-    }
-
-}
+/*
+ * 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.databinding.sdo.xml;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.databinding.sdo.SDOTypes;
+
+
+/**
+ * Loader that handles &lt;import.sdo&gt; elements.
+ *
+ * @version $Rev$ $Date$
+ */
+public class SDOTypesProcessor implements StAXArtifactProcessor<SDOTypes> {
+
+    public SDOTypesProcessor(ExtensionPointRegistry registry) {
+    }
+
+    public QName getXMLType() {
+        return SDOTypes.SDO_TYPES;
+    }
+
+    public SDOTypes read(XMLStreamReader reader,ProcessorContext context) throws ContributionReadException, XMLStreamException {
+        assert SDOTypes.SDO_TYPES.equals(reader.getName());
+
+        // FIXME: How do we associate the application HelperContext with the one
+        // imported by the composite
+        SDOTypes sdoTypes = new SDOTypes();
+        String factoryName = reader.getAttributeValue(null, "factory");
+        if (factoryName != null) {
+            sdoTypes.setFactory(factoryName);
+        }
+        String location = reader.getAttributeValue(null, "location");
+        if (location != null) {
+            sdoTypes.setSchemaLocation(location);
+        }
+        String ns = reader.getAttributeValue(null, "namespace");
+        sdoTypes.setNamespace(ns);
+
+        // Skip to end element
+        while (reader.hasNext()) {
+            if (reader.next() == END_ELEMENT && SDOTypes.SDO_TYPES.equals(reader.getName())) {
+                break;
+            }
+        }
+        return sdoTypes;
+    }
+
+    public QName getArtifactType() {
+        return SDOTypes.SDO_TYPES;
+    }
+
+    public void write(SDOTypes model, XMLStreamWriter writer,ProcessorContext context) throws ContributionWriteException {
+        try {
+            writer.writeStartElement(SDOTypes.SDO_TYPES.getNamespaceURI(), SDOTypes.SDO_TYPES.getLocalPart());
+            if (model.getNamespace() != null) {
+                writer.writeAttribute("namespace", model.getNamespace());
+            }
+            if (model.getSchemaLocation() != null) {
+                writer.writeAttribute("location", model.getSchemaLocation());
+            }
+            if (model.getFactory() != null) {
+                writer.writeAttribute("factory", model.getFactory());
+            }
+            writer.writeEndElement();
+        } catch (XMLStreamException e) {
+            throw new ContributionWriteException(e);
+        }
+    }
+
+    public Class<SDOTypes> getModelType() {
+        return SDOTypes.class;
+    }
+
+    public void resolve(SDOTypes types, ModelResolver resolver,ProcessorContext context) throws ContributionResolveException {
+        // Defer the resolution to SDOTypesResolver which aggragates the type registrations into an instance of HelperContext
+        resolver.addModel(types,context);
+    }
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml Sat Jun  5 05:17:47 2010
@@ -1,61 +1,61 @@
-<?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.
--->
-<project>
-
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.tuscany.sca</groupId>
-        <artifactId>tuscany-modules</artifactId>
-        <version>2.0-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <artifactId>tuscany-domain-node</artifactId>
-    <name>Apache Tuscany SCA Domain Node</name>
-
-    <dependencies>
- 
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-node-impl</artifactId>
-            <version>2.0-SNAPSHOT</version>
-        </dependency>
-        
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-sca-api</artifactId>
-            <version>2.0-SNAPSHOT</version>
-        </dependency>
-        
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-sca-client-impl</artifactId>
-            <version>2.0-SNAPSHOT</version>
-        </dependency>
-
-         <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-implementation-java-runtime</artifactId>
-            <version>2.0-SNAPSHOT</version>
-        </dependency>  
-                      
-    </dependencies>
-
-</project>
+<?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.
+-->
+<project>
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-modules</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>tuscany-domain-node</artifactId>
+    <name>Apache Tuscany SCA Domain Node</name>
+
+    <dependencies>
+ 
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-node-impl</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-client-impl</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+
+         <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>  
+                      
+    </dependencies>
+
+</project>

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java Sat Jun  5 05:17:47 2010
@@ -1,179 +1,179 @@
-/*
- * 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.node;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
-import org.apache.tuscany.sca.runtime.EndpointRegistry;
-import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
-import org.oasisopen.sca.NoSuchDomainException;
-import org.oasisopen.sca.NoSuchServiceException;
-import org.oasisopen.sca.client.SCAClientFactory;
-
-public class DomainNode {
-
-    private static final String DEFAULT_DOMAIN_SCHEME = "vm";
-    private static final String DEFAULT_DOMAIN_NAME = "defaultDomain";
-    private static final String DEFAULT_CONFIG_URI = DEFAULT_DOMAIN_SCHEME + "://" + DEFAULT_DOMAIN_NAME;
-
-    private String domainName;
-    private String domainRegistryURI;
-    
-    private Map<String, Node> nodes = new HashMap<String, Node>();
-    
-    public DomainNode() {
-       this(DEFAULT_CONFIG_URI, new String[]{});   
-    }
-    
-    public DomainNode(String... contributionLocations) {
-        this(DEFAULT_CONFIG_URI, contributionLocations);   
-    }
-    
-    public DomainNode(String configURI, String[] contributionLocations) {
-        this.domainRegistryURI = configURI;
-        initDomainName(configURI);
-        if (contributionLocations == null || contributionLocations.length == 0) {
-            addContribution(null, "_null");
-        } else {
-            for (String loc : contributionLocations) {
-                addContribution(loc);
-            }
-        }
-    }
-
-    public void stop() {
-        for (Node node : nodes.values()) {
-            node.stop();
-        }
-    }
-
-    public String addContribution(String location) {
-        String uri = location;
-        addContribution(uri, location);
-        return uri;
-    }
-
-    public void addContribution(String location, String uri) {
-        if (nodes.containsKey(uri)) {
-            throw new IllegalArgumentException("contribution already added: " + uri);
-        }
-        NodeConfiguration configuration = NodeFactory.getInstance().createNodeConfiguration();
-        if (location != null) {
-            configuration.addContribution(uri, location);
-        }
-        configuration.setDomainRegistryURI(domainRegistryURI);
-        configuration.setDomainURI(domainName);
-        configuration.setURI(uri); //???
-        Node node = NodeFactory.getInstance().createNode(configuration).start();
-        nodes.put(uri, node);
-    }
-
-    public void removeContribution(String uri) {
-        if (!nodes.containsKey(uri)) {
-            throw new IllegalArgumentException("contribution not found: " + uri);
-        }
-        Node node = nodes.remove(uri);
-        node.stop();
-    }
-
-    public String getDomainName() {
-        return domainName;
-    }
-    
-    public String getDomainConfigURI() {
-        return domainRegistryURI;
-    }
-    
-    public List<String> getServiceNames() {
-        List<String> serviceNames = new ArrayList<String>();
-        if (nodes.size() > 0) {
-            ExtensionPointRegistry extensionsRegistry = ((NodeImpl)nodes.values().iterator().next()).getExtensionPointRegistry();
-            DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(extensionsRegistry);
-            EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry(getDomainConfigURI(), getDomainName());
-            for (Endpoint endpoint : endpointRegistry.getEndpoints()) {
-                // Would be nice if Endpoint.getURI() returned this:
-                String name = endpoint.getComponent().getName() + "/" + endpoint.getService().getName();
-                if (endpoint.getBinding() != null) {
-                    // TODO: shouldn't the binding name be null if its not explicitly specified? 
-                    //       For now don't include it if the same as the default
-                    if (!endpoint.getService().getName().equals(endpoint.getBinding().getName())) {
-                        name += "/" + endpoint.getBinding().getName();
-                    }
-                }
-                serviceNames.add(name);
-            }
-        }
-        return serviceNames;
-    }
-
-    public <T> T getService(Class<T> interfaze, String uri) throws NoSuchServiceException {
-        try {
-            return SCAClientFactory.newInstance(URI.create(getDomainName())).getService(interfaze, uri);
-        } catch (NoSuchDomainException e) {
-            throw new IllegalStateException(e);
-        }
-    }
-
-    protected void initDomainName(String configURI) {
-//        URI uri = URI.create(fixScheme(configURI));
-//        String dn = uri.getHost();
-//        if (dn == null || dn.length() < 1) {
-//            dn = DEFAULT_DOMAIN_NAME;
-//        }
-        if (configURI.startsWith("tuscany:vm:")) {
-            domainName = configURI.substring("tuscany:vm:".length());  
-        } else if (configURI.startsWith("tuscany:")) {
-            int i = configURI.indexOf('?');
-            if (i == -1) {
-                domainName = configURI.substring("tuscany:".length());  
-            } else{
-                domainName = configURI.substring("tuscany:".length(), i);  
-            }
-        } else {
-            domainName = configURI;  
-        }
-    }
-    
-    /**
-     * I keep typing the scheme part with just a colon instead of colon slash slash
-     * which URI doesn't parse properly which irritates me so fix it up here
-     */
-    protected String fixScheme(String uri) {
-        int i = uri.indexOf(":");
-        if (i > -1 && uri.charAt(i+1) != '/') {
-            uri = uri.replaceFirst(":", ":/");
-        }
-        if (i > -1 && uri.charAt(i+2) != '/') {
-            uri = uri.replaceFirst(":/", "://");
-        }
-        return uri;
-    }
-}
+/*
+ * 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.node;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
+import org.apache.tuscany.sca.runtime.DomainRegistryFactory;
+import org.apache.tuscany.sca.runtime.EndpointRegistry;
+import org.apache.tuscany.sca.runtime.ExtensibleDomainRegistryFactory;
+import org.oasisopen.sca.NoSuchDomainException;
+import org.oasisopen.sca.NoSuchServiceException;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+public class DomainNode {
+
+    private static final String DEFAULT_DOMAIN_SCHEME = "vm";
+    private static final String DEFAULT_DOMAIN_NAME = "defaultDomain";
+    private static final String DEFAULT_CONFIG_URI = DEFAULT_DOMAIN_SCHEME + "://" + DEFAULT_DOMAIN_NAME;
+
+    private String domainName;
+    private String domainRegistryURI;
+    
+    private Map<String, Node> nodes = new HashMap<String, Node>();
+    
+    public DomainNode() {
+       this(DEFAULT_CONFIG_URI, new String[]{});   
+    }
+    
+    public DomainNode(String... contributionLocations) {
+        this(DEFAULT_CONFIG_URI, contributionLocations);   
+    }
+    
+    public DomainNode(String configURI, String[] contributionLocations) {
+        this.domainRegistryURI = configURI;
+        initDomainName(configURI);
+        if (contributionLocations == null || contributionLocations.length == 0) {
+            addContribution(null, "_null");
+        } else {
+            for (String loc : contributionLocations) {
+                addContribution(loc);
+            }
+        }
+    }
+
+    public void stop() {
+        for (Node node : nodes.values()) {
+            node.stop();
+        }
+    }
+
+    public String addContribution(String location) {
+        String uri = location;
+        addContribution(uri, location);
+        return uri;
+    }
+
+    public void addContribution(String location, String uri) {
+        if (nodes.containsKey(uri)) {
+            throw new IllegalArgumentException("contribution already added: " + uri);
+        }
+        NodeConfiguration configuration = NodeFactory.getInstance().createNodeConfiguration();
+        if (location != null) {
+            configuration.addContribution(uri, location);
+        }
+        configuration.setDomainRegistryURI(domainRegistryURI);
+        configuration.setDomainURI(domainName);
+        configuration.setURI(uri); //???
+        Node node = NodeFactory.getInstance().createNode(configuration).start();
+        nodes.put(uri, node);
+    }
+
+    public void removeContribution(String uri) {
+        if (!nodes.containsKey(uri)) {
+            throw new IllegalArgumentException("contribution not found: " + uri);
+        }
+        Node node = nodes.remove(uri);
+        node.stop();
+    }
+
+    public String getDomainName() {
+        return domainName;
+    }
+    
+    public String getDomainConfigURI() {
+        return domainRegistryURI;
+    }
+    
+    public List<String> getServiceNames() {
+        List<String> serviceNames = new ArrayList<String>();
+        if (nodes.size() > 0) {
+            ExtensionPointRegistry extensionsRegistry = ((NodeImpl)nodes.values().iterator().next()).getExtensionPointRegistry();
+            DomainRegistryFactory domainRegistryFactory = ExtensibleDomainRegistryFactory.getInstance(extensionsRegistry);
+            EndpointRegistry endpointRegistry = domainRegistryFactory.getEndpointRegistry(getDomainConfigURI(), getDomainName());
+            for (Endpoint endpoint : endpointRegistry.getEndpoints()) {
+                // Would be nice if Endpoint.getURI() returned this:
+                String name = endpoint.getComponent().getName() + "/" + endpoint.getService().getName();
+                if (endpoint.getBinding() != null) {
+                    // TODO: shouldn't the binding name be null if its not explicitly specified? 
+                    //       For now don't include it if the same as the default
+                    if (!endpoint.getService().getName().equals(endpoint.getBinding().getName())) {
+                        name += "/" + endpoint.getBinding().getName();
+                    }
+                }
+                serviceNames.add(name);
+            }
+        }
+        return serviceNames;
+    }
+
+    public <T> T getService(Class<T> interfaze, String uri) throws NoSuchServiceException {
+        try {
+            return SCAClientFactory.newInstance(URI.create(getDomainName())).getService(interfaze, uri);
+        } catch (NoSuchDomainException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    protected void initDomainName(String configURI) {
+//        URI uri = URI.create(fixScheme(configURI));
+//        String dn = uri.getHost();
+//        if (dn == null || dn.length() < 1) {
+//            dn = DEFAULT_DOMAIN_NAME;
+//        }
+        if (configURI.startsWith("tuscany:vm:")) {
+            domainName = configURI.substring("tuscany:vm:".length());  
+        } else if (configURI.startsWith("tuscany:")) {
+            int i = configURI.indexOf('?');
+            if (i == -1) {
+                domainName = configURI.substring("tuscany:".length());  
+            } else{
+                domainName = configURI.substring("tuscany:".length(), i);  
+            }
+        } else {
+            domainName = configURI;  
+        }
+    }
+    
+    /**
+     * I keep typing the scheme part with just a colon instead of colon slash slash
+     * which URI doesn't parse properly which irritates me so fix it up here
+     */
+    protected String fixScheme(String uri) {
+        int i = uri.indexOf(":");
+        if (i > -1 && uri.charAt(i+1) != '/') {
+            uri = uri.replaceFirst(":", ":/");
+        }
+        if (i > -1 && uri.charAt(i+2) != '/') {
+            uri = uri.replaceFirst(":/", "://");
+        }
+        return uri;
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNode.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNodeMain.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNodeMain.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNodeMain.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNodeMain.java Sat Jun  5 05:17:47 2010
@@ -1,67 +1,67 @@
-/*
- * 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.node;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.node.Node;
-import org.apache.tuscany.sca.node.NodeFactory;
-
-public class DomainNodeMain {
-
-    /**
-     * Start an SCA domain node
-     * @param args a list of contribution jars for the node to run
-     */
-    public static void main(String[] args) throws Exception {
-
-        String configURI = "uri:default";
-
-        List<String> contributions = new ArrayList<String>();
-        for (int i = 0; i < args.length; i++) {
-            if (args[i].startsWith("vm:") || args[i].startsWith("tribes:") || args[i].startsWith("tuscany:") || args[i].startsWith("uri:") || args[i].startsWith("properties:")) {
-                configURI = args[i];
-            } else{
-                File f = new File(args[i]);
-                if (!f.exists()) {
-                    System.err.println("contribution not found: " + f);
-                    System.exit(1);
-                }
-                contributions.add(f.toURI().toString());
-            }
-        }
-
-        Node node = NodeFactory.newInstance(configURI).createNode((String)null, contributions.toArray(new String[contributions.size()]));
-        node.start();
-
-        System.out.println("Hit enter to stop node...");
-        if (System.in.read() == -1) {
-            // no sysin so wait for ever letting caller do the terminate
-            Object lock = new Object();
-            synchronized (lock) {
-                lock.wait();
-            }
-        }
-
-        node.stop();
-    }
-}
+/*
+ * 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.node;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+public class DomainNodeMain {
+
+    /**
+     * Start an SCA domain node
+     * @param args a list of contribution jars for the node to run
+     */
+    public static void main(String[] args) throws Exception {
+
+        String configURI = "uri:default";
+
+        List<String> contributions = new ArrayList<String>();
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].startsWith("vm:") || args[i].startsWith("tribes:") || args[i].startsWith("tuscany:") || args[i].startsWith("uri:") || args[i].startsWith("properties:")) {
+                configURI = args[i];
+            } else{
+                File f = new File(args[i]);
+                if (!f.exists()) {
+                    System.err.println("contribution not found: " + f);
+                    System.exit(1);
+                }
+                contributions.add(f.toURI().toString());
+            }
+        }
+
+        Node node = NodeFactory.newInstance(configURI).createNode((String)null, contributions.toArray(new String[contributions.size()]));
+        node.start();
+
+        System.out.println("Hit enter to stop node...");
+        if (System.in.read() == -1) {
+            // no sysin so wait for ever letting caller do the terminate
+            Object lock = new Object();
+            synchronized (lock) {
+                lock.wait();
+            }
+        }
+
+        node.stop();
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNodeMain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/domain/node/DomainNodeMain.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/itest/nodes/Helloworld.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/itest/nodes/Helloworld.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/itest/nodes/Helloworld.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/itest/nodes/Helloworld.java Sat Jun  5 05:17:47 2010
@@ -1,29 +1,29 @@
-/*
- * 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 itest.nodes;
-
-import org.oasisopen.sca.annotation.Remotable;
-
-@Remotable
-public interface Helloworld {
-    
-    String sayHello(String name);
-
-}
+/*
+ * 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 itest.nodes;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Helloworld {
+    
+    String sayHello(String name);
+
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/itest/nodes/Helloworld.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/itest/nodes/Helloworld.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java Sat Jun  5 05:17:47 2010
@@ -1,84 +1,84 @@
-/*
- * 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.node;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import itest.nodes.Helloworld;
-
-import org.junit.After;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.oasisopen.sca.ServiceRuntimeException;
-
-/**
- * This shows how to test the Calculator service component.
- */
-@Ignore("TUSCANY-3391")
-public class GetServiceTestCase{
-
-    private static DomainNode clientNode;
-    private static DomainNode serviceNode;
-    
-    @Test
-    public void testTwoNodesSameDomain() throws Exception {
-        serviceNode = new DomainNode("target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
-        clientNode = new DomainNode("target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
-
-        Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");
-        assertNotNull(service);
-        assertEquals("Hello Petra", service.sayHello("Petra"));
-
-        Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient");
-        assertNotNull(client);
-        assertEquals("Hi Hello Petra", client.sayHello("Petra"));
-    }
-
-    @Test
-    public void testTwoNodesDifferentDomains() throws Exception {
-        serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
-        Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");
-        assertNotNull(service);
-        assertEquals("Hello Petra", service.sayHello("Petra"));
-
-        clientNode = new DomainNode("vm://barDomain", new String[] {"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
-        Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient");
-        assertNotNull(client);
-
-        try {
-            assertEquals("Hi Hello Petra", client.sayHello("Petra"));
-            fail();
-        } catch (ServiceRuntimeException e) {
-            // FIXME: this gives an SCARuntimeException, would be better to be something like ServiceNotFoundException?
-            // expected
-        }
-    }
-
-    @After
-    public void tearDownAfterClass() throws Exception {
-        if (clientNode != null) {
-            clientNode.stop();
-        }
-        if (serviceNode != null) {
-            serviceNode.stop();
-        }
-    }
-}
+/*
+ * 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.node;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import itest.nodes.Helloworld;
+
+import org.junit.After;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.oasisopen.sca.ServiceRuntimeException;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+@Ignore("TUSCANY-3391")
+public class GetServiceTestCase{
+
+    private static DomainNode clientNode;
+    private static DomainNode serviceNode;
+    
+    @Test
+    public void testTwoNodesSameDomain() throws Exception {
+        serviceNode = new DomainNode("target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
+        clientNode = new DomainNode("target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
+
+        Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");
+        assertNotNull(service);
+        assertEquals("Hello Petra", service.sayHello("Petra"));
+
+        Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient");
+        assertNotNull(client);
+        assertEquals("Hi Hello Petra", client.sayHello("Petra"));
+    }
+
+    @Test
+    public void testTwoNodesDifferentDomains() throws Exception {
+        serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
+        Helloworld service = serviceNode.getService(Helloworld.class, "HelloworldService");
+        assertNotNull(service);
+        assertEquals("Hello Petra", service.sayHello("Petra"));
+
+        clientNode = new DomainNode("vm://barDomain", new String[] {"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
+        Helloworld client = clientNode.getService(Helloworld.class, "HelloworldClient");
+        assertNotNull(client);
+
+        try {
+            assertEquals("Hi Hello Petra", client.sayHello("Petra"));
+            fail();
+        } catch (ServiceRuntimeException e) {
+            // FIXME: this gives an SCARuntimeException, would be better to be something like ServiceNotFoundException?
+            // expected
+        }
+    }
+
+    @After
+    public void tearDownAfterClass() throws Exception {
+        if (clientNode != null) {
+            clientNode.stop();
+        }
+        if (serviceNode != null) {
+            serviceNode.stop();
+        }
+    }
+}

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/GetServiceTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java?rev=951651&r1=951650&r2=951651&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/domain/node/MultipleNodesPerJVMTestCase.java Sat Jun  5 05:17:47 2010
@@ -1,87 +1,87 @@
-/*
- * 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.node;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import itest.nodes.Helloworld;
-
-import java.net.URI;
-
-import org.junit.After;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.oasisopen.sca.ServiceRuntimeException;
-import org.oasisopen.sca.client.SCAClientFactory;
-
-/**
- * This shows how to test the Calculator service component.
- */
-@Ignore("TUSCANY-3391")
-public class MultipleNodesPerJVMTestCase{
-
-    private static DomainNode clientNode;
-    private static DomainNode serviceNode;
-    
-    @Test
-    public void testTwoNodesSameDomain() throws Exception {
-        serviceNode = new DomainNode("target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
-        clientNode = new DomainNode("target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
-
-        Helloworld service = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldService");
-        assertNotNull(service);
-        assertEquals("Hello Petra", service.sayHello("Petra"));
-
-        Helloworld client = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldClient");
-        assertNotNull(client);
-        assertEquals("Hi Hello Petra", client.sayHello("Petra"));
-    }
-
-    @Test
-    public void testTwoNodesDifferentDomains() throws Exception {
-        serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
-        Helloworld service = SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class, "HelloworldService");
-        assertNotNull(service);
-        assertEquals("Hello Petra", service.sayHello("Petra"));
-
-        clientNode = new DomainNode("vm://barDomain", new String[]{"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
-        Helloworld client = SCAClientFactory.newInstance(URI.create("vm://barDomain")).getService(Helloworld.class, "HelloworldClient");
-        assertNotNull(client);
-
-        try {
-            assertEquals("Hi Hello Petra", client.sayHello("Petra"));
-            fail();
-        } catch (ServiceRuntimeException e) {
-            // FIXME: this gives an SCARuntimeException, would be better to be something like ServiceNotFoundException?
-            // expected
-        }
-    }
-
-    @After
-    public void tearDownAfterClass() throws Exception {
-        if (clientNode != null) {
-            clientNode.stop();
-        }
-        if (serviceNode != null) {
-            serviceNode.stop();
-        }
-    }
-}
+/*
+ * 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.node;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import itest.nodes.Helloworld;
+
+import java.net.URI;
+
+import org.junit.After;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.oasisopen.sca.ServiceRuntimeException;
+import org.oasisopen.sca.client.SCAClientFactory;
+
+/**
+ * This shows how to test the Calculator service component.
+ */
+@Ignore("TUSCANY-3391")
+public class MultipleNodesPerJVMTestCase{
+
+    private static DomainNode clientNode;
+    private static DomainNode serviceNode;
+    
+    @Test
+    public void testTwoNodesSameDomain() throws Exception {
+        serviceNode = new DomainNode("target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar");
+        clientNode = new DomainNode("target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar");
+
+        Helloworld service = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldService");
+        assertNotNull(service);
+        assertEquals("Hello Petra", service.sayHello("Petra"));
+
+        Helloworld client = SCAClientFactory.newInstance(URI.create("vm://defaultDomain")).getService(Helloworld.class, "HelloworldClient");
+        assertNotNull(client);
+        assertEquals("Hi Hello Petra", client.sayHello("Petra"));
+    }
+
+    @Test
+    public void testTwoNodesDifferentDomains() throws Exception {
+        serviceNode = new DomainNode("vm://fooDomain", new String[]{"target/test-classes/itest-nodes-helloworld-service-2.0-SNAPSHOT.jar"});
+        Helloworld service = SCAClientFactory.newInstance(URI.create("vm://fooDomain")).getService(Helloworld.class, "HelloworldService");
+        assertNotNull(service);
+        assertEquals("Hello Petra", service.sayHello("Petra"));
+
+        clientNode = new DomainNode("vm://barDomain", new String[]{"target/test-classes/itest-nodes-helloworld-client-2.0-SNAPSHOT.jar"});
+        Helloworld client = SCAClientFactory.newInstance(URI.create("vm://barDomain")).getService(Helloworld.class, "HelloworldClient");
+        assertNotNull(client);
+
+        try {
+            assertEquals("Hi Hello Petra", client.sayHello("Petra"));
+            fail();
+        } catch (ServiceRuntimeException e) {
+            // FIXME: this gives an SCARuntimeException, would be better to be something like ServiceNotFoundException?
+            // expected
+        }
+    }
+
+    @After
+    public void tearDownAfterClass() throws Exception {
+        if (clientNode != null) {
+            clientNode.stop();
+        }
+        if (serviceNode != null) {
+            serviceNode.stop();
+        }
+    }
+}



Mime
View raw message