summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/implementation-python/src/main
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-08-29 02:46:21 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2010-08-29 02:46:21 +0000
commit490374326cf57b0161d053aea3a9f0cedd7d2228 (patch)
tree1a0dc011461aef099bf3fe33165b45a9ba492680 /sca-java-2.x/trunk/modules/implementation-python/src/main
parent460613d0d5e60b9ed43094220b89dd31388463c2 (diff)
Minor change. Code format and cleanup.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@990478 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/implementation-python/src/main')
-rw-r--r--sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonEval.java3
-rw-r--r--sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementation.java73
-rw-r--r--sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementationProcessor.java40
-rw-r--r--sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonProperty.java3
4 files changed, 58 insertions, 61 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonEval.java b/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonEval.java
index 2ce220f84e..ae9caab7d0 100644
--- a/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonEval.java
+++ b/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonEval.java
@@ -20,7 +20,6 @@ package org.apache.tuscany.sca.implementation.python;
import org.oasisopen.sca.annotation.Remotable;
-
/**
* Python component generic evaluation interface.
*
@@ -29,5 +28,5 @@ import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface PythonEval {
- public String eval(String args) throws Exception;
+ public String eval(String args) throws Exception;
}
diff --git a/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementation.java b/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementation.java
index 7b0867e4cd..058c01a48e 100644
--- a/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementation.java
+++ b/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementation.java
@@ -49,11 +49,12 @@ public class PythonImplementation extends ImplementationImpl {
contract = c;
class DynService extends ServiceImpl {
- public DynService() {
- setName("default");
- setInterfaceContract(contract);
- }
- };
+ public DynService() {
+ setName("default");
+ setInterfaceContract(contract);
+ }
+ }
+ ;
service = new DynService();
getServices().add(service);
}
@@ -61,43 +62,43 @@ public class PythonImplementation extends ImplementationImpl {
public String getScript() {
return script;
}
-
+
public String getLocation() {
- return location;
- }
+ return location;
+ }
public Service getService(final String n) {
- return service;
- }
+ return service;
+ }
public Reference getReference(final String n) {
- final Reference r = super.getReference(n);
- if (r != null)
- return r;
- class DynReference extends ReferenceImpl {
- public DynReference() {
- setName(n);
- setInterfaceContract(contract);
- }
- }
- final Reference nr = new DynReference();
- getReferences().add(nr);
- return nr;
+ final Reference r = super.getReference(n);
+ if(r != null)
+ return r;
+ class DynReference extends ReferenceImpl {
+ public DynReference() {
+ setName(n);
+ setInterfaceContract(contract);
+ }
+ }
+ final Reference nr = new DynReference();
+ getReferences().add(nr);
+ return nr;
}
-
+
public Property getProperty(final String n) {
- final Property p = super.getProperty(n);
- if (p != null)
- return p;
- class DynProperty extends PropertyImpl {
- public DynProperty() {
- setName(n);
- setDataType(new DataTypeImpl<XMLType>(null, String.class, String.class, XMLType.UNKNOWN));
- setXSDType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
- }
- }
- final Property np = new DynProperty();
- getProperties().add(np);
- return np;
+ final Property p = super.getProperty(n);
+ if(p != null)
+ return p;
+ class DynProperty extends PropertyImpl {
+ public DynProperty() {
+ setName(n);
+ setDataType(new DataTypeImpl<XMLType>(null, String.class, String.class, XMLType.UNKNOWN));
+ setXSDType(new QName("http://www.w3.org/2001/XMLSchema", "string"));
+ }
+ }
+ final Property np = new DynProperty();
+ getProperties().add(np);
+ return np;
}
}
diff --git a/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementationProcessor.java b/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementationProcessor.java
index 3edfb951ae..b4daab34cd 100644
--- a/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementationProcessor.java
+++ b/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonImplementationProcessor.java
@@ -55,29 +55,29 @@ public class PythonImplementationProcessor extends BaseStAXArtifactProcessor imp
final InterfaceContract contract;
- public PythonImplementationProcessor(final ExtensionPointRegistry ep) throws InvalidInterfaceException, NoSuchMethodException {
+ public PythonImplementationProcessor(final ExtensionPointRegistry ep) throws InvalidInterfaceException {
final FactoryExtensionPoint fep = ep.getExtensionPoint(FactoryExtensionPoint.class);
final JavaInterfaceFactory jf = fep.getFactory(JavaInterfaceFactory.class);
final JavaInterface eval = jf.createJavaInterface(PythonEval.class);
-
+
class DynamicInterface extends JavaInterfaceImpl {
- DynamicInterface() throws NoSuchMethodException {
- setJavaClass(eval.getJavaClass());
- setName(eval.getName());
- setRemotable(eval.isRemotable());
- Operation op = eval.getOperations().get(0);
- op.setDynamic(true);
- getOperations().add(op);
+ DynamicInterface() {
+ setJavaClass(eval.getJavaClass());
+ setName(eval.getName());
+ setRemotable(eval.isRemotable());
+ Operation op = eval.getOperations().get(0);
+ op.setDynamic(true);
+ getOperations().add(op);
resetDataBinding(JSONDataBinding.NAME);
setUnresolved(false);
- }
-
- @Override
- public boolean isDynamic() {
- return true;
- }
+ }
+
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
}
-
+
contract = jf.createJavaInterfaceContract();
contract.setInterface(new DynamicInterface());
}
@@ -92,7 +92,8 @@ public class PythonImplementationProcessor extends BaseStAXArtifactProcessor imp
public PythonImplementation read(final XMLStreamReader r, final ProcessorContext ctx) throws ContributionReadException, XMLStreamException {
final String scr = r.getAttributeValue(null, "script");
- while (r.hasNext() && !(r.next() == END_ELEMENT && QN.equals(r.getName())));
+ while(r.hasNext() && !(r.next() == END_ELEMENT && QN.equals(r.getName())))
+ ;
return new PythonImplementation(QN, scr, URI.create(ctx.getContribution().getLocation()).getPath(), contract);
}
@@ -100,10 +101,7 @@ public class PythonImplementationProcessor extends BaseStAXArtifactProcessor imp
}
public void write(final PythonImplementation impl, final XMLStreamWriter w, final ProcessorContext ctx) throws ContributionWriteException, XMLStreamException {
- writeStart(w,
- QN.getNamespaceURI(),
- QN.getLocalPart(),
- new XAttr("script", impl.getScript()));
+ writeStart(w, QN.getNamespaceURI(), QN.getLocalPart(), new XAttr("script", impl.getScript()));
writeEnd(w);
}
}
diff --git a/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonProperty.java b/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonProperty.java
index 4b5a1c7382..6efee36ab3 100644
--- a/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonProperty.java
+++ b/sca-java-2.x/trunk/modules/implementation-python/src/main/java/org/apache/tuscany/sca/implementation/python/PythonProperty.java
@@ -20,7 +20,6 @@ package org.apache.tuscany.sca.implementation.python;
import org.oasisopen.sca.annotation.Remotable;
-
/**
* Python component property evaluation interface.
*
@@ -29,5 +28,5 @@ import org.oasisopen.sca.annotation.Remotable;
@Remotable
public interface PythonProperty {
- public String eval();
+ public String eval();
}