org.jasig.cas.services
Class DefaultServicesManagerImpl

java.lang.Object
  extended by org.jasig.cas.services.DefaultServicesManagerImpl
All Implemented Interfaces:
ReloadableServicesManager, ServicesManager

public final class DefaultServicesManagerImpl
extends java.lang.Object
implements ReloadableServicesManager

Default implementation of the ServicesManager interface. If there are no services registered with the server, it considers the ServicecsManager disabled and will not prevent any service from using CAS.

Since:
3.1
Version:
$Revision: 48180 $ $Date: 2010-03-14 00:05:58 -0500 (Sun, 14 Mar 2010) $
Author:
Scott Battaglia

Constructor Summary
DefaultServicesManagerImpl(ServiceRegistryDao serviceRegistryDao)
           
DefaultServicesManagerImpl(ServiceRegistryDao serviceRegistryDao, java.util.List<java.lang.String> defaultAttributes)
          Constructs an instance of the DefaultServicesManagerImpl where the default RegisteredService can include a set of default attributes to use if no services are defined in the registry.
 
Method Summary
protected  java.util.TreeSet<RegisteredService> convertToTreeSet()
           
 RegisteredService delete(long id)
          Delete the entry for this RegisteredService.
 RegisteredService findServiceBy(long id)
          Find a RegisteredService by matching with the supplied id.
 RegisteredService findServiceBy(Service service)
          Note, if the repository is empty, this implementation will return a default service to grant all access.
 java.util.Collection<RegisteredService> getAllServices()
          Retrieve the collection of all registered services.
 boolean matchesExistingService(Service service)
          Convenience method to let one know if a service exists in the data store.
 void reload()
          Inform the ServicesManager to reload its list of services if its cached them.
 void save(RegisteredService registeredService)
          Register a service with CAS, or update an existing an entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultServicesManagerImpl

public DefaultServicesManagerImpl(ServiceRegistryDao serviceRegistryDao)

DefaultServicesManagerImpl

public DefaultServicesManagerImpl(ServiceRegistryDao serviceRegistryDao,
                                  java.util.List<java.lang.String> defaultAttributes)
Constructs an instance of the DefaultServicesManagerImpl where the default RegisteredService can include a set of default attributes to use if no services are defined in the registry.

Parameters:
serviceRegistryDao - the Service Registry Dao.
defaultAttributes - the list of default attributes to use.
Method Detail

delete

@Transactional(readOnly=false)
public RegisteredService delete(long id)
Description copied from interface: ServicesManager
Delete the entry for this RegisteredService.

Specified by:
delete in interface ServicesManager
Parameters:
id - the id of the registeredService to delete.
Returns:
the registered service that was deleted, null if there was none.

findServiceBy

public RegisteredService findServiceBy(Service service)
Note, if the repository is empty, this implementation will return a default service to grant all access.

This preserves default CAS behavior.

Specified by:
findServiceBy in interface ServicesManager
Parameters:
service - the service to match with.
Returns:
the RegisteredService that matches the supplied service.

findServiceBy

public RegisteredService findServiceBy(long id)
Description copied from interface: ServicesManager
Find a RegisteredService by matching with the supplied id.

Specified by:
findServiceBy in interface ServicesManager
Parameters:
id - the id to match with.
Returns:
the RegisteredService that matches the supplied service.

convertToTreeSet

protected java.util.TreeSet<RegisteredService> convertToTreeSet()

getAllServices

public java.util.Collection<RegisteredService> getAllServices()
Description copied from interface: ServicesManager
Retrieve the collection of all registered services.

Specified by:
getAllServices in interface ServicesManager
Returns:
the collection of all services.

matchesExistingService

public boolean matchesExistingService(Service service)
Description copied from interface: ServicesManager
Convenience method to let one know if a service exists in the data store.

Specified by:
matchesExistingService in interface ServicesManager
Parameters:
service - the service to check.
Returns:
true if it exists, false otherwise.

save

@Transactional(readOnly=false)
public void save(RegisteredService registeredService)
Description copied from interface: ServicesManager
Register a service with CAS, or update an existing an entry.

Specified by:
save in interface ServicesManager
Parameters:
registeredService - the RegisteredService to update or add.

reload

public void reload()
Description copied from interface: ReloadableServicesManager
Inform the ServicesManager to reload its list of services if its cached them. Note that this is a suggestion and that ServicesManagers are free to reload whenever they want.

Specified by:
reload in interface ReloadableServicesManager


Copyright © 2004-2010 Java Architectures Special Interest Group. All Rights Reserved.