Android Open Source - jepldroid J E P L Data Source






From Project

Back to project page jepldroid.

License

The source code is released under:

Apache License

If you think the Android project jepldroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
   Copyright 2011 Jose Maria Arranz Santamaria
/*from   w ww. ja  va  2  s .com*/
   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 jepl;

import javax.sql.DataSource;

/**
 * This interface is a wrapper of a standard JDBC DataSource managed by JEPLayer.
 *
 * @author jmarranz
 */
public interface JEPLDataSource extends JEPLUserData
{
    /**
     * Returns the parent object factory of this object.
     *
     * @return the parent factory.
     */
    public JEPLBoot getJEPLBoot();

    /**
     * Returns the wrapped DataSource.
     *
     * @return the wrapped DataSource.
     */
    public DataSource getDataSource();

    /**
     * Returns whether any PreparedStatement object used is cached for several
     * sentences when the SQL code is the same.
     * 
     * <p>If this method returns true, java.sql.PreparedStatement objects are reused when possible
     * (when the SQL sentence is the same), in this case be careful with PreparedStatement
     * configuration calling methods like setMaxRows or setFetchSize because the same
     * PreparedStatement object is reused to perform several queries. You can restore
     * to the default state inmediately after executing every query (do not mind of threads because by design
     * a PreparedStatement cannot be used for several concurrent threads and JEPLayer respects
     * this JDBC contract).
     * </p>
     *
     * 
     * @return true if PreparedStatement objects are cached. By default is true.
     * @see #setPreparedStatementCached(boolean)
     */
    public boolean isPreparedStatementCached();

    /**
     * Sets whether any PreparedStatement object used is cached for several
     * sentences when the SQL code is the same.
     *
     * @param value true for caching statements.
     * @see #isPreparedStatementCached()
     */
    public void setPreparedStatementCached(boolean value);

    /**
     * Returns the current connection being used by this thread in the time of calling.
     *
     * @return the current connection of this thread. Null if there is no connection in use.
     */
    public JEPLConnection getCurrentJEPLConnection();

    /**
     * Registers a lifecycle listener associated to this object.
     *
     * <p>If the provided listener implements several JEPLayer interfaces, this method
     * registers all of them.</p>
     *
     * <p>This method can be called several times. Only one listener of the same type is
     * registered replacing previous registries.</p>
     *
     * @param listener the lifecycle listener object.
     */
    public void addJEPLListener(JEPLListener listener);

    /**
     * Unregisters the specified listener.
     *
     * @param listener the listener to remove.
     */
    public void removeJEPLListener(JEPLListener listener);

    /**
     * Creates a new standalone DAL object associated to this data source.
     *
     * @return the new standalone DAL object.
     */
    public JEPLDAL createJEPLDAL();

    /**
     * Creates a new standalone DAO object associated to this data source.
     *
     * @param type the Class type of user defined data model objects of the new DAO object.
     * @return the new standalone DAO object.
     */
    public <T> JEPLDAO<T> createJEPLDAO(Class<T> type);

    /**
     * Creates a default {@link JEPLResultSetDAOListener} bean providing automatic mapping
     * between your user data model objects and data base rows.
     *
     * @param <T> the type of the user data model Class to map.
     * @param clasz the class of the user data model Class to map.
     * @param mapper optional mapper (may be null) to change default mapping behavior for concrete properties.
     * @return a new result set mapper bean.
     */
    public <T> JEPLResultSetDAOListenerDefault<T> createJEPLResultSetDAOListenerDefault(Class<T> clasz,JEPLRowBeanMapper<T> mapper);

    /**
     * Creates a default {@link JEPLResultSetDAOListener} bean providing automatic mapping
     * between your user data model objects and data base rows.
     *
     * @param <T> the type of the user data model Class to map.
     * @param clasz the class of the user data model Class to map.
     * @return a new result set mapper bean.
     * @see #createJEPLResultSetDAOListenerDefault(Class,JEPLRowBeanMapper)
     */
    public <T> JEPLResultSetDAOListenerDefault<T> createJEPLResultSetDAOListenerDefault(Class<T> clasz);


    /**
     * Executes the specified task, a JDBC Connection is got from DataSource in the beginning
     * and released in the end.
     *
     * <p>If this object is a {@link JEPLJTADataSource} the transactional behavior of the task
     * is defined by the annotation {@link JEPLTransactionalJTA} if present in the {@link JEPLTask#exec()}
     * of the {@link JEPLTask} parameter, if not present the default transaction propagation
     * returned by {@link JEPLJTADataSource#getDefaultJEPLTransactionPropagation()} is applied.
     * </p>
     *
     * <p>If this object is a {@link JEPLNonJTADataSource} the transactional behavior of the task
     * is defined by the annotation {@link JEPLTransactionalNonJTA} if present in the {@link JEPLTask#exec()}
     * of the {@link JEPLTask} parameter, if not present the default auto-commit mode
     * returned by {@link JEPLNonJTADataSource#isDefaultAutoCommit()} is applied.
     * </p>
     *
     *
     * @param <T> the type of the result value of the task.
     * @param task the task to be executed.
     * @return the same value returned by the task.
     */
    public <T> T exec(JEPLTask<T> task);

    /**
     * Executes the specified task, a JDBC Connection is got from DataSource in the beginning
     * and released in the end.
     *
     * <p>The optional listener provided as parameter can modify the transactional behavior
     * of the task, see {@link JEPLConnectionListener}.</p>
     *
     * @param <T> the type of the result value of the task.
     * @param task the task to be executed.
     * @param listener an optional listener. May be null.
     * @return the same value returned by the task.
     * @see #exec(JEPLTask) 
     */
    public <T> T exec(JEPLTask<T> task,JEPLListener listener);

}




