org.red5.server.service

## Class Call

- java.lang.Object
- - org.red5.server.service.Call

All Implemented Interfaces:
  Externalizable, Serializable, IServiceCall

Direct Known Subclasses:
  PendingCall

    public class Call
    extends Object
    implements IServiceCall, Externalizable

Basic service call (remote call) implementation

Author:
  The Red5 Project (red5@osflash.org), Luke Hubbard, Codegent Ltd (luke@codegent.com)
See Also:
  Serialized Form

### Field Summary

Fields
`protected Object[]` `arguments` Call arguments
`protected Exception` `exception` Call exception if any, null by default
`protected String` `serviceMethodName` Service method name
`protected String` `serviceName` Service name
`protected byte` `status` Call status, initial one is pending
`static byte` `STATUS_ACCESS_DENIED` Access denied constant
`static byte` `STATUS_APP_SHUTTING_DOWN` The application for this service is currently shutting down
`static byte` `STATUS_GENERAL_EXCEPTION` General exception constant
`static byte` `STATUS_INVOCATION_EXCEPTION` Exception on invocation constant
`static byte` `STATUS_METHOD_NOT_FOUND` Service's method not found constant
`static byte` `STATUS_NOT_CONNECTED` The remote method cannot be invoked because the client is not connected.
`static byte` `STATUS_PENDING` Pending status constant
`static byte` `STATUS_SERVICE_NOT_FOUND` Service not found constant
`static byte` `STATUS_SUCCESS_NULL` Returned value is null constant
`static byte` `STATUS_SUCCESS_RESULT` Success result constant
`static byte` `STATUS_SUCCESS_VOID` Service returns no value constant

### Constructor Summary

Constructors
Constructor and Description
`Call()`
`Call(String method)` Creates call from method name
`Call(String method, Object[] args)` Creates call from method name and array of call parameters
`Call(String name, String method, Object[] args)` Creates call from given service name, method name and array of call parameters

### Method Summary

