com.sas.services.information.metadata.favorites
Class FavoritesFactory

com.sas.services.information.metadata.favorites.FavoritesFactory
All Implemented Interfaces:
RemoteSessionContextStateChangedListener, java.rmi.Remote, java.util.EventListener

public class FavoritesFactory
implements RemoteSessionContextStateChangedListener

Factory class used for creating new favorites folders.

Since:
9.3

Method Summary
 void contextStateChanged(SessionContextStateChangedEvent event)
          Notifies the object that its state has changed within the session context.
 FavoritesFolder createFavoritesFolder(java.lang.String name, FolderInterface folder)
          Creates a new favorites folder.
 FavoritesGroup createFavoritesGroup(java.lang.String name, FavoritesContainer container)
          Creates a new favorites group within an owning container.
 FavoritesFolder getApplicationFavorites(java.lang.String contextName)
          Returns the Favorites folder for a given context.
 FavoritesFolder getApplicationHistory(java.lang.String applicationName)
          Returns the History favorites folder for a given application.
static FavoritesFactory getInstance(SessionContextInterface session)
          Returns the factory instance for a given session context.
 SessionContextInterface getSession()
          Returns the session associated with this factory instance.
 FavoritesFolder getUserFavorites()
          Returns the Favorites folder for the user currently logged in.
 

Method Detail

getInstance

public static FavoritesFactory getInstance(SessionContextInterface session)
                                    throws ServiceException,
                                           java.rmi.RemoteException
Returns the factory instance for a given session context.

Parameters:
session - the users's session context
Returns:
favorites factory instance
Throws:
ServiceException
java.rmi.RemoteException

getSession

public SessionContextInterface getSession()
Returns the session associated with this factory instance.

Returns:
session context

createFavoritesFolder

public FavoritesFolder createFavoritesFolder(java.lang.String name,
                                             FolderInterface folder)
                                      throws ServiceException,
                                             java.rmi.RemoteException
Creates a new favorites folder. Callers should ensure the name being used to create the object is unique within the parent folder. See Folder.hasDuplicate(String, String).

Parameters:
name - the name of the object
folder - the parent folder to associate this favorites folder to
Returns:
a new favorites folder or null if one could not be created
Throws:
ServiceException
java.rmi.RemoteException

createFavoritesGroup

public FavoritesGroup createFavoritesGroup(java.lang.String name,
                                           FavoritesContainer container)
                                    throws ServiceException,
                                           java.rmi.RemoteException
Creates a new favorites group within an owning container. Callers should ensure the name being used to create the object is unique within the container. See FavoritesContainer.hasDuplicateFavoritesGroup(String).

Parameters:
name - the name of the object
container - the parent container to associate this favorites group to
Returns:
a new favorites group or null if one could not be created
Throws:
ServiceException
java.rmi.RemoteException

getUserFavorites

public FavoritesFolder getUserFavorites()
                                 throws ServiceException,
                                        java.rmi.RemoteException
Returns the Favorites folder for the user currently logged in. The favorites folders reside in a user's Application Data folder, for example:
  /User Folders/user-name/Application Data/My Favorites(FavoritesFolder)
 
If the favorites folder does not exist, this method will attempt to create it along with its parent folders if necessary. Meaning, the method will first retrieve the user's Application Data folder, and will create it if necessary. And finally, the Favorites favorites folder itself is retrieved, or created.

Returns:
the user's favorites folder, or null if for some reason the favorites folder could not be created.
Throws:
ServiceException
java.rmi.RemoteException

getApplicationFavorites

public FavoritesFolder getApplicationFavorites(java.lang.String contextName)
                                        throws ServiceException,
                                               java.rmi.RemoteException
Returns the Favorites folder for a given context. A context is typically the name of the calling application, but it can represent a shared value if multiple applications want to display the same set of favorites. The favorites folders reside in a user's Application Data folder, for example:
  /User Folders/user-name/Application Data/context-name/Favorites(FavoritesFolder)
 
If the favorites folder does not exist, this method will attempt to create it along with its parent folders if necessary. Meaning, the method will first retrieve the user's Application Data folder, and will create it if necessary. Next, the context specific subfolder will be retrieved, or created if necessary. And finally, the Favorites favorites folder itself is retrieved, or created.

Parameters:
contextName - the context name to create the favorites folder under
Returns:
the context specific favorites folder, or null if for some reason the favorites folder could not be created.
Throws:
ServiceException
java.rmi.RemoteException

getApplicationHistory

public FavoritesFolder getApplicationHistory(java.lang.String applicationName)
                                      throws ServiceException,
                                             java.rmi.RemoteException
Returns the History favorites folder for a given application. History folders reside in a user's Application Data folder, for example:
  /User Folders/user-name/Application Data/application-name/History(FavoritesFolder)
 
If the favorites folder does not exist, this method will attempt to create it along with its parent folders if necessary. Meaning, the method will first retrieve the user's Application Data folder, and will create it if necessary. Next, the application specific subfolder will be retrieved, or created if necessary. And finally, the History favorites folder itself is retrieved, or created.

To set the number maximum number of objects contained within the history, see FavoritesContainer.setMaxCapacity(int).

Parameters:
applicationName - the context name to create the favorites folder under
Returns:
the application specific favorites folder, or null if for some reason the favorites folder could not be created.
Throws:
ServiceException
java.rmi.RemoteException

contextStateChanged

public void contextStateChanged(SessionContextStateChangedEvent event)
                         throws java.rmi.RemoteException
Description copied from interface: RemoteSessionContextStateChangedListener
Notifies the object that its state has changed within the session context. Currently, this is when the object is removed from the session context or when the session context is destroyed. If an object added to the session context with SessionContextInterface.setAttribute(Object) implements this interface, the session context will invoke this method when the object is removed from the session context or when the session context is destroyed.

Specified by:
contextStateChanged in interface RemoteSessionContextStateChangedListener
Parameters:
event - The event that identifies the bound object, the name of the bound object, the session context, and an identifier that indicates the type of state change that occurred.
Throws:
java.rmi.RemoteException - If a network anomaly is encountered.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.