You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/03/23 17:20:54 UTC
svn commit: r521792 [6/8] - in
/incubator/tuscany/sandbox/sebastien/java/sca: modules/ modules2/
modules2/assembly/ modules2/assembly/src/ modules2/assembly/src/main/
modules2/assembly/src/main/java/ modules2/assembly/src/main/java/org/
modules2/assemb...
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaConstants.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaConstants.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaConstants.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaConstants.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,28 @@
+/*
+ * 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.java.scdl;
+
+public interface JavaConstants {
+
+ public final String INTERFACE_JAVA ="interface.java";
+ public final String IMPLEMENTATION_JAVA = "implementation.java";
+ public final String INTERFACE = "interface";
+ public final String CLASS = "class";
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaConstants.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaHandler.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaHandler.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaHandler.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,82 @@
+/*
+ * 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.java.scdl;
+
+import org.apache.tuscany.assembly.model.Implementation;
+import org.apache.tuscany.assembly.model.Interface;
+import org.apache.tuscany.java.model.JavaFactory;
+import org.apache.tuscany.java.model.JavaImplementation;
+import org.apache.tuscany.java.model.JavaInterface;
+import org.apache.tuscany.scdl.Constants;
+import org.apache.tuscany.scdl.ImplementationHandler;
+import org.apache.tuscany.scdl.InterfaceHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * A content handler for Java interfaces and implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaHandler extends DefaultHandler implements ImplementationHandler, InterfaceHandler {
+
+ private JavaFactory javaFactory;
+ private JavaImplementation javaImplementation;
+ private JavaInterface javaInterface;
+
+ public JavaHandler(JavaFactory javaFactory) {
+ this.javaFactory = javaFactory;
+ }
+
+ public void startDocument() throws SAXException {
+ javaInterface = null;
+ javaImplementation = null;
+ }
+
+ public void startElement(String uri, String name, String qname, Attributes attr) throws SAXException {
+
+ if (Constants.SCA10_NS.equals(uri)) {
+
+ if (JavaConstants.IMPLEMENTATION_JAVA.equals(name)) {
+
+ // Parse a Java implementation
+ javaImplementation = javaFactory.createJavaImplementation();
+ javaImplementation.setUnresolved(true);
+ javaImplementation.setName(attr.getValue(JavaConstants.CLASS));
+
+ } else if (JavaConstants.INTERFACE_JAVA.equals(name)) {
+
+ // Parse a Java interface
+ javaInterface = javaFactory.createJavaInterface();
+ javaInterface.setUnresolved(true);
+ javaInterface.setName(attr.getValue(JavaConstants.INTERFACE));
+ }
+ }
+ }
+
+ public Implementation getImplementation() {
+ return javaImplementation;
+ }
+
+ public Interface getInterface() {
+ return javaInterface;
+ }
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/main/java/org/apache/tuscany/java/scdl/JavaHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/java/org/apache/tuscany/java/scdl/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/java/org/apache/tuscany/java/scdl/ReadTestCase.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/java/org/apache/tuscany/java/scdl/ReadTestCase.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/java/org/apache/tuscany/java/scdl/ReadTestCase.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,108 @@
+/*
+ * 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.java.scdl;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.assembly.util.CompositeUtil;
+import org.apache.tuscany.assembly.util.PrintUtil;
+import org.apache.tuscany.java.model.impl.JavaFactoryImpl;
+import org.apache.tuscany.scdl.Constants;
+import org.apache.tuscany.scdl.ContentHandlerRegistry;
+import org.apache.tuscany.scdl.ImplementationHandler;
+import org.apache.tuscany.scdl.InterfaceHandler;
+import org.apache.tuscany.scdl.impl.ComponentTypeHandler;
+import org.apache.tuscany.scdl.impl.CompositeHandler;
+import org.apache.tuscany.scdl.impl.ConstrainingTypeHandler;
+import org.apache.tuscany.scdl.impl.DefaultContentHandlerRegistry;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test the usability of the assembly model API when loading SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ AssemblyFactory assemblyFactory;
+ XMLReader reader;
+ ContentHandlerRegistry<InterfaceHandler> interfaceHandlers;
+ ContentHandlerRegistry<ImplementationHandler> implementationHandlers;
+
+ public void setUp() throws Exception {
+
+ reader = XMLReaderFactory.createXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+
+ assemblyFactory = new AssemblyFactoryImpl();
+
+ JavaHandler javaHandler = new JavaHandler(new JavaFactoryImpl(assemblyFactory));
+
+ interfaceHandlers = new DefaultContentHandlerRegistry<InterfaceHandler>();
+ interfaceHandlers.addHandler(Constants.SCA10_NS, JavaConstants.INTERFACE_JAVA, javaHandler);
+ implementationHandlers = new DefaultContentHandlerRegistry<ImplementationHandler>();
+ implementationHandlers.addHandler(Constants.SCA10_NS, JavaConstants.IMPLEMENTATION_JAVA, javaHandler);
+ }
+
+ public void tearDown() throws Exception {
+ assemblyFactory = null;
+ reader = null;
+ }
+
+ public void testReadComponentType() throws Exception {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentTypeHandler handler = new ComponentTypeHandler(assemblyFactory, interfaceHandlers);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getComponentType());
+
+ new PrintUtil(System.out).print(handler.getComponentType());
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeHandler handler = new ConstrainingTypeHandler(assemblyFactory, interfaceHandlers);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getConstrainingType());
+
+ new PrintUtil(System.out).print(handler.getConstrainingType());
+ }
+
+ public void testReadComposite() throws Exception {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("Calculator.composite");
+ CompositeHandler handler = new CompositeHandler(assemblyFactory, interfaceHandlers, implementationHandlers, null);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getComposite());
+
+ new CompositeUtil(assemblyFactory, handler.getComposite()).configure(null);
+
+ new PrintUtil(System.out).print(handler.getComposite());
+ }
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/java/org/apache/tuscany/java/scdl/ReadTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/java/org/apache/tuscany/java/scdl/ReadTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/Calculator.composite?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/Calculator.composite (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/Calculator.composite Fri Mar 23 09:20:35 2007
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ name="calc:Calculator">
+
+ <service name="CalculatorService" promote="CalculatorServiceComponent">
+ <interface.java interface="calculator.CalculatorService"/>
+ </service>
+
+ <component name="CalculatorServiceComponent">
+ <implementation.java class="calculator.CalculatorServiceImpl"/>
+ <reference name="addService" target="AddServiceComponent"/>
+ <reference name="subtractService" target="SubtractServiceComponent"/>
+ <reference name="multiplyService" target="MultiplyServiceComponent"/>
+ <reference name="divideService" target="DivideServiceComponent"/>
+ </component>
+
+ <component name="AddServiceComponent">
+ <implementation.java class="calculator.AddServiceImpl"/>
+ </component>
+
+ <component name="SubtractServiceComponent">
+ <implementation.java class="calculator.SubtractServiceImpl"/>
+ </component>
+
+ <component name="MultiplyServiceComponent">
+ <implementation.java class="calculator.MultiplyServiceImpl"/>
+ </component>
+
+ <component name="DivideServiceComponent">
+ <implementation.java class="calculator.DivideServiceImpl"/>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/Calculator.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/Calculator.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorComponent.constrainingType
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorComponent.constrainingType?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorComponent.constrainingType (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorComponent.constrainingType Fri Mar 23 09:20:35 2007
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:calc="http://sample.calculator"
+ name="calc:CalculatorComponent">
+
+ <service name="CalculatorService">
+ <interface.java class="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java class="calculator.DivideService" />
+ </reference>
+
+</constrainingType>
+
\ No newline at end of file
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorImpl.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorImpl.componentType?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorImpl.componentType (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorImpl.componentType Fri Mar 23 09:20:35 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+ <service name="CalculatorService">
+ <interface.java class="calculator.CalculatorService" />
+ </service>
+
+ <reference name="divideService">
+ <interface.java class="calculator.DivideService" />
+ </reference>
+
+</componentType>
+
\ No newline at end of file
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorImpl.componentType
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java-scdl/src/test/resources/CalculatorImpl.componentType
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/pom.xml?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/pom.xml (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/pom.xml Fri Mar 23 09:20:35 2007
@@ -0,0 +1,49 @@
+<?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>
+ <parent>
+ <groupId>org.apache.tuscany.sca.modules</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-sandbox-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-java</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany Java Interface Model</name>
+ <description>Apache Tuscany Java Interface Model.</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca.modules</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.1-sandbox-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaFactory.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaFactory.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaFactory.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,40 @@
+/*
+ * 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.java.model;
+
+/**
+ * Factory for the Java model
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaFactory {
+
+ /**
+ * Creates a new Java implementation.
+ * @return
+ */
+ JavaImplementation createJavaImplementation();
+
+ /**
+ * Creates a new Java interface.
+ * @return
+ */
+ JavaInterface createJavaInterface();
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaImplementation.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaImplementation.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaImplementation.java Fri Mar 23 09:20:35 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.java.model;
+
+import org.apache.tuscany.assembly.model.Implementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaImplementation extends Implementation {
+
+ /**
+ * Returns the name of the Java implementation class.
+ * @return the name of the Java implementation class
+ */
+ String getName();
+
+ /**
+ * Sets the name of the Java implementation class.
+ * @param className the name of the Java implementation class
+ */
+ void setName(String className);
+
+ /**
+ * Returns the Java implementation class.
+ * @return the Java implementation class
+ */
+ Class<?> getJavaClass();
+
+ /**
+ * Sets the Java implementation class.
+ * @param javaClass the Java implementation class
+ */
+ void setJavaClass(Class<?> javaClass);
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaImplementation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaImplementation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaInterface.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaInterface.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaInterface.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaInterface.java Fri Mar 23 09:20:35 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.java.model;
+
+import org.apache.tuscany.assembly.model.Interface;
+
+/**
+ * Represents a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface JavaInterface extends Interface {
+
+ /**
+ * Returns the name of the Java interface class.
+ * @return the name of the Java interface class
+ */
+ String getName();
+
+ /**
+ * Sets the name of the Java interface class.
+ * @param className the name of the Java interface class
+ */
+ void setName(String className);
+
+ /**
+ * Returns the Java interface class.
+ * @return the Java interface class
+ */
+ Class<?> getJavaClass();
+
+ /**
+ * Sets the Java interface class.
+ * @param javaClass the Java interface class
+ */
+ void setJavaClass(Class<?> javaClass);
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaInterface.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/JavaInterface.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaFactoryImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaFactoryImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaFactoryImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,53 @@
+/*
+ * 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.java.model.impl;
+
+/**
+ * A factory for the Java model.
+ */
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.Service;
+import org.apache.tuscany.java.model.JavaFactory;
+import org.apache.tuscany.java.model.JavaImplementation;
+import org.apache.tuscany.java.model.JavaInterface;
+
+public class JavaFactoryImpl implements JavaFactory {
+
+ private AssemblyFactory assemblyFactory;
+
+ public JavaFactoryImpl(AssemblyFactory assemblyFactory) {
+ this.assemblyFactory = assemblyFactory;
+ }
+
+ public JavaImplementation createJavaImplementation() {
+ JavaImplementation javaImplementation = new JavaImplementationImpl();
+
+ //TODO temporary, services should be created by introspecting
+ // the implementation
+ Service service = assemblyFactory.createService();
+ service.setName("default");
+ javaImplementation.getServices().add(service);
+ return javaImplementation;
+ }
+
+ public JavaInterface createJavaInterface() {
+ return new JavaInterfaceImpl();
+ }
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaImplementationImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaImplementationImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaImplementationImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,55 @@
+/*
+ * 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.java.model.impl;
+
+import org.apache.tuscany.assembly.model.impl.ComponentTypeImpl;
+import org.apache.tuscany.java.model.JavaImplementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaImplementationImpl extends ComponentTypeImpl implements JavaImplementation {
+
+ private String className;
+ private Class<?> javaClass;
+
+ public String getName() {
+ if (isUnresolved())
+ return className;
+ else
+ return javaClass.getName();
+ }
+
+ public void setName(String className) {
+ if (!isUnresolved())
+ throw new IllegalStateException();
+ this.className = className;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaImplementationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaImplementationImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaInterfaceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaInterfaceImpl.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaInterfaceImpl.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaInterfaceImpl.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,55 @@
+/*
+ * 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.java.model.impl;
+
+import org.apache.tuscany.assembly.model.impl.InterfaceImpl;
+import org.apache.tuscany.java.model.JavaInterface;
+
+/**
+ * Represents a Java interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
+
+ private String className;
+ private Class<?> javaClass;
+
+ public String getName() {
+ if (isUnresolved())
+ return className;
+ else
+ return javaClass.getName();
+ }
+
+ public void setName(String className) {
+ if (!isUnresolved())
+ throw new IllegalStateException();
+ this.className = className;
+ }
+
+ public Class<?> getJavaClass() {
+ return javaClass;
+ }
+
+ public void setJavaClass(Class<?> javaClass) {
+ this.javaClass = javaClass;
+ }
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaInterfaceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/java/src/main/java/org/apache/tuscany/java/model/impl/JavaInterfaceImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/LICENSE.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/LICENSE.txt?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/LICENSE.txt (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/LICENSE.txt Fri Mar 23 09:20:35 2007
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/LICENSE.txt
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/NOTICE.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/NOTICE.txt?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/NOTICE.txt (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/NOTICE.txt Fri Mar 23 09:20:35 2007
@@ -0,0 +1,14 @@
+${pom.name}
+Copyright (c) 2005 - 2006 The Apache Software Foundation
+
+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.
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/NOTICE.txt
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/pom.xml?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/pom.xml (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/pom.xml Fri Mar 23 09:20:35 2007
@@ -0,0 +1,35 @@
+<?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>
+ <parent>
+ <groupId>org.apache.tuscany.sca.modules</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-sandbox-incubating-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>new-module</artifactId>
+ <name>Apache Tuscany Module</name>
+ <description>Apache Tuscany Module</description>
+
+ <dependencies>
+ </dependencies>
+
+</project>
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/new-module/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/pom.xml?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/pom.xml (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/pom.xml Fri Mar 23 09:20:35 2007
@@ -0,0 +1,42 @@
+<?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>
+ <parent>
+ <groupId>org.apache.tuscany.sca.modules</groupId>
+ <artifactId>parent</artifactId>
+ <version>0.1-sandbox-incubating-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>tuscany-policy</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Tuscany SCA Policy Model</name>
+ <description>Apache Tuscany SCA Policy Model.</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/Intent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/Intent.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/Intent.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/Intent.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,28 @@
+/*
+ * 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.policy.model;
+
+
+
+/**
+ * Represents a policy intent. See the Policy Framework specification for a description of this attribute.
+ */
+public interface Intent {
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/Intent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/Intent.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/IntentAttachPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/IntentAttachPoint.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/IntentAttachPoint.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/IntentAttachPoint.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.policy.model;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can be have policy intents attached to them.
+ */
+public interface IntentAttachPoint {
+
+ /**
+ * Returns a list of policy intents. See the Policy Framework specification for a description of this attribute.
+ * @return a list of policy intents.
+ */
+ List<Intent> getRequiredIntents();
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/IntentAttachPoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/IntentAttachPoint.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySet.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySet.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySet.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,28 @@
+/*
+ * 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.policy.model;
+
+
+
+/**
+ * Represents a policy set. See the Policy Framework specification for a description of this attribute.
+ */
+public interface PolicySet {
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySet.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySetAttachPoint.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySetAttachPoint.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySetAttachPoint.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySetAttachPoint.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.policy.model;
+
+import java.util.List;
+
+/**
+ * Base interface for all assembly model objects that can have policy sets attached to them.
+ */
+public interface PolicySetAttachPoint {
+
+ /**
+ * Returns a list of policy sets. See the Policy Framework specification for a description of this attribute.
+ * @return a list of policy sets.
+ */
+ List<PolicySet> getPolicySets();
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySetAttachPoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/policy/model/PolicySetAttachPoint.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/Intent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/Intent.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/Intent.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/Intent.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,92 @@
+/*
+ * 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.spi.model;
+
+import java.util.ArrayList;
+import static java.util.Collections.unmodifiableList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+/**
+ * Model representation for intent. This class is used by intent loader only, other SCA model classes will not reference
+ * this class directly.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Intent {
+
+ /**
+ * name of intent.
+ */
+ protected IntentName name;
+
+ /**
+ * Description for this intent
+ */
+ protected String description;
+
+ /**
+ * QNames of artifacts this intent can apply to
+ */
+ protected List<QName> appliedArtifacts = new ArrayList<QName>();
+
+ /**
+ * intents required by this intent, only useful when this intent is a profile intent
+ */
+ protected List<IntentName> requriedIntents = new ArrayList<IntentName>();
+
+ /**
+ * Create a policy intent.
+ *
+ * @param name name of the intent.
+ * @param description description of the intent.
+ */
+ public Intent(IntentName name, String description) {
+ this.name = name;
+ this.description = description;
+ }
+
+ public List<QName> getAppliedArtifacts() {
+ return unmodifiableList(appliedArtifacts);
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public IntentName getName() {
+ return name;
+ }
+
+ public List<IntentName> getRequriedIntents() {
+ return unmodifiableList(requriedIntents);
+ }
+
+ public void addRequriedIntents(IntentName intent) {
+ requriedIntents.add(intent);
+ }
+
+ public void addAppliedArtifacts(QName artifactName) {
+ appliedArtifacts.add(artifactName);
+ }
+
+ public boolean isProfileIntent() {
+ return !requriedIntents.isEmpty();
+ }
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/Intent.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/Intent.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentMap.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentMap.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentMap.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentMap.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,64 @@
+/*
+ * 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.spi.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import static java.util.Collections.unmodifiableCollection;
+
+/**
+ * Represents an IntentMap within PolicySet.
+ *
+ * @version $Rev$ $Date$
+ */
+public class IntentMap extends PolicyModel {
+
+ /* Name of default intent provied by this IntentMap */
+ private String defaultProvideIntent;
+
+ /* Name of intent provided by this IntentMap */
+ private Collection<String> provideIntents = new ArrayList<String>();
+
+ /* Qualifiers of this IntentMap */
+ private Collection<Qualifier> qualifiers = new ArrayList<Qualifier>();
+
+ public IntentMap(String defaultProvideIntent, Collection<String> provideIntents) {
+ super();
+ this.defaultProvideIntent = defaultProvideIntent;
+ this.provideIntents.addAll(provideIntents);
+ }
+
+ public Collection<String> getProvideIntents() {
+ return unmodifiableCollection(provideIntents);
+ }
+
+ public void addQualifier(Qualifier qualifier) {
+ qualifiers.add(qualifier);
+ }
+
+ public Collection<Qualifier> getQualifiers() {
+ return unmodifiableCollection(qualifiers);
+ }
+
+ public String getDefaultProvideIntent() {
+ return defaultProvideIntent;
+ }
+
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentMap.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentName.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentName.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentName.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentName.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,140 @@
+/*
+ * 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.spi.model;
+
+import java.util.Arrays;
+
+/**
+ * Model class represents a name of a intent. An intent name has a domain name and one or more qualified names. For
+ * example, in "sec.confidentiality/message/body", the domain name is sec, and the qualified names are confidentiality,
+ * message and body
+ */
+@SuppressWarnings({"SerializableHasSerializationMethods"})
+public class IntentName implements java.io.Serializable {
+ private static final String QUALIFIED_SEPARATOR = "/";
+ private static final String DOMAIN_SEPARATOR = ".";
+ private static final long serialVersionUID = -7030021353149084879L;
+
+ /**
+ * domain of the intent
+ */
+ private String domain;
+
+ private String[] qualifiedNames;
+
+ /**
+ * Construct a IntentName from a string representation.
+ *
+ * @param intent string representation for a intent.
+ */
+ public IntentName(String intent) {
+ parse(intent);
+ }
+
+ /**
+ * Construct a IntentName from domain name and qualified names
+ *
+ * @param domain domain name of the intent
+ * @param qualifiedNames qualified names of the intent
+ */
+ public IntentName(String domain, String[] qualifiedNames) {
+ this.domain = domain;
+ this.qualifiedNames = qualifiedNames;
+ }
+
+ public String getDomain() {
+ return domain;
+ }
+
+ public String[] getQualifiedNames() {
+ String[] results = new String[qualifiedNames.length];
+ System.arraycopy(qualifiedNames, 0, results, 0, qualifiedNames.length);
+ return results;
+ }
+
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final IntentName other = (IntentName) obj;
+ if (domain == null) {
+ if (other.domain != null) {
+ return false;
+ }
+ } else if (!domain.equals(other.domain)) {
+ return false;
+ }
+ return Arrays.equals(qualifiedNames, other.qualifiedNames);
+ }
+
+ @Override
+ public int hashCode() {
+ final int PRIME = 17;
+ int result = 1;
+ result = PRIME * result + ((domain == null) ? 0 : domain.hashCode());
+ result = PRIME * result + Arrays.hashCode(qualifiedNames);
+ return result;
+ }
+
+ private String getName() {
+ StringBuilder sbd = new StringBuilder(domain);
+ for (int i = 0; i < qualifiedNames.length; i++) {
+ if (i == 0) {
+ sbd.append(DOMAIN_SEPARATOR);
+ } else {
+ sbd.append(QUALIFIED_SEPARATOR);
+ }
+ sbd.append(qualifiedNames[i]);
+ }
+
+ return sbd.toString();
+ }
+
+ /**
+ * Parse a string representation of intent.
+ *
+ * @param intent string representation of intent
+ */
+ private void parse(String intent) {
+ String iname = validateFormat(intent);
+ int domainIdx = iname.indexOf(DOMAIN_SEPARATOR);
+ domain = iname.substring(0, domainIdx);
+ String qualifNamesStr = iname.substring(domainIdx + 1);
+ qualifiedNames = qualifNamesStr.split(QUALIFIED_SEPARATOR);
+
+ }
+
+ private String validateFormat(String intent) {
+ // TODO validate and canonicalize intent name
+ return intent;
+ }
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentName.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/IntentName.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.spi.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import static java.util.Collections.unmodifiableCollection;
+
+/**
+ * PolicyModel which contains concrete policy content in form of WSPolicyAttachment or other extensions.
+ */
+public abstract class PolicyContentModel extends PolicyModel {
+ /* WSPolicyAttachment contained in this Model */
+ protected Collection<WSPolicyAttachment> wsPolicyAttachments = new ArrayList<WSPolicyAttachment>();
+ /* Any policy model extensions besides standard intentMap, ws-policyattachment, etc. */
+ protected Collection<PolicyModel> extensions = new ArrayList<PolicyModel>();
+
+ public Collection<PolicyModel> getPolicyExtensions() {
+ return extensions;
+ }
+
+ public Collection<WSPolicyAttachment> getWsPolicyAttachments() {
+ return unmodifiableCollection(wsPolicyAttachments);
+ }
+
+ public void addWsPolicyAttachment(WSPolicyAttachment attachment) {
+ wsPolicyAttachments.add(attachment);
+ }
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyContentModel.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java Fri Mar 23 09:20:35 2007
@@ -0,0 +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 org.apache.tuscany.spi.model;
+
+
+/**
+ * An abstract base class for all policy model representations.
+ * <p/>
+ * $Version$ $Date$
+ */
+public abstract class PolicyModel {
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicyModel.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicySet.java?view=auto&rev=521792
==============================================================================
--- incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicySet.java (added)
+++ incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicySet.java Fri Mar 23 09:20:35 2007
@@ -0,0 +1,99 @@
+/*
+ * 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.spi.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import static java.util.Collections.unmodifiableCollection;
+import static java.util.Collections.unmodifiableList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
+/**
+ * Model representation for PolicySet.
+ * <p/>
+ * $Rev$ $Date$
+ */
+public class PolicySet extends PolicyContentModel {
+
+ /**
+ * QNames of artifacts to which this Policy can apply
+ */
+ protected List<QName> appliedArtifacts = new ArrayList<QName>();
+
+ /**
+ * IntentMap contained in this PolicySet
+ */
+ private Collection<IntentMap> intentMaps = new ArrayList<IntentMap>();
+
+ /**
+ * Name for PolicySet, corresponding to name attribute of PolicySet element in SCDL
+ */
+ private QName name;
+
+ /**
+ * References to other PolicySet
+ */
+ private Collection<PolicySetReference> policySetReferences = new ArrayList<PolicySetReference>();
+
+ /**
+ * Name of intents provided by this PolicySet
+ */
+ private Collection<IntentName> provideIntents = new ArrayList<IntentName>();
+
+ public PolicySet(QName name, List<IntentName> providesIntent) {
+ super();
+ this.name = name;
+ this.provideIntents.addAll(providesIntent);
+ }
+
+
+ public void addPolicySetReference(PolicySetReference ref) {
+ policySetReferences.add(ref);
+ }
+
+ public void addAppliedArtifacts(QName artifactName) {
+ appliedArtifacts.add(artifactName);
+ }
+
+ public List<QName> getAppliedArtifacts() {
+ return unmodifiableList(appliedArtifacts);
+ }
+
+ public void addIntentMap(IntentMap intentMap) {
+ intentMaps.add(intentMap);
+ }
+
+ public Collection<IntentMap> getIntentMaps() {
+ return unmodifiableCollection(intentMaps);
+ }
+
+ public QName getName() {
+ return name;
+ }
+
+ public Collection<PolicySetReference> getPolicySetReferences() {
+ return unmodifiableCollection(policySetReferences);
+ }
+
+ public Collection<IntentName> getProvideIntents() {
+ return unmodifiableCollection(provideIntents);
+ }
+
+}
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/sandbox/sebastien/java/sca/modules2/policy/src/main/java/org/apache/tuscany/spi/model/PolicySet.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org