summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:06:50 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:06:50 +0000
commit0f3f9b59b310833f31ba234ee4aefa808649833c (patch)
tree4f8b3354beb0643151424eb978eece9e55038c90 /sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension
parentf860c2f35b2f94e379d2ff7d5c13f54cd4a3132a (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835120 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension')
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/README87
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/build.xml51
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/pom.xml77
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUD.java54
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java48
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java34
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/DefaultCRUDImplementationFactory.java49
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java90
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java135
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationProcessor.java95
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/module/CRUDModuleActivator.java76
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java70
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java45
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java77
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java64
-rw-r--r--sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/test/resources/crud.composite30
17 files changed, 1100 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/README b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/README
new file mode 100644
index 0000000000..973c13d00c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/README
@@ -0,0 +1,87 @@
+Implementation CRUD Sample
+==========================
+This sample demonstrates how new implementation types are constructed for
+Apache Tuscany SCA.
+
+The README in the samples directory (the directory above this) provides
+general instructions about building and running samples. Take a look there
+first.
+
+If you want to try out the CRUD implementation type that this sample provides
+please see the implementation-crud sample that provides the necessary client
+code to bring up an application that uses this implementation extension.
+
+Sample Overview
+---------------
+This sample contains a CRUD implementation type as an example of how to create
+new implementation types. Components using this implementation type always
+expose the same Create, Retrieve, Update and Delete interface. This sample
+uses a singleton ResourceManager to perform the CRUD operations but of course
+a real component would provide a real implementation.
+
+implementation-crud-extension/
+ src/
+ main/
+ java/
+ crud/ - implementation model interfaces
+ backend/ - fake component implementation
+ impl/ - implementations of the model interfaces
+ module/ - gets the implementation-crud module registered
+ with the SCA runtime
+ provider/ - runtime implementation
+ resources/
+ META-INF/
+ services/
+ org.apache.sca.tuscany.sca.core.ModuleActivator - specifies the
+ module activation class to call
+ test/
+ java/
+ crud/
+ CRUDTestCase.java - JUnit test case
+ resources/
+ crud.composite - the SCA assembly used during unit testing
+
+ build.xml - the Ant build file
+ pom.xml - the Maven build file
+
+Building The Sample Extension Using Ant
+-----------------------------------------
+With the binary distribution the sample extension can be built using Ant as
+follows
+
+cd implementation-crud-extension
+ant compile
+
+See the implementation-crud sample to run a sample that uses this
+implementation extension.
+
+Building The Sample Using Maven
+-------------------------------------------
+With either the binary or source distributions the sample can be built
+using Maven as follows.
+
+cd implementation-crud-extension
+mvn
+
+Maven will also test that the sample extension built properly. You should see
+the following output from the test phase.
+
+-------------------------------------------------------
+ T E S T S
+-------------------------------------------------------
+Running crud.CRUDTestCase
+Starting CRUDServiceComponent
+create(ABC) in tmp
+retrieve(0)
+update(0)
+retrieve(0)
+delete(0)
+retrieve(0)
+Stopping CRUDServiceComponent
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.212 sec
+
+Results :
+
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
+
+This shows that the Junit test cases have run successfully.
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/build.xml b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/build.xml
new file mode 100644
index 0000000000..88d308e6fc
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/build.xml
@@ -0,0 +1,51 @@
+<!--
+ * 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 name="implementation-crud-extension" default="compile">
+ <property name="test.jar" value="sample-implementation-crud-extension.jar" />
+
+ <target name="init">
+ <mkdir dir="target/classes"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac srcdir="src/main/java"
+ destdir="target/classes"
+ debug="on"
+ source="1.5"
+ target="1.5">
+ <classpath>
+ <pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+ </classpath>
+ </javac>
+ <copy todir="target/classes">
+ <fileset dir="src/main/resources"/>
+ </copy>
+ <jar destfile="target/${test.jar}" basedir="target/classes">
+ <manifest>
+ <attribute name="Main-Class" value="${test.class}" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="clean">
+ <delete quiet="true" includeemptydirs="true">
+ <fileset dir="target"/>
+ </delete>
+ </target>
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/pom.xml b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/pom.xml
new file mode 100644
index 0000000000..d14500a621
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/pom.xml
@@ -0,0 +1,77 @@
+<?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-sca</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-implementation-crud-extension</artifactId>
+ <name>Apache Tuscany CRUD Implementation Extension Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-assembly</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-interface-java-xml</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-core-spi</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.91-incubating-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUD.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUD.java
new file mode 100644
index 0000000000..b23d85887b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUD.java
@@ -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 crud;
+
+/**
+ * The service interface of the single CRUD service provided by CRUD components.
+ */
+public interface CRUD {
+
+ /**
+ * Create a new resource.
+ * @param resource
+ * @return
+ */
+ String create(Object resource);
+
+ /**
+ * Retrieve a resource.
+ * @param id
+ * @return
+ */
+ Object retrieve(String id);
+
+ /**
+ * Update a resource.
+ * @param id
+ * @param resource
+ * @return
+ */
+ Object update(String id, Object resource);
+
+ /**
+ * Delete a resource.
+ * @param id
+ */
+ void delete(String id);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java
new file mode 100644
index 0000000000..5cb2bd2b1c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementation.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package crud;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ */
+public interface CRUDImplementation extends Implementation {
+
+ /**
+ * Returns the directory used by CRUD implementations to persist resources.
+ *
+ * @return the directory used to persist resources
+ */
+ public String getDirectory();
+
+ /**
+ * Sets the directory used by CRUD implementations to persist resources.
+ *
+ * @param directory the directory used to persist resources
+ */
+ public void setDirectory(String directory);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java
new file mode 100644
index 0000000000..2a6f3bd955
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/CRUDImplementationFactory.java
@@ -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 crud;
+
+/**
+ * A factory for the sample CRUD implementation model.
+ */
+public interface CRUDImplementationFactory {
+
+ /**
+ * Creates a new CRUD implementation.
+ *
+ * @return
+ */
+ CRUDImplementation createCRUDImplementation();
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/DefaultCRUDImplementationFactory.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/DefaultCRUDImplementationFactory.java
new file mode 100644
index 0000000000..38aac604d9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/DefaultCRUDImplementationFactory.java
@@ -0,0 +1,49 @@
+/*
+ * 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 crud;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+
+import crud.impl.CRUDImplementationImpl;
+
+/**
+ * A default factory for the CRUD implementation model.
+ */
+public class DefaultCRUDImplementationFactory implements CRUDImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+ private JavaInterfaceIntrospector introspector;
+
+ public DefaultCRUDImplementationFactory(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector introspector) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ this.introspector = introspector;
+ }
+
+ public CRUDImplementation createCRUDImplementation() {
+ return new CRUDImplementationImpl(assemblyFactory, javaFactory, introspector);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java
new file mode 100644
index 0000000000..cc0795a735
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/backend/ResourceManager.java
@@ -0,0 +1,90 @@
+/*
+ * 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 crud.backend;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A fake resource manager implementation used as a backend by the sample
+ * CRUD component implementation.
+ */
+public class ResourceManager {
+ private static int counter;
+ private static final Map<String, Object> store = new HashMap<String, Object>();
+ private String directory;
+
+ /**
+ * Constructs a new resource manager.
+ *
+ * @param directory the directory where to persist resources
+ */
+ public ResourceManager(String directory) {
+ super();
+ this.directory = directory;
+ }
+
+ /**
+ * Creates a new resource.
+ *
+ * @param resource
+ * @return
+ */
+ public String createResource(Object resource) {
+ System.out.println("create(" + resource + ") in " + directory);
+ String key = String.valueOf(counter++);
+ store.put(key, resource);
+ return key;
+ }
+
+ /**
+ * Deletes a resource.
+ *
+ * @param id
+ */
+ public void deleteResource(String id) {
+ System.out.println("delete(" + id + ")");
+ store.remove(id);
+ }
+
+ /**
+ * Retrieves a resource.
+ *
+ * @param id
+ * @return
+ */
+ public Object retrieveResource(String id) {
+ System.out.println("retrieve(" + id + ")");
+ return store.get(id);
+ }
+
+ /**
+ * Updates a resource.
+ *
+ * @param id
+ * @param resource
+ * @return
+ */
+ public Object updateResource(String id, Object resource) {
+ System.out.println("update(" + id + ")");
+ return store.put(id, resource);
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java
new file mode 100644
index 0000000000..4dd3e336b7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java
@@ -0,0 +1,135 @@
+/*
+ * 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 crud.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicySet;
+
+import crud.CRUD;
+import crud.CRUDImplementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ */
+public class CRUDImplementationImpl implements CRUDImplementation {
+
+ private Service crudService;
+ private String directory;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory,
+ JavaInterfaceIntrospector introspector) {
+
+ // CRUD implementation always provide a single service exposing
+ // the CRUD interface, and have no references and properties
+ crudService = assemblyFactory.createService();
+ crudService.setName("CRUD");
+ JavaInterface javaInterface;
+ try {
+ javaInterface = introspector.introspect(CRUD.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ crudService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getDirectory() {
+ return directory;
+ }
+
+ public void setDirectory(String directory) {
+ this.directory = directory;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The sample CRUD implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The sample CRUD implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The sample CRUD implementation provides a single fixed CRUD service
+ return Collections.singletonList(crudService);
+ }
+
+ public List<Reference> getReferences() {
+ // The sample CRUD implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The sample CRUD implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The sample CRUD implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The sample CRUD implementation does not have a URI
+ }
+
+ public List<PolicySet> getPolicySets() {
+ // The sample CRUD implementation does not support policy sets
+ return Collections.emptyList();
+ }
+
+ public List<Intent> getRequiredIntents() {
+ // The sample CRUD implementation does not support intents
+ return Collections.emptyList();
+ }
+
+ public List<Object> getExtensions() {
+ // The sample CRUD implementation does not support extensions
+ return Collections.emptyList();
+ }
+
+ public boolean isUnresolved() {
+ // The sample CRUD implementation is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The sample CRUD implementation is always resolved
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationProcessor.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationProcessor.java
new file mode 100644
index 0000000000..cf57336cd1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationProcessor.java
@@ -0,0 +1,95 @@
+/*
+ * 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 crud.impl;
+
+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.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+
+import crud.CRUDImplementation;
+import crud.CRUDImplementationFactory;
+
+/**
+ * Implements a STAX artifact processor for CRUD implementations.
+ *
+ * The artifact processor is responsible for processing <implementation.crud>
+ * elements in SCA assembly XML composite files and populating the CRUD
+ * implementation model, resolving its references to other artifacts in the SCA
+ * contribution, and optionally write the model back to SCA assembly XML.
+ */
+public class CRUDImplementationProcessor implements StAXArtifactProcessor<CRUDImplementation> {
+ private static final QName IMPLEMENTATION_CRUD = new QName("http://crud", "implementation.crud");
+
+ private CRUDImplementationFactory crudFactory;
+
+ public CRUDImplementationProcessor(CRUDImplementationFactory crudFactory) {
+ this.crudFactory = crudFactory;
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_CRUD;
+ }
+
+ public Class<CRUDImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return CRUDImplementation.class;
+ }
+
+ public CRUDImplementation read(XMLStreamReader reader) throws ContributionReadException {
+ assert IMPLEMENTATION_CRUD.equals(reader.getName());
+
+ // Read an <implementation.crud> element
+ try {
+ // Read the directory attribute. This is where the sample
+ // CRUD implementation will persist resources.
+ String directory = reader.getAttributeValue(null, "directory");
+
+ // Create an initialize the CRUD implementation model
+ CRUDImplementation implementation = crudFactory.createCRUDImplementation();
+ implementation.setDirectory(directory);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_CRUD.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ } catch (XMLStreamException e) {
+ throw new ContributionReadException(e);
+ }
+ }
+
+ public void resolve(CRUDImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(CRUDImplementation model, XMLStreamWriter outputSource) throws ContributionWriteException {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/module/CRUDModuleActivator.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/module/CRUDModuleActivator.java
new file mode 100644
index 0000000000..bd6a037ba7
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/module/CRUDModuleActivator.java
@@ -0,0 +1,76 @@
+/*
+ * 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 crud.module;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+import crud.CRUDImplementationFactory;
+import crud.DefaultCRUDImplementationFactory;
+import crud.impl.CRUDImplementationProcessor;
+import crud.provider.CRUDImplementationProviderFactory;
+
+/**
+ * Implements a module activator for the CRUD implementation extension module.
+ * The module activator is responsible for contributing the CRUD implementation
+ * extensions and plugging them in the extension points defined by the Tuscany
+ * runtime.
+ */
+public class CRUDModuleActivator implements ModuleActivator {
+
+ public Object[] getExtensionPoints() {
+ // This module extension does not contribute any new extension point
+ return null;
+ }
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Create the CRUD implementation factory
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceIntrospectorExtensionPoint visitors = registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
+ JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ CRUDImplementationFactory crudFactory = new DefaultCRUDImplementationFactory(assemblyFactory, javaFactory, introspector);
+ factories.addFactory(crudFactory);
+
+ // Add the CRUD implementation extension to the StAXArtifactProcessor
+ // extension point
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ CRUDImplementationProcessor implementationArtifactProcessor = new CRUDImplementationProcessor(crudFactory);
+ processors.addArtifactProcessor(implementationArtifactProcessor);
+
+ // Add the CRUD provider factory to the ProviderFactory extension point
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new CRUDImplementationProviderFactory());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java
new file mode 100644
index 0000000000..0f040a478f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProvider.java
@@ -0,0 +1,70 @@
+/*
+ * 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 crud.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+import crud.CRUDImplementation;
+import crud.backend.ResourceManager;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ * The sample CRUD implementation is not a full blown implementation, it only
+ * supports a subset of what a component implementation can support: - a single
+ * fixed service (as opposed to a list of services typed by different
+ * interfaces) - a directory attribute used to specify where a CRUD component is
+ * going to persist resources - no references or properties - no policy intents
+ * or policy sets
+ */
+public class CRUDImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private CRUDImplementation implementation;
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ CRUDInvoker invoker = new CRUDInvoker(operation, new ResourceManager(implementation.getDirectory()));
+ return invoker;
+ }
+
+ public Invoker createCallbackInvoker(Operation operation) {
+ CRUDInvoker invoker = new CRUDInvoker(operation, new ResourceManager(implementation.getDirectory()));
+ return invoker;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName());
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java
new file mode 100644
index 0000000000..08e041d7e0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDImplementationProviderFactory.java
@@ -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 crud.provider;
+
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+import crud.CRUDImplementation;
+
+/**
+ * The model representing a sample CRUD implementation in an SCA assembly model.
+ */
+public class CRUDImplementationProviderFactory implements ImplementationProviderFactory<CRUDImplementation> {
+
+ /**
+ * Constructs a new CRUD implementation.
+ */
+ public CRUDImplementationProviderFactory() {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, CRUDImplementation implementation) {
+ return new CRUDImplementationProvider(component, implementation);
+ }
+
+ public Class<CRUDImplementation> getModelType() {
+ return CRUDImplementation.class;
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java
new file mode 100644
index 0000000000..f09922e965
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/java/crud/provider/CRUDInvoker.java
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package crud.provider;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+import crud.backend.ResourceManager;
+
+/**
+ * Implements a target invoker for CRUD component implementations.
+ *
+ * The target invoker is responsible for dispatching invocations to the particular
+ * component implementation logic. In this example we are simply delegating the
+ * CRUD operation invocations to the corresponding methods on our fake
+ * resource manager.
+ */
+public class CRUDInvoker implements Invoker {
+ private Operation operation;
+ private ResourceManager resourceManager;
+
+ public CRUDInvoker(Operation operation, ResourceManager resourceManager) {
+ this.operation = operation;
+ this.resourceManager = resourceManager;
+ }
+
+ public Message invoke(Message msg) {
+ try {
+ Object[] args = msg.getBody();
+ Object resp = doTheWork(args);
+ msg.setBody(resp);
+ } catch (InvocationTargetException e) {
+ msg.setFaultBody(e.getCause());
+ }
+ return msg;
+ }
+
+ public Object doTheWork(Object[] args) throws InvocationTargetException {
+ if (operation.getName().equals("create")) {
+ return resourceManager.createResource(args[0]);
+
+ } else if (operation.getName().equals("retrieve")) {
+ return resourceManager.retrieveResource((String)args[0]);
+
+ } else if (operation.getName().equals("update")) {
+ return resourceManager.updateResource((String)args[0], args[1]);
+
+ } else if (operation.getName().equals("delete")) {
+ resourceManager.deleteResource((String)args[0]);
+ return null;
+
+ } else {
+ return null;
+ }
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
new file mode 100644
index 0000000000..d9ab99f258
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
@@ -0,0 +1,18 @@
+# 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.
+# Implementation class for the ExtensionActivator
+crud.module.CRUDModuleActivator
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java
new file mode 100644
index 0000000000..8b092818a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/test/java/crud/CRUDTestCase.java
@@ -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 crud;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * Tests the CRUD service
+ */
+public class CRUDTestCase extends TestCase {
+
+ private SCADomain scaDomain;
+ private CRUD crudService;
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void setUp() throws Exception {
+ scaDomain = SCADomain.newInstance("crud.composite");
+ crudService = scaDomain.getService(CRUD.class, "CRUDServiceComponent");
+
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+
+ public void testCRUD() throws Exception {
+ String id = crudService.create("ABC");
+ Object result = crudService.retrieve(id);
+ assertEquals("ABC", result);
+ crudService.update(id, "EFG");
+ result = crudService.retrieve(id);
+ assertEquals("EFG", result);
+ crudService.delete(id);
+ result = crudService.retrieve(id);
+ assertNull(result);
+ }
+
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/test/resources/crud.composite b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/test/resources/crud.composite
new file mode 100644
index 0000000000..18745033bb
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.91/samples/implementation-crud-extension/src/test/resources/crud.composite
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://sample/crud"
+ xmlns:sc="http://sample/crud"
+ xmlns:c="http://crud"
+ name="crud">
+
+ <component name="CRUDServiceComponent">
+ <c:implementation.crud directory="tmp" />
+ </component>
+
+</composite>