com.trendmicro.grid.acl.ds
Class RepositorySelector<R extends Repository>

java.lang.Object
  extended by com.trendmicro.grid.acl.ds.RepositorySelector<R>
All Implemented Interfaces:
RepositorySelectorMBean

public class RepositorySelector<R extends Repository>
extends Object
implements RepositorySelectorMBean

Is a helper class used to maintain the selection of an active repository.

Version:
1.0
Author:
juergen_kellerer, 2010-05-05

Constructor Summary
RepositorySelector()
           
RepositorySelector(Map<String,R> repositories, Class<R> repositoryClass)
           
 
Method Summary
 List<String> getAvailableKeys()
          Returns a list of all registered implementations.
 long getLastModified()
           
 R getRepository()
          Returns the currently selected repository.
 R getRepository(String key)
           
 String getRepositoryClass()
          Returns the interface of the repository that this selector is selecting the implementation for.
 String getSelectedKey()
          Returns the name of the currently selected repository implementation.
 boolean hasSelection()
           
 void init(Map<String,R> repositories, Class<R> repositoryClass)
           
 void initFrom(RepositorySelector<R> other)
           
 boolean isAutoSelectedKey()
           
 void setLastModified(long time)
           
 void setSelectedKey(String selectedKey)
          Sets the implementation key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositorySelector

public RepositorySelector()

RepositorySelector

public RepositorySelector(Map<String,R> repositories,
                          Class<R> repositoryClass)
Method Detail

initFrom

public void initFrom(RepositorySelector<R> other)

init

public void init(Map<String,R> repositories,
                 Class<R> repositoryClass)

getLastModified

public long getLastModified()

setLastModified

public void setLastModified(long time)

getRepositoryClass

public String getRepositoryClass()
Returns the interface of the repository that this selector is selecting the implementation for.

Specified by:
getRepositoryClass in interface RepositorySelectorMBean
Returns:
the interface of the repository

getRepository

public R getRepository(String key)

getRepository

public R getRepository()
Returns the currently selected repository.

Returns:
the currently selected repository.

hasSelection

public boolean hasSelection()

isAutoSelectedKey

public boolean isAutoSelectedKey()

getSelectedKey

public String getSelectedKey()
Returns the name of the currently selected repository implementation.

Specified by:
getSelectedKey in interface RepositorySelectorMBean
Returns:
the name of the currently selected repository implementation.

setSelectedKey

public void setSelectedKey(String selectedKey)
Sets the implementation key.

Specified by:
setSelectedKey in interface RepositorySelectorMBean
Parameters:
selectedKey - the implementation key.

getAvailableKeys

public List<String> getAvailableKeys()
Returns a list of all registered implementations.

Specified by:
getAvailableKeys in interface RepositorySelectorMBean
Returns:
a list of all registered implementations.