com.sas.services.information.metadata
Class Folder

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.sas.services.information.metadata.Metadata
                          |
                          +--com.sas.services.information.metadata.Folder
All Implemented Interfaces:
FolderInterface, MetadataInterface,
Direct Known Subclasses:
DavPerson, FilteredFolder, LdapChannel, LdapDirectory, LdapEventSubscriber, LdapFtpServer, LdapHttpServer, LdapServer, LdapSubscriber, MyDocuments, MyInbox, MyResults, PersonalRepository

public class Folder
extends Metadata
implements FolderInterface, java.io.Serializable

This class implements the FolderInterface. It allows manipulation of a folder, getting, adding, removing or deleting contents (items) or subfolders.

Client code should avoid casting to this class. Instead, cast to FolderInterface.

Since:
1.0
See Also:
Serialized Form

Fields inherited from class com.sas.services.information.metadata.Metadata
_repository, _repositoryFlag, _repositoryObject, formats, gmtZone, REPOSITORY_DAV, REPOSITORY_LDAP, REPOSITORY_NONE, REPOSITORY_OMR
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface com.sas.services.information.metadata.FolderInterface
FOLDER_TYPE_BIP
 
Fields inherited from interface com.sas.services.information.metadata.MetadataInterface
PERMISSION_READMETADATA, PERMISSION_WRITEMETADATA
 
Constructor Summary
  Folder()
          Default constructor.
  Folder(Object o)
          Construct a folder given an object to initialize with.
protected Folder(Object o, Class theClass)
          Construct a folder given an object to initialize with.
 
Method Summary
 void addItem(MetadataInterface item)
          Add an item to the folder.
 MetadataInterface addNewItem(String name, String type)
          Create a new metadata object to add to the folder.
 void addSubfolder(FolderInterface folder)
          Add an existing folder to this one as a subfolder.
 void delete()
          Delete this object from its repository.
 void deleteItem(MetadataInterface item)
          Delete an item from this folder.
 void deleteSubfolder(String name)
          Delete a subfolder.
static long getFolderRefresh()
          Get the interval for keeping cached subfolder information before forcing a trip to the server to refresh it.
 String getFolderType()
          Get the folder type.
 MetadataInterface getItem(String name)
          Get a named item from the folder.
 MetadataInterface getItemByClass(String name, Class itemClass)
          Get a named item from the folder.
 MetadataInterface getItemByType(String name, String metadataType)
          Get a named item from the folder.
static long getItemRefresh()
          Get the interval to keep member item information before forcing a trip to the server to refresh it.
 List getItems()
          List all items in the folder.
 List getItemsByClass(Class itemClass)
          List the items in the folder that match the Class passed in as a parameter.
 List getItemsByType(String metadataType)
          Get a list of items in the folder of a specific type.
 FolderInterface getParent()
          Get parent folder.
 String getPath()
          Get the path string for this Folder.
 FolderInterface getSubfolder(String name)
          Get a named subfolder.
 List getSubfolders()
          Get all the folders immediately below this one in the hiearchy.
 String getType()
          Return a type string to identify this object.
 FolderInterface makeSubfolder(String name)
          Makes a subfolder under the current folder.
 String mapNameToFilesystem(int hostOS, String prefix, String suffix)
          Map the metadata object name to a file system path.
 String mapUrlToFilesystem(int hostOS, String prefix, String suffix)
          Map the metadata object's SBIP Url to a file system path.
 void removeItem(MetadataInterface item)
          Remove an item from the folder.
 void removeSubfolder(String name)
          Remove a subfolder from the current folder.
static void setFolderRefresh(long interval)
          Set the interval for keeping cached subfolder information before forcing a trip to the server to refresh it.
 void setFolderType(String type)
          Set the folder type.
static void setItemRefresh(long interval)
          Set the interval to keep member item information before forcing a trip to the server to refresh it.
 void setName(String name)
          Set the name of the object.
 void setRepository(RepositoryInterface ri)
          Set the repository that this item exists in.
 
