From 62197b3256833d9aaeabebda5426f927881cae4a Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 27 May 2009 13:21:13 +0000 Subject: TUSCANY-3052 - Update JEE processing to resolve the JEEImplementation composite. Set the "ejb" intent on both local and remote services. Add a definitions.xml to define the "ejb" intent. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@779160 13f79535-47bb-0310-9956-ffa450edef68 --- .../impl/EJBImplementationGeneratedProcessor.java | 67 ++++++++++++++++++++++ .../contribution/jee/impl/JavaEEExtensionImpl.java | 6 ++ .../jee/impl/JavaEEOptionalExtensionImpl.java | 2 + ...ca.contribution.processor.StAXArtifactProcessor | 21 +++++++ 4 files changed, 96 insertions(+) create mode 100644 branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedProcessor.java create mode 100644 branches/sca-java-1.x/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (limited to 'branches/sca-java-1.x/modules/contribution-jee/src') diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedProcessor.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedProcessor.java new file mode 100644 index 0000000000..bc8bc99770 --- /dev/null +++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedProcessor.java @@ -0,0 +1,67 @@ +/* + * 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.contribution.jee.impl; + +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.BaseStAXArtifactProcessor; +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 org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.monitor.Monitor; + + +/** + * Dummy processor that's used to mark EJBImplementationGeneratedImpl instance + * as resolved at the appropriate point in the resolution processing + * + * @version $Rev$ $Date$ + */ +public class EJBImplementationGeneratedProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor { + + public EJBImplementationGeneratedProcessor(ExtensionPointRegistry registry, + Monitor monitor) { + } + + public QName getArtifactType() { + return null; + } + + public Class getModelType() { + // Returns the type of model processed by this processor + return EJBImplementationGeneratedImpl.class; + } + + public EJBImplementationGeneratedImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException { + return null; + } + + public void resolve(EJBImplementationGeneratedImpl implementation, ModelResolver resolver) throws ContributionResolveException { + implementation.setUnresolved(false); + } + + public void write(EJBImplementationGeneratedImpl implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { + } +} diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java index c4e180bf82..6934069516 100644 --- a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java +++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java @@ -78,6 +78,8 @@ public class JavaEEExtensionImpl implements JavaEEExtension { e.printStackTrace(); } service.setInterfaceContract(ic); + service.getRequiredIntents().add(EJB_INTENT); + componentType.getServices().add(service); } @@ -124,6 +126,7 @@ public class JavaEEExtensionImpl implements JavaEEExtension { e.printStackTrace(); } service.setInterfaceContract(ic); + service.getRequiredIntents().add(EJB_INTENT); addComponentService(composite, component, service); } @@ -175,6 +178,7 @@ public class JavaEEExtensionImpl implements JavaEEExtension { e.printStackTrace(); } service.setInterfaceContract(ic); + service.getRequiredIntents().add(EJB_INTENT); addComponentService(composite, component, service); } @@ -224,9 +228,11 @@ public class JavaEEExtensionImpl implements JavaEEExtension { if (component == null){ component = assemblyFactory.createComponent(); component.setName(componentName); + component.setUnresolved(true); composite.getComponents().add(component); EJBImplementationGenerated implementation = new EJBImplementationGeneratedImpl(); + implementation.setUnresolved(true); component.setImplementation(implementation); } diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java index ad7e54b84f..d1b22c5631 100644 --- a/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java +++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java @@ -289,9 +289,11 @@ public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension { if (component == null){ component = assemblyFactory.createComponent(); component.setName(componentName); + component.setUnresolved(true); composite.getComponents().add(component); EJBImplementationGenerated implementation = new EJBImplementationGeneratedImpl(); + implementation.setUnresolved(true); component.setImplementation(implementation); } diff --git a/branches/sca-java-1.x/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.x/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor new file mode 100644 index 0000000000..b7e0efa75c --- /dev/null +++ b/branches/sca-java-1.x/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor @@ -0,0 +1,21 @@ +# 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. + +# $Rev: 685124 $ $Date: 2008-08-12 12:46:19 +0100 (Tue, 12 Aug 2008) $ + +# Implementation class for the artifact processor extension +org.apache.tuscany.sca.contribution.jee.impl.EJBImplementationGeneratedProcessor;qname=http://dummy_namespace/#dummy.name,model=org.apache.tuscany.sca.contribution.jee.impl.EJBImplementationGeneratedImpl,factory=dummy -- cgit v1.2.3