summaryrefslogtreecommitdiffstats
path: root/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper')
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java40
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java80
-rw-r--r--tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java78
3 files changed, 0 insertions, 198 deletions
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java
deleted file mode 100644
index a804fc51b4..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * 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.
- */
-package org.apache.tuscany.core.sdo.helper;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a field or method that is used to inject an SDO helper.
- *
- * The following helpers are supported:
- * commonj.sdo.helper.TypeHelper
- * commonj.sdo.helper.DataFactory
- * commonj.sdo.helper.XSDHelper
- * commonj.sdo.helper.XMLHelper
- *
- */
-@Target({METHOD, FIELD})
-@Retention(RUNTIME)
-public @interface SDOHelper {
-
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java
deleted file mode 100644
index c6f84fa485..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * 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.
- */
-package org.apache.tuscany.core.sdo.helper;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XMLHelper;
-import commonj.sdo.helper.XSDHelper;
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.builder.ObjectFactory;
-import org.apache.tuscany.core.extension.config.InjectorExtensibilityElement;
-import org.apache.tuscany.core.injection.FieldInjector;
-import org.apache.tuscany.core.injection.Injector;
-import org.apache.tuscany.core.injection.MethodInjector;
-import org.apache.tuscany.core.injection.ObjectCreationException;
-import org.apache.tuscany.core.sdo.DataFactoryObjectFactory;
-import org.apache.tuscany.core.sdo.TypeHelperObjectFactory;
-import org.apache.tuscany.core.sdo.XMLHelperObjectFactory;
-import org.apache.tuscany.core.sdo.XSDHelperObjectFactory;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class SDOHelperExtensibilityElement implements InjectorExtensibilityElement {
-
- private Method method;
- private Field field;
- private Class<?> type;
-
- public SDOHelperExtensibilityElement(Method m) {
- method = m;
- assert(method != null);
- assert(method.getParameterTypes().length == 1);
- type = method.getParameterTypes()[0];
- }
-
- public SDOHelperExtensibilityElement(Field field) {
- assert (field != null);
- this.field = field;
- this.type = field.getType();
- }
-
- public Injector<?> getInjector(ContextResolver resolver) {
- ObjectFactory<?> factory;
- if (TypeHelper.class.equals(type)) {
- factory = new TypeHelperObjectFactory(resolver);
- } else if (DataFactory.class.equals(type)) {
- factory = new DataFactoryObjectFactory(resolver);
- } else if (XSDHelper.class.equals(type)) {
- factory = new XSDHelperObjectFactory(resolver);
- } else if (XMLHelper.class.equals(type)) {
- factory = new XMLHelperObjectFactory(resolver);
- } else {
- ObjectCreationException e = new ObjectCreationException("Unknown type");
- e.setIdentifier(type.getName());
- throw e;
- }
- if (method != null) {
- return new MethodInjector(method, factory);
- }
- return new FieldInjector(field, factory);
- }
-}
diff --git a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java b/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java
deleted file mode 100644
index dc8d97779f..0000000000
--- a/tags/java-M1-20060522/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * 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.
- */
-package org.apache.tuscany.core.sdo.helper;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.apache.tuscany.core.config.ConfigurationLoadException;
-import org.apache.tuscany.core.config.InvalidSetterException;
-import org.apache.tuscany.core.config.processor.ImplementationProcessorSupport;
-import org.apache.tuscany.model.assembly.ComponentType;
-import org.osoa.sca.annotations.Scope;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-@Scope("Module")
-public class SDOHelperProcessor extends ImplementationProcessorSupport {
-
- @Override
- public void visitMethod(Method method, ComponentType type) throws ConfigurationLoadException {
- if (method.getDeclaringClass().equals(Object.class)) {
- return;
- }
- SDOHelper annotation = method.getAnnotation(SDOHelper.class);
- if (annotation != null) {
- if (!Modifier.isPublic(method.getModifiers())) {
- InvalidSetterException e = new InvalidSetterException("SDO setter method is not public");
- e.setIdentifier(method.toString());
- throw e;
- }
- Class<?>[] params = method.getParameterTypes();
- if (params.length != 1) {
- InvalidSetterException e = new InvalidSetterException("SDO setter method must have one parameter");
- e.setIdentifier(method.toString());
- throw e;
- }
- type.getExtensibilityElements().add(new SDOHelperExtensibilityElement(method));
-
- }
-
-
- }
-
- @Override
- public void visitField(Field field, ComponentType type) throws ConfigurationLoadException {
- if (field.getDeclaringClass().equals(Object.class)) {
- return;
- }
- int modifiers = field.getModifiers();
- SDOHelper annotation = field.getAnnotation(SDOHelper.class);
- if (annotation != null) {
- if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
- InvalidSetterException e = new InvalidSetterException("Property field is not public or protected");
- e.setIdentifier(field.getName());
- throw e;
- }
- type.getExtensibilityElements().add(new SDOHelperExtensibilityElement(field));
- }
- }
-
-
-}