summaryrefslogtreecommitdiffstats
path: root/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo')
-rw-r--r--tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java61
-rw-r--r--tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java61
-rw-r--r--tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java61
-rw-r--r--tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java62
-rw-r--r--tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java40
-rw-r--r--tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java80
-rw-r--r--tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java78
7 files changed, 0 insertions, 443 deletions
diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java
deleted file mode 100644
index 6b35115e1f..0000000000
--- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/DataFactoryObjectFactory.java
+++ /dev/null
@@ -1,61 +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;
-
-import commonj.sdo.helper.DataFactory;
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.builder.ObjectFactory;
-import org.apache.tuscany.core.context.AutowireContext;
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.injection.ObjectCreationException;
-import org.apache.tuscany.model.assembly.AssemblyContext;
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class DataFactoryObjectFactory implements ObjectFactory<DataFactory> {
-
- private ContextResolver resolver;
-
- /**
- * @throws org.apache.tuscany.core.injection.FactoryInitException
- *
- */
- public DataFactoryObjectFactory(ContextResolver resolver) {
- this.resolver = resolver;
- }
-
-
- public DataFactory getInstance() throws ObjectCreationException {
- CompositeContext parent = resolver.getCurrentContext();
- if (parent == null) {
- return null;// FIXME semantic here means required is not followed
- }
- if (!(parent instanceof AutowireContext)) {
- ObjectCreationException e = new ObjectCreationException("Parent does not implement "
- + AutowireContext.class.getName());
- e.setIdentifier(parent.getName());
- throw e;
- }
- AutowireContext ctx = (AutowireContext) parent;
- AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class);
- return SDOUtil.createDataFactory(assemblyContext.getTypeHelper());
- }
-
-
-}
diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java
deleted file mode 100644
index d345e7be95..0000000000
--- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/TypeHelperObjectFactory.java
+++ /dev/null
@@ -1,61 +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;
-
-import commonj.sdo.helper.TypeHelper;
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.builder.ObjectFactory;
-import org.apache.tuscany.core.context.AutowireContext;
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.injection.ObjectCreationException;
-import org.apache.tuscany.model.assembly.AssemblyContext;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class TypeHelperObjectFactory implements ObjectFactory<TypeHelper> {
-
-
- private ContextResolver resolver;
-
- /**
- * @throws org.apache.tuscany.core.injection.FactoryInitException
- *
- */
- public TypeHelperObjectFactory(ContextResolver resolver) {
- this.resolver = resolver;
- }
-
-
- public TypeHelper getInstance() throws ObjectCreationException {
- CompositeContext parent = resolver.getCurrentContext();
- if (parent == null) {
- return null;// FIXME semantic here means required is not followed
- }
- if (!(parent instanceof AutowireContext)) {
- ObjectCreationException e = new ObjectCreationException("Parent does not implement "
- + AutowireContext.class.getName());
- e.setIdentifier(parent.getName());
- throw e;
- }
- AutowireContext ctx = (AutowireContext) parent;
- AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class);
- return assemblyContext.getTypeHelper();
- }
-
-
-}
diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java
deleted file mode 100644
index 04773f9770..0000000000
--- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XMLHelperObjectFactory.java
+++ /dev/null
@@ -1,61 +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;
-
-import commonj.sdo.helper.XMLHelper;
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.builder.ObjectFactory;
-import org.apache.tuscany.core.context.AutowireContext;
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.injection.ObjectCreationException;
-import org.apache.tuscany.model.assembly.AssemblyContext;
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class XMLHelperObjectFactory implements ObjectFactory<XMLHelper> {
-
-
- private ContextResolver resolver;
-
- /**
- * @throws org.apache.tuscany.core.injection.FactoryInitException
- *
- */
- public XMLHelperObjectFactory(ContextResolver resolver) {
- this.resolver = resolver;
- }
-
-
- public XMLHelper getInstance() throws ObjectCreationException {
- CompositeContext parent = resolver.getCurrentContext();
- if (parent == null) {
- return null;// FIXME semantic here means required is not followed
- }
- if (!(parent instanceof AutowireContext)) {
- ObjectCreationException e = new ObjectCreationException("Parent does not implement "
- + AutowireContext.class.getName());
- e.setIdentifier(parent.getName());
- throw e;
- }
- AutowireContext ctx = (AutowireContext) parent;
- AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class);
- return SDOUtil.createXMLHelper(assemblyContext.getTypeHelper());
- }
-
-}
diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java b/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java
deleted file mode 100644
index eaddf15cb2..0000000000
--- a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/XSDHelperObjectFactory.java
+++ /dev/null
@@ -1,62 +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;
-
-import commonj.sdo.helper.XSDHelper;
-import org.apache.tuscany.core.builder.ContextResolver;
-import org.apache.tuscany.core.builder.ObjectFactory;
-import org.apache.tuscany.core.context.AutowireContext;
-import org.apache.tuscany.core.context.CompositeContext;
-import org.apache.tuscany.core.injection.ObjectCreationException;
-import org.apache.tuscany.model.assembly.AssemblyContext;
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-/**
- * @version $$Rev$$ $$Date$$
- */
-public class XSDHelperObjectFactory implements ObjectFactory<XSDHelper> {
-
-
- private ContextResolver resolver;
-
- /**
- * @throws org.apache.tuscany.core.injection.FactoryInitException
- *
- */
- public XSDHelperObjectFactory(ContextResolver resolver) {
- this.resolver = resolver;
- }
-
-
- public XSDHelper getInstance() throws ObjectCreationException {
- CompositeContext parent = resolver.getCurrentContext();
- if (parent == null) {
- return null;// FIXME semantic here means required is not followed
- }
- if (!(parent instanceof AutowireContext)) {
- ObjectCreationException e = new ObjectCreationException("Parent does not implement "
- + AutowireContext.class.getName());
- e.setIdentifier(parent.getName());
- throw e;
- }
- AutowireContext ctx = (AutowireContext) parent;
- AssemblyContext assemblyContext = ctx.resolveInstance(AssemblyContext.class);
- return SDOUtil.createXSDHelper(assemblyContext.getTypeHelper());
- }
-
-
-}
diff --git a/tags/java-M1-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelper.java b/tags/java-M1-final/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-final/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-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperExtensibilityElement.java b/tags/java-M1-final/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-final/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-final/java/sca/core/src/main/java/org/apache/tuscany/core/sdo/helper/SDOHelperProcessor.java b/tags/java-M1-final/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-final/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));
- }
- }
-
-
-}