Ila

org.topoweb.ila.server
Class Request

java.lang.Object
  |
  +--org.topoweb.ila.server.Request

public class Request
extends java.lang.Object

A basic unit of processing. Instances of this class are enqueued to be processed by a RequestProcessor instance. The reason why we have this class is that we have 2 general types of events to process in the same thread:

  1. Remote events.

    These are events generated as a result of a remote entity such as a client or another Ila server communicating with over the network.

  2. Local events.

    These are locally generated events that maintain, update or monitor the local Ila subsytem.

Since both of these types of events are pushed on the same queue, we need a class that represents both.

Author:
Babak Farhang

Constructor Summary
Request(IlaSession session)
          Creates a remote instance with the given session.
Request(Instruction instruction)
          Creates a local instance with the given instruction.
 
Method Summary
 Instruction getInstruction()
          Returns the instruction if the instance is "local".
 IlaSession getSession()
          Returns the session if the instance is "remote".
 boolean isLocal()
          Tests whether this instance represents a local event.
 boolean isRemote()
          Tests whether this instance represents a remote event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Request

public Request(Instruction instruction)
Creates a local instance with the given instruction. The isLocal method returns true.

Parameters:
instruction - the local unit of processing
Throws:
java.lang.IllegalArgumentException - if the argument is null

Request

public Request(IlaSession session)
Creates a remote instance with the given session. The isRemote method returns true.

Parameters:
session - the remote unit of processing
Throws:
java.lang.IllegalArgumentException - if the argument is null
Method Detail

isLocal

public boolean isLocal()
Tests whether this instance represents a local event. If true, the getInstruction method will return a non-null value.

Returns:
true, if this instance represents an instruction; false, o.w.
See Also:
getInstruction()

isRemote

public boolean isRemote()
Tests whether this instance represents a remote event. If true, the getSession method will return a non-null value.

Returns:
true, if this instance represents a session; false, o.w.
See Also:
getSession()

getSession

public IlaSession getSession()
Returns the session if the instance is "remote".

Returns:
an IlaSession, if this is a remote instance; null, o.w.
See Also:
isRemote()

getInstruction

public Instruction getInstruction()
Returns the instruction if the instance is "local".

Returns:
an Instruction, if this is a local instance; null, o.w.
See Also:
isLocal()

Ila

Copyright (C) 2002 Babak Farhang

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.