org.globus.delegation.service
Class DelegationResource

java.lang.Object
  extended by org.globus.delegation.service.DelegationResource
All Implemented Interfaces:
PersistenceCallback, RemoveCallback, Resource, ResourceIdentifier, ResourceLifetime, ResourceProperties, SecureResource

public class DelegationResource
extends java.lang.Object
implements Resource, ResourceIdentifier, ResourceLifetime, ResourceProperties, SecureResource, RemoveCallback, PersistenceCallback


Field Summary
private  java.lang.String callerDN
           
private  org.globus.gsi.GlobusCredential credential
           
private  ResourceSecurityDescriptor desc
           
private static org.globus.util.I18n i18n
           
private  java.util.HashMap listeners
           
private  java.lang.String localName
           
(package private) static org.apache.commons.logging.Log logger
           
private  FilePersistenceHelper persistenceHelper
           
private  ResourcePropertySet propSet
           
private  java.lang.String resourceId
           
static javax.xml.namespace.QName RP_SET
           
private  java.util.Calendar terminationTime
           
 
Constructor Summary
DelegationResource()
           
 
Method Summary
private  void addListener(DelegationListener listener)
           
 void addRefreshListener(DelegationListener listener)
          Register listener.
 void addRefreshListener(DelegationListener listener, javax.security.auth.Subject subject)
          Register listener.
private  void authorize()
           
private  void authorize(java.lang.String callerDN)
           
private  void authorize(javax.security.auth.Subject subject)
           
 void create(org.apache.ws.security.message.token.BinarySecurity _token, java.lang.String _callerDN, java.lang.String _localName, java.lang.String _resourceDescPath, java.lang.String id)
          Called only at resource creation time.
private  java.security.cert.X509Certificate[] getCertificateChain(org.apache.ws.security.message.token.BinarySecurity token)
           
 org.globus.gsi.GlobusCredential getCredential()
          Retireve credential.
 org.globus.gsi.GlobusCredential getCredential(javax.security.auth.Subject subject)
          Retrieve credential.
 java.util.Calendar getCurrentTime()
           
 java.lang.Object getID()
          Resource identifier interface
private  java.io.File getKeyAsFile(java.lang.Object key)
           
protected  FilePersistenceHelper getPersistenceHelper()
           
 ResourcePropertySet getResourcePropertySet()
          Resource property interface
 ResourceSecurityDescriptor getSecurityDescriptor()
          Secure resource interface
 java.util.Calendar getTerminationTime()
           
private  void initialize()
           
 void load(ResourceKey key)
          Loads and sets up the resource - credential, expiration time, listeners and security descriptor.
private  void notifyCredentialDelete()
           
private  void notifyListeners()
           
 void remove()
          Remove callback interface
 void removeRefreshListener(java.lang.String listenerId)
          Remove listener.
private  void setExpirationTime()
           
private  void setResourceDescriptor(java.lang.String resourceDescPath)
           
 void setTerminationTime(java.util.Calendar _terminationTime)
          Resource lifetime interface
private  void setTerminationTimeProperty()
           
private  void setToken(org.apache.ws.security.message.token.BinarySecurity token)
           
 void store()
          Persists the credential, callerDN, localName, resourceDescPath, termination time and listeners
 void storeToken(org.apache.ws.security.message.token.BinarySecurity token)
          Called on refresh.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

desc

private ResourceSecurityDescriptor desc

i18n

private static org.globus.util.I18n i18n

logger

static org.apache.commons.logging.Log logger

persistenceHelper

private FilePersistenceHelper persistenceHelper

credential

private org.globus.gsi.GlobusCredential credential

callerDN

private java.lang.String callerDN

localName

private java.lang.String localName

terminationTime

private java.util.Calendar terminationTime

listeners

private java.util.HashMap listeners

resourceId

private java.lang.String resourceId

propSet

private ResourcePropertySet propSet

RP_SET

public static final javax.xml.namespace.QName RP_SET
Constructor Detail

DelegationResource

public DelegationResource()
Method Detail

create

public void create(org.apache.ws.security.message.token.BinarySecurity _token,
                   java.lang.String _callerDN,
                   java.lang.String _localName,
                   java.lang.String _resourceDescPath,
                   java.lang.String id)
            throws DelegationException
