at.spardat.xma.rpc.RemoteCall Maven / Gradle / Ivy
/*******************************************************************************
* Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* s IT Solutions AT Spardat GmbH - initial API and implementation
*******************************************************************************/
// @(#) $Id: RemoteCall.java 2089 2007-11-28 13:56:13Z s3460 $
package at.spardat.xma.rpc;
import at.spardat.enterprise.exc.BaseException;
import at.spardat.xma.rpc.RemoteCallData.CallMeasurement;
/**
* Client and server side abstraction of a remote call, i.e., a call from
* XMA client to XMA server.
*
* @author YSD, 14.05.2003 21:30:35
*/
public abstract class RemoteCall extends RemoteOperation {
/**
* The data actually transferred from client to the server
*/
protected RemoteCallData data_;
/**
* Default constructor.
*/
protected RemoteCall () {
data_ = new RemoteCallData();
}
/**
* Returns the data for package internal use
*/
public RemoteCallData getCallData () {
return data_;
}
/**
* Returns the name of the server side event method that will be called as
* provided at construction time.
*/
public String getEventName () {
return data_.eventName_;
}
/**
* Adds a parameter to this call that is transferred to the server and may
* be accessed via getParameter there.
*
* Note that this feature is usually not necessary with XMA since data
* is automatically transferred via widget models. You should ask yourself
* seriously if you are doing things right.
*
* @param id a numeric id of the parameter. Must not be less than zero and greater than 127.
* @param parameter the parameter data which has to implement java.io.Serializable
* and must be successfully be serialized. It cannot be null.
* @throws IllegalArgumentException if any before mentioned condition is violated.
*/
public void setParameter (int id, Object parameter) {
data_.setParameter (id, parameter);
}
/**
* Retrieves a parameter for a given id.
*
* @param id the id that has been used in setParameter.
* @return the same object set via setParameter or null if there
* is no parameter with the given id.
*/
public Object getParameter (int id) {
return data_.getParameter (id);
}
/**
* Executes this RemoteCall. The call is made to the server, the server side
* event method is executed.
*
* @return A RemoteReply object optionally holding parameters you have set
* at the server side.
* @throws BaseException all exceptions from the server side event method are
* packed into BaseExceptions and thrown again here. If the server side
* event method already throws an BaseException, is is not wrapped
* in an BaseException again.
*/
public RemoteReply execute () throws BaseException {
throw new IllegalStateException();
}
/**
* Returns the measurement of the previos RPC.
*/
public CallMeasurement getLastClientMeasurement() {
return data_.getLastMeasurement();
}
}