Methods inherited from class com.sas.services.information.metadata.Metadata
add, addAccessControl, addAttribute, addAttributes, addExtension, addKeyword, addPermissions, addRemark, addTransactionListener, checkin, checkout, clearInformationService, commit, copyTo, deleteAttribute, deleteAttributes, getAccessControls, getAttribute, getAttributes, getCreateDate, getDescription, getEntityKey, getEntityURL, getExtensions, getGUID, getIdentities, getInformationService, getKeywords, getModifyDate, getName, getParentPath, getParents, getPath, getPaths, getPathUrl, getPathUrl, getPermission, getPermissions, getPermissions, getPreviousVersionNames, getRemarksList, getReposId, getRepository, getRepositoryEntity, getReposKey, getTrackingId, getTreeRefresh, getVersion, isAuthorized, isLoggingEnabled, logMessage, moveTo, newServiceObject, notifyTransactionListeners, refresh, removeAccessControl, removeExtension, removeKeyword, removePermissions, rollback, setAttribute, setAttributes, setDescription, setGUID, setKeywords, setPermission, setRemarksList, setTreeRefresh, startTransaction, transactionEvent, uncheckout, update, version
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sas.services.information.metadata.MetadataInterface
add, addAccessControl, addAttribute, addAttributes, addExtension, addKeyword, addPermissions, addRemark, addTransactionListener, checkin, checkout, commit, copyTo, deleteAttribute, deleteAttributes, getAccessControls, getAttribute, getAttributes, getCreateDate, getDescription, getEntityKey, getEntityURL, getExtensions, getGUID, getIdentities, getKeywords, getModifyDate, getName, getParentPath, getParents, getPath, getPaths, getPathUrl, getPathUrl, getPermission, getPermissions, getPermissions, getPreviousVersionNames, getRemarksList, getReposId, getRepository, getRepositoryEntity, getReposKey, getTrackingId, getVersion, isAuthorized, isLoggingEnabled, logMessage, moveTo, newServiceObject, refresh, removeAccessControl, removeExtension, removeKeyword, removePermissions, rollback, setAttribute, setAttributes, setDescription, setGUID, setKeywords, setPermission, setRemarksList, startTransaction, transactionEvent, uncheckout, update, version
 

Constructor Detail

Folder

public Folder()
       throws RemoteException
Default constructor.
Throws:
RemoteException - in the event of remote object failure.

Folder

public Folder(Object o)
       throws RemoteException
Construct a folder given an object to initialize with.

Parameters:
o - The repository object to initialize with.
Throws:
RemoteException - in the event of remote object failure.

Folder

protected Folder(Object o,
                 Class theClass)
          throws RemoteException
Construct a folder given an object to initialize with.

Parameters:
o - The repository object to initialize with.
theClass - Class which will be used to determine the appropriate RMI socket factories.
Throws:
RemoteException - in the event of remote object failure.
Method Detail

setFolderRefresh

public static void setFolderRefresh(long interval)
Set the interval for keeping cached subfolder information before forcing a trip to the server to refresh it.
Parameters:
interval - The interval in milliseconds to keep the cached subfolder information.

getFolderRefresh

public static long getFolderRefresh()
Get the interval for keeping cached subfolder information before forcing a trip to the server to refresh it.
Returns:
The interval in milliseconds to keep the cached subfolder information.

setItemRefresh

public static void setItemRefresh(long interval)
Set the interval to keep member item information before forcing a trip to the server to refresh it.
Parameters:
interval - The interval in milliseconds to keep the cached member item information.

getItemRefresh

public static long getItemRefresh()
Get the interval to keep member item information before forcing a trip to the server to refresh it.
Returns:
The interval in milliseconds to keep member item information.

getType

public String getType()
               throws RemoteException
Return a type string to identify this object.

Specified by:
getType in interface MetadataInterface
Overrides:
getType in class Metadata
Returns:
The type string ("Folder").
Throws:
RemoteException - in the event of remote object failure.

getPath

public String getPath()
               throws RemoteException
Get the path string for this Folder.

Specified by:
getPath in interface FolderInterface
Returns:
The String with the path from the BIP root to this folder.
Throws:
RemoteException - in the event of remote object failure.

getItems

public List getItems()
              throws ServiceException,
                     RemoteException
List all items in the folder. These are only the individual items. Subfolders will be returned separately.

Specified by:
getItems in interface FolderInterface
Returns:
A List of MetadataInterface objects in this folder. If this folder has no items, an empty List is returned.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

getItemsByType

public List getItemsByType(String metadataType)
                    throws ServiceException,
                           RemoteException
Get a list of items in the folder of a specific type.

Specified by:
getItemsByType in interface FolderInterface
Parameters:
metadataType - A String that will match the output from the object's getType method.
Returns:
A List of MetadataInterface objects whose getType() method returns the string specified by metadataType. If no matching objects are found, an empty List is returned.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

getItemsByClass

public List getItemsByClass(Class itemClass)
                     throws ServiceException,
                            RemoteException
