org.okiproject.serviceapi.file
Class Cabinet

java.lang.Object
  |
  +--org.okiproject.serviceapi.file.Cabinet
All Implemented Interfaces:
java.io.Serializable

public class Cabinet
extends java.lang.Object
implements java.io.Serializable

Copyright (c) 2001 Massachusetts Institute of Technology

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Cabinets have properties, and contain other Cabinets and ByteStores.

They may manage quotas, that is, if the implementation supports quotas, each Agent may be assigned a quota of space used in the Cabinet.

Cabinets contain CabinetEntries, each of which may be a ByteStore or a Cabinet. They are known by their GUIDs and optionally by name, where the name is a string with no syntax, and may represent a filename, e.g. logo.gif or a name and path within a heirarchy, e.g. images/logos/logo1.gif

It is a goal that a Cabinet be representable as a jar file and vice versa. A Cabinet may be converted to a jar file using a method.

One special type of Cabinet is used to store URLs, the implementation is built around java.net.URL. The name of the ByteStore is a URL. The cabinet is read-only, doesn't support quotas or versioning.

ByteStores and Cabinets are added to Cabinets. Cabinets are created in CabinetFactories and ByteStores are created in Cabinets.


$Source: /cvs/oki/org/okiproject/serviceapi/doc/file/org/okiproject/serviceapi/file/Cabinet.html,v $

See Also:
Serialized Form

Constructor Summary
Cabinet()
           
 
Method Summary
 void add(ByteStore byteStore)
          Method add
 void add(Cabinet subCabinet)
          Method add
 ByteStore createByteStore()
          Method createByteStore
 ByteStore createByteStore(java.lang.String name)
          Method createByteStore
 ByteStore createByteStore(java.lang.String name, ByteStore old)
          Method createByteStore
 ByteStore createTempByteStore()
          Method createTempByteStore
 java.util.Enumeration entries()
          Method entries
 long getAvailableBytes()
          Method getAvailableBytes
 ByteStore getByteStore(org.okiproject.serviceapi.guid.GUID guid)
          Method getByteStore
 ByteStore getByteStore(java.lang.String name)
          Method getByteStore
 CabinetEntry getCabinetEntry(org.okiproject.serviceapi.guid.GUID guid)
          Method getCabinetEntry
 CabinetEntry getCabinetEntry(java.lang.String name)
          Method getCabinetEntry
 java.util.Properties getProperties()
          Method getProperties
 long getQuota(org.okiproject.serviceapi.common.Agent owner)
          Method getQuota
 long getQuotaUsed(org.okiproject.serviceapi.common.Agent owner)
          Method getQuotaUsed
 long getUsedBytes()
          Method getUsedBytes
 void remove(ByteStore byteStore)
          Method remove
 void remove(Cabinet subCabinet)
          Method remove
 void setQuota(org.okiproject.serviceapi.common.Agent owner, long quotaBytes)
          Method setQuota
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cabinet

public Cabinet()
Method Detail

getProperties

public java.util.Properties getProperties()
Method getProperties
Returns:
 

createTempByteStore

public ByteStore createTempByteStore()
Method createTempByteStore
Returns:
 

createByteStore

public ByteStore createByteStore()
Method createByteStore
Returns:
 

createByteStore

public ByteStore createByteStore(java.lang.String name)
Method createByteStore
Parameters:
name -  
Returns:
 

createByteStore

public ByteStore createByteStore(java.lang.String name,
                                 ByteStore old)
Method createByteStore
Parameters:
name -  
old -  
Returns:
 

add

public void add(Cabinet subCabinet)
Method add
Parameters:
subCabinet -  

add

public void add(ByteStore byteStore)
Method add
Parameters:
byteStore -  

remove

public void remove(Cabinet subCabinet)
Method remove
Parameters:
subCabinet -  

remove

public void remove(ByteStore byteStore)
Method remove
Parameters:
byteStore -  

setQuota

public void setQuota(org.okiproject.serviceapi.common.Agent owner,
                     long quotaBytes)
Method setQuota
Parameters:
owner -  
quotaBytes -  

getQuota

public long getQuota(org.okiproject.serviceapi.common.Agent owner)
Method getQuota
Parameters:
owner -  
Returns:
 

getQuotaUsed

public long getQuotaUsed(org.okiproject.serviceapi.common.Agent owner)
Method getQuotaUsed
Parameters:
owner -  
Returns:
 

getAvailableBytes

public long getAvailableBytes()
Method getAvailableBytes
Returns:
 

getUsedBytes

public long getUsedBytes()
Method getUsedBytes
Returns:
 

getByteStore

public ByteStore getByteStore(org.okiproject.serviceapi.guid.GUID guid)
Method getByteStore
Parameters:
guid -  
Returns:
 

getByteStore

public ByteStore getByteStore(java.lang.String name)
Method getByteStore
Parameters:
name -  
Returns:
 

entries

public java.util.Enumeration entries()
Method entries
Returns:
 

getCabinetEntry

public CabinetEntry getCabinetEntry(org.okiproject.serviceapi.guid.GUID guid)
Method getCabinetEntry
Parameters:
guid -  
Returns:
 

getCabinetEntry

public CabinetEntry getCabinetEntry(java.lang.String name)
Method getCabinetEntry
Parameters:
name -  
Returns: