Package org.ametys.plugins.repositoryapp
Class RepositoryProvider
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.repositoryapp.RepositoryProvider
-
- All Implemented Interfaces:
Component,Contextualizable,LogEnabled
public class RepositoryProvider extends AbstractLogEnabled implements Contextualizable, Component
Repository helper.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCONTEXT_IS_JNDI_KEYThe JNDI variable key.static StringCONTEXT_REPOSITORY_KEYThe context repository key.static StringROLEThe avalon role.static StringSESSION_JCR_SESSIONS_KEYThe session map key.
-
Constructor Summary
Constructors Constructor Description RepositoryProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextualize(Context context)voiddisconnect()Disconnect from the repository.CredentialsgetCredentials()Get the credentials.RepositorygetRepository()Get the repository.SessiongetSession(String workspaceName)Get a session on the given workspace.Map<String,Session>getSessions()Get the JCR session map.booleanisJndi()Determines if the repository is obtained through JNDIvoidregisterRepository(Repository repository, Credentials credentials, boolean jndi)Register a repository.-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
SESSION_JCR_SESSIONS_KEY
public static final String SESSION_JCR_SESSIONS_KEY
The session map key.- See Also:
- Constant Field Values
-
CONTEXT_REPOSITORY_KEY
public static final String CONTEXT_REPOSITORY_KEY
The context repository key.- See Also:
- Constant Field Values
-
CONTEXT_IS_JNDI_KEY
public static final String CONTEXT_IS_JNDI_KEY
The JNDI variable key.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RepositoryProvider
public RepositoryProvider()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
getRepository
public Repository getRepository()
Get the repository.- Returns:
- the repository.
-
getCredentials
public Credentials getCredentials()
Get the credentials.- Returns:
- the credentials.
-
isJndi
public boolean isJndi()
Determines if the repository is obtained through JNDI- Returns:
- true if the repository is obtained through JNDI
-
registerRepository
public void registerRepository(Repository repository, Credentials credentials, boolean jndi)
Register a repository.- Parameters:
repository- The repository to registercredentials- The credentials to connectjndi- True to connect using jndi
-
getSessions
public Map<String,Session> getSessions()
Get the JCR session map.- Returns:
- a Map of the JCR sessions, indexed by workspace name.
-
getSession
public Session getSession(String workspaceName) throws RepositoryException
Get a session on the given workspace.- Parameters:
workspaceName- the workspace name.- Returns:
- the JCR session.
- Throws:
RepositoryException- if an error occurred
-
disconnect
public void disconnect()
Disconnect from the repository.
-
-