List the items in the folder that match the Class passed in as a parameter. This Class should be a subclass of MetadataInterface.

Specified by:
getItemsByClass in interface FolderInterface
Parameters:
itemClass - The Class used to filter the folder objects to return.
Returns:
A List of MetadataInterface objects that match the itemClass. If no objects matching the class are found, an empty List is returned.
Throws:
ServiceException - If a repository error occurs.
RemoteException - in the event of remote object failure.

getItem

public MetadataInterface getItem(String name)
                          throws ServiceException,
                                 RemoteException
Get a named item from the folder. With only a name, we can't guarantee that the object coming back will be the one the user wants. Even if we ask for a type, name collisions can occur.

Specified by:
getItem in interface FolderInterface
Parameters:
name - The name of the object to return.
Returns:
A MetadataInterface object matching name, or null if no such object is found.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

getItemByType

public MetadataInterface getItemByType(String name,
                                       String metadataType)
                                throws ServiceException,
                                       RemoteException
Get a named item from the folder. With only a name, we can't guarantee that the object coming back will be the one the user wants. Even if we ask for a type, name collisions can occur.
Specified by:
getItemByType in interface FolderInterface
Parameters:
name - The name of the object to return.
metadataType - The type of object to return.
Returns:
A MetadataInterface object that matches the name and type requested, or null if none is found.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

getItemByClass

public MetadataInterface getItemByClass(String name,
                                        Class itemClass)
                                 throws ServiceException,
                                        RemoteException
Get a named item from the folder. It must match both the name and the Class provided. If no Class is provided on the call, the first object matching the name is retuned. If no match is found, null is returned.

Specified by:
getItemByClass in interface FolderInterface
Parameters:
name - The name of the object to return.
itemClass - The Class of the object to return.
Returns:
A MetadataInterface object in the folder that matches the name and Class requested, or null if no such object is found.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

getSubfolders

public List getSubfolders()
                   throws ServiceException,
                          RemoteException
Get all the folders immediately below this one in the hiearchy.

Specified by:
getSubfolders in interface FolderInterface
Returns:
A List of FolderInterface objects that are members of this folder. If this folder has no subfolders, an empty List is returned.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

getSubfolder

public FolderInterface getSubfolder(String name)
                             throws ServiceException,
                                    RemoteException
Get a named subfolder.

Specified by:
getSubfolder in interface FolderInterface
Parameters:
name - The name of the folder to return.
Returns:
A FolderInterface object with the name requested, or null if it doesn't exist.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

addItem

public void addItem(MetadataInterface item)
             throws ServiceException,
                    RemoteException
Add an item to the folder. The item should already exist. This method makes the association that puts it in this folder, but doesn't create the item in the store.

Specified by:
addItem in interface FolderInterface
Parameters:
item - The item to add to this folder.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

addNewItem

public MetadataInterface addNewItem(String name,
                                    String type)
                             throws ServiceException,
                                    RemoteException
Create a new metadata object to add to the folder.

Specified by:
addNewItem in interface FolderInterface
Parameters:
name - The name of the new object.
type - The repository-specific type of the new object.
Returns:
The new metadata object.
Throws:
ServiceException - In the event of repository failure.
RemoteException - In the event of remote object failure.

removeItem

public void removeItem(MetadataInterface item)
                throws ServiceException,
                       RemoteException
Remove an item from the folder. This call just breaks the association with the item, and leaves it otherwise undisturbed in the repository.

Specified by:
removeItem in interface FolderInterface
Parameters:
item - The item to remove from this folder.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

deleteItem

public void deleteItem(MetadataInterface item)
                throws ServiceException,
                       RemoteException
Delete an item from this folder. This method deletes the item from the repository as well as removing it from the folder.

Specified by:
deleteItem in interface FolderInterface
Parameters:
item - The item to delete from this folder.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

makeSubfolder

public FolderInterface makeSubfolder(String name)
                              throws ServiceException,
                                     RemoteException
Makes a subfolder under the current folder.

Specified by:
makeSubfolder in interface FolderInterface
Parameters:
name - The name of the folder to create.
Returns:
The new folder. If the folder name already exists as a subfolder, the existing folder will be returned.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

addSubfolder

public void addSubfolder(FolderInterface folder)
                  throws ServiceException,
                         RemoteException
Add an existing folder to this one as a subfolder.
Specified by:
addSubfolder in interface FolderInterface
Parameters:
folder - The folder to add to this one as a subfolder.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

removeSubfolder

public void removeSubfolder(String name)
                     throws ServiceException,
                            RemoteException
Remove a subfolder from the current folder. This breaks the association, but does not remove it from the repository.

Specified by:
removeSubfolder in interface FolderInterface
Parameters:
name - The name of the subfolder to remove.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

deleteSubfolder

public void deleteSubfolder(String name)
                     throws ServiceException,
                            RemoteException
Delete a subfolder. This will only work if the folder is empty.

Specified by:
deleteSubfolder in interface FolderInterface
Parameters:
name - The name of the subfolder to delete.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

delete

public void delete()
            throws ServiceException,
                   RemoteException
Description copied from interface: MetadataInterface
Delete this object from its repository. This may be overridden by subclasses to perform clean up operations on other objects that may be dependent on this one.

Specified by:
delete in interface MetadataInterface
Overrides:
delete in class Metadata
Following copied from interface: com.sas.services.information.metadata.MetadataInterface
Throws:
ServiceException - in the event of a repository failure.
RemoteException - in the event of a network failure.

getParent

public FolderInterface getParent()
                          throws ServiceException,
                                 RemoteException
Get parent folder.

If the current folder has more than one parent, the preferred (first) parent folder is returned.

Specified by:
getParent in interface FolderInterface
Returns:
The parent Folder of this folder.
Throws:
ServiceException - if a repository error occurs.
RemoteException - in the event of remote object failure.

setRepository

public void setRepository(RepositoryInterface ri)
                   throws RemoteException
Description copied from interface: MetadataInterface
Set the repository that this item exists in.

Specified by:
setRepository in interface MetadataInterface
Overrides:
setRepository in class Metadata
Following copied from interface: com.sas.services.information.metadata.MetadataInterface
Parameters:
repository - A handle to the repository for this object.
Throws:
IllegalStateException - If the repository has already been set.
RemoteException - if an error occurs

setFolderType

public void setFolderType(String type)
                   throws ServiceException,
                          RemoteException
Set the folder type.
Specified by:
setFolderType in interface FolderInterface
Parameters:
type - The String indicating the type of the folder.
Throws:
ServiceException - If a repository error occurs.
RemoteException - In the event of remote object failure.

getFolderType

public String getFolderType()
                     throws ServiceException,
                            RemoteException
Get the folder type.
Specified by:
getFolderType in interface FolderInterface
Returns:
A String with the type of folder.
Throws:
ServiceException - If a repository error occurs.
RemoteException - In the event of remote object failure.

setName

public void setName(String name)
             throws RemoteException
Set the name of the object.

Specified by:
setName in interface MetadataInterface
Overrides:
setName in class Metadata
Parameters:
name - The name of the object in the repository.
Throws:
RemoteException - in the event of remote object failure.

mapNameToFilesystem

public String mapNameToFilesystem(int hostOS,
                                  String prefix,
                                  String suffix)
                           throws RemoteException,
                                  IllegalArgumentException
Map the metadata object name to a file system path.
Specified by:
mapNameToFilesystem in interface MetadataInterface
Overrides:
mapNameToFilesystem in class Metadata
Parameters:
hostOS - The host operating system. Valid values include Names.UNKNOWN, Names.WINDOWS, Names.UNIX, Names.ZOS_HFS, Names.ZOS_PDS and Names.WEBDAV.
prefix - The prefix to use when creating the file system path.
suffix - The suffix to use when creating the file system path.
Returns:
String The file system path.
Throws:
RemoteException - In the event of remote object failure.
IllegalArgumentException - If a null name is specified or if an invalid host operating system value is specified.

mapUrlToFilesystem

public String mapUrlToFilesystem(int hostOS,
                                 String prefix,
                                 String suffix)
                          throws ServiceException,
                                 RemoteException,
                                 IllegalArgumentException
Map the metadata object's SBIP Url to a file system path.
Specified by:
mapUrlToFilesystem in interface MetadataInterface
Overrides:
mapUrlToFilesystem in class Metadata
Parameters:
hostOS - The host operating system. Valid values include Names.UNKNOWN, Names.WINDOWS, Names.UNIX, Names.ZOS_HFS, Names.ZOS_PDS and Names.WEBDAV.
prefix - The prefix to use when creating the file system path.
suffix - The suffix to use when creating the file system path.
Returns:
String The file system path.
Throws:
ServiceException - if a repository error occurs.
RemoteException - In the event of remote object failure.
IllegalArgumentException - If a null name is specified or if an invalid host operating system value is specified.




Copyright © 2006 SAS Institute Inc. All Rights Reserved.
javadoc generated Fri, 10 Feb 2006 17:28:57