com.sas.services.information
Class AbstractRepository

com.sas.services.information.AbstractRepository
All Implemented Interfaces:
RepositoryInterface, java.io.Serializable, java.rmi.Remote

public abstract class AbstractRepository
implements RepositoryInterface

See Also:
Serialized Form

Nested Class Summary
 class AbstractRepository.SmartTypeHelper
          The purpose of this class is effeciently assist with the determination of the "smart metadata type" for a particular class name.
 
Field Summary
protected  java.lang.String _domain
           
protected  java.lang.String _host
           
protected  boolean _isDestroyed
           
protected  java.lang.String _isName
           
protected  java.util.ArrayList _listeners
           
protected  org.apache.log4j.Logger _logger
           
protected  int _portInt
           
protected  java.lang.String _principal
           
protected  java.lang.String _uniqueId
           
protected  java.lang.String _url
           
protected  UserContextInterface _user
           
protected  java.lang.Exception closeStack
           
 
Fields inherited from interface com.sas.services.information.RepositoryInterface
PROFILE_BEST, PROFILE_NO, PROFILE_POSSIBLE
 
Constructor Summary
protected AbstractRepository()
           
protected AbstractRepository(java.lang.Class theClass)
           
 
Method Summary
 void addListener(RepositoryListenerInterface listener)
          Add a listener to receive event notifications from the repository instance.
 void close()
          Close the connection and get rid of the cache.
 java.lang.String getDomain()
          Get the domain for this repository.
 java.lang.String getHost()
          Get the name of the host this repository is running on.
static InformationServiceInterface getInformationService()
          Return a handle to the Information Service.
 java.lang.String getISName()
          Get the Information Service configuration name for this repository if it exists.
 int getPort()
          Get the port number of the server this repository is using.
 java.lang.String getPrincipal()
          Get the principal name this instance connected with.
protected  java.lang.String getSmartType(java.lang.String key, AbstractRepository.SmartTypeHelper helper, java.util.Map rawData, org.apache.log4j.Logger logger)
           
 MetadataInterface getTrackedObject(int trackingId)
          Get a cached object by its tracking ID.
 java.lang.String getUniqueId()
          Get a unique identifier for this repository instance.
 java.lang.String getUrl()
          Get the URL that represents the specific instance for a repository.
 UserContextInterface getUserContext()
          Get the UserContext this repository was connected for.
 boolean isDestroyed()
          Check if the repostiory instance has been closed.
protected  void notifyListeners(int event)
          Notify listeners that a repository event has occurred (close, disconnect, reconnect).
protected  void pulseCheck()
           
 void removeListener(RepositoryListenerInterface listener)
          Remove a listener from the list of active event listeners for this repository.
 void setDomain(java.lang.String domain)
          Set the security domain for this repository.
 void setISName(java.lang.String name)
          Set the name that was used to connect to the repository.
 void setUserContext(UserContextInterface user)
          Set the UserContext that this repository belongs to.
 
Methods inherited from interface com.sas.services.information.RepositoryInterface
addEntity, addRootFolder, browseFetch, browseFolder, browseFolderRecursive, browseObjectByPath, browseSearch, connect, connect, connectWithProxy, deleteEntity, factoryProcess, factoryTest, fetch, fetch, fetchByUrl, fromByteArry, getBase, getCacheStatistics, getEvaluator, getFactoryKey, getIdentity, getObjectByPath, getObjectByPath, getObjectByPath, getObjectByPathString, getRootFolder, getRootFolders, getServer, getUser, isEqual, isProfileRepository, makeRootFolder, narrow, newChild, newMetadata, newMetadata, newMetadataByModel, produceDefaultMetadata, refreshAllData, refreshEntity, removeRootFolder, search, searchTree, searchTree, searchTreeFromBase, searchTreeFromBaseWithScope, setUser, toByteArray
 

Field Detail

_isName

protected java.lang.String _isName

_isDestroyed

protected boolean _isDestroyed

closeStack

protected java.lang.Exception closeStack

_user

protected UserContextInterface _user

_logger

protected org.apache.log4j.Logger _logger

_url

protected java.lang.String _url

_domain

protected java.lang.String _domain

_host

protected java.lang.String _host

_principal

protected java.lang.String _principal

_portInt

protected int _portInt

_listeners

protected java.util.ArrayList _listeners

_uniqueId

protected java.lang.String _uniqueId
Constructor Detail

AbstractRepository

protected AbstractRepository()
                      throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

AbstractRepository

protected AbstractRepository(java.lang.Class theClass)
                      throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException
Method Detail

close

public void close()
           throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Close the connection and get rid of the cache.

Specified by:
close in interface RepositoryInterface
Throws:
java.rmi.RemoteException - in the event of network errors.

getInformationService

public static InformationServiceInterface getInformationService()
                                                         throws java.rmi.RemoteException
Return a handle to the Information Service. If necessary, use the Discovery Service to get it.

Returns:
an instance of the Information Service.
Throws:
java.rmi.RemoteException - in the event of remote object failure.

setISName

public void setISName(java.lang.String name)
               throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Set the name that was used to connect to the repository. This method should be used by the InformationService connect methods. If this is used by client applications, certain functions may not work correctly.

Specified by:
setISName in interface RepositoryInterface
Parameters:
name - The name that was used to connect to the repository. This name should match the Information Service RepositoryDef name.
Throws:
java.rmi.RemoteException

