EndpointHelperpublic class EndpointHelper extends Object A utillity class which keeps track of JBI enabled end points |
Fields Summary |
---|
private com.sun.enterprise.webservice.monitoring.WebServiceEngine | engineA web service engine | private javax.jbi.component.ComponentContext | context | private com.sun.enterprise.jbi.serviceengine.core.EndpointRegistry | registry | private Map | uriToDetailsMap | private static EndpointHelper | helper | private com.sun.enterprise.webservice.monitoring.EndpointLifecycleListener | epLifecycleListener | private static final String | auto_enabled | protected static final Logger | loggerInternal handle to the logger instance |
Constructors Summary |
---|
private EndpointHelper()Creates a new instance of EndpointHelper
engine = WebServiceEngineFactory.getInstance().getEngine();
epLifecycleListener = new EndpointLifecycleListenerImpl();
engine.addLifecycleListener(epLifecycleListener);
context = JavaEEServiceEngineContext.getInstance().getJBIContext();
registry = EndpointRegistry.getInstance();
uriToDetailsMap = new HashMap();
|
Methods Summary |
---|
private javax.jbi.servicedesc.ServiceEndpoint | activateEndpoint(javax.xml.namespace.QName serviceName, java.lang.String endpointName)
String key = DescriptorEndpointInfo.getDEIKey(serviceName, endpointName);
DescriptorEndpointInfo dei = registry.getJBIEndpts().get(key);
if(dei != null) {
serviceName = dei.getServiceName();
endpointName = dei.getEndpointName();
}
return context.activateEndpoint(serviceName, endpointName);
| private void | debug(java.util.logging.Level logLevel, java.lang.String msgID, java.lang.Object[] params)
logger.log(logLevel, msgID, params);
| public void | destroy()
engine.removeLifecycleListener(epLifecycleListener);
| public void | disableEndpoint(javax.xml.namespace.QName service, java.lang.String endpointName)Deactivates the end point in JBI
// deactivates the end point in JBI
ServiceEngineEndpoint endpoint = registry.get(service, endpointName);
if (endpoint != null) {
try {
ServiceEndpoint endpt = endpoint.getServiceEndpoint();
// It's assumed that ServiceEndpoint is priorly activated in JBI
if(endpt != null ) {
context.deactivateEndpoint(endpt);
endpoint.setEnabled(false);
debug(Level.INFO,"serviceengine.disable_endpoint",
new Object[]{service.getLocalPart(), endpointName});
}
} catch(Exception e) {
debug(Level.SEVERE,"serviceengine.error_disable",
new Object[]{service.getLocalPart(), endpointName});
}
}
| public void | enableEndpoint(javax.xml.namespace.QName service, java.lang.String endpointName)
if(endpointName != null) {
ServiceEngineEndpoint endpoint = registry.get(service, endpointName);
if(endpoint != null && (!endpoint.isEnabled())) {
try {
ServiceEndpoint jbiEndpoint = activateEndpoint(
endpoint.getServiceName(),
endpoint.getEndpointName());
endpoint.setServiceEndpoint(jbiEndpoint);
endpoint.setEnabled(true);
debug(Level.INFO,"serviceengine.enable_endpoint",
new Object[]{service.getLocalPart(), endpointName});
} catch(Exception e) {
debug(Level.SEVERE,"serviceengine.error_enable",
new Object[]{service.getLocalPart(), endpointName});
}
}
}
| public static com.sun.enterprise.jbi.serviceengine.bridge.EndpointHelper | getInstance()
return helper;
| public void | initialize()
Iterator<Endpoint> endpoints = engine.getEndpoints();
while(endpoints.hasNext()) {
registerEndpoint(endpoints.next());
}
| private boolean | isJBIEnabled(com.sun.enterprise.deployment.WebServiceEndpoint endpoint)
try {
String applicationName =
endpoint.getWebService().getBundleDescriptor().getApplication().getRegistrationName();
ConfigContext configContext =
ApplicationServer.getServerContext().getConfigContext();
ConfigBean app =
ApplicationHelper.findApplication(configContext,applicationName);
String type =
ApplicationHelper.getApplicationType(configContext,
applicationName);
String endpointName = endpoint.getEndpointName();
if(type.equals(Applications.J2EE_APPLICATION)) {
com.sun.enterprise.config.serverbeans.WebServiceEndpoint endpointBean =
((J2eeApplication)app).getWebServiceEndpointByName(endpointName);
if(endpointBean != null)
return endpointBean.isJbiEnabled();
} else if (type.equals(Applications.EJB_MODULE)) {
com.sun.enterprise.config.serverbeans.WebServiceEndpoint endpointBean =
((EjbModule)app).getWebServiceEndpointByName(endpointName);
if(endpointBean != null)
return endpointBean.isJbiEnabled();
} else if (type.equals(Applications.WEB_MODULE)) {
com.sun.enterprise.config.serverbeans.WebServiceEndpoint endpointBean =
((WebModule)app).getWebServiceEndpointByName(endpointName);
if(endpointBean != null)
return endpointBean.isJbiEnabled();
}
} catch(Throwable ce) {
debug(Level.SEVERE,"serviceengine.config_not_found",
new Object[]{endpoint.getServiceName(),
endpoint.getEndpointName()});
}
// By default endpoints are disabled
return "true".equalsIgnoreCase(auto_enabled);
| public void | registerEndpoint(com.sun.enterprise.webservice.monitoring.Endpoint endpoint)Activates the end point in JBI
registerEndpoint(endpoint.getDescriptor());
| public void | registerEndpoint(com.sun.enterprise.deployment.WebServiceEndpoint webServiceDesc)
if(webServiceDesc != null) {
// activate the end point in JBI
String endpointName = webServiceDesc.hasWsdlPort() ? webServiceDesc.getWsdlPort().getLocalPart() : webServiceDesc.getEndpointName();
debug(Level.FINE,"serviceengine.start_registration",
new Object[]{webServiceDesc.getServiceName(),
endpointName});
try {
boolean ejbType = webServiceDesc.implementedByEjbComponent() ;
String relativeURI = webServiceDesc.getEndpointAddressUri();
//logger.info(" ClassLoader in service engine is : "+ classLoader);
String implClass = (ejbType)?webServiceDesc.getTieClassName():
webServiceDesc.getServletImplClass();
String contextRoot = null;
if(!ejbType) {
contextRoot =
webServiceDesc.getWebComponentImpl().
getWebBundleDescriptor().getContextRoot();
relativeURI = contextRoot + relativeURI;
}
ServiceEngineEndpoint seEndpoint =
new ServiceEngineEndpoint(webServiceDesc,
webServiceDesc.getServiceName(),
endpointName,
implClass,
contextRoot,
true);
if(isJBIEnabled(webServiceDesc) ||
registry.hasProviderEP(seEndpoint)) {
ServiceEndpoint endpoint = activateEndpoint(
webServiceDesc.getServiceName(),
endpointName);
seEndpoint.setServiceEndpoint(endpoint);
debug(Level.FINE,"serviceengine.success_registration",
new Object[]{webServiceDesc.getServiceName(),
endpointName});
} else {
seEndpoint.setEnabled(false);
}
// even if jbi-enabled flag is off, internal registries keep track
// of deployed web services in SJSAS
registry.put(webServiceDesc.getServiceName(),
endpointName, seEndpoint);
uriToDetailsMap.put(relativeURI,
new Object[]{webServiceDesc.getServiceName(),
endpointName});
} catch (Exception e) {
debug(Level.SEVERE,"serviceengine.error_registration",
new Object[]{webServiceDesc.getServiceName(),
endpointName});
}
}
| public void | toggleEndpointStatus(java.lang.String uri, boolean flag)
Object[] endpointInfo = (Object[])uriToDetailsMap.get(uri);
if(endpointInfo != null) {
if(flag)
enableEndpoint((QName)endpointInfo[0], (String)endpointInfo[1]);
else
disableEndpoint((QName)endpointInfo[0], (String)endpointInfo[1]);
}
| public void | unregisterEndpoint(javax.xml.namespace.QName service, java.lang.String endpointName)
if(endpointName != null) {
ServiceEngineEndpoint endpoint = registry.get(service, endpointName);
if(endpoint != null) {
String endpointURI = endpoint.getURI();
disableEndpoint(service, endpointName);
registry.delete(service, endpointName);
uriToDetailsMap.remove(endpointURI);
debug(Level.INFO,"serviceengine.success_removal",
new Object[]{service.getLocalPart(), endpointName});
}
}
|
|