com.rackspacecloud.client.cloudfiles
Class FilesContainer

java.lang.Object
  extended by com.rackspacecloud.client.cloudfiles.FilesContainer
Direct Known Subclasses:
FilesContainerExt

public class FilesContainer
extends java.lang.Object


Field Summary
protected  FilesClient client
           
protected static org.apache.log4j.Logger logger
           
protected  java.lang.String name
           
protected  java.util.List<FilesObject> objects
           
 
Constructor Summary
FilesContainer(java.lang.String name, FilesClient client)
           
FilesContainer(java.lang.String name, java.util.List<FilesObject> objs, FilesClient client)
          Note, this does not actually create a container on the server
 
Method Summary
 boolean addObject(java.io.File f, java.lang.String mimeType)
          Adds a new object to the container
 void createContainer()
          Creates the container represented by this instance on the server
 FilesClient getClient()
          Returns the instance of the client we're using
 FilesContainerInfo getInfo()
          Get useful information on this container
 java.lang.String getName()
          Get the name of the container
 java.util.List<FilesObject> getObjects()
          Returns the contents of this container
 java.util.List<FilesObject> getObjects(java.lang.String path)
          Returns the contents of this container
 void setName(java.lang.String name)
          Set the name of the container
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

objects

protected java.util.List<FilesObject> objects

client

protected FilesClient client

logger

protected static org.apache.log4j.Logger logger
Constructor Detail

FilesContainer

public FilesContainer(java.lang.String name,
                      java.util.List<FilesObject> objs,
                      FilesClient client)
Note, this does not actually create a container on the server

Parameters:
name - The name of the container
objs - The objects in that container
client - The client we are currently using

FilesContainer

public FilesContainer(java.lang.String name,
                      FilesClient client)
Parameters:
name - The name of the container
client - A logged in client
Method Detail

getName

public java.lang.String getName()
Get the name of the container

Returns:
The name of this container

setName

public void setName(java.lang.String name)
Set the name of the container

Parameters:
name - The new name

getObjects

public java.util.List<FilesObject> getObjects()
                                       throws java.io.IOException,
                                              FilesAuthorizationException,
                                              FilesException
Returns the contents of this container

Returns:
A list of the contents
Throws:
org.apache.http.HttpException - There was a problem communicating with the server
java.io.IOException - There was a problem communicating with the server
FilesAuthorizationException
FilesInvalidNameException
FilesException

getObjects

public java.util.List<FilesObject> getObjects(java.lang.String path)
                                       throws org.apache.http.HttpException,
                                              java.io.IOException,
                                              FilesAuthorizationException,
                                              FilesException
Returns the contents of this container

Parameters:
path - Limit the results to files under the following path
Returns:
A list of the contents
Throws:
org.apache.http.HttpException - There was a problem communicating with the server
java.io.IOException - There was a problem communicating with the server
FilesAuthorizationException
FilesInvalidNameException
FilesException

getInfo

public FilesContainerInfo getInfo()
                           throws org.apache.http.HttpException,
                                  java.io.IOException,
                                  FilesException
Get useful information on this container

Returns:
The container info
Throws:
org.apache.http.HttpException - There was a problem communicating with the server
java.io.IOException - There was a problem communicating with the server
FilesException

getClient

public FilesClient getClient()
Returns the instance of the client we're using

Returns:
The FilesClient

addObject

public boolean addObject(java.io.File f,
                         java.lang.String mimeType)
                  throws java.security.NoSuchAlgorithmException,
                         java.io.IOException,
                         FilesAuthorizationException,
                         FilesException
Adds a new object to the container

Parameters:
f - The file for this object
mimeType - It's MIME type
Returns:
The return code from the server
Throws:
java.security.NoSuchAlgorithmException - The MD5 implementation is not installed in the client
java.io.IOException
FilesAuthorizationException
FilesInvalidNameException
FilesException

createContainer

public void createContainer()
                     throws org.apache.http.HttpException,
                            java.io.IOException,
                            FilesAuthorizationException,
                            FilesException
Creates the container represented by this instance on the server

Throws:
org.apache.http.HttpException
java.io.IOException
FilesAuthorizationException
FilesInvalidNameException
FilesException