use of org.apache.cxf.resource.SinglePropertyResolver in project cxf by apache.
the class ExtensionManagerImpl method loadAndRegister.
final void loadAndRegister(Extension e) {
Class<?> cls = null;
if (null != e.getInterfaceName() && !"".equals(e.getInterfaceName())) {
cls = e.loadInterface(loader);
} else {
cls = e.getClassObject(loader);
}
if (null != activated && null != cls && null != activated.get(cls)) {
return;
}
synchronized (e) {
Object obj = e.load(loader, bus);
if (obj == null) {
return;
}
if (null != activated) {
Configurer configurer = (Configurer) (activated.get(Configurer.class));
if (null != configurer) {
configurer.configureBean(obj);
}
}
// let the object know for which namespaces it has been activated
ResourceResolver namespacesResolver = null;
if (null != e.getNamespaces()) {
namespacesResolver = new SinglePropertyResolver(ACTIVATION_NAMESPACES_PROPERTY_NAME, e.getNamespaces());
resourceManager.addResourceResolver(namespacesResolver);
}
// Now we call the setActivationNamespaces method directly here
if (e.getNamespaces() != null && !e.getNamespaces().isEmpty()) {
invokeSetterActivationNSMethod(obj, e.getNamespaces());
}
ResourceInjector injector = new ResourceInjector(resourceManager);
try {
injector.inject(obj);
injector.construct(obj);
} finally {
if (null != namespacesResolver) {
resourceManager.removeResourceResolver(namespacesResolver);
}
}
if (null != activated) {
if (cls == null) {
cls = obj.getClass();
}
activated.put(cls, obj);
}
}
}
use of org.apache.cxf.resource.SinglePropertyResolver in project tomee by apache.
the class ExtensionManagerImpl method loadAndRegister.
final void loadAndRegister(Extension e) {
Class<?> cls;
if (null != e.getInterfaceName() && !"".equals(e.getInterfaceName())) {
cls = e.loadInterface(loader);
} else {
cls = e.getClassObject(loader);
}
if (null != activated && null != cls && null != activated.get(cls)) {
return;
}
synchronized (e) {
Object obj = e.load(loader, bus);
if (obj == null) {
return;
}
if (null != activated) {
Configurer configurer = (Configurer) (activated.get(Configurer.class));
if (null != configurer) {
configurer.configureBean(obj);
}
}
// let the object know for which namespaces it has been activated
ResourceResolver namespacesResolver = null;
if (null != e.getNamespaces()) {
namespacesResolver = new SinglePropertyResolver(ACTIVATION_NAMESPACES_PROPERTY_NAME, e.getNamespaces());
resourceManager.addResourceResolver(namespacesResolver);
}
// Now we call the setActivationNamespaces method directly here
if (e.getNamespaces() != null && !e.getNamespaces().isEmpty()) {
invokeSetterActivationNSMethod(obj, e.getNamespaces());
}
ResourceInjector injector = new ResourceInjector(resourceManager);
try {
injector.inject(obj);
injector.construct(obj);
} finally {
if (null != namespacesResolver) {
resourceManager.removeResourceResolver(namespacesResolver);
}
}
if (null != activated) {
if (cls == null) {
cls = obj.getClass();
}
activated.put(cls, obj);
}
}
}
use of org.apache.cxf.resource.SinglePropertyResolver in project cxf by apache.
the class ExtensionManagerTest method setUp.
@Before
public void setUp() {
ResourceResolver resolver = new SinglePropertyResolver(EXTENSIONMANAGER_TEST_RESOURECE_NAME, this);
ResourceManager rm = new DefaultResourceManager(resolver);
extensions = new HashMap<>();
extensions.put(Integer.class, Integer.valueOf(0));
manager = new ExtensionManagerImpl("test-extension.xml", Thread.currentThread().getContextClassLoader(), extensions, rm, null);
}
Aggregations