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 String
CONTEXT_IS_JNDI_KEY
The JNDI variable key.static String
CONTEXT_REPOSITORY_KEY
The context repository key.static String
ROLE
The avalon role.static String
SESSION_JCR_SESSIONS_KEY
The session map key.
-
Constructor Summary
Constructors Constructor Description RepositoryProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextualize(Context context)
void
disconnect()
Disconnect from the repository.Credentials
getCredentials()
Get the credentials.Repository
getRepository()
Get the repository.Session
getSession(String workspaceName)
Get a session on the given workspace.Map<String,Session>
getSessions()
Get the JCR session map.boolean
isJndi()
Determines if the repository is obtained through JNDIvoid
registerRepository(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:
contextualize
in 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.
-
-