|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.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);
Fields inherited from class org.apache.turbine.services.BaseService |
configuration, name, properties, 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)
Method to allow a client to get a file to a server. |
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)
Method to allow a client to get a file from a server that requires authentication. |
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(javax.servlet.ServletConfig config)
This function initializes the XmlRpcService. |
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)
Method to allow a client to remove a file from the server |
void |
remove(java.lang.String serverURL,
java.lang.String username,
java.lang.String password,
java.lang.String sourceLocationProperty,
java.lang.String sourceFileName)
Method to allow a client to remove a file from a server that requires authentication. |
void |
send(java.lang.String serverURL,
java.lang.String sourceLocationProperty,
java.lang.String sourceFileName,
java.lang.String destinationLocationProperty,
java.lang.String destinationFileName)
Method to allow a client to send a file to a server. |
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)
Method to allow a client to send a file to a server that requires authentication |
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, 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, init, setInitableBroker |
Constructor Detail |
public TurbineXmlRpcService()
Method Detail |
public void init(javax.servlet.ServletConfig config) throws InitializationException
init
in class TurbineBaseService
org.apache.turbine.services.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) throws helma.xmlrpc.XmlRpcException, java.io.IOException
registerHandler
in interface XmlRpcService
handler
- The handler to use.XmlRpcException.
- IOException.
- public void registerHandler(java.lang.String handlerName, java.lang.Object handler) throws helma.xmlrpc.XmlRpcException, java.io.IOException
registerHandler
in interface XmlRpcService
handlerName
- The name the handler is registered under.handler
- The handler to use.XmlRpcException.
- IOException.
- 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.XmlRpcException.
- IOException.
- 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.XmlRpcException.
- IOException.
- public void send(java.lang.String serverURL, java.lang.String sourceLocationProperty, java.lang.String sourceFileName, java.lang.String destinationLocationProperty, java.lang.String destinationFileName) throws java.lang.Exception
send
in interface XmlRpcService
serverURL
- sourceLocationProperty
- sourceFileName
- destinationLocationProperty
- destinationFileName
- 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 java.lang.Exception
send
in interface XmlRpcService
serverURL
- username
- password
- sourceLocationProperty
- sourceFileName
- destinationLocationProperty
- destinationFileName
- public void get(java.lang.String serverURL, java.lang.String sourceLocationProperty, java.lang.String sourceFileName, java.lang.String destinationLocationProperty, java.lang.String destinationFileName) throws java.lang.Exception
get
in interface XmlRpcService
serverURL
- sourceLocationProperty
- sourceFileName
- destinationLocationProperty
- destinationFileName
- 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 java.lang.Exception
get
in interface XmlRpcService
serverURL
- username
- password
- sourceLocationProperty
- sourceFileName
- destinationLocationProperty
- destinationFileName
- public void remove(java.lang.String serverURL, java.lang.String sourceLocationProperty, java.lang.String sourceFileName) throws java.lang.Exception
remove
in interface XmlRpcService
serverURL
- sourceLocationProperty
- sourceFileName
- public void remove(java.lang.String serverURL, java.lang.String username, java.lang.String password, java.lang.String sourceLocationProperty, java.lang.String sourceFileName) throws java.lang.Exception
remove
in interface XmlRpcService
serverURL
- username
- password
- sourceLocationProperty
- sourceFileName
- 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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |