uk.ac.starlink.astrogrid
Class AcrConnection

java.lang.Object
  extended by uk.ac.starlink.connect.Connection
      extended by uk.ac.starlink.astrogrid.AcrConnection

public class AcrConnection
extends Connection

Connection to an ACR server.

Since:
9 Sep 2005
Author:
Mark Taylor

Field Summary
static String ACR_FILE
          Location in the user's home directory of the ACR rendezvous file.
static int HTTP_CHUNK
          Number of bytes per chunk used in HTTP streamed output.
 
Constructor Summary
AcrConnection(AcrConnector connector)
          Constructor.
 
Method Summary
 Object execute(String cmd, Object[] args)
          Executes an XML-RPC command.
 boolean getCacheDirectories()
           
 String getHome()
          Return the URI of the user's home directory for this connection.
 OutputStream getOutputStream(String outUri)
          Returns an output stream which can be used to write to a URI representing a location in MySpace (an Ivorn).
 Branch getRoot()
          Returns the root of the remote filesystem provided by this connection.
static URL getServerURL()
          Returns the URL of the ACR server, if there is one.
 boolean isConnected()
          Indicates whether this connection is currently up and running.
 void logOut()
          Closes this connection.
 void setCacheDirectories(boolean cache)
           
 
Methods inherited from class uk.ac.starlink.connect.Connection
getAuthValue, getConnector, setLogoutOnExit, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACR_FILE

public static String ACR_FILE
Location in the user's home directory of the ACR rendezvous file.


HTTP_CHUNK

public static int HTTP_CHUNK
Number of bytes per chunk used in HTTP streamed output.

Constructor Detail

AcrConnection

public AcrConnection(AcrConnector connector)
              throws IOException
Constructor.

Parameters:
connector - connector instance which dispatched this connection, if any
Throws:
IOException
Method Detail

isConnected

public boolean isConnected()
Description copied from class: Connection
Indicates whether this connection is currently up and running. Hopefully it will return true until Connection.logOut() has been called, but it's possible that the connection may expire for some reason before that.

Specified by:
isConnected in class Connection

getRoot

public Branch getRoot()
Description copied from class: Connection
Returns the root of the remote filesystem provided by this connection. This method should not do work, but only return an existing branch (acquired at login time); that is the root branch should not be constructed lazily.

Specified by:
getRoot in class Connection
Returns:
root of the virtual filesystem associated with this connection

logOut

public void logOut()
Description copied from class: Connection
Closes this connection.

Specified by:
logOut in class Connection

getHome

public String getHome()
Return the URI of the user's home directory for this connection.

Returns:
home directory ivo: URI

getCacheDirectories

public boolean getCacheDirectories()

setCacheDirectories

public void setCacheDirectories(boolean cache)

execute

public Object execute(String cmd,
                      Object[] args)
               throws IOException
Executes an XML-RPC command. If the result represents an array of arguments, it will be an Object[] array. If it represents a struct, it will be a Map. An IOException will be thrown if anything goes wrong.

Parameters:
cmd - fully-qualified command name
args - array of arguments to pass to the XML-RPC service
Returns:
result of execution
Throws:
IOException

getOutputStream

public OutputStream getOutputStream(String outUri)
                             throws IOException
Returns an output stream which can be used to write to a URI representing a location in MySpace (an Ivorn).

Parameters:
outUri - output URI
Returns:
output stream which will write data to the location represented by outUri
Throws:
IOException

getServerURL

public static URL getServerURL()
                        throws IOException
Returns the URL of the ACR server, if there is one. The URL is read from the ACR_FILE file in the user's home directory.

Returns:
ACR server URL
Throws:
IOException - if the URL can't be found


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.