OBEROn SDK

com.oberon.ooql.sdk
Class LocalArea

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

public class LocalArea
extends AdminBase
implements java.io.Serializable

LocalArea Admin Object: defines a file container on a distributed file system.

Version:
5.0
See Also:
Serialized Form

Field Summary
static int HASHNAMES_OPTION
          The file Hash flag index inside the Option Set
static java.lang.String PROTOCOL_DATABASE
          DATABASE protocol - files are stored inside the DB
static java.lang.String PROTOCOL_FILE
          FILE protocol - can be used only when the file storage folder is in the same mainframe of the java environment (usually the RMI server).
static java.lang.String PROTOCOL_FTP
          FTP protocol - the default transfer method
static java.lang.String PROTOCOL_HTTP
          HTTP protocol - transfer files using web-services or servlets
static int SUBFOLDERS_OPTION
          The use Sub Folder flag index inside the Option Set
 
Fields inherited from class com.oberon.ooql.sdk.AdminBase
bsOptions, HIDDEN_OPTION
 
Constructor Summary
LocalArea()
           
LocalArea(java.lang.String name)
           
 
Method Summary
 void check(Framework framework)
          Check the if file metadata are correct for this LocalArea
 java.lang.String compareUpdate(LocalArea refLocalArea, boolean checkImage, boolean overwrite, boolean force, Framework framework)
          Return/apply the OOQL command to update this LocalArea object and let it become equals to another reference object.
 void create(boolean force, Framework framework)
          Create a new LocalArea object on the database
 void create(Framework framework)
          Create a new LocalArea object on the database
 void defrag(Framework framework)
          Remove all unlinked files from LocalArea
 void destroy(Framework framework)
          Remove the LocalArea object from the database
 void empty(Framework framework)
          Remove all files from LocalArea
 void fromXML(org.jdom.Element rootElement)
          Load the LocalArea object properties from XML element tree
 java.lang.String getCreateCommand(boolean force)
          Return the OOQL command to create this LocalArea 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
 boolean getHashNames()
          Check if file names are hashed when stored into the file system
 java.lang.String getHost()
          Get the FTP host
 java.lang.String getPath()
          Get the file storage folder path
 int getPermissions()
          Get the file system permissions for the file storage folder
 int getPort()
          Get the FTP port
 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 LocalArea object by its OOQL identifier
 java.lang.String getProtocol()
          Get the file transfer protocol.
 boolean getRehash()
           
 java.lang.String getSaveCommand(boolean force)
          Return the OOQL command to update this LocalArea object with the modified properties.
 java.lang.String getSubPath()
          Get the relative FileSpace subPath
 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
 java.lang.String getURL()
          Get the web-service or servlet URL (http)
 java.lang.String getUserAccount()
          Get the FTP user account
 java.lang.String getUserPassword()
          Get the FTP account password
 boolean getUseSubFolders()
          Check if hashed file names are organized into sub folders
 void link(Framework framework, java.util.Hashtable<java.lang.String,java.lang.Integer> counters)
          Open the LocalArea object: connect the memory instance with the database instance
static LocalArea 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 setHashNames(boolean hashNames)
          Set if file names in the storage folder must be hashed.
 void setHost(java.lang.String host)
          Set the FTP host; can be the IP address or the host name.
 void setPath(java.lang.String path)
          Set the FTP path (ftp) of the Local file system path (file) for the file storage folder
 void setPermissions(int permissions)
          Set the file system permissions for the file storage folder.
 void setPort(int port)
          Set the FTP port.
 void setProtocol(java.lang.String protocol)
          Set the file transfer protocol for LocalAreas and FileSpaces.
 void setRehash(boolean rehash)
           
 void setSubPath(java.lang.String subPath)
          Set the FileSpace subPath: each LocalArea inherits the subPath from the relative FileSpace
 void setURL(java.lang.String url)
          Set the web-service or servlet URL (http)
 void setUserAccount(java.lang.String userName)
          Set the FTP user account
 void setUserPassword(java.lang.String password)
          Set the FTP account password
 void setUseSubFolders(boolean useSubFolders)
          Set if hashed files in the storage folder must be organized into sub folders.
 java.lang.String toBaseString()
          Return the object basic properties as a single String
 java.lang.String toBaseString(Framework framework)
          Return the object extended properties as a single String
 org.jdom.Element toBaseXML(boolean getImage, boolean fullDump, Framework framework)
          Return the object properties as XML element tree
 java.lang.String toString()
          Return the LocalArea object basic properties as a single String
 java.lang.String toString(Framework framework)
          Return the LocalArea object extended properties as a single String
 org.jdom.Element toXML(boolean getImage, boolean fullDump, Framework framework)
          Return the LocalArea object properties as XML element tree
 org.jdom.Element toXML(Framework framework)
          Return the LocalArea object properties as XML element tree
 void unlink(Framework framework)
          Close the object: disconnect the memory instance from the database instance
 void write(boolean force, Framework framework)
          Update the LocalArea object to the database
 void write(Framework framework)
          Update the LocalArea object to the database
 
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
 

Field Detail

SUBFOLDERS_OPTION

public static final int SUBFOLDERS_OPTION
The use Sub Folder flag index inside the Option Set

See Also:
Constant Field Values

HASHNAMES_OPTION

public static final int HASHNAMES_OPTION
The file Hash flag index inside the Option Set

See Also:
Constant Field Values

PROTOCOL_FTP

