com.vhosting.netconf
Class Operation

java.lang.Object
  extended by com.vhosting.netconf.Operation
Direct Known Subclasses:
CloseSession, Commit, CopyConfig, CreateSubscription, DeleteConfig, DiscardChanges, EditConfig, Get, GetConfig, KillSession, Load, Lock, NoOp, PartialLock, PartialUnlock, Restart, Shutdown, Unlock, Validate

public abstract class Operation
extends java.lang.Object

This class provides the basis for the construction of a specific RPC operation, with its own features, whose operation is conditioned by the capabilities made available to the server.

Version:
1.00, 02/11/2010
Author:
Giuseppe Palmeri

Nested Class Summary
 class Operation.Reply
          Represents the specific reply for the operation.
 
Field Summary
protected  Rpc operation
          The RPC operation reference.
protected  Session session
          The active session reference.
 
Constructor Summary
Operation(Session session)
          Constructs an instance of the operation assigning it to an active session.
 
Method Summary
 int execute(RpcHandler handler)
          Allows you to execute the operation, through the use of a RpcHandler.
 void execute(RpcHandler handler, RpcReplySpecificListener listener)
          Allows you to execute the operation, through the use of a RpcHandler specifying a listener that will intercept the RPC reply.
 RpcReply executeSync(RpcHandler handler)
          Allows you to execute the operation, through the use of a RpcHandler and waits until you get a reply.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

operation

protected Rpc operation
The RPC operation reference. The reference of the operation need to be enhanced in the constructor of the subclass.
 Example:
 
 public class Get extends Command {
 
 public Get(Session session) {
    super(session);
    
    // Assignmet of operation.
   operation = new Rpc(Session.BASE_1_0, "get");
 }
 
 ...
 


session

protected Session session
The active session reference.

Constructor Detail

Operation

public Operation(Session session)
Constructs an instance of the operation assigning it to an active session. A subclass must necessarily use this constructor:
 super(session);
 
In each manufacturer as its first statement.

Parameters:
session - The active session.
Method Detail

execute

public final int execute(RpcHandler handler)
                  throws java.io.IOException
Allows you to execute the operation, through the use of a RpcHandler. The execution takes place asynchronously. The RPC reply can be intercepted using the method: RpcHandler.setRpcReplyListener(RpcReplyListener listener);

Parameters:
handler - The RPC handler.
Returns:
The identifier of the message sent; useful to intercept the associated RPC reply.
Throws:
java.io.IOException - Throws this exception when the connection is no longer active before and during the exchange of messages.
See Also:
RpcHandler.setRpcReplyListener(RpcReplyListener listener)

execute

public final void execute(RpcHandler handler,
                          RpcReplySpecificListener listener)
                   throws java.io.IOException
Allows you to execute the operation, through the use of a RpcHandler specifying a listener that will intercept the RPC reply. The execution takes place asynchronously.

Parameters:
handler - The RPC handler.
listener - The listener that will intercept the RPC reply.
Throws:
java.io.IOException - Throws this exception when the connection is no longer active before and during the exchange of messages.

executeSync

public final RpcReply executeSync(RpcHandler handler)
                           throws java.io.IOException
Allows you to execute the operation, through the use of a RpcHandler and waits until you get a reply.

Parameters:
handler - The RPC handler.
Returns:
The RPC reply.
Throws:
java.io.IOException - Throws this exception when the connection is no longer active before and during the exchange of messages.