public synchronized ServerImpl getServer(String addr) {
if (server == null) {
checkProperties();
ClassLoaderHolder loader = null;
try {
if (bus != null) {
ClassLoader newLoader = bus.getExtension(ClassLoader.class);
if (newLoader != null) {
loader = ClassLoaderUtils.setThreadContextClassloader(newLoader);
}
}
// Initialize the endpointName so we can do configureObject
QName origEpn = endpointName;
if (endpointName == null) {
JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(getImplementorClass());
endpointName = implInfo.getEndpointName();
}
if (serviceFactory != null) {
serverFactory.setServiceFactory(serviceFactory);
}
/*if (serviceName != null) {
serverFactory.getServiceFactory().setServiceName(serviceName);
}*/
configureObject(this);
endpointName = origEpn;
// Set up the server factory
serverFactory.setAddress(addr);
serverFactory.setStart(false);
serverFactory.setEndpointName(endpointName);
serverFactory.setServiceBean(implementor);
serverFactory.setBus(bus);
serverFactory.setFeatures(getFeatures());
serverFactory.setInvoker(invoker);
serverFactory.setSchemaLocations(schemaLocations);
if (serverFactory.getProperties() != null) {
serverFactory.getProperties().putAll(properties);
} else {
serverFactory.setProperties(properties);
}
// Be careful not to override any serverfactory settings as a user might
// have supplied their own.
if (getWsdlLocation() != null) {
serverFactory.setWsdlURL(getWsdlLocation());
}
if (bindingUri != null) {
serverFactory.setBindingId(bindingUri);
}
if (serviceName != null) {
serverFactory.getServiceFactory().setServiceName(serviceName);
}
if (implementorClass != null) {
serverFactory.setServiceClass(implementorClass);
}
if (executor != null) {
serverFactory.getServiceFactory().setExecutor(executor);
}
if (handlers.size() > 0) {
serverFactory.addHandlers(handlers);
}
configureObject(serverFactory);
server = serverFactory.create();
org.apache.cxf.endpoint.Endpoint endpoint = getEndpoint();
if (in != null) {
endpoint.getInInterceptors().addAll(in);
}
if (out != null) {
endpoint.getOutInterceptors().addAll(out);
}
if (inFault != null) {
endpoint.getInFaultInterceptors().addAll(inFault);
}
if (outFault != null) {
endpoint.getOutFaultInterceptors().addAll(outFault);
}
if (properties != null) {
endpoint.putAll(properties);
}
configureObject(endpoint.getService());
configureObject(endpoint);
this.service = endpoint.getService();
if (getWsdlLocation() == null) {
//hold onto the wsdl location so cache won't clear till we go away
setWsdlLocation(serverFactory.getWsdlURL());
}
if (serviceName == null) {
setServiceName(serverFactory.getServiceFactory().getServiceQName());
}
if (endpointName == null) {
endpointName = endpoint.getEndpointInfo().getName();
}
} finally {
if (loader != null) {
loader.reset();
}
}
}
return (ServerImpl) server;
}