Methods Summary |
---|
public com.sun.xml.rpc.spi.tools.Configuration | createConfiguration()com.sun.xml.rpc.spi.tools.wscompile.CompileToolDelegate overrides.
Configuration configuration = null;
if( modelInfo != null ) {
configuration =
rpcFactory.createConfiguration(wscompile.getEnvironment());
configuration.setModelInfo(modelInfo);
}
//else, leave it to the jaxrpc implementation to
//create Configuration
return configuration;
|
private com.sun.xml.rpc.spi.tools.HandlerInfo | createHandlerInfo(com.sun.enterprise.deployment.WebServiceHandler handler)
HandlerInfo handlerInfo = rpcFactory.createHandlerInfo();
handlerInfo.setHandlerClassName(handler.getHandlerClass());
for(Iterator iter = handler.getSoapHeaders().iterator();
iter.hasNext();) {
QName next = (QName) iter.next();
handlerInfo.addHeaderName(next);
}
Map properties = handlerInfo.getProperties();
for(Iterator iter = handler.getInitParams().iterator();
iter.hasNext();) {
NameValuePairDescriptor next = (NameValuePairDescriptor)
iter.next();
properties.put(next.getName(), next.getValue());
}
return handlerInfo;
|
private void | doClientPostProcessing()
Model model = wscompile.getProcessor().getModel();
Iterator serviceIter = model.getServices();
Service service = null;
if( serviceRef.hasServiceName() ) {
while( serviceIter.hasNext() ) {
Service next = (Service) serviceIter.next();
if( next.getName().equals(serviceRef.getServiceName()) ) {
service = next;
break;
}
}
if( service == null ) {
throw new IllegalStateException
("Service " + serviceRef.getServiceName() +
" for service-ref " + serviceRef.getName() + " not found");
}
} else {
if( serviceIter.hasNext() ) {
service = (Service) serviceIter.next();
if( serviceIter.hasNext() ) {
throw new IllegalStateException
("service ref " + serviceRef.getName() + " must specify"
+ " service name since its wsdl declares multiple"
+ " services");
}
QName sName = service.getName();
serviceRef.setServiceNamespaceUri(sName.getNamespaceURI());
serviceRef.setServiceLocalPart(sName.getLocalPart());
} else {
throw new IllegalStateException
("service ref " + serviceRef.getName() + " WSDL must " +
"define at least one Service");
}
}
// Use naming convention to derive Generated Service
// implementation class name.
String serviceImpl = service.getJavaIntf().getName() + "_Impl";
serviceRef.setServiceImplClassName(serviceImpl);
|
private void | doServicePostProcessing()
Model model = wscompile.getProcessor().getModel();
Collection endpoints = webService.getEndpoints();
for(Iterator iter = endpoints.iterator(); iter.hasNext(); ) {
WebServiceEndpoint next = (WebServiceEndpoint) iter.next();
Service service = wsUtil.getServiceForPort(model,
next.getWsdlPort());
if( service == null ) {
service = (Service) model.getServices().next();
System.out.println("Warning : Can't find Service for Endpoint '"
+ next.getEndpointName() + "' Port '" +
next.getWsdlPort() + "'");
System.out.println("Defaulting to "+ service.getName());
}
QName serviceName = service.getName();
next.setServiceNamespaceUri(serviceName.getNamespaceURI());
next.setServiceLocalPart(serviceName.getLocalPart());
Port port = wsUtil.getPortFromModel(model, next.getWsdlPort());
if( port == null ) {
String msg = "Can't find model port for endpoint "
+ next.getEndpointName() + " with wsdl-port " +
next.getWsdlPort();
throw new IllegalStateException(msg);
}
// If port has a tie class name property, use it. Otherwise,
// use naming convention to derive tie class name. If there
// are multiple ports per SEI(binding), then the property then
// the TIE_CLASS_NAME property will be available. In that case,
// a separate tie and stub are generated per port.
String tieClassName = (String)
port.getProperty(ModelProperties.PROPERTY_TIE_CLASS_NAME);
if( tieClassName == null ) {
tieClassName = next.getServiceEndpointInterface() + "_Tie";
}
next.setTieClassName(tieClassName);
if( next.implementedByWebComponent() ) {
wsUtil.updateServletEndpointRuntime(next);
} else {
wsUtil.validateEjbEndpoint(next);
}
String endpointAddressUri = next.getEndpointAddressUri();
if( endpointAddressUri == null ) {
String msg = "Endpoint address uri must be set for endpoint " +
next.getEndpointName();
throw new IllegalStateException(msg);
} else if( endpointAddressUri.indexOf("*") >= 0 ) {
String msg = "Endpoint address uri " + endpointAddressUri +
" for endpoint " + next.getEndpointName() +
" is invalid. It must not contain the '*' character";
throw new IllegalStateException(msg);
} else if( endpointAddressUri.endsWith("/") ) {
String msg = "Endpoint address uri " + endpointAddressUri +
" for endpoint " + next.getEndpointName() +
" is invalid. It must not end with '/'";
throw new IllegalStateException(msg);
}
}
|
public com.sun.xml.rpc.spi.tools.CompileTool | getCompileTool()
return wscompile;
|
public java.util.Collection | getGeneratedFiles()
return generatedFiles;
|
public void | postRegisterProcessorActions()
if( !error) {
if (webService != null) {
setupServiceHandlerChain();
}
// NOTE : Client handler chains are configured at runtime.
}
|
public void | postRun()
generatedFiles = new HashSet();
if( !error ) {
for(Iterator iter = wscompile.getEnvironment().getGeneratedFiles();
iter.hasNext(); ) {
generatedFiles.add( iter.next() );
}
if( webService != null ) {
doServicePostProcessing();
} else if( serviceRef != null ) {
doClientPostProcessing();
}
}
|
public void | preOnError()
error = true;
|
public void | setModelInfo(com.sun.xml.rpc.spi.tools.ModelInfo info)
modelInfo = info;
|
private void | setupServiceHandlerChain()
Model model = wscompile.getProcessor().getModel();
Collection endpoints = webService.getEndpoints();
for(Iterator eIter = endpoints.iterator(); eIter.hasNext();) {
WebServiceEndpoint nextEndpoint = (WebServiceEndpoint) eIter.next();
if( !nextEndpoint.hasHandlers() ) {
continue;
}
Port port = wsUtil.getPortFromModel(model,
nextEndpoint.getWsdlPort());
if( port == null ) {
throw new IllegalStateException("Model port for endpoint " +
nextEndpoint.getEndpointName() +
" not found");
}
List handlerChain = nextEndpoint.getHandlers();
HandlerChainInfo modelHandlerChain =
port.getServerHCI();
List handlerInfoList = new ArrayList();
// Insert an container handler as the first element.
// This is needed to perform method authorization checks.
HandlerInfo preHandler = rpcFactory.createHandlerInfo();
String handlerClassName = nextEndpoint.implementedByEjbComponent() ?
"com.sun.enterprise.webservice.EjbContainerPreHandler" :
"com.sun.enterprise.webservice.ServletPreHandler";
preHandler.setHandlerClassName(handlerClassName);
handlerInfoList.add(preHandler);
// Collect all roles defined on each handler and set them on
// handler chain. NOTE : There is a bit of a mismatch here between
// 109 and JAXRPC. JAXRPC only defines roles at the handler chain
// level, whereas 109 descriptors put roles at the handler level.
Collection soapRoles = new HashSet();
for(Iterator hIter = handlerChain.iterator(); hIter.hasNext();) {
WebServiceHandler nextHandler =
(WebServiceHandler) hIter.next();
HandlerInfo handlerInfo = createHandlerInfo(nextHandler);
handlerInfoList.add(handlerInfo);
soapRoles.addAll(nextHandler.getSoapRoles());
}
// Insert a container handler as the last element in the chain.
HandlerInfo postHandler = rpcFactory.createHandlerInfo();
handlerClassName = nextEndpoint.implementedByEjbComponent() ?
"com.sun.enterprise.webservice.EjbContainerPostHandler" :
"com.sun.enterprise.webservice.ServletPostHandler";
postHandler.setHandlerClassName(handlerClassName);
handlerInfoList.add(postHandler);
// @@@ should probably use addHandler api instead once
// == bug is fixed.
modelHandlerChain.setHandlersList(handlerInfoList);
for(Iterator roleIter = soapRoles.iterator(); roleIter.hasNext();) {
modelHandlerChain.addRole((String) roleIter.next());
}
}
|