org.javaswift.joss.client.core
Class AbstractObjectStoreEntity<I extends AbstractInformation>

java.lang.Object
  extended by org.javaswift.joss.client.core.AbstractObjectStoreEntity<I>
All Implemented Interfaces:
ObjectStoreEntity
Direct Known Subclasses:
AbstractAccount, AbstractContainer, AbstractStoredObject

public abstract class AbstractObjectStoreEntity<I extends AbstractInformation>
extends Object
implements ObjectStoreEntity


Field Summary
protected static boolean ALLOW_CACHING
           
protected  I info
           
protected  boolean staleHeaders
           
 
Constructor Summary
AbstractObjectStoreEntity(boolean allowCaching)
           
 
Method Summary
protected  void checkForInfo()
           
protected  void checkForInfo(boolean readHeader, boolean allowErrorLog)
           
protected  void checkForInfoAndAllowHeaderSet()
           
protected  void checkForInfoDisallowErrorLog()
           
protected abstract  Metadata createMetadataEntry(String name, String value)
           
 boolean exists()
           
protected abstract  void getInfo(boolean allowErrorLog)
           
 Map<String,Object> getMetadata()
          Gets the metadata headers
 Object getMetadata(String key)
          Returns a single value of the designated key, or null if it does not exist.
 String getPath()
          Returns the path to be appended to the host
abstract  String getPathForEntity()
           
 void invalidate()
           
 boolean isAllowCaching()
           
 boolean isInfoRetrieved()
          Included for backwards portability reasons
 boolean isStale(boolean readHeader)
           
 void reload()
           
 void removeAndDoNotSaveMetadata(String key)
          Removes a single metadata field, but does not place a call to the server to save.
 void removeAndSaveMetadata(String key)
          Removes a single metadata field and immediately places a call to the server to save
 void saveMetadata()
          Places a call to the server to save all metadata, previously set with setMetadata excluding the save option
protected abstract  void saveSpecificMetadata()
           
 void setAndDoNotSaveMetadata(String key, Object value)
          Sets a single metadata field, but does not place a call to the server to save.
 void setAndSaveMetadata(String key, Object value)
          Sets a single metadata field and immediately places a call to the server to save
protected  void setInfoRetrieved()
           
 void setMetadata(Map<String,Object> metadata)
          Sets the metadata headers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_CACHING

protected static final boolean ALLOW_CACHING
See Also:
Constant Field Values

info

protected I extends AbstractInformation info

staleHeaders

protected boolean staleHeaders
Constructor Detail

AbstractObjectStoreEntity

public AbstractObjectStoreEntity(boolean allowCaching)
Method Detail

setMetadata

public void setMetadata(Map<String,Object> metadata)
Description copied from interface: ObjectStoreEntity
Sets the metadata headers

Specified by:
setMetadata in interface ObjectStoreEntity
Parameters:
metadata - contains all metadata name/value pairs that must be set

setAndSaveMetadata

public void setAndSaveMetadata(String key,
                               Object value)
Description copied from interface: ObjectStoreEntity
Sets a single metadata field and immediately places a call to the server to save

Specified by:
setAndSaveMetadata in interface ObjectStoreEntity
Parameters:
key - metadata field to add
value - value of the metadata field

setAndDoNotSaveMetadata

public void setAndDoNotSaveMetadata(String key,
                                    Object value)
Description copied from interface: ObjectStoreEntity
Sets a single metadata field, but does not place a call to the server to save. This must be explicitly called with saveMetadata.

Specified by:
setAndDoNotSaveMetadata in interface ObjectStoreEntity
Parameters:
key - metadata field to add
value - value of the metadata field

removeAndSaveMetadata

public void removeAndSaveMetadata(String key)
Description copied from interface: ObjectStoreEntity
Removes a single metadata field and immediately places a call to the server to save

Specified by:
removeAndSaveMetadata in interface ObjectStoreEntity
Parameters:
key - metadata field to remove

removeAndDoNotSaveMetadata

public void removeAndDoNotSaveMetadata(String key)
Description copied from interface: ObjectStoreEntity
Removes a single metadata field, but does not place a call to the server to save. This must be explicitly called with saveMetadata.

Specified by:
removeAndDoNotSaveMetadata in interface ObjectStoreEntity
Parameters:
key - metadata field to remove

createMetadataEntry

protected abstract Metadata createMetadataEntry(String name,
                                                String value)

saveMetadata

public void saveMetadata()
Description copied from interface: ObjectStoreEntity
Places a call to the server to save all metadata, previously set with setMetadata excluding the save option

Specified by:
saveMetadata in interface ObjectStoreEntity

saveSpecificMetadata

protected abstract void saveSpecificMetadata()

getMetadata

public Object getMetadata(String key)
Description copied from interface: ObjectStoreEntity
Returns a single value of the designated key, or null if it does not exist.

Specified by:
getMetadata in interface ObjectStoreEntity
Parameters:
key - the key of the key/value pair
Returns:
the value belonging to the key

getMetadata

public Map<String,Object> getMetadata()
Description copied from interface: ObjectStoreEntity
Gets the metadata headers

Specified by:
getMetadata in interface ObjectStoreEntity
Returns:
the metadata on the entity

checkForInfoAndAllowHeaderSet

protected void checkForInfoAndAllowHeaderSet()

checkForInfo

protected void checkForInfo()

checkForInfoDisallowErrorLog

protected void checkForInfoDisallowErrorLog()

checkForInfo

protected void checkForInfo(boolean readHeader,
                            boolean allowErrorLog)

setInfoRetrieved

protected void setInfoRetrieved()

exists

public boolean exists()

invalidate

public void invalidate()

isStale

public boolean isStale(boolean readHeader)

isAllowCaching

public boolean isAllowCaching()

reload

public void reload()

isInfoRetrieved

public boolean isInfoRetrieved()
Included for backwards portability reasons

Returns:
true if the metadata has been retrieved

getPath

public String getPath()
Description copied from interface: ObjectStoreEntity
Returns the path to be appended to the host

Specified by:
getPath in interface ObjectStoreEntity
Returns:
the path to append to the host

getPathForEntity

public abstract String getPathForEntity()
                                 throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

getInfo

protected abstract void getInfo(boolean allowErrorLog)


Copyright © 2012-2014 42 BV. All Rights Reserved.