OBEROn SDK

com.oberon.ooql.sdk
Class FileSpace

java.lang.Object
  extended by com.oberon.ooql.sdk.OBBase
      extended by com.oberon.ooql.sdk.AdminBase
          extended by com.oberon.ooql.sdk.LocalArea
              extended by com.oberon.ooql.sdk.FileSpace
All Implemented Interfaces:
java.io.Serializable

public class FileSpace
extends LocalArea

FileSpace Admin Object: defines a object file container on file system.

Version:
5.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.oberon.ooql.sdk.LocalArea
HASHNAMES_OPTION, PROTOCOL_DATABASE, PROTOCOL_FILE, PROTOCOL_FTP, PROTOCOL_HTTP, SUBFOLDERS_OPTION
 
Fields inherited from class com.oberon.ooql.sdk.AdminBase
bsOptions, HIDDEN_OPTION
 
Constructor Summary
FileSpace()
           
FileSpace(java.lang.String name)
           
 
Method Summary
 void addLocalArea(java.lang.String localAreaName)
          Add a LocalArea to this FileSpace; a LocalArea represents a FileSpace mirror where replicate the ObjectObj's attachements to let the user download them faster
 void check(Framework framework)
          Check the if file metadata are correct for this Filespace
 java.lang.String compareUpdate(FileSpace refFileSpace, boolean checkImage, boolean overwrite, boolean force, Framework framework)
          Return/apply the OOQL command to update this FileSpace object and let it become equals to another reference object.
 void create(boolean force, Framework framework)
          Create a new FileSpace object on the database
 void create(Framework framework)
          Create a new FileSpace object on the database
 void defrag(Framework framework)
          Remove from this Filespace files not linked with database metadata
 void destroy(Framework framework)
          Remove the FileSpace object from the database
 void empty(Framework framework)
          Remove all files from FileSpace
 void fromXML(org.jdom.Element rootElement)
          Load the FileSpace object properties from XML element tree
 java.lang.String getCreateCommand(boolean force)
          Return the OOQL command to create this FileSpace object with the settled properties
 java.util.Vector<java.lang.String> getFileSpaces(Framework framework)
          Return the list of FileSpaces where this Field is used
 java.lang.String getFileSpacesAsString(java.lang.String delim, Framework framework)
          Return the list of FileSpaces where this Field is used, as a String
 java.util.Vector<java.lang.String> getLocalAreas()
          Return the list of LocalAreas for this FileSpace
 java.lang.String getLocalAreasAsString(java.lang.String delim)
          Return the list of LocalAreas, as a String
 java.lang.String getProperty(java.lang.String propertyName, java.util.Vector<java.lang.Object> filterArgs, java.lang.String token, Framework framework)
          Get a property for this FileSpace object by its OOQL identifier
 java.lang.String getSaveCommand(boolean force)
          Return the OOQL command to update this FileSpace object with the modified properties.
 java.lang.String getSubPath()
          Return the SubPath for this FileSpace
 java.util.Vector<?> getTargetNames(java.lang.String composedName, java.util.Vector<java.lang.Object> filterArgs, Framework framework)
          Return a Vector of administrative object names extracted by using an OOQL selector
 void link(Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the FileSpace object: connect the memory instance with the database instance
static FileSpace open(java.lang.String name, Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open an administrative object and read properties from the database or retrieve them from memory
 void removeLocalArea(java.lang.String localAreaName)
          Remove a LocalArea from this FileSpace
 void setSubPath(java.lang.String subPath)
          Set a SubPath for this FileSpace: the files are stored into the file system folder given by the concatenation of Path and subPath ( /Path/subPath/ ).
 void synchronize(java.lang.String syncFrom, java.util.Vector<java.lang.String> syncTo, boolean force, boolean add, int commit, Framework framework)
          Synchronize the FileSpace with its LocalAreas: replicate the most updates files to/from mirror folders
 java.lang.String toString()
          Return the FileSpace object basic properties as a single String
 java.lang.String toString(Framework framework)
          Return the FileSpace object extended properties as a single String
 org.jdom.Element toXML(boolean getImage, boolean fullDump, Framework framework)
          Return the FileSpace object properties as XML element tree
 org.jdom.Element toXML(Framework framework)
          Return the FileSpace object properties as XML element tree
 void unlink(Framework framework)
          Close the object: disconnect the memory instance from the database instance
 void updateLocalAreas(java.util.Vector<java.lang.String> localAreas)
          Update the localareas on the basis of a given list
 void write(boolean force, Framework framework)
          Update the FileSpace object to the database
 void write(Framework framework)
          Update the FileSpace object to the database
 
Methods inherited from class com.oberon.ooql.sdk.LocalArea
compareUpdate, getHashNames, getHost, getPath, getPermissions, getPort, getProtocol, getRehash, getURL, getUserAccount, getUserPassword, getUseSubFolders, setHashNames, setHost, setPath, setPermissions, setPort, setProtocol, setRehash, setURL, setUserAccount, setUserPassword, setUseSubFolders, toBaseString, toBaseString, toBaseXML
 
Methods inherited from class com.oberon.ooql.sdk.AdminBase
addFeature, changedApplication, checkChangeName, checkCounters, checkCounters, getAdminType, getApplication, getCommonProperty, getCommonTargetNames, getCounters, getCreateBasicCommand, getCreateCommand, getCrtDate, getDescription, getEditBasicCommand, getFeature, getFeatures, getFeaturesAsString, getImage, getImage, getImage, getImageData, getImageFile, getModDate, getModUser, getName, getOldName, getPlainFeatures, getSaveCommand, getSVNRevision, getXMLFeatureList, hasImage, isHidden, setApplication, setCounters, setCrtDate, setDescription, setHidden, setImage, setImageData, setImageFile, setModDate, setModUser, setName, setSVNRevision, show, show, toCommonXML, toXML
 
Methods inherited from class com.oberon.ooql.sdk.OBBase
addChange, addUniqueChange, ChangesFromXML, ChangesToXML, getChanges, getChangesAsString, getId, isLinked, removeChange, resetChanges, setId, setLinked
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileSpace

public FileSpace()

FileSpace

public FileSpace(java.lang.String name)
          throws OberonException
Parameters:
name - the name of the administrative object
Throws:
OberonException - if the name contains invalid characters
Method Detail

open

public static FileSpace open(java.lang.String name,
                             Framework framework,
                             java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
                      throws OberonException
Open an administrative object and read properties from the database or retrieve them from memory

Parameters:
name - the object name
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions

link

public void link(Framework framework,
                 java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          throws OberonException
Open the FileSpace object: connect the memory instance with the database instance

Overrides:
link in class LocalArea
Parameters:
framework - the current framework
counters - administrative object synch counters (if null read them from database)
Throws:
OberonException - usually due to DB SQL exceptions

create

public void create(Framework framework)
            throws OberonException
Create a new FileSpace object on the database

Overrides:
create in class LocalArea
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

create

public void create(boolean force,
                   Framework framework)
            throws OberonException
Create a new FileSpace object on the database

Overrides:
create in class LocalArea
Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
1.6

write

public void write(Framework framework)
           throws OberonException
Update the FileSpace object to the database

Overrides:
write in class LocalArea
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

write

public void write(boolean force,
                  Framework framework)
           throws OberonException
Update the FileSpace object to the database

Overrides:
write in class LocalArea
Parameters:
force - if true ignores optional features
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights
Since:
1.6

unlink

public void unlink(Framework framework)
            throws OberonException
Close the object: disconnect the memory instance from the database instance

Overrides:
unlink in class LocalArea
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

destroy

public void destroy(Framework framework)
             throws OberonException
Remove the FileSpace object from the database

Overrides:
destroy in class LocalArea
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

synchronize

public void synchronize(java.lang.String syncFrom,
                        java.util.Vector<java.lang.String> syncTo,
                        boolean force,
                        boolean add,
                        int commit,
                        Framework framework)
                 throws OberonException
Synchronize the FileSpace with its LocalAreas: replicate the most updates files to/from mirror folders

Parameters:
syncFrom - the reference LocalArea name (if empty use the FileSpace as reference)
syncTo - vector of destination LocalArea names
force - replace files also if they are more recent
add - add file if it doesn't exist
commit - number of synchronized objects for each transaction commit (default = 1)
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

empty

public void empty(Framework framework)
           throws OberonException
Remove all files from FileSpace

Overrides:
empty in class LocalArea
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

check

public void check(Framework framework)
           throws OberonException
Check the if file metadata are correct for this Filespace

Overrides:
check in class LocalArea
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

defrag

public void defrag(Framework framework)
            throws OberonException
Remove from this Filespace files not linked with database metadata

Overrides:
defrag in class LocalArea
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

setSubPath

public void setSubPath(java.lang.String subPath)
Set a SubPath for this FileSpace: the files are stored into the file system folder given by the concatenation of Path and subPath ( /Path/subPath/ ). This allows to associate a LocalArea to multiple FileSpaces when each FileSpace has its own different subPath.

Overrides:
setSubPath in class LocalArea
Parameters:
subPath - the subpath

getSubPath

public java.lang.String getSubPath()
Return the SubPath for this FileSpace

Overrides:
getSubPath in class LocalArea
See Also:
setSubPath(String)

addLocalArea

public void addLocalArea(java.lang.String localAreaName)
Add a LocalArea to this FileSpace; a LocalArea represents a FileSpace mirror where replicate the ObjectObj's attachements to let the user download them faster

Parameters:
localAreaName - the name of the LocalArea to add

removeLocalArea

public void removeLocalArea(java.lang.String localAreaName)
Remove a LocalArea from this FileSpace

Parameters:
localAreaName - the name of the LocalArea to remove

updateLocalAreas

public void updateLocalAreas(java.util.Vector<java.lang.String> localAreas)
Update the localareas on the basis of a given list

Parameters:
localAreas - list of LocalArea's names
Since:
4.0

getLocalAreas

public java.util.Vector<java.lang.String> getLocalAreas()
Return the list of LocalAreas for this FileSpace

Returns:
Vector of LocalArea names

getLocalAreasAsString

public java.lang.String getLocalAreasAsString(java.lang.String delim)
Return the list of LocalAreas, as a String

Parameters:
delim - the separator item
Returns:
list of LocalArea names separated by the delim characters

getFileSpaces

public java.util.Vector<java.lang.String> getFileSpaces(Framework framework)
Description copied from class: LocalArea
Return the list of FileSpaces where this Field is used

Overrides:
getFileSpaces in class LocalArea
Parameters:
framework - the current framework
Returns:
vector of FileSpaces names

getFileSpacesAsString

public java.lang.String getFileSpacesAsString(java.lang.String delim,
                                              Framework framework)
Description copied from class: LocalArea
Return the list of FileSpaces where this Field is used, as a String

Overrides:
getFileSpacesAsString in class LocalArea
Parameters:
delim - the separator item
framework - the current framework
Returns:
list of FileSpaces separated by the delim characters

getProperty

public java.lang.String getProperty(java.lang.String propertyName,
                                    java.util.Vector<java.lang.Object> filterArgs,
                                    java.lang.String token,
                                    Framework framework)
Get a property for this FileSpace object by its OOQL identifier

Overrides:
getProperty in class LocalArea
Parameters:
propertyName - OOQL property identifier/name (example: host , path ...)
filterArgs - extra arguments used to compute properties
token - separator token for complex properties
framework - the current framework
Returns:
the property value

getTargetNames

public java.util.Vector<?> getTargetNames(java.lang.String composedName,
                                          java.util.Vector<java.lang.Object> filterArgs,
                                          Framework framework)
Return a Vector of administrative object names extracted by using an OOQL selector

Overrides:
getTargetNames in class LocalArea
Parameters:
composedName - OOQL property identifier/name (example: localarea .. )
filterArgs - extra arguments used to compute properties
framework - the current framework
Returns:
a Vector of target names, used to extract their (sub)properties values

toString

public java.lang.String toString()
Return the FileSpace object basic properties as a single String

Overrides:
toString in class LocalArea

toString

public java.lang.String toString(Framework framework)
Return the FileSpace object extended properties as a single String

Overrides:
toString in class LocalArea
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(Framework framework)
Return the FileSpace object properties as XML element tree

Overrides:
toXML in class LocalArea
Parameters:
framework - the current framework

toXML

public org.jdom.Element toXML(boolean getImage,
                              boolean fullDump,
                              Framework framework)
Return the FileSpace object properties as XML element tree

Overrides:
toXML in class LocalArea
Parameters:
getImage - true to include "imagedata" element with the base64 encoded image data
fullDump - true to include detailed information
framework - the current framework

fromXML

public void fromXML(org.jdom.Element rootElement)
Load the FileSpace object properties from XML element tree

Overrides:
fromXML in class LocalArea

getCreateCommand

public java.lang.String getCreateCommand(boolean force)
Return the OOQL command to create this FileSpace object with the settled properties

Overrides:
getCreateCommand in class LocalArea
Parameters:
force - if true append the "force" options at the end

getSaveCommand

public java.lang.String getSaveCommand(boolean force)
Return the OOQL command to update this FileSpace object with the modified properties.
If the object is new, it returns the create command.

Overrides:
getSaveCommand in class LocalArea
Parameters:
force - if true append the "force" options at the end

compareUpdate

public java.lang.String compareUpdate(FileSpace refFileSpace,
                                      boolean checkImage,
                                      boolean overwrite,
                                      boolean force,
                                      Framework framework)
                               throws OberonException
Return/apply the OOQL command to update this FileSpace object and let it become equals to another reference object.
This method is useful to import objects from an XML file.

Parameters:
refFileSpace - the reference FileSpace object
checkImage - if true compare also the image icon
overwrite - if true update the database object instance
force - if true ignores optional properties
framework - the current framework
Throws:
OberonException
See Also:
fromXML(Element)

OBEROn SDK

Copyright © 2008-2014 Mirko Solazzi. All Rights Reserved.