summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/contrib/modules/implementation-ejb/src/main
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-04-24 00:14:41 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-04-24 00:14:41 +0000
commit341c40b73fb2ff82c89e1afefe7348467b168a18 (patch)
tree08f01d1d414cc2cdc3b787f896a6ed9da57b2293 /sca-java-2.x/contrib/modules/implementation-ejb/src/main
parent0ee5516f07f4efafb221f1c909a9cd4122f22c0e (diff)
Port to tuscany 2.x
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@937561 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/contrib/modules/implementation-ejb/src/main')
-rw-r--r--sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java5
-rw-r--r--sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java46
-rw-r--r--sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java28
-rw-r--r--sca-java-2.x/contrib/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor2
4 files changed, 22 insertions, 59 deletions
diff --git a/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java b/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
index 0d3b05f0c9..b04a696c61 100644
--- a/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
+++ b/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
@@ -18,6 +18,9 @@
*/
package org.apache.tuscany.sca.implementation.ejb;
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Base;
import org.apache.tuscany.sca.assembly.Implementation;
@@ -28,7 +31,7 @@ import org.apache.tuscany.sca.assembly.Implementation;
* @version $Rev$ $Date$
*/
public interface EJBImplementation extends Implementation {
-
+ QName TYPE = new QName(Base.SCA11_NS, "implementation.ejb");
/**
* Returns the EJB link URI.
* @return the EJB link URI
diff --git a/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java b/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
index bf2e6354d5..1eb1d575ea 100644
--- a/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
+++ b/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
@@ -18,13 +18,7 @@
*/
package org.apache.tuscany.sca.implementation.ejb.impl;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
@@ -33,11 +27,7 @@ import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
*
* @version $Rev$ $Date$
*/
-class EJBImplementationImpl implements EJBImplementation {
-
- private List<Property> properties = new ArrayList<Property>();
- private List<Service> services = new ArrayList<Service>();
- private List<Reference> references = new ArrayList<Reference>();
+public class EJBImplementationImpl extends ImplementationImpl implements EJBImplementation {
private String ejbLink;
private String uri;
private boolean unresolved;
@@ -45,34 +35,14 @@ class EJBImplementationImpl implements EJBImplementation {
/**
* Constructs a new EJB implementation.
*/
- EJBImplementationImpl() {
- }
-
- public ConstrainingType getConstrainingType() {
- // The EJB implementation does not support constrainingTypes
- return null;
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public List<Service> getServices() {
- return services;
- }
-
- public List<Reference> getReferences() {
- return references;
+ public EJBImplementationImpl() {
+ super(TYPE);
}
public String getEJBLink() {
return ejbLink;
}
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The EJB implementation does not support constrainingTypes
- }
-
public void setEJBLink(String ejbLink) {
this.ejbLink = ejbLink;
}
@@ -84,12 +54,4 @@ class EJBImplementationImpl implements EJBImplementation {
public void setURI(String uri) {
this.uri = uri;
}
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
}
diff --git a/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java b/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
index 573bd7ef17..e963be1e69 100644
--- a/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
+++ b/sca-java-2.x/contrib/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
@@ -31,12 +31,13 @@ import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.monitor.Problem;
import org.apache.tuscany.sca.monitor.Problem.Severity;
@@ -47,17 +48,14 @@ import org.apache.tuscany.sca.monitor.Problem.Severity;
* @version $Rev$ $Date$
*/
public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<EJBImplementation> {
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- private static final QName IMPLEMENTATION_EJB = new QName(SCA10_NS, "implementation.ejb");
-
+ private static final QName IMPLEMENTATION_EJB = EJBImplementation.TYPE;
private AssemblyFactory assemblyFactory;
private EJBImplementationFactory implementationFactory;
- private Monitor monitor;
- public EJBImplementationProcessor(FactoryExtensionPoint modelFactories, Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.implementationFactory = modelFactories.getFactory(EJBImplementationFactory.class);
- this.monitor = monitor;
+ public EJBImplementationProcessor(ExtensionPointRegistry registry) {
+ FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+ this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ this.implementationFactory = factories.getFactory(EJBImplementationFactory.class);
}
/**
@@ -67,7 +65,7 @@ public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implem
* @param message
* @param model
*/
- private void error(String message, Object model, Object... messageParameters) {
+ private void error(org.apache.tuscany.sca.monitor.Monitor monitor, String message, Object model, Object... messageParameters) {
if (monitor != null) {
Problem problem = monitor.createProblem(this.getClass().getName(), "impl-ejb-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
monitor.problem(problem);
@@ -84,7 +82,7 @@ public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implem
return EJBImplementation.class;
}
- public EJBImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+ public EJBImplementation read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
// Read an <implementation.ejb> element
EJBImplementation implementation = implementationFactory.createEJBImplementation();
@@ -104,7 +102,7 @@ public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implem
implementation.setURI(ejbLink);
}
} else {
- error("EJBLinkAttributeMissing", reader);
+ error(context.getMonitor(), "EJBLinkAttributeMissing", reader);
}
// Skip to end element
@@ -117,14 +115,14 @@ public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implem
return implementation;
}
- public void resolve(EJBImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
+ public void resolve(EJBImplementation implementation, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
// Resolve the component type
String uri = implementation.getURI();
if (uri != null) {
ComponentType componentType = assemblyFactory.createComponentType();
componentType.setURI(uri + ".componentType");
- componentType = resolver.resolveModel(ComponentType.class, componentType);
+ componentType = resolver.resolveModel(ComponentType.class, componentType, context);
if (!componentType.isUnresolved()) {
// Initialize the implementation's services, references and properties
@@ -136,7 +134,7 @@ public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implem
implementation.setUnresolved(false);
}
- public void write(EJBImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+ public void write(EJBImplementation implementation, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException {
// Write <implementation.ejb>
writeStart(writer, IMPLEMENTATION_EJB.getNamespaceURI(), IMPLEMENTATION_EJB.getLocalPart(),
diff --git a/sca-java-2.x/contrib/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/sca-java-2.x/contrib/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
index ae6db609a2..a3d1f64b56 100644
--- a/sca-java-2.x/contrib/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ b/sca-java-2.x/contrib/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
@@ -16,4 +16,4 @@
# under the License.
# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.ejb.xml.EJBImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.ejb,model=org.apache.tuscany.sca.implementation.ejb.EJBImplementation,factory=org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
+org.apache.tuscany.sca.implementation.ejb.xml.EJBImplementationProcessor;qname=http://docs.oasis-open.org/ns/opencsa/sca/200912#implementation.ejb,model=org.apache.tuscany.sca.implementation.ejb.EJBImplementation,factory=org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory