Skip navigation links

Oracle Beehive Java Content Repository Java API Reference
Release 1 (1.5)

E14840-01


oracle.ocs.jcr
Interface OracleRepository

All Superinterfaces:
javax.naming.Referenceable, javax.jcr.Repository, java.io.Serializable

public interface OracleRepository
extends javax.jcr.Repository, java.io.Serializable, javax.naming.Referenceable

This interface is the entry point into the content repository. The repository as a whole is represented by a OracleRepository object, which is acquired by RepositoryFactory. OracleRepository objects are both Serializable and Referenceable, allowing them to be stored in a JNDI directory instead of being created and initialized each time. A client connects to the repository by calling OracleRepository.login()
by passing Credentials object as shown in the sample code below. The client gets a Session object tied to the specified workspace. Following piece of code shows the code snippet.

    // Create new Hashtable, to pass connection attributes
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, 
                 "oracle.j2ee.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
    env.put(Context.SECURITY_CREDENTIALS, "Welcome1");  
    env.put(Context.PROVIDER_URL, 
                     "opmn:ormi://stbcr04-2.us.oracle.com:6003:BEEAPP/jcr-service");

    BeehiveRepositoryConfiguration config = new BeehiveRepositoryConfiguration(env);
    // Get the repository with the given beehive repository configuration
    Repository rep = (Repository) RepositoryFactory.createRepository(config);

    //Create javax.jcr.SimpleCredentials object by giving username/password
    SimpleCredentials cred =
                     new SimpleCredentials(java.lang.String userID, char[] password);
    // Now login to Repository using credentials
    Session session = rep.login(cred);
 

Field Summary
static java.lang.String INITIAL_CONTEXT_FACTORY
          The Initial Context Factory value that we set to this attribute will be used during Java Naming and Directory Interface (JNDI) lookup of the JCR service.
static java.lang.String JCR_SERVICE
          Constant that stores the value of the JCR service name.
static java.lang.String PROVIDER_URL
          Constant specifying the name of the URL, where the JCR service is deployed.
static java.lang.String SECURITY_CREDENTIALS
          Constant specifying the credentials of the principal used in authenticating during JNDI lookup.
static java.lang.String SECURITY_PRINCIPAL
          Constant specifying the name of the principal used in authenticating during JNDI lookup.

 

Fields inherited from interface javax.jcr.Repository
LEVEL_1_SUPPORTED, LEVEL_2_SUPPORTED, OPTION_LOCKING_SUPPORTED, OPTION_OBSERVATION_SUPPORTED, OPTION_QUERY_SQL_SUPPORTED, OPTION_TRANSACTIONS_SUPPORTED, OPTION_VERSIONING_SUPPORTED, QUERY_XPATH_DOC_ORDER, QUERY_XPATH_POS_INDEX, REP_NAME_DESC, REP_VENDOR_DESC, REP_VENDOR_URL_DESC, REP_VERSION_DESC, SPEC_NAME_DESC, SPEC_VERSION_DESC

 

Method Summary
 java.lang.String getDescriptor(java.lang.String key)
          Returns the descriptor for the specified key.
 java.lang.String[] getDescriptorKeys()
          Returns a string array holding all descriptor keys available for this implementation.
 javax.jcr.Session login()
          Authenticates the user without credentials.
 javax.jcr.Session login(javax.jcr.Credentials credentials)
          Authenticates the user using the supplied credentials to the default workspace.
 javax.jcr.Session login(javax.jcr.Credentials credentials, java.lang.String workspaceName)
          Authenticates the user using the supplied credentials.
 javax.jcr.Session login(java.lang.String workspaceName)
          Authenticates the user without credentials.

 

Methods inherited from interface javax.naming.Referenceable
getReference

 

Field Detail

INITIAL_CONTEXT_FACTORY

static final java.lang.String INITIAL_CONTEXT_FACTORY
The Initial Context Factory value that we set to this attribute will be used during Java Naming and Directory Interface (JNDI) lookup of the JCR service.
See Also:
Constant Field Values

SECURITY_PRINCIPAL

static final java.lang.String SECURITY_PRINCIPAL
Constant specifying the name of the principal used in authenticating during JNDI lookup.
See Also:
Constant Field Values