Methods
`Object[]` `getArguments()` Returns array of service method arguments
`Exception` `getException()` Get service call exception
`long` `getReadTime()` Returns the time stamp at which this object was deserialized.
`String` `getServiceMethodName()` Returns service method name
`String` `getServiceName()` Returns service name
`byte` `getStatus()` Get service call status
`long` `getWriteTime()` Returns the time stamp at which this object was serialized.
`boolean` `isSuccess()` Whether call was successful or not
`void` `readExternal(ObjectInput in)`
`void` `setArguments(Object[] args)` Setter for arguments.
`void` `setException(Exception exception)` Sets exception
`void` `setServiceMethodName(String serviceMethodName)` Setter for service method name
`void` `setServiceName(String serviceName)` Setter for service name
`void` `setStatus(byte status)` Sets status
`String` `toString()`
`void` `writeExternal(ObjectOutput out)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### STATUS_PENDING

    public static final byte STATUS_PENDING

Pending status constant

See Also:
  Constant Field Values

#### STATUS_SUCCESS_RESULT

    public static final byte STATUS_SUCCESS_RESULT

Success result constant

See Also:
  Constant Field Values

#### STATUS_SUCCESS_NULL

    public static final byte STATUS_SUCCESS_NULL

Returned value is null constant

See Also:
  Constant Field Values

#### STATUS_SUCCESS_VOID

    public static final byte STATUS_SUCCESS_VOID

Service returns no value constant

See Also:
  Constant Field Values

#### STATUS_SERVICE_NOT_FOUND

    public static final byte STATUS_SERVICE_NOT_FOUND

Service not found constant

See Also:
  Constant Field Values

#### STATUS_METHOD_NOT_FOUND

    public static final byte STATUS_METHOD_NOT_FOUND

Service's method not found constant

See Also:
  Constant Field Values

#### STATUS_ACCESS_DENIED

    public static final byte STATUS_ACCESS_DENIED

Access denied constant

See Also:
  Constant Field Values

#### STATUS_INVOCATION_EXCEPTION

    public static final byte STATUS_INVOCATION_EXCEPTION

Exception on invocation constant

See Also:
  Constant Field Values

#### STATUS_GENERAL_EXCEPTION

    public static final byte STATUS_GENERAL_EXCEPTION

General exception constant

See Also:
  Constant Field Values

#### STATUS_APP_SHUTTING_DOWN

    public static final byte STATUS_APP_SHUTTING_DOWN

The application for this service is currently shutting down

See Also:
  Constant Field Values

#### STATUS_NOT_CONNECTED

    public static final byte STATUS_NOT_CONNECTED

The remote method cannot be invoked because the client is not connected. NOTE that it is possible that this error is returned in the situation where the method has been invoked on the server the connection has failed before the result returned could be read. There is no way to establish whether this has happened.

See Also:
  Constant Field Values

#### serviceName

    protected String serviceName

Service name

#### serviceMethodName

    protected String serviceMethodName

Service method name

#### arguments

    protected Object[] arguments

Call arguments

#### status

    protected byte status

Call status, initial one is pending

#### exception

    protected Exception exception

Call exception if any, null by default

### Constructor Detail

#### Call

    public Call()

#### Call

    public Call(String method)

Creates call from method name

Parameters:
  `method` - Method name

#### Call

    public Call(String method,
        Object[] args)

Creates call from method name and array of call parameters

Parameters:
  `method` - Method name
  `args` - Call parameters

#### Call

    public Call(String name,
        String method,
        Object[] args)

Creates call from given service name, method name and array of call parameters

Parameters:
  `name` - Service name
  `method` - Service method name
  `args` - Call parameters

### Method Detail

#### isSuccess

    public boolean isSuccess()

Whether call was successful or not

Specified by:
  `isSuccess` in interface `IServiceCall`
Returns:
  `true` on success, `false` otherwise

#### getServiceMethodName

    public String getServiceMethodName()

Returns service method name

Specified by:
  `getServiceMethodName` in interface `IServiceCall`
Returns:
  Service method name as string

#### setServiceMethodName

    public void setServiceMethodName(String serviceMethodName)

Setter for service method name

Parameters:
  `serviceMethodName` - New service method name value

#### getServiceName

    public String getServiceName()

Returns service name

Specified by:
  `getServiceName` in interface `IServiceCall`
Returns:
  Service name

#### setServiceName

    public void setServiceName(String serviceName)

Setter for service name

Parameters:
  `serviceName` - New service name value

#### getArguments

    public Object[] getArguments()

Returns array of service method arguments

Specified by:
  `getArguments` in interface `IServiceCall`
Returns:
  array of service method arguments

#### setArguments

    public void setArguments(Object[] args)

Setter for arguments.

Parameters:
  `args` - Arguments.

#### getStatus

    public byte getStatus()

Get service call status

Specified by:
  `getStatus` in interface `IServiceCall`
Returns:
  service call status

#### setStatus

    public void setStatus(byte status)

Sets status

Specified by:
  `setStatus` in interface `IServiceCall`
Parameters:
  `status` - Status as byte

#### getReadTime

    public long getReadTime()

Returns the time stamp at which this object was deserialized.

Specified by:
  `getReadTime` in interface `IServiceCall`
Returns:
  the readTime

#### getWriteTime

    public long getWriteTime()

Returns the time stamp at which this object was serialized.

Specified by:
  `getWriteTime` in interface `IServiceCall`
Returns:
  the writeTime

#### getException

    public Exception getException()

Get service call exception

Specified by:
  `getException` in interface `IServiceCall`
Returns:
  service call exception

#### setException

    public void setException(Exception exception)

Sets exception

Specified by:
  `setException` in interface `IServiceCall`
Parameters:
  `exception` - Call exception

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

#### readExternal

    public void readExternal(ObjectInput in)
                      throws IOException,
                             ClassNotFoundException

Specified by:
  `readExternal` in interface `Externalizable`
Throws:
  `IOException`
  `ClassNotFoundException`

#### writeExternal

    public void writeExternal(ObjectOutput out)
                       throws IOException

Specified by:
  `writeExternal` in interface `Externalizable`
Throws:
  `IOException`