1 /* 2 * Copyright the original author or authors. 3 * 4 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.mozilla.org/MPL/MPL-1.1.html 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 import org.as2lib.core.BasicInterface; 18 import org.as2lib.io.conn.core.event.MethodInvocationErrorListener; 19 20 /** 21 * {@code ServerServiceProxy} handles client requests to a certain service and its 22 * responses. 23 * 24 * @author Simon Wacker 25 * @author Christoph Atteneder 26 */ 27 interface org.as2lib.io.conn.core.server.ServerServiceProxy extends BasicInterface { 28 29 /** 30 * Runs the service and listens for requests of clients. 31 * 32 * @param host the host to run this service on 33 */ 34 public function run(host:String):Void; 35 36 /** 37 * Stops this service. 38 */ 39 public function stop(Void):Void; 40 41 /** 42 * @overload #invokeMethodByNameAndArguments 43 * @overload #invokeMethodByNameAndArgumentsAndResponseService 44 */ 45 public function invokeMethod():Void; 46 47 /** 48 * Invokes the service method corresponding to the passed-in {@code methodName} on 49 * the actaul service object, passing the content of {@code args} array as parameters. 50 * 51 * @param methodName the name of the service method to invoke 52 * @param args arguments to pass-to the method 53 */ 54 public function invokeMethodByNameAndArguments(methodName:String, args:Array):Void; 55 56 /** 57 * Invokes the service method corresponding to the passed-in {@code methodName} on 58 * the actual service object and returns the response to the client using the 59 * passed-in {@code responseServiceUrl}. 60 * 61 * @param methodName name of method to invoke on the service 62 * @param args arguments to pass to the method 63 * @param responseServiceUrl the url of response service to which the result is sent 64 */ 65 public function invokeMethodByNameAndArgumentsAndResponseService(methodName:String, args:Array, responseServiceUrl:String):Void; 66 67 /** 68 * Returns the actual service this proxy wraps. 69 * 70 * @return the wrapped service 71 */ 72 public function getService(Void); 73 74 /** 75 * Returns the path on the host of this service. 76 * 77 * @return the path of this service 78 */ 79 public function getPath(Void):String; 80 81 /** 82 * Indicates whether this service is currently running. 83 * 84 * @return {@code true} if this service runs else {@code false} 85 */ 86 public function isRunning(Void):Boolean; 87 88 /** 89 * Adds a new error listener to listen for errors that may occur when trying to 90 * invoke a method on this service. 91 * 92 * @param errorListener the error listener to add 93 * @see #removeErrorListener 94 */ 95 public function addErrorListener(errorListener:MethodInvocationErrorListener):Void; 96 97 /** 98 * Removes an added error listener. 99 * 100 * @param errorListener the error listener to remove 101 * @see #addErrorListener 102 */ 103 public function removeErrorListener(errorListener:MethodInvocationErrorListener):Void; 104 105 }