com.intel.cosbench.api.swift
Class SwiftStorage

java.lang.Object
  extended by com.intel.cosbench.api.storage.NoneStorage
      extended by com.intel.cosbench.api.swift.SwiftStorage
All Implemented Interfaces:
StorageAPI

public class SwiftStorage
extends NoneStorage

This class encapsulates one swift implementation for Storage API.

Author:
ywang19

Field Summary
 
Fields inherited from class com.intel.cosbench.api.storage.NoneStorage
API_TYPE
 
Constructor Summary
SwiftStorage()
           
 
Method Summary
 void createContainer(java.lang.String container, Config config)
          create a container.
 void createObject(java.lang.String container, java.lang.String object, java.io.InputStream data, long length, Config config)
          upload an object into a container.
 void deleteContainer(java.lang.String container, Config config)
          delete a container.
 void deleteObject(java.lang.String container, java.lang.String object, Config config)
          delete an object.
 void dispose()
          clean up Storage API.
 java.io.InputStream getObject(java.lang.String container, java.lang.String object, Config config)
          download an object from a container.
 void init(Config config, Logger logger)
          initialize Storage API with parameters contained in config, the parameter list depends on storage type.
 void setAuthContext(AuthContext info)
          associate authentication context with Storage API for further storage operations.
 
Methods inherited from class com.intel.cosbench.api.storage.NoneStorage
getParms
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwiftStorage

public SwiftStorage()
Method Detail

init

public void init(Config config,
                 Logger logger)
Description copied from interface: StorageAPI
initialize Storage API with parameters contained in config, the parameter list depends on storage type.

Specified by:
init in interface StorageAPI
Overrides:
init in class NoneStorage
Parameters:
config - - one instance from “com.intel.cosbench.config.Config” class, which includes parameters for authentication.
logger - - one instance from “com.intel.cosbench.log.Logger” class, which delivers logging capabilities to Auth API.

setAuthContext

public void setAuthContext(AuthContext info)
Description copied from interface: StorageAPI
associate authentication context with Storage API for further storage operations.

Specified by:
setAuthContext in interface StorageAPI
Overrides:
setAuthContext in class NoneStorage
Parameters:
info - - one AuthContext instance, normally, it's the return from login() in Auth API.

dispose

public void dispose()
Description copied from interface: StorageAPI
clean up Storage API.

Specified by:
dispose in interface StorageAPI
Overrides:
dispose in class NoneStorage

getObject

public java.io.InputStream getObject(java.lang.String container,
                                     java.lang.String object,
                                     Config config)
Description copied from interface: StorageAPI
download an object from a container.

Specified by:
getObject in interface StorageAPI
Overrides:
getObject in class NoneStorage
Parameters:
container - - the name of a container.
object - - the name of an object to be downloaded.
config - - the configuration used for this operation.
Returns:
inputStream - the inputStream of the object content. If null that means the object does't exist or something bad happened.

createContainer

public void createContainer(java.lang.String container,
                            Config config)
Description copied from interface: StorageAPI
create a container.

Specified by:
createContainer in interface StorageAPI
Overrides:
createContainer in class NoneStorage
Parameters:
container - - the name of a container.
config - - the configuration used for this operation.

createObject

public void createObject(java.lang.String container,
                         java.lang.String object,
                         java.io.InputStream data,
                         long length,
                         Config config)
Description copied from interface: StorageAPI
upload an object into a container.

Specified by:
createObject in interface StorageAPI
Overrides:
createObject in class NoneStorage
Parameters:
container - - the name of a container.
object - - the name of an object to be uploaded.
data - - the inputStream of the object content.
length - - the length of object content.
config - - the configuration used for this operation.

deleteContainer

public void deleteContainer(java.lang.String container,
                            Config config)
Description copied from interface: StorageAPI
delete a container.

Specified by:
deleteContainer in interface StorageAPI
Overrides:
deleteContainer in class NoneStorage
Parameters:
container - - the name of a container to be deleted.
config - - the configuration used for this operation.

deleteObject

public void deleteObject(java.lang.String container,
                         java.lang.String object,
                         Config config)
Description copied from interface: StorageAPI
delete an object.

Specified by:
deleteObject in interface StorageAPI
Overrides:
deleteObject in class NoneStorage
Parameters:
container - - the name of a container.
object - - the name of an object to be deleted.
config - - the configuration used for this operation.