import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.wamblee.system.core.AbstractComponent;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
import org.wamblee.system.core.AbstractComponent;
private Properties _properties;
private String[] _configFiles;
private Map<String, ProvidedInterface> _provided;
private Map<RequiredInterface, String> _required;
private Properties _properties;
private String[] _configFiles;
private Map<String, ProvidedInterface> _provided;
private Map<RequiredInterface, String> _required;
- /**
- * Parent application context containing required services.
- */
- private GenericApplicationContext _parentContext;
-
- /**
- * Application context containing parsed objects.
- */
- private AbstractApplicationContext _context;
} catch (Exception e) {
throw new SystemAssemblyException(
"Failed to assemble spring system", e);
} finally {
THIS.set(old);
} catch (Exception e) {
throw new SystemAssemblyException(
"Failed to assemble spring system", e);
} finally {
THIS.set(old);
- addInterface(_provided.get(name), svc);
+ addInterface(_provided.get(name), svc, aScope);
+ System.out.println("addService " + _provided.get(name) + " " + svc);
+ aScope.publishInterface(_provided.get(name), svc);
// Register required services in a parent context
for (RequiredInterface required: getRequiredInterfaces()) {
String beanName = _required.get(required);
// Register required services in a parent context
for (RequiredInterface required: getRequiredInterfaces()) {
String beanName = _required.get(required);
BeanDefinition definition = new RootBeanDefinition(
RequiredServiceBean.class, cargs,
new MutablePropertyValues());
BeanDefinition definition = new RootBeanDefinition(
RequiredServiceBean.class, cargs,
new MutablePropertyValues());
- protected void doStop() {
- _context.close();
- for (ProvidedInterface provided: getProvidedInterfaces()) {
- removeInterface(provided);
- }
+ protected void doStop(Scope aRuntime) {
+ AbstractApplicationContext context = (AbstractApplicationContext)aRuntime.get(CONTEXT_KEY);
+ context.close();