de.unido.ls5.eti.client
Class EtiConnectionSepp

java.lang.Object
  extended by de.unido.ls5.eti.client.EtiConnectionSepp
All Implemented Interfaces:
EtiConnection

public class EtiConnectionSepp
extends Object
implements EtiConnection

A jETI-connection for SEPP, the Streaming Eti Performance Protocol. SEPP is a very simple byte-monging TCP-based protocol.

Rating red

Constructor Summary
EtiConnectionSepp(URI uri)
          Saves the URI for later use and creates temporary directory.
 
Method Summary
 void endSession()
          Ends the currently used session.
 void exec(String tool, Map<String,String> parameters)
          Execute the given tool with the given parameters.
 void exec(String tool, String... parameters)
          Executes tool at the server with the given parameter.
 void forward(List<String> filenames, EtiConnection toServer)
          Delegate to forward(Set, EtiConnection).
 void forward(Set<String> filenames, EtiConnection toServer)
          Tell the server to forward the specified files to another server.
 URI getServerURI()
          Retrieve the server's URI of this connection
 String getSession()
          Retrieve the sessionId of this connection.
 void login(String username, String password)
          Create a session on the server.
 List<VirtualFile> retrieve(List<String> filenames)
          Delegate to retrieve(Set).
 Set<VirtualFile> retrieve(Set<String> filenames)
          Retrieve the named files from the server.
 VirtualFile retrieve(String filename)
          Delegates to retrieve(Set).
 void setSession(String sessionId)
          Sets the session ID of this connection.
 void store(List<VirtualFile> files)
          Delegate to store(Set).
 void store(Set<VirtualFile> files)
          Store the named files on the server.
 void store(VirtualFile file)
          Delegates to store(Set).
 String toString()
          Returns "EtiConnectionSepp($sessionid)".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EtiConnectionSepp

public EtiConnectionSepp(URI uri)
Saves the URI for later use and creates temporary directory. Nothing unusual.

Parameters:
uri - The endpoint of this Connection.
Method Detail

endSession

public void endSession()
                throws EtiLocalException,
                       EtiRemoteException
Ends the currently used session.

Specified by:
endSession in interface EtiConnection
Throws:
EtiLocalException - if the error occured on client-side
EtiRemoteException - if the Error was generated by the jETI Server

exec

public void exec(String tool,
                 Map<String,String> parameters)
          throws EtiLocalException,
                 EtiRemoteException
Execute the given tool with the given parameters.

Specified by:
exec in interface EtiConnection
Parameters:
tool - the tool to execute.
parameters - the key-value-paired parameters to use.
Throws:
EtiLocalException - if anything goes wrong with the connection (IOException).
EtiRemoteException - if the server sends an error code and message.

retrieve

public List<VirtualFile> retrieve(List<String> filenames)
                           throws EtiLocalException,
                                  EtiRemoteException
Delegate to retrieve(Set).

Specified by:
retrieve in interface EtiConnection
Parameters:
filenames - List of virtual filenames to retrieve.
Returns:
the retrieved files
Throws:
EtiLocalException - if something goes wrong on client side.
EtiRemoteException - if something goes wrong on server side.

retrieve

public Set<VirtualFile> retrieve(Set<String> filenames)
                          throws EtiLocalException,
                                 EtiRemoteException
Retrieve the named files from the server.

Specified by:
retrieve in interface EtiConnection
Parameters:
filenames - the files to retrieve.
Returns:
the lst of retrieved files.
Throws:
EtiLocalException - if anything goes wrong with the connection (IOException).
EtiRemoteException - if the server sends an error code and message.

store

public void store(List<VirtualFile> files)
           throws EtiLocalException,
                  EtiRemoteException
Delegate to store(Set).

Specified by:
store in interface EtiConnection
Parameters:
files - the list of files to store
Throws:
EtiLocalException - if something goes wrong on client side.
EtiRemoteException - if something goes wrong on server side.

store

public void store(Set<VirtualFile> files)
           throws EtiLocalException,
                  EtiRemoteException
Store the named files on the server.

Specified by:
store in interface EtiConnection
Parameters:
files - the files to send.
Throws:
EtiLocalException - if anything goes wrong with the connection (IOException).
EtiRemoteException - if the server sends an error code and message.

forward

public void forward(List<String> filenames,
                    EtiConnection toServer)
             throws EtiLocalException,
                    EtiRemoteException
Delegate to forward(Set, EtiConnection).

Specified by:
forward in interface EtiConnection
Parameters:
filenames - list of virtual filenames that shall be forwarded.
toServer - An existing connection to the server where the files shall be forwarded to.
Throws:
EtiLocalException
EtiRemoteException

forward

public void forward(Set<String> filenames,
                    EtiConnection toServer)
             throws EtiLocalException,
                    EtiRemoteException
Tell the server to forward the specified files to another server.

Specified by:
forward in interface EtiConnection
Parameters:
filenames - the files to forward.
toServer - the server to send the files to.
Throws:
EtiLocalException - if anything goes wrong with the connection (IOException).
EtiRemoteException - if the server sends an error code and message.

getServerURI

public URI getServerURI()
Description copied from interface: EtiConnection
Retrieve the server's URI of this connection

Specified by:
getServerURI in interface EtiConnection
Returns:
the server's URI

getSession

public String getSession()
Description copied from interface: EtiConnection
Retrieve the sessionId of this connection. This should usually onyl be needed for debugging purposes.

Specified by:
getSession in interface EtiConnection
Returns:
the session ID at the tool server

login

public void login(String username,
                  String password)
           throws EtiLocalException,
                  EtiRemoteException
Create a session on the server. Authentication is not supported by the server at the moment. Username and password have to be supplied anyway.

Specified by:
login in interface EtiConnection
Parameters:
username - the username to send.
password - the password to send.
Throws:
EtiLocalException - if anything goes wrong with the connection (IOException).
EtiRemoteException - if the server sends an error code and message.

setSession

public void setSession(String sessionId)
Description copied from interface: EtiConnection
Sets the session ID of this connection. Method is needed to create a new Connection Object for an already existing Server Session, currently used by EtiServer's forward function

Specified by:
setSession in interface EtiConnection
Parameters:
sessionId - the session Id to set.

exec

public void exec(String tool,
                 String... parameters)
          throws EtiLocalException,
                 EtiRemoteException
Description copied from interface: EtiConnection
Executes tool at the server with the given parameter. Note that non-String parameters must be appropriately serialized into Strings. This is a convenience method using varargs that can be used in case of a few hardcoded parameters. Internally, it might simly use EtiConnection.exec(String, Map) (depending on implementation).

Specified by:
exec in interface EtiConnection
parameters - alternating key,value,key,value,... sequence of parameters
Throws:
EtiLocalException - if size of parameters is not even
EtiRemoteException

retrieve

public VirtualFile retrieve(String filename)
                     throws EtiLocalException,
                            EtiRemoteException
Delegates to retrieve(Set).

Specified by:
retrieve in interface EtiConnection
Parameters:
filename - virtual filename to retrieve.
Returns:
the retrieved file
Throws:
EtiLocalException - if something goes wrong on client side.
EtiRemoteException - if something goes wrong on server side.

store

public void store(VirtualFile file)
           throws EtiLocalException,
                  EtiRemoteException
Delegates to store(Set).

Specified by:
store in interface EtiConnection
Parameters:
file - the file to store
Throws:
EtiLocalException - if something goes wrong on client side.
EtiRemoteException - if something goes wrong on server side.

toString

public String toString()
Returns "EtiConnectionSepp($sessionid)".

Overrides:
toString in class Object