001: /*
002: * Copyright 2006 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
007: * BI Platform. The Initial Developer is Pentaho Corporation.
008: *
009: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
011: * the license for the specific language governing your rights and limitations.
012: *
013: * @created Oct 12, 2005
014: * @author James Dixon
015: */
016:
017: package org.pentaho.core.component;
018:
019: import java.util.Map;
020:
021: import org.pentaho.commons.connection.IPentahoConnection;
022: import org.pentaho.commons.connection.IPentahoResultSet;
023: import org.pentaho.commons.connection.IDisposable;
024:
025: /**
026: * The prepared component interface extends component,
027: * allowing components to go into a prepared state vs. execute
028: * state. These components may place themselves as an output
029: * parameter, and then be used later in the action-sequence
030: * for execution of prepared statements / etc.
031: *
032: * @author Will Gorman
033: *
034: * @see MDXBaseComponent
035: * @see SQLBaseComponent
036: * @see IPentahoResultSet
037: *
038: */
039: public interface IPreparedComponent extends IComponent, IDisposable {
040:
041: /**
042: * this term may appear when resolving parameters
043: * "{PREPARELATER:PARAM_NAME}"
044: */
045: public static final String PREPARE_LATER_PREFIX = "PREPARELATER"; //$NON-NLS-1$
046:
047: /**
048: * this is an intermediate term used when resolving parameters
049: * in the executePrepared call
050: */
051: public static final String PREPARE_LATER_INTER_PREFIX = "PREPARELATER_INTER"; //$NON-NLS-1$
052:
053: /**
054: * The name of the output. If this appears as an output of
055: * an IPreparedComponent the component should alter its
056: * behavior and go into prepared mode.
057: */
058: public static final String PREPARED_COMPONENT_NAME = "prepared_component"; //$NON-NLS-1$
059:
060: /**
061: * The type of the output. If this appears in an output of an
062: * IPreparedComponent the component should alter its behavior
063: * and go into prepared mode.
064: */
065: public static final String PREPARED_OUTPUT_TYPE = "prepared_component"; //$NON-NLS-1$
066:
067: /**
068: * A placeholder for template strings and potential prepared lists, so
069: * template fields can be replaced on the fly vs. during initial setup
070: * of a prepared statement
071: */
072: public static final String PREPARE_LATER_PLACEHOLDER = "prepare-later-placeholder"; //$NON-NLS-1$
073:
074: /**
075: * executes a prepared method that returns a result set
076: * executePrepared looks up any "PREPARELATER" params
077: * in the preparedParams map.
078: *
079: * @param preparedParams a map of possible parameters.
080: * @return result set
081: */
082: public IPentahoResultSet executePrepared(Map preparedParams);
083:
084: /**
085: * exposes the connection object for others to use. The connection object in a prepared
086: * component is not closed until parameters are disposed at the end of an action sequence
087: * execution.
088: *
089: * Note: getConnection was already in use when naming this method.
090: *
091: * @return connection object
092: */
093: public IPentahoConnection shareConnection();
094:
095: /**
096: * Disposes of resources held by the prepared component
097: */
098: public void dispose();
099:
100: }
|