summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2008-12-09 00:25:09 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2008-12-09 00:25:09 +0000
commit16d0630f33776aeade8a29c383caca55b9d65ac5 (patch)
treeb2de664498218f687bec9fe0f0a13797eee9a8b6 /java
parentcff89c386c53a316bbdf66ae7672209472b23f06 (diff)
Adding factory for common java artifacts model objects
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@724566 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--java/sca/modules/implementation-pojo/META-INF/MANIFEST.MF11
-rw-r--r--java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaFactory.java82
-rw-r--r--java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java10
-rw-r--r--java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaFactoryImpl.java74
-rw-r--r--java/sca/modules/implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.pojo.JavaFactory20
5 files changed, 182 insertions, 15 deletions
diff --git a/java/sca/modules/implementation-pojo/META-INF/MANIFEST.MF b/java/sca/modules/implementation-pojo/META-INF/MANIFEST.MF
index d86b52e726..6852a8f363 100644
--- a/java/sca/modules/implementation-pojo/META-INF/MANIFEST.MF
+++ b/java/sca/modules/implementation-pojo/META-INF/MANIFEST.MF
@@ -1,11 +1,5 @@
Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.implementation.java.introspect;
- uses:="org.apache.tuscany.sca.assembly,org.apache.tuscany.sca.impleme
- ntation.java,org.osoa.sca";version="1.4",org.apache.tuscany.sca.imple
- mentation.java;uses:="org.apache.tuscany.sca.assembly,org.apache.tusc
- any.sca.implementation.java.introspect,org.apache.tuscany.sca.core,or
- g.apache.tuscany.sca.policy,org.apache.tuscany.sca.interfacedef.java"
- ;version="1.4"
+Export-Package: org.apache.tuscany.sca.pojo
Private-Package: org.apache.tuscany.sca.implementation.java.impl;versi
on="1.4",org.apache.tuscany.sca.implementation.java.introspect.impl;v
ersion="1.4"
@@ -20,12 +14,9 @@ Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-Description: Apache Tuscany SCA Java Implementation Model
Import-Package: javax.jws,
javax.xml.namespace,
-
org.apache.tuscany.sca.assembly;version="1.4",
org.apache.tuscany.sca.assembly.impl;version="1.4",
org.apache.tuscany.sca.core;version="1.4",
- org.apache.tuscany.sca.implementation.java;version="1.4",
- org.apache.tuscany.sca.implementation.java.introspect;version="1.4",
org.apache.tuscany.sca.interfacedef;version="1.4",
org.apache.tuscany.sca.interfacedef.java;version="1.4",
org.apache.tuscany.sca.interfacedef.java.impl;version="1.4";resolution:=optional,
diff --git a/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaFactory.java b/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaFactory.java
new file mode 100644
index 0000000000..28375c86f8
--- /dev/null
+++ b/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaFactory.java
@@ -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.sca.pojo;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+/**
+ * Factory for the Java model used during introspection of java class/interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+
+public interface JavaFactory {
+
+ /**
+ * Create a model representing a java constructor
+ * @param clazz
+ * @return the java constructor
+ */
+ JavaConstructor<?> createJavaConstructor(Constructor<?> constructor);
+
+ /**
+ * Create model representing a java class
+ * @param clazz the class
+ * @return the java element representing the class
+ */
+ JavaElement createJavaElement(Class<?> clazz);
+
+ /**
+ * Create a model representing a java property
+ * @param field the property
+ * @return the java element representing the property
+ */
+ JavaElement createJavaElement(Field field);
+
+ /**
+ * Create a model representing a java constructor
+ * @param constructor the constructor
+ * @param index the constructor position
+ * @return the java element representing the constructor
+ */
+ JavaElement createJavaElement(Constructor<?> constructor, int index);
+
+ /**
+ * Create a model representing a java method
+ * @param method the method
+ * @param index the method position
+ * @return the java element representing the constructor
+ */
+ JavaElement createJavaElement(Method method, int index);
+
+ /**
+ * Create a model representing a java parameter
+ * @return the parameter
+ */
+ JavaParameter createJavaParameter(Constructor<?> constructor, int index);
+
+ /**
+ * Create a model representing a java resource
+ * @return
+ */
+ JavaResource createJavaResource(JavaElement element);
+
+} \ No newline at end of file
diff --git a/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java b/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java
index 4ae725596f..fc3ca3238f 100644
--- a/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java
+++ b/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java
@@ -44,12 +44,12 @@ public class JavaElementImpl implements JavaElement {
private String name;
private Class<? extends Annotation> classifer;
- public JavaElementImpl(Class<?> cls) {
- this.anchor = cls;
+ public JavaElementImpl(Class<?> clazz) {
+ this.anchor = clazz;
this.elementType = ElementType.TYPE;
- this.type = cls;
- this.genericType = cls;
- this.name = cls.getName();
+ this.type = clazz;
+ this.genericType = clazz;
+ this.name = clazz.getName();
}
public JavaElementImpl(Field field) {
diff --git a/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaFactoryImpl.java b/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaFactoryImpl.java
new file mode 100644
index 0000000000..d1b7d4c5ad
--- /dev/null
+++ b/java/sca/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaFactoryImpl.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.pojo.impl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.sca.pojo.JavaConstructor;
+import org.apache.tuscany.sca.pojo.JavaElement;
+import org.apache.tuscany.sca.pojo.JavaFactory;
+import org.apache.tuscany.sca.pojo.JavaParameter;
+import org.apache.tuscany.sca.pojo.JavaResource;
+
+/**
+ * Factory for the Java model used during introspection of java class/interfaces
+ *
+ * @version $Rev$ $Date$
+ */
+
+public class JavaFactoryImpl implements JavaFactory {
+
+ public void JavaFactory() {
+
+ }
+
+ public JavaConstructor<?> createJavaConstructor(Constructor<?> constructor){
+ return new JavaConstructorImpl(constructor);
+ }
+
+ public JavaElement createJavaElement(Class<?> clazz) {
+ return new JavaElementImpl(clazz);
+ }
+
+ public JavaElement createJavaElement(Field field){
+ return new JavaElementImpl(field);
+
+ }
+
+ public JavaElement createJavaElement(Constructor<?> constructor, int index) {
+ return new JavaElementImpl(constructor, index);
+
+ }
+
+ public JavaElement createJavaElement(Method method, int index) {
+ return new JavaElementImpl(method, index);
+ }
+
+ public JavaParameter createJavaParameter(Constructor<?> constructor, int index) {
+ return new JavaParameterImpl(constructor, index);
+ }
+
+ public JavaResource createJavaResource(JavaElement element) {
+ return new JavaResourceImpl(element);
+ }
+
+}
+
diff --git a/java/sca/modules/implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.pojo.JavaFactory b/java/sca/modules/implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.pojo.JavaFactory
new file mode 100644
index 0000000000..5ed06a8dcd
--- /dev/null
+++ b/java/sca/modules/implementation-pojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.pojo.JavaFactory
@@ -0,0 +1,20 @@
+# 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 java model factory
+org.apache.tuscany.sca.pojo.impl.JavaFactoryImpl \ No newline at end of file