return;
}
Resource resource = implementation.getApplicationResource();
SpringComponentType componentType = new SpringComponentType();
// REVIEW andyp -- pass in deploymentContext.getClassLoader()?
AbstractRefreshableApplicationContext ctx;
if (runtimeInfo instanceof SpringRuntimeInfo) {
ctx = ((SpringRuntimeInfo) runtimeInfo).getApplicationContext();
} else {
ctx = new ScaApplicationContext(resource, componentType);
}
componentType.setApplicationContext(ctx); // FIXME andyp@bea.com -- don't do this!
// If there are <sca:service> elements, they define (and limit) the services exposed
// in the componentType.
String [] serviceBeanNames = ctx.getBeanNamesForType(ScaServiceExporter.class);
for (String serviceBeanName : serviceBeanNames) {
int nSuffix = serviceBeanName.indexOf(SERVICE_BEAN_SUFFIX);
if (nSuffix == -1) {
continue;
}
String serviceName = serviceBeanName.substring(0, nSuffix);
ScaServiceExporter serviceBean = (ScaServiceExporter) ctx.getBean(serviceName);
// REVIEW andyp -- use the class directly?
String serviceTypeName = serviceBean.getServiceType().getName();
try {
Class serviceInterface = Class.forName(serviceTypeName, true, deploymentContext.getClassLoader());
componentType.addServiceType(serviceName, serviceInterface);