public static final java.lang.String PROTOCOL_FTP
FTP protocol - the default transfer method

See Also:
Constant Field Values

PROTOCOL_FILE

public static final java.lang.String PROTOCOL_FILE
FILE protocol - can be used only when the file storage folder is in the same mainframe of the java environment (usually the RMI server). Usually this is true for the FileSpace but not for the LocalAreas

See Also:
Constant Field Values

PROTOCOL_HTTP

public static final java.lang.String PROTOCOL_HTTP
HTTP protocol - transfer files using web-services or servlets

See Also:
Constant Field Values

PROTOCOL_DATABASE

public static final java.lang.String PROTOCOL_DATABASE
DATABASE protocol - files are stored inside the DB

See Also:
Constant Field Values
Constructor Detail

LocalArea

public LocalArea()

LocalArea

public LocalArea(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 LocalArea 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 LocalArea object: connect the memory instance with the database instance

Specified by:
link in class AdminBase
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 LocalArea object on the database

Specified by:
create in class AdminBase
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 LocalArea object on the database

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 LocalArea object to the database

Specified by:
write in class AdminBase
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 LocalArea object to the database

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

Specified by:
unlink in class AdminBase
Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions

destroy

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

Specified by:
destroy in class AdminBase
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 all unlinked files from 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 LocalArea

Parameters:
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 LocalArea

Parameters:
framework - the current framework
Throws:
OberonException - usually due to DB SQL exceptions or to limited user access rights

setProtocol

public void setProtocol(java.lang.String protocol)
                 throws OberonException
Set the file transfer protocol for LocalAreas and FileSpaces.

Parameters:
protocol - the transfer protocol: ( PROTOCOL_FTP ,PROTOCOL_FILE , PROTOCOL_HTTP , PROTOCOL_DATABASE )
Throws:
OberonException

getProtocol

public java.lang.String getProtocol()
Get the file transfer protocol.


setHost

public void setHost(java.lang.String host)
Set the FTP host; can be the IP address or the host name. Default is "localhost"


getHost

public java.lang.String getHost()
Get the FTP host


setPort

public void setPort(int port)
Set the FTP port. Default is "21"


getPort

public int getPort()
Get the FTP port


setPath

public void setPath(java.lang.String path)
Set the FTP path (ftp) of the Local file system path (file) for the file storage folder


getPath

public java.lang.String getPath()
Get the file storage folder path


setSubPath

public void setSubPath(java.lang.String subPath)
Set the FileSpace subPath: each LocalArea inherits the subPath from the relative FileSpace


getSubPath

public java.lang.String getSubPath()
Get the relative FileSpace subPath


setURL

public void setURL(java.lang.String url)
Set the web-service or servlet URL (http)


getURL

public java.lang.String getURL()
Get the web-service or servlet URL (http)


setPermissions

public void setPermissions(int permissions)
Set the file system permissions for the file storage folder. Default is "666".

Parameters:
permissions - the typical Unix permission value ( example: 777 , 656 )

getPermissions

public int getPermissions()
Get the file system permissions for the file storage folder


setUserAccount

public void setUserAccount(java.lang.String userName)
Set the FTP user account


getUserAccount

public java.lang.String getUserAccount()
Get the FTP user account


setUserPassword

public void setUserPassword(java.lang.String password)
Set the FTP account password


getUserPassword

public java.lang.String getUserPassword()
Get the FTP account password


setUseSubFolders

public void setUseSubFolders(boolean useSubFolders)
Set if hashed files in the storage folder must be organized into sub folders.

Parameters:
useSubFolders - if true, hashed file names are stored in a two level sub-folders
(example: the fullpath for the hashed file "F34A6527.doc" will be "path/subPath/F3/4A/F34A6527.doc")

getUseSubFolders

public boolean getUseSubFolders()
Check if hashed file names are organized into sub folders


setHashNames

public void setHashNames(boolean hashNames)
Set if file names in the storage folder must be hashed. This avoid that file with the same name belonging to different ObjectObjs overwrite themselves

Parameters:
hashNames - if true file names are converted to a 8 digits hex number.
the association between the original name and the hashed name is kept as file metadata. The file extension is converted to the FileType extension.
(example: the file "MyDocument.doc" with FileType extension ".rtf" should be stored as 83E4C120.rtf )

getHashNames

public boolean getHashNames()
Check if file names are hashed when stored into the file system


setRehash

public void setRehash(boolean rehash)

getRehash

public boolean getRehash()

getFileSpaces

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

Parameters:
framework - the current framework
Returns:
vector of FileSpaces names

getFileSpacesAsString

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

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 LocalArea object by its OOQL identifier

Specified by:
getProperty in class OBBase
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

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

toBaseString

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


toString

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

Overrides:
toString in class AdminBase

toBaseString

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

Parameters:
framework - the current framework

toString

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

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

toBaseXML

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

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

toXML

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

Specified by:
toXML in class AdminBase
Parameters:
framework - the current framework

toXML

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

Specified by:
toXML in class AdminBase
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 LocalArea object properties from XML element tree

Overrides:
fromXML in class AdminBase

getCreateCommand

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

Specified by:
getCreateCommand in class AdminBase
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 LocalArea object with the modified properties.
If the object is new, it returns the create command.

Specified by:
getSaveCommand in class AdminBase
Parameters:
force - if true append the "force" options at the end

compareUpdate

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

Parameters:
refLocalArea - the reference LocalArea 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.