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.MethodInvocationCallback;
    19  
    20  /**
    21   * {@code ClientServiceProxy} 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.client.ClientServiceProxy extends BasicInterface {
    28  	
    29  	/**
    30  	 * @overload #invokeByName
    31  	 * @overload #invokeByNameAndArguments
    32  	 * @overload #invokeByNameAndCallback
    33  	 * @overload #invokeByNameAndArgumentsAndCallback
    34  	 */
    35  	public function invoke():MethodInvocationCallback;
    36  	
    37  	/**
    38  	 * Invokes the method with passed-in {@code methodName} on the service.
    39  	 * 
    40  	 * @param methodName the name of the method to invoke
    41  	 * @return a callback that can be used to get informed of the response
    42  	 */
    43  	public function invokeByName(methodName:String):MethodInvocationCallback;
    44  	
    45  	/**
    46  	 * Invokes the method with passed-in {@code methodName} on the service, passing the
    47  	 * given {@code args}.
    48  	 * 
    49  	 * @param methodName the name of the method to invoke
    50  	 * @param args the arguments to pass to the method
    51  	 * @return a callback that can be used to get informed of the response
    52  	 */
    53  	public function invokeByNameAndArguments(methodName:String, args:Array):MethodInvocationCallback;
    54  	
    55  	/**
    56  	 * Invokes the method with passed-in {@code methodName} on the service.
    57  	 * 
    58  	 * <p>When the response arrives the appropriate callback method is invoked.
    59  	 *
    60  	 * <p>If the passed-in {@code callback} is not {@code null} or {@code undefined},
    61  	 * the returned callback is the same.
    62  	 * 
    63  	 * @param methodName the name of the method to invoke
    64  	 * @param callback the callback that receives the return value or errors
    65  	 * @return a callback that can be used to get informed of the response
    66  	 */
    67  	public function invokeByNameAndCallback(methodName:String, callback:MethodInvocationCallback):MethodInvocationCallback;
    68  	
    69  	/**
    70  	 * Invokes the method with passed-in {@code methodName} on the service, passing the
    71  	 * arguments.
    72  	 * 
    73  	 * <p>When the response arrives the appropriate callback method is invoked.
    74  	 *
    75  	 * <p>If the passed-in {@code callback} is not {@code null} or {@code undefined},
    76  	 * the returned callback is the same.
    77  	 *
    78  	 * @param methodName the name of the method to be invoked
    79  	 * @param args the arguments to pass to the method
    80  	 * @param callback the callback to receive the response or possible failures
    81  	 * @return a callback that can be used to get informed of the response
    82  	 */
    83  	public function invokeByNameAndArgumentsAndCallback(methodName:String, args:Array, callback:MethodInvocationCallback):MethodInvocationCallback;
    84  	
    85  }