summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-07-28 21:01:00 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-07-28 21:01:00 +0000
commite01dfb8674dfc78d9af6ac60f1352d3149e6889b (patch)
tree492408746f680b0734bff54fe86fdeeec5add2ae /sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime
parentc4712a7d3ec710b46f65999f5df9f0abeb7e9f61 (diff)
Format the code based on the Tuscany eclipse formatter
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@980211 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime')
-rw-r--r--sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java35
-rw-r--r--sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java6
-rw-r--r--sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java64
-rw-r--r--sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java26
4 files changed, 65 insertions, 66 deletions
diff --git a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
index 6426306f26..3e0aacdb40 100644
--- a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
+++ b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAGenericApplicationContext.java
@@ -25,23 +25,22 @@ import org.springframework.context.support.GenericApplicationContext;
public class SCAGenericApplicationContext extends GenericApplicationContext {
- ClassLoader classloader = null;
-
- public SCAGenericApplicationContext(DefaultListableBeanFactory beanFactory,
- ApplicationContext parent,
- ClassLoader classloader) {
- super(beanFactory, parent);
- this.classloader = classloader;
- }
-
- public SCAGenericApplicationContext(ApplicationContext parent,
- ClassLoader classloader) {
- super(parent);
- this.classloader = classloader;
- }
+ ClassLoader classloader = null;
- @Override
- protected void postProcessBeanFactory (ConfigurableListableBeanFactory beanFactory) {
- beanFactory.setBeanClassLoader(classloader);
- }
+ public SCAGenericApplicationContext(DefaultListableBeanFactory beanFactory,
+ ApplicationContext parent,
+ ClassLoader classloader) {
+ super(beanFactory, parent);
+ this.classloader = classloader;
+ }
+
+ public SCAGenericApplicationContext(ApplicationContext parent, ClassLoader classloader) {
+ super(parent);
+ this.classloader = classloader;
+ }
+
+ @Override
+ protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
+ beanFactory.setBeanClassLoader(classloader);
+ }
}
diff --git a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java
index 36f1f6d761..88be5b720f 100644
--- a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java
+++ b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java
@@ -58,7 +58,7 @@ class SCAParentApplicationContext implements ApplicationContext {
} // end constructor
public Object getBean(String name) throws BeansException {
- return getBean(name, (Class) null);
+ return getBean(name, (Class)null);
}
/**
@@ -73,7 +73,7 @@ class SCAParentApplicationContext implements ApplicationContext {
} // end method getBean( String, Class )
public Object getBean(String name, Object[] args) throws BeansException {
- return getBean(name, ((Class)null));
+ return getBean(name, ((Class)null));
}
public <T> T getBean(Class<T> clazz) throws BeansException {
@@ -119,7 +119,7 @@ class SCAParentApplicationContext implements ApplicationContext {
}
public String getId() {
- return this.toString();
+ return this.toString();
}
public String getDisplayName() {
diff --git a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
index 77681b600f..d5a330c916 100644
--- a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
+++ b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
@@ -32,8 +32,8 @@ import org.apache.tuscany.sca.implementation.spring.processor.ReferenceAnnotatio
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.springframework.core.io.UrlResource;
@@ -48,11 +48,11 @@ public class SpringContextTie {
private AbstractApplicationContext springContext;
private SpringImplementationStub implementation;
-
+
public SpringContextTie(SpringImplementationStub implementation, List<URL> resource) {
this.implementation = implementation;
SCAParentApplicationContext scaParentContext = new SCAParentApplicationContext(implementation);
- springContext = createApplicationContext(scaParentContext, resource);
+ springContext = createApplicationContext(scaParentContext, resource);
}
public void start() {
@@ -71,30 +71,29 @@ public class SpringContextTie {
/**
* Include BeanPostProcessor to deal with SCA Annotations in Spring Bean
*/
- private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext, List<URL> resources) {
-
- XmlBeanFactory beanFactory = null;
- AbstractApplicationContext appContext = null;
-
- if (resources.size() > 1) {
- GenericApplicationContext appCtx =
- new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader());
- XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx);
- for (URL resource : resources) {
- xmlReader.loadBeanDefinitions(new UrlResource(resource));
- }
- xmlReader.setBeanClassLoader(implementation.getClassLoader());
- includeAnnotationProcessors(appCtx.getBeanFactory());
- return appCtx;
- }
-
- // use the generic application context as default
- beanFactory = new XmlBeanFactory(new UrlResource(resources.get(0)));
+ private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext,
+ List<URL> resources) {
+
+ XmlBeanFactory beanFactory = null;
+ AbstractApplicationContext appContext = null;
+
+ if (resources.size() > 1) {
+ GenericApplicationContext appCtx =
+ new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader());
+ XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx);
+ for (URL resource : resources) {
+ xmlReader.loadBeanDefinitions(new UrlResource(resource));
+ }
+ xmlReader.setBeanClassLoader(implementation.getClassLoader());
+ includeAnnotationProcessors(appCtx.getBeanFactory());
+ return appCtx;
+ }
+
+ // use the generic application context as default
+ beanFactory = new XmlBeanFactory(new UrlResource(resources.get(0)));
beanFactory.setBeanClassLoader(implementation.getClassLoader());
includeAnnotationProcessors(beanFactory);
- appContext = new SCAGenericApplicationContext(beanFactory,
- scaParentContext,
- implementation.getClassLoader());
+ appContext = new SCAGenericApplicationContext(beanFactory, scaParentContext, implementation.getClassLoader());
return appContext;
}
@@ -106,7 +105,7 @@ public class SpringContextTie {
* Include BeanPostProcessor to deal with SCA Annotations in Spring Bean
*/
private void includeAnnotationProcessors(ConfigurableListableBeanFactory beanFactory) {
-
+
// Processor to deal with @Init and @Destroy SCA Annotations
BeanPostProcessor initDestroyProcessor = new InitDestroyAnnotationProcessor();
beanFactory.addBeanPostProcessor(initDestroyProcessor);
@@ -115,19 +114,20 @@ public class SpringContextTie {
ComponentStub component = new ComponentStub(implementation.getComponentTie());
BeanPostProcessor referenceProcessor = new ReferenceAnnotationProcessor(component);
beanFactory.addBeanPostProcessor(referenceProcessor);
-
+
// Processor to deal with @Property SCA Annotations
PropertyValueStub pvs = new PropertyValueStub(implementation.getPropertyValueTie());
BeanPostProcessor propertyProcessor = new PropertyAnnotationProcessor(pvs);
beanFactory.addBeanPostProcessor(propertyProcessor);
-
+
// Processor to deal with @ComponentName SCA Annotations
- BeanPostProcessor componentNameProcessor = new ComponentNameAnnotationProcessor(implementation.getComponentName());
+ BeanPostProcessor componentNameProcessor =
+ new ComponentNameAnnotationProcessor(implementation.getComponentName());
beanFactory.addBeanPostProcessor(componentNameProcessor);
-
+
// Processor to deal with @Constructor SCA Annotations
BeanPostProcessor constructorProcessor = new ConstructorAnnotationProcessor();
- beanFactory.addBeanPostProcessor(constructorProcessor);
+ beanFactory.addBeanPostProcessor(constructorProcessor);
}
-} \ No newline at end of file
+}
diff --git a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
index af39869522..298d8944fb 100644
--- a/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
+++ b/sca-java-2.x/trunk/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
@@ -40,13 +40,13 @@ public class SpringImplementationStub {
Method getComponentTie;
Method getPropertyValueTie;
Method getClassLoader;
-
+
public SpringImplementationStub(Object tie) {
this.tie = tie;
Class<?> tieClass = tie.getClass();
try {
- getURI = tieClass.getMethod("getURI", new Class<?>[]{});
- getBean = tieClass.getMethod("getBean", new Class<?>[]{String.class, Class.class});
+ getURI = tieClass.getMethod("getURI", new Class<?>[] {});
+ getBean = tieClass.getMethod("getBean", new Class<?>[] {String.class, Class.class});
getComponentName = tieClass.getMethod("getComponentName");
getComponentTie = tieClass.getMethod("getComponentTie");
getPropertyValueTie = tieClass.getMethod("getPropertyValueTie");
@@ -55,7 +55,7 @@ public class SpringImplementationStub {
throw new RuntimeException(e);
}
}
-
+
public String getURI() {
try {
@@ -116,14 +116,14 @@ public class SpringImplementationStub {
throw new RuntimeException(e);
}
}
-
+
public ClassLoader getClassLoader() {
- try {
-
- return (ClassLoader) getClassLoader.invoke(tie);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
+ try {
+
+ return (ClassLoader)getClassLoader.invoke(tie);
+
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
-} \ No newline at end of file
+}