Java Source Code List

com.innowhere.jepldroidtest.JEPLDroidTestActivity.java
jepl.JEPLBootNonJTA.java
jepl.JEPLBootRoot.java
jepl.JEPLBoot.java
jepl.JEPLCachedResultSet.java
jepl.JEPLConnectionListener.java
jepl.JEPLConnection.java
jepl.JEPLDALQuery.java
jepl.JEPLDAL.java
jepl.JEPLDAOQuery.java
jepl.JEPLDAO.java
jepl.JEPLDataSource.java
jepl.JEPLException.java
jepl.JEPLListener.java
jepl.JEPLNonJTADataSource.java
jepl.JEPLParameter.java
jepl.JEPLPreparedStatementListener.java
jepl.JEPLPreparedStatement.java
jepl.JEPLResultSetDALListener.java
jepl.JEPLResultSetDAOListenerDefault.java
jepl.JEPLResultSetDAOListener.java
jepl.JEPLResultSetDAO.java
jepl.JEPLResultSet.java
jepl.JEPLRowBeanMapper.java
jepl.JEPLStatement.java
jepl.JEPLTask.java
jepl.JEPLTransactionPropagation.java
jepl.JEPLTransaction.java
jepl.JEPLTransactionalJTA.java
jepl.JEPLTransactionalNonJTA.java
jepl.JEPLUserData.java
jepl.impl.JEPLBootImpl.java
jepl.impl.JEPLBootRootImpl.java
jepl.impl.JEPLConnectionImpl.java
jepl.impl.JEPLCurrentTransactionImpl.java
jepl.impl.JEPLDALDefaultImpl.java
jepl.impl.JEPLDALImpl.java
jepl.impl.JEPLDAOImpl.java
jepl.impl.JEPLDataSourceImpl.java
jepl.impl.JEPLListenerListImpl.java
jepl.impl.JEPLPreparedStatementDefaultImpl.java
jepl.impl.JEPLPreparedStatementImpl.java
jepl.impl.JEPLStatementImpl.java
jepl.impl.JEPLTaskExecContextImpl.java
jepl.impl.JEPLTaskExecContextInConnectionImpl.java
jepl.impl.JEPLTaskOneExecWithConnectionImpl.java
jepl.impl.JEPLTaskOneExecWithConnectionWrapperImpl.java
jepl.impl.JEPLTaskOneExecutionImpl.java
jepl.impl.JEPLTaskOneExecutionWrapperImpl.java
jepl.impl.JEPLUserDataMonoThreadImpl.java
jepl.impl.JEPLUserDataMultiThreadImpl.java
jepl.impl.JEPLUtilImpl.java
jepl.impl.lex.Cursor.java
jepl.impl.lex.Identifier.java
jepl.impl.lex.JDBCParamStandardToken.java
jepl.impl.lex.JDBCParamToken.java
jepl.impl.lex.JDBCParamWithNameToken.java
jepl.impl.lex.JDBCParamWithNumberToken.java
jepl.impl.lex.OtherCharToken.java
jepl.impl.lex.SourceCode.java
jepl.impl.lex.Space.java
jepl.impl.lex.StringDoubleQuote.java
jepl.impl.lex.StringLiteral.java
jepl.impl.lex.StringSimpleQuote.java
jepl.impl.lex.TestSourceCode.java
jepl.impl.lex.TokenFilter.java
jepl.impl.lex.Token.java
jepl.impl.nonjta.JEPLBootNonJTAImpl.java
jepl.impl.nonjta.JEPLCurrentTransactionNonJTAImpl.java
jepl.impl.nonjta.JEPLNonJTAConnectionDefaultImpl.java
jepl.impl.nonjta.JEPLNonJTAConnectionImpl.java
jepl.impl.nonjta.JEPLNonJTADataSourceDefaultImpl.java
jepl.impl.nonjta.JEPLNonJTADataSourceImpl.java
jepl.impl.nonjta.JEPLTaskExecContextInConnectionNonJTAImpl.java
jepl.impl.nonjta.android.JEPLNonJTAConnectionSQLDroidImpl.java
jepl.impl.nonjta.android.JEPLNonJTADataSourceAndroidImpl.java
jepl.impl.nonjta.android.JEPLPreparedStatementSQLDroidImpl.java
jepl.impl.query.JEPLCachedResultSetImpl.java
jepl.impl.query.JEPLDALQueryImpl.java
jepl.impl.query.JEPLDAOQueryImpl.java
jepl.impl.query.JEPLParameterDecImpl.java
jepl.impl.query.JEPLParameterDecWithNameImpl.java
jepl.impl.query.JEPLParameterDecWithNumberImpl.java
jepl.impl.query.JEPLParameterImpl.java
jepl.impl.query.JEPLParameterValueImpl.java
jepl.impl.query.JEPLParameterValueNamedImpl.java
jepl.impl.query.JEPLParameterWithNameImpl.java
jepl.impl.query.JEPLParameterWithNumberImpl.java
jepl.impl.query.JEPLPropertyDescriptorImpl.java
jepl.impl.query.JEPLPropertyDescriptorJavaBeansImpl.java
jepl.impl.query.JEPLQueryParsedCacheImpl.java
jepl.impl.query.JEPLQueryParsedImpl.java
jepl.impl.query.JEPLResultSetBeanInfo.java
jepl.impl.query.JEPLResultSetDAOImpl.java
jepl.impl.query.JEPLResultSetDAOIteratorImpl.java
jepl.impl.query.JEPLResultSetDAOListenerDefaultImpl.java
jepl.impl.query.JEPLResultSetDefaultImpl.java
jepl.impl.query.JEPLResultSetImpl.java