Fields Summary |
---|
private static Log | log |
private Vector | validTransportsValid transports for this service
(server side only!)
!!! For now, if this is null, we assume all
transports are valid. |
private boolean | highFidelityRecordingDoes this service require a high-fidelity SAX recording of messages?
(default is true) |
private int | sendTypeHow does this service wish data which would normally be sent as
an attachment to be sent? Default for requests is
org.apache.axis.attachments.Attachments.SEND_TYPE_DEFAULT,
and the default for responses is to match the request. |
private org.apache.axis.description.ServiceDesc | serviceDescriptionOur ServiceDescription. Holds pretty much all the interesting
metadata about this service. |
private org.apache.axis.AxisEngine | engine |
public Map | serviceObjectsA list of our active service objects (these can have lifetimes and
be reaped) |
public int | nextObjectID |
private static Hashtable | sessionsList of sessions (for all services), key=serviceName, value=Service |
private boolean | isRunning |
ArrayList | actorsActor list - these are just the service-specific ones |
Methods Summary |
---|
public void | addSession(org.apache.axis.session.Session session)Add this passed in Session to this Service's list of sessions
WeakHashMap map = (WeakHashMap) sessions.get( this.getName() );
if ( map == null ) {
map = new WeakHashMap();
sessions.put( this.getName(), map);
}
if ( !map.containsKey(session) ) map.put(session, null);
|
public boolean | availableFromTransport(java.lang.String transportName)
if (validTransports != null) {
for (int i = 0; i < validTransports.size(); i++) {
if (validTransports.elementAt(i).equals(transportName))
return true;
}
return false;
}
return true;
|
public void | clearSessions()Remove all of this Service's serviceObjects from it known sessions
WeakHashMap map = (WeakHashMap) sessions.get( this.getName() );
if ( map == null ) return ;
Iterator iter = map.keySet().iterator();
while ( iter.hasNext() ) {
Session session = (Session) iter.next();
session.remove( this.getName() );
}
|
public void | disableTransport(java.lang.String transportName)Disable access to this service from a particular transport
if (validTransports != null) {
validTransports.removeElement(transportName);
}
|
public void | enableTransport(java.lang.String transportName)Make this service available on a particular transport
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage(
"enableTransport00", "" + this, transportName));
}
if (validTransports == null)
validTransports = new Vector();
validTransports.addElement(transportName);
|
public void | generateWSDL(org.apache.axis.MessageContext msgContext)Generate WSDL. If we have a specific file configured in the
ServiceDesc, just return that. Otherwise run through all the Handlers
(including the provider) and call generateWSDL() on them via our
parent's implementation.
if (serviceDescription == null ||
serviceDescription.getWSDLFile() == null) {
super.generateWSDL(msgContext);
return;
}
InputStream instream = null;
// Got a WSDL file in the service description, so try and read it
try {
String filename= serviceDescription.getWSDLFile();
File file=new File(filename);
if(file.exists()) {
//if this resolves to a file, load it
instream = new FileInputStream(filename);
} else if(msgContext.getStrProp(Constants.MC_HOME_DIR)!=null){
String path = msgContext.getStrProp(Constants.MC_HOME_DIR) +'/" + filename;
file = new File(path);
if(file.exists()) {
//if this resolves to a file, load it
instream = new FileInputStream(path);
}
}
if(instream == null) {
//else load a named resource in our classloader.
instream = ClassUtils.getResourceAsStream(this.getClass(),filename);
if (instream == null) {
String errorText=Messages.getMessage("wsdlFileMissing",filename);
throw new AxisFault(errorText);
}
}
Document doc = XMLUtils.newDocument(instream);
msgContext.setProperty("WSDL", doc);
} catch (Exception e) {
throw AxisFault.makeFault(e);
} finally {
if(instream!=null) {
try {
instream.close();
} catch (IOException e) { }
}
}
|
public java.util.ArrayList | getActors()Get the merged actor list for this service, including engine-wide
actor URIs.
ArrayList acts = (ArrayList)actors.clone(); // ??? cache this?
if (engine != null) {
acts.addAll(engine.getActorURIs());
}
return acts;
|
public org.apache.axis.AxisEngine | getEngine()
return engine;
|
public synchronized org.apache.axis.description.ServiceDesc | getInitializedServiceDesc(org.apache.axis.MessageContext msgContext)Returns a service description with the implementation class filled in.
Syncronized to prevent simutaneous modification of serviceDescription.
if (!serviceDescription.isInitialized()) {
// Let the provider do the work of filling in the service
// descriptor. This is so that it can decide itself how best
// to map the Operations. In the future, we may want to support
// providers which don't strictly map to Java class backends
// (BSFProvider, etc.), and as such we hand off here.
if (pivotHandler instanceof BasicProvider) {
((BasicProvider)pivotHandler).initServiceDesc(this, msgContext);
}
}
return serviceDescription;
|
public java.util.List | getRoles()
return getActors();
|
public int | getSendType()
return sendType;
|
public java.util.ArrayList | getServiceActors()Get the service-specific actor list
return actors;
|
public org.apache.axis.description.ServiceDesc | getServiceDescription()
return serviceDescription;
|
public org.apache.axis.constants.Style | getStyle()
return serviceDescription.getStyle();
|
public org.apache.axis.encoding.TypeMappingRegistry | getTypeMappingRegistry()
return serviceDescription.getTypeMappingRegistry();
|
public org.apache.axis.constants.Use | getUse()
return serviceDescription.getUse();
|
public void | invoke(org.apache.axis.MessageContext msgContext)
HandlerInfoChainFactory handlerFactory = (HandlerInfoChainFactory) this.getOption(Constants.ATTR_HANDLERINFOCHAIN);
HandlerChainImpl handlerImpl = null;
if (handlerFactory != null) handlerImpl = (HandlerChainImpl) handlerFactory.createHandlerChain();
boolean result = true;
try {
if (handlerImpl != null) {
try {
result = handlerImpl.handleRequest(msgContext);
}
catch (SOAPFaultException e) {
msgContext.setPastPivot(true);
handlerImpl.handleFault(msgContext);
return;
}
}
if (result) {
try {
super.invoke(msgContext);
} catch (AxisFault e) {
msgContext.setPastPivot(true);
if (handlerImpl != null) {
handlerImpl.handleFault(msgContext);
}
throw e;
}
} else {
msgContext.setPastPivot(true);
}
if ( handlerImpl != null) {
handlerImpl.handleResponse(msgContext);
}
} catch (SOAPFaultException e) {
msgContext.setPastPivot(true);
throw AxisFault.makeFault(e);
} catch (RuntimeException e) {
SOAPFault fault = new SOAPFault(new AxisFault("Server", "Server Error", null, null));
SOAPEnvelope env = new SOAPEnvelope();
env.addBodyElement(fault);
Message message = new Message(env);
message.setMessageType(Message.RESPONSE);
msgContext.setResponseMessage(message);
throw AxisFault.makeFault(e);
}
finally {
if (handlerImpl != null) {
handlerImpl.destroy();
}
}
|
public boolean | isRunning()Is this service suspended?
return isRunning;
|
public boolean | needsHighFidelityRecording()
return highFidelityRecording;
|
public void | setEngine(org.apache.axis.AxisEngine engine)Tell this service which engine it's deployed to.
if (engine == null)
throw new IllegalArgumentException(
Messages.getMessage("nullEngine"));
this.engine = engine;
((LockableHashtable)options).setParent(engine.getOptions());
TypeMappingRegistry tmr = engine.getTypeMappingRegistry();
getTypeMappingRegistry().delegate(tmr);
|
public void | setHighFidelityRecording(boolean highFidelityRecording)
this.highFidelityRecording = highFidelityRecording;
|
public void | setPropertyParent(java.util.Hashtable parent)
if (options == null) {
options = new LockableHashtable();
}
((LockableHashtable)options).setParent(parent);
|
public void | setRoles(java.util.List roles)Set the service-specific role list
actors = new ArrayList(roles);
|
public void | setSendType(int sendType)
this.sendType = sendType;
|
public void | setServiceDescription(org.apache.axis.description.ServiceDesc serviceDescription)
if (serviceDescription == null) {
// FIXME: Throw NPE?
return;
}
this.serviceDescription = serviceDescription;
//serviceDescription.setTypeMapping((TypeMapping)this.getTypeMappingRegistry().getDefaultTypeMapping());
|
public void | setStyle(org.apache.axis.constants.Style style)
serviceDescription.setStyle(style);
|
public void | setUse(org.apache.axis.constants.Use style)
serviceDescription.setUse(style);
|
public void | start()Placeholder for "resume this service" method
isRunning = true;
|
public void | stop()Placeholder for "suspend this service" method
isRunning = false;
|