SECURITY_CREDENTIALS

static final java.lang.String SECURITY_CREDENTIALS
Constant specifying the credentials of the principal used in authenticating during JNDI lookup.
See Also:
Constant Field Values

PROVIDER_URL

static final java.lang.String PROVIDER_URL
Constant specifying the name of the URL, where the JCR service is deployed.
See Also:
Constant Field Values

JCR_SERVICE

static final java.lang.String JCR_SERVICE
Constant that stores the value of the JCR service name. The value of this constant is "jcr-service"
See Also:
Constant Field Values

Method Detail

getDescriptorKeys

java.lang.String[] getDescriptorKeys()
Returns a string array holding all descriptor keys available for this implementation. This set must contain at least the built-in keys defined by the string constants in this interface.Used in conjunction with getDescriptor(String name) to query information about this repository implementation.
Specified by:
getDescriptorKeys in interface javax.jcr.Repository

getDescriptor

java.lang.String getDescriptor(java.lang.String key)
Returns the descriptor for the specified key. Used to query information about this repository implementation. The set of available keys can be found by calling getDescriptorKeys(). If the specified key is not found, null is returned.
Specified by:
getDescriptor in interface javax.jcr.Repository
Parameters:
key - a string corresponding to a descriptor for this repository implementation.
Returns:
a descriptor string

login

javax.jcr.Session login(javax.jcr.Credentials credentials,
                        java.lang.String workspaceName)
                        throws javax.jcr.LoginException,
                               javax.jcr.NoSuchWorkspaceException,
                               javax.jcr.RepositoryException
Authenticates the user using the supplied credentials. The credentials object should contain user name and password. Along with these, it should contain following attributes, which are used in ejb lookup of jcr service.
1. INITIAL_CONTEXT_FACTORY
2. SECURITY_PRINCIPAL
3. SECURITY_CREDENTIALS
4. PROVIDER_URL

workspaceName is null since multiple workspaces are not supported

Since workspaceName is null, a default workspace is automatically selected by the repository implementation. This is the "home workspace" of the user whose credentials were passed.

If authentication or authorization for the specified workspace fails, a LoginException is thrown.

If workspaceName is not recognized, a NoSuchWorkspaceException is thrown.

Specified by:
login in interface javax.jcr.Repository
Parameters:
credentials - The credentials of the user
workspaceName - the name of a workspace.
Returns:
a valid session for the user to access the repository.
Throws:
javax.jcr.LoginException - If the login fails.
javax.jcr.NoSuchWorkspaceException - If the specified workspaceName is not recognized.
javax.jcr.RepositoryException - if another error occurs.

login

javax.jcr.Session login(javax.jcr.Credentials credentials)
                        throws javax.jcr.LoginException,
                               javax.jcr.RepositoryException
Authenticates the user using the supplied credentials to the default workspace.
Specified by:
login in interface javax.jcr.Repository
Parameters:
credentials - The credentials of the user
Returns:
a valid session for the user to access the repository.
Throws:
javax.jcr.LoginException - If the login authentication fails.
javax.jcr.RepositoryException - if another error occurs.

login

javax.jcr.Session login(java.lang.String workspaceName)
                        throws javax.jcr.LoginException,
                               javax.jcr.NoSuchWorkspaceException,
                               javax.jcr.RepositoryException
Authenticates the user without credentials.
Specified by:
login in interface javax.jcr.Repository
Returns:
a valid session for the user to access the repository.
Throws:
javax.jcr.LoginException - If the login authentication fails.
javax.jcr.NoSuchWorkspaceException - If the specified workspaceName is not recognized.
javax.jcr.RepositoryException - if another error occurs.

login

javax.jcr.Session login()
                        throws javax.jcr.LoginException,
                               javax.jcr.RepositoryException
Authenticates the user without credentials.
Specified by:
login in interface javax.jcr.Repository
Returns:
a valid session for the user to access the repository.
Throws:
javax.jcr.LoginException - If the login authentication fails.
javax.jcr.RepositoryException - if another error occurs.

Skip navigation links

Oracle Beehive Java Content Repository Java API Reference
Release 1 (1.5)

E14840-01


Copyright © 2008, 2009, Oracle and/or its affiliates. All rights reserved.