All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.modeshape.jdbc.delegate.RepositoryDelegate Maven / Gradle / Ivy

Go to download

JDBC driver to allow clients to use JCR-SQL2 to query a ModeShape JCR repository within the same JVM process.

There is a newer version: 5.4.1.Final
Show newest version
/*
 * ModeShape (http://www.modeshape.org)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.modeshape.jdbc.delegate;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collection;
import java.util.Set;
import javax.jcr.RepositoryException;
import javax.jcr.nodetype.NodeType;
import javax.jcr.query.QueryResult;
import org.modeshape.jdbc.DriverInfo;

/**
 * Represents the communication interface thru which the JDBC logic will obtain a connection and issue commands to the Jcr layer.
 */

public interface RepositoryDelegate {

    /**
     * Call to get the connection information.
     * 
     * @return ConnectionInfo
     */
    ConnectionInfo getConnectionInfo();

    /**
     * Called when the {@link Statement} the is closed. This enables the underlying connection to the JcrRepository remain open
     * until the statement is finished using it.
     */
    void closeStatement();

    /**
     * Call to close the delegate connection and any outstanding transactions will be closed.
     * 
     * @see java.sql.Connection#close()
     */
    void close();

    /**
     * Call to get {@link NodeType} based on specified name
     * 
     * @param name
     * @return NodeType
     * @throws RepositoryException
     */
    NodeType nodeType( String name ) throws RepositoryException;

    /**
     * Call to get all the {@link NodeType}s defined.
     * 
     * @return List of all the node types.
     * @throws RepositoryException
     */
    Collection nodeTypes() throws RepositoryException;

    /**
     * Call to execute the query based on the specified JCR language.
     * 
     * @param query is the query expression to execute
     * @param language is the JCR language the query should be executed based on.
     * @return QueryResult is the JCR query result
     * @throws RepositoryException
     */
    QueryResult execute( String query,
                         String language ) throws RepositoryException;

    /**
     * Generate the plan for the query based on the specified JCR language.
     * 
     * @param query is the query expression to execute
     * @param language is the JCR language the query should be executed based on.
     * @return the string representation of the query plan
     * @throws RepositoryException
     */
    String explain( String query,
                    String language ) throws RepositoryException;

    /**
     * Call to create the connection based on the implementation of this interface.
     * 
     * @param info the driver information
     * @return Connection
     * @throws SQLException
     * @see java.sql.Driver#connect(String, java.util.Properties)
     */
    Connection createConnection( DriverInfo info ) throws SQLException;

    /**
     * @see java.sql.Connection#commit()
     * @throws RepositoryException
     */

    void commit() throws RepositoryException;

    /**
     * @see java.sql.Connection#rollback()
     * @throws RepositoryException
     */
    void rollback() throws RepositoryException;

    /**
     * @see java.sql.Connection#isValid(int)
     * @param timeout
     * @return boolean indicating if timeout is valid
     * @throws RepositoryException
     */
    boolean isValid( int timeout ) throws RepositoryException;

    /**
     * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
     * @param iface
     * @return boolean
     */
    boolean isWrapperFor( Class iface );

    /**
     * @see java.sql.Wrapper#unwrap(java.lang.Class)
     * @param iface
     * @param 
     * @return  T
     * @throws SQLException
     */
     T unwrap( Class iface ) throws SQLException;

    /**
     * Called to get all the repository names currently available in the ModeShapeEngine.
     *
     * @return Set of repository names
     * @throws RepositoryException
     */
    Set getRepositoryNames() throws RepositoryException;

    /**
     * Returns the value for the requested descriptorKey
     * 
     * @param descriptorKey
     * @return String descriptor value
     */
    String getDescriptor( String descriptorKey );

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy