if (!isEjb3Endpoint) {
// only POJO endpoints have to be initialized. EJB3 endpoints are handled by the EJB3 subsystem.
final ServiceName endpointComponentName = getEndpointComponentServiceName();
final ServiceController<BasicComponent> endpointController = getComponentController(endpointComponentName);
if (endpointController != null) {
final BasicComponent endpointComponent = endpointController.getValue();
final ComponentInstance endpointComponentInstance = endpointComponent.createInstance(delegate.getInstance(className).getValue());
final Object endpointInstance = endpointComponentInstance.getInstance();
// mark reference as initialized because JBoss server initialized it
final Reference endpointReference = ReferenceFactory.newInitializedReference(endpointInstance);
return cacheAndGet(endpointReference);
}
}
} else {
// handle JAXWS handler instantiation
final ServiceName handlerComponentName = getHandlerComponentServiceName(className);
final ServiceController<BasicComponent> handlerComponentController = getComponentController(handlerComponentName);
if (handlerComponentController != null) {
// we support initialization only on non system JAXWS handlers
final BasicComponent handlerComponent = handlerComponentController.getValue();
final ComponentInstance handlerComponentInstance = handlerComponent.createInstance(delegate.getInstance(className).getValue());
final Object handlerInstance = handlerComponentInstance.getInstance();
// mark reference as initialized because JBoss server initialized it
final Reference handlerReference = ReferenceFactory.newInitializedReference(handlerInstance);
return cacheAndGet(handlerReference);
}