From 9425990f532b1152c2d73db96c0f07ef5216a3d1 Mon Sep 17 00:00:00 2001 From: lresende Date: Thu, 12 Nov 2009 00:43:48 +0000 Subject: Moving 2.x contribs git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835178 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tuscany/sca/pojo/JavaConstructor.java | 42 +++++ .../org/apache/tuscany/sca/pojo/JavaElement.java | 92 ++++++++++ .../org/apache/tuscany/sca/pojo/JavaFactory.java | 82 +++++++++ .../org/apache/tuscany/sca/pojo/JavaParameter.java | 29 +++ .../org/apache/tuscany/sca/pojo/JavaResource.java | 65 +++++++ .../tuscany/sca/pojo/impl/JavaConstructorImpl.java | 54 ++++++ .../tuscany/sca/pojo/impl/JavaElementImpl.java | 194 +++++++++++++++++++++ .../tuscany/sca/pojo/impl/JavaFactoryImpl.java | 74 ++++++++ .../tuscany/sca/pojo/impl/JavaParameterImpl.java | 37 ++++ .../tuscany/sca/pojo/impl/JavaResourceImpl.java | 63 +++++++ 10 files changed, 732 insertions(+) create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaConstructor.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaElement.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaFactory.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaParameter.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaResource.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaConstructorImpl.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaFactoryImpl.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaParameterImpl.java create mode 100644 sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaResourceImpl.java (limited to 'sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca') diff --git a/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaConstructor.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaConstructor.java new file mode 100644 index 0000000000..5f81353606 --- /dev/null +++ b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaConstructor.java @@ -0,0 +1,42 @@ +/* + * 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; + + +/** + * Hold injection information for the constructor used to instantiate a + * component implementation instance + * + * @version $Rev$ $Date$ + */ +public interface JavaConstructor { + + /** + * @return the constructor + */ + Constructor getConstructor(); + + /** + * @return the parameters + */ + JavaParameter[] getParameters(); + +} \ No newline at end of file diff --git a/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaElement.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaElement.java new file mode 100644 index 0000000000..19d452d07f --- /dev/null +++ b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaElement.java @@ -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.sca.pojo; + +import java.lang.annotation.Annotation; +import java.lang.annotation.ElementType; +import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Type; + + +/** + * This class represents a java element such as a Package, Class, Constructor, + * Field, Method or Parameter. + * + * @version $Rev$ $Date$ + */ +public interface JavaElement { + + /** + * @return the anchor + */ + AnnotatedElement getAnchor(); + + /** + * @return the elementType + */ + ElementType getElementType(); + + /** + * @return the genericType + */ + Type getGenericType(); + + /** + * @return the index + */ + int getIndex(); + + /** + * @return the type + */ + Class getType(); + + /** + * @return the annotations + */ + Annotation[] getAnnotations(); + + /** + * Return a given annotation + * @param annotationType the annotation type + * @return the annotation + */ + T getAnnotation(Class annotationType); + + /** + * @return the name + */ + String getName(); + + /** + * @param name the name to set + */ + void setName(String name); + + /** + * @return the classifier + */ + Class getClassifer(); + + /** + * @param classifer the classifier to set + */ + void setClassifer(Class classifer); + +} \ No newline at end of file diff --git a/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaFactory.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaFactory.java new file mode 100644 index 0000000000..28375c86f8 --- /dev/null +++ b/sca-java-2.x/contrib/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/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaParameter.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaParameter.java new file mode 100644 index 0000000000..d5ded915db --- /dev/null +++ b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaParameter.java @@ -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.sca.pojo; + +/** + * This class represents a java element such as a Package, Class, Constructor, + * Field, Method or Parameter. + * + * @version $Rev$ $Date$ + */ +public interface JavaParameter extends JavaElement { + +} \ No newline at end of file diff --git a/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaResource.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaResource.java new file mode 100644 index 0000000000..38fbf75a71 --- /dev/null +++ b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/JavaResource.java @@ -0,0 +1,65 @@ +/* + * 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; + + +/** + * A resource dependency declared by a Java component implementation + * + * @version $Rev$ $Date$ + */ +public interface JavaResource { + + /** + * The name of the resource + * + * @return the name of the resource + */ + String getName(); + + /** + * Returns the URI of the resource + * + * @return the URI of the resource + */ + String getMappedName(); + + /** + * Sets the resource URI + */ + void setMappedName(String mappedName); + + /** + * If true, the resource is optional + * + * @return true if the resource is optional + */ + boolean isOptional(); + + /** + * Sets whether the resource is optional + */ + void setOptional(boolean optional); + + /** + * @return the element + */ + JavaElement getElement(); + +} \ No newline at end of file diff --git a/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaConstructorImpl.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaConstructorImpl.java new file mode 100644 index 0000000000..36a87420ab --- /dev/null +++ b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaConstructorImpl.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 org.apache.tuscany.sca.pojo.impl; + +import java.lang.reflect.Constructor; + +import org.apache.tuscany.sca.pojo.JavaConstructor; + + +/** + * Hold injection information for the constructor used to instantiate a + * component implementation instance + * + * @version $Rev$ $Date$ + */ +public class JavaConstructorImpl implements JavaConstructor { + private Constructor constructor; + private JavaParameterImpl[] parameters; + + public JavaConstructorImpl(Constructor constructor) { + this.constructor = constructor; + int size = constructor.getParameterTypes().length; + parameters = new JavaParameterImpl[size]; + for (int i = 0; i < size; i++) { + parameters[i] = new JavaParameterImpl(constructor, i); + } + } + + + public Constructor getConstructor() { + return constructor; + } + + + public JavaParameterImpl[] getParameters() { + return parameters; + } +} diff --git a/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java new file mode 100644 index 0000000000..fc3ca3238f --- /dev/null +++ b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaElementImpl.java @@ -0,0 +1,194 @@ +/* + * 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.annotation.Annotation; +import java.lang.annotation.ElementType; +import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Type; + +import org.apache.tuscany.sca.pojo.JavaElement; + +/** + * This class represents a java element such as a Package, Class, Constructor, + * Field, Method or Parameter. + * + * @version $Rev$ $Date$ + */ +public class JavaElementImpl implements JavaElement { + private AnnotatedElement anchor; + private ElementType elementType; + private Class type; + private Type genericType; + private int index = -1; + private String name; + private Class classifer; + + public JavaElementImpl(Class clazz) { + this.anchor = clazz; + this.elementType = ElementType.TYPE; + this.type = clazz; + this.genericType = clazz; + this.name = clazz.getName(); + } + + public JavaElementImpl(Field field) { + this.anchor = field; + this.elementType = ElementType.FIELD; + this.type = field.getType(); + this.genericType = field.getGenericType(); + this.name = field.getName(); + } + + public JavaElementImpl(Constructor constructor, int index) { + this.anchor = constructor; + this.elementType = ElementType.PARAMETER; + this.type = constructor.getParameterTypes()[index]; + this.genericType = constructor.getGenericParameterTypes()[index]; + this.index = index; + this.name = ""; + } + + public JavaElementImpl(Method method, int index) { + this.anchor = method; + this.elementType = ElementType.PARAMETER; + this.type = method.getParameterTypes()[index]; + this.genericType = method.getGenericParameterTypes()[index]; + this.index = index; + this.name = ""; + } + + /** + * For testing purpose + * + * @param name + * @param type + * @param classifer TODO + * @param elementType + */ + public JavaElementImpl(String name, Class type, Class classifer) { + super(); + this.type = type; + this.name = name; + this.classifer = classifer; + } + + public AnnotatedElement getAnchor() { + return anchor; + } + + public ElementType getElementType() { + return elementType; + } + + public Type getGenericType() { + return genericType; + } + + public int getIndex() { + return index; + } + + public Class getType() { + return type; + } + + public Annotation[] getAnnotations() { + if (elementType == ElementType.PARAMETER) { + if (anchor instanceof Method) { + // We only care about the method-level annotations + return ((Method)anchor).getAnnotations(); + } + if (anchor instanceof Constructor) { + return ((Constructor)anchor).getParameterAnnotations()[index]; + } + } + return anchor.getAnnotations(); + } + + public T getAnnotation(Class annotationType) { + for (Annotation a : getAnnotations()) { + if (a.annotationType() == annotationType) { + return annotationType.cast(a); + } + } + return null; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Class getClassifer() { + return classifer; + } + + public void setClassifer(Class classifer) { + this.classifer = classifer; + } + + + @Override + public String toString() { + return anchor.toString() + (elementType == ElementType.PARAMETER ? "[" + index + "]" : ""); + } + + @Override + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = PRIME * result + ((anchor == null) ? 0 : anchor.hashCode()); + result = PRIME * result + index; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final JavaElementImpl other = (JavaElementImpl)obj; + if (anchor == null) { + if (other.anchor != null) { + return false; + } + } else if (!anchor.equals(other.anchor)) { + return false; + } + if (index != other.index) { + return false; + } + return true; + } + +} diff --git a/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaFactoryImpl.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaFactoryImpl.java new file mode 100644 index 0000000000..d1b7d4c5ad --- /dev/null +++ b/sca-java-2.x/contrib/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/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaParameterImpl.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaParameterImpl.java new file mode 100644 index 0000000000..417644be14 --- /dev/null +++ b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaParameterImpl.java @@ -0,0 +1,37 @@ +/* + * 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 org.apache.tuscany.sca.pojo.JavaParameter; + +/** + * @version $Rev$ $Date$ + */ +public class JavaParameterImpl extends JavaElementImpl implements JavaParameter { + /** + * @param constructor + * @param index + */ + public JavaParameterImpl(Constructor constructor, int index) { + super(constructor, index); + } +} diff --git a/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaResourceImpl.java b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaResourceImpl.java new file mode 100644 index 0000000000..5a36a21db8 --- /dev/null +++ b/sca-java-2.x/contrib/modules/implementation-pojo/src/main/java/org/apache/tuscany/sca/pojo/impl/JavaResourceImpl.java @@ -0,0 +1,63 @@ +/* + * 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 org.apache.tuscany.sca.pojo.JavaElement; +import org.apache.tuscany.sca.pojo.JavaResource; + +/** + * A resource dependency declared by a Java component implementation + * + * @version $Rev$ $Date$ + */ +public class JavaResourceImpl implements JavaResource { + private JavaElement element; + private String mappedName; + private boolean optional; + + public JavaResourceImpl(JavaElement element) { + this.element = element; + } + + public String getName() { + return element.getName(); + } + + public String getMappedName() { + return mappedName; + } + + public void setMappedName(String mappedName) { + this.mappedName = mappedName; + } + + public boolean isOptional() { + return optional; + } + + public void setOptional(boolean optional) { + this.optional = optional; + } + + public JavaElement getElement() { + return element; + } + + +} -- cgit v1.2.3