Called only at resource creation time.

Throws:
DelegationException

storeToken

public void storeToken(org.apache.ws.security.message.token.BinarySecurity token)
                throws DelegationException
Called on refresh.

Throws:
DelegationException

getCredential

public org.globus.gsi.GlobusCredential getCredential()
                                              throws DelegationException
Retireve credential. API used by services in same container to obtain credentials. No remote interface

Throws:
DelegationException

getCredential

public org.globus.gsi.GlobusCredential getCredential(javax.security.auth.Subject subject)
                                              throws DelegationException
Retrieve credential. API used by services in same container to obtain credentials. No remote interface.

Throws:
DelegationException

addRefreshListener

public void addRefreshListener(DelegationListener listener)
                        throws DelegationException
Register listener. Does not have remote interface.

Throws:
DelegationException

addRefreshListener

public void addRefreshListener(DelegationListener listener,
                               javax.security.auth.Subject subject)
                        throws DelegationException
Register listener. Does not have remote interface.

Throws:
DelegationException

removeRefreshListener

public void removeRefreshListener(java.lang.String listenerId)
Remove listener. Does not have remote interface.


getResourcePropertySet

public ResourcePropertySet getResourcePropertySet()
Resource property interface

Specified by:
getResourcePropertySet in interface ResourceProperties

getID

public java.lang.Object getID()
Resource identifier interface

Specified by:
getID in interface ResourceIdentifier

setTerminationTime

public void setTerminationTime(java.util.Calendar _terminationTime)
Resource lifetime interface

Specified by:
setTerminationTime in interface ResourceLifetime

getTerminationTime

public java.util.Calendar getTerminationTime()
Specified by:
getTerminationTime in interface ResourceLifetime

getCurrentTime

public java.util.Calendar getCurrentTime()
Specified by:
getCurrentTime in interface ResourceLifetime

getSecurityDescriptor

public ResourceSecurityDescriptor getSecurityDescriptor()
Secure resource interface

Specified by:
getSecurityDescriptor in interface SecureResource

remove

public void remove()
            throws ResourceException
Remove callback interface

Specified by:
remove in interface RemoveCallback
Throws:
ResourceException

initialize

private void initialize()
                 throws DelegationException
Throws:
DelegationException

setToken

private void setToken(org.apache.ws.security.message.token.BinarySecurity token)
               throws DelegationException
Throws:
DelegationException

addListener

private void addListener(DelegationListener listener)
                  throws DelegationException
Throws:
DelegationException

setTerminationTimeProperty

private void setTerminationTimeProperty()

getCertificateChain

private java.security.cert.X509Certificate[] getCertificateChain(org.apache.ws.security.message.token.BinarySecurity token)
                                                          throws DelegationException
Throws:
DelegationException

setExpirationTime

private void setExpirationTime()

notifyListeners

private void notifyListeners()
                      throws DelegationException
Throws:
DelegationException

setResourceDescriptor

private void setResourceDescriptor(java.lang.String resourceDescPath)
                            throws DelegationException
Throws:
DelegationException

authorize

private void authorize(javax.security.auth.Subject subject)
                throws DelegationException
Throws:
DelegationException

authorize

private void authorize()
                throws DelegationException
Throws:
DelegationException

authorize

private void authorize(java.lang.String callerDN)
                throws DelegationException
Throws:
DelegationException

load

public void load(ResourceKey key)
          throws ResourceException,
                 NoSuchResourceException,
                 InvalidResourceKeyException
Loads and sets up the resource - credential, expiration time, listeners and security descriptor.

Specified by:
load in interface PersistenceCallback
Throws:
ResourceException
NoSuchResourceException
InvalidResourceKeyException

store

public void store()
           throws ResourceException
Persists the credential, callerDN, localName, resourceDescPath, termination time and listeners

Specified by:
store in interface PersistenceCallback
Throws:
ResourceException

getPersistenceHelper

protected FilePersistenceHelper getPersistenceHelper()

getKeyAsFile

private java.io.File getKeyAsFile(java.lang.Object key)
                           throws InvalidResourceKeyException
Throws:
InvalidResourceKeyException

notifyCredentialDelete

private void notifyCredentialDelete()