diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2013-10-07 22:23:21 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2013-10-07 22:23:21 +0000 |
commit | 5963a2d3d6860fe57afc138f095bf2d2eb5a7b80 (patch) | |
tree | 018d3d8c637e265b8292d34e5f7c11ca8ce11b7d /sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context | |
parent | 132aa8a77685ec92bc90c03f987650d275a7b639 (diff) |
Official Tuscany 2.0.1 Release
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1530096 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context')
4 files changed, 0 insertions, 664 deletions
diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java b/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java deleted file mode 100644 index 69e2ee2865..0000000000 --- a/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAGenericApplicationContext.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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.implementation.spring.context.tie; - -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringBeanElement; -import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringConstructorArgElement; -import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringElementTie; -import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringPropertyElement; -import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringSCAPropertyElement; -import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringSCAReferenceElement; -import org.apache.tuscany.sca.implementation.spring.elements.tie.SpringSCAServiceElement; -import org.springframework.beans.MutablePropertyValues; -import org.springframework.beans.PropertyValue; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.BeanReference; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.beans.factory.config.ConstructorArgumentValues; -import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder; -import org.springframework.beans.factory.config.TypedStringValue; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.GenericApplicationContext; - -public class SCAGenericApplicationContext extends GenericApplicationContext { - - private ClassLoader classloader = null; - private List<SpringSCAPropertyElement> propertyElements = new ArrayList<SpringSCAPropertyElement>(); - private List<SpringSCAServiceElement> serviceElements = new ArrayList<SpringSCAServiceElement>(); - private List<SpringSCAReferenceElement> referenceElements = new ArrayList<SpringSCAReferenceElement>(); - private List<SpringBeanElement> beanElements; - - 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); - } - - public void addSCAPropertyElement(SpringSCAPropertyElement propertyElement) { - propertyElements.add(propertyElement); - } - - public void addSCAServiceElement(SpringSCAServiceElement serviceElement) { - serviceElements.add(serviceElement); - } - - public void addSCAReferenceElement(SpringSCAReferenceElement referenceElement) { - referenceElements.add(referenceElement); - } - - public synchronized List<SpringBeanElement> getBeanElements() { - if (beanElements == null) { - beanElements = new ArrayList<SpringBeanElement>(); - for (String name : getBeanDefinitionNames()) { - BeanDefinition def = getBeanDefinition(name); - SpringBeanElement beanElement = new SpringBeanElement(name, def.getBeanClassName()); - beanElements.add(beanElement); - beanElement.setAbstractBean(def.isAbstract()); - beanElement.setFactoryBeanAttribute(def.getFactoryBeanName() != null); - beanElement.setFactoryMethodAttribute(def.getFactoryMethodName() != null); - beanElement.setParentAttribute(def.getParentName() != null); - beanElement.setInnerBean(beanElement.getId() == null); - - ConstructorArgumentValues args = def.getConstructorArgumentValues(); - for (Map.Entry<Integer, ValueHolder> e: args.getIndexedArgumentValues().entrySet()) { - ValueHolder holder = e.getValue(); - SpringConstructorArgElement arg = new SpringConstructorArgElement(holder.getType()); - arg.setIndex(e.getKey()); - beanElement.addCustructorArgs(arg); - } - - MutablePropertyValues values = def.getPropertyValues(); - for (PropertyValue p : values.getPropertyValueList()) { - SpringPropertyElement propertyElement = new SpringPropertyElement(p.getName()); - Object value = p.getValue(); - configurePropertyElement(propertyElement, value); - beanElement.getProperties().add(propertyElement); - } - } - } - return beanElements; - } - - public void configurePropertyElement(SpringPropertyElement propertyElement, Object value) { - if (value instanceof BeanReference) { - BeanReference beanRef = (BeanReference)value; - propertyElement.addRef(beanRef.getBeanName()); - } else if (value instanceof Collection) { - Collection collection = (Collection)value; - for (Object item : collection) { - configurePropertyElement(propertyElement, item); - } - } else if (value instanceof TypedStringValue) { - TypedStringValue stringValue = (TypedStringValue)value; - propertyElement.addValue(stringValue.getValue()); - } else { - if (value != null) { - propertyElement.addValue(value.toString()); - } - } - } - - public List<SpringSCAPropertyElement> getPropertyElements() { - return propertyElements; - } - - public List<SpringSCAServiceElement> getServiceElements() { - return serviceElements; - } - - public List<SpringSCAReferenceElement> getReferenceElements() { - return referenceElements; - } - - public <T> T[] getElements(Class<T> type) { - if (type.getSimpleName().equals(SpringSCAPropertyElement.class.getSimpleName())) { - T[] elements = (T[])Array.newInstance(type, getPropertyElements().size()); - for (int i = 0; i < elements.length; i++) { - elements[i] = SpringElementTie.copy(getPropertyElements().get(i), type, type); - } - return elements; - } else if (type.getSimpleName().equals(SpringSCAReferenceElement.class.getSimpleName())) { - T[] elements = (T[])Array.newInstance(type, getReferenceElements().size()); - for (int i = 0; i < elements.length; i++) { - elements[i] = SpringElementTie.copy(getReferenceElements().get(i), type, type); - } - return elements; - } else if (type.getSimpleName().equals(SpringSCAServiceElement.class.getSimpleName())) { - T[] elements = (T[])Array.newInstance(type, getServiceElements().size()); - for (int i = 0; i < elements.length; i++) { - elements[i] = SpringElementTie.copy(getServiceElements().get(i), type, type); - } - return elements; - } else if (type.getSimpleName().equals(SpringBeanElement.class.getSimpleName())) { - T[] elements = (T[])Array.newInstance(type, getBeanElements().size()); - for (int i = 0; i < elements.length; i++) { - elements[i] = SpringElementTie.copy(getBeanElements().get(i), type, type); - } - return elements; - } else { - throw new IllegalArgumentException(type + " is not supported"); - } - } -} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java b/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java deleted file mode 100644 index d2b35ce74e..0000000000 --- a/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SCAParentApplicationContext.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * 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.implementation.spring.context.tie; - -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.util.Locale; -import java.util.Map; - -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.beans.factory.config.AutowireCapableBeanFactory; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.MessageSourceResolvable; -import org.springframework.context.NoSuchMessageException; -import org.springframework.core.io.Resource; - -/** - * A Spring ParentApplicationContext for a given Spring Implementation - * - * The Parent application context is responsible for handling those entities within a Spring - * application context that actually belong to SCA rather than to Spring. The principal things - * are Properties and References. These may be present either through explicit <sca:property/> - * and <sca:reference/> elements in the application context or they may be implicit through - * unresolved Spring bean <property.../> elements. In either case, it is the Parent application - * context that must provide Spring beans that correspond to the property or reference, as derived - * from the SCA composite in which the Spring application context is an implementation. - * - * @version $Rev$ $Date$ - */ -public class SCAParentApplicationContext implements ApplicationContext { - - // The Spring implementation for which this is the parent application context - private SpringImplementationStub implementation; - - private static final String[] EMPTY_ARRAY = new String[0]; - - public SCAParentApplicationContext(SpringImplementationStub implementation) { - this.implementation = implementation; - } // end constructor - - public Object getBean(String name) throws BeansException { - return getBean(name, (Class)null); - } - - /** - * Get a Bean for a reference or for a property. - * - * @param name - the name of the Bean required - * @param requiredType - the required type of the Bean (either a Java class or a Java interface) - * @return Object - a Bean which matches the requested bean - */ - public Object getBean(String name, Class requiredType) throws BeansException { - Object bean = implementation.getBean(name, requiredType); - if (bean == null && getParent() != null) { - bean = getParent().getBean(name, requiredType); - } - if (bean == null) { - throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name); - } else { - return bean; - } - } // end method getBean( String, Class ) - - public Object getBean(String name, Object[] args) throws BeansException { - return getBean(name, ((Class)null)); - } - - public <T> T getBean(Class<T> clazz) throws BeansException { - return clazz.cast(getBean(clazz.getName(), clazz)); - } - - public Map<String, Object> getBeansWithAnnotation(Class<? extends Annotation> clazz) throws BeansException { - return null; - } - - public <A extends Annotation> A findAnnotationOnBean(String arg0, Class<A> clazz) { - return null; - } - - public boolean containsBean(String name) { - // TODO - return false; - } - - public boolean isSingleton(String name) throws NoSuchBeanDefinitionException { - // TODO - return false; - } - - public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException { - throw new UnsupportedOperationException(); - } - - public Class getType(String name) throws NoSuchBeanDefinitionException { - return null; - } - - public String[] getAliases(String name) throws NoSuchBeanDefinitionException { - return EMPTY_ARRAY; - } - - public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException { - return null; - } - - public String getId() { - return this.toString(); - } - - public String getDisplayName() { - return implementation.getURI(); - } - - public long getStartupDate() { - return 0; - } - - public boolean containsBeanDefinition(String beanName) { - return false; - } - - public int getBeanDefinitionCount() { - return 0; - } - - public String[] getBeanDefinitionNames() { - return new String[0]; - } - - public String[] getBeanNamesForType(Class type) { - return new String[0]; - } - - public String[] getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans) { - return new String[0]; - } - - public Map getBeansOfType(Class type) throws BeansException { - return null; - } - - public Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException { - return null; - } - - public boolean isPrototype(String theString) { - return false; - } - - public BeanFactory getParentBeanFactory() { - return null; - } - - public boolean containsLocalBean(String name) { - return false; - } - - public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) { - return null; - } - - public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException { - return null; - } - - public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { - return null; - } - - public void publishEvent(ApplicationEvent event) { - - } - - public Resource[] getResources(String locationPattern) throws IOException { - return new Resource[0]; - } - - public Resource getResource(String location) { - return null; - } - - public ClassLoader getClassLoader() { - // REVIEW: this is almost certainly flawed, but it's not clear how the SCA runtime's - // resource loading mechanism is exposed right now. - return this.getClass().getClassLoader(); - } - - @Override - public ApplicationContext getParent() { - return implementation.getParentApplicationContext(); - } - -} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java b/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java deleted file mode 100644 index 8bcdc8108d..0000000000 --- a/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringContextTie.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.implementation.spring.context.tie; - -import java.net.URL; -import java.util.List; - -import org.apache.tuscany.sca.implementation.spring.processor.tie.ComponentNameAnnotationProcessor; -import org.apache.tuscany.sca.implementation.spring.processor.tie.ComponentStub; -import org.apache.tuscany.sca.implementation.spring.processor.tie.ConstructorAnnotationProcessor; -import org.apache.tuscany.sca.implementation.spring.processor.tie.InitDestroyAnnotationProcessor; -import org.apache.tuscany.sca.implementation.spring.processor.tie.PropertyAnnotationProcessor; -import org.apache.tuscany.sca.implementation.spring.processor.tie.PropertyValueStub; -import org.apache.tuscany.sca.implementation.spring.processor.tie.ReferenceAnnotationProcessor; -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.XmlBeanDefinitionReader; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.GenericApplicationContext; -import org.springframework.core.io.UrlResource; - -/** - * This is the runtime side tie for the corresponding tuscany side stub class. - * It enables the Tuscany code to invoke methods on a Spring context without - * needing to know about any Spring classes. See the SpringContextStub class - * in the implementation-spring module for what the stub does. - */ -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); - } - - public ApplicationContext getApplicationContext() { - return springContext; - } - - public void start() { - // Do refresh here to ensure that Spring Beans are not touched before the SCA config process is complete... - springContext.refresh(); - springContext.start(); - } - - public void close() { - springContext.close(); - if (springContext instanceof GenericApplicationContext) { - springContext.stop(); - } - } - - /** - * Include BeanPostProcessor to deal with SCA Annotations in Spring Bean - */ - private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext, - List<URL> resources) { - - GenericApplicationContext appCtx = - new SCAGenericApplicationContext(scaParentContext, implementation.getClassLoader()); - XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(appCtx); - - // REVIEW: [rfeng] How do we control the schema validation - xmlReader.setValidating(false); - - for (URL resource : resources) { - xmlReader.loadBeanDefinitions(new UrlResource(resource)); - } - xmlReader.setBeanClassLoader(implementation.getClassLoader()); - includeAnnotationProcessors(appCtx.getBeanFactory()); - return appCtx; - - } - - public Object getBean(String id) throws BeansException { - return springContext.getBean(id); - } - - /** - * 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); - - // Processor to deal with @Reference SCA Annotations - 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()); - beanFactory.addBeanPostProcessor(componentNameProcessor); - - // Processor to deal with @Constructor SCA Annotations - BeanPostProcessor constructorProcessor = new ConstructorAnnotationProcessor(); - beanFactory.addBeanPostProcessor(constructorProcessor); - } - -} diff --git a/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java b/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java deleted file mode 100644 index 5ce52e668c..0000000000 --- a/sca-java-2.x/tags/2.0.1-RC1/modules/implementation-spring-tie/src/main/java/org/apache/tuscany/sca/implementation/spring/context/tie/SpringImplementationStub.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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.implementation.spring.context.tie; - -import java.lang.reflect.Method; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; - -/** - * This is the runtime side stub for the corresponding Tuscany-side stub class. - * It enables the Spring code in the runtime module to invoke methods on a - * Tuscany SpringImplementation without the Spring runtime module - * needing to know about any Tuscany classes. See the SpringImplementationTie class - * in the implementation-spring module for what the tie does. - */ -public class SpringImplementationStub { - - Object tie; - Method getURI; - Method getBean; - Method getComponentName; - Method getComponentTie; - Method getPropertyValueTie; - Method getClassLoader; - Method getParentApplicationContext; - - 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}); - getComponentName = tieClass.getMethod("getComponentName"); - getComponentTie = tieClass.getMethod("getComponentTie"); - getPropertyValueTie = tieClass.getMethod("getPropertyValueTie"); - getClassLoader = tieClass.getMethod("getClassLoader"); - getParentApplicationContext = tieClass.getMethod("getParentApplicationContext"); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public String getURI() { - try { - - return (String)getURI.invoke(tie); - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Get a Bean for a reference or for a property. - * - * @param name - the name of the Bean required - * @param requiredType - the required type of the Bean (either a Java class or a Java interface) - * @return Object - a Bean which matches the requested bean - */ - public Object getBean(String name, Class<?> requiredType) throws BeansException { - try { - - Object bean = getBean.invoke(tie, new Object[] {name, requiredType}); -// if (bean == null) { -// throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name); -// } - return bean; - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public String getComponentName() { - try { - - return (String)getComponentName.invoke(tie); - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public Object getComponentTie() { - try { - - return getComponentTie.invoke(tie); - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public Object getPropertyValueTie() { - try { - - return getPropertyValueTie.invoke(tie); - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public ClassLoader getClassLoader() { - try { - - return (ClassLoader)getClassLoader.invoke(tie); - - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /** - * Get the parent Spring application context set by the Tuscany runtime - * @return - */ - public ApplicationContext getParentApplicationContext() { - try { - - return (ApplicationContext)getParentApplicationContext.invoke(tie); - - } catch (Exception e) { - throw new RuntimeException(e); - } - - } -} |