001: package org.apache.turbine.services.xmlrpc;
002:
003: /*
004: * Copyright 2001-2005 The Apache Software Foundation.
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License")
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */
018:
019: import java.io.InputStream;
020:
021: import java.net.URL;
022:
023: import java.util.Vector;
024:
025: import org.apache.turbine.services.Service;
026: import org.apache.turbine.util.TurbineException;
027:
028: /**
029: * The interface an XmlRpcService implements.
030: *
031: * @author <a href="mailto:josh@stonecottage.com">Josh Lucas</a>
032: * @author <a href="mailto:magnus@handtolvur.is">Magnús Þór Torfason</a>
033: * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
034: * @author <a href="jvanzyl@periapt.com">Jason van Zyl</a>
035: * @version $Id: XmlRpcService.java 278958 2005-09-06 09:35:39Z henning $
036: */
037: public interface XmlRpcService extends Service {
038: /** TurbineXmlRpcService. */
039: String SERVICE_NAME = "XmlRpcService";
040:
041: /**
042: * Execute a remote procedure call.
043: *
044: * @param url A URL.
045: * @param methodName A String with the method name.
046: * @param params A Vector with the parameters.
047: * @return An Object.
048: * @exception TurbineException
049: */
050: Object executeRpc(URL url, String methodName, Vector params)
051: throws TurbineException;
052:
053: /**
054: * Execute a remote procedure call taht requires
055: * authentication.
056: *
057: * @param url A URL.
058: * @param username The username to authenticate with
059: * @param password The password to authenticate with
060: * @param methodName A String with the method name.
061: * @param params A Vector with the parameters.
062: * @return An Object.
063: * @exception TurbineException
064: */
065: Object executeAuthenticatedRpc(URL url, String username,
066: String password, String methodName, Vector params)
067: throws TurbineException;
068:
069: /**
070: * Register an object as a handler for the XmlRpc Server part.
071: *
072: * @param handlerName The name under which we want
073: * to register the service
074: * @param handler The handler object
075: */
076: void registerHandler(String handlerName, Object handler);
077:
078: /**
079: * Register an object as a the default handler for
080: * the XmlRpc Server part.
081: *
082: * @param handler The handler object
083: */
084: void registerHandler(Object handler);
085:
086: /**
087: * Unregister a handler.
088: *
089: * @param handlerName The name of the handler to unregister.
090: */
091: void unregisterHandler(String handlerName);
092:
093: /**
094: * Handle an XML-RPC request using the encapsulated server.
095: *
096: * You can use this method to handle a request from within
097: * a Turbine screen.
098: *
099: * @param is the stream to read request data from.
100: * @return the response body that needs to be sent to the client.
101: */
102: byte[] handleRequest(InputStream is);
103:
104: /**
105: * Handle an XML-RPC request using the encapsulated server with user
106: * authentication.
107: *
108: * You can use this method to handle a request from within
109: * a Turbine screen.
110: *
111: * <p> Note that the handlers need to implement AuthenticatedXmlRpcHandler
112: * interface to access the authentication infomration.
113: *
114: * @param is the stream to read request data from.
115: * @param user the user that is making the request.
116: * @param password the password given by user.
117: * @return the response body that needs to be sent to the client.
118: */
119: byte[] handleRequest(InputStream is, String user, String password);
120:
121: /**
122: * Method to allow a client to send a file to a server.
123: *
124: * @param serverURL
125: * @param sourceLocationProperty
126: * @param sourceFileName
127: * @param destinationLocationProperty
128: * @param destinationFileName
129: * @throws TurbineException
130: * @deprecated This is not scope of the Service itself but of an
131: * application which uses the service.
132: */
133: void send(String serverURL, String sourceLocationProperty,
134: String sourceFileName, String destinationLocationProperty,
135: String destinationFileName) throws TurbineException;
136:
137: /**
138: * Method to allow a client to send a file to a server that
139: * requires authentication
140: *
141: * @param serverURL
142: * @param username
143: * @param password
144: * @param sourceLocationProperty
145: * @param sourceFileName
146: * @param destinationLocationProperty
147: * @param destinationFileName
148: * @throws TurbineException
149: * @deprecated This is not scope of the Service itself but of an
150: * application which uses the service.
151: */
152: void send(String serverURL, String username, String password,
153: String sourceLocationProperty, String sourceFileName,
154: String destinationLocationProperty,
155: String destinationFileName) throws TurbineException;
156:
157: /**
158: * Method to allow a client to send a file to a server.
159: *
160: * @param serverURL
161: * @param sourceLocationProperty
162: * @param sourceFileName
163: * @param destinationLocationProperty
164: * @param destinationFileName
165: * @throws TurbineException
166: * @deprecated This is not scope of the Service itself but of an
167: * application which uses the service.
168: */
169: void get(String serverURL, String sourceLocationProperty,
170: String sourceFileName, String destinationLocationProperty,
171: String destinationFileName) throws TurbineException;
172:
173: /**
174: * Method to allow a client to send a file to a server that
175: * requires authentication
176: *
177: * @param serverURL
178: * @param username
179: * @param password
180: * @param sourceLocationProperty
181: * @param sourceFileName
182: * @param destinationLocationProperty
183: * @param destinationFileName
184: * @throws TurbineException
185: * @deprecated This is not scope of the Service itself but of an
186: * application which uses the service.
187: */
188: void get(String serverURL, String username, String password,
189: String sourceLocationProperty, String sourceFileName,
190: String destinationLocationProperty,
191: String destinationFileName) throws TurbineException;
192:
193: /**
194: * Method to allow a client to remove a file from
195: * the server
196: *
197: * @param serverURL
198: * @param sourceLocationProperty
199: * @param sourceFileName
200: * @throws TurbineException
201: * @deprecated This is not scope of the Service itself but of an
202: * application which uses the service.
203: */
204: void remove(String serverURL, String sourceLocationProperty,
205: String sourceFileName) throws TurbineException;
206:
207: /**
208: * Method to allow a client to remove a file from
209: * a server that requires authentication
210: *
211: * @param serverURL
212: * @param username
213: * @param password
214: * @param sourceLocationProperty
215: * @param sourceFileName
216: * @throws TurbineException
217: * @deprecated This is not scope of the Service itself but of an
218: * application which uses the service.
219: */
220: void remove(String serverURL, String username, String password,
221: String sourceLocationProperty, String sourceFileName)
222: throws TurbineException;
223:
224: /**
225: * Switch client filtering on/off.
226: *
227: * @param state
228: * @see #acceptClient(java.lang.String)
229: * @see #denyClient(java.lang.String)
230: */
231: void setParanoid(boolean state);
232:
233: /**
234: * Add an IP address to the list of accepted clients. The parameter can
235: * contain '*' as wildcard character, e.g. "192.168.*.*". You must
236: * call setParanoid(true) in order for this to have
237: * any effect.
238: *
239: * @param address
240: * @see #denyClient(java.lang.String)
241: * @see #setParanoid(boolean)
242: */
243: void acceptClient(String address);
244:
245: /**
246: * Add an IP address to the list of denied clients. The parameter can
247: * contain '*' as wildcard character, e.g. "192.168.*.*". You must call
248: * setParanoid(true) in order for this to have any effect.
249: *
250: * @param address
251: * @see #acceptClient(java.lang.String)
252: * @see #setParanoid(boolean)
253: */
254: void denyClient(String address);
255:
256: }
|