getISName

public java.lang.String getISName()
                           throws java.rmi.RemoteException
Get the Information Service configuration name for this repository if it exists. It looks through the ReposDefs for the best match and returns the name.

Specified by:
getISName in interface RepositoryInterface
Returns:
The ReposDef name for this repository.
Throws:
java.rmi.RemoteException - in the event of remote object failure.

setUserContext

public void setUserContext(UserContextInterface user)
                    throws java.rmi.RemoteException
Set the UserContext that this repository belongs to. This will be used to retrieve a logging interface as well as a session when necessary.

Specified by:
setUserContext in interface RepositoryInterface
Parameters:
user - The UserContext this repository was connected for.
Throws:
java.rmi.RemoteException - In the event of network failure.

getUserContext

public UserContextInterface getUserContext()
                                    throws java.rmi.RemoteException
Get the UserContext this repository was connected for. This may be null if none was set.

Specified by:
getUserContext in interface RepositoryInterface
Returns:
The UserContext this repostiory is connected for.
Throws:
java.rmi.RemoteException - in the event of network failure.

getUrl

public java.lang.String getUrl()
                        throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Get the URL that represents the specific instance for a repository.

Specified by:
getUrl in interface RepositoryInterface
Returns:
The URL representing the repository we're currently connected to.
Throws:
java.rmi.RemoteException - in the event of network errors.

getDomain

public java.lang.String getDomain()
Get the domain for this repository. This is the security domain that this service runs in.

Specified by:
getDomain in interface RepositoryInterface
Returns:
The security domain this server is authenticated in.

setDomain

public void setDomain(java.lang.String domain)
               throws java.rmi.RemoteException
Set the security domain for this repository.

Specified by:
setDomain in interface RepositoryInterface
Parameters:
domain - The security domain this server instance uses for authentication.
Throws:
java.rmi.RemoteException - in the event of network errors.

getHost

public java.lang.String getHost()
                         throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Get the name of the host this repository is running on.

Specified by:
getHost in interface RepositoryInterface
Returns:
The host name.
Throws:
java.rmi.RemoteException - in the event of network errors.

getPort

public int getPort()
            throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Get the port number of the server this repository is using.

Specified by:
getPort in interface RepositoryInterface
Returns:
The port number.
Throws:
java.rmi.RemoteException - in the event of network errors.

getPrincipal

public java.lang.String getPrincipal()
                              throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Get the principal name this instance connected with.

Specified by:
getPrincipal in interface RepositoryInterface
Returns:
The principal string.
Throws:
java.rmi.RemoteException - in the event of network errors.

getTrackedObject

public MetadataInterface getTrackedObject(int trackingId)
                                   throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Get a cached object by its tracking ID. Objects in the tracking cache are saved by WeakReference, so they may be garbage collected if no other object is using them. In that case, this method will return null.

Specified by:
getTrackedObject in interface RepositoryInterface
Parameters:
trackingId - The id of the desired metadata object.
Returns:
Cached object obtained using its tracking id or null if the object isn't available in the cache.
Throws:
java.rmi.RemoteException - in the event of network errors.

addListener

public void addListener(RepositoryListenerInterface listener)
                 throws ServiceException,
                        java.rmi.RemoteException
Add a listener to receive event notifications from the repository instance. Events include disconnect, reconnect, and close. Other events may be added.

Specified by:
addListener in interface RepositoryInterface
Parameters:
listener - The object to add to the repository's list of event listeners.
Throws:
ServiceException - if a repository error occurs.
java.rmi.RemoteException - in the event of network errors.

removeListener

public void removeListener(RepositoryListenerInterface listener)
                    throws ServiceException,
                           java.rmi.RemoteException
Remove a listener from the list of active event listeners for this repository.

Specified by:
removeListener in interface RepositoryInterface
Parameters:
listener - The object to remove from the repository's list of event listeners.
Throws:
ServiceException - if a repository error occurs.
java.rmi.RemoteException - in the event of network errors.

notifyListeners

protected void notifyListeners(int event)
                        throws java.rmi.RemoteException
Notify listeners that a repository event has occurred (close, disconnect, reconnect).

Parameters:
event - The type of event that occurred.
Throws:
java.rmi.RemoteException

getUniqueId

public java.lang.String getUniqueId()
                             throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Get a unique identifier for this repository instance.

Specified by:
getUniqueId in interface RepositoryInterface
Returns:
A unique identifier.
Throws:
java.rmi.RemoteException - In the event of remote object failure.

isDestroyed

public boolean isDestroyed()
                    throws java.rmi.RemoteException
Description copied from interface: RepositoryInterface
Check if the repostiory instance has been closed.

Specified by:
isDestroyed in interface RepositoryInterface
Returns:
true if the repository has been closed, false otherwise.
Throws:
java.rmi.RemoteException - In the event of remote object failure.

getSmartType

protected java.lang.String getSmartType(java.lang.String key,
                                        AbstractRepository.SmartTypeHelper helper,
                                        java.util.Map rawData,
                                        org.apache.log4j.Logger logger)

pulseCheck

protected void pulseCheck()
                   throws ServiceException
Throws:
ServiceException



Copyright © 2009 SAS Institute Inc. All Rights Reserved.