|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.services.BaseInitable
org.apache.turbine.services.BaseService
org.apache.turbine.services.TurbineBaseService
org.apache.turbine.services.xmlrpc.TurbineXmlRpcService
This is a service which will make an xml-rpc call to a remote server. Here's an example of how it would be done:
XmlRpcService xs =
(XmlRpcService)TurbineServices.getInstance()
.getService(XmlRpcService.XMLRPC_SERVICE_NAME);
Vector vec = new Vector();
vec.addElement(new Integer(5));
URL url = new URL("http://betty.userland.com/RPC2");
String name = (String)xs.executeRpc(url, "examples.getStateName", vec);
TODO: Handle XmlRpc.setDebug(boolean)
Field Summary | |
protected boolean |
isModernVersion
Whether a version of Apache's XML-RPC library greater than 1.1 is available. |
protected int |
port
The port to listen on. |
protected org.apache.xmlrpc.XmlRpcServer |
server
The encapsulated xmlrpc server. |
protected org.apache.xmlrpc.WebServer |
webserver
The standalone xmlrpc server. |
Fields inherited from class org.apache.turbine.services.BaseService |
configuration, name, serviceBroker |
Fields inherited from class org.apache.turbine.services.BaseInitable |
initableBroker, isInitialized |
Fields inherited from interface org.apache.turbine.services.xmlrpc.XmlRpcService |
SERVICE_NAME |
Constructor Summary | |
TurbineXmlRpcService()
|
Method Summary | |
void |
acceptClient(java.lang.String address)
Add an IP address to the list of accepted clients. |
void |
denyClient(java.lang.String address)
Add an IP address to the list of denied clients. |
java.lang.Object |
executeAuthenticatedRpc(java.net.URL url,
java.lang.String username,
java.lang.String password,
java.lang.String methodName,
java.util.Vector params)
Client's Authenticated interface to XML-RPC. |
java.lang.Object |
executeRpc(java.net.URL url,
java.lang.String methodName,
java.util.Vector params)
Client's interface to XML-RPC. |
void |
get(java.lang.String serverURL,
java.lang.String sourceLocationProperty,
java.lang.String sourceFileName,
java.lang.String destinationLocationProperty,
java.lang.String destinationFileName)
Deprecated. This is not scope of the Service itself but of an application which uses the service. |
void |
get(java.lang.String serverURL,
java.lang.String username,
java.lang.String password,
java.lang.String sourceLocationProperty,
java.lang.String sourceFileName,
java.lang.String destinationLocationProperty,
java.lang.String destinationFileName)
Deprecated. This is not scope of the Service itself but of an application which uses the service. |
byte[] |
handleRequest(java.io.InputStream is)
Handle an XML-RPC request using the encapsulated server. |
byte[] |
handleRequest(java.io.InputStream is,
java.lang.String user,
java.lang.String password)
Handle an XML-RPC request using the encapsulated server with user authentication. |
void |
init()
This function initializes the XmlRpcService.This is a zero parameter variant which queries the Turbine Servlet for its config. |
void |
init(javax.servlet.ServletConfig config)
Deprecated. Use init() instead. |
void |
registerHandler(java.lang.Object handler)
Register an Object as a default handler for the service. |
void |
registerHandler(java.lang.String handlerName,
java.lang.Object handler)
Register an Object as a handler for the service. |
void |
registerHandler(java.lang.String handlerName,
java.lang.String handlerClass)
A helper method that tries to initialize a handler and register it. |
void |
remove(java.lang.String serverURL,
java.lang.String sourceLocationProperty,
java.lang.String sourceFileName)
Deprecated. This is not scope of the Service itself but of an application which uses the service. |
void |
remove(java.lang.String serverURL,
java.lang.String username,
java.lang.String password,
java.lang.String sourceLocationProperty,
java.lang.String sourceFileName)
Deprecated. This is not scope of the Service itself but of an application which uses the service. |
void |
send(java.lang.String serverURL,
java.lang.String sourceLocationProperty,
java.lang.String sourceFileName,
java.lang.String destinationLocationProperty,
java.lang.String destinationFileName)
Deprecated. This is not scope of the Service itself but of an application which uses the service. |
void |
send(java.lang.String serverURL,
java.lang.String username,
java.lang.String password,
java.lang.String sourceLocationProperty,
java.lang.String sourceFileName,
java.lang.String destinationLocationProperty,
java.lang.String destinationFileName)
Deprecated. This is not scope of the Service itself but of an application which uses the service. |
void |
setParanoid(boolean state)
Switch client filtering on/off. |
void |
shutdown()
Shuts down this service, stopping running threads. |
void |
unregisterHandler(java.lang.String handlerName)
Unregister a handler. |
Methods inherited from class org.apache.turbine.services.TurbineBaseService |
init, init |
Methods inherited from class org.apache.turbine.services.BaseService |
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker |
Methods inherited from class org.apache.turbine.services.BaseInitable |
getInit, getInitableBroker, setInit, setInitableBroker |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.turbine.services.Service |
getConfiguration, getName, getProperties, setName, setServiceBroker |
Methods inherited from interface org.apache.turbine.services.Initable |
getInit, init, setInitableBroker |
Field Detail |
protected boolean isModernVersion
protected org.apache.xmlrpc.WebServer webserver
protected org.apache.xmlrpc.XmlRpcServer server
protected int port
Constructor Detail |
public TurbineXmlRpcService()
Method Detail |
public void init() throws InitializationException
init
in interface Initable
init
in class TurbineBaseService
InitializationException
- Something went wrong in the init
stagepublic void init(javax.servlet.ServletConfig config) throws InitializationException
init
in class TurbineBaseService
config
- A ServletConfing to use for initialization
activities.
InitializationException
- if initialization of this
class was not successful.public void registerHandler(java.lang.Object handler)
registerHandler
in interface XmlRpcService
handler
- The handler to use.public void registerHandler(java.lang.String handlerName, java.lang.Object handler)
registerHandler
in interface XmlRpcService
handlerName
- The name the handler is registered under.handler
- The handler to use.public void registerHandler(java.lang.String handlerName, java.lang.String handlerClass) throws TurbineException
handlerName
- The name the handler is registered under.handlerClass
- The name of the class to use as a handler.
TurbineException
- Couldn't instantiate handler.public void unregisterHandler(java.lang.String handlerName)
unregisterHandler
in interface XmlRpcService
handlerName
- The name of the handler to unregister.public byte[] handleRequest(java.io.InputStream is)
handleRequest
in interface XmlRpcService
is
- the stream to read request data from.
public byte[] handleRequest(java.io.InputStream is, java.lang.String user, java.lang.String password)
Note that the handlers need to implement AuthenticatedXmlRpcHandler interface to access the authentication infomration.
handleRequest
in interface XmlRpcService
is
- the stream to read request data from.user
- the user that is making the request.password
- the password given by user.
public java.lang.Object executeRpc(java.net.URL url, java.lang.String methodName, java.util.Vector params) throws TurbineException
executeRpc
in interface XmlRpcService
url
- A URL.methodName
- A String with the method name.params
- A Vector with the parameters.
TurbineException
public java.lang.Object executeAuthenticatedRpc(java.net.URL url, java.lang.String username, java.lang.String password, java.lang.String methodName, java.util.Vector params) throws TurbineException
executeAuthenticatedRpc
in interface XmlRpcService
url
- A URL.username
- The username to try and authenticate withpassword
- The password to try and authenticate withmethodName
- A String with the method name.params
- A Vector with the parameters.
TurbineException
public void send(java.lang.String serverURL, java.lang.String sourceLocationProperty, java.lang.String sourceFileName, java.lang.String destinationLocationProperty, java.lang.String destinationFileName) throws TurbineException
send
in interface XmlRpcService
serverURL
- sourceLocationProperty
- sourceFileName
- destinationLocationProperty
- destinationFileName
-
TurbineException
public void send(java.lang.String serverURL, java.lang.String username, java.lang.String password, java.lang.String sourceLocationProperty, java.lang.String sourceFileName, java.lang.String destinationLocationProperty, java.lang.String destinationFileName) throws TurbineException
send
in interface XmlRpcService
serverURL
- username
- password
- sourceLocationProperty
- sourceFileName
- destinationLocationProperty
- destinationFileName
-
TurbineException
public void get(java.lang.String serverURL, java.lang.String sourceLocationProperty, java.lang.String sourceFileName, java.lang.String destinationLocationProperty, java.lang.String destinationFileName) throws TurbineException
get
in interface XmlRpcService
serverURL
- sourceLocationProperty
- sourceFileName
- destinationLocationProperty
- destinationFileName
-
TurbineException
public void get(java.lang.String serverURL, java.lang.String username, java.lang.String password, java.lang.String sourceLocationProperty, java.lang.String sourceFileName, java.lang.String destinationLocationProperty, java.lang.String destinationFileName) throws TurbineException
get
in interface XmlRpcService
serverURL
- username
- password
- sourceLocationProperty
- sourceFileName
- destinationLocationProperty
- destinationFileName
-
TurbineException
public void remove(java.lang.String serverURL, java.lang.String sourceLocationProperty, java.lang.String sourceFileName) throws TurbineException
remove
in interface XmlRpcService
serverURL
- sourceLocationProperty
- sourceFileName
-
TurbineException
public void remove(java.lang.String serverURL, java.lang.String username, java.lang.String password, java.lang.String sourceLocationProperty, java.lang.String sourceFileName) throws TurbineException
remove
in interface XmlRpcService
serverURL
- username
- password
- sourceLocationProperty
- sourceFileName
-
TurbineException
public void setParanoid(boolean state)
setParanoid
in interface XmlRpcService
state
- Whether to filter clients.acceptClient(java.lang.String)
,
denyClient(java.lang.String)
public void acceptClient(java.lang.String address)
acceptClient
in interface XmlRpcService
address
- The address to add to the list.denyClient(java.lang.String)
,
setParanoid(boolean)
public void denyClient(java.lang.String address)
denyClient
in interface XmlRpcService
address
- The address to add to the list.acceptClient(java.lang.String)
,
setParanoid(boolean)
public void shutdown()
shutdown
in interface Initable
shutdown
in class TurbineBaseService
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |