001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.sql.framework.model;
042:
043: import java.util.List;
044: import java.util.Map;
045: import org.netbeans.modules.sql.framework.model.visitors.SQLVisitedObject;
046: import com.sun.sql.framework.exception.BaseException;
047:
048: /**
049: * Root container interface for holding SQL model objects.
050: *
051: * @author Sudhi Seshachala
052: * @author Ahimanikya Satapathy
053: * @version $Revision$
054: */
055: public interface SQLDefinition extends SQLContainerObject,
056: SQLVisitedObject {
057:
058: public static final String ATTR_CONTAINS_JAVA_OPERATORS = "containsJavaOperators";
059: public static final String ATTR_DISPLAYNAME = "displayName";
060: public static final String ATTR_EXECUTION_STRATEGY_CODE = "executionStrategyCode";
061: public static final String ATTR_VERSION = "version";
062: // Execution Strategy codes
063: public static final int EXECUTION_STRATEGY_BEST_FIT = 0;
064: public static final int EXECUTION_STRATEGY_DEFAULT = EXECUTION_STRATEGY_BEST_FIT;
065: public static final int EXECUTION_STRATEGY_PIPELINE = 1;
066: public static final int EXECUTION_STRATEGY_STAGING = 2;
067: //Response TYPES
068: public static final int EXECUTION_STRATEGY_WEBBROWSET = 1;
069: public static final int EXECUTION_STRATEGY_RELATIONALMAP = 2;
070: /** XML formatting constant: indent prefix */
071: public static final String INDENT = " ";
072:
073: public static final String AXION_DB_WORKING_FOLDER = "AxionWorkingFolder";
074: public static final String AXION_DB_INSTANCE_NAME = "AxionInstanceName";
075:
076: /**
077: * add an sql object listener
078: *
079: * @param listener sql object listener
080: */
081: public void addSQLObjectListener(SQLObjectListener listener);
082:
083: /**
084: * Clear Catalog and Schema names overrides from all DatabaseModel
085: */
086: public void clearOverride(boolean clearCatalog, boolean clearSchema);
087:
088: /**
089: * generate unique id for objects in this sqldefinition
090: */
091: public String generateId();
092:
093: /**
094: * Gets the List of Databases
095: *
096: * @return java.util.List for this
097: */
098: public List<SQLDBModel> getAllDatabases();
099:
100: /**
101: * set the condition text
102: *
103: * @param text condition text
104: */
105: public void setExecutionStrategyStr(String text);
106:
107: /**
108: * sets the working folder where axion instance will
109: * run this colloboration
110: * @param appDataRoot
111: */
112: public void setWorkingFolder(String appDataRoot);
113:
114: /**
115: * sets the name of the axion instance where this etl
116: * colloboration is run
117: * @param dbInstanceName
118: */
119: public void setDbInstanceName(String dbInstanceName);
120:
121: /**
122: * getter for axion db working folder
123: * @return
124: */
125: public String getDBWorkingFolder();
126:
127: /**
128: * getter for the axion database instance name
129: * @return
130: */
131: public String getDbInstanceName();
132:
133: public Object getAttributeValue(String attrName);
134:
135: /**
136: * Gets display name.
137: *
138: * @return current display name
139: */
140: public String getDisplayName();
141:
142: /**
143: * Gets execution strategy code set.
144: *
145: * @return
146: */
147: public Integer getExecutionStrategyCode();
148:
149: /**
150: * Gets execution strategy string value .
151: *
152: * @return
153: */
154: public String getExecutionStrategyStr();
155:
156: /**
157: * get all join sources. This includes tables which are not part of any join view and
158: * joinviews.
159: *
160: * @return list of join sources
161: */
162: public List<DBTable> getJoinSources();
163:
164: /**
165: * Gets the Root SQLJoinOperator object, if any, from the given List
166: *
167: * @param sourceTables List of source table SQLObjects
168: * @return SQLObject root join
169: * @throws BaseException if error occurs while resolving root join
170: */
171: public SQLObject getRootJoin(List<DBTable> sourceTables)
172: throws BaseException;
173:
174: /**
175: * get runtime db model
176: *
177: * @return runtime dbmodel
178: */
179: public RuntimeDatabaseModel getRuntimeDbModel();
180:
181: /**
182: * Gets the List of SourceColumns
183: *
184: * @return List, possibly empty, of SourceColumns
185: */
186: public List<DBColumn> getSourceColumns();
187:
188: /**
189: * Gets a List of target DatabaseModels
190: *
191: * @return List, possibly empty, of source DatabaseModels
192: */
193: public List<SQLDBModel> getSourceDatabaseModels();
194:
195: /**
196: * Gets the List of SourceTables
197: *
198: * @return List, possibly empty, of SourceTables
199: */
200: public List<DBTable> getSourceTables();
201:
202: public SQLFrameworkParentObject getSQLFrameworkParentObject();
203:
204: /**
205: * get the tag name for this SQLDefinition override at subclass level to return a
206: * different tag name
207: *
208: * @return tag name to be used in xml representation of this object
209: */
210: public String getTagName();
211:
212: /**
213: * Gets the List of TargetColumns
214: *
215: * @return List, possibly empty, of TargetColumns
216: */
217: public List<DBColumn> getTargetColumns();
218:
219: /**
220: * Gets a List of target DatabaseModels
221: *
222: * @return List, possibly empty, of target DatabaseModels
223: */
224: public List<SQLDBModel> getTargetDatabaseModels();
225:
226: /**
227: * Gets the List of TargetTables
228: *
229: * @return List, possibly empty, of TargetTables
230: */
231: public List<DBTable> getTargetTables();
232:
233: /**
234: * Indicates whether this model has data validation conditions.
235: *
236: * @return true if data validation conditions exist; false otherwise
237: */
238: public boolean hasValidationConditions();
239:
240: /**
241: * Check if a java operator is used in the model.
242: *
243: * @return true if a java operator is used.
244: */
245: public boolean isContainsJavaOperators();
246:
247: /**
248: * Check if a table already exists in this definition
249: *
250: * @param table - table
251: * @return Object - the existing table
252: * @throws BaseException - exception
253: */
254: public Object isTableExists(DBTable table) throws BaseException;
255:
256: /**
257: * Applies whatever rules are appropriate to migrate the current object model to the
258: * current version of SQLDefinition as implemented by the concrete class.
259: *
260: * @throws BaseException if error occurs during migration
261: */
262: public void migrateFromOlderVersions() throws BaseException;
263:
264: /**
265: * Override Catalog names in proper DatabaseModel
266: * @param overrideMapMap
267: */
268: public void overrideCatalogNamesForDb(Map overrideMapMap);
269:
270: /**
271: * Override Schema names in proper DatabaseModel
272: * @param overrideMapMap
273: */
274: public void overrideSchemaNamesForDb(Map overrideMapMap);
275:
276: /**
277: * remove sql object listener
278: *
279: * @param listener sql object listener
280: */
281: public void removeSQLObjectListener(SQLObjectListener listener);
282:
283: /**
284: * check if we have to use axion database if definition contains a java operator or
285: * there is a validation condition on one of source tables.
286: *
287: * @return
288: */
289: public boolean requiresPipelineProcess();
290:
291: public void setAttribute(String attrName, Object val);
292:
293: /**
294: * set it to true if a java operator is used in the model
295: *
296: * @param javaOp true if there is a java operator
297: */
298: public void setContainsJavaOperators(boolean javaOp);
299:
300: /**
301: * Sets display name to given value.
302: *
303: * @param newName new display name
304: */
305: public void setDisplayName(String newName);
306:
307: /**
308: * Sets the execution strategy.
309: *
310: * @param code
311: */
312: public void setExecutionStrategyCode(Integer code);
313:
314: public void setSQLFrameworkParentObject(
315: SQLFrameworkParentObject newParent);
316:
317: public void setVersion(String newVersion);
318:
319: /**
320: * validate the definition starting from the target tables.
321: *
322: * @return Map of invalid input object as keys and reason as value
323: */
324: public List<ValidationInfo> validate();
325:
326: /**
327: * validate the definition starting from the target tables.
328: *
329: * @return Map of invalid input object as keys and reason as value
330: */
331: public List<ValidationInfo> badgeValidate();
332:
333: /**
334: * Validate Database synchronization. Identify any eTL Collaboration element which has been
335: * deleted or modified in Database.
336: *
337: * @return Map of invalid object as keys and reason as value
338: */
339: public List<ValidationInfo> validateDbSynchronization();
340: }
|