You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2010/07/28 23:01:01 UTC
svn commit: r980211 [3/3] - in /tuscany/sca-java-2.x/trunk/modules:
implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/
implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/sp...
Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java?rev=980211&r1=980210&r2=980211&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java Wed Jul 28 21:01:00 2010
@@ -42,13 +42,15 @@ public class SpringImplementationTie {
private SpringImplementation implementation;
private RuntimeComponent component;
private JavaPropertyValueObjectFactory propertyFactory;
-
- public SpringImplementationTie(SpringImplementation implementation, RuntimeComponent component, JavaPropertyValueObjectFactory propertyFactory) {
+
+ public SpringImplementationTie(SpringImplementation implementation,
+ RuntimeComponent component,
+ JavaPropertyValueObjectFactory propertyFactory) {
this.implementation = implementation;
this.component = component;
this.propertyFactory = propertyFactory;
}
-
+
public String getURI() {
return implementation.getURI();
}
@@ -56,6 +58,7 @@ public class SpringImplementationTie {
public String getComponentName() {
return component.getName();
}
+
/**
* Method to create a Java Bean for a Property value
* @param <B> the class type of the Bean
@@ -127,11 +130,11 @@ public class SpringImplementationTie {
return getPropertyBean(requiredType, property.getName());
} // end if
} // end for
- // TODO: NoSuchBeanException
+ // TODO: NoSuchBeanException
throw new RuntimeException("Unable to find Bean with name " + name);
} // end method getBean( String, Class )
-
+
public Object getComponentTie() {
return new ComponentTie(component);
}
@@ -139,9 +142,9 @@ public class SpringImplementationTie {
public Object getPropertyValueTie() {
return new PropertyValueTie(component, propertyFactory);
}
-
+
public ClassLoader getClassLoader() {
- return implementation.getClassLoader();
+ return implementation.getClassLoader();
}
-}
\ No newline at end of file
+}
Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.java?rev=980211&r1=980210&r2=980211&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.java Wed Jul 28 21:01:00 2010
@@ -28,13 +28,13 @@ public class SpringInvocationException e
public SpringInvocationException(String msg) {
super(msg);
}
-
+
public SpringInvocationException(Throwable e) {
super(e);
}
-
- public SpringInvocationException(String msg,Throwable e) {
- super(msg,e);
+
+ public SpringInvocationException(String msg, Throwable e) {
+ super(msg, e);
}
}
Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java?rev=980211&r1=980210&r2=980211&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java Wed Jul 28 21:01:00 2010
@@ -70,14 +70,14 @@ public class SpringInvoker implements In
} // end constructor SpringInvoker
// Lazy-load the method to avoid timing problems with the Spring Context
- private void setupMethod() throws SpringInvocationException{
+ private void setupMethod() throws SpringInvocationException {
try {
bean = springContext.getBean(beanElement.getId());
Class<?> beanClass = bean.getClass();
theMethod = JavaInterfaceUtil.findMethod(beanClass, operation);
//System.out.println("SpringInvoker - found method " + theMethod.getName() );
} catch (NoSuchMethodException e) {
- throw new SpringInvocationException(e);
+ throw new SpringInvocationException(e);
}
}
@@ -98,9 +98,10 @@ public class SpringInvoker implements In
}
return ret;
} catch (InvocationTargetException e) {
- throw new SpringInvocationException("Spring invoker invoke method '"+ theMethod.getName()+"' error.",e.getCause());
+ throw new SpringInvocationException("Spring invoker invoke method '" + theMethod.getName() + "' error.",
+ e.getCause());
} catch (Exception e) {
- throw new SpringInvocationException("Spring invoker invoke method '"+ theMethod.getName()+"' error.",e);
+ throw new SpringInvocationException("Spring invoker invoke method '" + theMethod.getName() + "' error.", e);
}
} // end method doInvoke
@@ -114,7 +115,7 @@ public class SpringInvoker implements In
msg.setBody(resp);
} catch (SpringInvocationException e) {
msg.setFaultBody(e.getCause());
- }catch (Throwable e) {
+ } catch (Throwable e) {
msg.setFaultBody(e);
}
//System.out.println("Spring Invoker - invoke called");
Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java?rev=980211&r1=980210&r2=980211&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java Wed Jul 28 21:01:00 2010
@@ -51,7 +51,8 @@ import org.apache.tuscany.sca.monitor.Pr
*
* @version $Rev$ $Date$
*/
-public class SpringImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SpringImplementation> {
+public class SpringImplementationProcessor extends BaseStAXArtifactProcessor implements
+ StAXArtifactProcessor<SpringImplementation> {
private static final String LOCATION = "location";
private static final String IMPLEMENTATION_SPRING = "implementation.spring";
@@ -61,7 +62,6 @@ public class SpringImplementationProcess
private ExtensionPointRegistry registry;
private AssemblyFactory assemblyFactory;
private PolicySubjectProcessor policyProcessor;
-
private FactoryExtensionPoint factories;
@@ -80,10 +80,16 @@ public class SpringImplementationProcess
* @param model
*/
private void error(Monitor monitor, String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
+ if (monitor != null) {
+ Problem problem =
+ monitor.createProblem(this.getClass().getName(),
+ "impl-spring-validation-messages",
+ Severity.ERROR,
+ model,
+ message,
+ ex);
+ monitor.problem(problem);
+ }
}
/**
@@ -94,10 +100,16 @@ public class SpringImplementationProcess
* @param model
*/
private void error(Monitor monitor, String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
+ if (monitor != null) {
+ Problem problem =
+ monitor.createProblem(this.getClass().getName(),
+ "impl-spring-validation-messages",
+ Severity.ERROR,
+ model,
+ message,
+ (Object[])messageParameters);
+ monitor.problem(problem);
+ }
}
/*
@@ -119,7 +131,8 @@ public class SpringImplementationProcess
* then the default behaviour is to build an application context using all the *.xml files
* in the METAINF/spring directory.
*/
- public SpringImplementation read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
+ public SpringImplementation read(XMLStreamReader reader, ProcessorContext context)
+ throws ContributionReadException, XMLStreamException {
// Create the Spring implementation
SpringImplementation springImplementation = null;
@@ -127,12 +140,12 @@ public class SpringImplementationProcess
// Read the location attribute for the spring implementation
String springLocation = getURIString(reader, LOCATION);
if (springLocation != null) {
- springImplementation = new SpringImplementation();
- springImplementation.setLocation(springLocation);
- springImplementation.setUnresolved(true);
+ springImplementation = new SpringImplementation();
+ springImplementation.setLocation(springLocation);
+ springImplementation.setUnresolved(true);
processComponentType(springImplementation);
} else {
- error(context.getMonitor(), "LocationAttributeMissing", reader);
+ error(context.getMonitor(), "LocationAttributeMissing", reader);
//throw new ContributionReadException(MSG_LOCATION_MISSING);
}
@@ -167,7 +180,8 @@ public class SpringImplementationProcess
* Write out the XML representation of the Spring implementation
* <implementation.spring location="..." />
*/
- public void write(SpringImplementation springImplementation, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException, XMLStreamException {
+ public void write(SpringImplementation springImplementation, XMLStreamWriter writer, ProcessorContext context)
+ throws ContributionWriteException, XMLStreamException {
// Write <implementation.spring>
writer.writeStartElement(Constants.SCA11_NS, IMPLEMENTATION_SPRING);
@@ -188,19 +202,18 @@ public class SpringImplementationProcess
public void resolve(SpringImplementation springImplementation, ModelResolver resolver, ProcessorContext context)
throws ContributionResolveException {
- if (springImplementation == null)
- return;
+ if (springImplementation == null)
+ return;
- Monitor monitor = context.getMonitor();
+ Monitor monitor = context.getMonitor();
/* Load the Spring component type by reading the Spring application context */
- SpringXMLComponentTypeLoader springLoader =
- new SpringXMLComponentTypeLoader(registry, monitor);
+ SpringXMLComponentTypeLoader springLoader = new SpringXMLComponentTypeLoader(registry, monitor);
try {
// Load the Spring Implementation information from its application context file...
springLoader.load(springImplementation, resolver, context);
} catch (ContributionReadException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error(monitor, "ContributionResolveException", resolver, ce);
+ ContributionResolveException ce = new ContributionResolveException(e);
+ error(monitor, "ContributionResolveException", resolver, ce);
throw ce;
}
@@ -209,12 +222,12 @@ public class SpringImplementationProcess
// If the introspection fails to resolve, try to find a side file...
ComponentType componentType = resolver.resolveModel(ComponentType.class, ct, context);
if (componentType.isUnresolved()) {
- error(monitor, "UnableToResolveComponentType", resolver);
+ error(monitor, "UnableToResolveComponentType", resolver);
//throw new ContributionResolveException("SpringArtifactProcessor: unable to resolve componentType for Spring component");
} else {
springImplementation.setComponentType(componentType);
springImplementation.setUnresolved(false);
- }
+ }
} // end if