1.1 --- a/etl.editor/src/org/netbeans/modules/etl/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
1.2 +++ b/etl.editor/src/org/netbeans/modules/etl/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
1.3 @@ -30,5 +30,6 @@
1.4 OpenIDE-Module-Name=eTL Editor
1.5 OpenIDE-Module-Short-Description=ETL Editor for editing and creating etl documents.
1.6
1.7 -Templates/SOA/untitled.etl=ETL
1.8 +Templates/SOA_ETL=SOA
1.9 +Templates/SOA_ETL/untitled.etl=ETL
1.10 Services/MIMEResolver/org-netbeans-modules-etl-mime-resolver.xml=ETL File
2.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/DBConnectionDefinitionTemplate.java Sat Dec 08 10:04:51 2007 +0000
2.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/DBConnectionDefinitionTemplate.java Sat Dec 08 10:24:35 2007 +0000
2.3 @@ -1,53 +1,29 @@
2.4 /*
2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.6 + * The contents of this file are subject to the terms of the Common Development
2.7 + * and Distribution License (the License). You may not use this file except in
2.8 + * compliance with the License.
2.9 *
2.10 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
2.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
2.12 + * or http://www.netbeans.org/cddl.txt.
2.13 *
2.14 - * The contents of this file are subject to the terms of either the GNU
2.15 - * General Public License Version 2 only ("GPL") or the Common
2.16 - * Development and Distribution License("CDDL") (collectively, the
2.17 - * "License"). You may not use this file except in compliance with the
2.18 - * License. You can obtain a copy of the License at
2.19 - * http://www.netbeans.org/cddl-gplv2.html
2.20 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
2.21 - * specific language governing permissions and limitations under the
2.22 - * License. When distributing the software, include this License Header
2.23 - * Notice in each file and include the License file at
2.24 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
2.25 - * particular file as subject to the "Classpath" exception as provided
2.26 - * by Sun in the GPL Version 2 section of the License file that
2.27 - * accompanied this code. If applicable, add the following below the
2.28 - * License Header, with the fields enclosed by brackets [] replaced by
2.29 - * your own identifying information:
2.30 + * When distributing Covered Code, include this CDDL Header Notice in each file
2.31 + * and include the License file at http://www.netbeans.org/cddl.txt.
2.32 + * If applicable, add the following below the CDDL Header, with the fields
2.33 + * enclosed by brackets [] replaced by your own identifying information:
2.34 * "Portions Copyrighted [year] [name of copyright owner]"
2.35 *
2.36 - * Contributor(s):
2.37 - *
2.38 * The Original Software is NetBeans. The Initial Developer of the Original
2.39 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
2.40 * Microsystems, Inc. All Rights Reserved.
2.41 - *
2.42 - * If you wish your version of this file to be governed by only the CDDL
2.43 - * or only the GPL Version 2, indicate your decision by adding
2.44 - * "[Contributor] elects to include this software in this distribution
2.45 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
2.46 - * single choice of license, a recipient has the option to distribute
2.47 - * your version of this file under either the CDDL, the GPL Version 2 or
2.48 - * to extend the choice of license to its licensees as provided above.
2.49 - * However, if you add GPL Version 2 code and therefore, elected the GPL
2.50 - * Version 2 license, then the option applies only if the new code is
2.51 - * made subject to such option by the copyright holder.
2.52 */
2.53
2.54 package org.netbeans.modules.etl.codegen;
2.55
2.56 import java.util.HashMap;
2.57 import java.util.Map;
2.58 -
2.59 import org.w3c.dom.Element;
2.60 import org.w3c.dom.Node;
2.61 import org.w3c.dom.NodeList;
2.62 -
2.63 import org.netbeans.modules.sql.framework.common.jdbc.SQLDBConnectionDefinition;
2.64 import org.netbeans.modules.sql.framework.common.utils.XmlUtil;
2.65 import com.sun.sql.framework.exception.BaseException;
2.66 @@ -59,20 +35,18 @@
2.67 * DBConnectionDefinitionTemplate basicaly reads the template and stores for codegen
2.68 *
2.69 * @author Sudhi Seshachala
2.70 - * @version $Revision$
2.71 */
2.72 +// FIXME: DO We still need this class? -- Ahi
2.73 +public class DBConnectionDefinitionTemplate {
2.74
2.75 -public class DBConnectionDefinitionTemplate {
2.76 public static final String KEY_DATABASE_NAME = "DatabaseName";
2.77 -
2.78 public static final String KEY_HOST_NAME = "HostName";
2.79 public static final String KEY_HOST_PORT = "HostPort";
2.80 public static final String KEY_LOCATION_NAME = "LocationName";
2.81 public static final String KEY_METADATA_DIR = "MetadataDir";
2.82 public static final String KEY_PARAM_LIST = "ParamList";
2.83 private static final String TEMPLATE = "org/netbeans/modules/etl/codegen/CodegenConnectionDefinitionTemplate.xml";
2.84 -
2.85 - private Map connectionDefinitions = new HashMap();
2.86 + private Map<String, SQLDBConnectionDefinition> connectionDefinitions = new HashMap<String, SQLDBConnectionDefinition>();
2.87
2.88 /**
2.89 * Default Constructor
2.90 @@ -92,7 +66,7 @@
2.91 */
2.92 public SQLDBConnectionDefinition getDBConnectionDefinition(String dbType) {
2.93 if (!StringUtil.isNullString(dbType)) {
2.94 - SQLDBConnectionDefinition orig = (SQLDBConnectionDefinition) connectionDefinitions.get(dbType.toLowerCase());
2.95 + SQLDBConnectionDefinition orig = connectionDefinitions.get(dbType.toLowerCase());
2.96 if (orig != null) {
2.97 orig = (SQLDBConnectionDefinition) orig.cloneObject();
2.98 }
2.99 @@ -116,6 +90,4 @@
2.100 }
2.101 }
2.102 }
2.103 -
2.104 }
2.105 -
3.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/ETLCodegenUtil.java Sat Dec 08 10:04:51 2007 +0000
3.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/ETLCodegenUtil.java Sat Dec 08 10:24:35 2007 +0000
3.3 @@ -1,70 +1,45 @@
3.4 /*
3.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3.6 + * The contents of this file are subject to the terms of the Common Development
3.7 + * and Distribution License (the License). You may not use this file except in
3.8 + * compliance with the License.
3.9 *
3.10 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
3.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
3.12 + * or http://www.netbeans.org/cddl.txt.
3.13 *
3.14 - * The contents of this file are subject to the terms of either the GNU
3.15 - * General Public License Version 2 only ("GPL") or the Common
3.16 - * Development and Distribution License("CDDL") (collectively, the
3.17 - * "License"). You may not use this file except in compliance with the
3.18 - * License. You can obtain a copy of the License at
3.19 - * http://www.netbeans.org/cddl-gplv2.html
3.20 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
3.21 - * specific language governing permissions and limitations under the
3.22 - * License. When distributing the software, include this License Header
3.23 - * Notice in each file and include the License file at
3.24 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
3.25 - * particular file as subject to the "Classpath" exception as provided
3.26 - * by Sun in the GPL Version 2 section of the License file that
3.27 - * accompanied this code. If applicable, add the following below the
3.28 - * License Header, with the fields enclosed by brackets [] replaced by
3.29 - * your own identifying information:
3.30 + * When distributing Covered Code, include this CDDL Header Notice in each file
3.31 + * and include the License file at http://www.netbeans.org/cddl.txt.
3.32 + * If applicable, add the following below the CDDL Header, with the fields
3.33 + * enclosed by brackets [] replaced by your own identifying information:
3.34 * "Portions Copyrighted [year] [name of copyright owner]"
3.35 *
3.36 - * Contributor(s):
3.37 - *
3.38 * The Original Software is NetBeans. The Initial Developer of the Original
3.39 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
3.40 * Microsystems, Inc. All Rights Reserved.
3.41 - *
3.42 - * If you wish your version of this file to be governed by only the CDDL
3.43 - * or only the GPL Version 2, indicate your decision by adding
3.44 - * "[Contributor] elects to include this software in this distribution
3.45 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
3.46 - * single choice of license, a recipient has the option to distribute
3.47 - * your version of this file under either the CDDL, the GPL Version 2 or
3.48 - * to extend the choice of license to its licensees as provided above.
3.49 - * However, if you add GPL Version 2 code and therefore, elected the GPL
3.50 - * Version 2 license, then the option applies only if the new code is
3.51 - * made subject to such option by the copyright holder.
3.52 */
3.53 package org.netbeans.modules.etl.codegen;
3.54
3.55 import java.util.UUID;
3.56 -
3.57 import org.netbeans.modules.etl.utils.ETLDeploymentConstants;
3.58 import org.netbeans.modules.mashup.db.model.FlatfileDefinition;
3.59 -import org.netbeans.modules.model.database.DBTable;
3.60 import org.netbeans.modules.sql.framework.model.SQLConstants;
3.61 import org.netbeans.modules.sql.framework.model.SQLDBModel;
3.62 -
3.63 import com.sun.sql.framework.exception.BaseException;
3.64 +import org.netbeans.modules.sql.framework.model.DBTable;
3.65
3.66 /**
3.67 * Utility methods for generating engine file, Please note the class modifiers should be
3.68 * scoped to default to restrict their access to members of this package only.
3.69 *
3.70 * @author Ahimanikya Satapathy
3.71 - * @version $Revision$
3.72 */
3.73 public class ETLCodegenUtil {
3.74 +
3.75 private static final String ETL_FOLDER = "eTL";
3.76 //private static final String LOG_CATEGORY = ETLCodegenUtil.class.getName();
3.77
3.78 //private static final MessageManager MESSAGE_MGR = MessageManager.getManager(ETLCodelet.class);
3.79 //private static final String IS_SECTION = "IS Configuration" ;
3.80 //private static final String IS_WORKSPACE_DIR = "WORKSPACEDIR" ;
3.81 -
3.82 // /**
3.83 // * Returns Folder for Monitor DB. Specific to each Collaboration/CMap service.
3.84 // * @param deployable
3.85 @@ -79,18 +54,17 @@
3.86 public static String getMonitorDBDir(String deployable, String workspaceDir) throws BaseException {
3.87 String monitorDBFolder = null;
3.88 try {
3.89 - String repOID = UUID.randomUUID().toString() ;
3.90 -
3.91 - // Use "/" for maximum portability as codegen OS may be different than OS on
3.92 + String repOID = UUID.randomUUID().toString();
3.93 +
3.94 + // Use "/" for maximum portability as codegen OS may be different than OS on
3.95 // which service is deployed.
3.96 - monitorDBFolder = workspaceDir + "/" + ETL_FOLDER + "/m/" + repOID + "/" + deployable + "/" ;
3.97 + monitorDBFolder = workspaceDir + "/" + ETL_FOLDER + "/m/" + repOID + "/" + deployable + "/";
3.98 } catch (Exception ex) {
3.99 throw new BaseException("Cannot create eTL monitor log folder.", ex);
3.100 }
3.101
3.102 return monitorDBFolder;
3.103 }
3.104 -
3.105 // public static String getRSWorkspaceDir (CodeGenFramework framework, ErrorBundle errorBundle,
3.106 // ProjectDeployment projDeployment, Deployable deployable) {
3.107 // String errorMessage = null;
3.108 @@ -173,40 +147,38 @@
3.109 public static String getEngineInstanceWorkingFolder(String appWorkspaceDirectory) {
3.110 String engineInstanceDBFolder = null;
3.111 // Use "/" as codegen OS may be different than OS on which deployed.
3.112 - engineInstanceDBFolder = appWorkspaceDirectory + "/"
3.113 - + ETL_FOLDER + "/i/"
3.114 - + ETLDeploymentConstants.PARAM_INSTANCE_DB_NAME+ "/";
3.115 + engineInstanceDBFolder = appWorkspaceDirectory + "/" + ETL_FOLDER + "/i/" + ETLDeploymentConstants.PARAM_INSTANCE_DB_NAME + "/";
3.116 return engineInstanceDBFolder;
3.117 }
3.118 -
3.119 - public static FlatfileDefinition getOtd(DBTable table) {
3.120 - if(table.getParent().getSource() != null) {
3.121 +
3.122 + public static FlatfileDefinition getFFDefinition(DBTable table) {
3.123 + if (table.getParent().getSource() != null) {
3.124 if (table.getParent().getSource() instanceof FlatfileDefinition) {
3.125 - return (FlatfileDefinition) table.getParent().getSource() ;
3.126 + return (FlatfileDefinition) table.getParent().getSource();
3.127 }
3.128 }
3.129 return null;
3.130 }
3.131
3.132 public static FlatfileDefinition getStcdbObjectTypeDefinition(DBTable table) {
3.133 - if(table.getParent().getSource() != null) {
3.134 + if (table.getParent().getSource() != null) {
3.135 Object obj = table.getParent().getSource();
3.136 - if (obj instanceof FlatfileDefinition){
3.137 - return (FlatfileDefinition)obj;
3.138 + if (obj instanceof FlatfileDefinition) {
3.139 + return (FlatfileDefinition) obj;
3.140 }
3.141 }
3.142 - return (FlatfileDefinition)null;
3.143 + return (FlatfileDefinition) null;
3.144 }
3.145
3.146 - public static String getQualifiedOtdOid(SQLDBModel dbModel) {
3.147 + public static String getQualifiedObjectId(SQLDBModel dbModel) {
3.148 String key = null;
3.149
3.150 try {
3.151 key = dbModel.getSource().getObjectId();
3.152 if (dbModel.getObjectType() == SQLConstants.TARGET_DBMODEL) {
3.153 - key = createTargetPortNameFromOID(key);
3.154 - }else {
3.155 - key = createSourcePortNameFromOID(key);
3.156 + key = createTargetPortNameFromOID(key);
3.157 + } else {
3.158 + key = createSourcePortNameFromOID(key);
3.159 }
3.160 } catch (Exception ex) {
3.161 key = null;
3.162 @@ -216,12 +188,12 @@
3.163 }
3.164
3.165 public static String getQualifiedConnectionDefinitionName(SQLDBModel dbModel, String name) {
3.166 - String qName = name;
3.167 + String qName = name;
3.168 try {
3.169 if (dbModel.getObjectType() == SQLConstants.TARGET_DBMODEL) {
3.170 qName = "T_" + qName;
3.171 - }else {
3.172 - qName = "S_" + qName;
3.173 + } else {
3.174 + qName = "S_" + qName;
3.175 }
3.176 } catch (Exception ex) {
3.177 qName = null;
3.178 @@ -229,7 +201,7 @@
3.179
3.180 return qName;
3.181 }
3.182 -
3.183 +
3.184 public static String createSourcePortNameFromOID(String oid) {
3.185 return oid + SQLConstants.SOURCE_DB_MODEL_NAME_SUFFIX;
3.186 }
4.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/ETLProcessFlowGenerator.java Sat Dec 08 10:04:51 2007 +0000
4.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/ETLProcessFlowGenerator.java Sat Dec 08 10:24:35 2007 +0000
4.3 @@ -1,60 +1,37 @@
4.4 /*
4.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4.6 + * The contents of this file are subject to the terms of the Common Development
4.7 + * and Distribution License (the License). You may not use this file except in
4.8 + * compliance with the License.
4.9 *
4.10 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
4.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
4.12 + * or http://www.netbeans.org/cddl.txt.
4.13 *
4.14 - * The contents of this file are subject to the terms of either the GNU
4.15 - * General Public License Version 2 only ("GPL") or the Common
4.16 - * Development and Distribution License("CDDL") (collectively, the
4.17 - * "License"). You may not use this file except in compliance with the
4.18 - * License. You can obtain a copy of the License at
4.19 - * http://www.netbeans.org/cddl-gplv2.html
4.20 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
4.21 - * specific language governing permissions and limitations under the
4.22 - * License. When distributing the software, include this License Header
4.23 - * Notice in each file and include the License file at
4.24 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
4.25 - * particular file as subject to the "Classpath" exception as provided
4.26 - * by Sun in the GPL Version 2 section of the License file that
4.27 - * accompanied this code. If applicable, add the following below the
4.28 - * License Header, with the fields enclosed by brackets [] replaced by
4.29 - * your own identifying information:
4.30 + * When distributing Covered Code, include this CDDL Header Notice in each file
4.31 + * and include the License file at http://www.netbeans.org/cddl.txt.
4.32 + * If applicable, add the following below the CDDL Header, with the fields
4.33 + * enclosed by brackets [] replaced by your own identifying information:
4.34 * "Portions Copyrighted [year] [name of copyright owner]"
4.35 *
4.36 - * Contributor(s):
4.37 - *
4.38 * The Original Software is NetBeans. The Initial Developer of the Original
4.39 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
4.40 * Microsystems, Inc. All Rights Reserved.
4.41 - *
4.42 - * If you wish your version of this file to be governed by only the CDDL
4.43 - * or only the GPL Version 2, indicate your decision by adding
4.44 - * "[Contributor] elects to include this software in this distribution
4.45 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
4.46 - * single choice of license, a recipient has the option to distribute
4.47 - * your version of this file under either the CDDL, the GPL Version 2 or
4.48 - * to extend the choice of license to its licensees as provided above.
4.49 - * However, if you add GPL Version 2 code and therefore, elected the GPL
4.50 - * Version 2 license, then the option applies only if the new code is
4.51 - * made subject to such option by the copyright holder.
4.52 */
4.53 package org.netbeans.modules.etl.codegen;
4.54
4.55 import java.util.Map;
4.56 -
4.57 import com.sun.etl.engine.ETLEngine;
4.58 import com.sun.sql.framework.exception.BaseException;
4.59
4.60 /**
4.61 * @author Jonathan Giron
4.62 - * @version $Revision$
4.63 */
4.64 public interface ETLProcessFlowGenerator {
4.65 +
4.66 public void applyConnectionDefinitions() throws BaseException;
4.67 -
4.68 +
4.69 public void applyConnectionDefinitions(boolean isMemoryDb) throws BaseException;
4.70
4.71 - public void applyConnectionDefinitions(Map name2connectionDefMap, Map otd2ConnDefMap, Map intDbConfigParams) throws BaseException;
4.72 + public void applyConnectionDefinitions(Map name2connectionDefMap, Map connDefMap, Map intDbConfigParams) throws BaseException;
4.73
4.74 public String getInstanceDBFolder();
4.75
5.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/ETLProcessFlowGeneratorFactory.java Sat Dec 08 10:04:51 2007 +0000
5.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/ETLProcessFlowGeneratorFactory.java Sat Dec 08 10:24:35 2007 +0000
5.3 @@ -1,42 +1,20 @@
5.4 /*
5.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.6 + * The contents of this file are subject to the terms of the Common Development
5.7 + * and Distribution License (the License). You may not use this file except in
5.8 + * compliance with the License.
5.9 *
5.10 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
5.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
5.12 + * or http://www.netbeans.org/cddl.txt.
5.13 *
5.14 - * The contents of this file are subject to the terms of either the GNU
5.15 - * General Public License Version 2 only ("GPL") or the Common
5.16 - * Development and Distribution License("CDDL") (collectively, the
5.17 - * "License"). You may not use this file except in compliance with the
5.18 - * License. You can obtain a copy of the License at
5.19 - * http://www.netbeans.org/cddl-gplv2.html
5.20 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
5.21 - * specific language governing permissions and limitations under the
5.22 - * License. When distributing the software, include this License Header
5.23 - * Notice in each file and include the License file at
5.24 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
5.25 - * particular file as subject to the "Classpath" exception as provided
5.26 - * by Sun in the GPL Version 2 section of the License file that
5.27 - * accompanied this code. If applicable, add the following below the
5.28 - * License Header, with the fields enclosed by brackets [] replaced by
5.29 - * your own identifying information:
5.30 + * When distributing Covered Code, include this CDDL Header Notice in each file
5.31 + * and include the License file at http://www.netbeans.org/cddl.txt.
5.32 + * If applicable, add the following below the CDDL Header, with the fields
5.33 + * enclosed by brackets [] replaced by your own identifying information:
5.34 * "Portions Copyrighted [year] [name of copyright owner]"
5.35 *
5.36 - * Contributor(s):
5.37 - *
5.38 * The Original Software is NetBeans. The Initial Developer of the Original
5.39 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
5.40 * Microsystems, Inc. All Rights Reserved.
5.41 - *
5.42 - * If you wish your version of this file to be governed by only the CDDL
5.43 - * or only the GPL Version 2, indicate your decision by adding
5.44 - * "[Contributor] elects to include this software in this distribution
5.45 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
5.46 - * single choice of license, a recipient has the option to distribute
5.47 - * your version of this file under either the CDDL, the GPL Version 2 or
5.48 - * to extend the choice of license to its licensees as provided above.
5.49 - * However, if you add GPL Version 2 code and therefore, elected the GPL
5.50 - * Version 2 license, then the option applies only if the new code is
5.51 - * made subject to such option by the copyright holder.
5.52 */
5.53 package org.netbeans.modules.etl.codegen;
5.54
5.55 @@ -48,7 +26,6 @@
5.56 import org.netbeans.modules.sql.framework.model.TargetTable;
5.57 import org.netbeans.modules.sql.framework.model.visitors.SQLValidationVisitor;
5.58 import org.openide.util.NbBundle;
5.59 -
5.60 import com.sun.sql.framework.exception.BaseException;
5.61
5.62 /**
5.63 @@ -90,18 +67,16 @@
5.64
5.65 /**
5.66 * @param sqlDefintion
5.67 - * @param connDefsOverrideAvailable i.e Run Time, where OTD Connection definition's
5.68 + * @param connDefsOverrideAvailable i.e Run Time, where Connection definition's
5.69 * needs to be overridden.
5.70 * @return
5.71 * @throws BaseException
5.72 */
5.73 private static boolean usePipelineFlowGenerator(SQLDefinition sqlDefintion, boolean connDefsOverrideAvailable) throws BaseException {
5.74 boolean ret = false;
5.75 - if ((sqlDefintion.requiresPipelineProcess())
5.76 - || (sqlDefintion.getExecutionStrategyCode().intValue() == SQLDefinition.EXECUTION_STRATEGY_PIPELINE)) {
5.77 + if ((sqlDefintion.requiresPipelineProcess()) || (sqlDefintion.getExecutionStrategyCode().intValue() == SQLDefinition.EXECUTION_STRATEGY_PIPELINE)) {
5.78 ret = true;
5.79 - } else if (((sqlDefintion.getExecutionStrategyCode().intValue() == SQLDefinition.EXECUTION_STRATEGY_BEST_FIT)
5.80 - && (PatternFinder.isSourceAndTargetAreInternalButDifferentOtd(sqlDefintion)))) {
5.81 + } else if ((sqlDefintion.getExecutionStrategyCode().intValue() == SQLDefinition.EXECUTION_STRATEGY_BEST_FIT) && (PatternFinder.isSourceAndTargetAreInternalButDifferent(sqlDefintion))) {
5.82 ret = true;
5.83 }
5.84 return ret;
5.85 @@ -115,14 +90,13 @@
5.86 throw new BaseException(desc);
5.87 }
5.88
5.89 - if (PatternFinder.isSourceAndTargetAreInternalButDifferentOtd(sqlDef)) {
5.90 + if (PatternFinder.isSourceAndTargetAreInternalButDifferent(sqlDef)) {
5.91 String desc = NbBundle.getMessage(SQLValidationVisitor.class, "MSG_Staging_mode_not_allowed");
5.92 throw new BaseException(desc);
5.93 }
5.94 }
5.95 }
5.96
5.97 -
5.98 private ETLProcessFlowGeneratorFactory() {
5.99 }
5.100 }
6.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/ETLScriptBuilderModel.java Sat Dec 08 10:04:51 2007 +0000
6.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/ETLScriptBuilderModel.java Sat Dec 08 10:24:35 2007 +0000
6.3 @@ -1,42 +1,20 @@
6.4 /*
6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.6 + * The contents of this file are subject to the terms of the Common Development
6.7 + * and Distribution License (the License). You may not use this file except in
6.8 + * compliance with the License.
6.9 *
6.10 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
6.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
6.12 + * or http://www.netbeans.org/cddl.txt.
6.13 *
6.14 - * The contents of this file are subject to the terms of either the GNU
6.15 - * General Public License Version 2 only ("GPL") or the Common
6.16 - * Development and Distribution License("CDDL") (collectively, the
6.17 - * "License"). You may not use this file except in compliance with the
6.18 - * License. You can obtain a copy of the License at
6.19 - * http://www.netbeans.org/cddl-gplv2.html
6.20 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.21 - * specific language governing permissions and limitations under the
6.22 - * License. When distributing the software, include this License Header
6.23 - * Notice in each file and include the License file at
6.24 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
6.25 - * particular file as subject to the "Classpath" exception as provided
6.26 - * by Sun in the GPL Version 2 section of the License file that
6.27 - * accompanied this code. If applicable, add the following below the
6.28 - * License Header, with the fields enclosed by brackets [] replaced by
6.29 - * your own identifying information:
6.30 + * When distributing Covered Code, include this CDDL Header Notice in each file
6.31 + * and include the License file at http://www.netbeans.org/cddl.txt.
6.32 + * If applicable, add the following below the CDDL Header, with the fields
6.33 + * enclosed by brackets [] replaced by your own identifying information:
6.34 * "Portions Copyrighted [year] [name of copyright owner]"
6.35 *
6.36 - * Contributor(s):
6.37 - *
6.38 * The Original Software is NetBeans. The Initial Developer of the Original
6.39 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
6.40 * Microsystems, Inc. All Rights Reserved.
6.41 - *
6.42 - * If you wish your version of this file to be governed by only the CDDL
6.43 - * or only the GPL Version 2, indicate your decision by adding
6.44 - * "[Contributor] elects to include this software in this distribution
6.45 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.46 - * single choice of license, a recipient has the option to distribute
6.47 - * your version of this file under either the CDDL, the GPL Version 2 or
6.48 - * to extend the choice of license to its licensees as provided above.
6.49 - * However, if you add GPL Version 2 code and therefore, elected the GPL
6.50 - * Version 2 license, then the option applies only if the new code is
6.51 - * made subject to such option by the copyright holder.
6.52 */
6.53 package org.netbeans.modules.etl.codegen;
6.54
6.55 @@ -46,12 +24,7 @@
6.56 import java.util.Iterator;
6.57 import java.util.List;
6.58 import java.util.Map;
6.59 -
6.60 -import org.netbeans.modules.etl.codegen.DBConnectionDefinitionTemplate;
6.61 import org.netbeans.modules.etl.codegen.impl.InternalDBMetadata;
6.62 -import org.netbeans.modules.model.database.DBConnectionDefinition;
6.63 -import org.netbeans.modules.model.database.DBTable;
6.64 -import org.netbeans.modules.model.database.DatabaseModel;
6.65 import org.netbeans.modules.sql.framework.common.jdbc.SQLDBConnectionDefinition;
6.66 import org.netbeans.modules.sql.framework.common.jdbc.SQLUtils;
6.67 import org.netbeans.modules.sql.framework.model.RuntimeDatabaseModel;
6.68 @@ -61,21 +34,22 @@
6.69 import org.netbeans.modules.sql.framework.model.SQLDBTable;
6.70 import org.netbeans.modules.sql.framework.model.SQLDefinition;
6.71 import org.netbeans.modules.sql.framework.model.SQLModelObjectFactory;
6.72 -import org.netbeans.modules.sql.framework.model.SourceTable;
6.73 -import org.netbeans.modules.sql.framework.model.TargetTable;
6.74 import org.netbeans.modules.sql.framework.ui.view.DataOutputPanel;
6.75 -
6.76 import com.sun.etl.engine.ETLEngine;
6.77 import com.sun.etl.engine.impl.ETLEngineImpl;
6.78 import com.sun.sql.framework.exception.BaseException;
6.79 import com.sun.sql.framework.jdbc.DBConstants;
6.80 import com.sun.sql.framework.utils.StringUtil;
6.81 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
6.82 +import org.netbeans.modules.sql.framework.model.DBTable;
6.83 +import org.netbeans.modules.sql.framework.model.DatabaseModel;
6.84
6.85 /**
6.86 * @author Girish Patil
6.87 * @version $Revision 1.0$
6.88 */
6.89 public final class ETLScriptBuilderModel {
6.90 +
6.91 // Folder under eTL working directory
6.92 public static final String ETL_DESIGN_WORK_FOLDER = getDefaultWorkingFolder();
6.93 // Pool name aka connection Definition name are for internal cross reference purposes.
6.94 @@ -86,23 +60,19 @@
6.95 public static final String ETL_MONITOR_DB_FOLDER = "mdb/";
6.96 public static final String ETL_MONITOR_DB_NAME = DataOutputPanel.ETL_MONITOR_DB_NAME;
6.97 private boolean connectionDefinitionOverridesApplied = false;
6.98 -
6.99 - private List connectionDefinitions = null;
6.100 + private List<SQLDBConnectionDefinition> connectionDefinitions = null;
6.101 private ETLEngine engine = null;
6.102 private SQLDBConnectionDefinition instanceDb = null;
6.103 -
6.104 private String instanceDBFolder = ETL_DESIGN_WORK_FOLDER + ETL_INSTANCE_DB_FOLDER;
6.105 private String instanceDBName = ETL_INSTANCE_DB_NAME;
6.106 -
6.107 private boolean memoryMonitorDB = true;
6.108 private SQLDBConnectionDefinition monitorDb = null;
6.109 private String monitorDBFolder = ETL_DESIGN_WORK_FOLDER + ETL_MONITOR_DB_FOLDER;
6.110 private String monitorDBName = ETL_MONITOR_DB_NAME;
6.111 -
6.112 - private Map nameToOtdOidMap = null;
6.113 + private Map<String, String> nameToDatabaseMap = null;
6.114 private Map oidToFFMetadata = new HashMap();
6.115 - private Map otdOidToConnectionDefintionMap = null;
6.116 - private Map otdOidToNameMap = null;
6.117 + private Map<String, SQLDBConnectionDefinition> databaseToConnectionDefintionMap = null;
6.118 + private Map<String, String> dbIdToNameMap = null;
6.119 private boolean shutdownMonitorDB = false;
6.120 private SQLDefinition sqlDefinition = null;
6.121 private boolean useInstanceDB = false;
6.122 @@ -110,86 +80,81 @@
6.123
6.124 private static final String getDefaultWorkingFolder() {
6.125 String nbUsrDir = System.getProperty("netbeans.user");
6.126 - if ((nbUsrDir == null) || ("".equals(nbUsrDir))){
6.127 - nbUsrDir = ".." + File.separator + "usrdir" ;
6.128 + if ((nbUsrDir == null) || ("".equals(nbUsrDir))) {
6.129 + nbUsrDir = ".." + File.separator + "usrdir";
6.130 }
6.131 - return nbUsrDir + File.separator + "eTL"+ File.separator + "work/" ;
6.132 + return nbUsrDir + File.separator + "eTL" + File.separator + "work/";
6.133 }
6.134
6.135 public void applyConnectionDefinitions() throws BaseException {
6.136 // Get all connection definitions from SQLDefinition.
6.137 - connectionDefinitions = new ArrayList();
6.138 - otdOidToConnectionDefintionMap = new HashMap();
6.139 - otdOidToNameMap = new HashMap();
6.140 - nameToOtdOidMap = new HashMap();
6.141 + connectionDefinitions = new ArrayList<SQLDBConnectionDefinition>();
6.142 + databaseToConnectionDefintionMap = new HashMap<String, SQLDBConnectionDefinition>();
6.143 + dbIdToNameMap = new HashMap<String, String>();
6.144 + nameToDatabaseMap = new HashMap<String, String>();
6.145
6.146 SQLDBConnectionDefinition dbConnDef = null;
6.147 String key = null;
6.148 - String qConnDefName = null;
6.149 + String qConnDefName = null;
6.150
6.151 - List dbModels = sqlDefinition.getAllOTDs();
6.152 + List dbModels = sqlDefinition.getAllDatabases();
6.153 Iterator itr = dbModels.iterator();
6.154 while (itr.hasNext()) {
6.155 DatabaseModel dbModel = (DatabaseModel) itr.next();
6.156 dbConnDef = SQLModelObjectFactory.getInstance().createDBConnectionDefinition(dbModel.getConnectionDefinition());
6.157 - key = ETLCodegenUtil.getQualifiedOtdOid((SQLDBModel) dbModel);
6.158 - //RIT since there is no otd id in alaska just pass the connection for table.
6.159 -// qConnDefName = ETLCodegenUtil.getQualifiedConnectionDefinitionName((SQLDBModel) dbModel, dbConnDef.getName());
6.160 -// dbConnDef.setName(qConnDefName);
6.161 -
6.162 + key = ETLCodegenUtil.getQualifiedObjectId((SQLDBModel) dbModel);
6.163 +
6.164 if (key != null) {
6.165 - otdOidToConnectionDefintionMap.put(key, dbConnDef);
6.166 + databaseToConnectionDefintionMap.put(key, dbConnDef);
6.167 } else {
6.168 key = dbConnDef.getName();
6.169 - otdOidToConnectionDefintionMap.put(key, dbConnDef);
6.170 + databaseToConnectionDefintionMap.put(key, dbConnDef);
6.171 }
6.172 -
6.173 - otdOidToNameMap.put(key, qConnDefName);
6.174 - nameToOtdOidMap.put(qConnDefName, key);
6.175 +
6.176 + dbIdToNameMap.put(key, qConnDefName);
6.177 + nameToDatabaseMap.put(qConnDefName, key);
6.178 connectionDefinitions.add(dbConnDef);
6.179 }
6.180 -//RIT commented monitor related code for now
6.181 addMonitorAndInstanceConnectionDefinitions(connectionDefinitions);
6.182 getEngine().setConnectionDefList(this.connectionDefinitions);
6.183 }
6.184
6.185 /**
6.186 - * ConnDefName to ConnDef. Note name is may not be same as in OTD Conn Def OTD oid to
6.187 + * ConnDefName to ConnDef. Note name is may not be same as in Conn Def oid to
6.188 * connDefName mapping.
6.189 */
6.190 - public void applyConnectionDefinitions(Map name2connectionDefMap, Map otdOid2ConnDefNameMap, Map intDbConfigParams) throws BaseException {
6.191 -
6.192 - oidToFFMetadata = intDbConfigParams;
6.193 -
6.194 - nameToOtdOidMap = new HashMap();
6.195 - connectionDefinitions = new ArrayList();
6.196 + public void applyConnectionDefinitions(Map name2connectionDefMap, Map<String, String> connDefNameMap, Map intDbConfigParams) throws BaseException {
6.197
6.198 - otdOidToConnectionDefintionMap = new HashMap();
6.199 - otdOidToNameMap = new HashMap();
6.200 + oidToFFMetadata = intDbConfigParams;
6.201
6.202 - nameToOtdOidMap = transposeMap(otdOid2ConnDefNameMap);
6.203 -//RIT commented monitor related code for now
6.204 + nameToDatabaseMap = new HashMap<String, String>();
6.205 + connectionDefinitions = new ArrayList<SQLDBConnectionDefinition>();
6.206 +
6.207 + databaseToConnectionDefintionMap = new HashMap<String, SQLDBConnectionDefinition>();
6.208 + dbIdToNameMap = new HashMap<String, String>();
6.209 +
6.210 + nameToDatabaseMap = transposeMap(connDefNameMap);
6.211 addMonitorAndInstanceConnectionDefinitions(connectionDefinitions);
6.212
6.213 Iterator itr = name2connectionDefMap.entrySet().iterator();
6.214 while (itr.hasNext()) {
6.215 Map.Entry entry = (Map.Entry) itr.next();
6.216 String connDefName = (String) entry.getKey();
6.217 - DBConnectionDefinition connDef = (DBConnectionDefinition) entry.getValue();
6.218 - Object qualifiedOid = nameToOtdOidMap.get(connDefName);
6.219 + SQLDBConnectionDefinition connDef = (SQLDBConnectionDefinition) entry.getValue();
6.220 + String qualifiedOid = nameToDatabaseMap.get(connDefName);
6.221
6.222 if (SQLUtils.getSupportedDBType(connDef.getDBType()) == DBConstants.AXION) {
6.223 if (qualifiedOid != null) {
6.224 - nameToOtdOidMap.remove(connDefName);
6.225 - nameToOtdOidMap.put(ETL_INSTANCE_DB_CONN_DEF_NAME, qualifiedOid);
6.226 - otdOid2ConnDefNameMap.remove(qualifiedOid);
6.227 - otdOid2ConnDefNameMap.put(qualifiedOid, ETL_INSTANCE_DB_CONN_DEF_NAME);
6.228 - otdOidToConnectionDefintionMap.put(qualifiedOid, instanceDb);
6.229 + nameToDatabaseMap.remove(connDefName);
6.230 + nameToDatabaseMap.put(ETL_INSTANCE_DB_CONN_DEF_NAME, qualifiedOid);
6.231 + connDefNameMap.remove(qualifiedOid);
6.232 + connDefNameMap.put(qualifiedOid, ETL_INSTANCE_DB_CONN_DEF_NAME);
6.233 + databaseToConnectionDefintionMap.put(qualifiedOid, instanceDb);
6.234 }
6.235 itr.remove();
6.236 } else {
6.237 connectionDefinitions.add(connDef);
6.238 - otdOidToConnectionDefintionMap.put(qualifiedOid, connDef);
6.239 + databaseToConnectionDefintionMap.put(qualifiedOid, connDef);
6.240 }
6.241 }
6.242
6.243 @@ -215,44 +180,12 @@
6.244 }
6.245 }
6.246
6.247 - public String getConnectionDefinationName(TargetTable tTable) throws BaseException {
6.248 - //RIT since there is no otd id in alaska just pass the connection for table.
6.249 - SQLDBModel element = (SQLDBModel) tTable.getParent();
6.250 - if(element.getConnectionDefinition().getDriverClass().equals("org.axiondb.jdbc.AxionDriver"))
6.251 - return ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME;
6.252 - else
6.253 - return null;
6.254 -
6.255 - }
6.256 -
6.257 public DBConnectionDefinition getConnectionDefinition(DBTable table) throws BaseException {
6.258 - DatabaseModel dbModel = table.getParent();
6.259 - DBConnectionDefinition conDef = dbModel.getConnectionDefinition();
6.260 - //RIT since there is no otd id in alaska just pass the connection for table.
6.261 -
6.262 -// String key = ETLCodegenUtil.getQualifiedOtdOid((SQLDBModel) dbModel);
6.263 -//
6.264 -// if (this.otdOidToConnectionDefintionMap != null && !otdOidToConnectionDefintionMap.isEmpty()) {
6.265 -// SQLDBConnectionDefinition poolConDef = (SQLDBConnectionDefinition) this.otdOidToConnectionDefintionMap.get(key);
6.266 -// // TODO Check for unresolved tables at codegen validation time - this check
6.267 -// // and exception should not be necessary if it's caught during validation
6.268 -// if (poolConDef == null) {
6.269 -// throw new BaseException("Connection definition not found for table " + table
6.270 -// + "; its OTD may not be linked or configured in Connectivity Map.");
6.271 -// }
6.272 -//
6.273 -// // Create a local instance with OTD path populated for use in codegen.
6.274 -// poolConDef = SQLModelObjectFactory.getInstance().createDBConnectionDefinition(poolConDef);
6.275 -// if (conDef instanceof SQLDBConnectionDefinition) {
6.276 -// poolConDef.setOTDPathName(((SQLDBConnectionDefinition) conDef).getOTDPathName());
6.277 -// }
6.278 -// conDef = poolConDef;
6.279 -// }
6.280 - return conDef;
6.281 + return table.getParent().getConnectionDefinition();
6.282 }
6.283
6.284 public DBConnectionDefinition getConnectionDefinition(String name) throws BaseException {
6.285 - return (DBConnectionDefinition) otdOidToConnectionDefintionMap.get(name);
6.286 + return (DBConnectionDefinition) databaseToConnectionDefintionMap.get(name);
6.287 }
6.288
6.289 public List getConnectionDefinitions() {
6.290 @@ -275,17 +208,12 @@
6.291 }
6.292
6.293 public InternalDBMetadata getInternalMetadata(DBTable tTable) throws BaseException {
6.294 - if (tTable instanceof SourceTable) {
6.295 - //return (InternalDBMetadata) this.oidToFFMetadata.get(ETLCodegenUtil.resolveSourcePortName(tTable));
6.296 - } else {
6.297 - //return (InternalDBMetadata) this.oidToFFMetadata.get(ETLCodegenUtil.resolveTargetPortName(tTable));
6.298 + SQLDBModel element = (SQLDBModel) tTable.getParent();
6.299 + if (element.getAttribute("refKey") == null) {
6.300 + return null;
6.301 }
6.302 -
6.303 - SQLDBModel element = (SQLDBModel) tTable.getParent();
6.304 - if(element.getAttribute("refKey") == null)
6.305 - return null;
6.306 - String oid = (String) element.getAttribute("refKey").getAttributeValue();
6.307 - return (InternalDBMetadata)this.oidToFFMetadata.get(oid);
6.308 + String oid = (String) element.getAttribute("refKey").getAttributeValue();
6.309 + return (InternalDBMetadata) this.oidToFFMetadata.get(oid);
6.310 }
6.311
6.312 public String getMonitorDBFolder() {
6.313 @@ -324,7 +252,7 @@
6.314 this.connectionDefinitionOverridesApplied = connectionDefinitionOverridesApplied;
6.315 }
6.316
6.317 - public void setConnectionDefinitions(List connectionDefinitions) {
6.318 + public void setConnectionDefinitions(List<SQLDBConnectionDefinition> connectionDefinitions) {
6.319 this.connectionDefinitions = connectionDefinitions;
6.320 }
6.321
6.322 @@ -352,9 +280,9 @@
6.323 this.monitorDBName = monitorDBName;
6.324 }
6.325
6.326 - public void setOidToFFMetadataMap(Map otdOidToMetadata) {
6.327 + public void setOidToFFMetadataMap(Map dbToMetadata) {
6.328 //this.oidToFFMetadata.clear();
6.329 - //this.oidToFFMetadata.putAll(otdOidToMetadata);
6.330 + //this.oidToFFMetadata.putAll(dbToMetadata);
6.331 }
6.332
6.333 public void setShutdownMonitorDB(boolean shutdownMonitorDB) {
6.334 @@ -374,22 +302,12 @@
6.335 }
6.336
6.337 protected InternalDBMetadata getInternalMetadataFor(SQLDBTable table) throws BaseException {
6.338 - //InternalDBMetadata dbm = null;
6.339 -
6.340 - if (table != null) {
6.341 - if (table instanceof TargetTable) {
6.342 - //return (InternalDBMetadata) getOidToFFMetadataMap().get(ETLCodegenUtil.resolveTargetPortName(table));
6.343 - } else {
6.344 - //return (InternalDBMetadata) getOidToFFMetadataMap().get(ETLCodegenUtil.resolveSourcePortName(table));
6.345 - }
6.346 - }
6.347 -
6.348 return (InternalDBMetadata) getOidToFFMetadataMap().get(table.getName());
6.349 }
6.350
6.351 - private void addMonitorAndInstanceConnectionDefinitions(List connDefs) throws BaseException {
6.352 + private void addMonitorAndInstanceConnectionDefinitions(List<SQLDBConnectionDefinition> connDefs) throws BaseException {
6.353 DBConnectionDefinitionTemplate connTemplate = new DBConnectionDefinitionTemplate();
6.354 - HashMap args = new HashMap(1);
6.355 + Map<String, String> args = new HashMap<String, String>(1);
6.356
6.357 if (this.memoryMonitorDB) {
6.358 monitorDb = connTemplate.getDBConnectionDefinition("AXIONMEMORYDB");
6.359 @@ -402,7 +320,7 @@
6.360 args.put(DBConnectionDefinitionTemplate.KEY_METADATA_DIR, monitorDBFolder);
6.361 monitorDb.setConnectionURL(StringUtil.replace(monitorDb.getConnectionURL(), args));
6.362 monitorDb.setName(ETL_MONITOR_DB_CONN_DEF_NAME);
6.363 - this.otdOidToConnectionDefintionMap.put(ETL_MONITOR_DB_CONN_DEF_NAME, monitorDb);
6.364 + this.databaseToConnectionDefintionMap.put(ETL_MONITOR_DB_CONN_DEF_NAME, monitorDb);
6.365 connDefs.add(monitorDb);
6.366
6.367 if (this.useInstanceDB) {
6.368 @@ -413,7 +331,7 @@
6.369 instanceDb = connTemplate.getDBConnectionDefinition("STCDBADAPTER");
6.370 instanceDb.setConnectionURL(StringUtil.replace(instanceDb.getConnectionURL(), args));
6.371 instanceDb.setName(ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME);
6.372 - this.otdOidToConnectionDefintionMap.put(ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME, instanceDb);
6.373 + this.databaseToConnectionDefintionMap.put(ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME, instanceDb);
6.374 connDefs.add(instanceDb);
6.375 }
6.376 }
6.377 @@ -422,14 +340,14 @@
6.378 return this.oidToFFMetadata;
6.379 }
6.380
6.381 - private Map transposeMap(Map origMap) {
6.382 - Map trans = new HashMap();
6.383 + private Map<String, String> transposeMap(Map origMap) {
6.384 + Map<String, String> trans = new HashMap<String, String>();
6.385
6.386 if (origMap != null) {
6.387 Iterator itr = origMap.entrySet().iterator();
6.388 while (itr.hasNext()) {
6.389 Map.Entry mapEntry = (Map.Entry) itr.next();
6.390 - trans.put(mapEntry.getValue(), mapEntry.getKey());
6.391 + trans.put((String) mapEntry.getValue(), (String) mapEntry.getKey());
6.392 }
6.393 }
6.394 return trans;
7.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/ETLStrategyBuilder.java Sat Dec 08 10:04:51 2007 +0000
7.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/ETLStrategyBuilder.java Sat Dec 08 10:24:35 2007 +0000
7.3 @@ -1,42 +1,20 @@
7.4 /*
7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
7.6 + * The contents of this file are subject to the terms of the Common Development
7.7 + * and Distribution License (the License). You may not use this file except in
7.8 + * compliance with the License.
7.9 *
7.10 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
7.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7.12 + * or http://www.netbeans.org/cddl.txt.
7.13 *
7.14 - * The contents of this file are subject to the terms of either the GNU
7.15 - * General Public License Version 2 only ("GPL") or the Common
7.16 - * Development and Distribution License("CDDL") (collectively, the
7.17 - * "License"). You may not use this file except in compliance with the
7.18 - * License. You can obtain a copy of the License at
7.19 - * http://www.netbeans.org/cddl-gplv2.html
7.20 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
7.21 - * specific language governing permissions and limitations under the
7.22 - * License. When distributing the software, include this License Header
7.23 - * Notice in each file and include the License file at
7.24 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
7.25 - * particular file as subject to the "Classpath" exception as provided
7.26 - * by Sun in the GPL Version 2 section of the License file that
7.27 - * accompanied this code. If applicable, add the following below the
7.28 - * License Header, with the fields enclosed by brackets [] replaced by
7.29 - * your own identifying information:
7.30 + * When distributing Covered Code, include this CDDL Header Notice in each file
7.31 + * and include the License file at http://www.netbeans.org/cddl.txt.
7.32 + * If applicable, add the following below the CDDL Header, with the fields
7.33 + * enclosed by brackets [] replaced by your own identifying information:
7.34 * "Portions Copyrighted [year] [name of copyright owner]"
7.35 *
7.36 - * Contributor(s):
7.37 - *
7.38 * The Original Software is NetBeans. The Initial Developer of the Original
7.39 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
7.40 * Microsystems, Inc. All Rights Reserved.
7.41 - *
7.42 - * If you wish your version of this file to be governed by only the CDDL
7.43 - * or only the GPL Version 2, indicate your decision by adding
7.44 - * "[Contributor] elects to include this software in this distribution
7.45 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
7.46 - * single choice of license, a recipient has the option to distribute
7.47 - * your version of this file under either the CDDL, the GPL Version 2 or
7.48 - * to extend the choice of license to its licensees as provided above.
7.49 - * However, if you add GPL Version 2 code and therefore, elected the GPL
7.50 - * Version 2 license, then the option applies only if the new code is
7.51 - * made subject to such option by the copyright holder.
7.52 */
7.53 package org.netbeans.modules.etl.codegen;
7.54
7.55 @@ -50,13 +28,15 @@
7.56 * @version $Revision$
7.57 */
7.58 public interface ETLStrategyBuilder {
7.59 - public static final int EXEC_MODE_SIMPLE = 1; // All source and target in same Database
7.60 - public static final int EXEC_MODE_STAGING = 2; // Sources are copied to temp table on target DB
7.61 +
7.62 + public static final int EXEC_MODE_SIMPLE = 1; // All source and target in same Database
7.63 + public static final int EXEC_MODE_STAGING = 2; // Sources are copied to temp table on target DB
7.64 public static final int EXEC_MODE_ONE_PASS = 3; // All src are in same DB but different than Tgt
7.65 public static final int EXEC_MODE_PIPELINE = 4; // All src are in same DB but different than Tgt
7.66
7.67 public void setETLScriptBuilderModel(ETLScriptBuilderModel model);
7.68 +
7.69 public void generateScriptForTable(ETLStrategyBuilderContext context) throws BaseException;
7.70 +
7.71 public String getScriptToDisplay(ETLStrategyBuilderContext context) throws BaseException;
7.72 }
7.73 -
8.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/ETLStrategyBuilderContext.java Sat Dec 08 10:04:51 2007 +0000
8.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/ETLStrategyBuilderContext.java Sat Dec 08 10:24:35 2007 +0000
8.3 @@ -1,48 +1,25 @@
8.4 /*
8.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8.6 + * The contents of this file are subject to the terms of the Common Development
8.7 + * and Distribution License (the License). You may not use this file except in
8.8 + * compliance with the License.
8.9 *
8.10 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
8.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
8.12 + * or http://www.netbeans.org/cddl.txt.
8.13 *
8.14 - * The contents of this file are subject to the terms of either the GNU
8.15 - * General Public License Version 2 only ("GPL") or the Common
8.16 - * Development and Distribution License("CDDL") (collectively, the
8.17 - * "License"). You may not use this file except in compliance with the
8.18 - * License. You can obtain a copy of the License at
8.19 - * http://www.netbeans.org/cddl-gplv2.html
8.20 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
8.21 - * specific language governing permissions and limitations under the
8.22 - * License. When distributing the software, include this License Header
8.23 - * Notice in each file and include the License file at
8.24 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
8.25 - * particular file as subject to the "Classpath" exception as provided
8.26 - * by Sun in the GPL Version 2 section of the License file that
8.27 - * accompanied this code. If applicable, add the following below the
8.28 - * License Header, with the fields enclosed by brackets [] replaced by
8.29 - * your own identifying information:
8.30 + * When distributing Covered Code, include this CDDL Header Notice in each file
8.31 + * and include the License file at http://www.netbeans.org/cddl.txt.
8.32 + * If applicable, add the following below the CDDL Header, with the fields
8.33 + * enclosed by brackets [] replaced by your own identifying information:
8.34 * "Portions Copyrighted [year] [name of copyright owner]"
8.35 *
8.36 - * Contributor(s):
8.37 - *
8.38 * The Original Software is NetBeans. The Initial Developer of the Original
8.39 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
8.40 * Microsystems, Inc. All Rights Reserved.
8.41 - *
8.42 - * If you wish your version of this file to be governed by only the CDDL
8.43 - * or only the GPL Version 2, indicate your decision by adding
8.44 - * "[Contributor] elects to include this software in this distribution
8.45 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
8.46 - * single choice of license, a recipient has the option to distribute
8.47 - * your version of this file under either the CDDL, the GPL Version 2 or
8.48 - * to extend the choice of license to its licensees as provided above.
8.49 - * However, if you add GPL Version 2 code and therefore, elected the GPL
8.50 - * Version 2 license, then the option applies only if the new code is
8.51 - * made subject to such option by the copyright holder.
8.52 */
8.53 package org.netbeans.modules.etl.codegen;
8.54
8.55 import org.netbeans.modules.sql.framework.model.SQLDefinition;
8.56 import org.netbeans.modules.sql.framework.model.TargetTable;
8.57 -
8.58 import com.sun.etl.engine.ETLTaskNode;
8.59 import com.sun.sql.framework.exception.BaseException;
8.60
8.61 @@ -57,17 +34,13 @@
8.62
8.63 private StringBuilder dependentTasksForNextTask = new StringBuilder();
8.64 private ETLTaskNode globalCleanUpTask;
8.65 -
8.66 private ETLTaskNode initTask;
8.67 private ETLTaskNode lastPipelinedTask;
8.68 -
8.69 private ETLScriptBuilderModel model;
8.70 -
8.71 private ETLTaskNode nextTaskOnException;
8.72 private ETLTaskNode nextTaskOnSucess;
8.73 private ETLTaskNode predecessorTask;
8.74 private ETLTaskNode statsUpdateTask;
8.75 -
8.76 private TargetTable targetTable;
8.77
8.78 /**
8.79 @@ -190,7 +163,7 @@
8.80 this.statsUpdateTask = statsUpdateTask;
8.81 }
8.82
8.83 - public void setTargetTable(TargetTable tt) {
8.84 - this.targetTable = tt;
8.85 + public void setTargetTable(TargetTable targetTable) {
8.86 + this.targetTable = targetTable;
8.87 }
8.88 }
9.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/PatternFinder.java Sat Dec 08 10:04:51 2007 +0000
9.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/PatternFinder.java Sat Dec 08 10:24:35 2007 +0000
9.3 @@ -1,65 +1,39 @@
9.4 /*
9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
9.6 + * The contents of this file are subject to the terms of the Common Development
9.7 + * and Distribution License (the License). You may not use this file except in
9.8 + * compliance with the License.
9.9 *
9.10 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
9.11 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
9.12 + * or http://www.netbeans.org/cddl.txt.
9.13 *
9.14 - * The contents of this file are subject to the terms of either the GNU
9.15 - * General Public License Version 2 only ("GPL") or the Common
9.16 - * Development and Distribution License("CDDL") (collectively, the
9.17 - * "License"). You may not use this file except in compliance with the
9.18 - * License. You can obtain a copy of the License at
9.19 - * http://www.netbeans.org/cddl-gplv2.html
9.20 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
9.21 - * specific language governing permissions and limitations under the
9.22 - * License. When distributing the software, include this License Header
9.23 - * Notice in each file and include the License file at
9.24 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
9.25 - * particular file as subject to the "Classpath" exception as provided
9.26 - * by Sun in the GPL Version 2 section of the License file that
9.27 - * accompanied this code. If applicable, add the following below the
9.28 - * License Header, with the fields enclosed by brackets [] replaced by
9.29 - * your own identifying information:
9.30 + * When distributing Covered Code, include this CDDL Header Notice in each file
9.31 + * and include the License file at http://www.netbeans.org/cddl.txt.
9.32 + * If applicable, add the following below the CDDL Header, with the fields
9.33 + * enclosed by brackets [] replaced by your own identifying information:
9.34 * "Portions Copyrighted [year] [name of copyright owner]"
9.35 *
9.36 - * Contributor(s):
9.37 - *
9.38 * The Original Software is NetBeans. The Initial Developer of the Original
9.39 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
9.40 * Microsystems, Inc. All Rights Reserved.
9.41 - *
9.42 - * If you wish your version of this file to be governed by only the CDDL
9.43 - * or only the GPL Version 2, indicate your decision by adding
9.44 - * "[Contributor] elects to include this software in this distribution
9.45 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
9.46 - * single choice of license, a recipient has the option to distribute
9.47 - * your version of this file under either the CDDL, the GPL Version 2 or
9.48 - * to extend the choice of license to its licensees as provided above.
9.49 - * However, if you add GPL Version 2 code and therefore, elected the GPL
9.50 - * Version 2 license, then the option applies only if the new code is
9.51 - * made subject to such option by the copyright holder.
9.52 */
9.53 package org.netbeans.modules.etl.codegen;
9.54
9.55 import java.util.Iterator;
9.56 import java.util.List;
9.57 -
9.58 import org.netbeans.modules.etl.codegen.impl.OnePassETLStrategyBuilderImpl;
9.59 import org.netbeans.modules.etl.codegen.impl.PipelinedStrategyBuilderImpl;
9.60 import org.netbeans.modules.etl.codegen.impl.SimpleETLStrategyBuilderImpl;
9.61 import org.netbeans.modules.etl.codegen.impl.StagingStrategyBuilder;
9.62 import org.netbeans.modules.etl.codegen.impl.ValidatingStrategyBuilderImpl;
9.63 -import org.netbeans.modules.model.database.DBConnectionDefinition;
9.64 -import org.netbeans.modules.model.database.DBTable;
9.65 -import org.netbeans.modules.sql.framework.common.jdbc.SQLUtils;
9.66 import org.netbeans.modules.sql.framework.model.SQLConstants;
9.67 import org.netbeans.modules.sql.framework.model.SQLDefinition;
9.68 import org.netbeans.modules.sql.framework.model.TargetTable;
9.69 import org.netbeans.modules.sql.framework.model.visitors.SQLValidationVisitor;
9.70 import org.openide.util.NbBundle;
9.71 -
9.72 import com.sun.sql.framework.exception.BaseException;
9.73 -import com.sun.sql.framework.jdbc.DBConstants;
9.74 import com.sun.sql.framework.utils.StringUtil;
9.75 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
9.76 +import org.netbeans.modules.sql.framework.model.DBTable;
9.77
9.78 /**
9.79 * Factory for ETLStrategyBuilder. Based a matching pattern I will create an appropriate
9.80 @@ -83,6 +57,7 @@
9.81 }
9.82 return true;
9.83 }
9.84 +
9.85 public static ETLStrategyBuilder createETLStrategyBuilder(TargetTable tt, ETLScriptBuilderModel model) throws BaseException {
9.86 // Optimization: Depending on the pattern decide which strategy to use
9.87 List sourceTables = tt.getSourceTableList();
9.88 @@ -100,7 +75,7 @@
9.89 throw new BaseException(desc);
9.90 }
9.91
9.92 - if (PatternFinder.isSourceAndTargetAreInternalButDifferentOtd(definition)) {
9.93 + if (PatternFinder.isSourceAndTargetAreInternalButDifferent(definition)) {
9.94 String desc = NbBundle.getMessage(SQLValidationVisitor.class, "MSG_Staging_mode_not_allowed");
9.95 throw new BaseException(desc);
9.96 }
9.97 @@ -123,8 +98,7 @@
9.98 } else if (isSourceTargetFromSameDB(sourceTables, tt, model)) {
9.99 // If Source(s) and Target are both from the same DB
9.100 builder = new SimpleETLStrategyBuilderImpl(model);
9.101 - } else if (isSameDBTables(sourceTables.iterator(), model) && tt.getStatementType() == SQLConstants.INSERT_STATEMENT
9.102 - && (!tt.getJoinCondition().isConditionDefined()) && (!tt.getFilterCondition().isConditionDefined())) {
9.103 + } else if (isSameDBTables(sourceTables.iterator(), model) && tt.getStatementType() == SQLConstants.INSERT_STATEMENT && (!tt.getJoinCondition().isConditionDefined()) && (!tt.getFilterCondition().isConditionDefined())) {
9.104 // If all source table are from same DB and statement type is Insert
9.105 //builder = new OnePassETLStrategyBuilderImpl();
9.106 builder = new OnePassETLStrategyBuilderImpl(model);
9.107 @@ -167,9 +141,8 @@
9.108
9.109 public static boolean isInternalDBConnection(DBConnectionDefinition dbConnDef) {
9.110 boolean ret = false;
9.111 - int dbType = -1;
9.112 if (dbConnDef != null) {
9.113 - if (dbConnDef.getDBType().equalsIgnoreCase("AXION") || dbConnDef.getDBType().equalsIgnoreCase("Internal") ) {
9.114 + if (dbConnDef.getDBType().equalsIgnoreCase("AXION") || dbConnDef.getDBType().equalsIgnoreCase("Internal")) {
9.115 ret = true;
9.116 }
9.117 }
9.118 @@ -187,14 +160,14 @@
9.119 /**
9.120 * @param sqlDefinition
9.121 * @return true only if Target is internal and All its source are also internal but
9.122 - * belong to OTD other than Target Table's.
9.123 + * belong to database other than Target Table's.
9.124 * @throws BaseException
9.125 */
9.126 - public static boolean isSourceAndTargetAreInternalButDifferentOtd(SQLDefinition sqlDefinition) throws BaseException {
9.127 + public static boolean isSourceAndTargetAreInternalButDifferent(SQLDefinition sqlDefinition) throws BaseException {
9.128 boolean ret = false;
9.129 boolean internalTargetTableFound = false;
9.130 boolean allSourcesInternal = false;
9.131 - boolean otdDifferent = false;
9.132 + boolean dbDifferent = false;
9.133
9.134 List targetTables = sqlDefinition.getTargetTables();
9.135 Iterator ttIter = targetTables.iterator();
9.136 @@ -212,7 +185,7 @@
9.137 if (isInternalDBConnection(tgtConnDef)) {
9.138 internalTargetTableFound = true;
9.139 allSourcesInternal = true;
9.140 - otdDifferent = false;
9.141 + dbDifferent = false;
9.142
9.143 srcIter = tt.getSourceTableList().iterator();
9.144 while (srcIter.hasNext()) {
9.145 @@ -220,7 +193,7 @@
9.146 srcConnDef = srcTable.getParent().getConnectionDefinition();
9.147 if (isInternalDBConnection(srcConnDef)) {
9.148 if (!isIdenticalDBConDef(srcConnDef, tgtConnDef)) {
9.149 - otdDifferent = true;
9.150 + dbDifferent = true;
9.151 }
9.152 } else {
9.153 allSourcesInternal = false;
9.154 @@ -228,7 +201,7 @@
9.155 }
9.156 }
9.157
9.158 - if (internalTargetTableFound && allSourcesInternal && otdDifferent) {
9.159 + if (internalTargetTableFound && allSourcesInternal && dbDifferent) {
9.160 ret = true;
9.161 break;
9.162 }
9.163 @@ -258,8 +231,7 @@
9.164 boolean identical = false;
9.165
9.166 if (c1 != null && c2 != null) {
9.167 - identical = StringUtil.isIdenticalIgnoreCase(ignoreOptional(c1.getConnectionURL()), ignoreOptional(c2.getConnectionURL()))
9.168 - && StringUtil.isIdentical(c1.getUserName(), c2.getUserName()) && StringUtil.isIdentical(c1.getPassword(), c2.getPassword());
9.169 + identical = StringUtil.isIdenticalIgnoreCase(ignoreOptional(c1.getConnectionURL()), ignoreOptional(c2.getConnectionURL())) && StringUtil.isIdentical(c1.getUserName(), c2.getUserName()) && StringUtil.isIdentical(c1.getPassword(), c2.getPassword());
9.170 }
9.171 return identical;
9.172 }
10.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/BaseETLStrategyBuilder.java Sat Dec 08 10:04:51 2007 +0000
10.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/BaseETLStrategyBuilder.java Sat Dec 08 10:24:35 2007 +0000
10.3 @@ -1,44 +1,21 @@
10.4 /*
10.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
10.6 - *
10.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
10.8 - *
10.9 - * The contents of this file are subject to the terms of either the GNU
10.10 - * General Public License Version 2 only ("GPL") or the Common
10.11 - * Development and Distribution License("CDDL") (collectively, the
10.12 - * "License"). You may not use this file except in compliance with the
10.13 - * License. You can obtain a copy of the License at
10.14 - * http://www.netbeans.org/cddl-gplv2.html
10.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
10.16 - * specific language governing permissions and limitations under the
10.17 - * License. When distributing the software, include this License Header
10.18 - * Notice in each file and include the License file at
10.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
10.20 - * particular file as subject to the "Classpath" exception as provided
10.21 - * by Sun in the GPL Version 2 section of the License file that
10.22 - * accompanied this code. If applicable, add the following below the
10.23 - * License Header, with the fields enclosed by brackets [] replaced by
10.24 - * your own identifying information:
10.25 + * The contents of this file are subject to the terms of the Common Development
10.26 + * and Distribution License (the License). You may not use this file except in
10.27 + * compliance with the License.
10.28 + *
10.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
10.30 + * or http://www.netbeans.org/cddl.txt.
10.31 + *
10.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
10.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
10.34 + * If applicable, add the following below the CDDL Header, with the fields
10.35 + * enclosed by brackets [] replaced by your own identifying information:
10.36 * "Portions Copyrighted [year] [name of copyright owner]"
10.37 - *
10.38 - * Contributor(s):
10.39 - *
10.40 + *
10.41 * The Original Software is NetBeans. The Initial Developer of the Original
10.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
10.43 * Microsystems, Inc. All Rights Reserved.
10.44 - *
10.45 - * If you wish your version of this file to be governed by only the CDDL
10.46 - * or only the GPL Version 2, indicate your decision by adding
10.47 - * "[Contributor] elects to include this software in this distribution
10.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
10.49 - * single choice of license, a recipient has the option to distribute
10.50 - * your version of this file under either the CDDL, the GPL Version 2 or
10.51 - * to extend the choice of license to its licensees as provided above.
10.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
10.53 - * Version 2 license, then the option applies only if the new code is
10.54 - * made subject to such option by the copyright holder.
10.55 */
10.56 -
10.57 package org.netbeans.modules.etl.codegen.impl;
10.58
10.59 import java.util.ArrayList;
10.60 @@ -57,14 +34,12 @@
10.61 import org.netbeans.modules.etl.utils.MessageManager;
10.62 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
10.63 import org.netbeans.modules.mashup.db.model.FlatfileDefinition;
10.64 -import org.netbeans.modules.model.database.DBConnectionDefinition;
10.65 -import org.netbeans.modules.model.database.DBTable;
10.66 import org.netbeans.modules.sql.framework.common.jdbc.SQLDBConnectionDefinition;
10.67 -import org.netbeans.modules.sql.framework.evaluators.database.DB;
10.68 -import org.netbeans.modules.sql.framework.evaluators.database.DBFactory;
10.69 -import org.netbeans.modules.sql.framework.evaluators.database.StatementContext;
10.70 -import org.netbeans.modules.sql.framework.evaluators.database.Statements;
10.71 -import org.netbeans.modules.sql.framework.evaluators.database.axion.AxionDB;
10.72 +import org.netbeans.modules.sql.framework.codegen.DB;
10.73 +import org.netbeans.modules.sql.framework.codegen.DBFactory;
10.74 +import org.netbeans.modules.sql.framework.codegen.StatementContext;
10.75 +import org.netbeans.modules.sql.framework.codegen.Statements;
10.76 +import org.netbeans.modules.sql.framework.codegen.axion.AxionDB;
10.77 import org.netbeans.modules.sql.framework.model.SQLConstants;
10.78 import org.netbeans.modules.sql.framework.model.SQLDBTable;
10.79 import org.netbeans.modules.sql.framework.model.SourceTable;
10.80 @@ -77,6 +52,8 @@
10.81 import com.sun.sql.framework.jdbc.SQLPart;
10.82 import com.sun.sql.framework.utils.AttributeMap;
10.83 import com.sun.sql.framework.utils.StringUtil;
10.84 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
10.85 +import org.netbeans.modules.sql.framework.model.DBTable;
10.86
10.87 /**
10.88 * Base class for all ETLStrategyBuilder classes.
10.89 @@ -85,6 +62,7 @@
10.90 * @version $Revision$
10.91 */
10.92 public abstract class BaseETLStrategyBuilder implements ETLStrategyBuilder {
10.93 +
10.94 protected static final MessageManager MSG_MGR = MessageManager.getManager("org.netbeans.modules.etl.codegen.impl");
10.95 private static final String RUNTIME_INPUTS_MAP = "runtimeInputsMap";
10.96
10.97 @@ -101,7 +79,6 @@
10.98 }
10.99 return props;
10.100 }
10.101 -
10.102 protected ETLScriptBuilderModel builderModel = null;
10.103 protected DBConnectionFactory connFactory = DBConnectionFactory.getInstance();
10.104 protected DBConnectionDefinition targtConDef = null;
10.105 @@ -139,7 +116,7 @@
10.106 insertStartDateIntoSummaryTablePart.setConnectionPoolName(ETLScriptBuilderModel.ETL_MONITOR_DB_CONN_DEF_NAME);
10.107
10.108 context.setUsingFullyQualifiedTablePrefix(false);
10.109 - insertStartDateIntoSummaryTablePart.setTableName(db.getUnescapedName(db.getEvaluatorFactory().evaluate(tt, context)));
10.110 + insertStartDateIntoSummaryTablePart.setTableName(db.getUnescapedName(db.getGeneratorFactory().generate(tt, context)));
10.111
10.112 taskNode.addStatement(insertStartDateIntoSummaryTablePart);
10.113 }
10.114 @@ -155,7 +132,7 @@
10.115 SQLPart selectExecutionIdPart = stmts.getSelectExecutionIdFromSummaryTableStatement(tt, context);
10.116 selectExecutionIdPart.setConnectionPoolName(ETLScriptBuilderModel.ETL_MONITOR_DB_CONN_DEF_NAME);
10.117
10.118 - selectExecutionIdPart.setTableName(db.getUnescapedName(db.getEvaluatorFactory().evaluate(tt, context)));
10.119 + selectExecutionIdPart.setTableName(db.getUnescapedName(db.getGeneratorFactory().generate(tt, context)));
10.120
10.121 pipeline.addStatement(selectExecutionIdPart);
10.122 }
10.123 @@ -175,7 +152,7 @@
10.124 SQLPart updateEndDatePart = stmts.getUpdateEndDateInSummaryTableStatement(tt, context);
10.125 updateEndDatePart.setConnectionPoolName(ETLScriptBuilderModel.ETL_MONITOR_DB_CONN_DEF_NAME);
10.126
10.127 - String tableName = db.getUnescapedName(db.getEvaluatorFactory().evaluate(tt, context));
10.128 + String tableName = db.getUnescapedName(db.getGeneratorFactory().generate(tt, context));
10.129 updateEndDatePart.setTableName(tableName);
10.130 updateStats.addTableSpecificStatement(tableName, updateEndDatePart);
10.131 }
10.132 @@ -223,7 +200,7 @@
10.133 StatementContext context = new StatementContext();
10.134 context.setUsingFullyQualifiedTablePrefix(false);
10.135 context.setUsingUniqueTableName(true);
10.136 - final String statsTableName = statsDB.getUnescapedName(statsDB.getEvaluatorFactory().evaluate(tt, context));
10.137 + final String statsTableName = statsDB.getUnescapedName(statsDB.getGeneratorFactory().generate(tt, context));
10.138 transformerTask.setTableName(statsTableName);
10.139
10.140 int statementType = tt.getStatementType();
10.141 @@ -246,14 +223,12 @@
10.142 }
10.143
10.144 StatementContext tgtContext = new StatementContext();
10.145 - if ( (this.builderModel.isConnectionDefinitionOverridesApplied())
10.146 - && (PatternFinder.isInternalDBTable(tt))){
10.147 + if ((this.builderModel.isConnectionDefinitionOverridesApplied()) && (PatternFinder.isInternalDBTable(tt))) {
10.148 tgtContext.setUsingUniqueTableName(tt, true);
10.149 - }
10.150 + }
10.151 createTargetTableIfNotExists(tt, transformerTask, trgtConnName, targetDB, tgtContext);
10.152 truncateTargetTableIfExists(tt, transformerTask, trgtConnName, targetDB.getStatements(), tgtContext);
10.153
10.154 - //RIT commented summary table and statistics related code for now
10.155 // Insert new execution record for target table, tt.
10.156 addInsertNewExecutionRecordStatement(transformerTask, tt);
10.157
10.158 @@ -262,11 +237,11 @@
10.159 }
10.160
10.161 protected void createCorrelatedUpdateSQLParts(TargetTable tt,
10.162 - ETLTaskNode correlatedQueryExecutor,
10.163 - String trgtConnName,
10.164 - DB targetDB,
10.165 - DB statsDB,
10.166 - boolean genInsertSelect) throws BaseException {
10.167 + ETLTaskNode correlatedQueryExecutor,
10.168 + String trgtConnName,
10.169 + DB targetDB,
10.170 + DB statsDB,
10.171 + boolean genInsertSelect) throws BaseException {
10.172 SQLPart insertSelect = null;
10.173 SQLPart select = null;
10.174 SQLPart update = null;
10.175 @@ -274,7 +249,7 @@
10.176 StatementContext context = new StatementContext();
10.177 context.setUsingFullyQualifiedTablePrefix(false);
10.178 context.setUsingUniqueTableName(true);
10.179 - final String statsTableName = statsDB.getUnescapedName(statsDB.getEvaluatorFactory().evaluate(tt, context));
10.180 + final String statsTableName = statsDB.getUnescapedName(statsDB.getGeneratorFactory().generate(tt, context));
10.181 correlatedQueryExecutor.setTableName(statsTableName);
10.182
10.183 Map map = getCorrelatedUpdateQueries(tt, targetDB, genInsertSelect);
10.184 @@ -291,7 +266,7 @@
10.185 correlatedQueryExecutor.addStatement(select);
10.186 correlatedQueryExecutor.addStatement(update);
10.187
10.188 - if (genInsertSelect){
10.189 + if (genInsertSelect) {
10.190 insertSelect.setTableName(statsTableName);
10.191 insertSelect.setConnectionPoolName(trgtConnName);
10.192 correlatedQueryExecutor.addStatement(insertSelect);
10.193 @@ -301,12 +276,11 @@
10.194 createTargetTableIfNotExists(tt, correlatedQueryExecutor, trgtConnName, targetDB, tgtContext);
10.195 truncateTargetTableIfExists(tt, correlatedQueryExecutor, trgtConnName, targetDB.getStatements(), tgtContext);
10.196
10.197 - //RIT commented summary table and statistics related code for now
10.198 // Insert new execution record for target table, tt.
10.199 -// addInsertNewExecutionRecordStatement(correlatedQueryExecutor, tt);
10.200 + addInsertNewExecutionRecordStatement(correlatedQueryExecutor, tt);
10.201
10.202 // Add query to obtain execution id assigned to new execution record.
10.203 -// addSelectExecutionIdForNewExecutionRecordStatement(correlatedQueryExecutor, tt);
10.204 + addSelectExecutionIdForNewExecutionRecordStatement(correlatedQueryExecutor, tt);
10.205
10.206 AttributeMap attrMap = new AttributeMap();
10.207 attrMap.put("batchSize", tt.getBatchSize() + ""); // NOI18N
10.208 @@ -326,14 +300,14 @@
10.209 SourceTable srcTable = (SourceTable) iter.next();
10.210 if (isExtractionRequired(srcTable, tt)) {
10.211 context.setUsingTempTableName(srcTable, true);
10.212 - }else{
10.213 + } else {
10.214 useUniqueNameIfRequired(srcTable, context);
10.215 }
10.216 }
10.217 context.putClientProperty(RUNTIME_INPUTS_MAP, this.builderModel.getEngine().getInputAttrMap());
10.218 ret = stmts.getCorrelatedUpdateStatement(tt, context);
10.219
10.220 - if (genInsertSelect){
10.221 + if (genInsertSelect) {
10.222 context.putClientProperty("useWhere", Boolean.TRUE);
10.223 SQLPart insertSelectPart = stmts.getInsertSelectStatement(tt, context);
10.224 ret.put(SQLPart.STMT_INSERTSELECT, insertSelectPart);
10.225 @@ -361,13 +335,12 @@
10.226 return defragPartStatement;
10.227 }
10.228
10.229 - protected final void useUniqueNameIfRequired(SQLDBTable table, StatementContext sc) throws BaseException{
10.230 - if ( (this.builderModel.isConnectionDefinitionOverridesApplied())
10.231 - && (PatternFinder.isInternalDBTable(table))){
10.232 + protected final void useUniqueNameIfRequired(SQLDBTable table, StatementContext sc) throws BaseException {
10.233 + if ((this.builderModel.isConnectionDefinitionOverridesApplied()) && (PatternFinder.isInternalDBTable(table))) {
10.234 sc.setUsingUniqueTableName(table, true);
10.235 - }
10.236 + }
10.237 }
10.238 -
10.239 +
10.240 // Generate Insert Select Part
10.241 protected SQLPart generateTransformerSQLPart(TargetTable tt, boolean useSourceFilter, DB targetDB, int statementType, List srcTblList)
10.242 throws BaseException {
10.243 @@ -379,13 +352,13 @@
10.244 SourceTable srcTable = (SourceTable) iter.next();
10.245 if (isExtractionRequired(srcTable, tt)) {
10.246 context.setUsingTempTableName(srcTable, true);
10.247 - }else{
10.248 + } else {
10.249 useUniqueNameIfRequired(srcTable, context);
10.250 }
10.251 }
10.252
10.253 useUniqueNameIfRequired(tt, context);
10.254 -
10.255 +
10.256 SQLPart insertSelectPart;
10.257 switch (statementType) {
10.258 case SQLConstants.UPDATE_STATEMENT:
10.259 @@ -428,12 +401,12 @@
10.260 sqlPart = createSQLPart(flatfileDBTable.getDropStatementSQL(tableName), stmtType, connPoolName);
10.261 } else if (stmtType.equals("CREATE")) {
10.262 sqlPart = createSQLPart(flatfileDBTable.getCreateStatementSQL(staticDirectory, tableName, flatfileRuntimeFilePath, isDynamicPath,
10.263 - createDataFileIfNotExist), stmtType, connPoolName);
10.264 + createDataFileIfNotExist), stmtType, connPoolName);
10.265 }
10.266
10.267 // Provide a fully-qualified filename, appending staticDirectory as the path, as
10.268 // default value if dynamic path is true; otherwise, use just the sample filename
10.269 - // as supplied from the OTD.
10.270 + // as supplied from the Database.
10.271 String defaultValue = (isDynamicPath ? staticDirectory + "/" : "") + flatfileDBTable.getFileName();
10.272 sqlPart.setDefaultValue(defaultValue);
10.273
10.274 @@ -451,7 +424,7 @@
10.275 */
10.276 protected String getCommentForTransformer(TargetTable targetTable) throws BaseException {
10.277 return MSG_MGR.getString("DISPLAY_INSERT_TARGET", targetTable.getParent().getModelName(), this.builderModel.getConnectionDefinition(
10.278 - targetTable).getDBType());
10.279 + targetTable).getDBType());
10.280 }
10.281
10.282 /**
10.283 @@ -487,7 +460,7 @@
10.284 return db.getStatements();
10.285 }
10.286
10.287 - protected void getFlatfileInitSQLParts(FlatfileDefinition stcotd, InternalDBMetadata ffMetadata, boolean isAllDBTypeInternal,
10.288 + protected void getFlatfileInitSQLParts(FlatfileDefinition ffdb, InternalDBMetadata ffMetadata, boolean isAllDBTypeInternal,
10.289 ETLTaskNode initTask, ETLTaskNode cleanupTask, String connPoolName, SQLDBTable flatfileRuntime, boolean createDataFileIfNotExist) {
10.290 String staticDirectory = ffMetadata.getStaticDirectory();
10.291 boolean isDynamicFilePath = ffMetadata.isDynamicFilePath();
10.292 @@ -495,19 +468,19 @@
10.293 String tableName = null;
10.294 String flatfileRuntimeFilePath = flatfileRuntime.getRuntimeArgumentName();
10.295 String oId = flatfileRuntime.getUniqueTableName();
10.296 - FlatfileDBTable flatfileTable = (FlatfileDBTable) stcotd.getTable(flatfileRuntime.getName());
10.297 + FlatfileDBTable flatfileTable = (FlatfileDBTable) ffdb.getTable(flatfileRuntime.getName());
10.298
10.299 // if (isAllDBTypeInternal) {
10.300 - tableName = oId;
10.301 + tableName = oId;
10.302 // } else {
10.303 // tableName = flatfileTable.getName();
10.304 // }
10.305
10.306 if (flatfileTable != null) {
10.307 SQLPart dropPart = generateSQLPart(flatfileTable, tableName, staticDirectory, "DROP", connPoolName, flatfileRuntimeFilePath, isDynamicFilePath,
10.308 - createDataFileIfNotExist);
10.309 + createDataFileIfNotExist);
10.310 SQLPart createPart = generateSQLPart(flatfileTable, tableName, staticDirectory, "CREATE", connPoolName, flatfileRuntimeFilePath,
10.311 - isDynamicFilePath, createDataFileIfNotExist);
10.312 + isDynamicFilePath, createDataFileIfNotExist);
10.313
10.314 initTask.addOptionalTask(dropPart);
10.315 initTask.addOptionalTask(createPart);
10.316 @@ -515,20 +488,20 @@
10.317 }
10.318 }
10.319
10.320 - protected void getFlatfileInitSQLParts(FlatfileDefinition stcotd, InternalDBMetadata internalMetadata, ETLTaskNode initTask,
10.321 + protected void getFlatfileInitSQLParts(FlatfileDefinition ffdb, InternalDBMetadata internalMetadata, ETLTaskNode initTask,
10.322 ETLTaskNode cleanupTask, SQLDBTable flatfileRuntime, boolean createDataFileIfNotExist) {
10.323 String staticDirectory = internalMetadata.getStaticDirectory();
10.324 boolean isDynamicFilePath = internalMetadata.isDynamicFilePath();
10.325
10.326 - FlatfileDBTable flatfileTable = (FlatfileDBTable) stcotd.getTable(flatfileRuntime.getName());
10.327 + FlatfileDBTable flatfileTable = (FlatfileDBTable) ffdb.getTable(flatfileRuntime.getName());
10.328 String tableName = flatfileRuntime.getUniqueTableName();
10.329 String flatfileRuntimeFilePath = flatfileRuntime.getRuntimeArgumentName();
10.330
10.331 if (flatfileTable != null) {
10.332 SQLPart dropPart = generateSQLPart(flatfileTable, tableName, staticDirectory, "DROP", ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME,
10.333 - flatfileRuntimeFilePath, isDynamicFilePath, createDataFileIfNotExist);
10.334 + flatfileRuntimeFilePath, isDynamicFilePath, createDataFileIfNotExist);
10.335 SQLPart createPart = generateSQLPart(flatfileTable, tableName, staticDirectory, "CREATE",
10.336 - ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME, flatfileRuntimeFilePath, isDynamicFilePath, createDataFileIfNotExist);
10.337 + ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME, flatfileRuntimeFilePath, isDynamicFilePath, createDataFileIfNotExist);
10.338
10.339 initTask.addOptionalTask(dropPart);
10.340 initTask.addOptionalTask(createPart);
10.341 @@ -537,11 +510,11 @@
10.342 }
10.343
10.344 protected String getTargetConnName() {
10.345 -
10.346 - if(targtConDef.getDriverClass().equals("org.axiondb.jdbc.AxionDriver") &&
10.347 - builderModel.isConnectionDefinitionOverridesApplied()){
10.348 - return ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME;
10.349 - }
10.350 +
10.351 + if (targtConDef.getDriverClass().equals("org.axiondb.jdbc.AxionDriver") &&
10.352 + builderModel.isConnectionDefinitionOverridesApplied()) {
10.353 + return ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME;
10.354 + }
10.355 return targtConDef.getName();
10.356 }
10.357
10.358 @@ -553,10 +526,7 @@
10.359 protected String getTransformerSQL(TargetTable targetTable, DB targetDB, List srcTblList, boolean useSourceFilter) throws BaseException {
10.360 String sql = null;
10.361 int statementType = targetTable.getStatementType();
10.362 - if ((targetDB.getDBType() == DB.JDBCDB)
10.363 - && (targetTable.getSourceTableList().size() != 0)
10.364 - && ((statementType == SQLConstants.UPDATE_STATEMENT)
10.365 - ||(statementType == SQLConstants.INSERT_UPDATE_STATEMENT))){
10.366 + if ((targetDB.getDBType() == DB.JDBCDB) && (targetTable.getSourceTableList().size() != 0) && ((statementType == SQLConstants.UPDATE_STATEMENT) || (statementType == SQLConstants.INSERT_UPDATE_STATEMENT))) {
10.367 Map map = this.getCorrelatedUpdateQueries(targetTable, targetDB, (statementType == SQLConstants.INSERT_UPDATE_STATEMENT));
10.368 SQLPart select = (SQLPart) map.get(SQLPart.STMT_CORRELATED_SELECT);
10.369 SQLPart update = (SQLPart) map.get(SQLPart.STMT_CORRELATED_UPDATE);
10.370 @@ -592,10 +562,7 @@
10.371
10.372 protected void populateInitTask(ETLTaskNode initTask, ETLTaskNode cleanupTask, TargetTable tTable) throws BaseException {
10.373 DBConnectionDefinition dbCondefn = builderModel.getConnectionDefinition(tTable);
10.374 - String tgtConnPoolName = builderModel.getConnectionDefinationName(tTable);
10.375 - if (tgtConnPoolName == null) {
10.376 - tgtConnPoolName = dbCondefn.getName();
10.377 - }
10.378 + String tgtConnPoolName = dbCondefn.getName();
10.379
10.380 InternalDBMetadata tgtInternalMetadata = builderModel.getInternalMetadata(tTable);
10.381 if (tgtInternalMetadata == null) {
10.382 @@ -622,82 +589,81 @@
10.383 boolean isAllDBTypeInternal = PatternFinder.isInternalDBTable(tTable) && PatternFinder.allDBTablesAreInternal(participatingTables.iterator());
10.384
10.385 // For Target Table
10.386 - FlatfileDefinition tgtOtd = ETLCodegenUtil.getStcdbObjectTypeDefinition(tTable);
10.387 - if (tgtOtd != null && tgtInternalMetadata != null
10.388 - && tgtInternalMetadata.getStaticDirectory() != null) {
10.389 - getFlatfileInitSQLParts(tgtOtd, tgtInternalMetadata, isAllDBTypeInternal, initTask, cleanupTask, tgtConnPoolName, tTable, true);
10.390 + FlatfileDefinition tgtDB = ETLCodegenUtil.getStcdbObjectTypeDefinition(tTable);
10.391 + if (tgtDB != null && tgtInternalMetadata != null && tgtInternalMetadata.getStaticDirectory() != null) {
10.392 + getFlatfileInitSQLParts(tgtDB, tgtInternalMetadata, isAllDBTypeInternal, initTask, cleanupTask, tgtConnPoolName, tTable, true);
10.393 }
10.394
10.395 // For all SourceTables associated with Target table
10.396 for (Iterator it = participatingTables.iterator(); it.hasNext();) {
10.397 SQLDBTable dbTable = (SQLDBTable) it.next();
10.398 - FlatfileDefinition srcOtd = ETLCodegenUtil.getOtd(dbTable);
10.399 - if(srcOtd != null) {
10.400 - DBConnectionDefinition srcCondefn = builderModel.getConnectionDefinition(dbTable);
10.401 - InternalDBMetadata srcInternalMetadata = builderModel.getInternalMetadata(dbTable);
10.402 - String conDefnName = getConDefnName(srcCondefn);
10.403 -
10.404 - if (srcInternalMetadata != null) {
10.405 - if (isAllDBTypeInternal) {
10.406 - conDefnName = tgtConnPoolName;
10.407 - }
10.408 - getFlatfileInitSQLParts(srcOtd, srcInternalMetadata, isAllDBTypeInternal, initTask, cleanupTask, conDefnName, dbTable, false);
10.409 - }
10.410 + FlatfileDefinition srcDB = ETLCodegenUtil.getFFDefinition(dbTable);
10.411 + if (srcDB != null) {
10.412 + DBConnectionDefinition srcCondefn = builderModel.getConnectionDefinition(dbTable);
10.413 + InternalDBMetadata srcInternalMetadata = builderModel.getInternalMetadata(dbTable);
10.414 + String conDefnName = getConDefnName(srcCondefn);
10.415 +
10.416 + if (srcInternalMetadata != null) {
10.417 + if (isAllDBTypeInternal) {
10.418 + conDefnName = tgtConnPoolName;
10.419 + }
10.420 + getFlatfileInitSQLParts(srcDB, srcInternalMetadata, isAllDBTypeInternal, initTask, cleanupTask, conDefnName, dbTable, false);
10.421 + }
10.422 }
10.423 }
10.424 }
10.425
10.426 protected String getConDefnName(DBConnectionDefinition srcCondefn) {
10.427 - if(srcCondefn.getDriverClass().equals("org.axiondb.jdbc.AxionDriver") &&
10.428 - builderModel.isConnectionDefinitionOverridesApplied()){
10.429 - return ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME;
10.430 - }
10.431 + if (srcCondefn.getDriverClass().equals("org.axiondb.jdbc.AxionDriver") &&
10.432 + builderModel.isConnectionDefinitionOverridesApplied()) {
10.433 + return ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME;
10.434 + }
10.435 return srcCondefn.getName();
10.436 - }
10.437 + }
10.438
10.439 - protected void truncateTargetTableIfExists(TargetTable tt, ETLTaskNode taskNode, String trgtConnName, Statements stmts, StatementContext sc) throws BaseException {
10.440 + protected void truncateTargetTableIfExists(TargetTable tt, ETLTaskNode taskNode, String trgtConnName, Statements stmts, StatementContext sc) throws BaseException {
10.441 if (tt.isTruncateBeforeLoad()) {
10.442 - truncateTableIfExists((SQLDBTable)tt, taskNode, trgtConnName, stmts, sc);
10.443 + truncateTableIfExists((SQLDBTable) tt, taskNode, trgtConnName, stmts, sc);
10.444 }
10.445 }
10.446
10.447 - protected void truncateTableIfExists(SQLDBTable dbt, ETLTaskNode taskNode, String trgtConnName, Statements stmts, StatementContext sc) throws BaseException {
10.448 - SQLPart ifExists = stmts.getTableExistsStatement(dbt, sc);
10.449 - String existsSql = (ifExists != null) ? ifExists.getSQL().trim() : null;
10.450 - StringBuilder sqlBuffer = StringUtil.isNullString(existsSql) ? new StringBuilder(200) : new StringBuilder(existsSql);
10.451 + protected void truncateTableIfExists(SQLDBTable dbt, ETLTaskNode taskNode, String trgtConnName, Statements stmts, StatementContext sc) throws BaseException {
10.452 + SQLPart ifExists = stmts.getTableExistsStatement(dbt, sc);
10.453 + String existsSql = (ifExists != null) ? ifExists.getSQL().trim() : null;
10.454 + StringBuilder sqlBuffer = StringUtil.isNullString(existsSql) ? new StringBuilder(200) : new StringBuilder(existsSql);
10.455
10.456 - SQLPart doTruncate = stmts.getTruncateStatement(dbt, sc);
10.457 - String truncateSql = doTruncate.getSQL().trim();
10.458 - if (!StringUtil.isNullString(truncateSql)) {
10.459 - if (sqlBuffer.length() != 0) {
10.460 - sqlBuffer.append(SQLPart.STATEMENT_SEPARATOR);
10.461 - }
10.462 -
10.463 - sqlBuffer.append(truncateSql);
10.464 - SQLPart truncateIfExists = new SQLPart(sqlBuffer.toString(), SQLPart.STMT_TRUNCATEBEFOREPROCESS, trgtConnName);
10.465 - taskNode.addStatement(truncateIfExists);
10.466 - } else {
10.467 - truncateSql = "";
10.468 + SQLPart doTruncate = stmts.getTruncateStatement(dbt, sc);
10.469 + String truncateSql = doTruncate.getSQL().trim();
10.470 + if (!StringUtil.isNullString(truncateSql)) {
10.471 + if (sqlBuffer.length() != 0) {
10.472 + sqlBuffer.append(SQLPart.STATEMENT_SEPARATOR);
10.473 }
10.474
10.475 - StatementContext context = new StatementContext();
10.476 - context.putClientProperty("useWhere", Boolean.FALSE);
10.477 - SQLPart doDelete = stmts.getDeleteStatement(dbt, context);
10.478 - String deleteSql = doDelete.getSQL().trim();
10.479 + sqlBuffer.append(truncateSql);
10.480 + SQLPart truncateIfExists = new SQLPart(sqlBuffer.toString(), SQLPart.STMT_TRUNCATEBEFOREPROCESS, trgtConnName);
10.481 + taskNode.addStatement(truncateIfExists);
10.482 + } else {
10.483 + truncateSql = "";
10.484 + }
10.485
10.486 - // Only add the fallback delete statement if it is not identical to the
10.487 - // truncate statement. The delete and truncate statements are identical for
10.488 - // those DBs which do not have a separate 'truncate' command.
10.489 - if (!StringUtil.isNullString(deleteSql) && !deleteSql.equalsIgnoreCase(truncateSql)) {
10.490 - sqlBuffer = StringUtil.isNullString(existsSql) ? new StringBuilder(200) : new StringBuilder(existsSql);
10.491 - if (sqlBuffer.length() != 0) {
10.492 - sqlBuffer.append(SQLPart.STATEMENT_SEPARATOR);
10.493 - }
10.494 + StatementContext context = new StatementContext();
10.495 + context.putClientProperty("useWhere", Boolean.FALSE);
10.496 + SQLPart doDelete = stmts.getDeleteStatement(dbt, context);
10.497 + String deleteSql = doDelete.getSQL().trim();
10.498
10.499 - sqlBuffer.append(deleteSql);
10.500 + // Only add the fallback delete statement if it is not identical to the
10.501 + // truncate statement. The delete and truncate statements are identical for
10.502 + // those DBs which do not have a separate 'truncate' command.
10.503 + if (!StringUtil.isNullString(deleteSql) && !deleteSql.equalsIgnoreCase(truncateSql)) {
10.504 + sqlBuffer = StringUtil.isNullString(existsSql) ? new StringBuilder(200) : new StringBuilder(existsSql);
10.505 + if (sqlBuffer.length() != 0) {
10.506 + sqlBuffer.append(SQLPart.STATEMENT_SEPARATOR);
10.507 + }
10.508
10.509 - SQLPart deleteIfExists = new SQLPart(sqlBuffer.toString(), SQLPart.STMT_DELETEBEFOREPROCESS, trgtConnName);
10.510 - taskNode.addStatement(deleteIfExists);
10.511 + sqlBuffer.append(deleteSql);
10.512 +
10.513 + SQLPart deleteIfExists = new SQLPart(sqlBuffer.toString(), SQLPart.STMT_DELETEBEFOREPROCESS, trgtConnName);
10.514 + taskNode.addStatement(deleteIfExists);
10.515 }
10.516 }
10.517
10.518 @@ -705,5 +671,4 @@
10.519 String name = dbTable.getUniqueTableName();
10.520 dbTable.setUserDefinedTableName(name);
10.521 }
10.522 -
10.523 }
11.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/BaseFlowGenerator.java Sat Dec 08 10:04:51 2007 +0000
11.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/BaseFlowGenerator.java Sat Dec 08 10:24:35 2007 +0000
11.3 @@ -1,42 +1,20 @@
11.4 /*
11.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
11.6 - *
11.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
11.8 - *
11.9 - * The contents of this file are subject to the terms of either the GNU
11.10 - * General Public License Version 2 only ("GPL") or the Common
11.11 - * Development and Distribution License("CDDL") (collectively, the
11.12 - * "License"). You may not use this file except in compliance with the
11.13 - * License. You can obtain a copy of the License at
11.14 - * http://www.netbeans.org/cddl-gplv2.html
11.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
11.16 - * specific language governing permissions and limitations under the
11.17 - * License. When distributing the software, include this License Header
11.18 - * Notice in each file and include the License file at
11.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
11.20 - * particular file as subject to the "Classpath" exception as provided
11.21 - * by Sun in the GPL Version 2 section of the License file that
11.22 - * accompanied this code. If applicable, add the following below the
11.23 - * License Header, with the fields enclosed by brackets [] replaced by
11.24 - * your own identifying information:
11.25 + * The contents of this file are subject to the terms of the Common Development
11.26 + * and Distribution License (the License). You may not use this file except in
11.27 + * compliance with the License.
11.28 + *
11.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
11.30 + * or http://www.netbeans.org/cddl.txt.
11.31 + *
11.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
11.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
11.34 + * If applicable, add the following below the CDDL Header, with the fields
11.35 + * enclosed by brackets [] replaced by your own identifying information:
11.36 * "Portions Copyrighted [year] [name of copyright owner]"
11.37 - *
11.38 - * Contributor(s):
11.39 - *
11.40 + *
11.41 * The Original Software is NetBeans. The Initial Developer of the Original
11.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
11.43 * Microsystems, Inc. All Rights Reserved.
11.44 - *
11.45 - * If you wish your version of this file to be governed by only the CDDL
11.46 - * or only the GPL Version 2, indicate your decision by adding
11.47 - * "[Contributor] elects to include this software in this distribution
11.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
11.49 - * single choice of license, a recipient has the option to distribute
11.50 - * your version of this file under either the CDDL, the GPL Version 2 or
11.51 - * to extend the choice of license to its licensees as provided above.
11.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
11.53 - * Version 2 license, then the option applies only if the new code is
11.54 - * made subject to such option by the copyright holder.
11.55 */
11.56 package org.netbeans.modules.etl.codegen.impl;
11.57
11.58 @@ -60,6 +38,7 @@
11.59 * @version $Revision$
11.60 */
11.61 public abstract class BaseFlowGenerator implements ETLProcessFlowGenerator {
11.62 +
11.63 private static final String LOG_CATEGORY = BaseFlowGenerator.class.getName();
11.64 protected ETLScriptBuilderModel builderModel = new ETLScriptBuilderModel();
11.65 protected ETLTaskNode endTask = null;
11.66 @@ -78,13 +57,13 @@
11.67 this.builderModel.buildRuntimeDatabaseModel();
11.68 }
11.69
11.70 - public void applyConnectionDefinitions(Map name2connectionDefMap, Map otdOid2ConnDefNameMap, Map intDbConfigParams) throws BaseException {
11.71 + public void applyConnectionDefinitions(Map name2connectionDefMap, Map connDefNameMap, Map intDbConfigParams) throws BaseException {
11.72 if ((intDbConfigParams != null) && (intDbConfigParams.size() > 0)) {
11.73 this.builderModel.setUseInstanceDB(true);
11.74 }
11.75 this.builderModel.setMemoryMonitorDB(false);
11.76 //this.builderModel.setShutdownMonitorDB(true); //103130
11.77 - this.builderModel.applyConnectionDefinitions(name2connectionDefMap, otdOid2ConnDefNameMap, intDbConfigParams);
11.78 + this.builderModel.applyConnectionDefinitions(name2connectionDefMap, connDefNameMap, intDbConfigParams);
11.79 this.builderModel.buildRuntimeDatabaseModel();
11.80 }
11.81
11.82 @@ -155,13 +134,13 @@
11.83 globalCleanupTask.addStatement(shutdownDB);
11.84 }
11.85
11.86 - /** HotFix #103130 :
11.87 - // Commented to resolve problem that occur while mulitple threads attempt to modify Summary table in mutlithread environment.
11.88 - // if (this.builderModel.isShutdownMonitorDB()) {
11.89 - // shutdownDB = new SQLPart("SHUTDOWN", SQLPart.STMT_DEFRAG, ETLScriptBuilderModel.ETL_MONITOR_DB_CONN_DEF_NAME);
11.90 - // globalCleanupTask.addOptionalTask(shutdownDB);
11.91 - // }
11.92 - */
11.93 + /** HotFix #103130 :
11.94 + // Commented to resolve problem that occur while mulitple threads attempt to modify Summary table in mutlithread environment.
11.95 + // if (this.builderModel.isShutdownMonitorDB()) {
11.96 + // shutdownDB = new SQLPart("SHUTDOWN", SQLPart.STMT_DEFRAG, ETLScriptBuilderModel.ETL_MONITOR_DB_CONN_DEF_NAME);
11.97 + // globalCleanupTask.addOptionalTask(shutdownDB);
11.98 + // }
11.99 + */
11.100
11.101 // Final WAIT task
11.102 // Create a wait task node to collect thread of each transformer chain.
11.103 @@ -198,9 +177,9 @@
11.104 startTask.setDisplayName(dnLabelMgr.getString("LBL_dn_start"));
11.105 endTask.setDisplayName(dnLabelMgr.getString("LBL_dn_end"));
11.106 }
11.107 +
11.108 public void applyConnectionDefinitions(boolean isMemoryDb) throws BaseException {
11.109 - this.builderModel.setMemoryMonitorDB(false);
11.110 - applyConnectionDefinitions();
11.111 + this.builderModel.setMemoryMonitorDB(false);
11.112 + applyConnectionDefinitions();
11.113 }
11.114 -
11.115 }
12.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/DefaultProcessFlowGenerator.java Sat Dec 08 10:04:51 2007 +0000
12.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/DefaultProcessFlowGenerator.java Sat Dec 08 10:24:35 2007 +0000
12.3 @@ -1,42 +1,20 @@
12.4 /*
12.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
12.6 - *
12.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
12.8 - *
12.9 - * The contents of this file are subject to the terms of either the GNU
12.10 - * General Public License Version 2 only ("GPL") or the Common
12.11 - * Development and Distribution License("CDDL") (collectively, the
12.12 - * "License"). You may not use this file except in compliance with the
12.13 - * License. You can obtain a copy of the License at
12.14 - * http://www.netbeans.org/cddl-gplv2.html
12.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
12.16 - * specific language governing permissions and limitations under the
12.17 - * License. When distributing the software, include this License Header
12.18 - * Notice in each file and include the License file at
12.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
12.20 - * particular file as subject to the "Classpath" exception as provided
12.21 - * by Sun in the GPL Version 2 section of the License file that
12.22 - * accompanied this code. If applicable, add the following below the
12.23 - * License Header, with the fields enclosed by brackets [] replaced by
12.24 - * your own identifying information:
12.25 + * The contents of this file are subject to the terms of the Common Development
12.26 + * and Distribution License (the License). You may not use this file except in
12.27 + * compliance with the License.
12.28 + *
12.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
12.30 + * or http://www.netbeans.org/cddl.txt.
12.31 + *
12.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
12.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
12.34 + * If applicable, add the following below the CDDL Header, with the fields
12.35 + * enclosed by brackets [] replaced by your own identifying information:
12.36 * "Portions Copyrighted [year] [name of copyright owner]"
12.37 - *
12.38 - * Contributor(s):
12.39 - *
12.40 + *
12.41 * The Original Software is NetBeans. The Initial Developer of the Original
12.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
12.43 * Microsystems, Inc. All Rights Reserved.
12.44 - *
12.45 - * If you wish your version of this file to be governed by only the CDDL
12.46 - * or only the GPL Version 2, indicate your decision by adding
12.47 - * "[Contributor] elects to include this software in this distribution
12.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
12.49 - * single choice of license, a recipient has the option to distribute
12.50 - * your version of this file under either the CDDL, the GPL Version 2 or
12.51 - * to extend the choice of license to its licensees as provided above.
12.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
12.53 - * Version 2 license, then the option applies only if the new code is
12.54 - * made subject to such option by the copyright holder.
12.55 */
12.56 package org.netbeans.modules.etl.codegen.impl;
12.57
13.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/ETLCodegenHelper.java Sat Dec 08 10:04:51 2007 +0000
13.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/ETLCodegenHelper.java Sat Dec 08 10:24:35 2007 +0000
13.3 @@ -1,42 +1,20 @@
13.4 /*
13.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
13.6 - *
13.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
13.8 - *
13.9 - * The contents of this file are subject to the terms of either the GNU
13.10 - * General Public License Version 2 only ("GPL") or the Common
13.11 - * Development and Distribution License("CDDL") (collectively, the
13.12 - * "License"). You may not use this file except in compliance with the
13.13 - * License. You can obtain a copy of the License at
13.14 - * http://www.netbeans.org/cddl-gplv2.html
13.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
13.16 - * specific language governing permissions and limitations under the
13.17 - * License. When distributing the software, include this License Header
13.18 - * Notice in each file and include the License file at
13.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
13.20 - * particular file as subject to the "Classpath" exception as provided
13.21 - * by Sun in the GPL Version 2 section of the License file that
13.22 - * accompanied this code. If applicable, add the following below the
13.23 - * License Header, with the fields enclosed by brackets [] replaced by
13.24 - * your own identifying information:
13.25 + * The contents of this file are subject to the terms of the Common Development
13.26 + * and Distribution License (the License). You may not use this file except in
13.27 + * compliance with the License.
13.28 + *
13.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
13.30 + * or http://www.netbeans.org/cddl.txt.
13.31 + *
13.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
13.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
13.34 + * If applicable, add the following below the CDDL Header, with the fields
13.35 + * enclosed by brackets [] replaced by your own identifying information:
13.36 * "Portions Copyrighted [year] [name of copyright owner]"
13.37 - *
13.38 - * Contributor(s):
13.39 - *
13.40 + *
13.41 * The Original Software is NetBeans. The Initial Developer of the Original
13.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
13.43 * Microsystems, Inc. All Rights Reserved.
13.44 - *
13.45 - * If you wish your version of this file to be governed by only the CDDL
13.46 - * or only the GPL Version 2, indicate your decision by adding
13.47 - * "[Contributor] elects to include this software in this distribution
13.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
13.49 - * single choice of license, a recipient has the option to distribute
13.50 - * your version of this file under either the CDDL, the GPL Version 2 or
13.51 - * to extend the choice of license to its licensees as provided above.
13.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
13.53 - * Version 2 license, then the option applies only if the new code is
13.54 - * made subject to such option by the copyright holder.
13.55 */
13.56 package org.netbeans.modules.etl.codegen.impl;
13.57
14.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/ETLCodelet.java Sat Dec 08 10:04:51 2007 +0000
14.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/ETLCodelet.java Sat Dec 08 10:24:35 2007 +0000
14.3 @@ -1,43 +1,21 @@
14.4
14.5 /*
14.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
14.7 - *
14.8 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
14.9 - *
14.10 - * The contents of this file are subject to the terms of either the GNU
14.11 - * General Public License Version 2 only ("GPL") or the Common
14.12 - * Development and Distribution License("CDDL") (collectively, the
14.13 - * "License"). You may not use this file except in compliance with the
14.14 - * License. You can obtain a copy of the License at
14.15 - * http://www.netbeans.org/cddl-gplv2.html
14.16 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
14.17 - * specific language governing permissions and limitations under the
14.18 - * License. When distributing the software, include this License Header
14.19 - * Notice in each file and include the License file at
14.20 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
14.21 - * particular file as subject to the "Classpath" exception as provided
14.22 - * by Sun in the GPL Version 2 section of the License file that
14.23 - * accompanied this code. If applicable, add the following below the
14.24 - * License Header, with the fields enclosed by brackets [] replaced by
14.25 - * your own identifying information:
14.26 + * The contents of this file are subject to the terms of the Common Development
14.27 + * and Distribution License (the License). You may not use this file except in
14.28 + * compliance with the License.
14.29 + *
14.30 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
14.31 + * or http://www.netbeans.org/cddl.txt.
14.32 + *
14.33 + * When distributing Covered Code, include this CDDL Header Notice in each file
14.34 + * and include the License file at http://www.netbeans.org/cddl.txt.
14.35 + * If applicable, add the following below the CDDL Header, with the fields
14.36 + * enclosed by brackets [] replaced by your own identifying information:
14.37 * "Portions Copyrighted [year] [name of copyright owner]"
14.38 - *
14.39 - * Contributor(s):
14.40 - *
14.41 + *
14.42 * The Original Software is NetBeans. The Initial Developer of the Original
14.43 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
14.44 * Microsystems, Inc. All Rights Reserved.
14.45 - *
14.46 - * If you wish your version of this file to be governed by only the CDDL
14.47 - * or only the GPL Version 2, indicate your decision by adding
14.48 - * "[Contributor] elects to include this software in this distribution
14.49 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
14.50 - * single choice of license, a recipient has the option to distribute
14.51 - * your version of this file under either the CDDL, the GPL Version 2 or
14.52 - * to extend the choice of license to its licensees as provided above.
14.53 - * However, if you add GPL Version 2 code and therefore, elected the GPL
14.54 - * Version 2 license, then the option applies only if the new code is
14.55 - * made subject to such option by the copyright holder.
14.56 */
14.57 package org.netbeans.modules.etl.codegen.impl;
14.58
14.59 @@ -130,7 +108,7 @@
14.60 // // com.sun.jbi.ui.devtool.etl.utils.jar: eTL (engine)
14.61 // DEPENDENT_CLASS_NAMES.add("com.sun.jbi.ui.devtool.etl.utils.ETLException");
14.62 //
14.63 -// // com.sun.jbi.ui.devtool.sqlframework.common.jar: eTL, sqlframework, flatfiledbotd (various)
14.64 +// // com.sun.jbi.ui.devtool.sqlframework.common.jar: eTL, sqlframework, flatfiledb (various)
14.65 // DEPENDENT_CLASS_NAMES.add("com.sun.jbi.ui.devtool.sql.framework.exception.BaseException");
14.66 //
14.67 // // commons-jxpath.jar: eTL (runtime.ETLBeanMessageImpl)
14.68 @@ -139,7 +117,7 @@
14.69 // // com.sun.jbi.ui.devtool.etl.monitor.jar: eTL (ETL MBean server)
14.70 // DEPENDENT_CLASS_NAMES.add("com.sun.jbi.ui.devtool.etl.monitor.mbeans.ETLMBeanLoader");
14.71 //
14.72 -// // AxionDB.jar: eTL, sqlframework, flatfiledbotd (various)
14.73 +// // AxionDB.jar: eTL, sqlframework, flatfiledb (various)
14.74 // DEPENDENT_CLASS_NAMES.add("org.axiondb.jdbc.AxionDriver");
14.75 //
14.76 // // add axion query jar org.axiondb.service
14.77 @@ -650,7 +628,7 @@
14.78 //
14.79 // private void validateDeplymentConfiguration(ErrorBundle errorBundle){
14.80 // try {
14.81 -// validateOTDConfiguarion(errorBundle);
14.82 +// validateDBConfiguarion(errorBundle);
14.83 // validateRuntimeServerConfiguarion(errorBundle);
14.84 //
14.85 // }catch (CodeGenException ex) {
14.86 @@ -662,7 +640,7 @@
14.87 // }
14.88 // }
14.89 //
14.90 -// private int validateOTDConfiguarion(ErrorBundle errorBundle)
14.91 +// private int validateDBConfiguarion(ErrorBundle errorBundle)
14.92 // throws CodeGenException, RepositoryException {
14.93 // int i = getNextSequenceForErrorBundle(errorBundle);
14.94 // String portName = null;
15.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/GenerateEngineFile.java Sat Dec 08 10:04:51 2007 +0000
15.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/GenerateEngineFile.java Sat Dec 08 10:24:35 2007 +0000
15.3 @@ -1,42 +1,20 @@
15.4 /*
15.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
15.6 - *
15.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
15.8 - *
15.9 - * The contents of this file are subject to the terms of either the GNU
15.10 - * General Public License Version 2 only ("GPL") or the Common
15.11 - * Development and Distribution License("CDDL") (collectively, the
15.12 - * "License"). You may not use this file except in compliance with the
15.13 - * License. You can obtain a copy of the License at
15.14 - * http://www.netbeans.org/cddl-gplv2.html
15.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
15.16 - * specific language governing permissions and limitations under the
15.17 - * License. When distributing the software, include this License Header
15.18 - * Notice in each file and include the License file at
15.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
15.20 - * particular file as subject to the "Classpath" exception as provided
15.21 - * by Sun in the GPL Version 2 section of the License file that
15.22 - * accompanied this code. If applicable, add the following below the
15.23 - * License Header, with the fields enclosed by brackets [] replaced by
15.24 - * your own identifying information:
15.25 + * The contents of this file are subject to the terms of the Common Development
15.26 + * and Distribution License (the License). You may not use this file except in
15.27 + * compliance with the License.
15.28 + *
15.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
15.30 + * or http://www.netbeans.org/cddl.txt.
15.31 + *
15.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
15.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
15.34 + * If applicable, add the following below the CDDL Header, with the fields
15.35 + * enclosed by brackets [] replaced by your own identifying information:
15.36 * "Portions Copyrighted [year] [name of copyright owner]"
15.37 - *
15.38 - * Contributor(s):
15.39 - *
15.40 + *
15.41 * The Original Software is NetBeans. The Initial Developer of the Original
15.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
15.43 * Microsystems, Inc. All Rights Reserved.
15.44 - *
15.45 - * If you wish your version of this file to be governed by only the CDDL
15.46 - * or only the GPL Version 2, indicate your decision by adding
15.47 - * "[Contributor] elects to include this software in this distribution
15.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
15.49 - * single choice of license, a recipient has the option to distribute
15.50 - * your version of this file under either the CDDL, the GPL Version 2 or
15.51 - * to extend the choice of license to its licensees as provided above.
15.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
15.53 - * Version 2 license, then the option applies only if the new code is
15.54 - * made subject to such option by the copyright holder.
15.55 */
15.56 package org.netbeans.modules.etl.codegen.impl;
15.57
15.58 @@ -84,13 +62,13 @@
15.59 // private ETLEngine engine = null;
15.60 // private ETLDefinitionProjectElement etlDefnPE = null;
15.61 //
15.62 -// // Holds a map of unique IDs (OTD OID + port type [either "-Source" or "-Target"]) to
15.63 +// // Holds a map of unique IDs (DB OID + port type [either "-Source" or "-Target"]) to
15.64 // // InternalDBMetadata instances which hold CME-level parameters such as directory
15.65 // // location of flatfiles and whether dynamic file name resolution is in effect.
15.66 // private Map internalDBConfigParams = new HashMap();
15.67 //
15.68 -// // Holds a map of OTD OIDs to corresponding connection pool names.
15.69 -// private Map otdNamePoolNameMap = new HashMap(2);
15.70 +// // Holds a map of DB OIDs to corresponding connection pool names.
15.71 +// private Map dbNamePoolNameMap = new HashMap(2);
15.72 //
15.73 //
15.74 // /**
15.75 @@ -341,14 +319,14 @@
15.76 // public GenerateEngineFile(ETLCodelet codelet, Collection pnLinks, ProcessingDefinition processDefn, ProjectDeployment deploy)
15.77 // throws RepositoryException, BaseException, CodeGenException {
15.78 // Iterator it = pnLinks.iterator();
15.79 -// String qualOtdId = null;
15.80 +// String qualdbId = null;
15.81 // String externalSystemType = null;
15.82 // String externalSystemSubType = null;
15.83 // IConfiguration iExtSubSysCfg = null;
15.84 // IConfiguration iExtSysCommonCfg = null;
15.85 // Map connDefs = new HashMap(); // Connection pool names --> resolved
15.86 -// Map otdCatalogOverrideMapMap = new HashMap();
15.87 -// Map otdSchemaOverrideMapMap = new HashMap();
15.88 +// Map dbCatalogOverrideMapMap = new HashMap();
15.89 +// Map dbSchemaOverrideMapMap = new HashMap();
15.90 //
15.91 // this.codelet = codelet;
15.92 // this.connectionDefnTemplate = new DBConnectionDefinitionTemplate();
15.93 @@ -374,8 +352,8 @@
15.94 // String poolName = this.codelet.getDeployedName().getLocalPart() + "_" + link.getDestinationNode().getName();
15.95 //
15.96 // if (portType != null) {
15.97 -// qualOtdId = portType.getOID() + suffix ;
15.98 -// this.otdNamePoolNameMap.put(qualOtdId, poolName);
15.99 +// qualdbId = portType.getOID() + suffix ;
15.100 +// this.dbNamePoolNameMap.put(qualdbId, poolName);
15.101 // externalSystemType = this.codelet.getExternalSystemType(link);
15.102 // externalSystemSubType = this.codelet.getExternalSystemTypeName(link);
15.103 // iExtSubSysCfg = ETLCodegenHelper.getExternalSystemConfiguration(link, deploy, externalSystemSubType);
15.104 @@ -387,13 +365,13 @@
15.105 // Map map = new TreeMap(String.CASE_INSENSITIVE_ORDER);
15.106 // map.putAll(runtimeEnv.getOverwrittenCatalogNameMap());
15.107 //
15.108 -// otdCatalogOverrideMapMap.put(qualOtdId, map);
15.109 +// dbCatalogOverrideMapMap.put(qualdbId, map);
15.110 // }
15.111 //
15.112 // if (runtimeEnv.isSchemaNameOverwritten()){
15.113 // Map map = new TreeMap(String.CASE_INSENSITIVE_ORDER);
15.114 // map.putAll(runtimeEnv.getOverwrittenSchemaNameMap());
15.115 -// otdSchemaOverrideMapMap.put(qualOtdId, map);
15.116 +// dbSchemaOverrideMapMap.put(qualdbId, map);
15.117 // }
15.118 // }
15.119 // }
15.120 @@ -404,15 +382,15 @@
15.121 // SQLDefinition sqlDefinition = etldefn.getSQLDefinition();
15.122 //
15.123 // try {
15.124 -// sqlDefinition.overrideCatalogNamesForOtd(otdCatalogOverrideMapMap);
15.125 -// sqlDefinition.overrideSchemaNamesForOtd(otdSchemaOverrideMapMap);
15.126 +// sqlDefinition.overrideCatalogNamesForDb(dbCatalogOverrideMapMap);
15.127 +// sqlDefinition.overrideSchemaNamesForDb(dbSchemaOverrideMapMap);
15.128 // ETLProcessFlowGenerator flowgen = ETLProcessFlowGeneratorFactory.getCollabFlowGenerator(sqlDefinition, true );
15.129 // flowgen.setWorkingFolder(ETLDeploymentConstants.PARAM_APP_DATAROOT);
15.130 // flowgen.setInstanceDBName(ETLDeploymentConstants.PARAM_INSTANCE_DB_NAME);
15.131 // flowgen.setInstanceDBFolder(codelet.getEngineInstanceDBDirectory());
15.132 // flowgen.setMonitorDBName(codelet.getDeployable().getName());
15.133 // flowgen.setMonitorDBFolder(codelet.getEngineMonitorDBDirectory());
15.134 -// flowgen.applyConnectionDefinitions(connDefs, this.otdNamePoolNameMap, internalDBConfigParams);
15.135 +// flowgen.applyConnectionDefinitions(connDefs, this.dbNamePoolNameMap, internalDBConfigParams);
15.136 // this.engine = flowgen.getScript();
15.137 // }finally{
15.138 // sqlDefinition.clearOverride(true, true);
16.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/InternalDBMetadata.java Sat Dec 08 10:04:51 2007 +0000
16.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/InternalDBMetadata.java Sat Dec 08 10:24:35 2007 +0000
16.3 @@ -1,49 +1,27 @@
16.4 /*
16.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
16.6 - *
16.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
16.8 - *
16.9 - * The contents of this file are subject to the terms of either the GNU
16.10 - * General Public License Version 2 only ("GPL") or the Common
16.11 - * Development and Distribution License("CDDL") (collectively, the
16.12 - * "License"). You may not use this file except in compliance with the
16.13 - * License. You can obtain a copy of the License at
16.14 - * http://www.netbeans.org/cddl-gplv2.html
16.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16.16 - * specific language governing permissions and limitations under the
16.17 - * License. When distributing the software, include this License Header
16.18 - * Notice in each file and include the License file at
16.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
16.20 - * particular file as subject to the "Classpath" exception as provided
16.21 - * by Sun in the GPL Version 2 section of the License file that
16.22 - * accompanied this code. If applicable, add the following below the
16.23 - * License Header, with the fields enclosed by brackets [] replaced by
16.24 - * your own identifying information:
16.25 + * The contents of this file are subject to the terms of the Common Development
16.26 + * and Distribution License (the License). You may not use this file except in
16.27 + * compliance with the License.
16.28 + *
16.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
16.30 + * or http://www.netbeans.org/cddl.txt.
16.31 + *
16.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
16.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
16.34 + * If applicable, add the following below the CDDL Header, with the fields
16.35 + * enclosed by brackets [] replaced by your own identifying information:
16.36 * "Portions Copyrighted [year] [name of copyright owner]"
16.37 - *
16.38 - * Contributor(s):
16.39 - *
16.40 + *
16.41 * The Original Software is NetBeans. The Initial Developer of the Original
16.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
16.43 * Microsystems, Inc. All Rights Reserved.
16.44 - *
16.45 - * If you wish your version of this file to be governed by only the CDDL
16.46 - * or only the GPL Version 2, indicate your decision by adding
16.47 - * "[Contributor] elects to include this software in this distribution
16.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
16.49 - * single choice of license, a recipient has the option to distribute
16.50 - * your version of this file under either the CDDL, the GPL Version 2 or
16.51 - * to extend the choice of license to its licensees as provided above.
16.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
16.53 - * Version 2 license, then the option applies only if the new code is
16.54 - * made subject to such option by the copyright holder.
16.55 */
16.56
16.57 package org.netbeans.modules.etl.codegen.impl;
16.58
16.59 /**
16.60 - * Holds Flat file OTD metadata for codegen.
16.61 - *
16.62 + * Holds Flat file Database metadata for codegen.
16.63 + *
16.64 * @author Sudhi Seshachala
16.65 */
16.66 public class InternalDBMetadata {
17.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/OnePassETLStrategyBuilderImpl.java Sat Dec 08 10:04:51 2007 +0000
17.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/OnePassETLStrategyBuilderImpl.java Sat Dec 08 10:24:35 2007 +0000
17.3 @@ -1,42 +1,20 @@
17.4 /*
17.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
17.6 - *
17.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
17.8 - *
17.9 - * The contents of this file are subject to the terms of either the GNU
17.10 - * General Public License Version 2 only ("GPL") or the Common
17.11 - * Development and Distribution License("CDDL") (collectively, the
17.12 - * "License"). You may not use this file except in compliance with the
17.13 - * License. You can obtain a copy of the License at
17.14 - * http://www.netbeans.org/cddl-gplv2.html
17.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
17.16 - * specific language governing permissions and limitations under the
17.17 - * License. When distributing the software, include this License Header
17.18 - * Notice in each file and include the License file at
17.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
17.20 - * particular file as subject to the "Classpath" exception as provided
17.21 - * by Sun in the GPL Version 2 section of the License file that
17.22 - * accompanied this code. If applicable, add the following below the
17.23 - * License Header, with the fields enclosed by brackets [] replaced by
17.24 - * your own identifying information:
17.25 + * The contents of this file are subject to the terms of the Common Development
17.26 + * and Distribution License (the License). You may not use this file except in
17.27 + * compliance with the License.
17.28 + *
17.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
17.30 + * or http://www.netbeans.org/cddl.txt.
17.31 + *
17.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
17.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
17.34 + * If applicable, add the following below the CDDL Header, with the fields
17.35 + * enclosed by brackets [] replaced by your own identifying information:
17.36 * "Portions Copyrighted [year] [name of copyright owner]"
17.37 - *
17.38 - * Contributor(s):
17.39 - *
17.40 + *
17.41 * The Original Software is NetBeans. The Initial Developer of the Original
17.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17.43 * Microsystems, Inc. All Rights Reserved.
17.44 - *
17.45 - * If you wish your version of this file to be governed by only the CDDL
17.46 - * or only the GPL Version 2, indicate your decision by adding
17.47 - * "[Contributor] elects to include this software in this distribution
17.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
17.49 - * single choice of license, a recipient has the option to distribute
17.50 - * your version of this file under either the CDDL, the GPL Version 2 or
17.51 - * to extend the choice of license to its licensees as provided above.
17.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
17.53 - * Version 2 license, then the option applies only if the new code is
17.54 - * made subject to such option by the copyright holder.
17.55 */
17.56 package org.netbeans.modules.etl.codegen.impl;
17.57
17.58 @@ -46,10 +24,9 @@
17.59 import org.netbeans.modules.etl.codegen.ETLStrategyBuilderContext;
17.60 import org.netbeans.modules.etl.codegen.PatternFinder;
17.61 import org.netbeans.modules.etl.utils.MessageManager;
17.62 -import org.netbeans.modules.model.database.DBConnectionDefinition;
17.63 -import org.netbeans.modules.sql.framework.evaluators.database.DB;
17.64 -import org.netbeans.modules.sql.framework.evaluators.database.DBFactory;
17.65 -import org.netbeans.modules.sql.framework.evaluators.database.StatementContext;
17.66 +import org.netbeans.modules.sql.framework.codegen.DB;
17.67 +import org.netbeans.modules.sql.framework.codegen.DBFactory;
17.68 +import org.netbeans.modules.sql.framework.codegen.StatementContext;
17.69 import org.netbeans.modules.sql.framework.model.SourceTable;
17.70 import org.netbeans.modules.sql.framework.model.TargetTable;
17.71
17.72 @@ -62,6 +39,7 @@
17.73 import com.sun.sql.framework.jdbc.SQLPart;
17.74 import com.sun.sql.framework.utils.AttributeMap;
17.75 import com.sun.sql.framework.utils.Logger;
17.76 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
17.77
17.78 /**
17.79 * If all source table are from same DB and statement type is Insert
17.80 @@ -125,7 +103,7 @@
17.81 DB statsDb = DBFactory.getInstance().getDatabase(DB.AXIONDB);
17.82 stmtContext.setUsingFullyQualifiedTablePrefix(false);
17.83 stmtContext.setUsingUniqueTableName(true);
17.84 - String statsTable = statsDb.getUnescapedName(statsDb.getEvaluatorFactory().evaluate(tgtTable, stmtContext));
17.85 + String statsTable = statsDb.getUnescapedName(statsDb.getGeneratorFactory().generate(tgtTable, stmtContext));
17.86 onePassETLNode.setTableName(statsTable); //NOI18N
17.87 } else {
17.88 throw new BaseException("Must have source table for One-Pass eTL Strategy.");
18.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/PipelinedFlowGenerator.java Sat Dec 08 10:04:51 2007 +0000
18.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/PipelinedFlowGenerator.java Sat Dec 08 10:24:35 2007 +0000
18.3 @@ -1,42 +1,20 @@
18.4 /*
18.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
18.6 - *
18.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
18.8 - *
18.9 - * The contents of this file are subject to the terms of either the GNU
18.10 - * General Public License Version 2 only ("GPL") or the Common
18.11 - * Development and Distribution License("CDDL") (collectively, the
18.12 - * "License"). You may not use this file except in compliance with the
18.13 - * License. You can obtain a copy of the License at
18.14 - * http://www.netbeans.org/cddl-gplv2.html
18.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
18.16 - * specific language governing permissions and limitations under the
18.17 - * License. When distributing the software, include this License Header
18.18 - * Notice in each file and include the License file at
18.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
18.20 - * particular file as subject to the "Classpath" exception as provided
18.21 - * by Sun in the GPL Version 2 section of the License file that
18.22 - * accompanied this code. If applicable, add the following below the
18.23 - * License Header, with the fields enclosed by brackets [] replaced by
18.24 - * your own identifying information:
18.25 + * The contents of this file are subject to the terms of the Common Development
18.26 + * and Distribution License (the License). You may not use this file except in
18.27 + * compliance with the License.
18.28 + *
18.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
18.30 + * or http://www.netbeans.org/cddl.txt.
18.31 + *
18.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
18.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
18.34 + * If applicable, add the following below the CDDL Header, with the fields
18.35 + * enclosed by brackets [] replaced by your own identifying information:
18.36 * "Portions Copyrighted [year] [name of copyright owner]"
18.37 - *
18.38 - * Contributor(s):
18.39 - *
18.40 + *
18.41 * The Original Software is NetBeans. The Initial Developer of the Original
18.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
18.43 * Microsystems, Inc. All Rights Reserved.
18.44 - *
18.45 - * If you wish your version of this file to be governed by only the CDDL
18.46 - * or only the GPL Version 2, indicate your decision by adding
18.47 - * "[Contributor] elects to include this software in this distribution
18.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
18.49 - * single choice of license, a recipient has the option to distribute
18.50 - * your version of this file under either the CDDL, the GPL Version 2 or
18.51 - * to extend the choice of license to its licensees as provided above.
18.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
18.53 - * Version 2 license, then the option applies only if the new code is
18.54 - * made subject to such option by the copyright holder.
18.55 */
18.56 package org.netbeans.modules.etl.codegen.impl;
18.57
18.58 @@ -49,7 +27,6 @@
18.59 import org.netbeans.modules.etl.codegen.ETLStrategyBuilder;
18.60 import org.netbeans.modules.etl.codegen.ETLStrategyBuilderContext;
18.61 import org.netbeans.modules.etl.utils.MessageManager;
18.62 -import org.netbeans.modules.model.database.DBConnectionDefinition;
18.63 import org.netbeans.modules.sql.framework.common.jdbc.SQLUtils;
18.64 import org.netbeans.modules.sql.framework.model.SQLDBTable;
18.65 import org.netbeans.modules.sql.framework.model.SQLDefinition;
18.66 @@ -62,6 +39,7 @@
18.67 import com.sun.sql.framework.jdbc.DBConstants;
18.68 import com.sun.sql.framework.utils.Logger;
18.69 import com.sun.sql.framework.utils.StringUtil;
18.70 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
18.71
18.72 /**
18.73 * Builds ETL Process Flow and delegates to appropriate ETLStrategyBuilder implementation
18.74 @@ -81,14 +59,16 @@
18.75 this.builderModel.setUseInstanceDB(true);
18.76 }
18.77
18.78 + @Override
18.79 public void applyConnectionDefinitions() throws BaseException {
18.80 super.applyConnectionDefinitions();
18.81 }
18.82
18.83 - public void applyConnectionDefinitions(Map name2connectionDefMap, Map otdOid2ConnDefNameMap, Map intDbConfigParams) throws BaseException {
18.84 + @Override
18.85 + public void applyConnectionDefinitions(Map name2connectionDefMap, Map connDefNameMap, Map intDbConfigParams) throws BaseException {
18.86 this.builderModel.setUseInstanceDB(true);
18.87 this.builderModel.setShutdownMonitorDB(true);
18.88 - super.applyConnectionDefinitions(name2connectionDefMap, otdOid2ConnDefNameMap, intDbConfigParams);
18.89 + super.applyConnectionDefinitions(name2connectionDefMap, connDefNameMap, intDbConfigParams);
18.90 }
18.91
18.92 public ETLEngine getScript() throws BaseException {
19.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/PipelinedStrategyBuilderImpl.java Sat Dec 08 10:04:51 2007 +0000
19.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/PipelinedStrategyBuilderImpl.java Sat Dec 08 10:24:35 2007 +0000
19.3 @@ -1,42 +1,20 @@
19.4 /*
19.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
19.6 - *
19.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
19.8 - *
19.9 - * The contents of this file are subject to the terms of either the GNU
19.10 - * General Public License Version 2 only ("GPL") or the Common
19.11 - * Development and Distribution License("CDDL") (collectively, the
19.12 - * "License"). You may not use this file except in compliance with the
19.13 - * License. You can obtain a copy of the License at
19.14 - * http://www.netbeans.org/cddl-gplv2.html
19.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
19.16 - * specific language governing permissions and limitations under the
19.17 - * License. When distributing the software, include this License Header
19.18 - * Notice in each file and include the License file at
19.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
19.20 - * particular file as subject to the "Classpath" exception as provided
19.21 - * by Sun in the GPL Version 2 section of the License file that
19.22 - * accompanied this code. If applicable, add the following below the
19.23 - * License Header, with the fields enclosed by brackets [] replaced by
19.24 - * your own identifying information:
19.25 + * The contents of this file are subject to the terms of the Common Development
19.26 + * and Distribution License (the License). You may not use this file except in
19.27 + * compliance with the License.
19.28 + *
19.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
19.30 + * or http://www.netbeans.org/cddl.txt.
19.31 + *
19.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
19.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
19.34 + * If applicable, add the following below the CDDL Header, with the fields
19.35 + * enclosed by brackets [] replaced by your own identifying information:
19.36 * "Portions Copyrighted [year] [name of copyright owner]"
19.37 - *
19.38 - * Contributor(s):
19.39 - *
19.40 + *
19.41 * The Original Software is NetBeans. The Initial Developer of the Original
19.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
19.43 * Microsystems, Inc. All Rights Reserved.
19.44 - *
19.45 - * If you wish your version of this file to be governed by only the CDDL
19.46 - * or only the GPL Version 2, indicate your decision by adding
19.47 - * "[Contributor] elects to include this software in this distribution
19.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
19.49 - * single choice of license, a recipient has the option to distribute
19.50 - * your version of this file under either the CDDL, the GPL Version 2 or
19.51 - * to extend the choice of license to its licensees as provided above.
19.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
19.53 - * Version 2 license, then the option applies only if the new code is
19.54 - * made subject to such option by the copyright holder.
19.55 */
19.56 package org.netbeans.modules.etl.codegen.impl;
19.57
19.58 @@ -54,16 +32,15 @@
19.59 import org.netbeans.modules.etl.codegen.ETLStrategyBuilderContext;
19.60 import org.netbeans.modules.etl.utils.MessageManager;
19.61 import org.netbeans.modules.mashup.db.model.FlatfileDefinition;
19.62 -import org.netbeans.modules.model.database.DBConnectionDefinition;
19.63 import org.netbeans.modules.sql.framework.common.jdbc.SQLDBConnectionDefinition;
19.64 import org.netbeans.modules.sql.framework.common.jdbc.SQLUtils;
19.65 -import org.netbeans.modules.sql.framework.evaluators.database.DB;
19.66 -import org.netbeans.modules.sql.framework.evaluators.database.DBFactory;
19.67 -import org.netbeans.modules.sql.framework.evaluators.database.StatementContext;
19.68 -import org.netbeans.modules.sql.framework.evaluators.database.Statements;
19.69 -import org.netbeans.modules.sql.framework.evaluators.database.axion.AxionDB;
19.70 -import org.netbeans.modules.sql.framework.evaluators.database.axion.AxionPipelineStatements;
19.71 -import org.netbeans.modules.sql.framework.evaluators.database.axion.AxionStatements;
19.72 +import org.netbeans.modules.sql.framework.codegen.DB;
19.73 +import org.netbeans.modules.sql.framework.codegen.DBFactory;
19.74 +import org.netbeans.modules.sql.framework.codegen.StatementContext;
19.75 +import org.netbeans.modules.sql.framework.codegen.Statements;
19.76 +import org.netbeans.modules.sql.framework.codegen.axion.AxionDB;
19.77 +import org.netbeans.modules.sql.framework.codegen.axion.AxionPipelineStatements;
19.78 +import org.netbeans.modules.sql.framework.codegen.axion.AxionStatements;
19.79 import org.netbeans.modules.sql.framework.model.SQLConstants;
19.80 import org.netbeans.modules.sql.framework.model.SQLDBTable;
19.81 import org.netbeans.modules.sql.framework.model.SQLModelObjectFactory;
19.82 @@ -77,6 +54,7 @@
19.83 import com.sun.sql.framework.jdbc.SQLPart;
19.84 import com.sun.sql.framework.utils.Logger;
19.85 import com.sun.sql.framework.utils.StringUtil;
19.86 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
19.87
19.88 /**
19.89 * @author Jonathan Giron
19.90 @@ -211,9 +189,9 @@
19.91 InternalDBMetadata tgtInternalMetadata = model.getInternalMetadata(tTable);
19.92
19.93 //For Target Table
19.94 - FlatfileDefinition tgtOtd = ETLCodegenUtil.getStcdbObjectTypeDefinition(tTable);
19.95 - if (tgtOtd instanceof FlatfileDefinition && tgtInternalMetadata != null) {
19.96 - getFlatfileInitSQLParts(tgtOtd, tgtInternalMetadata, initTask, cleanupTask, tTable, true);
19.97 + FlatfileDefinition trgFFDef = ETLCodegenUtil.getStcdbObjectTypeDefinition(tTable);
19.98 + if (trgFFDef instanceof FlatfileDefinition && tgtInternalMetadata != null) {
19.99 + getFlatfileInitSQLParts(trgFFDef, tgtInternalMetadata, initTask, cleanupTask, tTable, true);
19.100 }
19.101
19.102 //For all SourceTables associated with Target table
19.103 @@ -221,10 +199,10 @@
19.104 SQLDBTable dbTable = (SQLDBTable) it.next();
19.105 FlatfileDefinition srcRepObj = ETLCodegenUtil.getStcdbObjectTypeDefinition(dbTable);
19.106 if (srcRepObj != null) {
19.107 - FlatfileDefinition srcOtd = srcRepObj;
19.108 + FlatfileDefinition srcFFDef = srcRepObj;
19.109 InternalDBMetadata srcInternalMetadata = model.getInternalMetadata(dbTable);
19.110 if (srcInternalMetadata != null) {
19.111 - getFlatfileInitSQLParts(srcOtd, srcInternalMetadata, initTask, cleanupTask, dbTable, false);
19.112 + getFlatfileInitSQLParts(srcFFDef, srcInternalMetadata, initTask, cleanupTask, dbTable, false);
19.113 }
19.114 }
19.115 }
19.116 @@ -248,7 +226,7 @@
19.117 // Use unique table name to generate table name associated with
19.118 // pipeline/validation task.
19.119 sc.setUseTargetTableAliasName(false);
19.120 - pipeline.setTableName(db.getUnescapedName(db.getEvaluatorFactory().evaluate(tt, sc)));
19.121 + pipeline.setTableName(db.getUnescapedName(db.getGeneratorFactory().generate(tt, sc)));
19.122
19.123 // Insert new execution record for target table, tt.
19.124 super.addInsertNewExecutionRecordStatement(pipeline, tt);
19.125 @@ -313,13 +291,13 @@
19.126 StatementContext context = new StatementContext();
19.127 context.setUsingUniqueTableName(table, true);
19.128 context.setUsingFullyQualifiedTablePrefix(false);
19.129 - String localName = db.getUnescapedName(db.getEvaluatorFactory().evaluate(table, context));
19.130 + String localName = db.getUnescapedName(db.getGeneratorFactory().generate(table, context));
19.131
19.132 SQLPart initPart = new SQLPart(getCreateRemoteTableSQL(table, localName, linkName), SQLPart.STMT_INITIALIZESTATEMENTS,
19.133 ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME);
19.134 initTask.addOptionalTask(initPart);
19.135
19.136 - // FIXME: create remount statement in Axion statement evaluator
19.137 + // FIXME: create remount statement in Axion statement Generator
19.138 // FIXME: Do we need remount here ?
19.139 SQLPart remountPart = new SQLPart("REMOUNT EXTERNAL TABLE " + (StringUtil.isNullString(localName) ? table.getName() : localName),
19.140 SQLPart.STMT_INITIALIZESTATEMENTS, ETLScriptBuilderModel.ETL_INSTANCE_DB_CONN_DEF_NAME);
19.141 @@ -395,7 +373,7 @@
19.142 }
19.143
19.144 context.setUseTargetTableAliasName(false);
19.145 - insertSelectPart.setTableName(db.getUnescapedName(db.getEvaluatorFactory().evaluate(tt, context)));
19.146 + insertSelectPart.setTableName(db.getUnescapedName(db.getGeneratorFactory().generate(tt, context)));
19.147 return insertSelectPart;
19.148 }
19.149
19.150 @@ -405,6 +383,7 @@
19.151 * @param targetTable
19.152 * @return Comment String
19.153 */
19.154 + @Override
19.155 protected String getCommentForTransformer(TargetTable targetTable) throws BaseException {
19.156 return MSG_MGR.getString("DISPLAY_INSERT_TARGET_PIPELINE", targetTable.getParent().getModelName(), this.builderModel.getConnectionDefinition(
19.157 targetTable).getDBType());
20.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/SimpleETLStrategyBuilderImpl.java Sat Dec 08 10:04:51 2007 +0000
20.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/SimpleETLStrategyBuilderImpl.java Sat Dec 08 10:24:35 2007 +0000
20.3 @@ -1,42 +1,20 @@
20.4 /*
20.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
20.6 - *
20.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
20.8 - *
20.9 - * The contents of this file are subject to the terms of either the GNU
20.10 - * General Public License Version 2 only ("GPL") or the Common
20.11 - * Development and Distribution License("CDDL") (collectively, the
20.12 - * "License"). You may not use this file except in compliance with the
20.13 - * License. You can obtain a copy of the License at
20.14 - * http://www.netbeans.org/cddl-gplv2.html
20.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
20.16 - * specific language governing permissions and limitations under the
20.17 - * License. When distributing the software, include this License Header
20.18 - * Notice in each file and include the License file at
20.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
20.20 - * particular file as subject to the "Classpath" exception as provided
20.21 - * by Sun in the GPL Version 2 section of the License file that
20.22 - * accompanied this code. If applicable, add the following below the
20.23 - * License Header, with the fields enclosed by brackets [] replaced by
20.24 - * your own identifying information:
20.25 + * The contents of this file are subject to the terms of the Common Development
20.26 + * and Distribution License (the License). You may not use this file except in
20.27 + * compliance with the License.
20.28 + *
20.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
20.30 + * or http://www.netbeans.org/cddl.txt.
20.31 + *
20.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
20.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
20.34 + * If applicable, add the following below the CDDL Header, with the fields
20.35 + * enclosed by brackets [] replaced by your own identifying information:
20.36 * "Portions Copyrighted [year] [name of copyright owner]"
20.37 - *
20.38 - * Contributor(s):
20.39 - *
20.40 + *
20.41 * The Original Software is NetBeans. The Initial Developer of the Original
20.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
20.43 * Microsystems, Inc. All Rights Reserved.
20.44 - *
20.45 - * If you wish your version of this file to be governed by only the CDDL
20.46 - * or only the GPL Version 2, indicate your decision by adding
20.47 - * "[Contributor] elects to include this software in this distribution
20.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
20.49 - * single choice of license, a recipient has the option to distribute
20.50 - * your version of this file under either the CDDL, the GPL Version 2 or
20.51 - * to extend the choice of license to its licensees as provided above.
20.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
20.53 - * Version 2 license, then the option applies only if the new code is
20.54 - * made subject to such option by the copyright holder.
20.55 */
20.56 package org.netbeans.modules.etl.codegen.impl;
20.57
20.58 @@ -45,9 +23,9 @@
20.59 import org.netbeans.modules.etl.codegen.ETLScriptBuilderModel;
20.60 import org.netbeans.modules.etl.codegen.ETLStrategyBuilderContext;
20.61 import org.netbeans.modules.etl.utils.MessageManager;
20.62 -import org.netbeans.modules.sql.framework.evaluators.database.DB;
20.63 -import org.netbeans.modules.sql.framework.evaluators.database.DBFactory;
20.64 -import org.netbeans.modules.sql.framework.evaluators.database.StatementContext;
20.65 +import org.netbeans.modules.sql.framework.codegen.DB;
20.66 +import org.netbeans.modules.sql.framework.codegen.DBFactory;
20.67 +import org.netbeans.modules.sql.framework.codegen.StatementContext;
20.68 import org.netbeans.modules.sql.framework.model.SQLConstants;
20.69 import org.netbeans.modules.sql.framework.model.SourceTable;
20.70 import org.netbeans.modules.sql.framework.model.TargetTable;
20.71 @@ -66,8 +44,8 @@
20.72 * <p>
20.73 * Note: In some cases where the source tables and target table are flat file we will also
20.74 * jump directly transformation, but the caller has to make sure the table names are
20.75 - * unique since there might be situation where two OTD was created and both have same
20.76 - * table name, in that case we just prefix the table name with otd name
20.77 + * unique since there might be situation where two Database was created and both have same
20.78 + * table name, in that case we just prefix the table name with database name
20.79 * <p>
20.80 *
20.81 * @author Ahimanikya Satapathy
20.82 @@ -123,7 +101,7 @@
20.83 MessageManager msgMgr = MessageManager.getManager(ETLTaskNode.class);
20.84 String displayName = msgMgr.getString("TEMPLATE_dn", msgMgr.getString("LBL_dn_transformer"), context.getTargetTable().getName());
20.85
20.86 - // TODO Need to refactor/redesign interfaces between evaluators and codgen framework
20.87 + // TODO Need to refactor/redesign interfaces between sql-codegen and etl-codgen framework
20.88 // such that we will avoid code like "IF ELSE" like below.
20.89 if ((targetDB.getDBType() == DB.JDBCDB)
20.90 && (targetTable.getSourceTableList().size() != 0)
20.91 @@ -177,6 +155,7 @@
20.92 return sc;
20.93 }
20.94
20.95 + @Override
20.96 protected boolean isExtractionRequired(SourceTable sourceTable, TargetTable targetTable) throws BaseException {
20.97 return false;
20.98 }
21.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/StagingStrategyBuilder.java Sat Dec 08 10:04:51 2007 +0000
21.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/StagingStrategyBuilder.java Sat Dec 08 10:24:35 2007 +0000
21.3 @@ -1,42 +1,20 @@
21.4 /*
21.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
21.6 - *
21.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
21.8 - *
21.9 - * The contents of this file are subject to the terms of either the GNU
21.10 - * General Public License Version 2 only ("GPL") or the Common
21.11 - * Development and Distribution License("CDDL") (collectively, the
21.12 - * "License"). You may not use this file except in compliance with the
21.13 - * License. You can obtain a copy of the License at
21.14 - * http://www.netbeans.org/cddl-gplv2.html
21.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
21.16 - * specific language governing permissions and limitations under the
21.17 - * License. When distributing the software, include this License Header
21.18 - * Notice in each file and include the License file at
21.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
21.20 - * particular file as subject to the "Classpath" exception as provided
21.21 - * by Sun in the GPL Version 2 section of the License file that
21.22 - * accompanied this code. If applicable, add the following below the
21.23 - * License Header, with the fields enclosed by brackets [] replaced by
21.24 - * your own identifying information:
21.25 + * The contents of this file are subject to the terms of the Common Development
21.26 + * and Distribution License (the License). You may not use this file except in
21.27 + * compliance with the License.
21.28 + *
21.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
21.30 + * or http://www.netbeans.org/cddl.txt.
21.31 + *
21.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
21.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
21.34 + * If applicable, add the following below the CDDL Header, with the fields
21.35 + * enclosed by brackets [] replaced by your own identifying information:
21.36 * "Portions Copyrighted [year] [name of copyright owner]"
21.37 - *
21.38 - * Contributor(s):
21.39 - *
21.40 + *
21.41 * The Original Software is NetBeans. The Initial Developer of the Original
21.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
21.43 * Microsystems, Inc. All Rights Reserved.
21.44 - *
21.45 - * If you wish your version of this file to be governed by only the CDDL
21.46 - * or only the GPL Version 2, indicate your decision by adding
21.47 - * "[Contributor] elects to include this software in this distribution
21.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
21.49 - * single choice of license, a recipient has the option to distribute
21.50 - * your version of this file under either the CDDL, the GPL Version 2 or
21.51 - * to extend the choice of license to its licensees as provided above.
21.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
21.53 - * Version 2 license, then the option applies only if the new code is
21.54 - * made subject to such option by the copyright holder.
21.55 */
21.56 package org.netbeans.modules.etl.codegen.impl;
21.57
21.58 @@ -47,11 +25,10 @@
21.59 import org.netbeans.modules.etl.codegen.ETLStrategyBuilderContext;
21.60 import org.netbeans.modules.etl.codegen.PatternFinder;
21.61 import org.netbeans.modules.etl.utils.MessageManager;
21.62 -import org.netbeans.modules.model.database.DBConnectionDefinition;
21.63 -import org.netbeans.modules.sql.framework.evaluators.database.DB;
21.64 -import org.netbeans.modules.sql.framework.evaluators.database.DBFactory;
21.65 -import org.netbeans.modules.sql.framework.evaluators.database.StatementContext;
21.66 -import org.netbeans.modules.sql.framework.evaluators.database.Statements;
21.67 +import org.netbeans.modules.sql.framework.codegen.DB;
21.68 +import org.netbeans.modules.sql.framework.codegen.DBFactory;
21.69 +import org.netbeans.modules.sql.framework.codegen.StatementContext;
21.70 +import org.netbeans.modules.sql.framework.codegen.Statements;
21.71 import org.netbeans.modules.sql.framework.model.SQLConstants;
21.72 import org.netbeans.modules.sql.framework.model.SourceTable;
21.73 import org.netbeans.modules.sql.framework.model.TargetTable;
21.74 @@ -63,7 +40,7 @@
21.75 import com.sun.sql.framework.jdbc.SQLPart;
21.76 import com.sun.sql.framework.utils.AttributeMap;
21.77 import com.sun.sql.framework.utils.Logger;
21.78 -import com.sun.sql.framework.utils.StringUtil;
21.79 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
21.80
21.81 /**
21.82 * @author Girish Patil
21.83 @@ -78,21 +55,6 @@
21.84 super(model);
21.85 }
21.86
21.87 - private String getTargetTableUserDefinedSchema(TargetTable tt)
21.88 - {
21.89 - String schemaName = null;
21.90 - // If User has defined Schema name use it.
21.91 - String uSchema = tt.getUserDefinedSchemaName();
21.92 - if (StringUtil.isNullString(uSchema)){
21.93 - if (!StringUtil.isNullString(tt.getSchema())){
21.94 - schemaName = tt.getSchema().toUpperCase();
21.95 - }
21.96 - }else{
21.97 - schemaName = uSchema.toUpperCase();
21.98 - }
21.99 -
21.100 - return schemaName;
21.101 - }
21.102 /**
21.103 * Before calling apply appropriate applyConnections
21.104 */
21.105 @@ -111,7 +73,7 @@
21.106 ETLTaskNode transformerTask = null;
21.107 String displayName = msgMgr.getString("TEMPLATE_dn", msgMgr.getString("LBL_dn_transformer"), context.getTargetTable().getName());
21.108
21.109 - // TODO Need to refactor/redesign interfaces between evaluators and codgen framework
21.110 + // TODO Need to refactor/redesign interfaces between sql-codegen and etl-codgen framework
21.111 // such that we will avoid code like "IF ELSE" like below.
21.112 if ((targetDB.getDBType() == DB.JDBCDB)
21.113 && (targetTable.getSourceTableList().size() != 0)
21.114 @@ -151,7 +113,6 @@
21.115 ETLTaskNode xformPredecessor = null;
21.116 List sourceTables = context.getTargetTable().getSourceTableList();
21.117 String dropSQLStr = "";
21.118 - String truncateSql = "";
21.119
21.120 // Loop Thru the source tables to generate
21.121 if (sourceTables == null || sourceTables.isEmpty()) {
21.122 @@ -179,7 +140,7 @@
21.123 // same DB as the target table.
21.124 if (isExtractionRequired(sourceTable, targetTable)) {
21.125 ETLTaskNode extractorTask = createExtractorNode(sourceTable, targetDB, waitTaskId, waitTaskId, getTargetConnName(),
21.126 - getTargetTableUserDefinedSchema(targetTable));
21.127 + targetTable.getSchema().toUpperCase());
21.128
21.129 // Add staging table to the drop list only if user specifies
21.130 // that it is deleteable - otherwise preserve the contents of the
21.131 @@ -194,18 +155,6 @@
21.132 }
21.133 dropSQLStr += dropSQLPartTemp.getSQL();
21.134 }
21.135 - if(sourceTable.isTruncateStagingTable()) {
21.136 - // User has specified the "Staging Table Name" property. Use it and truncate the data.
21.137 - StatementContext trcontext = new StatementContext();
21.138 - trcontext.setUsingTempTableName(sourceTable, true);
21.139 - trcontext.putClientProperty(StatementContext.IF_EXISTS, Boolean.TRUE);
21.140 - SQLPart doTruncate = getTargetStatements().getTruncateStatement(sourceTable, trcontext);
21.141 - if(truncateSql.length() > 0 ) {
21.142 - truncateSql += SQLPart.STATEMENT_SEPARATOR;
21.143 - }
21.144 - truncateSql += doTruncate.getSQL().trim();
21.145 -
21.146 - }
21.147
21.148 context.getPredecessorTask().addNextETLTaskNode(ETLTask.SUCCESS, extractorTask.getId());
21.149 if (dependentTasks.length() > 0) {
21.150 @@ -216,7 +165,7 @@
21.151 StatementContext stmtContext = new StatementContext();
21.152 stmtContext.setUsingFullyQualifiedTablePrefix(false);
21.153 stmtContext.setUsingUniqueTableName(true);
21.154 - final String statsTableName = statsDB.getUnescapedName(statsDB.getEvaluatorFactory().evaluate(targetTable, stmtContext));
21.155 + final String statsTableName = statsDB.getUnescapedName(statsDB.getGeneratorFactory().generate(targetTable, stmtContext));
21.156 extractorTask.setTableName(statsTableName);
21.157 }
21.158 } // end extractor Loop
21.159 @@ -233,11 +182,6 @@
21.160 SQLPart etlSQLPart = dropSQLPart;
21.161 context.getNextTaskOnException().addStatement(etlSQLPart);
21.162 }
21.163 -
21.164 - if(truncateSql != null && truncateSql.trim().length() != 0 ) {
21.165 - SQLPart truncateSQLPart = new SQLPart(truncateSql, SQLPart.STMT_TRUNCATEBEFOREPROCESS, getTargetConnName()); // NOI18N
21.166 - context.getNextTaskOnException().addStatement(truncateSQLPart);
21.167 - }
21.168
21.169 // Set dependent list for predecessor to transform nodes
21.170 xformPredecessor.addNextETLTaskNode(ETLTask.SUCCESS, transformerTask.getId());
21.171 @@ -281,6 +225,7 @@
21.172 this.forceStaging = forceStaging;
21.173 }
21.174
21.175 + @Override
21.176 protected boolean isExtractionRequired(SourceTable sourceTable, TargetTable targetTable) throws BaseException {
21.177 if (forceStaging) {
21.178 return true;
21.179 @@ -294,7 +239,7 @@
21.180 DBConnectionDefinition srcConDef = this.builderModel.getConnectionDefinition(srcTable);
21.181 String srcConnName = srcConDef.getName();
21.182
21.183 - // reset the evaluator for the source table dbType
21.184 + // reset the Generator for the source table dbType
21.185 DB sourceDB = getDBFor(srcConDef);
21.186 final Statements sourceStmts = sourceDB.getStatements();
21.187 final Statements targetStmts = targetDB.getStatements();
21.188 @@ -371,7 +316,7 @@
21.189 private String getExtractorSQL(SourceTable srcTable, DB targetDB, TargetTable tt) throws BaseException {
21.190 StringBuilder buffer = new StringBuilder(50);
21.191
21.192 - // Get the evaluator
21.193 + // Get the Generator
21.194 DBConnectionDefinition srcConDefn = this.builderModel.getConnectionDefinition(srcTable);
21.195 DB sourceDB = getDBFor(srcConDefn);
21.196
22.1 --- a/etl.editor/src/org/netbeans/modules/etl/codegen/impl/ValidatingStrategyBuilderImpl.java Sat Dec 08 10:04:51 2007 +0000
22.2 +++ b/etl.editor/src/org/netbeans/modules/etl/codegen/impl/ValidatingStrategyBuilderImpl.java Sat Dec 08 10:24:35 2007 +0000
22.3 @@ -1,42 +1,20 @@
22.4 /*
22.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
22.6 - *
22.7 - * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
22.8 - *
22.9 - * The contents of this file are subject to the terms of either the GNU
22.10 - * General Public License Version 2 only ("GPL") or the Common
22.11 - * Development and Distribution License("CDDL") (collectively, the
22.12 - * "License"). You may not use this file except in compliance with the
22.13 - * License. You can obtain a copy of the License at
22.14 - * http://www.netbeans.org/cddl-gplv2.html
22.15 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
22.16 - * specific language governing permissions and limitations under the
22.17 - * License. When distributing the software, include this License Header
22.18 - * Notice in each file and include the License file at
22.19 - * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
22.20 - * particular file as subject to the "Classpath" exception as provided
22.21 - * by Sun in the GPL Version 2 section of the License file that
22.22 - * accompanied this code. If applicable, add the following below the
22.23 - * License Header, with the fields enclosed by brackets [] replaced by
22.24 - * your own identifying information:
22.25 + * The contents of this file are subject to the terms of the Common Development
22.26 + * and Distribution License (the License). You may not use this file except in
22.27 + * compliance with the License.
22.28 + *
22.29 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
22.30 + * or http://www.netbeans.org/cddl.txt.
22.31 + *
22.32 + * When distributing Covered Code, include this CDDL Header Notice in each file
22.33 + * and include the License file at http://www.netbeans.org/cddl.txt.
22.34 + * If applicable, add the following below the CDDL Header, with the fields
22.35 + * enclosed by brackets [] replaced by your own identifying information:
22.36 * "Portions Copyrighted [year] [name of copyright owner]"
22.37 - *
22.38 - * Contributor(s):
22.39 - *
22.40 + *
22.41 * The Original Software is NetBeans. The Initial Developer of the Original
22.42 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
22.43 * Microsystems, Inc. All Rights Reserved.
22.44 - *
22.45 - * If you wish your version of this file to be governed by only the CDDL
22.46 - * or only the GPL Version 2, indicate your decision by adding
22.47 - * "[Contributor] elects to include this software in this distribution
22.48 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
22.49 - * single choice of license, a recipient has the option to distribute
22.50 - * your version of this file under either the CDDL, the GPL Version 2 or
22.51 - * to extend the choice of license to its licensees as provided above.
22.52 - * However, if you add GPL Version 2 code and therefore, elected the GPL
22.53 - * Version 2 license, then the option applies only if the new code is
22.54 - * made subject to such option by the copyright holder.
22.55 */
22.56 package org.netbeans.modules.etl.codegen.impl;
22.57
22.58 @@ -45,10 +23,9 @@
22.59
22.60 import org.netbeans.modules.etl.codegen.ETLScriptBuilderModel;
22.61 import org.netbeans.modules.etl.codegen.ETLStrategyBuilderContext;
22.62 -import org.netbeans.modules.model.database.DBConnectionDefinition;
22.63 import org.netbeans.modules.sql.framework.common.jdbc.SQLDBConnectionDefinition;
22.64 import org.netbeans.modules.sql.framework.common.utils.MonitorUtil;
22.65 -import org.netbeans.modules.sql.framework.evaluators.database.StatementContext;
22.66 +import org.netbeans.modules.sql.framework.codegen.StatementContext;
22.67 import org.netbeans.modules.sql.framework.model.SQLDBTable;
22.68 import org.netbeans.modules.sql.framework.model.SQLModelObjectFactory;
22.69 import org.netbeans.modules.sql.framework.model.TargetTable;
22.70 @@ -57,6 +34,7 @@
22.71 import com.sun.etl.engine.ETLTaskNode;
22.72 import com.sun.sql.framework.exception.BaseException;
22.73 import com.sun.sql.framework.jdbc.SQLPart;
22.74 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
22.75
22.76 /**
22.77 * Extends base pipelining strategy builder to override methods which affect conduct and
22.78 @@ -78,6 +56,7 @@
22.79 * @param tt TargetTable instance from which rejected row table information is derived
22.80 * @throws BaseException if error occurs during statement generation
22.81 */
22.82 + @Override
22.83 public void addSelectRejectedRowCountStatement(ETLTaskNode updateStats, TargetTable tt) throws BaseException {
22.84 StatementContext context = new StatementContext();
22.85 context.setUsingFullyQualifiedTablePrefix(false);
22.86 @@ -87,11 +66,12 @@
22.87 SQLPart selectRejectedCountPart = pipelineStmts.getSelectRejectedRowsCountFromDetailsTableStatement(tt);
22.88 selectRejectedCountPart.setConnectionPoolName(ETLScriptBuilderModel.ETL_MONITOR_DB_CONN_DEF_NAME);
22.89
22.90 - String tableName = db.getUnescapedName(db.getEvaluatorFactory().evaluate(tt, context));
22.91 + String tableName = db.getUnescapedName(db.getGeneratorFactory().generate(tt, context));
22.92 selectRejectedCountPart.setTableName(tableName);
22.93 updateStats.addTableSpecificStatement(tableName, selectRejectedCountPart);
22.94 }
22.95
22.96 + @Override
22.97 public String getScriptToDisplay(ETLStrategyBuilderContext context) throws BaseException {
22.98 super.checkTargetConnectionDefinition(context);
22.99
22.100 @@ -115,6 +95,7 @@
22.101 return buffer.toString();
22.102 }
22.103
22.104 + @Override
22.105 protected void buildCleanupStatements(ETLTaskNode cleanupTask, List targetTables) throws BaseException {
22.106 super.buildCleanupStatements(cleanupTask, targetTables);
22.107
22.108 @@ -123,6 +104,7 @@
22.109 cleanupTask.addStatement(shutdownPipeline);
22.110 }
22.111
22.112 + @Override
22.113 protected void buildInitializationStatements(SQLDBTable table, ETLTaskNode initTask, Map connDefToLinkName) throws BaseException {
22.114 super.buildInitializationStatements(table, initTask, connDefToLinkName);
22.115 if (table instanceof TargetTable) {
22.116 @@ -202,6 +184,7 @@
22.117 return clone;
22.118 }
22.119
22.120 + @Override
22.121 protected String getTaskType() {
22.122 return ETLEngine.VALIDATING;
22.123 }
23.1 --- a/etl.editor/src/org/netbeans/modules/etl/model/ETLDefinition.java Sat Dec 08 10:04:51 2007 +0000
23.2 +++ b/etl.editor/src/org/netbeans/modules/etl/model/ETLDefinition.java Sat Dec 08 10:24:35 2007 +0000
23.3 @@ -43,22 +43,22 @@
23.4
23.5 import java.util.Collection;
23.6 import java.util.List;
23.7 -
23.8 -import org.netbeans.modules.model.database.DatabaseModel;
23.9 import org.netbeans.modules.sql.framework.model.RuntimeDatabaseModel;
23.10 import org.netbeans.modules.sql.framework.model.SQLDefinition;
23.11 import org.netbeans.modules.sql.framework.model.SQLObject;
23.12 import org.netbeans.modules.sql.framework.model.SQLObjectListener;
23.13 import org.w3c.dom.Element;
23.14 -
23.15 import com.sun.sql.framework.exception.BaseException;
23.16 -import org.netbeans.modules.sql.framework.model.SourceTable;
23.17 +import org.netbeans.modules.sql.framework.model.DBTable;
23.18 +import org.netbeans.modules.sql.framework.model.DatabaseModel;
23.19 +import org.netbeans.modules.sql.framework.model.SQLDBModel;
23.20 +import org.netbeans.modules.sql.framework.model.ValidationInfo;
23.21
23.22 /**
23.23 * @author Ritesh Adval
23.24 + * @author Ahimanikya Satapathy
23.25 * @version $Revision$
23.26 - *
23.27 - * TODO: Sync with external metadata change.
23.28 + *
23.29 */
23.30 public interface ETLDefinition {
23.31
23.32 @@ -83,14 +83,14 @@
23.33 *
23.34 * @return Collection, possibly empty, of all SQLObjects
23.35 */
23.36 - public Collection getAllObjects();
23.37 + public Collection<SQLObject> getAllObjects();
23.38
23.39 /**
23.40 - * Gets the List of OTDs
23.41 + * Gets the List of Databases
23.42 *
23.43 * @return java.util.List for this
23.44 */
23.45 - public List getAllOTDs();
23.46 + public List<SQLDBModel> getAllDatabases();
23.47
23.48 /**
23.49 * Getter for DatabaseModel
23.50 @@ -99,10 +99,6 @@
23.51 * @return DatabaseModel for given Model Name
23.52 */
23.53 public DatabaseModel getDatabaseModel(String modelName);
23.54 -
23.55 - public DatabaseModel getSourceTable();
23.56 -
23.57 - public DatabaseModel getTargetTable();
23.58
23.59 /**
23.60 * Gets display name.
23.61 @@ -136,14 +132,14 @@
23.62 *
23.63 * @return List, possibly empty, of source DatabaseModels
23.64 */
23.65 - public List getSourceDatabaseModels();
23.66 + public List<SQLDBModel> getSourceDatabaseModels();
23.67
23.68 /**
23.69 * Gets the List of SourceTables
23.70 *
23.71 * @return List, possibly empty, of SourceTables
23.72 */
23.73 - public List getSourceTables();
23.74 + public List<DBTable> getSourceTables();
23.75
23.76 /**
23.77 * get the sql definition
23.78 @@ -157,14 +153,14 @@
23.79 *
23.80 * @return List, possibly empty, of target DatabaseModels
23.81 */
23.82 - public List getTargetDatabaseModels();
23.83 + public List<SQLDBModel> getTargetDatabaseModels();
23.84
23.85 /**
23.86 * Gets the List of TargetTables
23.87 *
23.88 * @return List, possibly empty, of TargetTables
23.89 */
23.90 - public List getTargetTables();
23.91 + public List<DBTable> getTargetTables();
23.92
23.93 /**
23.94 * get the version
23.95 @@ -230,6 +226,5 @@
23.96 *
23.97 * @return Map of invalid input object as keys and reason as value
23.98 */
23.99 - public List validate();
23.100 + public List<ValidationInfo> validate();
23.101 }
23.102 -
24.1 --- a/etl.editor/src/org/netbeans/modules/etl/model/ETLObject.java Sat Dec 08 10:04:51 2007 +0000
24.2 +++ b/etl.editor/src/org/netbeans/modules/etl/model/ETLObject.java Sat Dec 08 10:24:35 2007 +0000
24.3 @@ -11,7 +11,7 @@
24.4
24.5 /**
24.6 *
24.7 - * @author resendes
24.8 + * @author Ahimanikya Satapathy
24.9 */
24.10 public interface ETLObject {
24.11
25.1 --- a/etl.editor/src/org/netbeans/modules/etl/model/impl/ETLDefinitionImpl.java Sat Dec 08 10:04:51 2007 +0000
25.2 +++ b/etl.editor/src/org/netbeans/modules/etl/model/impl/ETLDefinitionImpl.java Sat Dec 08 10:24:35 2007 +0000
25.3 @@ -45,9 +45,7 @@
25.4 import java.util.HashMap;
25.5 import java.util.List;
25.6 import java.util.Map;
25.7 -
25.8 import org.netbeans.modules.etl.model.ETLDefinition;
25.9 -import org.netbeans.modules.model.database.DatabaseModel;
25.10 import org.netbeans.modules.sql.framework.common.utils.TagParserUtility;
25.11 import org.netbeans.modules.sql.framework.model.RuntimeDatabaseModel;
25.12 import org.netbeans.modules.sql.framework.model.SQLConstants;
25.13 @@ -56,41 +54,37 @@
25.14 import org.netbeans.modules.sql.framework.model.SQLModelObjectFactory;
25.15 import org.netbeans.modules.sql.framework.model.SQLObject;
25.16 import org.netbeans.modules.sql.framework.model.SQLObjectListener;
25.17 -import org.netbeans.modules.sql.framework.model.SourceTable;
25.18 import org.w3c.dom.Element;
25.19 import org.w3c.dom.NodeList;
25.20 -
25.21 import com.sun.sql.framework.exception.BaseException;
25.22 import com.sun.sql.framework.utils.Attribute;
25.23 +import org.netbeans.modules.sql.framework.model.DBTable;
25.24 +import org.netbeans.modules.sql.framework.model.DatabaseModel;
25.25 +import org.netbeans.modules.sql.framework.model.SQLDBModel;
25.26 +import org.netbeans.modules.sql.framework.model.ValidationInfo;
25.27
25.28 /**
25.29 * Root container for holding ETL model objects.
25.30 *
25.31 * @author Jonathan Giron
25.32 * @author Ritesh Adval
25.33 + * @author Ahimanikya Satapathy
25.34 * @version $Revision$
25.35 */
25.36 public class ETLDefinitionImpl implements ETLDefinition, Serializable {
25.37
25.38 /** Attribute name: displayName */
25.39 public static final String ATTR_DISPLAYNAME = "displayName";
25.40 -
25.41 /** Attribute name: displayName */
25.42 public static final String ATTR_REFID = "refId";
25.43 -
25.44 /** Document version */
25.45 - public static final String DOC_VERSION = "6.0";
25.46 -
25.47 + public static final String DOC_VERSION = "5.2";
25.48 /** XML formatting constant: indent prefix */
25.49 public static final String INDENT = " ";
25.50 -
25.51 /** TAG_DEFINITION is the tag for an ETL definition */
25.52 public static final String TAG_DEFINITION = "etlDefinition";
25.53 -
25.54 private static final String ATTR_VERSION = "version";
25.55 -
25.56 - private Map attributes = new HashMap();
25.57 -
25.58 + private Map<String, Attribute> attributes = new HashMap<String, Attribute>();
25.59 private SQLDefinition sqlDefinition;
25.60
25.61 /**
25.62 @@ -113,7 +107,7 @@
25.63 public ETLDefinitionImpl(Element xmlElement, SQLFrameworkParentObject parent) throws BaseException {
25.64 this(xmlElement, parent, false);
25.65 }
25.66 -
25.67 +
25.68 /**
25.69 * Creates a new instance of ETLDefinitionImpl, parsing the given DOM Element to
25.70 * retrieve its contents, and optionally preserving the parsed version information.
25.71 @@ -129,7 +123,6 @@
25.72 init();
25.73 sqlDefinition.setSQLFrameworkParentObject(parent);
25.74 parseXML(xmlElement); // parseXML checks for old version
25.75 -
25.76 if (!preserveVersion) {
25.77 this.setVersion(DOC_VERSION); // after parsing set the version
25.78 }
25.79 @@ -171,17 +164,17 @@
25.80 *
25.81 * @return Collection, possibly empty, of all SQLObjects
25.82 */
25.83 - public Collection getAllObjects() {
25.84 + public Collection<SQLObject> getAllObjects() {
25.85 return this.sqlDefinition.getAllObjects();
25.86 }
25.87
25.88 /**
25.89 - * Gets the List of OTDs
25.90 + * Gets the List of Databases
25.91 *
25.92 * @return java.util.List for this
25.93 */
25.94 - public List getAllOTDs() {
25.95 - return this.sqlDefinition.getAllOTDs();
25.96 + public List<SQLDBModel> getAllDatabases() {
25.97 + return this.sqlDefinition.getAllDatabases();
25.98 }
25.99
25.100 /**
25.101 @@ -191,13 +184,13 @@
25.102 * @return Attribute instance associated with attrName, or null if none exists
25.103 */
25.104 public Attribute getAttribute(String attrName) {
25.105 - return (Attribute) attributes.get(attrName);
25.106 + return attributes.get(attrName);
25.107 }
25.108
25.109 /**
25.110 * @see SQLObject#getAttributeNames
25.111 */
25.112 - public Collection getAttributeNames() {
25.113 + public Collection<String> getAttributeNames() {
25.114 return attributes.keySet();
25.115 }
25.116
25.117 @@ -216,7 +209,7 @@
25.118 * @return DatabaseModel for given Model Name
25.119 */
25.120 public DatabaseModel getDatabaseModel(String modelName) {
25.121 - java.util.List list = sqlDefinition.getAllOTDs();
25.122 + java.util.List list = sqlDefinition.getAllDatabases();
25.123 java.util.Iterator it = list.iterator();
25.124 while (it.hasNext()) {
25.125 SQLObject sqlObj = (SQLObject) it.next();
25.126 @@ -246,7 +239,7 @@
25.127 */
25.128 public Integer getExecutionStrategyCode() {
25.129 return this.sqlDefinition.getExecutionStrategyCode();
25.130 - }
25.131 + }
25.132
25.133 /**
25.134 * get the parent repository object
25.135 @@ -271,7 +264,7 @@
25.136 *
25.137 * @return List, possibly empty, of source DatabaseModels
25.138 */
25.139 - public List getSourceDatabaseModels() {
25.140 + public List<SQLDBModel> getSourceDatabaseModels() {
25.141 return this.sqlDefinition.getSourceDatabaseModels();
25.142 }
25.143
25.144 @@ -280,7 +273,7 @@
25.145 *
25.146 * @return List, possibly empty, of SourceTables
25.147 */
25.148 - public List getSourceTables() {
25.149 + public List<DBTable> getSourceTables() {
25.150 return this.sqlDefinition.getSourceTables();
25.151 }
25.152
25.153 @@ -308,7 +301,7 @@
25.154 *
25.155 * @return List, possibly empty, of target DatabaseModels
25.156 */
25.157 - public List getTargetDatabaseModels() {
25.158 + public List<SQLDBModel> getTargetDatabaseModels() {
25.159 return this.sqlDefinition.getTargetDatabaseModels();
25.160 }
25.161
25.162 @@ -317,7 +310,7 @@
25.163 *
25.164 * @return List, possibly empty, of TargetTables
25.165 */
25.166 - public List getTargetTables() {
25.167 + public List<DBTable> getTargetTables() {
25.168 return this.sqlDefinition.getTargetTables();
25.169 }
25.170
25.171 @@ -413,7 +406,7 @@
25.172 public void setExecutionStrategyCode(Integer code) {
25.173 sqlDefinition.setExecutionStrategyCode(code);
25.174 }
25.175 -
25.176 +
25.177 /**
25.178 * set the parent repository object
25.179 *
25.180 @@ -460,16 +453,16 @@
25.181 * validate the definition starting from the target tables.
25.182 * @return Map of invalid input object as keys and reason as value
25.183 */
25.184 - public List validate() {
25.185 + public List<ValidationInfo> validate() {
25.186 return this.sqlDefinition.validate();
25.187 }
25.188
25.189 /**
25.190 - * Applies whatever rules are appropriate to migrate the current object model to the
25.191 + * Applies whatever rules are appropriate to migrate the current object model to the
25.192 * current version of ETLDefinition as implemented by the concrete class.
25.193 - *
25.194 + *
25.195 * @throws BaseException if error occurs during migration
25.196 - */
25.197 + */
25.198 public void migrateFromOlderVersions() throws BaseException {
25.199 sqlDefinition.migrateFromOlderVersions();
25.200 }
25.201 @@ -477,38 +470,4 @@
25.202 protected void init() {
25.203 sqlDefinition = SQLModelObjectFactory.getInstance().createSQLDefinition();
25.204 }
25.205 -
25.206 - public DatabaseModel getSourceTable() {
25.207 - java.util.List list = sqlDefinition.getAllOTDs();
25.208 - java.util.Iterator it = list.iterator();
25.209 - while (it.hasNext()) {
25.210 - SQLObject sqlObj = (SQLObject) it.next();
25.211 - int type = sqlObj.getObjectType();
25.212 - if (type == SQLConstants.SOURCE_DBMODEL) {
25.213 - DatabaseModel dbModel = (DatabaseModel) sqlObj;
25.214 - if (dbModel != null) {
25.215 - return (DatabaseModel) dbModel;
25.216 - }
25.217 - }
25.218 - }
25.219 - return null;
25.220 - }
25.221 -
25.222 - public DatabaseModel getTargetTable() {
25.223 - java.util.List list = sqlDefinition.getAllOTDs();
25.224 - java.util.Iterator it = list.iterator();
25.225 - while (it.hasNext()) {
25.226 - SQLObject sqlObj = (SQLObject) it.next();
25.227 - int type = sqlObj.getObjectType();
25.228 - if (type == SQLConstants.TARGET_DBMODEL) {
25.229 - DatabaseModel dbModel = (DatabaseModel) sqlObj;
25.230 - if (dbModel != null) {
25.231 - return (DatabaseModel) dbModel;
25.232 - }
25.233 - }
25.234 - }
25.235 - return null;
25.236 - }
25.237 -
25.238 }
25.239 -
26.1 --- a/etl.editor/src/org/netbeans/modules/etl/model/impl/ETLObjectImpl.java Sat Dec 08 10:04:51 2007 +0000
26.2 +++ b/etl.editor/src/org/netbeans/modules/etl/model/impl/ETLObjectImpl.java Sat Dec 08 10:24:35 2007 +0000
26.3 @@ -41,24 +41,23 @@
26.4 package org.netbeans.modules.etl.model.impl;
26.5
26.6 import java.util.UUID;
26.7 -
26.8 import org.netbeans.modules.etl.model.ETLObject;
26.9
26.10
26.11 /**
26.12 * This class implements ETLObject implements some base functionalies
26.13 - *
26.14 - * @author Sudhendra Seshachala
26.15 + *
26.16 + * @author Ahimanikya Satapathy
26.17 * @version $Revision$
26.18 */
26.19 public class ETLObjectImpl implements ETLObject {
26.20 -
26.21 - private String name;
26.22 - private String id;
26.23 -
26.24 - /**
26.25 +
26.26 + private String name;
26.27 + private String id;
26.28 +
26.29 + /**
26.30 * Constructs an instance.
26.31 - *
26.32 + *
26.33 * @param name the name
26.34 */
26.35 public ETLObjectImpl(String name) {
26.36 @@ -67,30 +66,30 @@
26.37
26.38 /**
26.39 * Constructs an instance.
26.40 - *
26.41 + *
26.42 * @param id id
26.43 * @param name name
26.44 */
26.45 - public ETLObjectImpl(String id, String name) {
26.46 + public ETLObjectImpl(String id, String name) {
26.47 if (null != name) {
26.48 setName(name);
26.49 }
26.50
26.51 if ((null == id) || (id.trim().length() == 0)) {
26.52 - id = ( "{" + UUID.randomUUID().toString() + "}");
26.53 + id = ("{" + UUID.randomUUID().toString() + "}");
26.54 } else {
26.55 setOID(id);
26.56 }
26.57 -
26.58 }
26.59
26.60 /**
26.61 * Overrides default implementation to correctly compare ETLObjectImpl instances.
26.62 - *
26.63 + *
26.64 * @param obj Object to be compared
26.65 * @return true if objects are functionally identical, as defined in the method; false
26.66 * otherwise
26.67 */
26.68 + @Override
26.69 public boolean equals(Object obj) {
26.70 if (obj == null) {
26.71 return false;
26.72 @@ -108,28 +107,28 @@
26.73 if (null != getName()) {
26.74 return getName().equals(that.getName());
26.75 }
26.76 -
26.77 +
26.78 return false;
26.79 }
26.80
26.81 -
26.82 /**
26.83 * @see org.netbeans.modules.etl.model.ETLObject#getName
26.84 */
26.85 - public String getName() {
26.86 + public String getName() {
26.87 return this.name;
26.88 }
26.89
26.90 /**
26.91 * @see org.netbeans.modules.etl.model.ETLObject#getOID
26.92 */
26.93 - public String getObjectId() {
26.94 + public String getObjectId() {
26.95 return this.id;
26.96 }
26.97
26.98 - /**
26.99 + /**
26.100 * @see java.lang.Object#hashCode
26.101 */
26.102 + @Override
26.103 public int hashCode() {
26.104 return super.hashCode();
26.105 }
26.106 @@ -137,23 +136,22 @@
26.107 /**
26.108 * @see org.netbeans.modules.etl.model.ETLObject#setName
26.109 */
26.110 - public void setName(String value) {
26.111 + public void setName(String value) {
26.112 this.name = value;
26.113 }
26.114
26.115 /**
26.116 * @see org.netbeans.modules.etl.model.ETLObject#setOID
26.117 */
26.118 - public void setOID(String value) {
26.119 + public void setOID(String value) {
26.120 this.id = value;
26.121 }
26.122
26.123 /**
26.124 * @return a string
26.125 */
26.126 + @Override
26.127 public String toString() {
26.128 return this.name;
26.129 }
26.130 -
26.131 }
26.132 -
27.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/DataObjectHelper.java Sat Dec 08 10:04:51 2007 +0000
27.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/DataObjectHelper.java Sat Dec 08 10:24:35 2007 +0000
27.3 @@ -21,7 +21,6 @@
27.4 import javax.swing.JPanel;
27.5 import javax.swing.SwingUtilities;
27.6
27.7 -import org.netbeans.modules.etl.model.impl.ETLDefinitionImpl;
27.8 import org.netbeans.modules.etl.ui.model.impl.ETLCollaborationModel;
27.9 import org.netbeans.modules.etl.ui.view.ETLCollaborationTopComponent;
27.10 import org.netbeans.modules.etl.ui.view.property.ETLResourceManager;
27.11 @@ -47,7 +46,7 @@
27.12 import org.openide.windows.WindowManager;
27.13
27.14 import com.sun.sql.framework.exception.BaseException;
27.15 -import org.netbeans.modules.sql.framework.ui.graph.IGraphView;
27.16 +import java.io.IOException;
27.17
27.18 /**
27.19 *
27.20 @@ -59,8 +58,6 @@
27.21
27.22 private static PropertyViewManager pvMgr;
27.23
27.24 - private static DataObjectHelper manager;
27.25 -
27.26 /** Creates a new instance of DataObjectHelper */
27.27 public DataObjectHelper(ETLDataObject dataObject) {
27.28 mDataObject = dataObject;
27.29 @@ -75,15 +72,14 @@
27.30 mDataObject = mObj;
27.31 ETLWizardHelper wHelper = new ETLWizardHelper(descriptor);
27.32
27.33 - List sourceOTDList = wHelper.getSelectedSourceOtds();
27.34 - List destinationOTDList = wHelper.getSelectedDestinationOtds();
27.35 + List sourceDbList = wHelper.getSelectedSourceDb();
27.36 + List destinationDbList = wHelper.getSelectedDestinationDb();
27.37 SQLJoinView joinView = wHelper.getSQLJoinView();
27.38 List jVisibleColumns = wHelper.getTableColumnNodes();
27.39 - ETLDefinitionImpl repModel = (ETLDefinitionImpl) mObj.getETLDefinition();
27.40
27.41 // for now we need to have an editor top component so that table can be added to
27.42 // it
27.43 - final ETLCollaborationTopComponent etlEditor = this.mDataObject.getETLEditorTC();
27.44 + final ETLCollaborationTopComponent etlEditor = mDataObject.getETLEditorTC();
27.45 ETLCollaborationModel collabModel = mObj.getModel();
27.46
27.47 // first add join view
27.48 @@ -95,12 +91,12 @@
27.49 establishRuntimeInputs(collabModel, joinView.getSourceTables());
27.50 }
27.51
27.52 - if (sourceOTDList != null) {
27.53 - addDestinationOTDs(sourceOTDList, collabModel);
27.54 + if (sourceDbList != null) {
27.55 + addDestinationDb(sourceDbList, collabModel);
27.56 }
27.57
27.58 - if (destinationOTDList != null) {
27.59 - addDestinationOTDs(destinationOTDList, collabModel);
27.60 + if (destinationDbList != null) {
27.61 + addDestinationDb(destinationDbList, collabModel);
27.62 }
27.63 establishRuntimeOutputs(mObj);
27.64 //make sure editor document has etl content when first time created
27.65 @@ -110,41 +106,14 @@
27.66 editorSupport.getDocument().remove(0, editorSupport.getDocument().getLength());
27.67 editorSupport.getDocument().insertString(0, content, null);
27.68 } catch(Exception ex) {
27.69 - ErrorManager.getDefault().notify(ex);
27.70 + //ErrorManager.getDefault().notify(ex);
27.71 }
27.72 }
27.73
27.74 - public void initializeETLDataObject(WizardDescriptor descriptor, ETLCollaborationModel collabModel, IGraphView graphView) throws Exception {
27.75 - ETLWizardHelper wHelper = new ETLWizardHelper(descriptor);
27.76 -
27.77 - List sourceOTDList = wHelper.getSelectedSourceOtds();
27.78 - List destinationOTDList = wHelper.getSelectedDestinationOtds();
27.79 - SQLJoinView joinView = wHelper.getSQLJoinView();
27.80 - List jVisibleColumns = wHelper.getTableColumnNodes();
27.81 -
27.82 - // first add join view
27.83 - if (joinView != null) {
27.84 - JoinUtility.handleNewJoinCreation(joinView, jVisibleColumns, graphView);
27.85 -
27.86 - // WT #67643: Ensure that flatfile tables in join views have filename runtime
27.87 - // inputs.
27.88 - establishRuntimeInputs(collabModel, joinView.getSourceTables());
27.89 - }
27.90 -
27.91 - if (sourceOTDList != null) {
27.92 - addDestinationOTDs(sourceOTDList, collabModel);
27.93 - }
27.94 -
27.95 - if (destinationOTDList != null) {
27.96 - addDestinationOTDs(destinationOTDList, collabModel);
27.97 - }
27.98 - establishRuntimeOutputs(collabModel.getSQLDefinition());
27.99 - }
27.100 -
27.101 - private static void addDestinationOTDs(List otds, ETLCollaborationModel collabModel)
27.102 + private static void addDestinationDb(List db, ETLCollaborationModel collabModel)
27.103 throws BaseException {
27.104 - for (int i = 0; i < otds.size(); i++) {
27.105 - SQLDBModel dbModel = (SQLDBModel) otds.get(i);
27.106 + for (int i = 0; i < db.size(); i++) {
27.107 + SQLDBModel dbModel = (SQLDBModel) db.get(i);
27.108
27.109 // Add database model only if at least one table in it was selected by user
27.110 if (dbModel.getTables().size() == 0) {
27.111 @@ -192,23 +161,23 @@
27.112 *
27.113 * @param dObj etldataobject(representing an eTL Collaboration) whose table
27.114 * selections are to be updated
27.115 - * @param sourceOtds List of source table OTDs to be added to <code>element</code>
27.116 - * @param targetOtds List of target table OTDs to be added to <code>element</code>
27.117 + * @param sourcedb List of source table Databases to be added to <code>element</code>
27.118 + * @param targetdb List of target table Databases to be added to <code>element</code>
27.119 * @throws Exception if error occurs during update
27.120 */
27.121 - public void updateTableSelections(ETLDataObject dObj, List sourceOtds, List targetOtds) throws Exception {
27.122 + public void updateTableSelections(ETLDataObject dObj, List sourceDb, List targetDb) throws Exception {
27.123 ETLCollaborationModel collabModel = null;
27.124 collabModel = dObj.getModel();
27.125 if (collabModel == null) {
27.126 return;
27.127 }
27.128
27.129 - if (sourceOtds != null) {
27.130 - addDestinationOTDs(sourceOtds, collabModel);
27.131 + if (sourceDb != null) {
27.132 + addDestinationDb(sourceDb, collabModel);
27.133 }
27.134
27.135 - if (targetOtds != null) {
27.136 - addDestinationOTDs(targetOtds, collabModel);
27.137 + if (targetDb != null) {
27.138 + addDestinationDb(targetDb, collabModel);
27.139 }
27.140 }
27.141
27.142 @@ -218,9 +187,20 @@
27.143 * @return instance of PropertyViewManager
27.144 */
27.145 public static PropertyViewManager getPropertyViewManager() {
27.146 + InputStream stream = null;
27.147 if (pvMgr == null) {
27.148 - InputStream stream = DataObjectHelper.class.getClassLoader().getResourceAsStream("org/netbeans/modules/etl/ui/resources/etl_properties.xml");
27.149 - pvMgr = new PropertyViewManager(stream, new ETLResourceManager());
27.150 + try {
27.151 + stream = DataObjectHelper.class.getClassLoader().getResourceAsStream("org/netbeans/modules/etl/ui/resources/etl_properties.xml");
27.152 + pvMgr = new PropertyViewManager(stream, new ETLResourceManager());
27.153 + } finally {
27.154 + if (stream != null) {
27.155 + try {
27.156 + stream.close();
27.157 + } catch (IOException ignore) {
27.158 + // ignore
27.159 + }
27.160 + }
27.161 + }
27.162 }
27.163 return pvMgr;
27.164 }
28.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/DataObjectProvider.java Sat Dec 08 10:04:51 2007 +0000
28.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/DataObjectProvider.java Sat Dec 08 10:24:35 2007 +0000
28.3 @@ -1,11 +1,11 @@
28.4 /*
28.5 * Sun Public License Notice
28.6 - *
28.7 + *
28.8 * The contents of this file are subject to the Sun Public License
28.9 * Version 1.0 (the "License"). You may not use this file except in
28.10 * compliance with the License. A copy of the License is available at
28.11 * http://www.sun.com/
28.12 - *
28.13 + *
28.14 * The Original Code is NetBeans. The Initial Developer of the Original
28.15 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
28.16 * Microsystems, Inc. All Rights Reserved.
28.17 @@ -46,12 +46,12 @@
28.18 * @author ks161616
28.19 */
28.20 public class DataObjectProvider {
28.21 -
28.22 +
28.23 /* singleton instance of the top component provider */
28.24 private static DataObjectProvider instance;
28.25 -
28.26 +
28.27 public static ETLDataObject activeDataObject;
28.28 -
28.29 +
28.30 /**
28.31 * Creates a new instance of DataObjectProvider
28.32 */
29.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLDataLoader.java Sat Dec 08 10:04:51 2007 +0000
29.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLDataLoader.java Sat Dec 08 10:24:35 2007 +0000
29.3 @@ -1,15 +1,14 @@
29.4 /*
29.5 * Sun Public License Notice
29.6 - *
29.7 + *
29.8 * The contents of this file are subject to the Sun Public License
29.9 * Version 1.0 (the "License"). You may not use this file except in
29.10 * compliance with the License. A copy of the License is available at
29.11 * http://www.sun.com/
29.12 - *
29.13 + *
29.14 * The Original Code is NetBeans. The Initial Developer of the Original
29.15 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
29.16 * Microsystems, Inc. All Rights Reserved.
29.17 -
29.18 If you wish your version of this file to be governed by only the CDDL
29.19 or only the GPL Version 2, indicate your decision by adding
29.20 "[Contributor] elects to include this software in this distribution
29.21 @@ -76,7 +75,7 @@
29.22 private static final long serialVersionUID = -4579746482156152493L;
29.23
29.24 public ETLDataLoader() {
29.25 - super("org.netbeans.modules.etl.ui.ETLDataObject");// Fix for IllegalStateException when loading netbeans
29.26 + super("org.netbeans.modules.etl.ui.ETLDataObject");// Fix for IllegalStateException when loading netbeans
29.27 //super("org.netbeans.modules.etl.ETLDataObject");
29.28 }
29.29
30.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLDataLoaderBeanInfo.java Sat Dec 08 10:04:51 2007 +0000
30.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLDataLoaderBeanInfo.java Sat Dec 08 10:24:35 2007 +0000
30.3 @@ -1,11 +1,11 @@
30.4 /*
30.5 * Sun Public License Notice
30.6 - *
30.7 + *
30.8 * The contents of this file are subject to the Sun Public License
30.9 * Version 1.0 (the "License"). You may not use this file except in
30.10 * compliance with the License. A copy of the License is available at
30.11 * http://www.sun.com/
30.12 - *
30.13 + *
30.14 * The Original Code is NetBeans. The Initial Developer of the Original
30.15 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
30.16 * Microsystems, Inc. All Rights Reserved.
30.17 @@ -52,8 +52,8 @@
30.18 */
30.19 public class ETLDataLoaderBeanInfo extends SimpleBeanInfo {
30.20
30.21 -
30.22 -
30.23 +
30.24 +
30.25 /**
30.26 * copied from Ant Module
30.27 */
31.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLDataObject.java Sat Dec 08 10:04:51 2007 +0000
31.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLDataObject.java Sat Dec 08 10:24:35 2007 +0000
31.3 @@ -9,7 +9,6 @@
31.4 * The Original Code is NetBeans. The Initial Developer of the Original
31.5 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
31.6 * Microsystems, Inc. All Rights Reserved.
31.7 -
31.8 If you wish your version of this file to be governed by only the CDDL
31.9 or only the GPL Version 2, indicate your decision by adding
31.10 "[Contributor] elects to include this software in this distribution
31.11 @@ -20,7 +19,6 @@
31.12 However, if you add GPL Version 2 code and therefore, elected the GPL
31.13 Version 2 license, then the option applies only if the new code is
31.14 made subject to such option by the copyright holder.
31.15 -
31.16 If you wish your version of this file to be governed by only the CDDL
31.17 or only the GPL Version 2, indicate your decision by adding
31.18 "[Contributor] elects to include this software in this distribution
31.19 @@ -32,7 +30,6 @@
31.20 Version 2 license, then the option applies only if the new code is
31.21 made subject to such option by the copyright holder.
31.22 */
31.23 -
31.24 package org.netbeans.modules.etl.ui;
31.25
31.26 import java.io.IOException;
31.27 @@ -42,7 +39,6 @@
31.28 import java.util.concurrent.atomic.AtomicReference;
31.29
31.30 import org.openide.util.Lookup;
31.31 -import org.openide.util.lookup.InstanceContent;
31.32 import org.openide.util.lookup.Lookups;
31.33 import org.openide.util.lookup.ProxyLookup;
31.34 import org.netbeans.modules.etl.model.ETLDefinition;
31.35 @@ -65,7 +61,6 @@
31.36 import org.xml.sax.InputSource;
31.37
31.38 import com.sun.org.apache.xerces.internal.util.XMLChar;
31.39 -import org.netbeans.modules.etl.ui.view.ETLEditorTopView;
31.40
31.41 /**
31.42 * Represents a ETL file.
31.43 @@ -73,85 +68,90 @@
31.44 * @author radval
31.45 */
31.46 public class ETLDataObject extends MultiDataObject {
31.47 -
31.48 +
31.49 public ETLDataObject(FileObject fObj, MultiFileLoader loader)
31.50 - throws DataObjectExistsException {
31.51 + throws DataObjectExistsException {
31.52 super(fObj, loader);
31.53 CookieSet set = getCookieSet();
31.54 -
31.55 +
31.56 editorSupport = new ETLEditorSupport(this);
31.57 // editor support defines MIME type understood by EditorKits registry
31.58 set.add(editorSupport);
31.59 -
31.60 +
31.61 // Add check and validate cookies
31.62 InputSource is = DataObjectAdapters.inputSource(this);
31.63 set.add(new CheckXMLSupport(is));
31.64 try {
31.65 mModel = new ETLCollaborationModel(this);
31.66 - } catch(Exception ex) {
31.67 + } catch (Exception ex) {
31.68 ErrorManager.getDefault().notify(ex);
31.69 }
31.70 - // add validate action here
31.71 + // add validate action here
31.72 }
31.73 -
31.74 +
31.75 + @Override
31.76 protected Node createNodeDelegate() {
31.77 - if(this.mNode == null) {
31.78 + if (this.mNode == null) {
31.79 this.mNode = new ETLNode(this);
31.80 }
31.81 return this.mNode;
31.82 }
31.83 -
31.84 +
31.85 /**
31.86 * subclasses should look updateServices() and additionalInitialLookup()
31.87 */
31.88 + @Override
31.89 public final Lookup getLookup() {
31.90 if (myLookup.get() == null) {
31.91 -
31.92 +
31.93 Lookup lookup;
31.94 List<Lookup> list = new LinkedList<Lookup>();
31.95 -
31.96 - list.add(Lookups.fixed( new Object[]{this}));
31.97 +
31.98 + list.add(Lookups.fixed(new Object[]{this}));
31.99 lookup = new ProxyLookup(list.toArray(new Lookup[list.size()]));
31.100 myLookup.compareAndSet(null, lookup);
31.101 - isLookupInit.compareAndSet( false, true );
31.102 + isLookupInit.compareAndSet(false, true);
31.103 }
31.104 return myLookup.get();
31.105 }
31.106 -
31.107 +
31.108 + @Override
31.109 public HelpCtx getHelpCtx() {
31.110 return HelpCtx.DEFAULT_HELP;
31.111 - // If you add context help, change to:
31.112 - // return new HelpCtx (MyDataObject.class);
31.113 + // If you add context help, change to:
31.114 + // return new HelpCtx (MyDataObject.class);
31.115 }
31.116 -
31.117 +
31.118 @Override
31.119 protected FileObject handleRename(String name) throws IOException {
31.120 ETLEditorSupport weSupport = getETLEditorSupport();
31.121 String oldName = this.getName();
31.122 weSupport.updateTitles();
31.123 //Do we need to change the name attribute of the ETL def?
31.124 -
31.125 +
31.126 //logic to keep the status of the save badge (*) intact.
31.127 boolean modified = weSupport.getEnv().isModified();
31.128 if (modified) {
31.129 weSupport.getEnv().unmarkModified();
31.130 }
31.131 - FileObject fo = super.handleRename(name);
31.132 + FileObject fo = super.handleRename(name);
31.133 if (modified) {
31.134 weSupport.getEnv().markModified();
31.135 }
31.136 firePropertyChange(DataObject.PROP_NAME, oldName, name);
31.137 return fo;
31.138 }
31.139 -
31.140 +
31.141 + @Override
31.142 protected void handleDelete() throws IOException {
31.143 //this is work around when file is modified in editor and
31.144 //editor has lock
31.145 getETLEditorSupport().getEnv().unmarkModified();
31.146 -
31.147 +
31.148 super.handleDelete();
31.149 }
31.150 -
31.151 +
31.152 + @Override
31.153 protected DataObject handleCreateFromTemplate(DataFolder df, String name) throws IOException {
31.154 ETLDataObject dataObject = (ETLDataObject) super.handleCreateFromTemplate(df, name);
31.155 String doName = dataObject.getName();
31.156 @@ -159,14 +159,14 @@
31.157 if (!XMLChar.isValidNmtoken(doName)) {
31.158 return dataObject;
31.159 }
31.160 -
31.161 +
31.162 SaveCookie sCookie = (SaveCookie) dataObject.getCookie(SaveCookie.class);
31.163 - if(sCookie != null) {
31.164 + if (sCookie != null) {
31.165 sCookie.save();
31.166 }
31.167 return dataObject;
31.168 }
31.169 -
31.170 +
31.171 public void initialize(WizardDescriptor descriptor) {
31.172 try {
31.173 DataObjectHelper dHelper = new DataObjectHelper(this);
31.174 @@ -174,11 +174,11 @@
31.175 // the first time data object is created, it cannot be got through lookup.
31.176 // find a better way to do this.
31.177 DataObjectProvider.activeDataObject = this;
31.178 - } catch(Exception ex) {
31.179 + } catch (Exception ex) {
31.180 ErrorManager.getDefault().notify(ex);
31.181 }
31.182 }
31.183 -
31.184 +
31.185 @Override
31.186 public void setModified(boolean modified) {
31.187 super.setModified(modified);
31.188 @@ -188,62 +188,51 @@
31.189 getCookieSet().remove(getSaveCookie());
31.190 }
31.191 }
31.192 -
31.193 +
31.194 private SaveCookie getSaveCookie() {
31.195 return new SaveCookie() {
31.196 +
31.197 public void save() throws IOException {
31.198 getETLEditorSupport().synchDocument();
31.199 getETLEditorSupport().saveDocument();
31.200 }
31.201 -
31.202 +
31.203 @Override
31.204 public int hashCode() {
31.205 return getClass().hashCode();
31.206 }
31.207 -
31.208 +
31.209 @Override
31.210 public boolean equals(Object other) {
31.211 return getClass().equals(other.getClass());
31.212 }
31.213 };
31.214 }
31.215 -
31.216 - public ETLEditorTopView getEditorView() {
31.217 - if(this.view == null) {
31.218 - view = new ETLEditorTopView(getModel());
31.219 - }
31.220 - return this.view;
31.221 - }
31.222 -
31.223 +
31.224 public ETLEditorSupport getETLEditorSupport() {
31.225 return editorSupport;
31.226 }
31.227 -
31.228 +
31.229 public ETLDefinition getETLDefinition() throws Exception {
31.230 return this.mModel.getETLDefinition();
31.231 }
31.232 -
31.233 +
31.234 public ETLCollaborationModel getModel() {
31.235 return this.mModel;
31.236 }
31.237 -
31.238 +
31.239 public ETLCollaborationTopComponent getETLEditorTC() throws Exception {
31.240 - if(this.mTC == null) {
31.241 + if (this.mTC == null) {
31.242 this.mTC = new ETLCollaborationTopComponent(this);
31.243 }
31.244 return this.mTC;
31.245 }
31.246 -
31.247 private static final long serialVersionUID = 6338889116068357651L;
31.248 private transient ETLEditorSupport editorSupport;
31.249 - private ETLEditorTopView view;
31.250 private transient ETLCollaborationTopComponent mTC;
31.251 private transient ETLCollaborationModel mModel;
31.252 - private transient AtomicReference<Lookup> myLookup =
31.253 - new AtomicReference<Lookup>();
31.254 - private transient AtomicReference<InstanceContent> myServices =
31.255 - new AtomicReference<InstanceContent>();
31.256 - private transient AtomicBoolean isLookupInit = new AtomicBoolean(false);
31.257 + private transient AtomicReference<Lookup> myLookup = new AtomicReference<Lookup>();
31.258 + private transient AtomicBoolean isLookupInit = new AtomicBoolean(false);
31.259 private Node mNode = null;
31.260 public static final String ETL_ICON = "org/netbeans/modules/etl/ui/resources/images/ETLDefinition.png";
31.261 }
32.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLEditorSupport.java Sat Dec 08 10:04:51 2007 +0000
32.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLEditorSupport.java Sat Dec 08 10:24:35 2007 +0000
32.3 @@ -9,7 +9,6 @@
32.4 * The Original Code is NetBeans. The Initial Developer of the Original
32.5 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
32.6 * Microsystems, Inc. All Rights Reserved.
32.7 -
32.8 If you wish your version of this file to be governed by only the CDDL
32.9 or only the GPL Version 2, indicate your decision by adding
32.10 "[Contributor] elects to include this software in this distribution
32.11 @@ -20,7 +19,6 @@
32.12 However, if you add GPL Version 2 code and therefore, elected the GPL
32.13 Version 2 license, then the option applies only if the new code is
32.14 made subject to such option by the copyright holder.
32.15 -
32.16 If you wish your version of this file to be governed by only the CDDL
32.17 or only the GPL Version 2, indicate your decision by adding
32.18 "[Contributor] elects to include this software in this distribution
32.19 @@ -32,24 +30,14 @@
32.20 Version 2 license, then the option applies only if the new code is
32.21 made subject to such option by the copyright holder.
32.22 */
32.23 -
32.24 -/*
32.25 - * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
32.26 - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
32.27 - *
32.28 - * $Id$
32.29 - */
32.30 -
32.31 package org.netbeans.modules.etl.ui;
32.32
32.33 import java.awt.EventQueue;
32.34 import java.io.IOException;
32.35 import java.io.Serializable;
32.36 import java.util.Enumeration;
32.37 -
32.38 import javax.swing.SwingUtilities;
32.39 import javax.swing.text.Document;
32.40 -
32.41 import org.netbeans.core.api.multiview.MultiViewHandler;
32.42 import org.netbeans.core.api.multiview.MultiViewPerspective;
32.43 import org.netbeans.core.api.multiview.MultiViews;
32.44 @@ -77,59 +65,36 @@
32.45 import org.openide.windows.Mode;
32.46 import org.openide.windows.TopComponent;
32.47 import org.openide.windows.WindowManager;
32.48 -
32.49 import com.sun.sql.framework.exception.BaseException;
32.50
32.51 -
32.52 -
32.53 /**
32.54 *
32.55 - * @author Jeri Lockhart
32.56 - * @author Todd Fast, todd.fast@sun.com
32.57 + * @author Ahimanikya Satapathy
32.58 */
32.59 -public class ETLEditorSupport extends DataEditorSupport
32.60 -implements OpenCookie, EditCookie,
32.61 - EditorCookie.Observable, LineCookie, CloseCookie, PrintCookie {
32.62 -
32.63 -
32.64 - /**
32.65 - *
32.66 - *
32.67 - */
32.68 +public class ETLEditorSupport extends DataEditorSupport implements OpenCookie, EditCookie, EditorCookie.Observable, LineCookie, CloseCookie, PrintCookie {
32.69 +
32.70 +
32.71 public ETLEditorSupport(ETLDataObject sobj) {
32.72 super(sobj, new ETLEditorEnv(sobj));
32.73 setMIMEType(ETLDataLoader.MIME_TYPE);
32.74 }
32.75 -
32.76 -
32.77 - /**
32.78 - *
32.79 - *
32.80 - */
32.81 +
32.82 public ETLEditorEnv getEnv() {
32.83 - return (ETLEditorEnv)env;
32.84 + return (ETLEditorEnv) env;
32.85 }
32.86 -
32.87 -
32.88 - /**
32.89 - *
32.90 - *
32.91 - */
32.92 +
32.93 @Override
32.94 protected Pane createPane() {
32.95 - multiviewTC = ETLMultiViewFactory.createMultiView(
32.96 - (ETLDataObject)getDataObject());
32.97 + multiviewTC = ETLMultiViewFactory.createMultiView((ETLDataObject) getDataObject());
32.98 multiviewTC.setName(getDataObject().getPrimaryFile().getNameExt());
32.99 -
32.100 - Mode editorMode = WindowManager.getDefault().findMode(
32.101 - ETLEditorSupport.EDITOR_MODE);
32.102 +
32.103 + Mode editorMode = WindowManager.getDefault().findMode(ETLEditorSupport.EDITOR_MODE);
32.104 if (editorMode != null) {
32.105 editorMode.dockInto(multiviewTC);
32.106 }
32.107 - return (Pane)multiviewTC;
32.108 + return (Pane) multiviewTC;
32.109 }
32.110 -
32.111 -
32.112 +
32.113 /**
32.114 * This is called by the multiview elements whenever they are created
32.115 * (and given a observer knowing their multiview TopComponent). It is
32.116 @@ -141,7 +106,7 @@
32.117 */
32.118 public void setTopComponent(TopComponent mvtc) {
32.119 this.multiviewTC = mvtc;
32.120 -
32.121 +
32.122 // Force the title to update so the * left over from when the
32.123 // modified data object was discarded is removed from the title.
32.124 // It is okay for this to be invoked multiple times.
32.125 @@ -154,41 +119,32 @@
32.126 });
32.127 }
32.128 }
32.129 -
32.130 -
32.131 -
32.132 -
32.133 - /**
32.134 - *
32.135 - *
32.136 - */
32.137 +
32.138 public static boolean isLastView(TopComponent tc) {
32.139 -
32.140 - if (!(tc instanceof CloneableTopComponent))
32.141 +
32.142 + if (!(tc instanceof CloneableTopComponent)) {
32.143 return false;
32.144 -
32.145 + }
32.146 boolean oneOrLess = true;
32.147 - Enumeration en =
32.148 - ((CloneableTopComponent)tc).getReference().getComponents();
32.149 + Enumeration en = ((CloneableTopComponent) tc).getReference().getComponents();
32.150 if (en.hasMoreElements()) {
32.151 en.nextElement();
32.152 - if (en.hasMoreElements())
32.153 + if (en.hasMoreElements()) {
32.154 oneOrLess = false;
32.155 + }
32.156 }
32.157 -
32.158 +
32.159 return oneOrLess;
32.160 }
32.161 -
32.162 -
32.163 +
32.164 @Override
32.165 protected void updateTitles() {
32.166 // This method is invoked by DataEditorSupport.DataNodeListener
32.167 // whenever the DataNode displayName property is changed. It is
32.168 // also called when the CloneableEditorSupport is (un)modified.
32.169 -
32.170 // Let the superclass handle the CloneableEditor instances.
32.171 super.updateTitles();
32.172 -
32.173 +
32.174 // We need to get the title updated on the MultiViewTopComponent.
32.175 EventQueue.invokeLater(new Runnable() {
32.176 public void run() {
32.177 @@ -202,8 +158,7 @@
32.178 }
32.179 });
32.180 }
32.181 -
32.182 -
32.183 +
32.184 /**
32.185 * Returns the UndoRedo.Manager instance managed by this editor support.
32.186 *
32.187 @@ -212,11 +167,12 @@
32.188 public UndoRedo.Manager getUndoManager() {
32.189 return super.getUndoRedo();
32.190 }
32.191 -
32.192 +
32.193 @Override
32.194 protected Task reloadDocument() {
32.195 Task task = super.reloadDocument();
32.196 EventQueue.invokeLater(new Runnable() {
32.197 +
32.198 public void run() {
32.199 // Remove the undo listener only if columns view is showing.
32.200 if (multiviewTC != null) {
32.201 @@ -224,8 +180,7 @@
32.202 if (mvh != null) {
32.203 MultiViewPerspective mvp = mvh.getSelectedPerspective();
32.204 if (mvp != null) {
32.205 - if (mvp.preferredID().contains(
32.206 - ETLEditorViewMultiViewDesc.PREFERRED_ID)) {
32.207 + if (mvp.preferredID().contains(ETLEditorViewMultiViewDesc.PREFERRED_ID)) {
32.208 Document doc = getDocument();
32.209 UndoRedo.Manager urm = getUndoRedo();
32.210 if (doc != null && urm != null) {
32.211 @@ -239,11 +194,7 @@
32.212 });
32.213 return task;
32.214 }
32.215 -
32.216 -
32.217 -
32.218 -
32.219 -
32.220 +
32.221 /**
32.222 * Have the schema model sync with the document.
32.223 */
32.224 @@ -252,28 +203,27 @@
32.225 // which indicates that we are switching from the source view.
32.226 // Update the tree with the modified text.
32.227 try {
32.228 -// getWSDLDocument().sync();
32.229 - //TODO: remove ETLMainModel
32.230 - ETLDataObject etlDataObject = ((ETLDataObject)getDataObject());
32.231 -// DataObjectProvider.getProvider().setActiveDataObject(etlDataObject);
32.232 + ETLDataObject etlDataObject = (ETLDataObject) getDataObject();
32.233 ETLCollaborationModel collabModel = etlDataObject.getModel();
32.234 collabModel.getUndoManager().discardAllEdits();
32.235 -
32.236 +
32.237 openDocument();
32.238 String defnContent = getDocument().getText(0, getDocument().getLength());
32.239 collabModel.reLoad(defnContent);
32.240 // is below required?
32.241 collabModel.setReloaded(true);
32.242 populateCanvas(etlDataObject, collabModel);
32.243 + // Validate the collabModel
32.244 + //etlDataObject.getETLEditorTC().doValidation();
32.245 +
32.246 isFirstTime = false;
32.247 } catch (Throwable ioe) {
32.248 // The document cannot be parsed
32.249 NotifyDescriptor nd = new NotifyDescriptor.Message(NbBundle.getMessage(ETLEditorSupport.class, "MSG_NotWellformedEtl"), NotifyDescriptor.ERROR_MESSAGE);
32.250 DialogDisplayer.getDefault().notify(nd);
32.251 }
32.252 -
32.253 }
32.254 -
32.255 +
32.256 /**
32.257 * Populates eTL editor canvas using information from given ETLCollaborationModel.
32.258 *
32.259 @@ -283,134 +233,104 @@
32.260 */
32.261 private void populateCanvas(final ETLDataObject etlDataObject, final ETLCollaborationModel collabModel) throws BaseException {
32.262 Runnable run = new Runnable() {
32.263 +
32.264 public void run() {
32.265 try {
32.266 etlDataObject.getETLEditorTC().getGraphView().clearAll();
32.267 collabModel.restoreUIState();
32.268 - } catch(Exception ex) {
32.269 + } catch (Exception ex) {
32.270 ErrorManager.getDefault().notify(ex);
32.271 }
32.272 }
32.273 };
32.274 -
32.275 +
32.276 SwingUtilities.invokeLater(run);
32.277 + }
32.278
32.279 - }
32.280 -
32.281 public void synchDocument() {
32.282 //syn source view
32.283 //TODO: rit we should create etl defininition model based on swing document
32.284 // and there add document listeber to keeep model in synch with text editing.
32.285 - //all update model incrementally
32.286 + //all update model incrementally
32.287 try {
32.288 - ETLDataObject etlDataObject = (ETLDataObject) getDataObject();
32.289 -// DataObjectProvider.getProvider().setActiveDataObject(etlDataObject);
32.290 - String content = etlDataObject.getETLDefinition().toXMLString("");
32.291 - Document doc = getDocument();
32.292 - if(doc != null) {
32.293 + ETLDataObject etlDataObject = (ETLDataObject) getDataObject();
32.294 + String content = etlDataObject.getETLDefinition().toXMLString("");
32.295 + Document doc = getDocument();
32.296 + if (doc != null) {
32.297 doc.remove(0, getDocument().getLength());
32.298 doc.insertString(0, content, null);
32.299 - }
32.300 - etlDataObject.getModel().setDirty(false);
32.301 + }
32.302 + etlDataObject.getModel().setDirty(false);
32.303 } catch (Exception ex) {
32.304 ErrorManager.getDefault().notify(ex);
32.305 }
32.306 }
32.307 -
32.308 - ////////////////////////////////////////////////////////////////////////////
32.309 - // Inner class
32.310 - ////////////////////////////////////////////////////////////////////////////
32.311 -
32.312 - /**
32.313 +
32.314 +/**
32.315 * Env class extends SchemaEditorSupport.Env.
32.316 * overrides findSchemaEditorSupport
32.317 *
32.318 */
32.319 protected static class ETLEditorEnv extends DataEditorSupport.Env {
32.320 -
32.321 - static final long serialVersionUID =1099957785497677206L;
32.322 -
32.323 +
32.324 + static final long serialVersionUID = 1099957785497677206L;
32.325 +
32.326 public ETLEditorEnv(ETLDataObject obj) {
32.327 super(obj);
32.328 }
32.329 -
32.330 +
32.331 public CloneableEditorSupport findTextEditorSupport() {
32.332 return getETLDataObject().getETLEditorSupport();
32.333 }
32.334 -
32.335 - public ETLDataObject getETLDataObject(){
32.336 +
32.337 + public ETLDataObject getETLDataObject() {
32.338 return (ETLDataObject) getDataObject();
32.339 }
32.340 -
32.341 +
32.342 @Override
32.343 protected FileObject getFile() {
32.344 return getDataObject().getPrimaryFile();
32.345 }
32.346 -
32.347 +
32.348 @Override
32.349 protected FileLock takeLock() throws IOException {
32.350 return getDataObject().getPrimaryFile().lock();
32.351 }
32.352 }
32.353 -
32.354 -
32.355 -
32.356 -
32.357 - ////////////////////////////////////////////////////////////////////////////
32.358 - // Inner class
32.359 - ////////////////////////////////////////////////////////////////////////////
32.360 -
32.361 - /**
32.362 +
32.363 + /**
32.364 * Implementation of CloseOperationHandler for multiview. Ensures both
32.365 * column view and xml editor are correctly closed, data saved, etc. Holds
32.366 * a reference to Schema DataObject only - to be serializable with the
32.367 * multiview TopComponent without problems.
32.368 */
32.369 - public static class CloseHandler extends Object
32.370 - implements CloseOperationHandler, Serializable {
32.371 - /**
32.372 - *
32.373 - *
32.374 - */
32.375 + public static class CloseHandler extends Object implements CloseOperationHandler, Serializable {
32.376 +
32.377 private CloseHandler() {
32.378 super();
32.379 }
32.380 -
32.381 - /**
32.382 - *
32.383 - *
32.384 - */
32.385 +
32.386 public CloseHandler(DataObject schemaDO) {
32.387 dataObject = schemaDO;
32.388 }
32.389 -
32.390 - /**
32.391 - *
32.392 - *
32.393 - */
32.394 +
32.395 private ETLEditorSupport getETLEditorSupport() {
32.396 - return dataObject != null &&
32.397 - dataObject instanceof ETLDataObject ?
32.398 - ((ETLDataObject)dataObject).getETLEditorSupport() : null;
32.399 + return dataObject != null && dataObject instanceof ETLDataObject ? ((ETLDataObject) dataObject).getETLEditorSupport() : null;
32.400 }
32.401 -
32.402 - /**
32.403 - *
32.404 - *
32.405 - */
32.406 +
32.407 public boolean resolveCloseOperation(CloseOperationState[] elements) {
32.408 ETLEditorSupport etlEditor = getETLEditorSupport();
32.409 if (etlEditor != null) {
32.410 // This handles saving the document.
32.411 boolean close = etlEditor.canClose();
32.412 if (close) {
32.413 - if(dataObject.isValid()) {
32.414 + if (dataObject.isValid()) {
32.415 // In case user discarded edits, need to reload.
32.416 if (dataObject.isModified()) {
32.417 // In case user discarded edits, need to reload.
32.418 etlEditor.reloadDocument().waitFinished();
32.419 }
32.420 -
32.421 +
32.422 etlEditor.syncModel();
32.423 // Need to properly close the support, too.
32.424 etlEditor.notifyClosed();
32.425 @@ -420,28 +340,10 @@
32.426 }
32.427 return true;
32.428 }
32.429 -
32.430 - private static final long serialVersionUID =-3838395157610633251L;
32.431 -
32.432 + private static final long serialVersionUID = -3838395157610633251L;
32.433 private DataObject dataObject;
32.434 }
32.435 -
32.436 -
32.437 -
32.438 -
32.439 - ////////////////////////////////////////////////////////////////////////////
32.440 - // Class members
32.441 - ////////////////////////////////////////////////////////////////////////////
32.442 -
32.443 - /** Set of opened WSDLEditorSupport instances (text or colView opened) */
32.444 -// private static Set opened = Collections.synchronizedSet(new HashSet());
32.445 -
32.446 -
32.447 -
32.448 - ////////////////////////////////////////////////////////////////////////////
32.449 - // Instance members
32.450 - ////////////////////////////////////////////////////////////////////////////
32.451 -
32.452 +
32.453 /**
32.454 * The embracing multiview TopComponent (holds the ColumnView and
32.455 * schema xml editor) - we remeber the last active TopComponent
33.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLEditorViewMultiViewDesc.java Sat Dec 08 10:04:51 2007 +0000
33.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLEditorViewMultiViewDesc.java Sat Dec 08 10:24:35 2007 +0000
33.3 @@ -1,15 +1,14 @@
33.4 /*
33.5 * Sun Public License Notice
33.6 - *
33.7 + *
33.8 * The contents of this file are subject to the Sun Public License
33.9 * Version 1.0 (the "License"). You may not use this file except in
33.10 * compliance with the License. A copy of the License is available at
33.11 * http://www.sun.com/
33.12 - *
33.13 + *
33.14 * The Original Code is NetBeans. The Initial Developer of the Original
33.15 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
33.16 * Microsystems, Inc. All Rights Reserved.
33.17 -
33.18 If you wish your version of this file to be governed by only the CDDL
33.19 or only the GPL Version 2, indicate your decision by adding
33.20 "[Contributor] elects to include this software in this distribution
33.21 @@ -34,13 +33,6 @@
33.22 */
33.23
33.24 /*
33.25 - * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
33.26 - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
33.27 - *
33.28 - * $Id$
33.29 - */
33.30 -
33.31 -/*
33.32 * WSDLTreeViewMultiViewDesc.java
33.33 *
33.34 * Created on October 13, 2005, 2:04 PM
33.35 @@ -67,7 +59,7 @@
33.36 *
33.37 */
33.38 public class ETLEditorViewMultiViewDesc extends Object
33.39 - implements MultiViewDescription, Serializable {
33.40 + implements MultiViewDescription, Serializable {
33.41
33.42
33.43 /**
33.44 @@ -77,97 +69,97 @@
33.45 public static final String PREFERRED_ID = "etl-designview";
33.46 private ETLDataObject etlDataObject;
33.47
33.48 - /**
33.49 - *
33.50 - *
33.51 - */
33.52 - public ETLEditorViewMultiViewDesc() {
33.53 - super();
33.54 - }
33.55 + /**
33.56 + *
33.57 + *
33.58 + */
33.59 + public ETLEditorViewMultiViewDesc() {
33.60 + super();
33.61 + }
33.62
33.63
33.64 - /**
33.65 - *
33.66 - *
33.67 - */
33.68 - public ETLEditorViewMultiViewDesc(ETLDataObject etlDataObject) {
33.69 - this.etlDataObject = etlDataObject;
33.70 - }
33.71 + /**
33.72 + *
33.73 + *
33.74 + */
33.75 + public ETLEditorViewMultiViewDesc(ETLDataObject etlDataObject) {
33.76 + this.etlDataObject = etlDataObject;
33.77 + }
33.78
33.79
33.80 - /**
33.81 - *
33.82 - *
33.83 - */
33.84 - public String preferredID() {
33.85 - return PREFERRED_ID;
33.86 - }
33.87 + /**
33.88 + *
33.89 + *
33.90 + */
33.91 + public String preferredID() {
33.92 + return PREFERRED_ID;
33.93 + }
33.94
33.95
33.96 - /**
33.97 - *
33.98 - *
33.99 - */
33.100 - public int getPersistenceType() {
33.101 - return TopComponent.PERSISTENCE_NEVER;
33.102 - }
33.103 + /**
33.104 + *
33.105 + *
33.106 + */
33.107 + public int getPersistenceType() {
33.108 + return TopComponent.PERSISTENCE_NEVER;
33.109 + }
33.110
33.111
33.112 - /**
33.113 - *
33.114 - *
33.115 - */
33.116 - public java.awt.Image getIcon() {
33.117 - return Utilities.loadImage(ETLDataObject.ETL_ICON);
33.118 - }
33.119 + /**
33.120 + *
33.121 + *
33.122 + */
33.123 + public java.awt.Image getIcon() {
33.124 + return Utilities.loadImage(ETLDataObject.ETL_ICON);
33.125 + }
33.126
33.127
33.128 - /**
33.129 - *
33.130 - *
33.131 - */
33.132 - public org.openide.util.HelpCtx getHelpCtx() {
33.133 - return org.openide.util.HelpCtx.DEFAULT_HELP;
33.134 - }
33.135 + /**
33.136 + *
33.137 + *
33.138 + */
33.139 + public org.openide.util.HelpCtx getHelpCtx() {
33.140 + return org.openide.util.HelpCtx.DEFAULT_HELP;
33.141 + }
33.142
33.143
33.144 - /**
33.145 - *
33.146 - *
33.147 - */
33.148 - public String getDisplayName() {
33.149 - return NbBundle.getMessage(ETLEditorViewMultiViewDesc.class,
33.150 - "LBL_designView_name");
33.151 - }
33.152 + /**
33.153 + *
33.154 + *
33.155 + */
33.156 + public String getDisplayName() {
33.157 + return NbBundle.getMessage(ETLEditorViewMultiViewDesc.class,
33.158 + "LBL_designView_name");
33.159 + }
33.160
33.161
33.162 - /**
33.163 - *
33.164 - *
33.165 - */
33.166 - public MultiViewElement createElement() {
33.167 + /**
33.168 + *
33.169 + *
33.170 + */
33.171 + public MultiViewElement createElement() {
33.172 return new ETLEditorViewMultiViewElement(/*new WSDLTreeTopComponent(wsdlDataObject),*/ etlDataObject);
33.173 - }
33.174 + }
33.175
33.176
33.177 - /**
33.178 - *
33.179 - *
33.180 - */
33.181 - public void writeExternal(ObjectOutput out) throws IOException {
33.182 - out.writeObject(etlDataObject);
33.183 - }
33.184 + /**
33.185 + *
33.186 + *
33.187 + */
33.188 + public void writeExternal(ObjectOutput out) throws IOException {
33.189 + out.writeObject(etlDataObject);
33.190 + }
33.191
33.192
33.193 - /**
33.194 - *
33.195 - *
33.196 - */
33.197 - public void readExternal(ObjectInput in)
33.198 - throws IOException, ClassNotFoundException
33.199 - {
33.200 - Object firstObject = in.readObject();
33.201 - if (firstObject instanceof ETLDataObject)
33.202 - etlDataObject = (ETLDataObject) firstObject;
33.203 - }
33.204 + /**
33.205 + *
33.206 + *
33.207 + */
33.208 + public void readExternal(ObjectInput in)
33.209 + throws IOException, ClassNotFoundException
33.210 + {
33.211 + Object firstObject = in.readObject();
33.212 + if (firstObject instanceof ETLDataObject)
33.213 + etlDataObject = (ETLDataObject) firstObject;
33.214 + }
33.215 }
34.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLEditorViewMultiViewElement.java Sat Dec 08 10:04:51 2007 +0000
34.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLEditorViewMultiViewElement.java Sat Dec 08 10:24:35 2007 +0000
34.3 @@ -1,15 +1,14 @@
34.4 /*
34.5 * Sun Public License Notice
34.6 - *
34.7 + *
34.8 * The contents of this file are subject to the Sun Public License
34.9 * Version 1.0 (the "License"). You may not use this file except in
34.10 * compliance with the License. A copy of the License is available at
34.11 * http://www.sun.com/
34.12 - *
34.13 + *
34.14 * The Original Code is NetBeans. The Initial Developer of the Original
34.15 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
34.16 * Microsystems, Inc. All Rights Reserved.
34.17 -
34.18 If you wish your version of this file to be governed by only the CDDL
34.19 or only the GPL Version 2, indicate your decision by adding
34.20 "[Contributor] elects to include this software in this distribution
34.21 @@ -20,7 +19,6 @@
34.22 However, if you add GPL Version 2 code and therefore, elected the GPL
34.23 Version 2 license, then the option applies only if the new code is
34.24 made subject to such option by the copyright holder.
34.25 -
34.26 If you wish your version of this file to be governed by only the CDDL
34.27 or only the GPL Version 2, indicate your decision by adding
34.28 "[Contributor] elects to include this software in this distribution
34.29 @@ -48,8 +46,6 @@
34.30 import java.io.IOException;
34.31 import java.util.Arrays;
34.32
34.33 -import javax.swing.JComponent;
34.34 -import javax.swing.JToolBar;
34.35 import javax.swing.UIManager;
34.36 import javax.swing.event.ChangeListener;
34.37 import javax.swing.text.Document;
34.38 @@ -61,16 +57,9 @@
34.39 import org.netbeans.core.spi.multiview.MultiViewElementCallback;
34.40 import org.netbeans.core.spi.multiview.MultiViewFactory;
34.41 import org.netbeans.modules.etl.model.ETLDefinition;
34.42 -import org.netbeans.modules.etl.ui.model.impl.ETLCollaborationModel;
34.43 import org.netbeans.modules.etl.ui.palette.PaletteSupport;
34.44 import org.netbeans.modules.etl.ui.view.ETLCollaborationTopComponent;
34.45 -import org.netbeans.modules.etl.ui.view.ETLEditorTopView;
34.46 -import org.netbeans.modules.sql.framework.model.SourceTable;
34.47 -import org.netbeans.modules.sql.framework.ui.graph.IGraphView;
34.48 -import org.netbeans.modules.sql.framework.ui.graph.IToolBar;
34.49 import org.netbeans.modules.sql.framework.ui.graph.impl.GraphView;
34.50 -import org.netbeans.modules.sql.framework.ui.graph.view.impl.SQLToolBar;
34.51 -import org.netbeans.modules.sql.framework.ui.view.graph.SQLCollaborationView;
34.52 import org.netbeans.spi.palette.PaletteController;
34.53 import org.openide.ErrorManager;
34.54 import org.openide.awt.UndoRedo;
34.55 @@ -83,8 +72,6 @@
34.56 import org.openide.util.lookup.Lookups;
34.57 import org.openide.util.lookup.ProxyLookup;
34.58 import org.openide.windows.CloneableTopComponent;
34.59 -import org.openide.windows.TopComponent;
34.60 -
34.61
34.62 /**
34.63 * @author radval
34.64 @@ -93,35 +80,19 @@
34.65 * Window - Preferences - Java - Code Generation - Code and Comments
34.66 */
34.67 public class ETLEditorViewMultiViewElement extends CloneableTopComponent
34.68 - implements MultiViewElement, Lookup.Provider {
34.69 -
34.70 - /**
34.71 - *
34.72 - */
34.73 + implements MultiViewElement, Lookup.Provider {
34.74 +
34.75 private static final long serialVersionUID = -655912409997381426L;
34.76 + private ETLDataObject mObj = null;
34.77 + private ETLCollaborationTopComponent mTC;
34.78 + private ETLEditorSupport mEditorSupport = null;
34.79 + private transient InstanceContent nodesHack;
34.80 + private transient javax.swing.JLabel errorLabel = new javax.swing.JLabel();
34.81
34.82 - private ETLDataObject mObj = null;
34.83 -
34.84 - private SourceTable srcTbl;
34.85 -
34.86 - private ETLCollaborationTopComponent mTC;
34.87 -
34.88 - private ETLEditorSupport mEditorSupport = null;
34.89 -
34.90 - private transient InstanceContent nodesHack;
34.91 -
34.92 - private PropertyChangeListener myActiveNodeChangeListener;
34.93 -
34.94 - private transient javax.swing.JLabel errorLabel = new javax.swing.JLabel();
34.95 -
34.96 - private transient MultiViewElementCallback myMultiViewObserver;
34.97 -
34.98 - private static JComponent ToolBar;
34.99 -
34.100 public ETLEditorViewMultiViewElement() {
34.101 - super();
34.102 + super();
34.103 }
34.104 -
34.105 +
34.106 public ETLEditorViewMultiViewElement(ETLDataObject dObj) {
34.107 super();
34.108 this.mObj = dObj;
34.109 @@ -130,13 +101,13 @@
34.110 } catch (Exception ex) {
34.111 ErrorManager.getDefault().log(ErrorManager.ERROR,
34.112 NbBundle.getMessage(ETLEditorViewMultiViewElement.class,
34.113 - "ERROR_IN_INITITALIZATION_OF_ETL_EDITOR"));
34.114 + "ERROR_IN_INITITALIZATION_OF_ETL_EDITOR") + ex.getMessage());
34.115 }
34.116 }
34.117 -
34.118 - private void initialize() throws Exception {
34.119 +
34.120 + private void initialize() throws Exception {
34.121 try {
34.122 - mEditorSupport = mObj.getETLEditorSupport();
34.123 + mEditorSupport = mObj.getETLEditorSupport();
34.124 setLayout(new BorderLayout());
34.125 mTC = mObj.getETLEditorTC();
34.126 add(BorderLayout.CENTER, mTC);
34.127 @@ -145,29 +116,29 @@
34.128 throw ex;
34.129 }
34.130 }
34.131 -
34.132 +
34.133 private void initializeLookup() throws IOException {
34.134 associateLookup(createAssociateLookup());
34.135 - // initActiveNodeChangeListener();
34.136 addPropertyChangeListener(new PropertyChangeListener() {
34.137 +
34.138 /**
34.139 * TODO: may not be needed at some point when parenting
34.140 * MultiViewTopComponent delegates properly to its peer's
34.141 * activatedNodes.
34.142 *
34.143 * see http://www.netbeans.org/issues/show_bug.cgi?id=67257
34.144 - *
34.145 + *
34.146 * note: TopComponent.setActivatedNodes is final
34.147 */
34.148 public void propertyChange(PropertyChangeEvent event) {
34.149 - if(event.getPropertyName().equals("activatedNodes")) {
34.150 - nodesHack.set(Arrays.asList(getActivatedNodes()),null);
34.151 + if (event.getPropertyName().equals("activatedNodes")) {
34.152 + nodesHack.set(Arrays.asList(getActivatedNodes()), null);
34.153 }
34.154 - }
34.155 - });
34.156 - setActivatedNodes(new Node[] {getETLDataObject().getNodeDelegate()});
34.157 + }
34.158 + });
34.159 + setActivatedNodes(new Node[]{getETLDataObject().getNodeDelegate()});
34.160 }
34.161 -
34.162 +
34.163 private Lookup createAssociateLookup() throws IOException {
34.164 //
34.165 // see http://www.netbeans.org/issues/show_bug.cgi?id=67257
34.166 @@ -175,30 +146,26 @@
34.167 PaletteController controller = createPalette();
34.168 nodesHack = new InstanceContent();
34.169 nodesHack.add(controller);
34.170 - return new ProxyLookup(new Lookup[] {
34.171 + return new ProxyLookup(new Lookup[]{
34.172 //
34.173 // other than nodesHack what else do we need in the associated
34.174 // lookup? I think that XmlNavigator needs DataObject
34.175 //
34.176 getETLDataObject().getLookup(), // this lookup contain objects that are used in OM clients
34.177 Lookups.singleton(this),
34.178 - new AbstractLookup(nodesHack),
34.179 - Lookups.fixed(new Object[] {controller}),
34.180 -
34.181 - });
34.182 - }
34.183 + new AbstractLookup(nodesHack),
34.184 + Lookups.fixed(new Object[] {controller}),});
34.185 + }
34.186 +
34.187 + private PaletteController createPalette( ) throws IOException {
34.188 + PaletteController controller = PaletteSupport.createPalette(mTC);
34.189 + return controller;
34.190 + }
34.191
34.192 - private PaletteController createPalette() throws IOException{
34.193 - PaletteSupport support = new PaletteSupport(mTC);
34.194 - PaletteController controller = PaletteSupport.createPalette();
34.195 - return controller;
34.196 -
34.197 - }
34.198 private ETLDataObject getETLDataObject() {
34.199 return mObj;
34.200 }
34.201
34.202 -
34.203 /**
34.204 * Overwrite when you want to change default persistence type. Default
34.205 * persistence type is PERSISTENCE_ALWAYS.
34.206 @@ -208,7 +175,7 @@
34.207 */
34.208 @Override
34.209 public int getPersistenceType() {
34.210 - return PERSISTENCE_ONLY_OPENED;//was PERSISTENCE_NEVER
34.211 + return PERSISTENCE_ONLY_OPENED;//was PERSISTENCE_NEVER
34.212 }
34.213
34.214 public void setMultiViewCallback(final MultiViewElementCallback callback) {
34.215 @@ -222,125 +189,90 @@
34.216 }
34.217 return CloseOperationState.STATE_OK;
34.218 }
34.219 -
34.220 +
34.221 @Override
34.222 public void componentHidden() {
34.223 - super.componentHidden();
34.224 + super.componentHidden();
34.225 }
34.226 -
34.227 +
34.228 @Override
34.229 public void componentClosed() {
34.230 - super.componentClosed();
34.231 + super.componentClosed();
34.232 }
34.233 -
34.234 +
34.235 @Override
34.236 public void componentOpened() {
34.237 - super.componentOpened();
34.238 + super.componentOpened();
34.239 DataObjectProvider.activeDataObject = mObj;
34.240 }
34.241 -
34.242 +
34.243 @Override
34.244 - public void componentActivated() {
34.245 - super.componentActivated();
34.246 -
34.247 - if(getETLDataObject().getETLEditorSupport().isFirstTime){
34.248 + public void componentActivated() {
34.249 + super.componentActivated();
34.250 +
34.251 + if (getETLDataObject().getETLEditorSupport().isFirstTime) {
34.252 getETLDataObject().getETLEditorSupport().syncModel();
34.253 }
34.254 - getETLDataObject().createNodeDelegate();
34.255 + getETLDataObject().createNodeDelegate();
34.256 DataObjectProvider.activeDataObject = mObj;
34.257 -
34.258 GraphView graphView = (GraphView) this.mTC.getGraphView();
34.259 - if(null != graphView){
34.260 + if (null != graphView) {
34.261 graphView.setObserved(graphView);
34.262 + }
34.263 }
34.264 - }
34.265 -
34.266 +
34.267 @Override
34.268 public void componentDeactivated() {
34.269 - SaveCookie cookie = (SaveCookie) mObj.getCookie(SaveCookie.class);
34.270 - if(cookie != null) {
34.271 + SaveCookie cookie = mObj.getCookie(SaveCookie.class);
34.272 + if (cookie != null) {
34.273 getETLDataObject().getETLEditorSupport().synchDocument();
34.274 - }
34.275 + }
34.276 super.componentDeactivated();
34.277 }
34.278 -
34.279 +
34.280 @Override
34.281 public void componentShowing() {
34.282 -
34.283 - super.componentShowing();
34.284 +
34.285 + super.componentShowing();
34.286 ETLEditorSupport editor = mObj.getETLEditorSupport();
34.287 UndoRedo.Manager undoRedo = editor.getUndoManager();
34.288 Document document = editor.getDocument();
34.289 - if(document != null) {
34.290 + if (document != null) {
34.291 document.removeUndoableEditListener(undoRedo);
34.292 }
34.293 - checkModelState();
34.294 + checkModelState();
34.295 DataObjectProvider.activeDataObject = mObj;
34.296 }
34.297 -
34.298 - private void initActiveNodeChangeListener() {
34.299 - if (myActiveNodeChangeListener == null) {
34.300 - myActiveNodeChangeListener = new PropertyChangeListener() {
34.301 - /**
34.302 - * TODO: may not be needed at some point when parenting
34.303 - * MultiViewTopComponent delegates properly to its peer's
34.304 - * activatedNodes. see
34.305 - * http://www.netbeans.org/issues/show_bug.cgi?id=67257 note:
34.306 - * TopComponent.setActivatedNodes is final
34.307 - */
34.308 - public void propertyChange(PropertyChangeEvent event) {
34.309 - // java.util.logging.Logger.getLogger(ETLEditorViewMultiViewElement.class.getName()).info("ETLActivatedNodes in PropertyChangeListener ------------ ");
34.310 - // no constant in TopComponent...lame
34.311 - if(event.getPropertyName().equals("activatedNodes")) { // NOI18N
34.312 -
34.313 - TopComponent tc = TopComponent.getRegistry().getActivated();
34.314 - /* Ignore event coming from my TC */
34.315 - // if(DEBUG)
34.316 - // Debug.verboseWithin(this,"propertyChange",getDataObject());
34.317 - nodesHack.set(Arrays.asList(getActivatedNodes()),null);
34.318 - }
34.319 - };
34.320 - };
34.321 - } else {
34.322 - removePropertyChangeListener(myActiveNodeChangeListener);
34.323 - }
34.324
34.325 - addPropertyChangeListener(myActiveNodeChangeListener);
34.326 - setActivatedNodes(new Node[] {getDataObject().getNodeDelegate()});
34.327 - }
34.328 -
34.329 - private ETLDataObject getDataObject() {
34.330 - return mObj;
34.331 - }
34.332 -
34.333 private void checkModelState() {
34.334 ETLEditorSupport editor = getETLDataObject().getETLEditorSupport();
34.335 ETLDataObject dObj = (ETLDataObject) editor.getDataObject();
34.336 - ETLDefinition model = null;
34.337 + ETLDefinition model = null;
34.338 String errorMessage = null;
34.339 -
34.340 +
34.341 try {
34.342 model = dObj.getETLDefinition();
34.343 - if( model != null) {
34.344 + if (model != null) {
34.345 recreateUI(model);
34.346 return;
34.347 }
34.348 } catch (Exception ex) {
34.349 - errorMessage = ex.getMessage();
34.350 + errorMessage = ex.getMessage();
34.351 + ex.printStackTrace();
34.352 }
34.353 -
34.354 +
34.355 //if it comes here, either the schema is not well-formed or invalid
34.356 - if( model == null ) {
34.357 - if(errorMessage == null)
34.358 + if (model == null) {
34.359 + if (errorMessage == null) {
34.360 errorMessage = NbBundle.getMessage(
34.361 ETLEditorViewMultiViewElement.class,
34.362 "MSG_NotWellformedEtl");
34.363 + }
34.364 }
34.365 -
34.366 +
34.367 emptyUI(errorMessage);
34.368 }
34.369 -
34.370 -
34.371 +
34.372 private void emptyUI(String errorMessage) {
34.373 this.removeAll();
34.374 errorLabel.setText("<" + errorMessage + ">");
34.375 @@ -348,109 +280,81 @@
34.376 errorLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
34.377 errorLabel.setEnabled(false);
34.378 Color usualWindowBkg = UIManager.getColor("window"); //NOI18N
34.379 - errorLabel.setBackground(usualWindowBkg != null ? usualWindowBkg :
34.380 - Color.white);
34.381 + errorLabel.setBackground(usualWindowBkg != null ? usualWindowBkg : Color.white);
34.382 errorLabel.setOpaque(true);
34.383 add(errorLabel, BorderLayout.CENTER);
34.384 }
34.385 -
34.386 +
34.387 private void recreateUI(ETLDefinition model) {
34.388 this.removeAll();
34.389 // Add the schema category pane as our primary interface.
34.390 add(mTC, BorderLayout.CENTER);
34.391 }
34.392 -
34.393 +
34.394 public javax.swing.JComponent getToolbarRepresentation() {
34.395 - if(ToolBar == null) {
34.396 - ToolBar = createToolbar();
34.397 - }
34.398 - return ToolBar;
34.399 + return mTC.createToolbar();
34.400 }
34.401
34.402 - private JToolBar createToolbar() {
34.403 - IGraphView graphView = this.mTC.getGraphView();
34.404 - ETLCollaborationModel collabModel = getETLDataObject().getModel();
34.405 - ETLEditorTopView etlTopView = new ETLEditorTopView(collabModel,this.mTC);
34.406 - etlTopView.enableToolBarActions(true);
34.407 - SQLCollaborationView collabView = etlTopView.getCollaborationView();
34.408 - IToolBar toolBar = new SQLToolBar(collabView.getIOperatorManager());
34.409 - if(toolBar != null) {
34.410 - toolBar.setGraphView(graphView);
34.411 - toolBar.setActions(etlTopView.getToolBarActions());
34.412 - toolBar.initializeToolBar();
34.413 - }
34.414 - return (JToolBar) toolBar;
34.415 - }
34.416 -
34.417 public javax.swing.JComponent getVisualRepresentation() {
34.418 return this;
34.419 - }
34.420 -
34.421 - public static JToolBar getToolBar() {
34.422 - return (JToolBar) ToolBar;
34.423 }
34.424 -
34.425 - public static void setToolBar(IToolBar tBar) {
34.426 - ToolBar = (JToolBar)tBar;
34.427 - }
34.428 -
34.429 +
34.430 public CloneableTopComponent getComponent() {
34.431 return this;
34.432 }
34.433 -
34.434 +
34.435 /** Get the undo/redo support for this component.
34.436 * The default implementation returns a dummy support that cannot
34.437 * undo anything.
34.438 *
34.439 * @return undoable edit for this component
34.440 */
34.441 - @Override
34.442 - public UndoRedo getUndoRedo () {
34.443 - return new TreeEditorUndoRedo();
34.444 - }
34.445 -
34.446 - public void cleanUp() {
34.447 -
34.448 - }
34.449 + @Override
34.450 + public UndoRedo getUndoRedo() {
34.451 + return new TreeEditorUndoRedo();
34.452 + }
34.453
34.454 - class TreeEditorUndoRedo implements UndoRedo {
34.455 -
34.456 + public void cleanUp() {
34.457 +
34.458 + }
34.459 +
34.460 + class TreeEditorUndoRedo implements UndoRedo {
34.461 +
34.462 public void addChangeListener(ChangeListener l) {
34.463 -
34.464 +
34.465 }
34.466 -
34.467 +
34.468 public boolean canRedo() {
34.469 return mEditorSupport.getUndoManager().canRedo();
34.470 }
34.471 -
34.472 +
34.473 public boolean canUndo() {
34.474 return mEditorSupport.getUndoManager().canUndo();
34.475 }
34.476 -
34.477 +
34.478 public String getRedoPresentationName() {
34.479 - if(mEditorSupport != null) {
34.480 + if (mEditorSupport != null) {
34.481 return mEditorSupport.getUndoManager().getRedoPresentationName();
34.482 }
34.483 return "Redo_ETLTreeEditor";
34.484 }
34.485 -
34.486 +
34.487 public String getUndoPresentationName() {
34.488 - if(mEditorSupport != null) {
34.489 + if (mEditorSupport != null) {
34.490 return mEditorSupport.getUndoManager().getUndoPresentationName();
34.491 }
34.492 -
34.493 return "Undo_ETLTreeEditor";
34.494 }
34.495 -
34.496 +
34.497 public void redo() throws CannotRedoException {
34.498 mEditorSupport.getUndoManager().redo();
34.499 }
34.500 -
34.501 +
34.502 public void removeChangeListener(ChangeListener l) {
34.503 }
34.504 -
34.505 +
34.506 public void undo() throws CannotUndoException {
34.507 mEditorSupport.getUndoManager().undo();
34.508 }
34.509 - }
34.510 + }
34.511 }
35.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLMultiViewFactory.java Sat Dec 08 10:04:51 2007 +0000
35.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLMultiViewFactory.java Sat Dec 08 10:24:35 2007 +0000
35.3 @@ -1,15 +1,14 @@
35.4 /*
35.5 * Sun Public License Notice
35.6 - *
35.7 + *
35.8 * The contents of this file are subject to the Sun Public License
35.9 * Version 1.0 (the "License"). You may not use this file except in
35.10 * compliance with the License. A copy of the License is available at
35.11 * http://www.sun.com/
35.12 - *
35.13 + *
35.14 * The Original Code is NetBeans. The Initial Developer of the Original
35.15 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
35.16 * Microsystems, Inc. All Rights Reserved.
35.17 -
35.18 If you wish your version of this file to be governed by only the CDDL
35.19 or only the GPL Version 2, indicate your decision by adding
35.20 "[Contributor] elects to include this software in this distribution
35.21 @@ -34,13 +33,6 @@
35.22 */
35.23
35.24 /*
35.25 - * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
35.26 - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
35.27 - *
35.28 - * $Id$
35.29 - */
35.30 -
35.31 -/*
35.32 * ETLMultiViewFactory.java
35.33 *
35.34 * Created on October 13, 2005, 1:58 PM
36.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLNode.java Sat Dec 08 10:04:51 2007 +0000
36.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLNode.java Sat Dec 08 10:24:35 2007 +0000
36.3 @@ -9,7 +9,6 @@
36.4 * The Original Code is NetBeans. The Initial Developer of the Original
36.5 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
36.6 * Microsystems, Inc. All Rights Reserved.
36.7 -
36.8 If you wish your version of this file to be governed by only the CDDL
36.9 or only the GPL Version 2, indicate your decision by adding
36.10 "[Contributor] elects to include this software in this distribution
37.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLSourceMultiViewElement.java Sat Dec 08 10:04:51 2007 +0000
37.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLSourceMultiViewElement.java Sat Dec 08 10:24:35 2007 +0000
37.3 @@ -9,7 +9,6 @@
37.4 * The Original Code is NetBeans. The Initial Developer of the Original
37.5 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
37.6 * Microsystems, Inc. All Rights Reserved.
37.7 -
37.8 If you wish your version of this file to be governed by only the CDDL
37.9 or only the GPL Version 2, indicate your decision by adding
37.10 "[Contributor] elects to include this software in this distribution
37.11 @@ -34,13 +33,6 @@
37.12 */
37.13
37.14 /*
37.15 - * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
37.16 - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
37.17 - *
37.18 - * $Id$
37.19 - */
37.20 -
37.21 -/*
37.22 * ETLSourceMultiViewElement.java
37.23 *
37.24 * Created on October 13, 2005, 2:36 PM
38.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/ETLSourceMultiviewDesc.java Sat Dec 08 10:04:51 2007 +0000
38.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/ETLSourceMultiviewDesc.java Sat Dec 08 10:24:35 2007 +0000
38.3 @@ -1,15 +1,14 @@
38.4 /*
38.5 * Sun Public License Notice
38.6 - *
38.7 + *
38.8 * The contents of this file are subject to the Sun Public License
38.9 * Version 1.0 (the "License"). You may not use this file except in
38.10 * compliance with the License. A copy of the License is available at
38.11 * http://www.sun.com/
38.12 - *
38.13 + *
38.14 * The Original Code is NetBeans. The Initial Developer of the Original
38.15 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
38.16 * Microsystems, Inc. All Rights Reserved.
38.17 -
38.18 If you wish your version of this file to be governed by only the CDDL
38.19 or only the GPL Version 2, indicate your decision by adding
38.20 "[Contributor] elects to include this software in this distribution
38.21 @@ -34,13 +33,6 @@
38.22 */
38.23
38.24 /*
38.25 - * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
38.26 - * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
38.27 - *
38.28 - * $Id$
38.29 - */
38.30 -
38.31 -/*
38.32 * ETLSourceMultiviewDesc.java
38.33 *
38.34 * Created on October 13, 2005, 2:05 PM
38.35 @@ -85,7 +77,7 @@
38.36 }
38.37
38.38 public String preferredID() {
38.39 - return PREFERRED_ID;
38.40 + return PREFERRED_ID;
38.41 }
38.42
38.43 public int getPersistenceType() {
38.44 @@ -111,19 +103,19 @@
38.45 return editorComponent;
38.46 }
38.47 return MultiViewFactory.BLANK_ELEMENT;
38.48 -
38.49 +
38.50 }
38.51
38.52 public void writeExternal(ObjectOutput out) throws IOException {
38.53 - out.writeObject(etlDataObject);
38.54 + out.writeObject(etlDataObject);
38.55 }
38.56
38.57 public void readExternal(ObjectInput in)
38.58 - throws IOException, ClassNotFoundException
38.59 + throws IOException, ClassNotFoundException
38.60 {
38.61 - Object firstObject = in.readObject();
38.62 - if (firstObject instanceof ETLDataObject)
38.63 - etlDataObject = (ETLDataObject) firstObject;
38.64 + Object firstObject = in.readObject();
38.65 + if (firstObject instanceof ETLDataObject)
38.66 + etlDataObject = (ETLDataObject) firstObject;
38.67 }
38.68
38.69 }
39.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/model/impl/ETLCollaborationModel.java Sat Dec 08 10:04:51 2007 +0000
39.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/model/impl/ETLCollaborationModel.java Sat Dec 08 10:24:35 2007 +0000
39.3 @@ -50,13 +50,11 @@
39.4 import org.netbeans.modules.sql.framework.common.utils.XmlUtil;
39.5 import org.netbeans.modules.sql.framework.ui.model.CollabSQLUIModel;
39.6 import org.netbeans.modules.sql.framework.ui.model.impl.CollabSQLUIModelImpl;
39.7 -import org.w3c.dom.Element;
39.8
39.9 /**
39.10 * This class represents a model for GUI collaboration objects
39.11 *
39.12 * @author Ritesh Adval
39.13 - * @version $Revision$
39.14 */
39.15
39.16 public class ETLCollaborationModel extends CollabSQLUIModelImpl implements CollabSQLUIModel {
39.17 @@ -124,6 +122,7 @@
39.18 reLoad(this.eTLXml);
39.19 }
39.20
39.21 + @Override
39.22 public void reLoad(String etlDefinitionXml) throws BaseException {
39.23 this.eTLXml = etlDefinitionXml;
39.24
40.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/navigator/ETLNavigatorComponent.java Sat Dec 08 10:04:51 2007 +0000
40.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/navigator/ETLNavigatorComponent.java Sat Dec 08 10:24:35 2007 +0000
40.3 @@ -124,7 +124,7 @@
40.4 panelUI.setBorder(javax.swing.BorderFactory.createEmptyBorder(50,50,50,50));//, left, bottom, right)createTitledBorder("Navigator Panel Title"));
40.5 panelUI.setSize(150,150);
40.6 }
40.7 - //panelUI.removeAll();
40.8 +
40.9 while(true) {
40.10 try {
40.11 //panelUI = dObj.getETLEditorTC().getSatelliteView();
41.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/palette/Category.java Sat Dec 08 10:04:51 2007 +0000
41.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/palette/Category.java Sat Dec 08 10:24:35 2007 +0000
41.3 @@ -18,11 +18,9 @@
41.4 License Header, with the fields enclosed by brackets [] replaced by
41.5 your own identifying information:
41.6 "Portions Copyrighted [year] [name of copyright owner]"
41.7 -
41.8 Contributor(s):
41.9 *
41.10 * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
41.11 -
41.12 If you wish your version of this file to be governed by only the CDDL
41.13 or only the GPL Version 2, indicate your decision by adding
41.14 "[Contributor] elects to include this software in this distribution
41.15 @@ -44,7 +42,7 @@
41.16 */
41.17 public class Category {
41.18
41.19 - private String name;
41.20 + private String name;
41.21
41.22 /** Creates a new instance of Category */
41.23 public Category() {
41.24 @@ -59,8 +57,8 @@
41.25 }
41.26
41.27 /**
41.28 - *
41.29 - * @param name
41.30 + *
41.31 + * @param name
41.32 */
41.33 public void setName(String name) {
41.34 this.name = name;
42.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/palette/CategoryChildren.java Sat Dec 08 10:04:51 2007 +0000
42.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/palette/CategoryChildren.java Sat Dec 08 10:24:35 2007 +0000
42.3 @@ -18,11 +18,9 @@
42.4 License Header, with the fields enclosed by brackets [] replaced by
42.5 your own identifying information:
42.6 "Portions Copyrighted [year] [name of copyright owner]"
42.7 -
42.8 Contributor(s):
42.9 *
42.10 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
42.11 -
42.12 + * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
42.13 If you wish your version of this file to be governed by only the CDDL
42.14 or only the GPL Version 2, indicate your decision by adding
42.15 "[Contributor] elects to include this software in this distribution
42.16 @@ -47,28 +45,23 @@
42.17 */
42.18 public class CategoryChildren extends Children.Keys {
42.19
42.20 - private String[] Categories = new String[]{
42.21 - "String Operators",
42.22 - "Date Operators",
42.23 - "Cleansing Operators",
42.24 - "Relational Operators",
42.25 - "SQL Operators",
42.26 - "Function Operators"
42.27 - /*"Mashup Operators"*/};
42.28 + private String[] Categories = new String[]{"String Operators", "Date Operators", "Cleansing Operators", "Relational Operators", "SQL Operators", "Function Operators"};
42.29
42.30 public CategoryChildren() {
42.31 }
42.32
42.33 /**
42.34 - *
42.35 - * @param key
42.36 + *
42.37 + * @param key
42.38 * @return nodes Node[]
42.39 */
42.40 protected Node[] createNodes(Object key) {
42.41 Category obj = (Category) key;
42.42 - return new Node[] { new CategoryNode(obj) };
42.43 + return new Node[]{new CategoryNode(obj)};
42.44 }
42.45
42.46 + @SuppressWarnings(value = "unchecked")
42.47 + @Override
42.48 protected void addNotify() {
42.49 super.addNotify();
42.50 Category[] objs = new Category[Categories.length];
42.51 @@ -79,5 +72,4 @@
42.52 }
42.53 setKeys(objs);
42.54 }
42.55 -
42.56 }
43.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/palette/CategoryNode.java Sat Dec 08 10:04:51 2007 +0000
43.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/palette/CategoryNode.java Sat Dec 08 10:24:35 2007 +0000
43.3 @@ -1,6 +1,6 @@
43.4 /*
43.5 * The contents of this file are subject to the terms of the Common
43.6 - * Development
43.7 + * Development and Distribution License (the License). You may not use this
43.8 The contents of this file are subject to the terms of either the GNU
43.9 General Public License Version 2 only ("GPL") or the Common
43.10 Development and Distribution License("CDDL") (collectively, the
43.11 @@ -18,11 +18,9 @@
43.12 License Header, with the fields enclosed by brackets [] replaced by
43.13 your own identifying information:
43.14 "Portions Copyrighted [year] [name of copyright owner]"
43.15 -
43.16 Contributor(s):
43.17 *
43.18 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
43.19 -
43.20 + * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
43.21 If you wish your version of this file to be governed by only the CDDL
43.22 or only the GPL Version 2, indicate your decision by adding
43.23 "[Contributor] elects to include this software in this distribution
43.24 @@ -48,8 +46,8 @@
43.25 public class CategoryNode extends AbstractNode {
43.26
43.27 /** Creates a new instance of CategoryNode */
43.28 - public CategoryNode( Category category ) {
43.29 - super( new OperatorChildren(category), Lookups.singleton(category) );
43.30 + public CategoryNode(Category category) {
43.31 + super(new OperatorChildren(category), Lookups.singleton(category));
43.32 setDisplayName(category.getName());
43.33 }
43.34 }
44.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/palette/Operator.java Sat Dec 08 10:04:51 2007 +0000
44.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/palette/Operator.java Sat Dec 08 10:24:35 2007 +0000
44.3 @@ -1,6 +1,6 @@
44.4 /*
44.5 * The contents of this file are subject to the terms of the Common
44.6 - * Development
44.7 + * Development and Distribution License (the License). You may not use this
44.8 The contents of this file are subject to the terms of either the GNU
44.9 General Public License Version 2 only ("GPL") or the Common
44.10 Development and Distribution License("CDDL") (collectively, the
44.11 @@ -18,11 +18,9 @@
44.12 License Header, with the fields enclosed by brackets [] replaced by
44.13 your own identifying information:
44.14 "Portions Copyrighted [year] [name of copyright owner]"
44.15 -
44.16 Contributor(s):
44.17 *
44.18 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
44.19 -
44.20 + * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
44.21 If you wish your version of this file to be governed by only the CDDL
44.22 or only the GPL Version 2, indicate your decision by adding
44.23 "[Contributor] elects to include this software in this distribution
44.24 @@ -38,9 +36,6 @@
44.25
44.26 package org.netbeans.modules.etl.ui.palette;
44.27
44.28 -import java.awt.Image;
44.29 -import java.util.Vector;
44.30 -
44.31 /**
44.32 *
44.33 * @author nithya
44.34 @@ -49,32 +44,32 @@
44.35
44.36 private Integer number;
44.37 private String category;
44.38 - private String title;
44.39 + //private String title;
44.40 private String image;
44.41 private String name;
44.42
44.43 /** Creates a new instance of Instrument */
44.44 public Operator() {
44.45 }
44.46 -
44.47 +
44.48 /**
44.49 - *
44.50 + *
44.51 * @return name
44.52 */
44.53 public String getName() {
44.54 return this.name;
44.55 }
44.56 -
44.57 +
44.58 /**
44.59 - *
44.60 - * @param name
44.61 + *
44.62 + * @param name
44.63 */
44.64 public void setName(String name) {
44.65 this.name = name;
44.66 }
44.67
44.68 /**
44.69 - *
44.70 + *
44.71 * @return number
44.72 */
44.73 public Integer getNumber() {
44.74 @@ -82,15 +77,15 @@
44.75 }
44.76
44.77 /**
44.78 - *
44.79 - * @param number
44.80 + *
44.81 + * @param number
44.82 */
44.83 public void setNumber(Integer number) {
44.84 this.number = number;
44.85 }
44.86
44.87 /**
44.88 - *
44.89 + *
44.90 * @return category
44.91 */
44.92 public String getCategory() {
44.93 @@ -98,15 +93,15 @@
44.94 }
44.95
44.96 /**
44.97 - *
44.98 - * @param category
44.99 + *
44.100 + * @param category
44.101 */
44.102 public void setCategory(String category) {
44.103 this.category = category;
44.104 }
44.105
44.106 /**
44.107 - *
44.108 + *
44.109 * @return image
44.110 */
44.111 public String getImage() {
44.112 @@ -114,11 +109,10 @@
44.113 }
44.114
44.115 /**
44.116 - *
44.117 - * @param image
44.118 + *
44.119 + * @param image
44.120 */
44.121 public void setImage(String image) {
44.122 this.image = image;
44.123 }
44.124 -
44.125 }
44.126 \ No newline at end of file
45.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/palette/OperatorChildren.java Sat Dec 08 10:04:51 2007 +0000
45.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/palette/OperatorChildren.java Sat Dec 08 10:24:35 2007 +0000
45.3 @@ -1,6 +1,6 @@
45.4 /*
45.5 * The contents of this file are subject to the terms of the Common
45.6 - * Development
45.7 + * Development and Distribution License (the License). You may not use this
45.8 The contents of this file are subject to the terms of either the GNU
45.9 General Public License Version 2 only ("GPL") or the Common
45.10 Development and Distribution License("CDDL") (collectively, the
45.11 @@ -21,8 +21,7 @@
45.12
45.13 Contributor(s):
45.14 *
45.15 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
45.16 -
45.17 + * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
45.18 If you wish your version of this file to be governed by only the CDDL
45.19 or only the GPL Version 2, indicate your decision by adding
45.20 "[Contributor] elects to include this software in this distribution
45.21 @@ -116,6 +115,7 @@
45.22 *
45.23 * @return childrenNodes List<Node>
45.24 */
45.25 + @Override
45.26 protected java.util.List<Node> initCollection() {
45.27 List<Node> childrenNodes = new ArrayList<Node>( items.length );
45.28 for( int i=0; i<items.length; i++ ) {
46.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/palette/OperatorNode.java Sat Dec 08 10:04:51 2007 +0000
46.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/palette/OperatorNode.java Sat Dec 08 10:24:35 2007 +0000
46.3 @@ -1,6 +1,6 @@
46.4 /*
46.5 * The contents of this file are subject to the terms of the Common
46.6 - * Development
46.7 + * Development and Distribution License (the License). You may not use this
46.8 The contents of this file are subject to the terms of either the GNU
46.9 General Public License Version 2 only ("GPL") or the Common
46.10 Development and Distribution License("CDDL") (collectively, the
46.11 @@ -18,11 +18,9 @@
46.12 License Header, with the fields enclosed by brackets [] replaced by
46.13 your own identifying information:
46.14 "Portions Copyrighted [year] [name of copyright owner]"
46.15 -
46.16 Contributor(s):
46.17 *
46.18 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
46.19 -
46.20 + * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
46.21 If you wish your version of this file to be governed by only the CDDL
46.22 or only the GPL Version 2, indicate your decision by adding
46.23 "[Contributor] elects to include this software in this distribution
46.24 @@ -52,20 +50,20 @@
46.25
46.26 /**
46.27 * Creates a new instance of InstrumentNode
46.28 - * @param key
46.29 + * @param key
46.30 */
46.31 public OperatorNode(Operator key) {
46.32 - super(Children.LEAF, Lookups.fixed( new Object[] {key} ) );
46.33 + super(Children.LEAF, Lookups.fixed(new Object[]{key}));
46.34 this.model = key;
46.35 setIconBaseWithExtension(key.getImage());
46.36 setName(key.getName());
46.37 }
46.38 -
46.39 +
46.40 /**
46.41 - *
46.42 + *
46.43 * @return model
46.44 */
46.45 public Operator getOperator() {
46.46 return this.model;
46.47 - }
46.48 + }
46.49 }
46.50 \ No newline at end of file
47.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/palette/PaletteSupport.java Sat Dec 08 10:04:51 2007 +0000
47.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/palette/PaletteSupport.java Sat Dec 08 10:24:35 2007 +0000
47.3 @@ -18,11 +18,9 @@
47.4 License Header, with the fields enclosed by brackets [] replaced by
47.5 your own identifying information:
47.6 "Portions Copyrighted [year] [name of copyright owner]"
47.7 -
47.8 Contributor(s):
47.9 *
47.10 - * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
47.11 -
47.12 + * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
47.13 If you wish your version of this file to be governed by only the CDDL
47.14 or only the GPL Version 2, indicate your decision by adding
47.15 "[Contributor] elects to include this software in this distribution
47.16 @@ -35,7 +33,6 @@
47.17 made subject to such option by the copyright holder.
47.18 *
47.19 */
47.20 -
47.21 package org.netbeans.modules.etl.ui.palette;
47.22
47.23 import java.awt.Point;
47.24 @@ -58,98 +55,104 @@
47.25 import org.openide.util.Lookup;
47.26 import org.openide.util.datatransfer.ExTransferable;
47.27
47.28 +/**
47.29 + *
47.30 + * @author nithya
47.31 + */
47.32 public class PaletteSupport {
47.33 -
47.34 +
47.35 public static final String MASHUP_DATA_FLAVOR = DataFlavor.javaJVMLocalObjectMimeType;
47.36 -
47.37 private static PaletteController controller;
47.38 -
47.39 private static IGraphView graphView;
47.40 -
47.41 - private static ETLCollaborationTopComponent topComp;
47.42 -
47.43 - public PaletteSupport(ETLCollaborationTopComponent tc) {
47.44 - PaletteSupport.topComp = tc;
47.45 +
47.46 + public PaletteSupport() {
47.47 }
47.48 -
47.49 +
47.50 /**
47.51 - *
47.52 - * @return
47.53 + *
47.54 + * @return
47.55 */
47.56 - public static PaletteController createPalette() throws IOException {
47.57 - controller = PaletteFactory.createPalette("ETLOperators", new ETLAction(),
47.58 - null, new ETLDnDHandler());
47.59 + public static PaletteController createPalette(final ETLCollaborationTopComponent topC) throws IOException {
47.60 + controller = PaletteFactory.createPalette("ETLOperators", new ETLAction(), null, new ETLDnDHandler());
47.61 controller.addPropertyChangeListener(new PropertyChangeListener() {
47.62
47.63 + // FIXME: There should be a better way to do this.
47.64 + ETLCollaborationTopComponent tc = topC;
47.65 public void propertyChange(PropertyChangeEvent evt) {
47.66 - if(PaletteController.PROP_SELECTED_ITEM.equals(evt.getPropertyName())){
47.67 + if (PaletteController.PROP_SELECTED_ITEM.equals(evt.getPropertyName())) {
47.68 Lookup selItem = controller.getSelectedItem();
47.69 - graphView = topComp.getGraphView();
47.70 - if(null != selItem ){
47.71 +
47.72 + graphView = tc.getGraphView();
47.73 + if (null != selItem) {
47.74 Node selNode = selItem.lookup(Node.class);
47.75 - if(null != selNode ){
47.76 + if (null != selNode) {
47.77 IOperatorXmlInfo opXmlInfo = OperatorXmlInfoModel.getInstance("ETLOperators").findOperatorXmlInfo(selNode.getName());
47.78 graphView.setXMLInfo(opXmlInfo);
47.79 }
47.80 }
47.81 }
47.82 }
47.83 -});
47.84 - return controller;
47.85 + });
47.86 + return controller;
47.87 }
47.88 -
47.89 +
47.90 public static class ETLAction extends PaletteActions {
47.91 +
47.92 /**
47.93 - *
47.94 - * @return
47.95 + *
47.96 + * @return
47.97 */
47.98 public Action[] getImportActions() {
47.99 return null;
47.100 }
47.101 +
47.102 /**
47.103 - *
47.104 - * @return
47.105 + *
47.106 + * @return
47.107 */
47.108 public Action[] getCustomPaletteActions() {
47.109 return null;
47.110 }
47.111 +
47.112 /**
47.113 - *
47.114 - * @param lookup
47.115 - * @return
47.116 + *
47.117 + * @param lookup
47.118 + * @return
47.119 */
47.120 public Action[] getCustomCategoryActions(Lookup lookup) {
47.121 return null;
47.122 }
47.123 +
47.124 /**
47.125 - *
47.126 - * @param lookup
47.127 - * @return
47.128 + *
47.129 + * @param lookup
47.130 + * @return
47.131 */
47.132 public Action[] getCustomItemActions(Lookup lookup) {
47.133 return null;
47.134 }
47.135 +
47.136 /**
47.137 - *
47.138 - * @param lookup
47.139 - * @return
47.140 + *
47.141 + * @param lookup
47.142 + * @return
47.143 */
47.144 - public Action getPreferredAction(Lookup lookup){
47.145 - return new PreferredAction(lookup);
47.146 + public Action getPreferredAction(Lookup lookup) {
47.147 + return new PreferredAction(lookup);
47.148 }
47.149 }
47.150 -
47.151 -
47.152 - public static class PreferredAction implements Action{
47.153 -
47.154 +
47.155 + public static class PreferredAction implements Action {
47.156 +
47.157 private IOperatorXmlInfo opXmlInfo = null;
47.158 -
47.159 - public PreferredAction(Lookup lookup){
47.160 - Node node = lookup.lookup(Node.class);
47.161 - if ( null != node){
47.162 - opXmlInfo = OperatorXmlInfoModel.getInstance("ETLOperators").findOperatorXmlInfo(node.getName());
47.163 - graphView.setXMLInfo(opXmlInfo);
47.164 - }
47.165 +
47.166 + // FIXME: There should be a better way to do this.
47.167 + public PreferredAction(Lookup lookup) {
47.168 + Node node = lookup.lookup(Node.class);
47.169 + if (null != node) {
47.170 + opXmlInfo = OperatorXmlInfoModel.getInstance("ETLOperators").findOperatorXmlInfo(node.getName());
47.171 + graphView.setXMLInfo(opXmlInfo);
47.172 + }
47.173 }
47.174
47.175 public Object getValue(String key) {
47.176 @@ -169,23 +172,23 @@
47.177 }
47.178
47.179 public void addPropertyChangeListener(PropertyChangeListener listener) {
47.180 - throw new UnsupportedOperationException("Not supported yet.");
47.181 - }
47.182 + throw new UnsupportedOperationException("Not supported yet.");
47.183 + }
47.184
47.185 public void removePropertyChangeListener(PropertyChangeListener listener) {
47.186 throw new UnsupportedOperationException("Not supported yet.");
47.187 }
47.188
47.189 - public void actionPerformed(ActionEvent e) {
47.190 + public void actionPerformed(ActionEvent e) {
47.191 Point viewCoord = new Point();
47.192 - if (graphView.getGraphController() != null) {
47.193 - graphView.getGraphController().handleNodeAdded(opXmlInfo, viewCoord);
47.194 - }
47.195 + if (graphView.getGraphController() != null) {
47.196 + graphView.getGraphController().handleNodeAdded(opXmlInfo, viewCoord);
47.197 + }
47.198 }
47.199 }
47.200 -
47.201 +
47.202 private static class ETLDnDHandler extends DragAndDropHandler {
47.203 -
47.204 +
47.205 public void customize(ExTransferable exTransferable, Lookup lookupobj) {
47.206 final Node node = lookupobj.lookup(Node.class);
47.207 DataFlavor flv = null;
47.208 @@ -194,13 +197,12 @@
47.209 } catch (ClassNotFoundException ex) {
47.210 ex.printStackTrace();
47.211 }
47.212 - exTransferable.put(new ExTransferable.Single(flv) {
47.213 + exTransferable.put(new ExTransferable.Single(flv) {
47.214 +
47.215 protected Object getData() throws IOException, UnsupportedFlavorException {
47.216 return node;
47.217 - }
47.218 + }
47.219 });
47.220 }
47.221 -
47.222 -
47.223 }
47.224 - }
47.225 +}
48.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/resources/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
48.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/resources/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
48.3 @@ -1,6 +1,7 @@
48.4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
48.5 #
48.6 # Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
48.7 +
48.8 #
48.9 # The contents of this file are subject to the terms of either the GNU
48.10 # General Public License Version 2 only ("GPL") or the Common
49.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/resources/etl_properties.xml Sat Dec 08 10:04:51 2007 +0000
49.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/resources/etl_properties.xml Sat Dec 08 10:24:35 2007 +0000
49.3 @@ -28,7 +28,6 @@
49.4 The Original Software is NetBeans. The Initial Developer of the Original
49.5 Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
49.6 Microsystems, Inc. All Rights Reserved.
49.7 -
49.8 If you wish your version of this file to be governed by only the CDDL
49.9 or only the GPL Version 2, indicate your decision by adding
49.10 "[Contributor] elects to include this software in this distribution
49.11 @@ -75,7 +74,7 @@
49.12
49.13 <Template name="TargetTable">
49.14 <PropertyGroup name="default" position="0" >
49.15 - <OptionProperty name="strStatementType" valueType="java.lang.String" position="0" default="true" defaultOption="0" editorClass="org.netbeans.modules.sql.framework.ui.editor.property.impl.OptionListEditor">
49.16 + <OptionProperty name="strStatementType" valueType="java.lang.String" position="1" defaultOption="0" editorClass="org.netbeans.modules.sql.framework.ui.editor.property.impl.OptionListEditor">
49.17 <Option name="insert" value="insert" />
49.18 <Option name="insert_update" value="insert_update" />
49.19 <Option name="update" value="update" />
49.20 @@ -140,7 +139,7 @@
49.21 </OptionProperty>
49.22 <Property name="joinCondition" valueType ="org.netbeans.modules.sql.framework.model.SQLCondition" position="1" customEditor ="true" />
49.23 <Property name="filterCondition" valueType ="org.netbeans.modules.sql.framework.model.SQLCondition" position="2" customEditor ="true" />
49.24 - <Property name="SQLGroupBy" valueType="org.netbeans.modules.sql.framework.model.SQLGroupBy" position="3" customEditor ="true" />
49.25 + <Property name="SQLGroupBy" valueType="org.netbeans.modules.sql.framework.model.SQLGroupBy" position="3" customEditor ="true" />
49.26 <Property name="displayName" valueType="java.lang.String" position="4" readOnly="true" />
49.27 <Property name="modelName" valueType="java.lang.String" position="5" readOnly="true" />
49.28 <Property name="primaryKeys" valueType="java.lang.String" position="6" readOnly="true" default="true" customEditor="true" />
49.29 @@ -157,13 +156,14 @@
49.30
49.31 <Template name="Collaboration">
49.32 <PropertyGroup name="default" position="0" >
49.33 - <Property name="displayName" valueType="java.lang.String" position="0" readOnly="true" />
49.34 - <OptionProperty name="executionStrategyCode" valueType="java.lang.Integer" position="1" defaultOption="0" editorClass="org.netbeans.modules.sql.framework.ui.editor.property.impl.OptionListEditor">
49.35 + <Property name="displayName" valueType="java.lang.String" position="1" readOnly="true" />
49.36 + <OptionProperty name="executionStrategyCode" valueType="java.lang.Integer" position="2" defaultOption="0" editorClass="org.netbeans.modules.sql.framework.ui.editor.property.impl.OptionListEditor">
49.37 <Option name="Best Fit" value="0" />
49.38 <Option name="Pipeline" value="1" />
49.39 <Option name="Staging" value="2" />
49.40 </OptionProperty>
49.41 -
49.42 + <Property name="sourceModelName" valueType="java.lang.String" position="3" readOnly="true" />
49.43 + <Property name="targetModelName" valueType="java.lang.String" position="4" readOnly="true" />
49.44 </PropertyGroup>
49.45 </Template>
49.46
49.47 @@ -174,6 +174,20 @@
49.48 <Property name="password" valueType ="java.lang.String" position="3" editorClass="org.netbeans.modules.sql.framework.ui.editor.property.impl.DefaultPropertyEditor$PasswordTextEditor"/>
49.49 </PropertyGroup>
49.50 </Template>
49.51 +
49.52 + <Template name="RuntimeInput">
49.53 + <PropertyGroup name ="default" position="0" >
49.54 + <Property name="displayName" valueType ="java.lang.String" position="1" readOnly="true"/>
49.55 + <Property name="modelName" valueType ="java.lang.String" position="2" readOnly="true"/>
49.56 + </PropertyGroup>
49.57 + </Template>
49.58 +
49.59 + <Template name="RuntimeOutput">
49.60 + <PropertyGroup name ="default" position="0" >
49.61 + <Property name="displayName" valueType ="java.lang.String" position="1" readOnly="true"/>
49.62 + <Property name="modelName" valueType ="java.lang.String" position="2" readOnly="true"/>
49.63 + </PropertyGroup>
49.64 + </Template>
49.65
49.66 <Template name="DBTable">
49.67 <PropertyGroup name="default" position="0" >
49.68 @@ -181,4 +195,17 @@
49.69 <Property name="Schema" valueType="java.lang.String" position="2" />
49.70 </PropertyGroup>
49.71 </Template>
49.72 +
49.73 + <Template name="Join">
49.74 + <PropertyGroup name="default" position="0" >
49.75 + <Property name="joinCondition" valueType ="org.netbeans.modules.sql.framework.model.SQLCondition" position="1" customEditor ="true" />
49.76 + <OptionProperty name="joinType" valueType="java.lang.Integer" position="2" defaultOption="0" editorClass="org.netbeans.modules.sql.framework.ui.editor.property.impl.OptionListEditor">
49.77 + <Option name="Inner" value="0" />
49.78 + <Option name="Full Outer" value="1" />
49.79 + <Option name="Left Outer" value="2" />
49.80 + <Option name="Right Outer" value="3" />
49.81 + </OptionProperty>
49.82 + </PropertyGroup>
49.83 + </Template>
49.84 +
49.85 </TemplateGroup>
50.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
50.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
50.3 @@ -31,8 +31,6 @@
50.4 HINT_ETLOutputWindowTopComponent=This is a ETL Output window
50.5 LBL_ExecuteTestAction=&Test Run
50.6
50.7 -MSG_minimum_otd=At least one eTL-compatible OTD needs to exist in this project before a new collaboration can be created.
50.8 -
50.9 MSG_save_failed=Unable to save "{0}".
50.10
50.11 LBL_SelectTablesAction=&Select Tables...
50.12 @@ -109,3 +107,4 @@
50.13 NODE_VC_TOOLTIP=Version: {0}
50.14
50.15 MSG_load_error=Error encountered while loading eTL collaboration "{0}".
50.16 +ETL_Output_Title=This is an Output Window
50.17 \ No newline at end of file
51.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/ConfigParamsTreeView.java Sat Dec 08 10:04:51 2007 +0000
51.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/ConfigParamsTreeView.java Sat Dec 08 10:24:35 2007 +0000
51.3 @@ -9,7 +9,6 @@
51.4
51.5 package org.netbeans.modules.etl.ui.view;
51.6
51.7 -import com.sun.sql.framework.exception.BaseException;
51.8 import java.awt.BorderLayout;
51.9 import java.awt.Component;
51.10 import java.beans.PropertyChangeEvent;
51.11 @@ -38,7 +37,6 @@
51.12
51.13 import org.netbeans.modules.etl.ui.DataObjectHelper;
51.14 import org.netbeans.modules.etl.ui.ETLDataObject;
51.15 -import org.netbeans.modules.model.database.DBTable;
51.16 import org.netbeans.modules.sql.framework.common.jdbc.SQLDBConnectionDefinition;
51.17 import org.netbeans.modules.sql.framework.model.SQLConstants;
51.18 import org.netbeans.modules.sql.framework.model.SQLDBColumn;
51.19 @@ -56,6 +54,7 @@
51.20
51.21 import com.sun.sql.framework.utils.XmlUtil;
51.22 import com.sun.sql.framework.utils.Logger;
51.23 +import org.netbeans.modules.sql.framework.model.DBTable;
51.24
51.25
51.26 /**
51.27 @@ -107,7 +106,7 @@
51.28
51.29 private final String ETL_CONNECTION_ATTR_8 = "dataDir";
51.30
51.31 - private static URL otdImgUrl = ConfigParamsTreeView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/otd.png");
51.32 + private static URL rootImgUrl = ConfigParamsTreeView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/root.png");
51.33
51.34 private static URL columnImgUrl = ConfigParamsTreeView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/column.png");
51.35
51.36 @@ -115,7 +114,7 @@
51.37
51.38 private static URL targetTableImgUrl = ConfigParamsTreeView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/TargetTable.png");
51.39
51.40 - private static ImageIcon otdIcon;
51.41 + private static ImageIcon rootIcon;
51.42
51.43 private static ImageIcon tableIcon;
51.44
51.45 @@ -126,7 +125,7 @@
51.46 private IPropertyGroup pGroup;
51.47
51.48 static {
51.49 - otdIcon = new ImageIcon(otdImgUrl);
51.50 + rootIcon = new ImageIcon(rootImgUrl);
51.51 tableIcon = new ImageIcon(tableImgUrl);
51.52 columnIcon = new ImageIcon(columnImgUrl);
51.53 targetTableIcon = new ImageIcon(targetTableImgUrl);
51.54 @@ -516,22 +515,22 @@
51.55 Object obj = treeNode.getUserObject();
51.56 if (obj instanceof SQLDBModel) {
51.57 SQLDBModel dbModel = (SQLDBModel) obj;
51.58 - String otdName = dbModel.getModelName();
51.59 + String dbName = dbModel.getModelName();
51.60 switch (dbModel.getObjectType()) {
51.61 case SQLConstants.SOURCE_DBMODEL:
51.62 - otdName = NbBundle.getMessage(ConfigParamsTreeView.class, "TEMPLATE_source_model_label", otdName);
51.63 + dbName = NbBundle.getMessage(ConfigParamsTreeView.class, "TEMPLATE_source_model_label", dbName);
51.64 break;
51.65
51.66 case SQLConstants.TARGET_DBMODEL:
51.67 - otdName = NbBundle.getMessage(ConfigParamsTreeView.class, "TEMPLATE_target_model_label", otdName);
51.68 + dbName = NbBundle.getMessage(ConfigParamsTreeView.class, "TEMPLATE_target_model_label", dbName);
51.69 break;
51.70
51.71 default:
51.72 break;
51.73 }
51.74 - renderer.setText(otdName);
51.75 - renderer.setIcon(otdIcon);
51.76 - renderer.setToolTipText(otdName);
51.77 + renderer.setText(dbName);
51.78 + renderer.setIcon(rootIcon);
51.79 + renderer.setToolTipText(dbName);
51.80 } else if (obj instanceof SourceTable) {
51.81 renderer.setIcon(tableIcon);
51.82 renderer.setToolTipText(UIUtil.getTableToolTip((SQLDBTable) obj));
52.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/ConfigureParametersPanel.java Sat Dec 08 10:04:51 2007 +0000
52.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/ConfigureParametersPanel.java Sat Dec 08 10:24:35 2007 +0000
52.3 @@ -1,11 +1,11 @@
52.4 /*
52.5 * Sun Public License Notice
52.6 - *
52.7 + *
52.8 * The contents of this file are subject to the Sun Public License
52.9 * Version 1.0 (the "License"). You may not use this file except in
52.10 * compliance with the License. A copy of the License is available at
52.11 * http://www.sun.com/
52.12 - *
52.13 + *
52.14 * The Original Code is NetBeans. The Initial Developer of the Original
52.15 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
52.16 * Microsystems, Inc. All Rights Reserved.
53.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/DBModelTreeView.java Sat Dec 08 10:04:51 2007 +0000
53.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/DBModelTreeView.java Sat Dec 08 10:24:35 2007 +0000
53.3 @@ -70,7 +70,6 @@
53.4 import javax.swing.tree.TreePath;
53.5
53.6 import org.netbeans.modules.etl.ui.DataObjectHelper;
53.7 -import org.netbeans.modules.model.database.DBTable;
53.8 import org.netbeans.modules.sql.framework.common.jdbc.SQLDBConnectionDefinition;
53.9 import org.netbeans.modules.sql.framework.model.SQLConstants;
53.10 import org.netbeans.modules.sql.framework.model.SQLDBColumn;
53.11 @@ -86,6 +85,7 @@
53.12 import org.openide.util.NbBundle;
53.13
53.14 import com.sun.sql.framework.utils.Logger;
53.15 +import org.netbeans.modules.sql.framework.model.DBTable;
53.16
53.17 /**
53.18 * @author Ritesh Adval
53.19 @@ -101,7 +101,7 @@
53.20 private IPropertySheet propSheet;
53.21 private static DataFlavor[] mDataFlavorArray = new DataFlavor[1];
53.22
53.23 - private static URL otdImgUrl = DBModelTreeView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/otd.png");
53.24 + private static URL rootImgUrl = DBModelTreeView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/root.png");
53.25
53.26 private static URL columnImgUrl = DBModelTreeView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/column.png");
53.27
53.28 @@ -109,7 +109,7 @@
53.29
53.30 private static URL targetTableImgUrl = DBModelTreeView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/TargetTable.png");
53.31
53.32 - private static ImageIcon otdIcon;
53.33 + private static ImageIcon rootIcon;
53.34
53.35 private static ImageIcon tableIcon;
53.36
53.37 @@ -122,7 +122,7 @@
53.38 static {
53.39 try {
53.40 mDataFlavorArray[0] = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
53.41 - otdIcon = new ImageIcon(otdImgUrl);
53.42 + rootIcon = new ImageIcon(rootImgUrl);
53.43 tableIcon = new ImageIcon(tableImgUrl);
53.44 columnIcon = new ImageIcon(columnImgUrl);
53.45 targetTableIcon = new ImageIcon(targetTableImgUrl);
53.46 @@ -508,24 +508,24 @@
53.47 Object obj = treeNode.getUserObject();
53.48 if (obj instanceof SQLDBModel) {
53.49 SQLDBModel dbModel = (SQLDBModel) obj;
53.50 - String otdName = dbModel.getModelName();
53.51 + String dbName = dbModel.getModelName();
53.52
53.53 switch (dbModel.getObjectType()) {
53.54 case SQLConstants.SOURCE_DBMODEL:
53.55 - otdName = NbBundle.getMessage(DBModelTreeView.class, "TEMPLATE_source_model_label", otdName);
53.56 + dbName = NbBundle.getMessage(DBModelTreeView.class, "TEMPLATE_source_model_label", dbName);
53.57 break;
53.58
53.59 case SQLConstants.TARGET_DBMODEL:
53.60 - otdName = NbBundle.getMessage(DBModelTreeView.class, "TEMPLATE_target_model_label", otdName);
53.61 + dbName = NbBundle.getMessage(DBModelTreeView.class, "TEMPLATE_target_model_label", dbName);
53.62 break;
53.63
53.64 default:
53.65 break;
53.66 }
53.67
53.68 - renderer.setText(otdName);
53.69 - renderer.setIcon(otdIcon);
53.70 - renderer.setToolTipText(otdName);
53.71 + renderer.setText(dbName);
53.72 + renderer.setIcon(rootIcon);
53.73 + renderer.setToolTipText(dbName);
53.74 } else if (obj instanceof SourceTable) {
53.75 renderer.setIcon(tableIcon);
53.76 renderer.setToolTipText(UIUtil.getTableToolTip((SQLDBTable) obj));
54.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/ETLEditorTopView.java Sat Dec 08 10:04:51 2007 +0000
54.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/ETLEditorTopView.java Sat Dec 08 10:24:35 2007 +0000
54.3 @@ -48,7 +48,6 @@
54.4 import org.netbeans.modules.etl.codegen.ETLProcessFlowGeneratorFactory;
54.5 import org.netbeans.modules.etl.codegen.ETLStrategyBuilder;
54.6 import org.netbeans.modules.etl.codegen.ETLStrategyBuilderContext;
54.7 -import org.netbeans.modules.etl.ui.DataObjectHelper;
54.8 import org.netbeans.modules.etl.ui.view.graph.actions.CollabPropertiesAction;
54.9 import org.netbeans.modules.etl.ui.view.graph.actions.EditDbModelAction;
54.10 import org.netbeans.modules.etl.ui.view.graph.actions.JoinAction;
54.11 @@ -67,8 +66,6 @@
54.12 import org.netbeans.modules.sql.framework.ui.graph.actions.CollapseAllAction;
54.13 import org.netbeans.modules.sql.framework.ui.graph.actions.ExpandAllAction;
54.14 import org.netbeans.modules.sql.framework.ui.graph.actions.GraphAction;
54.15 -import org.netbeans.modules.sql.framework.ui.graph.actions.RedoAction;
54.16 -import org.netbeans.modules.sql.framework.ui.graph.actions.UndoAction;
54.17 import org.netbeans.modules.sql.framework.ui.graph.actions.ZoomAction;
54.18 import org.netbeans.modules.sql.framework.ui.model.CollabSQLUIModel;
54.19 import org.netbeans.modules.sql.framework.ui.view.BasicTopView;
54.20 @@ -76,6 +73,7 @@
54.21 import com.sun.sql.framework.exception.BaseException;
54.22 import com.sun.sql.framework.utils.Logger;
54.23 import com.sun.sql.framework.utils.StringUtil;
54.24 +import org.netbeans.modules.etl.ui.view.graph.actions.RefreshMetadataAction;
54.25 import org.netbeans.modules.sql.framework.ui.graph.actions.ZoomInAction;
54.26 import org.netbeans.modules.sql.framework.ui.graph.actions.ZoomOutAction;
54.27 /**
54.28 @@ -88,8 +86,8 @@
54.29 public static final String OPERATOR_FOLDER = "ETLOperators";
54.30
54.31 private ETLCollaborationTopComponent etlView;
54.32 - private UndoAction undoAction;
54.33 - private RedoAction redoAction;
54.34 + //private UndoAction undoAction;
54.35 + //private RedoAction redoAction;
54.36
54.37 /**
54.38 * Creates a new instance of ETLEditorTopView.
54.39 @@ -98,7 +96,7 @@
54.40 * @param etlTopComp ETLCollaborationTopComponent which will host this view
54.41 */
54.42 public ETLEditorTopView(CollabSQLUIModel model, ETLCollaborationTopComponent etlTopComp) {
54.43 - super(DataObjectHelper.getPropertyViewManager(), model);
54.44 + super(model);
54.45 this.etlView = etlTopComp;
54.46 }
54.47
54.48 @@ -108,7 +106,7 @@
54.49 * @param model CollabSQLUIModelImpl containing collab model info
54.50 */
54.51 public ETLEditorTopView(CollabSQLUIModel model) {
54.52 - super(DataObjectHelper.getPropertyViewManager(), model);
54.53 + super(model);
54.54 }
54.55
54.56 /**
54.57 @@ -116,6 +114,7 @@
54.58 *
54.59 * @return boolean - true/false
54.60 */
54.61 + @Override
54.62 public boolean canEdit() {
54.63 return etlView.canEdit();
54.64 }
54.65 @@ -126,6 +125,7 @@
54.66 * @param command - command
54.67 * @param args - arguments
54.68 */
54.69 + @Override
54.70 public Object[] execute(String command, Object[] args) {
54.71 if (command.equals(ICommand.ADD_RUNTIME_CMD)) {
54.72 Integer tableType = (Integer) args[0];
54.73 @@ -144,36 +144,35 @@
54.74 */
54.75 public List getGraphActions() {
54.76 ArrayList actions = new ArrayList();
54.77 -
54.78 -// // undo action are not static (because they are used in condition builder also) so
54.79 -// // we create it using constructor
54.80 -// if ((undoAction == null) || (redoAction == null) ) {
54.81 -// synchronized (this) {
54.82 -// if ((undoAction == null) || (redoAction == null) ) {
54.83 -// undoAction = new UndoAction();
54.84 -// redoAction = new RedoAction();
54.85 -// }
54.86 -// }
54.87 -// }
54.88 -//
54.89 -// //FOR RIGHT CLICK......
54.90 -// if ((undoAction == null) || (redoAction == null)) {
54.91 -// synchronized (this) {
54.92 -// if ((undoAction == null) || (redoAction == null) ) {
54.93 -// undoAction.setEnabled(true);
54.94 -// redoAction.setEnabled(true);
54.95 -// }
54.96 -// }
54.97 -// }
54.98 -// actions.add(undoAction);
54.99 -// actions.add(redoAction);
54.100 - //null is used for seperator
54.101 -// actions.add(null);
54.102 + // // undo action are not static (because they are used in condition builder also) so
54.103 + // // we create it using constructor
54.104 + // if ((undoAction == null) || (redoAction == null) ) {
54.105 + // synchronized (this) {
54.106 + // if ((undoAction == null) || (redoAction == null) ) {
54.107 + // undoAction = new UndoAction();
54.108 + // redoAction = new RedoAction();
54.109 + // }
54.110 + // }
54.111 + // }
54.112 + //
54.113 + // //FOR RIGHT CLICK......
54.114 + // if ((undoAction == null) || (redoAction == null)) {
54.115 + // synchronized (this) {
54.116 + // if ((undoAction == null) || (redoAction == null) ) {
54.117 + // undoAction.setEnabled(true);
54.118 + // redoAction.setEnabled(true);
54.119 + // }
54.120 + // }
54.121 + // }
54.122 + // actions.add(undoAction);
54.123 + // actions.add(redoAction);
54.124 + // //null is used for seperator
54.125 + // actions.add(null);
54.126
54.127 actions.add(GraphAction.getAction(ExpandAllAction.class));
54.128 actions.add(GraphAction.getAction(CollapseAllAction.class));
54.129 actions.add(GraphAction.getAction(ToggleOutputAction.class));
54.130 -
54.131 + actions.add(GraphAction.getAction(RefreshMetadataAction.class));
54.132 actions.add(GraphAction.getAction(SelectTableAction.class));
54.133
54.134 //null is used for seperator
54.135 @@ -186,7 +185,7 @@
54.136
54.137 //null is used for seperator
54.138 actions.add(null);
54.139 -
54.140 +
54.141 actions.add(GraphAction.getAction(ZoomInAction.class));
54.142 actions.add(GraphAction.getAction(ZoomOutAction.class));
54.143 //actions.add(GraphAction.getAction(ZoomAction.class));
54.144 @@ -196,10 +195,10 @@
54.145 actions.add(GraphAction.getAction(AutoLayoutAction.class));
54.146 actions.add(GraphAction.getAction(ValidationAction.class));
54.147 actions.add(GraphAction.getAction(TestRunAction.class));
54.148 -// actions.add(GraphAction.getAction(PrintAction.class));
54.149 + // actions.add(GraphAction.getAction(PrintAction.class));
54.150 + //null is used for seperator
54.151 + actions.add(null);
54.152
54.153 - //null is used for seperator
54.154 - actions.add(null);
54.155 actions.add(GraphAction.getAction(CollabPropertiesAction.class));
54.156
54.157 return actions;
54.158 @@ -221,24 +220,25 @@
54.159 */
54.160 public List getToolBarActions() {
54.161 ArrayList actions = new ArrayList();
54.162 -// // undo action are not static (because they are used in condition builder also) so
54.163 -// // we create it using constructor
54.164 -// if ((undoAction == null) || (redoAction == null) ) {
54.165 -// synchronized (this) {
54.166 -// if ((undoAction == null) || (redoAction == null) ) {
54.167 -// undoAction = new UndoAction();
54.168 -// redoAction = new RedoAction();
54.169 -// }
54.170 -// }
54.171 -// }
54.172 -//
54.173 -// actions.add(undoAction);
54.174 -// actions.add(redoAction);
54.175 -// actions.add(null);
54.176 + // // undo action are not static (because they are used in condition builder also) so
54.177 + // // we create it using constructor
54.178 + // if ((undoAction == null) || (redoAction == null) ) {
54.179 + // synchronized (this) {
54.180 + // if ((undoAction == null) || (redoAction == null) ) {
54.181 + // undoAction = new UndoAction();
54.182 + // redoAction = new RedoAction();
54.183 + // }
54.184 + // }
54.185 + // }
54.186 + //
54.187 + // actions.add(undoAction);
54.188 + // actions.add(redoAction);
54.189 + // actions.add(null);
54.190
54.191 actions.add(GraphAction.getAction(ExpandAllAction.class));
54.192 actions.add(GraphAction.getAction(CollapseAllAction.class));
54.193 actions.add(GraphAction.getAction(ToggleOutputAction.class));
54.194 + actions.add(GraphAction.getAction(RefreshMetadataAction.class));
54.195 actions.add(GraphAction.getAction(SelectTableAction.class));
54.196
54.197 // null is used for seperator
54.198 @@ -249,14 +249,14 @@
54.199 actions.add(GraphAction.getAction(RuntimeOutputAction.class));
54.200 // null is used for seperator
54.201 actions.add(null);
54.202 -
54.203 +
54.204 actions.add(GraphAction.getAction(ZoomInAction.class));
54.205 actions.add(GraphAction.getAction(ZoomOutAction.class));
54.206 actions.add(GraphAction.getAction(ZoomAction.class));
54.207 // null is used for seperator
54.208 actions.add(null);
54.209 actions.add(GraphAction.getAction(AutoLayoutAction.class));
54.210 -// actions.add(GraphAction.getAction(PrintAction.class));
54.211 + // actions.add(GraphAction.getAction(PrintAction.class));
54.212 actions.add(GraphAction.getAction(ValidationAction.class));
54.213 actions.add(GraphAction.getAction(TestRunAction.class));
54.214 return actions;
54.215 @@ -267,10 +267,12 @@
54.216 *
54.217 * @param obj SQLObject whose SQL statement is to be displayed
54.218 */
54.219 + @Override
54.220 protected void showSql(SQLObject obj) {
54.221 if (obj.getObjectType() == SQLConstants.TARGET_TABLE) {
54.222 SQLStatementPanel statementPanel = super.getOrCreateSQLStatementPanel(obj);
54.223 SQLStatementPanel.ShowSQLWorkerThread showSqlThread = statementPanel.new ShowSQLWorkerThread() {
54.224 + @Override
54.225 public Object construct() {
54.226 TargetTable targetTable = null;
54.227 try {
55.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/ETLOutputWindowTopComponent.form Sat Dec 08 10:04:51 2007 +0000
55.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/ETLOutputWindowTopComponent.form Sat Dec 08 10:24:35 2007 +0000
55.3 @@ -1,6 +1,6 @@
55.4 <?xml version="1.0" encoding="UTF-8" ?>
55.5
55.6 -<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
55.7 +<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
55.8 <AuxValues>
55.9 <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
55.10 <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
56.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/ETLOutputWindowTopComponent.java Sat Dec 08 10:04:51 2007 +0000
56.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/ETLOutputWindowTopComponent.java Sat Dec 08 10:24:35 2007 +0000
56.3 @@ -42,10 +42,19 @@
56.4
56.5 import java.awt.BorderLayout;
56.6 import java.awt.Component;
56.7 +import java.awt.event.MouseEvent;
56.8 +import java.beans.PropertyChangeEvent;
56.9 +import java.beans.PropertyChangeListener;
56.10 import java.io.Serializable;
56.11 +import java.util.HashSet;
56.12 +import java.util.Set;
56.13 import java.util.logging.Logger;
56.14 -import javax.swing.JComponent;
56.15 -import javax.swing.JPanel;
56.16 +import javax.swing.JLabel;
56.17 +import javax.swing.JPopupMenu;
56.18 +import javax.swing.JTabbedPane;
56.19 +import javax.swing.SwingUtilities;
56.20 +import org.openide.awt.MouseUtils;
56.21 +import org.openide.awt.TabbedPaneFactory;
56.22 import org.openide.util.NbBundle;
56.23 import org.openide.windows.TopComponent;
56.24 import org.openide.windows.WindowManager;
56.25 @@ -53,26 +62,56 @@
56.26 /**
56.27 * Top component which displays something.
56.28 */
56.29 -public final class ETLOutputWindowTopComponent extends TopComponent {
56.30 -
56.31 +public final class ETLOutputWindowTopComponent extends TopComponent implements PropertyChangeListener {
56.32 +
56.33 private static ETLOutputWindowTopComponent instance;
56.34 /** path to the icon used by the component and its open action */
56.35 // static final String ICON_PATH = "SET/PATH/TO/ICON/HERE";
56.36 -
56.37 private static final String PREFERRED_ID = "ETLOutputWindowTopComponent";
56.38 -
56.39 + private Set<Component> components = new HashSet<Component>(1);
56.40 + private JTabbedPane tabbedPane = TabbedPaneFactory.createCloseButtonTabbedPane();
56.41 + private PopupListener listener;
56.42 + private JPopupMenu pop;
56.43 + private CloseListener closeL;
56.44 + private transient boolean isVisible = false;
56.45 + private boolean inited = false;
56.46 +
56.47 private ETLOutputWindowTopComponent() {
56.48 initComponents();
56.49 + setLayout(new BorderLayout());
56.50 setName(NbBundle.getMessage(ETLOutputWindowTopComponent.class, "CTL_ETLOutputWindowTopComponent"));
56.51 setToolTipText(NbBundle.getMessage(ETLOutputWindowTopComponent.class, "HINT_ETLOutputWindowTopComponent"));
56.52 - // setIcon(Utilities.loadImage(ICON_PATH, true));
56.53 + tabbedPane.addPropertyChangeListener(this);
56.54 + pop = new JPopupMenu();
56.55 + listener = new PopupListener();
56.56 + closeL = new CloseListener();
56.57 }
56.58 -
56.59 - /** This method is called from within the constructor to
56.60 +
56.61 + private class CloseListener implements PropertyChangeListener {
56.62 +
56.63 + public void propertyChange(java.beans.PropertyChangeEvent evt) {
56.64 + if (TabbedPaneFactory.PROP_CLOSE.equals(evt.getPropertyName())) {
56.65 + removePanel((Component) evt.getNewValue());
56.66 + }
56.67 + }
56.68 + }
56.69 +
56.70 +/** This method is called from within the constructor to
56.71 * initialize the form.
56.72 * WARNING: Do NOT modify this code. The content of this method is
56.73 * always regenerated by the Form Editor.
56.74 */
56.75 + private class PopupListener extends MouseUtils.PopupMouseAdapter {
56.76 +
56.77 + /**
56.78 + * Called when the sequence of mouse events should lead to actual showing popup menu
56.79 + */
56.80 + @Override
56.81 + protected void showPopup(MouseEvent e) {
56.82 + pop.show(ETLOutputWindowTopComponent.this, e.getX(), e.getY());
56.83 + }
56.84 + } // end of PopupListener
56.85 +
56.86 // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
56.87 private void initComponents() {
56.88
56.89 @@ -87,11 +126,9 @@
56.90 .add(0, 300, Short.MAX_VALUE)
56.91 );
56.92 }// </editor-fold>//GEN-END:initComponents
56.93 -
56.94 -
56.95 +
56.96 // Variables declaration - do not modify//GEN-BEGIN:variables
56.97 // End of variables declaration//GEN-END:variables
56.98 -
56.99 /**
56.100 * Gets default instance. Do not use directly: reserved for *.settings files only,
56.101 * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
56.102 @@ -104,7 +141,7 @@
56.103 }
56.104 return instance;
56.105 }
56.106 -
56.107 +
56.108 /**
56.109 * Obtain the ETLOutputWindowTopComponent instance. Never call {@link #getDefault} directly!
56.110 * @return ETLOutputWindowTopComponent defaultInstance
56.111 @@ -112,52 +149,128 @@
56.112 public static synchronized ETLOutputWindowTopComponent findInstance() {
56.113 TopComponent win = WindowManager.getDefault().findTopComponent(PREFERRED_ID);
56.114 if (win == null) {
56.115 - Logger.getLogger(ETLOutputWindowTopComponent.class.getName()).warning(
56.116 - "Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
56.117 + Logger.getLogger(ETLOutputWindowTopComponent.class.getName()).warning("Cannot find " + PREFERRED_ID + " component. It will not be located properly in the window system.");
56.118 return getDefault();
56.119 }
56.120 if (win instanceof ETLOutputWindowTopComponent) {
56.121 - return (ETLOutputWindowTopComponent)win;
56.122 + return (ETLOutputWindowTopComponent) win;
56.123 }
56.124 - Logger.getLogger(ETLOutputWindowTopComponent.class.getName()).warning(
56.125 - "There seem to be multiple components with the '" + PREFERRED_ID +
56.126 - "' ID. That is a potential source of errors and unexpected behavior.");
56.127 + Logger.getLogger(ETLOutputWindowTopComponent.class.getName()).warning("There seem to be multiple components with the '" + PREFERRED_ID + "' ID. That is a potential source of errors and unexpected behavior.");
56.128 return getDefault();
56.129 }
56.130 -
56.131 - public void addComponent(Component comp) {
56.132 - removeAll();
56.133 - setLayout(new BorderLayout());
56.134 - add(comp, BorderLayout.CENTER);
56.135 + //removePanel
56.136 +
56.137 + public void removePanel(Component panel) {
56.138 + Component comp = getComponentCount() > 0 ? getComponent(0) : null;
56.139 + if (comp instanceof JTabbedPane) {
56.140 + JTabbedPane tabs = (JTabbedPane) comp;
56.141 + if (panel == null) {
56.142 + panel = tabs.getSelectedComponent();
56.143 + }
56.144 + tabs.remove(panel);
56.145 + if (tabs.getComponentCount() == 1) {
56.146 + Component c = tabs.getComponent(0);
56.147 + tabs.removeMouseListener(listener);
56.148 + tabs.removePropertyChangeListener(closeL);
56.149 + remove(tabs);
56.150 + add(c, BorderLayout.CENTER);
56.151 + }
56.152 + } else {
56.153 + if (comp != null) {
56.154 + remove(comp);
56.155 + }
56.156 + isVisible = false;
56.157 + close();
56.158 + }
56.159 + validate();
56.160 + }
56.161 +
56.162 + public void addPanel(Component panel) {
56.163 + if (getComponentCount() == 0) {
56.164 + add(panel, BorderLayout.CENTER);
56.165 + } else {
56.166 + Component comp = getComponent(0);
56.167 + if (comp instanceof JTabbedPane) {
56.168 + ((JTabbedPane) comp).addTab(panel.getName() + " ", null, panel, panel.getName()); //NOI18N
56.169 + ((JTabbedPane) comp).setSelectedComponent(panel);
56.170 + comp.validate();
56.171 + } else if (comp instanceof JLabel) {
56.172 + remove(comp);
56.173 + add(panel, BorderLayout.CENTER);
56.174 + } else {
56.175 + remove(comp);
56.176 + JTabbedPane pane = TabbedPaneFactory.createCloseButtonTabbedPane();
56.177 + pane.addMouseListener(listener);
56.178 + pane.addPropertyChangeListener(closeL);
56.179 + add(pane, BorderLayout.CENTER);
56.180 + pane.addTab(comp.getName() + " ", null, comp, comp.getName()); //NOI18N
56.181 + pane.addTab(panel.getName() + " ", null, panel, panel.getName()); //NOI18N
56.182 + pane.setSelectedComponent(panel);
56.183 + pane.validate();
56.184 + }
56.185 + }
56.186 + if (!isVisible) {
56.187 + isVisible = true;
56.188 + open();
56.189 + }
56.190 + validate();
56.191 + requestActive();
56.192 + }
56.193 + //remove Component
56.194 +
56.195 + private void removeComponent(Component c) {
56.196 + assert SwingUtilities.isEventDispatchThread();
56.197 + assert components.remove(c);
56.198 + if (components.size() == 0) {
56.199 + removeAll();
56.200 + } else if (components.size() == 1) {
56.201 + tabbedPane.removeAll();
56.202 + removeAll();
56.203 + add(components.iterator().next());
56.204 + } else {
56.205 + tabbedPane.remove(c);
56.206 + }
56.207 revalidate();
56.208 }
56.209 -
56.210 +
56.211 + @Override
56.212 public int getPersistenceType() {
56.213 return TopComponent.PERSISTENCE_ALWAYS;
56.214 }
56.215 -
56.216 +
56.217 + @Override
56.218 public void componentOpened() {
56.219 // TODO add custom code on component opening
56.220 }
56.221 -
56.222 +
56.223 + @Override
56.224 public void componentClosed() {
56.225 // TODO add custom code on component closing
56.226 }
56.227 -
56.228 - /** replaces this in object stream */
56.229 +
56.230 + @Override
56.231 public Object writeReplace() {
56.232 return new ResolvableHelper();
56.233 }
56.234 -
56.235 +
56.236 + @Override
56.237 protected String preferredID() {
56.238 return PREFERRED_ID;
56.239 }
56.240 -
56.241 - final static class ResolvableHelper implements Serializable {
56.242 +
56.243 + static final class ResolvableHelper implements Serializable {
56.244 +
56.245 private static final long serialVersionUID = 1L;
56.246 +
56.247 public Object readResolve() {
56.248 return ETLOutputWindowTopComponent.getDefault();
56.249 }
56.250 }
56.251 -
56.252 +
56.253 + public void propertyChange(PropertyChangeEvent evt) {
56.254 + if (TabbedPaneFactory.PROP_CLOSE.equals(evt.getPropertyName())) {
56.255 + Component c = (Component) evt.getNewValue();
56.256 + removeComponent(c);
56.257 + }
56.258 + }
56.259 }
57.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/TablePanel.java Sat Dec 08 10:04:51 2007 +0000
57.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/TablePanel.java Sat Dec 08 10:24:35 2007 +0000
57.3 @@ -68,8 +68,7 @@
57.4
57.5 import org.netbeans.modules.etl.ui.DataObjectProvider;
57.6 import org.netbeans.modules.etl.ui.model.impl.ETLCollaborationModel;
57.7 -import org.netbeans.modules.model.database.DBColumn;
57.8 -import org.netbeans.modules.model.database.DatabaseModel;
57.9 +import org.netbeans.modules.sql.framework.model.DBColumn;
57.10 import org.netbeans.modules.sql.framework.common.jdbc.SQLUtils;
57.11 import org.netbeans.modules.sql.framework.model.RuntimeDatabaseModel;
57.12 import org.netbeans.modules.sql.framework.model.RuntimeOutput;
57.13 @@ -87,6 +86,7 @@
57.14 import org.openide.NotifyDescriptor;
57.15
57.16 import com.sun.sql.framework.exception.BaseException;
57.17 +import org.netbeans.modules.sql.framework.model.DatabaseModel;
57.18
57.19 /**
57.20 * This class is used to define columns for input and output table
57.21 @@ -858,6 +858,7 @@
57.22
57.23 private void initGui() {
57.24 // set layout
57.25 +
57.26 this.setLayout(new BorderLayout());
57.27 // create a panel to hold jtable at CENTER of this component
57.28 JPanel tableColumnPanel = new JPanel();
58.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/cookies/ExecuteTestCookie.java Sat Dec 08 10:04:51 2007 +0000
58.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/cookies/ExecuteTestCookie.java Sat Dec 08 10:24:35 2007 +0000
58.3 @@ -45,9 +45,7 @@
58.4 import java.util.Iterator;
58.5 import java.util.List;
58.6 import java.util.ListIterator;
58.7 -
58.8 import javax.swing.SwingUtilities;
58.9 -
58.10 import org.netbeans.modules.etl.codegen.ETLProcessFlowGenerator;
58.11 import org.netbeans.modules.etl.codegen.ETLProcessFlowGeneratorFactory;
58.12 import org.netbeans.modules.etl.codegen.ETLScriptBuilderModel;
58.13 @@ -57,7 +55,6 @@
58.14 import org.netbeans.modules.etl.ui.ETLDataObject;
58.15 import org.netbeans.modules.etl.ui.model.impl.ETLCollaborationModel;
58.16 import org.netbeans.modules.etl.ui.view.ETLCollaborationTopComponent;
58.17 -import org.netbeans.modules.etl.utils.ETLException;
58.18 import org.netbeans.modules.sql.framework.model.ValidationInfo;
58.19 import org.netbeans.modules.sql.framework.ui.SwingWorker;
58.20 import org.netbeans.modules.sql.framework.ui.utils.UIUtil;
58.21 @@ -66,7 +63,6 @@
58.22 import org.openide.NotifyDescriptor;
58.23 import org.openide.nodes.Node;
58.24 import org.openide.util.NbBundle;
58.25 -
58.26 import com.sun.etl.engine.ETLEngine;
58.27 import com.sun.etl.engine.ETLEngineExecEvent;
58.28 import com.sun.etl.engine.ETLEngineListener;
58.29 @@ -83,19 +79,16 @@
58.30 * @version $Revision$
58.31 */
58.32 public class ExecuteTestCookie implements Node.Cookie {
58.33 -
58.34 +
58.35 private static final String NL = System.getProperty("line.separator", "\n");
58.36 -
58.37 private final String logCategory = ExecuteTestCookie.class.getName();
58.38 -
58.39 private ETLEngine engine;
58.40 private ETLCollaborationTopComponent etlView;
58.41 private ETLDataObject dObj;
58.42 -
58.43 private SQLLogView logView;
58.44 private long startTime;
58.45 private long endTime;
58.46 -
58.47 +
58.48 /**
58.49 * Creates a new instance of ETLEditorSaveAction associated with the given
58.50 * data object.
58.51 @@ -104,36 +97,34 @@
58.52 */
58.53 public ExecuteTestCookie() {
58.54 }
58.55 -
58.56 +
58.57 /** Executes the test process for the associated SQLDefinition. */
58.58 public void start() {
58.59 try {
58.60 - etlView = DataObjectProvider.getProvider()
58.61 - .getActiveDataObject().getETLEditorTC();
58.62 + etlView = DataObjectProvider.getProvider().getActiveDataObject().getETLEditorTC();
58.63 } catch (Exception ex) {
58.64 // ignore
58.65 }
58.66 if (etlView != null) {
58.67 logView = etlView.showLog();
58.68 }
58.69 -
58.70 +
58.71 try {
58.72 - ETLCollaborationModel collabModel = DataObjectProvider.getProvider()
58.73 - .getActiveDataObject().getModel();
58.74 + ETLCollaborationModel collabModel = DataObjectProvider.getProvider().getActiveDataObject().getModel();
58.75 if (collabModel == null) {
58.76 throw new BaseException("Collaboration model is null");
58.77 }
58.78 -
58.79 +
58.80 ETLDefinition execModel = collabModel.getETLDefinition();
58.81 if (execModel == null) {
58.82 throw new BaseException("Repository model is null");
58.83 }
58.84 -
58.85 +
58.86 // WT #67452: Validate collab prior to executing engine.
58.87 List invalidObjectList = execModel.validate();
58.88 if (!invalidObjectList.isEmpty()) {
58.89 String errMsg = "";
58.90 -
58.91 +
58.92 Iterator iter = invalidObjectList.iterator();
58.93 boolean validationErr = false;
58.94 while (iter.hasNext()) {
58.95 @@ -144,73 +135,70 @@
58.96 validationErr = true;
58.97 }
58.98 }
58.99 -
58.100 +
58.101 if (validationErr) {
58.102 throw new BaseException("Invalid eTL Collaboration." + NL + errMsg);
58.103 }
58.104 logView.appendToView(errMsg + NL);
58.105 }
58.106 -
58.107 +
58.108 logView.appendToView(NbBundle.getMessage(ExecuteTestCookie.class, "MSG_execution_started"));
58.109 -
58.110 +
58.111 startTime = System.currentTimeMillis();
58.112 RunEngineWorkerThread runEThread = new RunEngineWorkerThread(execModel);
58.113 - DataObjectHelper.setWaitCursor();
58.114 + DataObjectHelper.setWaitCursor();
58.115 String title = NbBundle.getMessage(ExecuteTestCookie.class, "MSG_ExecuteTest");
58.116 String msg = NbBundle.getMessage(ExecuteTestCookie.class, "MSG_ExecuteProgress");
58.117 - UIUtil.startProgressDialog(title, msg);
58.118 + UIUtil.startProgressDialog(title, msg);
58.119 runEThread.start();
58.120 } catch (Exception e) {
58.121 String msg = NbBundle.getMessage(ExecuteTestCookie.class, "MSG_execute_failed", e.getMessage());
58.122 -
58.123 +
58.124 // Ensure progress bar dialog box is removed from display even if listener
58.125 // never gets the message that engine is done.
58.126 SwingUtilities.invokeLater(new CloseProgressBarTask());
58.127 -
58.128 +
58.129 logView.appendToView(msg);
58.130 DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
58.131 Logger.printThrowable(Logger.ERROR, logCategory, null, "Problem in executing engine.", e);
58.132 }
58.133 }
58.134 -
58.135 +
58.136 private final class CloseProgressBarTask implements Runnable {
58.137 +
58.138 public void run() {
58.139 UIUtil.stopProgressDialog();
58.140 DataObjectHelper.setDefaultCursor();
58.141 }
58.142 }
58.143 -
58.144 +
58.145 private class UIEngineListener implements ETLEngineListener {
58.146 +
58.147 /**
58.148 * This method will be called at the end of execution of the workflow.
58.149 * @param event Event associated with Execution of ETL.
58.150 */
58.151 public synchronized void executionPerformed(ETLEngineExecEvent event) {
58.152 - if ((event.getStatus() == ETLEngine.STATUS_COLLAB_COMPLETED)
58.153 - || (event.getStatus() == ETLEngine.STATUS_COLLAB_EXCEPTION)) {
58.154 -
58.155 + if ((event.getStatus() == ETLEngine.STATUS_COLLAB_COMPLETED) || (event.getStatus() == ETLEngine.STATUS_COLLAB_EXCEPTION)) {
58.156 +
58.157 Logger.print(Logger.INFO, logCategory, "eTL engine execution completed...");
58.158 // Ensure GUI change occurs in the event-dispatch thread.
58.159 SwingUtilities.invokeLater(new CloseProgressBarTask());
58.160 try {
58.161 endTime = System.currentTimeMillis();
58.162 StringBuilder msgBuf = new StringBuilder(100);
58.163 - String msg = (event.getStatus() == ETLEngine.STATUS_COLLAB_COMPLETED) ?
58.164 - "MSG_executed_success" : "MSG_executed_errors" ; // No I18N
58.165 + String msg = (event.getStatus() == ETLEngine.STATUS_COLLAB_COMPLETED) ? "MSG_executed_success" : "MSG_executed_errors"; // No I18N
58.166 msgBuf.append(NbBundle.getMessage(ExecuteTestCookie.class, msg));
58.167 - msgBuf.append(NbBundle.getMessage(ExecuteTestCookie.class, "MSG_execution_time",
58.168 - new Long((endTime - startTime) / 1000),
58.169 - new Long((endTime - startTime) % 1000)));
58.170 - logView.appendToView(msgBuf.toString());
58.171 - if (event.getStatus() == ETLEngine.STATUS_COLLAB_COMPLETED){
58.172 + msgBuf.append(NbBundle.getMessage(ExecuteTestCookie.class, "MSG_execution_time", new Long((endTime - startTime) / 1000), new Long((endTime - startTime) % 1000)));
58.173 + logView.appendToView(msgBuf.toString());
58.174 + if (event.getStatus() == ETLEngine.STATUS_COLLAB_COMPLETED) {
58.175 int rowsProcessed = 0;
58.176 - Iterator it = engine.getContext().getStatistics().getKnownTableNames().iterator();
58.177 - while(it.hasNext()) {
58.178 - rowsProcessed += engine.getContext().getStatistics().getRowsInsertedCount(
58.179 - (String)it.next());
58.180 + Iterator it = engine.getContext().getStatistics().getKnownTableNames().iterator();
58.181 + while (it.hasNext()) {
58.182 + rowsProcessed += engine.getContext().getStatistics().getRowsInsertedCount((String) it.next());
58.183 }
58.184 msgBuf.append("Rows Processed: " + String.valueOf(rowsProcessed));
58.185 - DialogDisplayer.getDefault().notify( new NotifyDescriptor.Message(msgBuf.toString(), NotifyDescriptor.INFORMATION_MESSAGE));
58.186 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msgBuf.toString(), NotifyDescriptor.INFORMATION_MESSAGE));
58.187 }
58.188 } catch (Exception ex) {
58.189 Logger.printThrowable(Logger.ERROR, logCategory, null, "Problem while handling ETLEngineExecEvent for current execution.", ex);
58.190 @@ -222,7 +210,7 @@
58.191 }
58.192 }
58.193 }
58.194 -
58.195 +
58.196 public void updateOutputMessage(ETLEngineLogEvent evt) {
58.197 if (evt != null && logView != null) {
58.198 String msg = NbBundle.getMessage(ExecuteTestCookie.class, "MSG_output_template", evt.getSourceName(), evt.getLogMessage());
58.199 @@ -231,15 +219,17 @@
58.200 }
58.201 }
58.202 }
58.203 -
58.204 +
58.205 private class RunEngineWorkerThread extends SwingWorker {
58.206 +
58.207 private ETLDefinition execModel;
58.208 private List throwableList = new ArrayList();
58.209 -
58.210 +
58.211 public RunEngineWorkerThread(ETLDefinition execModel) {
58.212 this.execModel = execModel;
58.213 }
58.214 -
58.215 +
58.216 + @SuppressWarnings(value = "unchecked")
58.217 public Object construct() {
58.218 if (execModel != null) {
58.219 ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
58.220 @@ -247,17 +237,17 @@
58.221 ETLProcessFlowGenerator flowGen = ETLProcessFlowGeneratorFactory.getCollabFlowGenerator(execModel.getSQLDefinition(), false);
58.222 flowGen.applyConnectionDefinitions();
58.223 engine = flowGen.getScript();
58.224 -
58.225 +
58.226 //RIT print out the content of etl engine file
58.227 - System.out.println("printing etl engine file content: \n"+ engine.toXMLString());
58.228 -
58.229 + //System.out.println("printing etl engine file content: \n" + engine.toXMLString());
58.230 +
58.231 UIEngineListener listener = new UIEngineListener();
58.232 -
58.233 +
58.234 // WT #67399: Ensure we use the class loader associated with
58.235 // SQLFramework moudle, to avoid instantiating Axion classes which are
58.236 // associated with eBAM.
58.237 Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
58.238 -
58.239 +
58.240 engine.exec(listener);
58.241 synchronized (listener) {
58.242 listener.wait();
58.243 @@ -271,20 +261,21 @@
58.244 removeInstanceDBFolder();
58.245 }
58.246 } else {
58.247 - throwableList.add(new ETLException("No eTL collaboration model to execute"));
58.248 + throwableList.add(new BaseException("No eTL collaboration model to execute"));
58.249 logView.appendToView(NbBundle.getMessage(ExecuteTestCookie.class, "MSG_execution_failed"));
58.250 }
58.251 -
58.252 +
58.253 return "";
58.254 }
58.255 -
58.256 +
58.257 // Runs on the event-dispatching thread.
58.258 + @Override
58.259 public void finished() {
58.260 if (throwableList.size() != 0) {
58.261 new CloseProgressBarTask().run();
58.262 -
58.263 +
58.264 writeToAppLog(throwableList);
58.265 -
58.266 +
58.267 StringBuilder msgBuf = new StringBuilder(100);
58.268 ListIterator iter = throwableList.listIterator();
58.269 while (iter.hasNext()) {
58.270 @@ -293,18 +284,18 @@
58.271 if (StringUtil.isNullString(detailMsg)) {
58.272 detailMsg = NbBundle.getMessage(ExecuteTestCookie.class, "MSG_executed_error_unknown");
58.273 }
58.274 -
58.275 +
58.276 detailMsg.trim();
58.277 msgBuf.append(iter.nextIndex()).append(". ").append(detailMsg).append(NL);
58.278 }
58.279 -
58.280 +
58.281 String msg = NbBundle.getMessage(ExecuteTestCookie.class, "MSG_executed_errors", new Integer(throwableList.size()), msgBuf.toString());
58.282 -
58.283 +
58.284 logView.appendToView(msg);
58.285 DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.WARNING_MESSAGE));
58.286 }
58.287 }
58.288 -
58.289 +
58.290 /**
58.291 * Logs all Throwables, if any, encountered during an execution run to the system
58.292 * log.
58.293 @@ -321,28 +312,27 @@
58.294 }
58.295 }
58.296 }
58.297 -
58.298 +
58.299 private boolean deleteFile(File file) throws Exception {
58.300 - if(!file.exists()) {
58.301 + if (!file.exists()) {
58.302 return true;
58.303 }
58.304 - if(file.isDirectory()) {
58.305 + if (file.isDirectory()) {
58.306 File[] files = file.listFiles();
58.307 - for(int i = 0; i < files.length; i++) {
58.308 + for (int i = 0; i < files.length; i++) {
58.309 deleteFile(files[i]);
58.310 }
58.311 }
58.312 return file.delete();
58.313 }
58.314 -
58.315 +
58.316 private void removeInstanceDBFolder() {
58.317 try {
58.318 File workingFolder = new File(ETLScriptBuilderModel.ETL_DESIGN_WORK_FOLDER);
58.319 deleteFile(workingFolder);
58.320 - }catch (Exception ex) {
58.321 + } catch (Exception ex) {
58.322 Logger.printThrowable(Logger.WARN, logCategory, this, "Error deleting working folder.", ex);
58.323 }
58.324 }
58.325 }
58.326 }
58.327 -
59.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/cookies/SelectTablesCookie.java Sat Dec 08 10:04:51 2007 +0000
59.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/cookies/SelectTablesCookie.java Sat Dec 08 10:24:35 2007 +0000
59.3 @@ -41,7 +41,6 @@
59.4 package org.netbeans.modules.etl.ui.view.cookies;
59.5
59.6 import java.util.List;
59.7 -
59.8 import org.netbeans.modules.etl.model.impl.ETLDefinitionImpl;
59.9 import org.netbeans.modules.etl.ui.DataObjectHelper;
59.10 import org.netbeans.modules.etl.ui.DataObjectProvider;
59.11 @@ -51,7 +50,6 @@
59.12 import org.openide.DialogDisplayer;
59.13 import org.openide.NotifyDescriptor;
59.14 import org.openide.nodes.Node;
59.15 -
59.16 import com.sun.sql.framework.utils.Logger;
59.17
59.18 /**
59.19 @@ -62,12 +60,11 @@
59.20 * @version $Revision$
59.21 */
59.22 public class SelectTablesCookie implements Node.Cookie {
59.23 -
59.24 +
59.25 private static final boolean DEBUG = false;
59.26 -
59.27 private static final String LOG_CATEGORY = SelectTablesCookie.class.getName();
59.28 -
59.29 private ETLDataObject dataObj;
59.30 +
59.31 /**
59.32 * Creates a new instance of SelectTablesCookie associated with the given
59.33 * ProjectElement.
59.34 @@ -76,32 +73,29 @@
59.35 */
59.36 public SelectTablesCookie() {
59.37 }
59.38 -
59.39 +
59.40 /**
59.41 * Displays the table selection wizard for the current data object.
59.42 */
59.43 public void showDialog() {
59.44 try {
59.45 dataObj = DataObjectProvider.getProvider().getActiveDataObject();
59.46 - ETLCollaborationModel collabModel = DataObjectProvider.getProvider().
59.47 - getActiveDataObject().getModel();
59.48 - ETLDefinitionImpl def = collabModel.getETLDefinition();
59.49 + ETLCollaborationModel collabModel = DataObjectProvider.getProvider().getActiveDataObject().getModel();
59.50 + ETLDefinitionImpl def = collabModel.getETLDefinition();
59.51 ETLTableSelectionWizard wizard = new ETLTableSelectionWizard(def);
59.52 DataObjectHelper.setDefaultCursor();
59.53 -
59.54 +
59.55 if (wizard.show()) {
59.56 List sources = wizard.getSelectedSourceModels();
59.57 List targets = wizard.getSelectedDestinationModels();
59.58 -
59.59 +
59.60 // Update definition object.
59.61 DataObjectHelper helper = new DataObjectHelper(dataObj);
59.62 helper.updateTableSelections(dataObj, sources, targets);
59.63 -
59.64 +
59.65 if (DEBUG) {
59.66 Logger.print(Logger.DEBUG, LOG_CATEGORY, "showDialog()", "Selected source tables:\n" + sources);
59.67 -
59.68 Logger.print(Logger.DEBUG, LOG_CATEGORY, "showDialog()", "Selected target tables:\n" + targets);
59.69 -
59.70 Logger.print(Logger.DEBUG, LOG_CATEGORY, "showDialog()", "New state of ETL Definition:\n" + def.toXMLString(""));
59.71 }
59.72 dataObj.getETLEditorSupport().synchDocument();
59.73 @@ -112,4 +106,3 @@
59.74 }
59.75 }
59.76 }
59.77 -
60.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
60.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
60.3 @@ -61,6 +61,9 @@
60.4 ACTION_VALIDATION=Validate
60.5 ACTION_VALIDATION_TOOLTIP=Validate Collaboration
60.6
60.7 +#Refresh Metadata action
60.8 +ACTION_REFRESH=Refresh Metadata
60.9 +ACTION_REFRESH_TOOLTIP=Refresh Metadata
60.10 #Run Action
60.11 ACTION_TESTRUN=Run
60.12 ACTION_TESTRUN_TOOLTIP=Run Collaboration
61.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/CollabPropertiesAction.java Sat Dec 08 10:04:51 2007 +0000
61.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/CollabPropertiesAction.java Sat Dec 08 10:24:35 2007 +0000
61.3 @@ -49,8 +49,6 @@
61.4 import javax.swing.ImageIcon;
61.5 import javax.swing.KeyStroke;
61.6
61.7 -import org.netbeans.modules.etl.ui.DataObjectProvider;
61.8 -import org.netbeans.modules.etl.ui.view.ETLCollaborationTopComponent;
61.9 import org.netbeans.modules.sql.framework.ui.graph.actions.GraphAction;
61.10 import org.openide.util.NbBundle;
61.11 import org.openide.windows.WindowManager;
61.12 @@ -88,17 +86,9 @@
61.13 * @param ev event
61.14 */
61.15 public void actionPerformed(ActionEvent ev) {
61.16 - ETLCollaborationTopComponent etlEditor = null;
61.17 - try {
61.18 - etlEditor = DataObjectProvider.getProvider().getActiveDataObject().getETLEditorTC();
61.19 - } catch (Exception ex) {
61.20 - // ignore
61.21 - }
61.22 - if (etlEditor != null) {
61.23 - // etlEditor.showSqlDefinitionProperties();
61.24 - if(!WindowManager.getDefault ().findTopComponent ("properties").isShowing())
61.25 - WindowManager.getDefault ().findTopComponent ("properties").open ();
61.26 - }
61.27 + if(!WindowManager.getDefault().findTopComponent("properties").isShowing())
61.28 + WindowManager.getDefault().findTopComponent("properties").open();
61.29 }
61.30 +
61.31 }
61.32
62.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/ConfigureParametersAction.java Sat Dec 08 10:04:51 2007 +0000
62.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/ConfigureParametersAction.java Sat Dec 08 10:24:35 2007 +0000
62.3 @@ -9,7 +9,6 @@
62.4 * The Original Code is NetBeans. The Initial Developer of the Original
62.5 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
62.6 * Microsystems, Inc. All Rights Reserved.
62.7 -
62.8 If you wish your version of this file to be governed by only the CDDL
62.9 or only the GPL Version 2, indicate your decision by adding
62.10 "[Contributor] elects to include this software in this distribution
62.11 @@ -20,7 +19,6 @@
62.12 However, if you add GPL Version 2 code and therefore, elected the GPL
62.13 Version 2 license, then the option applies only if the new code is
62.14 made subject to such option by the copyright holder.
62.15 -
62.16 If you wish your version of this file to be governed by only the CDDL
62.17 or only the GPL Version 2, indicate your decision by adding
62.18 "[Contributor] elects to include this software in this distribution
62.19 @@ -50,10 +48,8 @@
62.20 import javax.swing.JLabel;
62.21 import javax.swing.JPanel;
62.22 import javax.swing.SwingConstants;
62.23 -
62.24 import org.w3c.dom.Element;
62.25 import org.w3c.dom.NodeList;
62.26 -
62.27 import org.netbeans.modules.etl.ui.ETLDataObject;
62.28 import org.netbeans.modules.etl.ui.view.ConfigParamsTreeView;
62.29 import org.netbeans.modules.etl.ui.view.ConfigureParametersPanel;
62.30 @@ -70,7 +66,6 @@
62.31 import org.openide.DialogDisplayer;
62.32 import org.openide.NotifyDescriptor;
62.33 import org.openide.filesystems.FileUtil;
62.34 -
62.35 import com.sun.sql.framework.exception.BaseException;
62.36 import com.sun.sql.framework.utils.Logger;
62.37 import com.sun.sql.framework.utils.XmlUtil;
62.38 @@ -81,37 +76,34 @@
62.39 * @author karthik
62.40 */
62.41 public final class ConfigureParametersAction extends CookieAction {
62.42 -
62.43 +
62.44 private final String PATH_SUFFIX = "\\..\\..\\nbproject\\config\\";
62.45 -
62.46 private final String CONF_FILE = ".conf";
62.47 -
62.48 private File configFile;
62.49 -
62.50 ETLDataObject mObj;
62.51 -
62.52 +
62.53 protected void performAction(Node[] activatedNodes) {
62.54 - ETLDataObject dObj = (ETLDataObject) activatedNodes[0].getCookie(ETLDataObject.class);
62.55 + ETLDataObject dObj = activatedNodes[0].getCookie(ETLDataObject.class);
62.56 String msg = null;
62.57 boolean syncReqd = true;
62.58 - if(dObj != null) {
62.59 + if (dObj != null) {
62.60 this.mObj = dObj;
62.61 dObj.getPrimaryFile().refresh();
62.62 String path = dObj.getPrimaryFile().getPath() + PATH_SUFFIX;
62.63 configFile = new File(path);
62.64 - if(!configFile.exists()) {
62.65 + if (!configFile.exists()) {
62.66 configFile.mkdir();
62.67 }
62.68 path = path + dObj.getName() + CONF_FILE;
62.69 configFile = new File(path);
62.70 FileWriter writer = null;
62.71 - if(!configFile.exists()) {
62.72 + if (!configFile.exists()) {
62.73 try {
62.74 // This one doesn't work if ETL Collaboration is not yet opened. Only after opening
62.75 // the ETL Collab in the editor, the db models are updated into the SQL definition.
62.76 //writer.write(dObj.getETLDefinition().getSQLDefinition().toXMLString(""));
62.77 writeToConfigFile(configFile, createSQLDefinition(dObj));
62.78 -
62.79 +
62.80 // SQL Definition is not necessary. Probably should be using dbModels directly.
62.81 // for simplicity sake, using sql defn as of now.
62.82 syncReqd = false;
62.83 @@ -119,52 +111,49 @@
62.84 // ignore
62.85 }
62.86 }
62.87 - if(configFile.exists()) {
62.88 - if(syncReqd) {
62.89 + if (configFile.exists()) {
62.90 + if (syncReqd) {
62.91 syncConfigWithCollab(configFile, dObj);
62.92 }
62.93 showConfigPanel();
62.94 } else {
62.95 msg = "Failed to create the config file.";
62.96 - DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg,
62.97 - NotifyDescriptor.INFORMATION_MESSAGE));
62.98 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE));
62.99 }
62.100 } else {
62.101 msg = "Failed to initialize.";
62.102 - DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg,
62.103 - NotifyDescriptor.INFORMATION_MESSAGE));
62.104 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE));
62.105 }
62.106 -
62.107 }
62.108 -
62.109 +
62.110 protected int mode() {
62.111 return CookieAction.MODE_EXACTLY_ONE;
62.112 }
62.113 -
62.114 +
62.115 public String getName() {
62.116 return NbBundle.getMessage(ConfigureParametersAction.class, "CTL_ConfigureParametersAction");
62.117 }
62.118 -
62.119 +
62.120 protected Class[] cookieClasses() {
62.121 - return new Class[] {
62.122 - ETLDataObject.class
62.123 - };
62.124 + return new Class[]{ETLDataObject.class};
62.125 }
62.126 -
62.127 +
62.128 + @Override
62.129 protected void initialize() {
62.130 super.initialize();
62.131 // see org.openide.util.actions.SystemAction.iconResource() javadoc for more details
62.132 putValue("noIconInMenu", Boolean.TRUE);
62.133 }
62.134 -
62.135 +
62.136 public HelpCtx getHelpCtx() {
62.137 return HelpCtx.DEFAULT_HELP;
62.138 }
62.139 -
62.140 +
62.141 + @Override
62.142 protected boolean asynchronous() {
62.143 return false;
62.144 }
62.145 -
62.146 +
62.147 /**
62.148 *
62.149 *
62.150 @@ -174,16 +163,16 @@
62.151 panelTitle.setFont(panelTitle.getFont().deriveFont(Font.BOLD));
62.152 panelTitle.setFocusable(false);
62.153 panelTitle.setHorizontalAlignment(SwingConstants.LEADING);
62.154 -
62.155 +
62.156 ConfigureParametersPanel editPanel = new ConfigureParametersPanel(mObj);
62.157 -
62.158 +
62.159 JPanel contentPane = new JPanel();
62.160 contentPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
62.161 contentPane.setLayout(new BorderLayout());
62.162 contentPane.add(panelTitle, BorderLayout.NORTH);
62.163 contentPane.add(editPanel, BorderLayout.CENTER);
62.164 -
62.165 -
62.166 +
62.167 +
62.168 DialogDescriptor dd = new DialogDescriptor(contentPane, "Configure Deployment Parameters");
62.169 Dialog dlg = DialogDisplayer.getDefault().createDialog(dd);
62.170 dlg.setSize(new Dimension(600, 450));
62.171 @@ -196,75 +185,71 @@
62.172 propSheet.commitChanges();
62.173 }
62.174 SQLDefinition defn = configModelTreeView.getData();
62.175 - if(defn != null){
62.176 + if (defn != null) {
62.177 this.configFile.delete();
62.178 try {
62.179 writeToConfigFile(this.configFile, defn);
62.180 String msg = "Deployment parameters successfully updated.";
62.181 - DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg,
62.182 - NotifyDescriptor.INFORMATION_MESSAGE));
62.183 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE));
62.184 } catch (IOException ex) {
62.185 String msg = "Failed to update changes.";
62.186 - DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg,
62.187 - NotifyDescriptor.INFORMATION_MESSAGE));
62.188 - } catch(BaseException baseEx) {
62.189 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE));
62.190 + } catch (BaseException baseEx) {
62.191 String msg = "Failed to read SQL Definition.";
62.192 - DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg,
62.193 - NotifyDescriptor.INFORMATION_MESSAGE));
62.194 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE));
62.195 }
62.196 }
62.197 }
62.198 } else {
62.199 String msg = "All the edits are discarded.";
62.200 - DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg,
62.201 - NotifyDescriptor.INFORMATION_MESSAGE));
62.202 + DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(msg, NotifyDescriptor.INFORMATION_MESSAGE));
62.203 }
62.204 }
62.205 -
62.206 +
62.207 private void syncConfigWithCollab(File configFile, ETLDataObject dObj) {
62.208 SQLDefinition srcDefn = createSQLDefinition(dObj);
62.209 SQLDefinition confDefn = getConfigData(configFile);
62.210 -
62.211 +
62.212 // sync Source db Models.
62.213 confDefn = compareAndSync(srcDefn, confDefn, true);
62.214 // sync Target db Models.
62.215 confDefn = compareAndSync(srcDefn, confDefn, false);
62.216 try {
62.217 -
62.218 +
62.219 // write new config data into config file.
62.220 writeToConfigFile(configFile, confDefn);
62.221 } catch (Exception ex) {
62.222 Logger.print(Logger.ERROR, ConfigureParametersAction.class.getName(), ex.getMessage());
62.223 }
62.224 }
62.225 -
62.226 +
62.227 private SQLDefinition compareAndSync(SQLDefinition srcDefn, SQLDefinition tgtDefn, boolean isSource) {
62.228 // sync the Models.
62.229 Iterator it = null;
62.230 - if(isSource) {
62.231 + if (isSource) {
62.232 it = srcDefn.getSourceDatabaseModels().iterator();
62.233 } else {
62.234 it = srcDefn.getTargetDatabaseModels().iterator();
62.235 }
62.236 - while(it.hasNext()) {
62.237 + while (it.hasNext()) {
62.238 boolean exists = false;
62.239 SQLDBModel match = null;
62.240 - SQLDBModel srcModel = (SQLDBModel)it.next();
62.241 + SQLDBModel srcModel = (SQLDBModel) it.next();
62.242 Iterator confIterator = null;
62.243 - if(isSource) {
62.244 + if (isSource) {
62.245 confIterator = tgtDefn.getSourceDatabaseModels().iterator();
62.246 } else {
62.247 confIterator = tgtDefn.getTargetDatabaseModels().iterator();
62.248 }
62.249 - while(confIterator.hasNext()) {
62.250 - SQLDBModel tgtModel = (SQLDBModel)confIterator.next();
62.251 - if(tgtModel.getModelName().equals(srcModel.getModelName())) {
62.252 + while (confIterator.hasNext()) {
62.253 + SQLDBModel tgtModel = (SQLDBModel) confIterator.next();
62.254 + if (tgtModel.getModelName().equals(srcModel.getModelName())) {
62.255 exists = true;
62.256 match = tgtModel;
62.257 break;
62.258 }
62.259 }
62.260 - if(exists) {
62.261 + if (exists) {
62.262 try {
62.263 tgtDefn.removeObject(match);
62.264 match = syncTables(srcModel, match);
62.265 @@ -282,27 +267,27 @@
62.266 }
62.267 return tgtDefn;
62.268 }
62.269 -
62.270 +
62.271 private SQLDBModel syncTables(SQLDBModel srcModel, SQLDBModel tgtModel) {
62.272 Iterator it = srcModel.getTables().iterator();
62.273 - while(it.hasNext()) {
62.274 + while (it.hasNext()) {
62.275 boolean exists = false;
62.276 - SQLDBTable srcTbl = (SQLDBTable)it.next();
62.277 + SQLDBTable srcTbl = (SQLDBTable) it.next();
62.278 Iterator confIterator = tgtModel.getTables().iterator();
62.279 - while(confIterator.hasNext()) {
62.280 - SQLDBTable tgtTbl = (SQLDBTable)confIterator.next();
62.281 - if(tgtTbl.getName().equals(srcTbl.getName())) {
62.282 + while (confIterator.hasNext()) {
62.283 + SQLDBTable tgtTbl = (SQLDBTable) confIterator.next();
62.284 + if (tgtTbl.getName().equals(srcTbl.getName())) {
62.285 exists = true;
62.286 break;
62.287 }
62.288 }
62.289 - if(!exists) {
62.290 + if (!exists) {
62.291 tgtModel.addTable(srcTbl);
62.292 }
62.293 }
62.294 return tgtModel;
62.295 }
62.296 -
62.297 +
62.298 private SQLDefinition getConfigData(File configFile) {
62.299 org.w3c.dom.Node rootNode = null;
62.300 SQLDefinition sqlDefn = null;
62.301 @@ -312,17 +297,17 @@
62.302 } catch (Exception ex) {
62.303 Logger.print(Logger.ERROR, ConfigureParametersAction.class.getName(), ex.getMessage());
62.304 }
62.305 - if(rootNode != null) {
62.306 + if (rootNode != null) {
62.307 org.w3c.dom.Node sqlNode = rootNode.getFirstChild();
62.308 try {
62.309 - sqlDefn = new SQLDefinitionImpl((Element)sqlNode);
62.310 + sqlDefn = new SQLDefinitionImpl((Element) sqlNode);
62.311 } catch (Exception ex) {
62.312 Logger.print(Logger.ERROR, ConfigureParametersAction.class.getName(), ex.getMessage());
62.313 }
62.314 }
62.315 return sqlDefn;
62.316 }
62.317 -
62.318 +
62.319 private SQLDefinition createSQLDefinition(ETLDataObject dObj) {
62.320 Element element = null;
62.321 try {
62.322 @@ -331,21 +316,20 @@
62.323 // ignore
62.324 }
62.325 SQLDefinition sqlDefn = null;
62.326 - if(element != null) {
62.327 + if (element != null) {
62.328 NodeList list = element.getElementsByTagName("sqlDefinition");
62.329 - Element sqlElement = (Element)list.item(0);
62.330 + Element sqlElement = (Element) list.item(0);
62.331 try {
62.332 - sqlDefn= new SQLDefinitionImpl(sqlElement);
62.333 + sqlDefn = new SQLDefinitionImpl(sqlElement);
62.334 } catch (BaseException ex) {
62.335 // ignore
62.336 }
62.337 }
62.338 return sqlDefn;
62.339 }
62.340 -
62.341 - private void writeToConfigFile(File configFile, SQLDefinition confDefn)
62.342 - throws IOException, BaseException {
62.343 - if(configFile.exists()) {
62.344 +
62.345 + private void writeToConfigFile(File configFile, SQLDefinition confDefn) throws IOException, BaseException {
62.346 + if (configFile.exists()) {
62.347 configFile.delete();
62.348 }
62.349 configFile.createNewFile();
63.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/JoinAction.java Sat Dec 08 10:04:51 2007 +0000
63.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/JoinAction.java Sat Dec 08 10:24:35 2007 +0000
63.3 @@ -62,6 +62,7 @@
63.4
63.5 import com.sun.sql.framework.exception.BaseException;
63.6 import com.sun.sql.framework.utils.Logger;
63.7 +import org.netbeans.modules.sql.framework.model.DBTable;
63.8
63.9 /**
63.10 * This action is to create or edit join
63.11 @@ -111,7 +112,7 @@
63.12 .getActiveDataObject().getModel();
63.13
63.14 if (collabModel != null) {
63.15 - List sList = collabModel.getSQLDefinition().getJoinSources();
63.16 + List<DBTable> sList = collabModel.getSQLDefinition().getJoinSources();
63.17 JoinMainDialog.showJoinDialog(sList, null, etlEditor.getGraphView(), true);
63.18
63.19 if (JoinMainDialog.getClosingButtonState() == JoinMainDialog.OK_BUTTON) {
64.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
64.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/RefreshMetadataAction.java Sat Dec 08 10:24:35 2007 +0000
64.3 @@ -0,0 +1,136 @@
64.4 +/*
64.5 + *
64.6 + * Copyright (c) 2003-2005, SeeBeyond Technology Corporation,
64.7 + * All Rights Reserved
64.8 + *
64.9 + * This program, and all the routines referenced herein,
64.10 + * are the proprietary properties and trade secrets of
64.11 + * SEEBEYOND TECHNOLOGY CORPORATION.
64.12 + *
64.13 + * Except as provided for by license agreement, this
64.14 + * program shall not be duplicated, used, or disclosed
64.15 + * without written consent signed by an officer of
64.16 + * SEEBEYOND TECHNOLOGY CORPORATION.
64.17 + *
64.18 + */
64.19 +
64.20 +package org.netbeans.modules.etl.ui.view.graph.actions;
64.21 +
64.22 +import com.sun.sql.framework.exception.DBSQLException;
64.23 +import org.netbeans.modules.sql.framework.model.SQLDBTable;
64.24 +import org.netbeans.modules.sql.framework.model.SourceTable;
64.25 +import org.netbeans.modules.sql.framework.model.TargetTable;
64.26 +import org.netbeans.modules.sql.framework.model.visitors.SQLDBSynchronizationVisitor;
64.27 +import java.awt.event.ActionEvent;
64.28 +import java.net.URL;
64.29 +import java.util.ArrayList;
64.30 +import javax.swing.Action;
64.31 +import java.util.Iterator;
64.32 +import java.util.List;
64.33 +import javax.swing.ImageIcon;
64.34 +import javax.swing.JOptionPane;
64.35 +import org.netbeans.modules.etl.ui.DataObjectProvider;
64.36 +import org.netbeans.modules.sql.framework.model.SQLJoinView;
64.37 +import org.openide.util.Exceptions;
64.38 +import org.openide.util.NbBundle;
64.39 +import org.netbeans.modules.sql.framework.ui.view.graph.MetaTableModel;
64.40 +import org.netbeans.modules.sql.framework.ui.view.graph.SQLTableArea;
64.41 +import org.netbeans.modules.sql.framework.model.visitors.SQLDBSynchronizationVisitor;
64.42 +import org.netbeans.modules.sql.framework.ui.graph.IGraphView;
64.43 +import org.netbeans.modules.sql.framework.ui.model.CollabSQLUIModel;
64.44 +import org.netbeans.modules.sql.framework.ui.view.graph.SQLSourceTableArea;
64.45 +import org.netbeans.modules.sql.framework.ui.view.graph.SQLTargetTableArea;
64.46 +import org.netbeans.modules.sql.framework.ui.graph.actions.GraphAction;
64.47 +import org.netbeans.modules.sql.framework.ui.view.BasicTopView;
64.48 +import org.netbeans.modules.sql.framework.ui.view.graph.SQLBasicTableArea;
64.49 +import org.netbeans.modules.sql.framework.ui.view.join.JoinViewGraphNode;
64.50 +import org.openide.windows.WindowManager;
64.51 +
64.52 +/**
64.53 + * @author Nithya Radhakrishnan
64.54 + * @version $Revision$
64.55 + */
64.56 +public class RefreshMetadataAction extends GraphAction {
64.57 +
64.58 + private static final URL synchroniseImgUrl = RefreshMetadataAction.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/refresh.png");
64.59 +
64.60 + public RefreshMetadataAction() {
64.61 + //action name
64.62 + this.putValue(Action.NAME, NbBundle.getMessage(RefreshMetadataAction.class, "ACTION_REFRESH"));
64.63 +
64.64 + //action icon
64.65 + this.putValue(Action.SMALL_ICON, new ImageIcon(synchroniseImgUrl));
64.66 +
64.67 + //action tooltip
64.68 + this.putValue(Action.SHORT_DESCRIPTION, NbBundle.getMessage(RefreshMetadataAction.class, "ACTION_REFRESH_TOOLTIP"));
64.69 + }
64.70 +
64.71 + /**
64.72 + * called when this action is performed in the ui
64.73 + *
64.74 + * @param ev event
64.75 + */
64.76 + public void actionPerformed(ActionEvent ev) {
64.77 + IGraphView graphView = (IGraphView) ev.getSource();
64.78 + CollabSQLUIModel model = (CollabSQLUIModel) graphView.getGraphModel();
64.79 + List infoList = new ArrayList();
64.80 + String dlgMsg = NbBundle.getMessage(SQLBasicTableArea.class, "MSG_dlg_refresh_metadata");
64.81 + String dlgTitle = NbBundle.getMessage(SQLBasicTableArea.class, "TITLE_dlg_refresh_metadata");
64.82 + int response = JOptionPane.showConfirmDialog(WindowManager.getDefault().getMainWindow(), dlgMsg, dlgTitle, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE);
64.83 + if (JOptionPane.OK_OPTION == response) {
64.84 + Iterator targetTables = model.getSQLDefinition().getTargetTables().iterator();
64.85 + while (targetTables.hasNext()) {
64.86 + try {
64.87 + TargetTable tt = (TargetTable) targetTables.next();
64.88 + SQLDBSynchronizationVisitor visitView = new SQLDBSynchronizationVisitor();
64.89 + SQLTargetTableArea ttArea = (SQLTargetTableArea) graphView.findGraphNode(tt);
64.90 + SQLTableArea tarea = (SQLTableArea) ttArea.getTableArea();
64.91 + MetaTableModel metaModel = (MetaTableModel) tarea.getModel();
64.92 + visitView.mergeCollabTableWithDatabaseTable((SQLDBTable) tt, metaModel);
64.93 + if (!visitView.infoList.isEmpty()) {
64.94 + ttArea.layoutChildren();
64.95 + // Mark collab as needing to be persisted.
64.96 + DataObjectProvider.getProvider().getActiveDataObject().setModified(true);
64.97 + model.setDirty(true);
64.98 + infoList.addAll(visitView.infoList);
64.99 + }
64.100 + } catch (DBSQLException ex) {
64.101 + Exceptions.printStackTrace(ex);
64.102 + } catch (Exception ex) {
64.103 + Exceptions.printStackTrace(ex);
64.104 + }
64.105 + }
64.106 +
64.107 + Iterator sourceTables = model.getSQLDefinition().getSourceTables().iterator();
64.108 + while (sourceTables.hasNext()) {
64.109 + try {
64.110 + SourceTable st = (SourceTable) sourceTables.next();
64.111 + SQLDBSynchronizationVisitor visitView = new SQLDBSynchronizationVisitor();
64.112 + SQLSourceTableArea stArea = (SQLSourceTableArea) graphView.findGraphNode(st);
64.113 + SQLTableArea tarea = (SQLTableArea) stArea.getTableArea();
64.114 + MetaTableModel metaModel = (MetaTableModel) tarea.getModel();
64.115 + visitView.mergeCollabTableWithDatabaseTable((SQLDBTable) st, metaModel);
64.116 + if (!visitView.infoList.isEmpty()) {
64.117 + stArea.layoutChildren();
64.118 + SQLJoinView jView = model.getJoinView(st);
64.119 + if (jView != null) {
64.120 + JoinViewGraphNode jViewGraph = (JoinViewGraphNode) graphView.findGraphNode(jView);
64.121 + jViewGraph.layoutChildren();
64.122 + jViewGraph.setHeight(jViewGraph.getMaximumHeight());
64.123 + }
64.124 + // Mark collab as needing to be persisted.
64.125 + DataObjectProvider.getProvider().getActiveDataObject().setModified(true);
64.126 + model.setDirty(true);
64.127 + infoList.addAll(visitView.infoList);
64.128 + }
64.129 + } catch (DBSQLException ex) {
64.130 + Exceptions.printStackTrace(ex);
64.131 + } catch (Exception ex) {
64.132 + Exceptions.printStackTrace(ex);
64.133 + }
64.134 + }
64.135 + BasicTopView gvMgr = (BasicTopView) graphView.getGraphViewContainer();
64.136 + gvMgr.showRefreshMetadataInfo(infoList);
64.137 + } // end of jOptionPane
64.138 + }
64.139 +}
64.140 \ No newline at end of file
65.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/TestRunAction.java Sat Dec 08 10:04:51 2007 +0000
65.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/graph/actions/TestRunAction.java Sat Dec 08 10:24:35 2007 +0000
65.3 @@ -10,7 +10,6 @@
65.4 import org.netbeans.modules.etl.ui.view.ETLCollaborationTopComponent;
65.5 import org.netbeans.modules.sql.framework.ui.graph.actions.GraphAction;
65.6 import org.netbeans.modules.sql.framework.ui.utils.AxionExternalConnectionProvider;
65.7 -import org.openide.util.HelpCtx;
65.8 import org.openide.util.NbBundle;
65.9
65.10 import com.sun.sql.framework.utils.Logger;
66.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/property/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
66.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/property/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
66.3 @@ -252,7 +252,35 @@
66.4 COLLABORATION_DEFAULT_DISPLAYNAME_TOOLTIP=Collaboration Name
66.5 COLLABORATION_DEFAULT_EXECUTIONSTRATEGYCODE_DISPLAYNAME = Execution Strategy
66.6 COLLABORATION_DEFAULT_EXECUTIONSTRATEGYCODE_TOOLTIP = Execution Strategy
66.7 +COLLABORATION_DEFAULT_SOURCEMODELNAME_DISPLAYNAME=SourceConnectionURL
66.8 +COLLABORATION_DEFAULT_SOURCEMODELNAME_TOOLTIP=Connection URL for SourceTable
66.9 +COLLABORATION_DEFAULT_TARGETMODELNAME_DISPLAYNAME =TargetConnectionURL
66.10 +COLLABORATION_DEFAULT_TARGETMODELNAME_TOOLTIP=Connection URL for TargetTable
66.11
66.12 +###########################################
66.13 +# Join properties
66.14 +###########################################
66.15 +JOIN_DEFAULT_DISPLAYNAME=Basic
66.16 +JOIN_DEFAULT_JOINTYPE_DISPLAYNAME=Join Type
66.17 +JOIN_DEFAULT_JOINTYPE_TOOLTIP=Select type of Join
66.18 +JOIN_DEFAULT_JOINCONDITION_DISPLAYNAME =Join Condition
66.19 +JOIN_DEFAULT_JOINCONDITION_TOOLTIP = Select Join condition
66.20 +
66.21 +
66.22 +###########################################
66.23 +# Runtime Input and Output properties
66.24 +#######################################
66.25 +RUNTIMEINPUT_DEFAULT_DISPLAYNAME=Basic
66.26 +RUNTIMEINPUT_DEFAULT_DISPLAYNAME_DISPLAYNAME=Display Name
66.27 +RUNTIMEINPUT_DEFAULT_DISPLAYNAME_TOOLTIP=RunTimeInput Name
66.28 +RUNTIMEINPUT_DEFAULT_MODELNAME_DISPLAYNAME=Model Name
66.29 +RUNTIMEINPUT_DEFAULT_MODELNAME_TOOLTIP=RunTimeInput ModelName
66.30 +
66.31 +RUNTIMEOUTPUT_DEFAULT_DISPLAYNAME=Basic
66.32 +RUNTIMEOUTPUT_DEFAULT_DISPLAYNAME_DISPLAYNAME=Display Name
66.33 +RUNTIMEOUTPUT_DEFAULT_DISPLAYNAME_TOOLTIP=RunTimeOutput Name
66.34 +RUNTIMEOUTPUT_DEFAULT_MODELNAME_DISPLAYNAME=Model Name
66.35 +RUNTIMEOUTPUT_DEFAULT_MODELNAME_TOOLTIP=RunTimeOutput ModelName
66.36
66.37 # DB table editing properties
66.38 DBMODEL_DEFAULT_DISPLAYNAME=Data source
67.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/BrowseFolders.java Sat Dec 08 10:04:51 2007 +0000
67.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/BrowseFolders.java Sat Dec 08 10:24:35 2007 +0000
67.3 @@ -39,16 +39,13 @@
67.4 import java.awt.event.ActionEvent;
67.5 import java.awt.event.ActionListener;
67.6 import java.beans.PropertyVetoException;
67.7 -import java.text.MessageFormat;
67.8 import java.util.ArrayList;
67.9 import java.util.Arrays;
67.10 import java.util.Collection;
67.11 import java.util.Collections;
67.12 -import java.util.StringTokenizer;
67.13 import javax.swing.JButton;
67.14 import javax.swing.JScrollPane;
67.15 import org.netbeans.api.project.Project;
67.16 -import org.netbeans.api.project.ProjectUtils;
67.17 import org.netbeans.api.project.SourceGroup;
67.18 import org.netbeans.api.queries.VisibilityQuery;
67.19 import org.openide.DialogDescriptor;
67.20 @@ -58,7 +55,6 @@
67.21 import org.openide.filesystems.FileObject;
67.22 import org.openide.loaders.DataFolder;
67.23 import org.openide.loaders.DataObject;
67.24 -import org.openide.loaders.DataObjectNotFoundException;
67.25 import org.openide.nodes.Children;
67.26 import org.openide.nodes.Node;
67.27 import org.openide.nodes.AbstractNode;
68.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
68.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
68.3 @@ -26,36 +26,6 @@
68.4 # Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
68.5 # Microsystems, Inc. All Rights Reserved.
68.6 #
68.7 -#LBL_combobox_select=-- Select --
68.8 -
68.9 -#
68.10 -# WizardManager log error messages.
68.11 -#
68.12 -ERROR_wizmgr_showdlg_noselection=No selection node detected in wizard selection dialog.
68.13 -ERROR_wizmgr_showdlg_noclassname=Could not locate value in layer for attribute "className" of selected wizard node.
68.14 -ERROR_wizmgr_showdlg_ex_classnotfound=Could not load class using fully-qualified name of "{0}".
68.15 -ERROR_wizmgr_showdlg_ex_instantiation=Could not instantiate instance of "{0}"
68.16 -ERROR_wizmgr_showdlg_ex_illegalaccess=Could not instantiate instance of "{0}"
68.17 -ERROR_wizdesc_showdlg_ex_interrupted=Could not display wizard dialog.
68.18 -ERROR_wizdesc_showdlg_ex_invoctarget=Could not display wizard dialog.
68.19 -ERROR_wizmgr_showdlg_msg_cannotload=The system could not locate the {0} OTD wizard.
68.20 -
68.21 -IMG_otd_dlg_contentsplash=/org/netbeans/modules/etl/ui/resources/images/WizardSplash.png
68.22 -MSG_title_otd={0}
68.23 -TITLE_otd_dlg=Object Type Definition Wizard
68.24 -
68.25 -
68.26 -TITLE_otd_welcome_default=Welcome to the OTD Wizard!
68.27 -TITLE_otd_import_default=Import data objects.
68.28 -
68.29 -LBL_otd_welcome_stepsheader=The wizard will walk you through the following steps:
68.30 -
68.31 -
68.32 -BTN_otd_edit=Edit...
68.33 -BTN_otd_new=New...
68.34 -
68.35 -MNEMONIC_otd_edit_import=e
68.36 -MNEMONIC_otd_new_import=w
68.37
68.38 #BrowseFolders
68.39 BTN_BrowseFolders_Select_Option=Select Folder
68.40 @@ -72,115 +42,9 @@
68.41 # {2} Original name of the folder,
68.42 FMT_PhysicalView_GroupName={1} - {0}
68.43
68.44 -#
68.45 -# OTD Wizard dialog titles
68.46 -#
68.47 -TITLE_otd_db_dlg=Database OTD Wizard
68.48 -TITLE_otd_file_dlg=File OTD Wizard
68.49 -
68.50 -
68.51 -#
68.52 -# DB OTD Wizard: welcome panel
68.53 -#
68.54 -TITLE_otd_db_welcome=Welcome to the Database OTD Wizard!
68.55 -LBL_otd_db_welcome_step=Welcome!
68.56 -LBL_otd_db_welcome_description=This wizard will help you create an Object Type Definition (OTD) from Database Objects.
68.57 -LBL_otd_db_welcome_continue=To continue, click Next.
68.58 -
68.59 -
68.60 -#
68.61 -# Database OTD Wizard: source panel
68.62 -#
68.63 -
68.64 -LBL_otd_db_source_step=Select Datasource
68.65 -LBL_otd_db_source_description=Select from the list of existing datasources or click New to create a new datasource.
68.66 -
68.67 -LBL_otd_db_filetreeview=Existing datasources and available tables:
68.68 -MNEMONIC_otd_db_filetreeview=x
68.69 -
68.70 -
68.71 -#
68.72 -# File OTD Wizard: welcome panel
68.73 -#
68.74 -
68.75 -TITLE_otd_file_welcome=Welcome to the File OTD Wizard!
68.76 -LBL_otd_file_welcome_step=Welcome!
68.77 -LBL_otd_file_welcome_description=This wizard will help you create Object Type Definitions (OTDs) from data files.
68.78 -LBL_otd_file_welcome_continue=To start the wizard, click Next.
68.79 -
68.80 -
68.81 -#
68.82 -# File OTD Wizard: source panel
68.83 -#
68.84 -TITLE_otd_file_source=Select a filesource to supply OTD metadata.
68.85 -
68.86 -LBL_otd_file_source_step=Select Filesource
68.87 -LBL_otd_file_source_description=Select from the list of existing filesources or click New to create a new filesource.
68.88 -
68.89 -LBL_otd_file_filetreeview=Existing filesources and imported files:
68.90 -MNEMONIC_otd_file_filetreeview=x
68.91 -
68.92 -
68.93 -#
68.94 -# Common panel for OTD Wizards: edit OTD panel
68.95 -#
68.96 -TITLE_otd_editotd_default=Specify OTD name and select tables and columns.
68.97 -LBL_otd_editotd_step=Configure OTD
68.98 -LBL_otd_editotd_description=Select tables and columns to include in this OTD by clicking on the checkbox next to the desired item. To modify a column property, select it and edit the value in the table to the right.
68.99 -LBL_otd_editotd_finish=To close this Wizard, click Finish.
68.100 -
68.101 -ERROR_otd_name_exists=An OTD with the name "{0}" already exists. Please choose a new name.
68.102 -
68.103 -LBL_otd_editotd_name=OTD name
68.104 -MNEMONIC_otd_editotd_name=n
68.105 -
68.106 -
68.107 -LBL_otd_editotd_otd=OTD name
68.108 -LBL_otd_editotd_table=Table name
68.109 -LBL_otd_editotd_column=Column name
68.110 -LBL_otd_editotd_type=Type
68.111 -LBL_otd_editotd_scale=Scale
68.112 -LBL_otd_editotd_precision=Precision
68.113 -
68.114 -
68.115 -
68.116 -
68.117 -# Window System API
68.118 -
68.119 -# TopComponent
68.120 -LBL_component_name=<name of component>
68.121 -LBL_mode_name=<name of mode>
68.122 -LBL_workspace_name=<name of workspace>
68.123 -
68.124 -
68.125 -# CallableSystem
68.126 -LBL_action_new_otd=New Object Type Definition
68.127 -
68.128 -# Window System API
68.129 -#add display names for wizard categories
68.130 -ETLWizard/database=Database
68.131 -ETLWizard/file=File
68.132 -
68.133 -#Tooltip
68.134 -TOOLTIP_databaseWizard=Database OTD Wizard
68.135 -TOOLTIP_fileWizard=File OTD Wizard
68.136 -TOOLTIP_fileImportWizard=File Metadata Import Utility
68.137 -
68.138 -
68.139 -LBL_List_Transfer_Panel1=List Transfer Panel 1
68.140 -
68.141 -LBL_List_Transfer_Panel2=List Transfer Panel 2
68.142 -
68.143 -LBL_List_Transfer_Panel3=List Transfer Panel 3
68.144 -
68.145 -LBL_List_Transfer_Panel4=List Transfer Panel 4
68.146 -
68.147 #Dialog
68.148 TITLE_dlg_new_collab=New Collaboration Definition Wizard (eTL)
68.149
68.150 -#User-defined name for new collaboration
68.151 -LBL_collaboration_name=Collaboration name:
68.152 -
68.153 MSG_titleformat_wiz_default={0}
68.154 MSG_titleformat_wiz_notfound="Could not locate key for title format."
68.155
68.156 @@ -212,19 +76,12 @@
68.157 LBL_Argument_Type=Type
68.158
68.159 TITLE_dlg_selecttables=Select Source and Target Tables
68.160 -
68.161 TITLE_tblwizard_sources=Select Source Tables
68.162 -
68.163 TITLE_tblwizard_targets=Select Target Tables
68.164 -
68.165 TOOLTIP_target_table_exists=Table {0} already exists as target in this collaboration.
68.166 -
68.167 TOOLTIP_source_table_disabled_unselected=Table {0} already exists as target table in this collaboration.
68.168 -
68.169 TOOLTIP_target_table_disabled_unselected=Table {0} already exists as source table in this collaboration.
68.170
68.171 -
68.172 -
68.173 #Target chooser
68.174 LBL_TargetChooser_FileName_Label=File Name\:
68.175 LBL_TargetChooser_FolderName_Label=Folder Name\:
68.176 @@ -275,28 +132,18 @@
68.177 ACSN_BrowseFolders_jLabel1=Folders\:
68.178 ACSN_BrowseFolders_folderPanel=Folders:
68.179 ACSD_BrowseFolders_folderPanel=The tree contains the folders contained in the project's directory
68.180 -
68.181 ACSN_BrowseFolders=Browse folders to choose a target folder
68.182 -
68.183 ACSD_ProjectChooserAccessory_jCheckBoxMain=N/A
68.184 ACSD_ProjectChooserAccessory_jCheckBoxSubprojects=Opens also the projects of which depends the selected project
68.185 -
68.186 ACSN_ProjectChooserAccessory_jListSubprojects=List of the subprojects
68.187 -
68.188 ACSD_ProjectChooserAccessory_jListSubprojects=List of the projects of which depends the selected project
68.189
68.190 AD_SimpleTargetChooserPanelGUI=N/A
68.191 -
68.192 AD_documentNameTextField=N/A
68.193 -
68.194 AD_projectTextField=N/A
68.195 -
68.196 AD_locationComboBox=N/A
68.197 -
68.198 AD_folderTextField=N/A
68.199 -
68.200 AD_browseButton=N/A
68.201 -
68.202 AD_fileTextField=N/A
68.203
68.204 LBL_TemplatesPanel_Name=Choose File Type
69.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizard.java Sat Dec 08 10:04:51 2007 +0000
69.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizard.java Sat Dec 08 10:24:35 2007 +0000
69.3 @@ -129,7 +129,7 @@
69.4 * @see org.openide.WizardDescriptor.Iterator#nextPanel
69.5 */
69.6 public void nextPanel() {
69.7 - if ( current().equals(sourceTableSelectionPanel) ) { // Currently in source OTDs panel.
69.8 + if ( current().equals(sourceTableSelectionPanel) ) { // Currently in source Database panel.
69.9 ETLCollaborationWizardTransferPanel xferPanel = (ETLCollaborationWizardTransferPanel) current();
69.10
69.11 // Skip join panel if we don't have two or more tables selected,
69.12 @@ -307,7 +307,7 @@
69.13 public void run() {
69.14 etlDataObj.initialize(descriptor);
69.15 if (etlDataObj.getNodeDelegate() != null) {
69.16 - OpenCookie openCookie = (OpenCookie) etlDataObj.getNodeDelegate().getCookie(OpenCookie.class);
69.17 + OpenCookie openCookie = etlDataObj.getNodeDelegate().getCookie(OpenCookie.class);
69.18 openCookie.open();
69.19 }
69.20 }
69.21 @@ -331,8 +331,8 @@
69.22 /** Key name used to reference collaboration name in wizard context. */
69.23 public static final String COLLABORATION_NAME = "collaboration_name";
69.24
69.25 - /** Key name used to reference List of destination OTDs in wizard context. */
69.26 - public static final String TARGET_DB = "destination_otds";
69.27 + /** Key name used to reference List of destination Database in wizard context. */
69.28 + public static final String TARGET_DB = "destination_dbs";
69.29
69.30 /** Key name used to reference List of destination tables in wizard context. */
69.31 public static final String DESTINATION_TABLES = "destination_tables";
69.32 @@ -349,8 +349,8 @@
69.33 /** Key name used to reference Collection of runtime input args in wizard context. */
69.34 public static final String RUNTIME_INPUTS = "runtime_inputs";
69.35
69.36 - /** Key name used to reference List of source OTDs in wizard context. */
69.37 - public static final String SOURCE_DB = "source_otds";
69.38 + /** Key name used to reference List of source Database in wizard context. */
69.39 + public static final String SOURCE_DB = "source_dbs";
69.40
69.41 public static final int SOURCE_PANEL_INDEX = 2;
69.42
69.43 @@ -394,21 +394,21 @@
69.44 }
69.45
69.46 /**
69.47 - * Gets List of destination OTDs as selected by user.
69.48 + * Gets List of destination Databases as selected by user.
69.49 *
69.50 - * @return List (possibly empty) of selected destination OTDs
69.51 + * @return List (possibly empty) of selected destination Databases
69.52 */
69.53 - public List getSelectedDestinationOtds() {
69.54 - return getSelectedOtdsOfType(ETLCollaborationWizard.TARGET_DB);
69.55 + public List getSelectedDestinationDb() {
69.56 + return getSelectedDbOfType(ETLCollaborationWizard.TARGET_DB);
69.57 }
69.58
69.59 /**
69.60 - * Gets List of source OTDs as selected by user.
69.61 + * Gets List of source Databases as selected by user.
69.62 *
69.63 - * @return List (possibly empty) of selected source OTDs
69.64 + * @return List (possibly empty) of selected source Databases
69.65 */
69.66 - public List getSelectedSourceOtds() {
69.67 - return getSelectedOtdsOfType(ETLCollaborationWizard.SOURCE_DB);
69.68 + public List getSelectedSourceDb() {
69.69 + return getSelectedDbOfType(ETLCollaborationWizard.SOURCE_DB);
69.70 }
69.71
69.72 public SQLJoinView getSQLJoinView() {
69.73 @@ -451,7 +451,7 @@
69.74 return NbBundle.getMessage(ETLCollaborationWizard.class, "TITLE_dlg_new_collab");
69.75 }
69.76
69.77 - private List getSelectedOtdsOfType(String typeKey) {
69.78 + private List getSelectedDbOfType(String typeKey) {
69.79 return (List) descriptor.getProperty(typeKey);
69.80 }
69.81
70.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardJoinPanel.java Sat Dec 08 10:04:51 2007 +0000
70.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardJoinPanel.java Sat Dec 08 10:24:35 2007 +0000
70.3 @@ -160,8 +160,8 @@
70.4 public void readSettings(Object settings) {
70.5 this.joinMainPanel.setDividerLocation(210);
70.6 Set sTables = new HashSet();
70.7 - List sourceOtds = etlCWizard.getSelectedSourceOtds();
70.8 - Iterator it = sourceOtds.iterator();
70.9 + List sourceDb = etlCWizard.getSelectedSourceDb();
70.10 + Iterator it = sourceDb.iterator();
70.11
70.12 while (it.hasNext()) {
70.13 SQLDBModel dbModel = (SQLDBModel) it.next();
70.14 @@ -238,8 +238,8 @@
70.15 // Mark any tables associated with the current join view as selected and
70.16 // editable.
70.17 List joinSourceTables = joinView.getSourceTables();
70.18 - List sourceOtds = (List) wizard.getProperty(ETLCollaborationWizard.SOURCE_DB);
70.19 - Iterator it = sourceOtds.iterator();
70.20 + List sourceDb = (List) wizard.getProperty(ETLCollaborationWizard.SOURCE_DB);
70.21 + Iterator it = sourceDb.iterator();
70.22 while (it.hasNext()) {
70.23 SQLDBModel dbModel = (SQLDBModel) it.next();
70.24 Iterator sIt = joinSourceTables.iterator();
70.25 @@ -264,8 +264,8 @@
70.26
70.27 // NOW MARK TABLES WHICH ARE IN JOIN VIEW AS UNSELECTED AND UNEDITABLE
70.28 List joinSourceTables = joinView.getSourceTables();
70.29 - List sourceOtds = (List) wizard.getProperty(ETLCollaborationWizard.SOURCE_DB);
70.30 - Iterator it = sourceOtds.iterator();
70.31 + List sourceDb = (List) wizard.getProperty(ETLCollaborationWizard.SOURCE_DB);
70.32 + Iterator it = sourceDb.iterator();
70.33 while (it.hasNext()) {
70.34 SQLDBModel dbModel = (SQLDBModel) it.next();
70.35 Iterator sIt = joinSourceTables.iterator();
71.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardTransferFinishPanel.java Sat Dec 08 10:04:51 2007 +0000
71.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardTransferFinishPanel.java Sat Dec 08 10:24:35 2007 +0000
71.3 @@ -67,11 +67,11 @@
71.4 * @param title String to be displayed as title of this panel
71.5 * @param dsList List of DatabaseModels used to populate datasource panel
71.6 * @param destColl Collection of DBTables used to populate table panel
71.7 - * @param sourceOTD true if this panel displays available selections for source OTDs;
71.8 - * false if it displays available destination OTDsl
71.9 + * @param sourceDb true if this panel displays available selections for source Databases;
71.10 + * false if it displays available destination Databases
71.11 */
71.12 - public ETLCollaborationWizardTransferFinishPanel(String title, List dsList, Collection destColl, boolean sourceOTD) {
71.13 - super(title, dsList, destColl, sourceOTD);
71.14 + public ETLCollaborationWizardTransferFinishPanel(String title, List dsList, Collection destColl, boolean sourceDb) {
71.15 + super(title, dsList, destColl, sourceDb);
71.16 this.setPreferredSize(new Dimension(575, 425));
71.17 this.setSize(575, 425);
71.18 }
71.19 @@ -83,12 +83,12 @@
71.20 * @param title String to be displayed as title of this panel
71.21 * @param dsList List of DatabaseModels used to populate datasource panel
71.22 * @param destColl Collection of DBTables used to populate table panel
71.23 - * @param sourceOTD true if this panel displays available selections for source OTDs;
71.24 - * false if it displays available destination OTDsl
71.25 + * @param sourceDb true if this panel displays available selections for source Databases;
71.26 + * false if it displays available destination Databases
71.27 * @param enableNext true if Next button should always be enabled for this panel.
71.28 */
71.29 - public ETLCollaborationWizardTransferFinishPanel(String title, List dsList, Collection destColl, boolean sourceOTD, boolean enableNext) {
71.30 - super(title, dsList, destColl, sourceOTD);
71.31 + public ETLCollaborationWizardTransferFinishPanel(String title, List dsList, Collection destColl, boolean sourceDb, boolean enableNext) {
71.32 + super(title, dsList, destColl, sourceDb);
71.33 this.enableNext = enableNext;
71.34 this.setPreferredSize(new Dimension(575, 425));
71.35 this.setSize(575, 425);
72.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardTransferPanel.java Sat Dec 08 10:04:51 2007 +0000
72.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLCollaborationWizardTransferPanel.java Sat Dec 08 10:24:35 2007 +0000
72.3 @@ -78,28 +78,22 @@
72.4
72.5 import org.netbeans.api.db.explorer.ConnectionManager;
72.6 import org.netbeans.api.db.explorer.DatabaseConnection;
72.7 -import org.netbeans.modules.jdbc.builder.DBMetaData;
72.8 -import org.netbeans.modules.jdbc.builder.ForeignKeyColumn;
72.9 -import org.netbeans.modules.jdbc.builder.KeyColumn;
72.10 -import org.netbeans.modules.jdbc.builder.Table;
72.11 -import org.netbeans.modules.jdbc.builder.TableColumn;
72.12 -import org.netbeans.modules.model.database.DBConnectionDefinition;
72.13 -import org.netbeans.modules.model.database.DatabaseModel;
72.14 +import org.netbeans.modules.sql.framework.model.DBMetaDataFactory;
72.15 import org.netbeans.modules.sql.framework.model.SQLConstants;
72.16 import org.netbeans.modules.sql.framework.model.SQLDBModel;
72.17 import org.netbeans.modules.sql.framework.model.SQLDBTable;
72.18 import org.netbeans.modules.sql.framework.model.SQLModelObjectFactory;
72.19 -import org.netbeans.modules.sql.framework.model.impl.ForeignKeyImpl;
72.20 -import org.netbeans.modules.sql.framework.model.impl.PrimaryKeyImpl;
72.21 -import org.netbeans.modules.sql.framework.model.impl.SourceColumnImpl;
72.22 import org.netbeans.modules.sql.framework.model.impl.SourceTableImpl;
72.23 -import org.netbeans.modules.sql.framework.model.impl.TargetColumnImpl;
72.24 import org.netbeans.modules.sql.framework.model.impl.TargetTableImpl;
72.25 import org.openide.NotifyDescriptor;
72.26 import org.openide.WizardDescriptor;
72.27 import org.openide.util.HelpCtx;
72.28
72.29 import com.sun.sql.framework.utils.Logger;
72.30 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
72.31 +import org.netbeans.modules.sql.framework.model.DBTable;
72.32 +import org.netbeans.modules.sql.framework.model.DatabaseModel;
72.33 +import org.netbeans.modules.sql.framework.model.impl.AbstractDBTable;
72.34
72.35 /**
72.36 * Implements a two-list transfer panel with bulk add/remove capability.
72.37 @@ -177,7 +171,7 @@
72.38 */
72.39 class ListTransferModel {
72.40
72.41 - private HashSet changeListeners;
72.42 + private HashSet<ChangeListener> changeListeners;
72.43 // Dropdown of schemas for a selected connection (source)
72.44 private DefaultComboBoxModel dest;
72.45
72.46 @@ -215,12 +209,17 @@
72.47 schemaTables = new DefaultListModel();
72.48 nameToModelMap = new HashMap<String, SQLDBTable>();
72.49
72.50 - selectedTableModel = new DefaultTableModel(new Object[][]{}, tableHeaders ) { public boolean isCellEditable(int row, int col) { return false; } };
72.51 + selectedTableModel = new DefaultTableModel(new Object[][]{}, tableHeaders) {
72.52 + @Override
72.53 + public boolean isCellEditable(int row, int col) {
72.54 + return false;
72.55 + }
72.56 + };
72.57
72.58 setSourceList(srcColl);
72.59 setDestinationList(dstColl);
72.60
72.61 - changeListeners = new HashSet();
72.62 + changeListeners = new HashSet<ChangeListener>();
72.63 }
72.64
72.65
72.66 @@ -318,13 +317,13 @@
72.67 * @return List of current destination list contents
72.68 */
72.69 public List getSelectedTablesList() {
72.70 - ArrayList dstList = new ArrayList();
72.71 + ArrayList<SQLDBTable> dstList = new ArrayList<SQLDBTable>();
72.72 synchronized (this.selectedTableModel) {
72.73 for (int i = 0; i < selectedTableModel.getRowCount(); i++) {
72.74 String tableName = (String) selectedTableModel.getValueAt(i, 0);
72.75 String schemaName = (String) selectedTableModel.getValueAt(i, 1);
72.76 String key = schemaName + "." + tableName;
72.77 - SQLDBTable tableModel = (SQLDBTable) this.nameToModelMap.get(key);
72.78 + SQLDBTable tableModel = this.nameToModelMap.get(key);
72.79 if (tableModel != null) {
72.80 dstList.add(tableModel);
72.81 }
72.82 @@ -395,7 +394,7 @@
72.83 * @return List of current source list contents
72.84 */
72.85 public List getSourceList() {
72.86 - ArrayList srcList = new ArrayList();
72.87 + ArrayList<Object> srcList = new ArrayList<Object>();
72.88
72.89 synchronized (source) {
72.90 source.trimToSize();
72.91 @@ -533,6 +532,7 @@
72.92 setText(protoString.toString());
72.93 }
72.94
72.95 + @Override
72.96 public Component getListCellRendererComponent(JList list,
72.97 Object value,
72.98 int index,
72.99 @@ -614,28 +614,28 @@
72.100 public static final String TIP_REMOVE_ALL = "Remove all items";
72.101
72.102 /**
72.103 - * Indicates whether OTDs in the given List have enough selected tables to allow for
72.104 + * Indicates whether Databases in the given List have enough selected tables to allow for
72.105 * creation of a join from among the set of tables.
72.106 *
72.107 * @return true if number of selected tables is sufficient to create a join; false
72.108 * otherwise
72.109 */
72.110 - static boolean hasEnoughTablesForJoin(List otds) {
72.111 - return (getSelectedTableCount(otds) >= 2);
72.112 + static boolean hasEnoughTablesForJoin(List db) {
72.113 + return (getSelectedTableCount(db) >= 2);
72.114 }
72.115
72.116 /**
72.117 - * Counts number of selected tables in the given List of OTDs.
72.118 + * Counts number of selected tables in the given List of Databases.
72.119 *
72.120 - * @param srcOtds List of OTDs to iterate through
72.121 - * @return count of selected tables in <code>srcOtds</code>
72.122 + * @param srcDb List of Databases to iterate through
72.123 + * @return count of selected tables in <code>srcDb</code>
72.124 */
72.125 - private static int getSelectedTableCount(List otds) {
72.126 + private static int getSelectedTableCount(List db) {
72.127 int selected = 0;
72.128
72.129 - Iterator otdIter = otds.iterator();
72.130 - while (otdIter.hasNext()) {
72.131 - SQLDBModel dbModel = (SQLDBModel) otdIter.next();
72.132 + Iterator dbIter = db.iterator();
72.133 + while (dbIter.hasNext()) {
72.134 + SQLDBModel dbModel = (SQLDBModel) dbIter.next();
72.135 Iterator tblIter = dbModel.getTables().iterator();
72.136 while (tblIter.hasNext()) {
72.137 if (((SQLDBTable) tblIter.next()).isSelected()) {
72.138 @@ -648,12 +648,12 @@
72.139 }
72.140
72.141 private static List getTableNames(ListModel dest) {
72.142 - ArrayList tabNameList = new ArrayList();
72.143 + ArrayList<DBTable> tabNameList = new ArrayList<DBTable>();
72.144 for (int i = 0; i < dest.getSize(); i++) {
72.145 - DatabaseModel otd = (DatabaseModel) dest.getElementAt(i);
72.146 - if (otd != null) {
72.147 + DatabaseModel db = (DatabaseModel) dest.getElementAt(i);
72.148 + if (db != null) {
72.149
72.150 - tabNameList.addAll(otd.getTables());
72.151 + tabNameList.addAll(db.getTables());
72.152 }
72.153 }
72.154 return tabNameList;
72.155 @@ -701,6 +701,7 @@
72.156 });
72.157 schemaTablesList.setName("schemaTables");
72.158 schemaTablesList.addMouseListener(new java.awt.event.MouseAdapter() {
72.159 + @Override
72.160 public void mouseClicked(java.awt.event.MouseEvent evt) {
72.161 if(evt.getClickCount() == 2 && evt.getSource() instanceof JList ) {
72.162 moveSelectedTables();
72.163 @@ -801,7 +802,7 @@
72.164 private boolean isSource;
72.165
72.166 /* Set <ChangeListeners> */
72.167 - private final Set listeners = new HashSet(1);
72.168 + private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(1);
72.169
72.170 private ListTransferModel listModel;
72.171
72.172 @@ -826,17 +827,17 @@
72.173 * @param title String to be displayed as title of this panel
72.174 * @param dsList List of DatabaseModels used to populate datasource panel
72.175 * @param destColl Collection of selected DatabaseModels
72.176 - * @param sourceOTD true if this panel displays available selections for source OTDs;
72.177 - * false if it displays available destination OTDs
72.178 + * @param sourceDb true if this panel displays available selections for source Databases;
72.179 + * false if it displays available destination Databases
72.180 */
72.181 - public ETLCollaborationWizardTransferPanel(String title, List dsList, Collection destColl, boolean sourceOTD) {
72.182 + public ETLCollaborationWizardTransferPanel(String title, List dsList, Collection destColl, boolean sourceDb) {
72.183 this();
72.184 nameToConnMap = new HashMap<String, DatabaseConnection>();
72.185 if (title != null && title.trim().length() != 0) {
72.186 setName(title);
72.187 }
72.188
72.189 - this.isSource = sourceOTD;
72.190 + this.isSource = sourceDb;
72.191 listModel = new ListTransferModel(dsList, destColl);
72.192 String largestString = listModel.getPrototypeCell();
72.193
72.194 @@ -850,6 +851,7 @@
72.195 sourceList = new JList(listModel.getSourceModel());
72.196 sourceList.addMouseListener(new MouseAdapter() {
72.197
72.198 + @Override
72.199 public void mouseClicked(MouseEvent e) {
72.200 ((DefaultComboBoxModel) listModel.getDestinationModel()).removeAllElements();
72.201 schemaTablesList.setListData(new Vector());
72.202 @@ -858,7 +860,7 @@
72.203 // assigning the conn to the placeholder for current selected
72.204 // connection
72.205 selectedConnection = conn;
72.206 - DBMetaData meta = new DBMetaData();
72.207 + DBMetaDataFactory meta = new DBMetaDataFactory();
72.208 try {
72.209 ConnectionManager.getDefault().showConnectionDialog(selectedConnection);
72.210 meta.connectDB(selectedConnection.getJDBCConnection());
72.211 @@ -897,30 +899,20 @@
72.212 }
72.213
72.214 private List getSelectedDBModels(boolean isSource) throws Exception {
72.215 - Object ffTable = null;
72.216 - String tableDisplayString = null;
72.217 + AbstractDBTable newTable = null;
72.218 String connName = null;
72.219 - String ttype = "TABLE";
72.220 HashMap<String, SQLDBModel> nameToDBModelMap = new HashMap<String, SQLDBModel>();
72.221 - List dbModels = new ArrayList();
72.222 + List<SQLDBModel> dbModels = new ArrayList<SQLDBModel>();
72.223 List tableList = this.listModel.getSelectedTablesList();
72.224 if (tableList != null) {
72.225 for (int i = 0; i < tableList.size(); i++) {
72.226 - if (isSource) {
72.227 - ffTable = (SourceTableImpl) tableList.get(i);
72.228 - tableDisplayString = ((SourceTableImpl)ffTable).getQualifiedName();
72.229 - connName = this.listModel.getConnectionNameForTable(tableDisplayString, ((SourceTableImpl)ffTable).getSchema());
72.230 - } else {
72.231 - ffTable = (TargetTableImpl) tableList.get(i);
72.232 - tableDisplayString = ((TargetTableImpl)ffTable).getQualifiedName();
72.233 - connName = this.listModel.getConnectionNameForTable(tableDisplayString, ((TargetTableImpl)ffTable).getSchema());
72.234 - }
72.235 -
72.236 + newTable = (AbstractDBTable) tableList.get(i);
72.237 + connName = this.listModel.getConnectionNameForTable(newTable.getQualifiedName(), newTable.getSchema());
72.238 DatabaseConnection conn = this.nameToConnMap.get(connName);
72.239 if( conn != null ) {
72.240
72.241 // Add all tables to database
72.242 - DBMetaData meta = new DBMetaData();
72.243 + DBMetaDataFactory meta = new DBMetaDataFactory();
72.244 try {
72.245 meta.connectDB(conn.getJDBCConnection());
72.246
72.247 @@ -935,92 +927,11 @@
72.248 populateModel(model, conn, meta);
72.249 nameToDBModelMap.put(connName, model);
72.250 }
72.251 - Table t = null;
72.252 - if(ffTable instanceof SourceTableImpl) {
72.253 - t = meta.getTableMetaData(((SourceTableImpl)ffTable).getCatalog(),
72.254 - ((SourceTableImpl)ffTable).getSchema(), ((SourceTableImpl)ffTable).getName(), ttype);
72.255 - } else {
72.256 - t = meta.getTableMetaData(((TargetTableImpl)ffTable).getCatalog(),
72.257 - ((TargetTableImpl)ffTable).getSchema(), ((TargetTableImpl)ffTable).getName(), ttype);
72.258 - }
72.259 - meta.checkForeignKeys(t);
72.260 - meta.checkPrimaryKeys(t);
72.261
72.262 - TableColumn[] cols = t.getColumns();
72.263 - TableColumn tc = null;
72.264 - List pks = t.getPrimaryKeyColumnList();
72.265 - List pkCols = new ArrayList();
72.266 - Iterator it = pks.iterator();
72.267 - while(it.hasNext()) {
72.268 - KeyColumn kc = (KeyColumn)it.next();
72.269 - pkCols.add(kc.getColumnName());
72.270 - }
72.271 - if(pks.size()!=0) {
72.272 - PrimaryKeyImpl pkImpl = new PrimaryKeyImpl(((KeyColumn)t.getPrimaryKeyColumnList().get(0)).getName(), pkCols, true);
72.273 - if(ffTable instanceof SourceTableImpl) {
72.274 - ((SourceTableImpl)ffTable).setPrimaryKey(pkImpl);
72.275 - } else {
72.276 - ((TargetTableImpl)ffTable).setPrimaryKey(pkImpl);
72.277 - }
72.278 - }
72.279 - List fkList = t.getForeignKeyColumnList();
72.280 - it = fkList.iterator();
72.281 - while(it.hasNext()) {
72.282 - ForeignKeyColumn fkCol = (ForeignKeyColumn)it.next();
72.283 - ForeignKeyImpl fkImpl = new ForeignKeyImpl((SQLDBTable)ffTable, fkCol.getName(), fkCol.getImportKeyName(),
72.284 - fkCol.getImportTableName(), fkCol.getImportSchemaName(), fkCol.getImportCatalogName(), fkCol.getUpdateRule(),
72.285 - fkCol.getDeleteRule(), fkCol.getDeferrability());
72.286 - List fkColumns = new ArrayList();
72.287 - fkColumns.add(fkCol.getColumnName());
72.288 - String catalog = fkCol.getImportCatalogName();
72.289 - if (catalog == null) {
72.290 - catalog = "";
72.291 - }
72.292 - String schema = fkCol.getImportSchemaName();
72.293 - if(schema == null) {
72.294 - schema = "";
72.295 - }
72.296 - pks = meta.getPrimaryKeys(catalog, schema, fkCol.getImportTableName());
72.297 - List pkColumns = new ArrayList();
72.298 - Iterator pksIt = pks.iterator();
72.299 - while(pksIt.hasNext()) {
72.300 - KeyColumn kc = (KeyColumn)pksIt.next();
72.301 - pkColumns.add(kc.getColumnName());
72.302 - }
72.303 - fkImpl.setColumnNames(fkColumns, pkColumns);
72.304 - if(ffTable instanceof SourceTableImpl) {
72.305 - ((SourceTableImpl)ffTable).addForeignKey(fkImpl);
72.306 - } else {
72.307 - ((TargetTableImpl)ffTable).addForeignKey(fkImpl);
72.308 - }
72.309 - }
72.310 - for (int j = 0; j < cols.length; j++) {
72.311 - tc = cols[j];
72.312 - if (isSource) {
72.313 - SourceColumnImpl ffColumn = new SourceColumnImpl(tc.getName(), tc
72.314 - .getSqlTypeCode(), tc.getNumericScale(), tc
72.315 - .getNumericPrecision(), tc
72.316 - .getIsPrimaryKey(), tc.getIsForeignKey(),
72.317 - false /* isIndexed */, tc.getIsNullable());
72.318 - ((SourceTableImpl)ffTable).addColumn(ffColumn);
72.319 - } else {
72.320 - TargetColumnImpl ffColumn = new TargetColumnImpl(tc.getName(), tc
72.321 - .getSqlTypeCode(), tc.getNumericScale(), tc
72.322 - .getNumericPrecision(), tc
72.323 - .getIsPrimaryKey(), tc.getIsForeignKey(),
72.324 - false /* isIndexed */, tc.getIsNullable());
72.325 - ((TargetTableImpl)ffTable).addColumn(ffColumn);
72.326 - }
72.327 - }
72.328 - if(ffTable instanceof SourceTableImpl) {
72.329 - ((SourceTableImpl)ffTable).setEditable(true);
72.330 - ((SourceTableImpl)ffTable).setSelected(true);
72.331 - model.addTable((SourceTableImpl)ffTable);
72.332 - } else {
72.333 - ((TargetTableImpl)ffTable).setEditable(true);
72.334 - ((TargetTableImpl)ffTable).setSelected(true);
72.335 - model.addTable((TargetTableImpl)ffTable);
72.336 - }
72.337 + meta.populateColumns(newTable);
72.338 + newTable.setEditable(true);
72.339 + newTable.setSelected(true);
72.340 + model.addTable(newTable);
72.341 } catch (Exception e) {
72.342 throw e;
72.343 }
72.344 @@ -1035,7 +946,7 @@
72.345 return dbModels;
72.346 }
72.347
72.348 - private SQLDBModel populateModel(SQLDBModel model, DatabaseConnection conn, DBMetaData meta) {
72.349 + private SQLDBModel populateModel(SQLDBModel model, DatabaseConnection conn, DBMetaDataFactory meta) {
72.350 DBConnectionDefinition def = null;
72.351 try {
72.352 def = SQLModelObjectFactory.getInstance().createDBConnectionDefinition(conn.getDisplayName(),
72.353 @@ -1081,7 +992,7 @@
72.354 } //end actionPerformed
72.355
72.356 private void populateTableList(String schemaName) {
72.357 - DBMetaData dbMeta = new DBMetaData();
72.358 + DBMetaDataFactory dbMeta = new DBMetaDataFactory();
72.359 try {
72.360 if (ETLCollaborationWizardTransferPanel.this.selectedConnection == null) {
72.361 Logger.print(Logger.INFO, LOG_CATEGORY, null, "selectedConn is null");
72.362 @@ -1092,16 +1003,16 @@
72.363 String[][] tableList = dbMeta.getTablesAndViews("", schemaName, "", false);
72.364 SQLDBTable aTable = null;
72.365 String[] currTable = null;
72.366 - Vector tableNameList = new Vector();
72.367 + Vector<SQLDBTable> tableNameList = new Vector<SQLDBTable>();
72.368 if (tableList != null) {
72.369 for (int i = 0; i < tableList.length; i++) {
72.370 currTable = tableList[i];
72.371 if (isSource) {
72.372 - aTable = new SourceTableImpl(currTable[DBMetaData.NAME],
72.373 - currTable[DBMetaData.SCHEMA], currTable[DBMetaData.CATALOG]);
72.374 + aTable = new SourceTableImpl(currTable[DBMetaDataFactory.NAME],
72.375 + currTable[DBMetaDataFactory.SCHEMA], currTable[DBMetaDataFactory.CATALOG]);
72.376 } else {
72.377 - aTable = new TargetTableImpl(currTable[DBMetaData.NAME],
72.378 - currTable[DBMetaData.SCHEMA], currTable[DBMetaData.CATALOG]);
72.379 + aTable = new TargetTableImpl(currTable[DBMetaDataFactory.NAME],
72.380 + currTable[DBMetaDataFactory.SCHEMA], currTable[DBMetaDataFactory.CATALOG]);
72.381 }
72.382 tableNameList.add(aTable);
72.383 }
72.384 @@ -1210,7 +1121,7 @@
72.385 Iterator it;
72.386
72.387 synchronized (listeners) {
72.388 - it = new HashSet(listeners).iterator();
72.389 + it = new HashSet<ChangeListener>(listeners).iterator();
72.390 }
72.391
72.392 ChangeEvent ev = new ChangeEvent(this);
72.393 @@ -1241,7 +1152,7 @@
72.394 *
72.395 * @return ListTransferModel
72.396 */
72.397 - public synchronized ListTransferModel getModel() {
72.398 + synchronized ListTransferModel getModel() {
72.399 return listModel;
72.400 }
72.401
72.402 @@ -1261,6 +1172,7 @@
72.403 /**
72.404 * @see org.openide.WizardDescriptor.Panel#isValid
72.405 */
72.406 + @Override
72.407 public boolean isValid() {
72.408 return true;
72.409 }
72.410 @@ -1386,24 +1298,8 @@
72.411 * Called whenever the value of the selection changes.
72.412 *
72.413 * @param e the event that characterizes the change.
72.414 - * To be included in the TODO list-to be implemented
72.415 */
72.416 public void valueChanged(ListSelectionEvent e) {
72.417 - // Object src = e.getSource();
72.418 -
72.419 - // Enforce mutually exclusive focus between source and destination
72.420 - // lists.
72.421 -// if (sourceList.equals(src)) {
72.422 - // if (!destList.isSelectionEmpty()) {
72.423 - // destList.clearSelection();
72.424 - // }
72.425 - // } else if (destList.equals(src)) {
72.426 - // if (!sourceList.isSelectionEmpty()) {
72.427 - // sourceList.clearSelection();
72.428 - // }
72.429 - // } else {
72.430 - // TODO Log unhandled ListSelectionEvent as DEBUG message.
72.431 - // }
72.432 }
72.433
72.434 /**
73.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLTableSelectionWizard.java Sat Dec 08 10:04:51 2007 +0000
73.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLTableSelectionWizard.java Sat Dec 08 10:24:35 2007 +0000
73.3 @@ -53,15 +53,20 @@
73.4 import org.netbeans.api.db.explorer.DatabaseConnection;
73.5 import org.netbeans.api.db.explorer.JDBCDriver;
73.6 import org.netbeans.modules.etl.model.impl.ETLDefinitionImpl;
73.7 -import org.netbeans.modules.model.database.DBConnectionDefinition;
73.8 import org.netbeans.modules.sql.framework.common.jdbc.DesignTimeDBConnectionProvider;
73.9 import org.netbeans.modules.sql.framework.common.utils.DBExplorerConnectionUtil;
73.10 -import org.netbeans.modules.sql.framework.model.SQLConstants;
73.11 import org.netbeans.modules.sql.framework.model.SQLDBModel;
73.12 import org.netbeans.modules.sql.framework.model.SQLDBTable;
73.13
73.14 import com.sun.sql.framework.utils.StringUtil;
73.15 import com.sun.sql.framework.utils.Logger;
73.16 +import java.io.File;
73.17 +import java.io.FileInputStream;
73.18 +import java.io.FileNotFoundException;
73.19 +import java.io.IOException;
73.20 +import java.util.Properties;
73.21 +import org.netbeans.modules.mashup.db.ui.AxionDBConfiguration;
73.22 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
73.23
73.24 /**
73.25 * Presents choice source and target tables for inclusion in an ETL Definition.
73.26 @@ -70,51 +75,104 @@
73.27 * @version $Revision$
73.28 */
73.29 public class ETLTableSelectionWizard extends ETLWizard {
73.30 -
73.31 +
73.32 private static final String LOG_CATEGORY = ETLTableSelectionWizard.class.getName();
73.33 -
73.34 +
73.35 class Descriptor extends ETLWizardDescriptor {
73.36 +
73.37 public Descriptor(WizardDescriptor.Iterator iter) {
73.38 super(iter, context);
73.39 }
73.40 }
73.41 -
73.42 +
73.43 class WizardIterator extends ETLWizardIterator {
73.44 -
73.45 +
73.46 private List panels;
73.47 -
73.48 private List srcModels;
73.49 -
73.50 private List targetModels;
73.51 -
73.52 + public WizardDescriptor wiz;
73.53 +
73.54 public WizardIterator(ETLDefinitionImpl def) {
73.55 - srcModels = getDatabaseModels(def, def.getSourceDatabaseModels(), SQLConstants.SOURCE_DBMODEL);
73.56 - targetModels = getDatabaseModels(def, def.getTargetDatabaseModels(), SQLConstants.TARGET_DBMODEL);
73.57 - List currModels = new ArrayList();
73.58 - panels = new ArrayList(2);
73.59 - sourceTransferPanel = new ETLCollaborationWizardTransferFinishPanel(NbBundle.getMessage(ETLTableSelectionWizard.class,
73.60 - "TITLE_tblwizard_selectsources"), srcModels, currModels, true, true);
73.61 - panels.add(sourceTransferPanel);
73.62 - targetTransferPanel = new ETLCollaborationWizardTransferFinishPanel(NbBundle.getMessage(ETLTableSelectionWizard.class,
73.63 - "TITLE_tblwizard_selecttargets"), targetModels, currModels, false, true);
73.64 + panels = new ArrayList(2);
73.65 + List srcModel = new ArrayList();
73.66 + List destModel = new ArrayList();
73.67 + List dbModels = getModelConnections();
73.68 + sourceTransferPanel = new ETLCollaborationWizardTransferFinishPanel(NbBundle.getMessage(ETLCollaborationWizard.class, "TITLE_tblwizard_selectsources"), dbModels, srcModel, true);
73.69 + panels.add(sourceTransferPanel);
73.70 + targetTransferPanel = new ETLCollaborationWizardTransferFinishPanel(NbBundle.getMessage(ETLCollaborationWizard.class, "TITLE_tblwizard_selecttargets"), dbModels, destModel, false);
73.71 panels.add(targetTransferPanel);
73.72 }
73.73 -
73.74 +
73.75 + private String getDefaultWorkingFolder() {
73.76 + File conf = AxionDBConfiguration.getConfigFile();
73.77 + Properties prop = new Properties();
73.78 + try {
73.79 + FileInputStream in = new FileInputStream(conf);
73.80 + prop.load(in);
73.81 + } catch (FileNotFoundException ex) {
73.82 + //ignore
73.83 + } catch (IOException ex) {
73.84 + //ignore
73.85 + }
73.86 + return prop.getProperty(AxionDBConfiguration.PROP_DB_LOC);
73.87 + }
73.88 +
73.89 + private List getModelConnections() {
73.90 + List model = new ArrayList();
73.91 + // add flatfile databases to db explorer.
73.92 + String workDir = getDefaultWorkingFolder();
73.93 + File f = new File(workDir);
73.94 + File[] db = null;
73.95 + if (f.exists()) {
73.96 + db = f.listFiles();
73.97 + for (int i = 0; i < db.length; i++) {
73.98 + String ver = null;
73.99 + try {
73.100 + ver = db[i].getCanonicalPath() + "\\" + db[i].getName().toUpperCase() + ".VER";
73.101 + File version = new File(ver);
73.102 + if (version.exists()) {
73.103 + String url = "jdbc:axiondb:" + db[i].getName() + ":" + getDefaultWorkingFolder() + db[i].getName();
73.104 + DatabaseConnection con = ConnectionManager.getDefault().getConnection(url);
73.105 + if (con == null) {
73.106 + DBExplorerConnectionUtil.createConnection("org.axiondb.jdbc.AxionDriver", url, "sa", "sa");
73.107 + }
73.108 + }
73.109 + } catch (Exception ex) {
73.110 + //ignore
73.111 + }
73.112 + }
73.113 + }
73.114 + DatabaseConnection[] conns = ConnectionManager.getDefault().getConnections();
73.115 + if (conns.length > 0) {
73.116 + for (int i = 0; i < conns.length; i++) {
73.117 + if (conns[i] == null) {
73.118 + Logger.print(Logger.INFO, LOG_CATEGORY, null, "Got Null connection.");
73.119 + model.add("<NULL>");
73.120 + } else {
73.121 + model.add(conns[i]);
73.122 + }
73.123 + }
73.124 + } else {
73.125 + model.add("<None>");
73.126 + }
73.127 + return model;
73.128 + }
73.129 +
73.130 public String name() {
73.131 return "Select Source/Target Tables";
73.132 }
73.133 -
73.134 +
73.135 protected List createPanels() {
73.136 return Collections.unmodifiableList(panels);
73.137 }
73.138 -
73.139 +
73.140 protected String[] createSteps() {
73.141 try {
73.142 - return new String[] { NbBundle.getMessage(ETLTableSelectionWizard.class, "STEP_tblwizard_sources"),
73.143 - NbBundle.getMessage(ETLTableSelectionWizard.class, "STEP_tblwizard_targets")};
73.144 + return new String[]{NbBundle.getMessage(ETLTableSelectionWizard.class, "STEP_tblwizard_sources"), NbBundle.getMessage(ETLTableSelectionWizard.class, "STEP_tblwizard_targets")};
73.145 } catch (MissingResourceException e) {
73.146 Logger.printThrowable(Logger.DEBUG, LOG_CATEGORY, "createPanelTitles()", "Could not locate steps strings.", e);
73.147 - return new String[] {};
73.148 + return new String[]
73.149 + {};
73.150 }
73.151 }
73.152
73.153 @@ -124,23 +182,23 @@
73.154 private List getDatabaseModels(ETLDefinitionImpl def, Collection dbModels, int type) {
73.155 ArrayList list = new ArrayList();
73.156 Iterator it = dbModels.iterator();
73.157 -
73.158 +
73.159 List selModels = Collections.EMPTY_LIST;
73.160 if (type == org.netbeans.modules.sql.framework.model.SQLConstants.TARGET_DBMODEL) {
73.161 selModels = def.getTargetDatabaseModels();
73.162 } else {
73.163 selModels = def.getSourceDatabaseModels();
73.164 }
73.165 -
73.166 +
73.167 // This flag is used to find out if a DatabaseModel is already used
73.168 // if so then we delete that DatabaseModel from the passed in all available
73.169 // dbmodel list
73.170 boolean dbModelAlreadyUsed = false;
73.171 -
73.172 +
73.173 while (it.hasNext()) {
73.174 // this is already a dbmodel as passed in this metohd
73.175 SQLDBModel newDbModel = (SQLDBModel) it.next();
73.176 -
73.177 +
73.178 Iterator selIter = selModels.iterator();
73.179 while (selIter.hasNext()) {
73.180 SQLDBModel selModel = (SQLDBModel) selIter.next();
73.181 @@ -154,23 +212,19 @@
73.182 if (dbModelAlreadyUsed) {
73.183 DesignTimeDBConnectionProvider provider = new DesignTimeDBConnectionProvider();
73.184 try {
73.185 - for(int i = 0; i < connections.length; i++) {
73.186 - if(connections[i].getDatabaseURL().equals(
73.187 - newDbModel.getETLDBConnectionDefinition().getConnectionURL())) {
73.188 + for (int i = 0; i < connections.length; i++) {
73.189 + if (connections[i].getDatabaseURL().equals(newDbModel.getETLDBConnectionDefinition().getConnectionURL())) {
73.190 dbconn = connections[i];
73.191 break;
73.192 }
73.193 }
73.194 - if(dbconn == null) {
73.195 - JDBCDriver drv = DBExplorerConnectionUtil.registerDriverInstance(
73.196 - newDbModel.getETLDBConnectionDefinition().getDriverClass());
73.197 - dbconn = DatabaseConnection.create(drv, newDbModel.getETLDBConnectionDefinition().getConnectionURL(),
73.198 - newDbModel.getETLDBConnectionDefinition().getUserName(), (String)null,
73.199 - newDbModel.getETLDBConnectionDefinition().getPassword(), true);
73.200 + if (dbconn == null) {
73.201 + JDBCDriver drv = DBExplorerConnectionUtil.registerDriverInstance(newDbModel.getETLDBConnectionDefinition().getDriverClass());
73.202 + dbconn = DatabaseConnection.create(drv, newDbModel.getETLDBConnectionDefinition().getConnectionURL(), newDbModel.getETLDBConnectionDefinition().getUserName(), (String) null, newDbModel.getETLDBConnectionDefinition().getPassword(), true);
73.203 ConnectionManager.getDefault().addConnection(dbconn);
73.204 }
73.205 } catch (Exception ex) {
73.206 - //ignore
73.207 + //ignore
73.208 }
73.209 list.add(dbconn);
73.210 // remove this db model from passed in all dbmodel list
73.211 @@ -179,68 +233,61 @@
73.212 dbModelAlreadyUsed = false;
73.213 }
73.214 }
73.215 -
73.216 +
73.217 return list;
73.218 }
73.219 -
73.220 +
73.221 private boolean isIdenticalModel(SQLDBModel model1, SQLDBModel model2) {
73.222 boolean identical = model1.getModelName().equals(model2.getModelName());
73.223 -
73.224 +
73.225 final DBConnectionDefinition c1 = model1.getConnectionDefinition();
73.226 final DBConnectionDefinition c2 = model2.getConnectionDefinition();
73.227 -
73.228 +
73.229 if (c1 != null && c2 != null) {
73.230 - identical &= StringUtil.isIdentical(c1.getConnectionURL(), c2.getConnectionURL())
73.231 - && StringUtil.isIdentical(c1.getUserName(), c2.getUserName()) && StringUtil.isIdentical(c1.getPassword(), c2.getPassword());
73.232 + identical &= StringUtil.isIdentical(c1.getConnectionURL(), c2.getConnectionURL()) && StringUtil.isIdentical(c1.getUserName(), c2.getUserName()) && StringUtil.isIdentical(c1.getPassword(), c2.getPassword());
73.233 }
73.234 -
73.235 +
73.236 return identical;
73.237 }
73.238 -
73.239 +
73.240 protected List createPanels(WizardDescriptor wiz) {
73.241 - storeSettings(wiz, srcModels, targetModels);
73.242 + List dbModels = getModelConnections();
73.243 + storeSettings(wiz, dbModels);
73.244 return createPanels();
73.245 }
73.246 -
73.247 - public void storeSettings(Object settings, List srcModels, List targetModels) {
73.248 +
73.249 + public void storeSettings(Object settings, List models) {
73.250 WizardDescriptor wd = null;
73.251 if (settings instanceof ETLWizardContext) {
73.252 ETLWizardContext wizardContext = (ETLWizardContext) settings;
73.253 - wd = (WizardDescriptor) wizardContext
73.254 - .getProperty(ETLWizardContext.WIZARD_DESCRIPTOR);
73.255 -
73.256 + wd = (WizardDescriptor) wizardContext.getProperty(ETLWizardContext.WIZARD_DESCRIPTOR);
73.257 +
73.258 } else if (settings instanceof WizardDescriptor) {
73.259 wd = (WizardDescriptor) settings;
73.260 }
73.261 -
73.262 if (wd != null) {
73.263 // Don't commit if user didn't click next.
73.264 // if (wd.getValue() != WizardDescriptor.NEXT_OPTION) {
73.265 // return;
73.266 // }
73.267 - wd.putProperty(ETLCollaborationWizard.DATABASE_SOURCES, srcModels
73.268 - .toArray());
73.269 - wd.putProperty(ETLCollaborationWizard.DATABASE_TARGETS, targetModels
73.270 - .toArray());
73.271 + wd.putProperty(ETLCollaborationWizard.DATABASE_SOURCES, models.toArray());
73.272 + wd.putProperty(ETLCollaborationWizard.DATABASE_TARGETS, models.toArray());
73.273 }
73.274 }
73.275 }
73.276 -
73.277 - /** Constant string key for storing/retrieving destination OTDs from wizard context. */
73.278 + /** Constant string key for storing/retrieving destination Databases from wizard context. */
73.279 public static final String DESTINATION_MODELS = ETLCollaborationWizard.TARGET_DB;
73.280 -
73.281 /** Constant string key for storing/retrieving destination tables from wizard context. */
73.282 public static final String DESTINATION_TABLES = "destination_tables"; // NOI18N
73.283 -
73.284 - /** Constant string key for storing/retrieving source OTDs from wizard context. */
73.285 +
73.286 + /** Constant string key for storing/retrieving source Databases from wizard context. */
73.287 public static final String SOURCE_MODELS = ETLCollaborationWizard.SOURCE_DB;
73.288 -
73.289 /** Constant string key for storing/retrieving source tables from wizard context. */
73.290 public static final String SOURCE_TABLES = "source_tables"; // NOI18N
73.291 -
73.292 +
73.293 /* Log4J category string */
73.294 //private static final String LOG_CATEGORY = ETLTableSelectionWizard.class.getName();
73.295 -
73.296 +
73.297 /**
73.298 * Iterates through the given List, removing db model that have no DBTable instances where
73.299 * isSelected() returns true.
73.300 @@ -251,14 +298,14 @@
73.301 */
73.302 public static final List removeModelsWithNoSelectedTables(List list) {
73.303 List filteredList = Collections.EMPTY_LIST;
73.304 -
73.305 +
73.306 if (list != null && !list.isEmpty()) {
73.307 filteredList = new ArrayList(list.size());
73.308 Iterator iter = list.iterator();
73.309 while (iter.hasNext()) {
73.310 SQLDBModel dbModel = (SQLDBModel) iter.next();
73.311 -
73.312 - // Don't filter out unselected tables from OTDs just yet...user might
73.313 +
73.314 + // Don't filter out unselected tables from Databases just yet...user might
73.315 // go back and change their selections, but the underlying DBModel
73.316 // will be out-of-sync with the GUI.
73.317 if (hasSelectedTables(dbModel)) {
73.318 @@ -266,21 +313,21 @@
73.319 }
73.320 }
73.321 }
73.322 -
73.323 +
73.324 return filteredList;
73.325 }
73.326 -
73.327 - static final void removeUnselectedTables(List otds) {
73.328 - Iterator it = otds.iterator();
73.329 +
73.330 + static final void removeUnselectedTables(List db) {
73.331 + Iterator it = db.iterator();
73.332 while (it.hasNext()) {
73.333 removeUnselectedTables((SQLDBModel) it.next());
73.334 }
73.335 }
73.336 -
73.337 +
73.338 static final void removeUnselectedTables(SQLDBModel dbModel) {
73.339 List tables = dbModel.getTables();
73.340 Iterator it = tables.iterator();
73.341 -
73.342 +
73.343 while (it.hasNext()) {
73.344 SQLDBTable table = (SQLDBTable) it.next();
73.345 if (!table.isSelected() || !table.isEditable()) {
73.346 @@ -288,7 +335,7 @@
73.347 }
73.348 }
73.349 }
73.350 -
73.351 +
73.352 /*
73.353 * Indicates whether the given SQLDBModel instance has at least one table
73.354 * selected by the user. Does not remove unselected tables from <code> dbModel </code>
73.355 @@ -298,10 +345,10 @@
73.356 */
73.357 private static final boolean hasSelectedTables(SQLDBModel dbModel) {
73.358 boolean hasSelected = false;
73.359 -
73.360 +
73.361 List tables = dbModel.getTables();
73.362 Iterator it = tables.iterator();
73.363 -
73.364 +
73.365 while (it.hasNext()) {
73.366 SQLDBTable table = (SQLDBTable) it.next();
73.367 if (table.isSelected() && table.isEditable()) {
73.368 @@ -309,63 +356,58 @@
73.369 break;
73.370 }
73.371 }
73.372 -
73.373 +
73.374 return hasSelected;
73.375 }
73.376 -
73.377 /* Defines panels to be displayed */
73.378 private WizardDescriptor descriptor;
73.379 -
73.380 private ETLDefinitionImpl etlDef;
73.381 -
73.382 /* Wizard iterator; handles display and movement among wizard panels */
73.383 private ETLWizardIterator iterator;
73.384 -
73.385 private ETLCollaborationWizardTransferFinishPanel sourceTransferPanel;
73.386 -
73.387 private ETLCollaborationWizardTransferFinishPanel targetTransferPanel;
73.388 -
73.389 +
73.390 /**
73.391 - * Creates a new instance of DatabaseOTDWizard
73.392 + * Creates a new instance of DatabaseWizard
73.393 *
73.394 * @param def ETLDefinitionProjectElement containing table data
73.395 */
73.396 public ETLTableSelectionWizard(ETLDefinitionImpl def) {
73.397 etlDef = def;
73.398 }
73.399 -
73.400 +
73.401 /**
73.402 * @see ETLWizard#getDescriptor
73.403 */
73.404 public WizardDescriptor getDescriptor() {
73.405 return descriptor;
73.406 }
73.407 -
73.408 +
73.409 /**
73.410 * @see ETLWizard#getIterator
73.411 */
73.412 public WizardDescriptor.Iterator getIterator() {
73.413 return iterator;
73.414 }
73.415 -
73.416 +
73.417 /**
73.418 - * Gets List of destination OTDs as selected by user.
73.419 + * Gets List of destination Databases as selected by user.
73.420 *
73.421 - * @return List (possibly empty) of selected destination OTDs
73.422 + * @return List (possibly empty) of selected destination Databases
73.423 */
73.424 public List getSelectedDestinationModels() {
73.425 return getSelectedModelsOfType(ETLTableSelectionWizard.DESTINATION_MODELS);
73.426 }
73.427 -
73.428 +
73.429 /**
73.430 * Gets List of source Models as selected by user.
73.431 *
73.432 - * @return List (possibly empty) of selected source OTDs
73.433 + * @return List (possibly empty) of selected source Databases
73.434 */
73.435 public List getSelectedSourceModels() {
73.436 return getSelectedModelsOfType(ETLTableSelectionWizard.SOURCE_MODELS);
73.437 }
73.438 -
73.439 +
73.440 /**
73.441 * Initializes iterator and descriptor for this wizard.
73.442 */
73.443 @@ -375,24 +417,24 @@
73.444 if (sourceTransferPanel != null) {
73.445 sourceTransferPanel.updatePanelState();
73.446 }
73.447 -
73.448 +
73.449 if (targetTransferPanel != null) {
73.450 targetTransferPanel.updatePanelState();
73.451 }
73.452 }
73.453 -
73.454 +
73.455 /**
73.456 * Performs processing to handle cancellation of this wizard.
73.457 */
73.458 protected void cancel() {
73.459 }
73.460 -
73.461 +
73.462 /**
73.463 * Performs processing to cleanup any resources used by this wizard.
73.464 */
73.465 protected void cleanup() {
73.466 }
73.467 -
73.468 +
73.469 /**
73.470 * Performs processing to handle committal of data gathered by this wizard.
73.471 */
73.472 @@ -401,24 +443,24 @@
73.473 // from them.
73.474 List models = new ArrayList(getSelectedSourceModels());
73.475 models.addAll(getSelectedDestinationModels());
73.476 -
73.477 +
73.478 ETLTableSelectionWizard.removeUnselectedTables(models);
73.479 }
73.480 -
73.481 +
73.482 /**
73.483 * @see org.netbeans.modules.etl.ui.view.wizards.ETLWizard#getDialogTitle()
73.484 */
73.485 protected String getDialogTitle() {
73.486 return NbBundle.getMessage(ETLTableSelectionWizard.class, "TITLE_dlg_selecttables");
73.487 }
73.488 -
73.489 +
73.490 private List getSelectedModelsOfType(String typeKey) {
73.491 List selections = Collections.EMPTY_LIST;
73.492 -
73.493 +
73.494 if (descriptor != null && typeKey != null) {
73.495 selections = ETLTableSelectionWizard.removeModelsWithNoSelectedTables((List) descriptor.getProperty(typeKey));
73.496 }
73.497 -
73.498 +
73.499 return selections;
73.500 }
73.501 }
74.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLWizardHelper.java Sat Dec 08 10:04:51 2007 +0000
74.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/ETLWizardHelper.java Sat Dec 08 10:24:35 2007 +0000
74.3 @@ -30,21 +30,21 @@
74.4 }
74.5
74.6 /**
74.7 - * Gets List of destination OTDs as selected by user.
74.8 + * Gets List of destination Databases as selected by user.
74.9 *
74.10 - * @return List (possibly empty) of selected destination OTDs
74.11 + * @return List (possibly empty) of selected destination Databases
74.12 */
74.13 - public List getSelectedDestinationOtds() {
74.14 - return getSelectedOtdsOfType(ETLCollaborationWizard.TARGET_DB, this.mDescriptor);
74.15 + public List getSelectedDestinationDb() {
74.16 + return getSelectedDbOfType(ETLCollaborationWizard.TARGET_DB, this.mDescriptor);
74.17 }
74.18
74.19 /**
74.20 - * Gets List of source OTDs as selected by user.
74.21 + * Gets List of source Databases as selected by user.
74.22 *
74.23 - * @return List (possibly empty) of selected source OTDs
74.24 + * @return List (possibly empty) of selected source Databases
74.25 */
74.26 - public List getSelectedSourceOtds() {
74.27 - return getSelectedOtdsOfType(ETLCollaborationWizard.SOURCE_DB, this.mDescriptor);
74.28 + public List getSelectedSourceDb() {
74.29 + return getSelectedDbOfType(ETLCollaborationWizard.SOURCE_DB, this.mDescriptor);
74.30 }
74.31
74.32 public SQLJoinView getSQLJoinView() {
74.33 @@ -55,7 +55,7 @@
74.34 return (List) this.mDescriptor.getProperty(ETLCollaborationWizard.JOIN_VIEW_VISIBLE_COLUMNS);
74.35 }
74.36
74.37 - private static List getSelectedOtdsOfType(String typeKey, WizardDescriptor descriptor) {
74.38 + private static List getSelectedDbOfType(String typeKey, WizardDescriptor descriptor) {
74.39 List selections = Collections.EMPTY_LIST;
74.40 if (descriptor != null && typeKey != null) {
74.41 selections = (List) descriptor.getProperty(typeKey);
75.1 --- a/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/PhysicalView.java Sat Dec 08 10:04:51 2007 +0000
75.2 +++ b/etl.editor/src/org/netbeans/modules/etl/ui/view/wizards/PhysicalView.java Sat Dec 08 10:24:35 2007 +0000
75.3 @@ -150,9 +150,6 @@
75.4
75.5 /**
75.6 * DOCUMENT ME!
75.7 - *
75.8 - * @author $author$
75.9 - * @version $Revision$
75.10 */
75.11 static final class VisibilityQueryDataFilter implements ChangeListener, ChangeableDataFilter {
75.12 /**
75.13 @@ -221,9 +218,6 @@
75.14
75.15 /**
75.16 * DOCUMENT ME!
75.17 - *
75.18 - * @author $author$
75.19 - * @version $Revision$
75.20 */
75.21 static final class GroupNode extends FilterNode implements PropertyChangeListener {
75.22 private static final DataFilter VISIBILITY_QUERY_FILTER = new VisibilityQueryDataFilter();
75.23 @@ -418,9 +412,6 @@
75.24
75.25 /**
75.26 * DOCUMENT ME!
75.27 - *
75.28 - * @author $author$
75.29 - * @version $Revision$
75.30 */
75.31 public static class PathFinder {
75.32 private SourceGroup group;
76.1 --- a/etl.editor/src/org/netbeans/modules/etl/utils/ETLDeploymentConstants.java Sat Dec 08 10:04:51 2007 +0000
76.2 +++ b/etl.editor/src/org/netbeans/modules/etl/utils/ETLDeploymentConstants.java Sat Dec 08 10:24:35 2007 +0000
76.3 @@ -47,6 +47,8 @@
76.4 * @author Sudhi seshachala
76.5 * @version $Revision$
76.6 */
76.7 +
76.8 +//TODO: XXXX Need to clean this XXXX
76.9 public class ETLDeploymentConstants {
76.10
76.11 public static String AXION_URL_PREFIX = "jdbc:axiondb:";
77.1 --- a/etl.editor/src/org/netbeans/modules/etl/utils/MessageManager.java Sat Dec 08 10:04:51 2007 +0000
77.2 +++ b/etl.editor/src/org/netbeans/modules/etl/utils/MessageManager.java Sat Dec 08 10:24:35 2007 +0000
77.3 @@ -60,13 +60,13 @@
77.4 * the classpath.
77.5 * <p>
77.6 * Please see the documentation for java.util.ResourceBundle for more information.
77.7 - *
77.8 + *
77.9 * @author sseshachala
77.10 * @version :$Revision$
77.11 */
77.12 +public class MessageManager {
77.13
77.14 -public class MessageManager {
77.15 - private static HashMap managers = new HashMap();
77.16 + private static HashMap<String, MessageManager> managers = new HashMap<String, MessageManager>();
77.17
77.18 public static synchronized MessageManager getManager(java.lang.Class theClass) {
77.19 return getManager(theClass.getPackage().getName());
77.20 @@ -75,40 +75,36 @@
77.21 /**
77.22 * Get the MessageManager for a particular package. If a manager for a package already
77.23 * exists, it will be reused, else a new MessageManager will be created and returned.
77.24 - *
77.25 + *
77.26 * @param packageName for which the MessageManager needs to be picked
77.27 * @return MessageManager For the given packageName
77.28 */
77.29 -
77.30 public static synchronized MessageManager getManager(String packageName) {
77.31 if (managers != null) {
77.32 - MessageManager mgr = (MessageManager) managers.get(packageName);
77.33 + MessageManager mgr = managers.get(packageName);
77.34 if (mgr == null) {
77.35 mgr = new MessageManager(packageName);
77.36 managers.put(packageName, mgr);
77.37 }
77.38 return mgr;
77.39 }
77.40 - managers = new HashMap();
77.41 + managers = new HashMap<String, MessageManager>();
77.42 MessageManager mgr = new MessageManager(packageName);
77.43 managers.put(packageName, mgr);
77.44 return mgr;
77.45 }
77.46 -
77.47 /**
77.48 * The ResourceBundle for this MessageManager.
77.49 */
77.50 -
77.51 private ResourceBundle bundle;
77.52
77.53 /**
77.54 * Creates a new MessageManager for a given package. This is a private method and all
77.55 * access to it is arbitrated by the static getManager method call so that only one
77.56 * MessageManager per package will be created.
77.57 - *
77.58 + *
77.59 * @param packageName Name of package to create MessageManager for.
77.60 */
77.61 -
77.62 private MessageManager(String packageName) {
77.63 String bundleName = packageName + ".";
77.64 bundleName = bundleName + "LocalStrings";
77.65 @@ -117,11 +113,10 @@
77.66
77.67 /**
77.68 * Get a string from the underlying resource bundle.
77.69 - *
77.70 + *
77.71 * @param key for which msg needs to retrieved from HashMap
77.72 * @return String The MessageFormat for given Key
77.73 */
77.74 -
77.75 public synchronized String getString(String key) {
77.76 if (key == null) {
77.77 String msg = "key is null";
77.78 @@ -147,52 +142,49 @@
77.79 /**
77.80 * Get a string from the underlying resource bundle and format it with the given
77.81 * object argument. This argument can of course be a String object.
77.82 - *
77.83 + *
77.84 * @param key For which String needs to be displayed
77.85 * @param arg That is the result for Info, ERR or Exception
77.86 * @return String MessageString for given Key
77.87 */
77.88 -
77.89 public synchronized String getString(String key, Object arg) {
77.90 - Object[] args = new Object[] { arg};
77.91 + Object[] args = new Object[]{arg};
77.92 return getString(key, args);
77.93 }
77.94
77.95 /**
77.96 * Get a string from the underlying resource bundle and format it with the given
77.97 * object arguments. These arguments can of course be String objects.
77.98 - *
77.99 + *
77.100 * @param key For which Message needs to be constructed
77.101 * @param arg1 used for message construction
77.102 * @param arg2 used for message construction
77.103 * @return String Message String for the given key
77.104 */
77.105 -
77.106 public String getString(String key, Object arg1, Object arg2) {
77.107 - Object[] args = new Object[] { arg1, arg2};
77.108 + Object[] args = new Object[]{arg1, arg2};
77.109 return getString(key, args);
77.110 }
77.111
77.112 /**
77.113 * Get a string from the underlying resource bundle and format it with the given
77.114 * object arguments. These arguments can of course be String objects.
77.115 - *
77.116 + *
77.117 * @param key For which Message needs to be constructed
77.118 * @param arg1 Used for messageConstruction
77.119 * @param arg2 Used for message construction
77.120 * @param arg3 used for message construction
77.121 * @return String for given key and args.
77.122 */
77.123 -
77.124 public String getString(String key, Object arg1, Object arg2, Object arg3) {
77.125 - Object[] args = new Object[] { arg1, arg2, arg3};
77.126 + Object[] args = new Object[]{arg1, arg2, arg3};
77.127 return getString(key, args);
77.128 }
77.129
77.130 /**
77.131 * Get a string from the underlying resource bundle and format it with the given
77.132 * object arguments. These arguments can of course be String objects.
77.133 - *
77.134 + *
77.135 * @param key For which Message needs to be constructed
77.136 * @param arg1 Used for messageConstruction
77.137 * @param arg2 Used for messageConstruction
77.138 @@ -200,16 +192,15 @@
77.139 * @param arg4 Used for messageConstruction
77.140 * @return String MessageString for the given String And Args
77.141 */
77.142 -
77.143 public String getString(String key, Object arg1, Object arg2, Object arg3, Object arg4) {
77.144 - Object[] args = new Object[] { arg1, arg2, arg3, arg4};
77.145 + Object[] args = new Object[]{arg1, arg2, arg3, arg4};
77.146 return getString(key, args);
77.147 }
77.148
77.149 /**
77.150 * Get a string from the underlying resource bundle and format it with the given set
77.151 * of arguments.
77.152 - *
77.153 + *
77.154 * @param key For which MessageFormat needs to be picked for a key
77.155 * @param args This contains the arguments
77.156 * @return String Message Format for given key and arguments
77.157 @@ -219,11 +210,11 @@
77.158 String value = getString(key);
77.159
77.160 try {
77.161 - Object nonNullArgs[] = args;
77.162 + Object[] nonNullArgs = args;
77.163 for (int i = 0; i < args.length; i++) {
77.164 if (args[i] == null) {
77.165 if (nonNullArgs == args) {
77.166 - nonNullArgs = (Object[]) args.clone();
77.167 + nonNullArgs = args.clone();
77.168 }
77.169 nonNullArgs[i] = "null";
77.170 }
77.171 @@ -241,6 +232,4 @@
77.172
77.173 return iString;
77.174 }
77.175 -
77.176 }
77.177 -
78.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/bootstrap/FlatfileBootstrapParserFactory.java Sat Dec 08 10:04:51 2007 +0000
78.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/bootstrap/FlatfileBootstrapParserFactory.java Sat Dec 08 10:24:35 2007 +0000
78.3 @@ -47,7 +47,6 @@
78.4 import java.util.List;
78.5 import java.util.Map;
78.6
78.7 -import org.netbeans.modules.mashup.db.common.FlatfileDBException;
78.8 import org.netbeans.modules.mashup.db.common.PropertyKeys;
78.9 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
78.10
79.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/bootstrap/WebBootstrapParser.java Sat Dec 08 10:04:51 2007 +0000
79.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/bootstrap/WebBootstrapParser.java Sat Dec 08 10:24:35 2007 +0000
79.3 @@ -128,12 +128,16 @@
79.4 }
79.5
79.6 public boolean acceptable(FlatfileDBTable table) throws FlatfileDBException {
79.7 - try {
79.8 - getElement(table.getProperty(PropertyKeys.URL), 1);
79.9 - } catch (Exception ex) {
79.10 - return false;
79.11 + String url = table.getProperty(PropertyKeys.URL).toLowerCase();
79.12 + if(url.startsWith("http://") || url.startsWith("https://") || url.startsWith("ftp://") || url.endsWith(".html") || url.endsWith(".htm")){
79.13 + try{
79.14 + getElement(table.getProperty(PropertyKeys.URL), 1);
79.15 + } catch(Exception e){
79.16 + return false;
79.17 + }
79.18 + return true;
79.19 }
79.20 - return true;
79.21 + return false;
79.22 }
79.23
79.24 private FlatfileDBColumn[] getColumns(FlatfileDBTable table) {
80.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/bootstrap/WebrowsetBootstrapParser.java Sat Dec 08 10:04:51 2007 +0000
80.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/bootstrap/WebrowsetBootstrapParser.java Sat Dec 08 10:24:35 2007 +0000
80.3 @@ -111,17 +111,21 @@
80.4 }
80.5
80.6 private WebRowSet getWebRowset(String string) throws Exception {
80.7 - WebRowSet wrs = new WebRowSetImpl();
80.8 - string = StringUtil.escapeControlChars(string);
80.9 - File f = new File(string);
80.10 - InputStream is = null;
80.11 - if(f.exists()) {
80.12 - is = new FileInputStream(f);
80.13 - } else {
80.14 - is = new URL(string).openStream();
80.15 + try {
80.16 + WebRowSet wrs = new WebRowSetImpl();
80.17 + string = StringUtil.escapeControlChars(string);
80.18 + File f = new File(string);
80.19 + InputStream is = null;
80.20 + if(f.exists()) {
80.21 + is = new FileInputStream(f);
80.22 + } else {
80.23 + is = new URL(string).openStream();
80.24 + }
80.25 + wrs.readXml(is);
80.26 + wrs.getMetaData().getColumnCount();
80.27 + return wrs;
80.28 + } catch (Exception e) {
80.29 + throw new FlatfileDBException("Unable to parse: " + string);
80.30 }
80.31 - wrs.readXml(is);
80.32 - wrs.getMetaData().getColumnCount();
80.33 - return wrs;
80.34 }
80.35 }
80.36 \ No newline at end of file
81.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/common/FlatfileDBConnectionFactory.java Sat Dec 08 10:04:51 2007 +0000
81.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/common/FlatfileDBConnectionFactory.java Sat Dec 08 10:24:35 2007 +0000
81.3 @@ -91,13 +91,13 @@
81.4 Facing problem when connection used by other modules like ETL Engine. */
81.5
81.6 // WT #67399: if class loader is not specified, use the class loader
81.7 - // associated with flatfile db otd module to avoid instantiating Axion classes
81.8 + // associated with flatfile db module to avoid instantiating Axion classes
81.9 // which are associated with eBAM.
81.10 -// if (cl == null) {
81.11 -// cl = FlatfileDBConnectionFactory.class.getClassLoader();
81.12 -// }
81.13 -//
81.14 -// Thread.currentThread().setContextClassLoader(cl);
81.15 + // if (cl == null) {
81.16 + // cl = FlatfileDBConnectionFactory.class.getClassLoader();
81.17 + // }
81.18 + //
81.19 + // Thread.currentThread().setContextClassLoader(cl);
81.20 registerDriver();
81.21
81.22 if (props != null) {
81.23 @@ -128,11 +128,11 @@
81.24 // WT #67399: if class loader is not specified, use the class loader
81.25 // associated with flatfile db module to avoid instantiating Axion classes
81.26 // which are associated with eBAM.
81.27 -// if (cl == null) {
81.28 -// cl = FlatfileDBConnectionFactory.class.getClassLoader();
81.29 -// }
81.30 + // if (cl == null) {
81.31 + // cl = FlatfileDBConnectionFactory.class.getClassLoader();
81.32 + // }
81.33 + //Thread.currentThread().setContextClassLoader(cl);
81.34
81.35 - //Thread.currentThread().setContextClassLoader(cl);
81.36 Driver drv = registerDriver();
81.37 Properties prop = new Properties();
81.38 prop.setProperty("user", uid);
82.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/common/FlatfileDBException.java Sat Dec 08 10:04:51 2007 +0000
82.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/common/FlatfileDBException.java Sat Dec 08 10:24:35 2007 +0000
82.3 @@ -42,7 +42,7 @@
82.4
82.5 /**
82.6 * Base class for exceptions thrown within the Flatfile Database module.
82.7 - *
82.8 + *
82.9 * @author Jonathan Giron
82.10 * @version $Revision$
82.11 */
83.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDBColumn.java Sat Dec 08 10:04:51 2007 +0000
83.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDBColumn.java Sat Dec 08 10:24:35 2007 +0000
83.3 @@ -42,8 +42,7 @@
83.4
83.5 import java.util.Map;
83.6
83.7 -import org.netbeans.modules.model.database.DBColumn;
83.8 -import org.w3c.dom.Element;
83.9 +import org.netbeans.modules.sql.framework.model.SQLDBColumn;
83.10
83.11
83.12 /**
83.13 @@ -54,7 +53,7 @@
83.14 * @author Ahimanikya Satapathy
83.15 * @version $Revision$
83.16 */
83.17 -public interface FlatfileDBColumn extends DBColumn {
83.18 +public interface FlatfileDBColumn extends SQLDBColumn {
83.19
83.20 int getCardinalPosition();
83.21
83.22 @@ -87,88 +86,7 @@
83.23 */
83.24 boolean isSelected();
83.25
83.26 - void parseXML(Element xmlElement);
83.27 void setCardinalPosition(int theCardinalPosition);
83.28
83.29 - /**
83.30 - * sets the default value
83.31 - *
83.32 - * @param default value to be set
83.33 - */
83.34 - void setDefaultValue(String defValue);
83.35 -
83.36 - /**
83.37 - * Sets whether this column is flagged as part of a foreign key.
83.38 - *
83.39 - * @param newFlag true if this column is part of a foreign key; false otherwise
83.40 - */
83.41 - void setForeignKey(boolean newFlag);
83.42 -
83.43 - /**
83.44 - * Sets whether this column is flagged as indexed.
83.45 - *
83.46 - * @param newFlag true if this column is indexed; false otherwise
83.47 - */
83.48 - void setIndexed(boolean newFlag);
83.49 -
83.50 - /**
83.51 - * Indicates whether this DBColumn references the given DBColumn in a FK -> PK
83.52 - * relationship.
83.53 - *
83.54 - * @param column PK whose relationship to this column is to be checked
83.55 - * @return true if this column is a FK reference to column; false otherwise
83.56 - */
83.57 - // public boolean references(DBColumn column);
83.58 - /**
83.59 - * Indicates whether this DBColumn is referenced by the given DBColumn in a FK -> PK
83.60 - * relationship.
83.61 - *
83.62 - * @param column potential FK reference to be checked
83.63 - * @return true if column is referenced as a PK by the given column, false otherwise
83.64 - */
83.65 - // public boolean isReferencedBy(DBColumn column);
83.66 - /**
83.67 - * Sets SQL type code.
83.68 - *
83.69 - * @param newCode SQL code
83.70 - * @throws FlatfileDBException if newCode is not a recognized SQL type code
83.71 - */
83.72 - void setJdbcType(int newType);
83.73 -
83.74 - void setName(String theName);
83.75 -
83.76 - /**
83.77 - * Sets whether this column is flagged as nullable.
83.78 - *
83.79 - * @param newFlag true if this column is nullable; false otherwise
83.80 - */
83.81 - void setNullable(boolean newFlag);
83.82 -
83.83 - /**
83.84 - * Sets reference to DBTable that owns this DBColumn.
83.85 - *
83.86 - * @param newParent new parent of this column.
83.87 - */
83.88 - void setParent(FlatfileDBTable newParent);
83.89 -
83.90 - void setPrecision(int thePrecision);
83.91 -
83.92 - /**
83.93 - * Sets whether this column is flagged as part of a primary key.
83.94 - *
83.95 - * @param newFlag true if this column is part of a primary key; false otherwise
83.96 - */
83.97 - void setPrimaryKey(boolean newFlag);
83.98 -
83.99 - void setScale(int theScale);
83.100 -
83.101 - /**
83.102 - * Marshall this object to XML string.
83.103 - *
83.104 - * @param prefix
83.105 - * @return XML string
83.106 - */
83.107 - String toXMLString(String prefix);
83.108 -
83.109 }
83.110
84.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDBConnectionDefinition.java Sat Dec 08 10:04:51 2007 +0000
84.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDBConnectionDefinition.java Sat Dec 08 10:24:35 2007 +0000
84.3 @@ -40,7 +40,7 @@
84.4 */
84.5 package org.netbeans.modules.mashup.db.model;
84.6
84.7 -import org.netbeans.modules.model.database.DBConnectionDefinition;
84.8 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
84.9 import org.w3c.dom.Element;
84.10
84.11
85.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDBTable.java Sat Dec 08 10:04:51 2007 +0000
85.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDBTable.java Sat Dec 08 10:24:35 2007 +0000
85.3 @@ -43,9 +43,8 @@
85.4 import java.io.File;
85.5 import java.util.Map;
85.6
85.7 -import org.netbeans.modules.model.database.DBTable;
85.8 import org.netbeans.modules.sql.framework.common.utils.FlatfileDBTableMarker;
85.9 -import org.w3c.dom.Element;
85.10 +import org.netbeans.modules.sql.framework.model.SQLDBTable;
85.11
85.12
85.13 /**
85.14 @@ -56,7 +55,7 @@
85.15 * @author Ahimanikya Satapathy
85.16 * @version $Revision$
85.17 */
85.18 -public interface FlatfileDBTable extends DBTable, FlatfileDBTableMarker {
85.19 +public interface FlatfileDBTable extends SQLDBTable, FlatfileDBTableMarker {
85.20
85.21 public static final String PROP_CREATE_IF_NOT_EXIST = "CREATE_IF_NOT_EXIST";
85.22
85.23 @@ -67,14 +66,6 @@
85.24 public static final String PROP_WIZARD = "WIZARD"; // NOI18N
85.25
85.26 /**
85.27 - * Adds a DBColumn instance to this table.
85.28 - *
85.29 - * @param theColumn column to be added.
85.30 - * @return true if successful. false if failed.
85.31 - */
85.32 - boolean addColumn(FlatfileDBColumn theColumn);
85.33 -
85.34 - /**
85.35 * Clone a deep copy of DBTable.
85.36 *
85.37 * @return a copy of DBTable.
85.38 @@ -93,15 +84,6 @@
85.39 int compareTo(Object refObj);
85.40
85.41 /**
85.42 - * Performs deep copy of contents of given DBTable. We deep copy (that is, the method
85.43 - * clones all child objects such as columns) because columns have a parent-child
85.44 - * relationship that must be preserved internally.
85.45 - *
85.46 - * @param source DBTable providing contents to be copied.
85.47 - */
85.48 - void copyFrom(DBTable source);
85.49 -
85.50 - /**
85.51 * Performs deep copy of contents of given FlatfileDBTable. We deep copy (that is, the
85.52 * method clones all child objects such as columns) because columns have a
85.53 * parent-child relationship that must be preserved internally.
85.54 @@ -129,21 +111,6 @@
85.55 boolean nullable);
85.56
85.57 /**
85.58 - * Deletes all columns associated with this table.
85.59 - *
85.60 - * @return true if all columns were deleted successfully, false otherwise.
85.61 - */
85.62 - boolean deleteAllColumns();
85.63 -
85.64 - /**
85.65 - * Deletes DBColumn, if any, associated with the given name from this table.
85.66 - *
85.67 - * @param columnName column name to be removed.
85.68 - * @return true if successful. false if failed.
85.69 - */
85.70 - boolean deleteColumn(String columnName);
85.71 -
85.72 - /**
85.73 * Overrides default implementation to return value based on memberwise comparison.
85.74 *
85.75 * @param obj Object against which we compare this instance
85.76 @@ -234,7 +201,6 @@
85.77 */
85.78 int hashCode();
85.79
85.80 - void parseXML(Element xmlElement);
85.81 /**
85.82 * Sets description text for this instance.
85.83 *
85.84 @@ -264,23 +230,6 @@
85.85 */
85.86 void setLocalFilePath(File localFile);
85.87
85.88 - /*
85.89 - * Setters and non-API helper methods for this implementation.
85.90 - */
85.91 - /**
85.92 - * Sets table name to new value.
85.93 - *
85.94 - * @param newName new value for table name
85.95 - */
85.96 - void setName(String newName);
85.97 -
85.98 - /**
85.99 - * Sets parent DatabaseModel to the given reference.
85.100 - *
85.101 - * @param newParent new DatabaseModel parent
85.102 - */
85.103 - void setParent(FlatfileDatabaseModel newParent);
85.104 -
85.105 void setParseType(String type);
85.106
85.107 void setProperties(Map newProps);
85.108 @@ -295,14 +244,6 @@
85.109 */
85.110 String toString();
85.111
85.112 - /**
85.113 - * Marshall this object to XML string.
85.114 - *
85.115 - * @param prefix
85.116 - * @return XML string
85.117 - */
85.118 - String toXMLString(String prefix);
85.119 -
85.120 void updateProperties(Map newProps);
85.121 }
85.122
86.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDatabaseModel.java Sat Dec 08 10:04:51 2007 +0000
86.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDatabaseModel.java Sat Dec 08 10:24:35 2007 +0000
86.3 @@ -41,11 +41,9 @@
86.4 package org.netbeans.modules.mashup.db.model;
86.5
86.6 import java.util.Map;
86.7 -
86.8 -import org.netbeans.modules.model.database.DBTable;
86.9 -import org.netbeans.modules.model.database.DatabaseModel;
86.10 -import org.netbeans.modules.model.database.JDBCConnectionProvider;
86.11 -import org.w3c.dom.Element;
86.12 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
86.13 +import org.netbeans.modules.sql.framework.model.JDBCConnectionProvider;
86.14 +import org.netbeans.modules.sql.framework.model.SQLDBModel;
86.15
86.16
86.17 /**
86.18 @@ -58,7 +56,7 @@
86.19 * @author Ahimanikya Satapathy
86.20 * @version $Revision$
86.21 */
86.22 -public interface FlatfileDatabaseModel extends DatabaseModel, JDBCConnectionProvider {
86.23 +public interface FlatfileDatabaseModel extends SQLDBModel, JDBCConnectionProvider {
86.24
86.25 /**
86.26 * Adds new SourceTable to the model.
86.27 @@ -75,11 +73,6 @@
86.28 Object clone();
86.29
86.30 /**
86.31 - * Copies member values from those contained in the given DatabaseModel instance.
86.32 - */
86.33 - void copyFrom(DatabaseModel src);
86.34 -
86.35 - /**
86.36 * Copies member values from those contained in the given FlatfileDatabaseModel
86.37 * instance.
86.38 *
86.39 @@ -88,31 +81,6 @@
86.40 void copyFrom(FlatfileDatabaseModel src);
86.41
86.42 /**
86.43 - * Create DBTable instance with the given table, schema, and catalog names.
86.44 - *
86.45 - * @param tableName table name of new table
86.46 - * @param schemaName schema name of new table
86.47 - * @param catalogName catalog name of new table
86.48 - * @return an instance of ETLTable if successful, null if failed.
86.49 - */
86.50 - DBTable createTable(String tableName, String schemaName, String catalogName);
86.51 -
86.52 - /**
86.53 - * Deletes all tables associated with this data source.
86.54 - *
86.55 - * @return true if all tables were deleted successfully, false otherwise.
86.56 - */
86.57 - boolean deleteAllTables();
86.58 -
86.59 - /**
86.60 - * Delete table from the ETLDataSource
86.61 - *
86.62 - * @param fqTableName fully qualified name of table to be deleted.
86.63 - * @return true if successful. false if failed.
86.64 - */
86.65 - boolean deleteTable(String fqTableName);
86.66 -
86.67 - /**
86.68 * @see java.lang.Object#equals
86.69 */
86.70 boolean equals(Object refObj);
86.71 @@ -142,37 +110,18 @@
86.72 */
86.73 FlatfileDBTable getFileMatchingTableName(String tableName);
86.74
86.75 - FlatfileDBConnectionDefinition getFlatfileDBConnectionDefinition(boolean download);
86.76 + DBConnectionDefinition getFlatfileDBConnectionDefinition(boolean download);
86.77
86.78 Map getFlatfileTablePropertyMap(String flatfileName);
86.79
86.80 Map getFlatfileTablePropertyMaps();
86.81
86.82 - /**
86.83 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDatabaseModel#getMajorVersion
86.84 - */
86.85 int getMajorVersion();
86.86
86.87 - /**
86.88 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDatabaseModel#getMicroVersion
86.89 - */
86.90 int getMicroVersion();
86.91
86.92 - /**
86.93 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDatabaseModel#getMinorVersion
86.94 - */
86.95 int getMinorVersion();
86.96
86.97 - /**
86.98 - * Gets a read-only Map of table names to available DBTable instances in this model.
86.99 - *
86.100 - * @return readonly Map of table names to DBTable instances
86.101 - */
86.102 - Map getTableMap();
86.103 -
86.104 - /**
86.105 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDatabaseModel#getVersionString
86.106 - */
86.107 String getVersionString();
86.108
86.109 /**
86.110 @@ -185,18 +134,11 @@
86.111 int hashCode();
86.112
86.113 /**
86.114 - * Unmarshal this object from XML element.
86.115 - *
86.116 - * @param xmlElement
86.117 - */
86.118 - void parseXML(Element xmlElement);
86.119 -
86.120 - /**
86.121 * Setter for FlatfileDBConnectionDefinition
86.122 *
86.123 * @param theConnectionDefinition to be set
86.124 */
86.125 - void setConnectionDefinition(FlatfileDBConnectionDefinition theConnectionDefinition);
86.126 + void setConnectionDefinition(DBConnectionDefinition theConnectionDefinition);
86.127
86.128 /**
86.129 * Sets the Connection Name associated with connection name
86.130 @@ -206,24 +148,10 @@
86.131 void setConnectionName(String theConName);
86.132
86.133 /**
86.134 - * Sets the description string of this DatabaseModel
86.135 - *
86.136 - * @param newDesc new description string
86.137 - */
86.138 - void setDescription(String newDesc);
86.139 -
86.140 - /**
86.141 - * Setter for Model Name
86.142 - *
86.143 - * @param theModelName
86.144 - */
86.145 - void setModelName(String theModelName);
86.146 -
86.147 - /**
86.148 * Sets repository object, if any, providing underlying data for this DatabaseModel
86.149 * implementation.
86.150 *
86.151 - * @param obj StcdbObjectTypeDefinition hosting this object's metadata, or null if data are not
86.152 + * @param obj FlatfileDefinition hosting this object's metadata, or null if data are not
86.153 * held by a StcdbObjectTypeDefinition.
86.154 */
86.155 void setSource(FlatfileDefinition obj);
86.156 @@ -243,13 +171,5 @@
86.157 */
86.158 String toString();
86.159
86.160 - /**
86.161 - * Marshall this object to XML string.
86.162 - *
86.163 - * @param prefix
86.164 - * @return XML string
86.165 - */
86.166 - String toXMLString(String prefix);
86.167 -
86.168 }
86.169
87.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDefinition.java Sat Dec 08 10:04:51 2007 +0000
87.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/FlatfileDefinition.java Sat Dec 08 10:24:35 2007 +0000
87.3 @@ -49,11 +49,11 @@
87.4 import org.netbeans.modules.etl.model.ETLObject;
87.5 import org.netbeans.modules.etl.model.impl.ETLObjectImpl;
87.6 import org.netbeans.modules.mashup.db.model.impl.FlatfileDatabaseModelImpl;
87.7 -import org.netbeans.modules.model.database.DBConnectionDefinition;
87.8 -import org.netbeans.modules.model.database.DBTable;
87.9 -import org.netbeans.modules.model.database.JDBCConnectionProvider;
87.10 import org.netbeans.modules.sql.framework.common.utils.FlatfileDBMarker;
87.11 import org.netbeans.modules.sql.framework.common.utils.FlatfileDBTableMarker;
87.12 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
87.13 +import org.netbeans.modules.sql.framework.model.DBTable;
87.14 +import org.netbeans.modules.sql.framework.model.JDBCConnectionProvider;
87.15
87.16
87.17 /**
87.18 @@ -202,9 +202,9 @@
87.19 }
87.20
87.21 /**
87.22 - * Gets the Table marker for a given otdName
87.23 + * Gets the Table marker for a given dbName
87.24 *
87.25 - * @param otdName to be used to get Table
87.26 + * @param dbName to be used to get Table
87.27 * @return FlatfileDBTableMarker
87.28 */
87.29 public FlatfileDBTableMarker getFlatfileDBTableMarker(String tableName) {
87.30 @@ -242,7 +242,7 @@
87.31 return modelImpl.getJDBCDriverClassNames();
87.32 }
87.33
87.34 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.35 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.36 }
87.37
87.38 /**
87.39 @@ -257,7 +257,7 @@
87.40 return modelImpl.getJDBCDriverClassName();
87.41 }
87.42
87.43 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.44 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.45 }
87.46
87.47 /**
87.48 @@ -272,7 +272,7 @@
87.49 return modelImpl.getJDBCDriverType();
87.50 }
87.51
87.52 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.53 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.54 }
87.55
87.56 /**
87.57 @@ -287,7 +287,7 @@
87.58 return modelImpl.getJDBCDriverTypes(className);
87.59 }
87.60
87.61 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.62 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.63 }
87.64
87.65 /**
87.66 @@ -302,7 +302,7 @@
87.67 return modelImpl.getJDBCConnection();
87.68 }
87.69
87.70 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.71 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.72
87.73 }
87.74
87.75 @@ -318,7 +318,7 @@
87.76 return modelImpl.getJDBCConnection(cl);
87.77 }
87.78
87.79 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.80 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.81 }
87.82
87.83 /**
87.84 @@ -337,7 +337,7 @@
87.85 return modelImpl.getJDBCConnection(connProps);
87.86 }
87.87
87.88 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.89 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.90 }
87.91
87.92 /**
87.93 @@ -357,7 +357,7 @@
87.94 return modelImpl.getJDBCConnection(connProps, cl);
87.95 }
87.96
87.97 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.98 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.99 }
87.100
87.101 /**
87.102 @@ -373,7 +373,7 @@
87.103 return modelImpl.getJDBCConnection(jdbcUrl, uid, passwd);
87.104 }
87.105
87.106 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.107 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.108 }
87.109
87.110 /**
87.111 @@ -389,7 +389,7 @@
87.112 return modelImpl.getJDBCConnection(jdbcUrl, uid, passwd, cl);
87.113 }
87.114
87.115 - throw new Exception("Could not create DatabaseModel implementation for FlatfileDB OTD");
87.116 + throw new Exception("Could not create DatabaseModel implementation for FlatfileDB Database");
87.117 }
87.118 }
87.119
88.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/impl/FlatfileDBColumnImpl.java Sat Dec 08 10:04:51 2007 +0000
88.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/impl/FlatfileDBColumnImpl.java Sat Dec 08 10:24:35 2007 +0000
88.3 @@ -42,28 +42,26 @@
88.4
88.5 import java.sql.Types;
88.6 import java.util.Map;
88.7 -
88.8 -import org.netbeans.modules.mashup.db.common.FlatfileDBException;
88.9 import org.netbeans.modules.mashup.db.common.SQLUtils;
88.10 import org.netbeans.modules.mashup.db.model.FlatfileDBColumn;
88.11 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
88.12 -import org.netbeans.modules.model.database.DBColumn;
88.13 -import org.netbeans.modules.model.database.DBTable;
88.14 +import org.netbeans.modules.sql.framework.model.DBColumn;
88.15 import org.netbeans.modules.sql.framework.common.utils.TagParserUtility;
88.16 import org.w3c.dom.Element;
88.17 -
88.18 import com.sun.sql.framework.utils.Logger;
88.19 import com.sun.sql.framework.utils.StringUtil;
88.20 +import org.netbeans.modules.sql.framework.model.impl.AbstractDBColumn;
88.21
88.22 /**
88.23 * Implements FlatfileDBColumn interface.
88.24 - *
88.25 + *
88.26 * @author Jonathan Giron
88.27 * @author Girish Patil
88.28 * @author Ahimanikya Satapathy
88.29 * @version $Revision$
88.30 */
88.31 -public class FlatfileDBColumnImpl implements FlatfileDBColumn, Cloneable, Comparable {
88.32 +public class FlatfileDBColumnImpl extends AbstractDBColumn implements FlatfileDBColumn, Cloneable, Comparable {
88.33 +
88.34 /** Constants used in XML tags * */
88.35 private static final String ATTR_CARDINAL_POSITION = "cardinalPosition";
88.36 private static final String ATTR_INDEXED = "indexed";
88.37 @@ -79,54 +77,23 @@
88.38 private static final String EQUAL_START_QUOTE = "=\"";
88.39 private static final String LOG_CATEGORY = FlatfileDBColumnImpl.class.getName();
88.40 private static final String QUOTE = "\"";
88.41 -
88.42 private static final String TAG_STCDB_COLUMN = "stcdbColumn";
88.43 -
88.44 /* Cardinal Position */
88.45 protected int cardinalPosition;
88.46 -
88.47 - /* Default Value */
88.48 - protected String defaultValue;
88.49 -
88.50 - /** whether this column is part of a foreign key */
88.51 - protected boolean fkFlag;
88.52 -
88.53 - /** whether this column is indexed */
88.54 - protected boolean indexed;
88.55 -
88.56 - /** JDBC SQL type, as enumerated in java.sql.Types */
88.57 - protected int jdbcType;
88.58 -
88.59 - /** name of column */
88.60 - protected String name;
88.61 -
88.62 - /** whether this column can accept null as a valid value */
88.63 - protected boolean nullable;
88.64 -
88.65 - /** DBTable to which this PK belongs */
88.66 - protected FlatfileDBTable parent;
88.67 -
88.68 - /** whether this column is part of a primary key */
88.69 - protected boolean pkFlag;
88.70 -
88.71 - /** column precision (for numeric types) / width (for char types) */
88.72 - protected int precision;
88.73 -
88.74 - /** column scale (meaningful only for numeric types) */
88.75 - protected int scale;
88.76 -
88.77 private boolean isSelected; // specifies if the column is selected
88.78
88.79 public FlatfileDBColumnImpl() {
88.80 + super();
88.81 }
88.82
88.83 /**
88.84 * Creates a new instance of FlatfileDBColumnImpl, cloning the contents of the given
88.85 * DBColumn implementation instance.
88.86 - *
88.87 + *
88.88 * @param src DBColumn instance to be cloned
88.89 */
88.90 public FlatfileDBColumnImpl(DBColumn src) {
88.91 + this();
88.92 if (src == null) {
88.93 throw new IllegalArgumentException("Must supply non-null DBColumn instance for src.");
88.94 }
88.95 @@ -138,7 +105,7 @@
88.96 * Constructs a new instance of FlatfileDBColumnImpl using the given parameters and
88.97 * assuming that the column is not part of a foreign key or primary key, and that it
88.98 * accepts null values.
88.99 - *
88.100 + *
88.101 * @param colName name of this column
88.102 * @param sqlJdbcType JDBC type of this column
88.103 * @param colScale scale of this column
88.104 @@ -147,18 +114,12 @@
88.105 * @see java.sql.Types
88.106 */
88.107 public FlatfileDBColumnImpl(String colName, int sqlJdbcType, int colPrecision, int colScale, boolean isNullable) {
88.108 - name = colName;
88.109 - jdbcType = sqlJdbcType;
88.110 -
88.111 - precision = colPrecision;
88.112 - scale = colScale;
88.113 -
88.114 - nullable = isNullable;
88.115 + super(colName, sqlJdbcType, colScale, colPrecision, isNullable);
88.116 }
88.117
88.118 /**
88.119 * Constructs a new instance of FlatfileDBColumnImpl using the given parameters.
88.120 - *
88.121 + *
88.122 * @param colName name of this column
88.123 * @param sqlJdbcType JDBC type of this column
88.124 * @param colScale scale of this column
88.125 @@ -169,20 +130,16 @@
88.126 * @param isNullable true if nullable, false otherwise
88.127 * @see java.sql.Types
88.128 */
88.129 - public FlatfileDBColumnImpl(String colName, int sqlJdbcType, int colScale, int colPrecision, boolean isPrimaryKey, boolean isForeignKey,
88.130 - boolean isIndexed, boolean isNullable) {
88.131 - this(colName, sqlJdbcType, colPrecision, colScale, isNullable);
88.132 -
88.133 - pkFlag = isPrimaryKey;
88.134 - fkFlag = isForeignKey;
88.135 - indexed = isIndexed;
88.136 + public FlatfileDBColumnImpl(String colName, int sqlJdbcType, int colScale, int colPrecision, boolean isPrimaryKey, boolean isForeignKey, boolean isIndexed, boolean isNullable) {
88.137 + super(colName, sqlJdbcType, colScale, colPrecision, isPrimaryKey, isForeignKey, isIndexed, isNullable);
88.138 }
88.139
88.140 /**
88.141 * Clone a deep copy of DBColumn.
88.142 - *
88.143 + *
88.144 * @return a copy of DBColumn.
88.145 */
88.146 + @Override
88.147 public Object clone() {
88.148 try {
88.149 FlatfileDBColumn column = (FlatfileDBColumn) super.clone();
88.150 @@ -197,12 +154,13 @@
88.151 * Compares DBColumn with another object for lexicographical ordering. Null objects
88.152 * and those DBColumns with null names are placed at the end of any ordered collection
88.153 * using this method.
88.154 - *
88.155 + *
88.156 * @param refObj Object to be compared.
88.157 * @return -1 if this column is before refObj 0 if this column and refObj are in the
88.158 * same position. 1 if this column name is after refObj
88.159 * @throws ClassCastException if refObj is not comparable to FlatfileDBColumnImpl
88.160 */
88.161 + @Override
88.162 public int compareTo(Object refObj) {
88.163 if (null == refObj) {
88.164 return -1;
88.165 @@ -217,10 +175,11 @@
88.166 /**
88.167 * Sets the various member variables and collections using the given DBColumn instance
88.168 * as a source object.
88.169 - *
88.170 + *
88.171 * @param source DBColumn from which to obtain values for member variables and
88.172 * collections
88.173 */
88.174 + @Override
88.175 public void copyFrom(DBColumn source) {
88.176 name = source.getName();
88.177 jdbcType = source.getJdbcType();
88.178 @@ -237,16 +196,16 @@
88.179 defaultValue = source.getDefaultValue();
88.180
88.181 try {
88.182 - parent = (FlatfileDBTable) source.getParent();
88.183 - } catch (RuntimeException e) {
88.184 - // TODO log this
88.185 - }
88.186 + parent = (FlatfileDBTable) source.getParent();
88.187 + } catch (RuntimeException e) {
88.188 + // TODO log this
88.189 + }
88.190 }
88.191
88.192 /**
88.193 * Gets debug output as a String, using the given String as a prefix for each output
88.194 * line.
88.195 - *
88.196 + *
88.197 * @param prefix String to prepend to each new line of debug output
88.198 * @return debug output
88.199 */
88.200 @@ -267,10 +226,11 @@
88.201
88.202 /**
88.203 * Overrides default implementation to return value based on memberwise comparison.
88.204 - *
88.205 + *
88.206 * @param refObj Object against which we compare this instance
88.207 * @return true if refObj is functionally identical to this instance; false otherwise
88.208 */
88.209 + @Override
88.210 public boolean equals(Object refObj) {
88.211 if (this == refObj) {
88.212 return true;
88.213 @@ -281,14 +241,9 @@
88.214 }
88.215
88.216 FlatfileDBColumnImpl refMeta = (FlatfileDBColumnImpl) refObj;
88.217 -
88.218 boolean result = (name != null) ? name.equals(refMeta.name) : (refMeta.name == null);
88.219 -
88.220 - result &= (jdbcType == refMeta.jdbcType) && (pkFlag == refMeta.pkFlag) && (fkFlag == refMeta.fkFlag) && (indexed == refMeta.indexed)
88.221 - && (nullable == refMeta.nullable) && (getScale() == refMeta.getScale()) && (precision == refMeta.precision);
88.222 -
88.223 + result &= (jdbcType == refMeta.jdbcType) && (pkFlag == refMeta.pkFlag) && (fkFlag == refMeta.fkFlag) && (indexed == refMeta.indexed) && (nullable == refMeta.nullable) && (getScale() == refMeta.getScale()) && (precision == refMeta.precision);
88.224 result &= (parent != null) ? parent.equals(refMeta.parent) : (refMeta.parent == null);
88.225 -
88.226 return result;
88.227 }
88.228
88.229 @@ -298,7 +253,7 @@
88.230
88.231 /**
88.232 * Gets the SQL create statement to create a column representing this flatfile field.
88.233 - *
88.234 + *
88.235 * @return SQL statement fragment to create of a column representing this field
88.236 */
88.237 public String getCreateStatementSQL() {
88.238 @@ -314,11 +269,9 @@
88.239 case java.sql.Types.INTEGER:
88.240 sqlTypeCode = Types.NUMERIC;
88.241 break;
88.242 -
88.243 case java.sql.Types.CHAR:
88.244 sqlTypeCode = Types.VARCHAR;
88.245 break;
88.246 -
88.247 default:
88.248 sqlTypeCode = this.jdbcType;
88.249 break;
88.250 @@ -334,7 +287,6 @@
88.251 case java.sql.Types.VARCHAR:
88.252 buffer.append("(").append(this.precision).append(")");
88.253 break;
88.254 -
88.255 case java.sql.Types.NUMERIC:
88.256 int extraLen = ((getScale() == 0) ? 0 : 1) + 1;
88.257 buffer.append("(").append(this.precision - extraLen);
88.258 @@ -343,7 +295,11 @@
88.259 }
88.260 buffer.append(")");
88.261 break;
88.262 -
88.263 + case java.sql.Types.DATE:
88.264 + case java.sql.Types.TIME:
88.265 + case java.sql.Types.TIMESTAMP:
88.266 + buffer.append("(").append(this.precision).append(")");
88.267 + break;
88.268 default:
88.269 // Append nothing.
88.270 break;
88.271 @@ -359,7 +315,6 @@
88.272 case java.sql.Types.TIMESTAMP:
88.273 buffer.append("'").append(defaultValue).append("'");
88.274 break;
88.275 -
88.276 default:
88.277 if (!StringUtil.isNullString(defaultValue)) {
88.278 buffer.append(defaultValue);
88.279 @@ -376,61 +331,8 @@
88.280 }
88.281
88.282 /**
88.283 - * Gets the default value
88.284 - *
88.285 - * @return defaultValue
88.286 - */
88.287 - public String getDefaultValue() {
88.288 - return this.defaultValue;
88.289 - }
88.290 -
88.291 - /**
88.292 - * @see org.netbeans.modules.model.database.DBColumn#getJdbcType
88.293 - */
88.294 - public int getJdbcType() {
88.295 - return jdbcType;
88.296 - }
88.297 -
88.298 - /**
88.299 - * @see org.netbeans.modules.model.database.DBColumn#getJdbcTypeString
88.300 - */
88.301 - public String getJdbcTypeString() {
88.302 - return SQLUtils.getStdSqlType(jdbcType);
88.303 - }
88.304 -
88.305 - /**
88.306 - * @see org.netbeans.modules.model.database.DBColumn#getName
88.307 - */
88.308 - public String getName() {
88.309 - return this.name;
88.310 - }
88.311 -
88.312 - /**
88.313 - * Gets the Ordinal Position
88.314 - *
88.315 - * @param cardinalPosition to be used
88.316 - */
88.317 - public int getOrdinalPosition() {
88.318 - return this.cardinalPosition;
88.319 - }
88.320 -
88.321 - /**
88.322 - * @see org.netbeans.modules.model.database.DBColumn#getParent
88.323 - */
88.324 - public DBTable getParent() {
88.325 - return parent;
88.326 - }
88.327 -
88.328 - /**
88.329 - * @see org.netbeans.modules.model.database.DBColumn#getPrecision
88.330 - */
88.331 - public int getPrecision() {
88.332 - return precision;
88.333 - }
88.334 -
88.335 - /**
88.336 * Gets Map of current properties associated with this field.
88.337 - *
88.338 + *
88.339 * @return unmodifiable Map of current properties.
88.340 */
88.341 public Map getProperties() {
88.342 @@ -439,7 +341,7 @@
88.343
88.344 /**
88.345 * Gets property string associated with the given name.
88.346 - *
88.347 + *
88.348 * @param propName property key
88.349 * @return property associated with propName, or null if no such property exists.
88.350 */
88.351 @@ -450,11 +352,11 @@
88.352 /**
88.353 * @see org.netbeans.modules.model.database.DBColumn#getScale
88.354 */
88.355 + @Override
88.356 public int getScale() {
88.357 switch (jdbcType) {
88.358 case Types.NUMERIC:
88.359 return scale;
88.360 -
88.361 default:
88.362 return 0;
88.363 }
88.364 @@ -462,9 +364,10 @@
88.365
88.366 /**
88.367 * Returns the hashCode for this object.
88.368 - *
88.369 + *
88.370 * @return the hashCode of this object.
88.371 */
88.372 + @Override
88.373 public int hashCode() {
88.374 int myHash = (name != null) ? name.hashCode() : 0;
88.375 myHash += jdbcType + (10 * getScale()) + (100 * precision);
88.376 @@ -480,42 +383,15 @@
88.377 }
88.378
88.379 /**
88.380 - * @see org.netbeans.modules.model.database.DBColumn#isForeignKey
88.381 - */
88.382 - public boolean isForeignKey() {
88.383 - return fkFlag;
88.384 - }
88.385 -
88.386 - /**
88.387 - * @see org.netbeans.modules.model.database.DBColumn#isIndexed
88.388 - */
88.389 - public boolean isIndexed() {
88.390 - return indexed;
88.391 - }
88.392 -
88.393 - /**
88.394 - * @see org.netbeans.modules.model.database.DBColumn#isNullable
88.395 - */
88.396 - public boolean isNullable() {
88.397 - return nullable;
88.398 - }
88.399 -
88.400 - /**
88.401 - * @see org.netbeans.modules.model.database.DBColumn#isPrimaryKey
88.402 - */
88.403 - public boolean isPrimaryKey() {
88.404 - return pkFlag;
88.405 - }
88.406 -
88.407 - /**
88.408 * Indicates whether column is selected
88.409 - *
88.410 + *
88.411 * @return true if selected, false otherwise
88.412 */
88.413 public boolean isSelected() {
88.414 return isSelected;
88.415 }
88.416
88.417 + @Override
88.418 public void parseXML(Element xmlElement) {
88.419 Map attrs = TagParserUtility.getNodeAttributes(xmlElement);
88.420 String str = null;
88.421 @@ -600,54 +476,12 @@
88.422 }
88.423
88.424 /**
88.425 - * sets the default value
88.426 - *
88.427 - * @param default value to be set
88.428 - */
88.429 - public void setDefaultValue(String defValue) {
88.430 - this.defaultValue = defValue;
88.431 - }
88.432 -
88.433 - /**
88.434 - * Sets whether this column is flagged as part of a foreign key.
88.435 - *
88.436 - * @param newFlag true if this column is part of a foreign key; false otherwise
88.437 - */
88.438 - public void setForeignKey(boolean newFlag) {
88.439 - fkFlag = newFlag;
88.440 - }
88.441 -
88.442 - /**
88.443 - * Sets whether this column is flagged as indexed.
88.444 - *
88.445 - * @param newFlag true if this column is indexed; false otherwise
88.446 - */
88.447 - public void setIndexed(boolean newFlag) {
88.448 - indexed = newFlag;
88.449 - }
88.450 -
88.451 - /**
88.452 - * Indicates whether this DBColumn references the given DBColumn in a FK -> PK
88.453 - * relationship.
88.454 - *
88.455 - * @param column PK whose relationship to this column is to be checked
88.456 - * @return true if this column is a FK reference to column; false otherwise
88.457 - */
88.458 - // public boolean references(DBColumn column);
88.459 - /**
88.460 - * Indicates whether this DBColumn is referenced by the given DBColumn in a FK -> PK
88.461 - * relationship.
88.462 - *
88.463 - * @param column potential FK reference to be checked
88.464 - * @return true if column is referenced as a PK by the given column, false otherwise
88.465 - */
88.466 - // public boolean isReferencedBy(DBColumn column);
88.467 - /**
88.468 * Sets SQL type code.
88.469 - *
88.470 + *
88.471 * @param newCode SQL code
88.472 * @throws FlatfileDBException if newCode is not a recognized SQL type code
88.473 */
88.474 + @Override
88.475 public void setJdbcType(int newType) {
88.476 if (SQLUtils.isStdJdbcType(newType)) {
88.477 jdbcType = newType;
88.478 @@ -659,63 +493,21 @@
88.479 case java.sql.Types.INTEGER:
88.480 jdbcType = java.sql.Types.NUMERIC;
88.481 break;
88.482 -
88.483 case java.sql.Types.CHAR:
88.484 jdbcType = java.sql.Types.VARCHAR;
88.485 break;
88.486 -
88.487 case java.sql.Types.DATE:
88.488 jdbcType = java.sql.Types.TIMESTAMP;
88.489 break;
88.490 -
88.491 default:
88.492 jdbcType = newType;
88.493 }
88.494 }
88.495 }
88.496
88.497 - public void setName(String theName) {
88.498 - this.name = theName;
88.499 - }
88.500 -
88.501 - /**
88.502 - * Sets whether this column is flagged as nullable.
88.503 - *
88.504 - * @param newFlag true if this column is nullable; false otherwise
88.505 - */
88.506 - public void setNullable(boolean newFlag) {
88.507 - nullable = newFlag;
88.508 - }
88.509 -
88.510 - /**
88.511 - * Sets reference to DBTable that owns this DBColumn.
88.512 - *
88.513 - * @param newParent new parent of this column.
88.514 - */
88.515 - public void setParent(FlatfileDBTable newParent) {
88.516 - parent = newParent;
88.517 - }
88.518 -
88.519 - public void setPrecision(int thePrecision) {
88.520 - this.precision = thePrecision;
88.521 - }
88.522 -
88.523 - /**
88.524 - * Sets whether this column is flagged as part of a primary key.
88.525 - *
88.526 - * @param newFlag true if this column is part of a primary key; false otherwise
88.527 - */
88.528 - public void setPrimaryKey(boolean newFlag) {
88.529 - pkFlag = newFlag;
88.530 - }
88.531 -
88.532 - public void setScale(int theScale) {
88.533 - this.scale = theScale;
88.534 - }
88.535 -
88.536 /**
88.537 * Marshall this object to XML string.
88.538 - *
88.539 + *
88.540 * @param prefix
88.541 * @return XML string
88.542 */
88.543 @@ -784,5 +576,7 @@
88.544 return sb.toString();
88.545 }
88.546
88.547 + protected String getElementTagName() {
88.548 + throw new UnsupportedOperationException("Not supported yet.");
88.549 + }
88.550 }
88.551 -
89.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/impl/FlatfileDBConnectionDefinitionImpl.java Sat Dec 08 10:04:51 2007 +0000
89.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/impl/FlatfileDBConnectionDefinitionImpl.java Sat Dec 08 10:24:35 2007 +0000
89.3 @@ -40,10 +40,12 @@
89.4 */
89.5 package org.netbeans.modules.mashup.db.model.impl;
89.6
89.7 +import com.sun.sql.framework.jdbc.DBConnectionParameters;
89.8 import java.util.Map;
89.9 +import org.netbeans.modules.mashup.db.model.FlatfileDBConnectionDefinition;
89.10
89.11 -import org.netbeans.modules.mashup.db.model.FlatfileDBConnectionDefinition;
89.12 import org.netbeans.modules.sql.framework.common.utils.TagParserUtility;
89.13 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
89.14 import org.w3c.dom.Element;
89.15
89.16
89.17 @@ -54,7 +56,7 @@
89.18 * @author Girish Patil
89.19 * @version $Revision$
89.20 */
89.21 -public class FlatfileDBConnectionDefinitionImpl implements FlatfileDBConnectionDefinition {
89.22 +public class FlatfileDBConnectionDefinitionImpl extends DBConnectionParameters implements FlatfileDBConnectionDefinition {
89.23 /** Constants used in XML tags * */
89.24 private static final String ATTR_DRIVER_CLASS = "driverClass";
89.25 private static final String ATTR_NAME = "name";
89.26 @@ -68,23 +70,9 @@
89.27 /* JDBC driver class name for Axion */
89.28 private static final String AXION_DRIVER = "org.axiondb.jdbc.AxionDriver";
89.29
89.30 - /* User-supplied connection name */
89.31 - private String name;
89.32 -
89.33 - /* JDBC driver name */
89.34 - private String driverClass;
89.35 -
89.36 /* JDBC URL */
89.37 private String url;
89.38
89.39 - /* Username for authentication */
89.40 - private String userName;
89.41 -
89.42 - /* Password for authentication */
89.43 - private String password;
89.44 -
89.45 - /* User-supplied description (optional) for this connection */
89.46 - private String description;
89.47
89.48 /** Creates a new default instance of FlatfileDBConnectionDefinitionImpl. */
89.49 public FlatfileDBConnectionDefinitionImpl() {
89.50 @@ -129,7 +117,7 @@
89.51 *
89.52 * @param connectionDefn DBConnectionDefinition to be copied
89.53 */
89.54 - public FlatfileDBConnectionDefinitionImpl(FlatfileDBConnectionDefinition connectionDefn) {
89.55 + public FlatfileDBConnectionDefinitionImpl(DBConnectionDefinition connectionDefn) {
89.56 if (connectionDefn == null) {
89.57 throw new IllegalArgumentException("Must supply non-null DBConnectionDefinition instance for connectionDefn param.");
89.58 }
89.59 @@ -142,67 +130,24 @@
89.60 /**
89.61 * @see org.netbeans.modules.model.database.DBConnectionDefinition#getConnectionURL()
89.62 */
89.63 + @Override
89.64 public String getConnectionURL() {
89.65 return url;
89.66 }
89.67
89.68 + @Override
89.69 public void setConnectionURL(String aUrl) {
89.70 url = aUrl;
89.71 }
89.72
89.73 - /**
89.74 - * Gets user-defined description, if any, for this DBConnectionDefinition.
89.75 - *
89.76 - * @return user-defined description, possibly null if none was defined
89.77 - */
89.78 - public String getDescription() {
89.79 - return description;
89.80 - }
89.81 -
89.82 public String getUrl() {
89.83 return this.url;
89.84 }
89.85
89.86 /**
89.87 - * @see org.netbeans.modules.model.database.DBConnectionDefinition#getDriverClass
89.88 - */
89.89 - public String getDriverClass() {
89.90 - return AXION_DRIVER;
89.91 - }
89.92 -
89.93 - /**
89.94 - * @see org.netbeans.modules.model.database.DBConnectionDefinition#getName
89.95 - */
89.96 - public String getName() {
89.97 - return name;
89.98 - }
89.99 -
89.100 - /**
89.101 - * Sets new name for this DBConnectionDefinition.
89.102 - *
89.103 - * @param newName new name for DBConnectionDefinition
89.104 - */
89.105 - public void setName(String newName) {
89.106 - name = newName;
89.107 - }
89.108 -
89.109 - /**
89.110 - * @see org.netbeans.modules.model.database.DBConnectionDefinition#getUserName
89.111 - */
89.112 - public String getUserName() {
89.113 - return userName;
89.114 - }
89.115 -
89.116 - /**
89.117 - * @see org.netbeans.modules.model.database.DBConnectionDefinition#getPassword
89.118 - */
89.119 - public String getPassword() {
89.120 - return password;
89.121 - }
89.122 -
89.123 - /**
89.124 * @see org.netbeans.modules.model.database.DBConnectionDefinition#getDBType
89.125 */
89.126 + @Override
89.127 public String getDBType() {
89.128 return "Internal";
89.129 }
89.130 @@ -214,7 +159,7 @@
89.131 * @param source DBConnectionDefinition whose contents are to be copied into this
89.132 * instance
89.133 */
89.134 - public synchronized void copyFrom(FlatfileDBConnectionDefinitionImpl source) {
89.135 + public synchronized void copyFrom(DBConnectionDefinition source) {
89.136 if (source == null) {
89.137 throw new IllegalArgumentException("Must supply non-null ref for source.");
89.138 } else if (source == this) {
89.139 @@ -235,6 +180,7 @@
89.140 * @param o Object to compare for equality against this instance.
89.141 * @return true if o is equivalent to this, false otherwise
89.142 */
89.143 + @Override
89.144 public boolean equals(Object o) {
89.145 // Check for reflexivity.
89.146 if (this == o) {
89.147 @@ -272,6 +218,7 @@
89.148 *
89.149 * @return computed hash code
89.150 */
89.151 + @Override
89.152 public int hashCode() {
89.153 int hashCode = 0;
89.154
89.155 @@ -285,6 +232,7 @@
89.156 return hashCode;
89.157 }
89.158
89.159 + @Override
89.160 public void parseXML(Element xmlElement) {
89.161 Map attrs = TagParserUtility.getNodeAttributes(xmlElement);
89.162
89.163 @@ -295,6 +243,7 @@
89.164 this.password = (String) attrs.get(ATTR_PASSWORD);
89.165 }
89.166
89.167 + @Override
89.168 public String toXMLString(String prefix) {
89.169 StringBuilder sb = new StringBuilder();
89.170 sb.append(prefix);
90.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/impl/FlatfileDBTableImpl.java Sat Dec 08 10:04:51 2007 +0000
90.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/impl/FlatfileDBTableImpl.java Sat Dec 08 10:24:35 2007 +0000
90.3 @@ -40,10 +40,10 @@
90.4 */
90.5 package org.netbeans.modules.mashup.db.model.impl;
90.6
90.7 +import com.sun.sql.framework.exception.BaseException;
90.8 import java.io.File;
90.9 import java.util.ArrayList;
90.10 import java.util.Collections;
90.11 -import java.util.Comparator;
90.12 import java.util.HashMap;
90.13 import java.util.HashSet;
90.14 import java.util.Iterator;
90.15 @@ -58,13 +58,7 @@
90.16 import org.netbeans.modules.mashup.db.common.PropertyKeys;
90.17 import org.netbeans.modules.mashup.db.model.FlatfileDBColumn;
90.18 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
90.19 -import org.netbeans.modules.mashup.db.model.FlatfileDatabaseModel;
90.20 -import org.netbeans.modules.model.database.DBColumn;
90.21 -import org.netbeans.modules.model.database.DBTable;
90.22 -import org.netbeans.modules.model.database.DatabaseModel;
90.23 -import org.netbeans.modules.model.database.ForeignKey;
90.24 -import org.netbeans.modules.model.database.Index;
90.25 -import org.netbeans.modules.model.database.PrimaryKey;
90.26 +import org.netbeans.modules.sql.framework.model.DBColumn;
90.27 import org.netbeans.modules.sql.framework.common.utils.TagParserUtility;
90.28 import org.netbeans.modules.sql.framework.model.impl.PrimaryKeyImpl;
90.29 import org.w3c.dom.Element;
90.30 @@ -73,6 +67,9 @@
90.31
90.32 import com.sun.sql.framework.utils.Logger;
90.33 import com.sun.sql.framework.utils.StringUtil;
90.34 +import org.netbeans.modules.sql.framework.model.DBTable;
90.35 +import org.netbeans.modules.sql.framework.model.SQLDBColumn;
90.36 +import org.netbeans.modules.sql.framework.model.impl.AbstractDBTable;
90.37
90.38 /**
90.39 * Reference implementation for interface org.netbeans.modules.etl.model.DBTable
90.40 @@ -82,16 +79,7 @@
90.41 * @author Ahimanikya Satapathy
90.42 * @version $Revision$
90.43 */
90.44 -public class FlatfileDBTableImpl implements FlatfileDBTable, Cloneable, Comparable {
90.45 - static class StringComparator implements Comparator {
90.46 - public int compare(Object o1, Object o2) {
90.47 - if (o1 instanceof String && o2 instanceof String) {
90.48 - return ((String) o1).compareTo((String) o2);
90.49 - }
90.50 - throw new ClassCastException("StringComparator cannot compare non-String objects.");
90.51 - }
90.52 - }
90.53 -
90.54 +public class FlatfileDBTableImpl extends AbstractDBTable implements FlatfileDBTable, Cloneable, Comparable {
90.55 /** Constants used in XML tags * */
90.56 private static final String ATTR_ENCODING = "encoding";
90.57 private static final String ATTR_FILE_NAME = "fileName";
90.58 @@ -135,18 +123,6 @@
90.59 WIZARD_ONLY_PROPERTIES.add("FIELDCOUNT");
90.60 }
90.61
90.62 - /** Map of column metadata. */
90.63 - protected Map columns;
90.64 -
90.65 - /** user-defined description */
90.66 - protected String description;
90.67 -
90.68 - /** table name. */
90.69 - protected String name;
90.70 -
90.71 - /** FlatfileDatabaseModelImpl instance that "owns" this table. */
90.72 - protected FlatfileDatabaseModel parent;
90.73 -
90.74 /* Encoding of file contents, e.g., utf-8, cp500, etc. */
90.75 private String encoding = "";
90.76
90.77 @@ -161,11 +137,10 @@
90.78 /* Parse configurator for this flatfile */
90.79 private Map properties;
90.80
90.81 - private PrimaryKey pk = null;
90.82 -
90.83 /* No-arg constructor; initializes Collections-related member variables. */
90.84 public FlatfileDBTableImpl() {
90.85 - columns = new LinkedHashMap();
90.86 + super();
90.87 + columns = new LinkedHashMap<String, DBColumn>();
90.88 properties = new HashMap();
90.89 }
90.90
90.91 @@ -229,7 +204,7 @@
90.92 * @param ignoreDupCols ignore or throw exception when column with same name being added.
90.93 * @return true if successful. false if failed.
90.94 */
90.95 - private boolean addColumn(FlatfileDBColumn theColumn, boolean ignoreDupCols) {
90.96 + private boolean addColumn(SQLDBColumn theColumn, boolean ignoreDupCols) {
90.97 if (theColumn != null) {
90.98 if ((!ignoreDupCols) && (columns.containsKey(theColumn.getName()))) {
90.99 throw new IllegalArgumentException("Column " + theColumn.getName() + " already exist.");
90.100 @@ -249,7 +224,7 @@
90.101 * @return true if successful. false if failed.
90.102 */
90.103
90.104 - public boolean addColumn(FlatfileDBColumn theColumn) {
90.105 + public boolean addColumn(SQLDBColumn theColumn) {
90.106 return addColumn(theColumn, false);
90.107 }
90.108
90.109 @@ -289,8 +264,8 @@
90.110 return 0;
90.111 }
90.112
90.113 - String refName = (parent != null) ? parent.getFullyQualifiedTableName((DBTable) refObj) : ((DBTable) refObj).getName();
90.114 - String myName = (parent != null) ? parent.getFullyQualifiedTableName(this) : name;
90.115 + String refName = (parentDBModel != null) ? parentDBModel.getFullyQualifiedTableName((DBTable) refObj) : ((DBTable) refObj).getName();
90.116 + String myName = (parentDBModel != null) ? parentDBModel.getFullyQualifiedTableName(this) : name;
90.117 return (myName != null) ? myName.compareTo(refName) : (refName != null) ? 1 : -1;
90.118 }
90.119
90.120 @@ -357,30 +332,6 @@
90.121 }
90.122
90.123 /**
90.124 - * Deletes all columns associated with this table.
90.125 - *
90.126 - * @return true if all columns were deleted successfully, false otherwise.
90.127 - */
90.128 - public boolean deleteAllColumns() {
90.129 - this.columns.clear();
90.130 - return false;
90.131 - }
90.132 -
90.133 - /**
90.134 - * Deletes DBColumn, if any, associated with the given name from this table.
90.135 - *
90.136 - * @param columnName column name to be removed.
90.137 - * @return true if successful. false if failed.
90.138 - */
90.139 - public boolean deleteColumn(String columnName) {
90.140 - if (columnName != null && columnName.trim().length() != 0) {
90.141 - FlatfileDBColumn dbColumn = (FlatfileDBColumn) columns.remove(columnName);
90.142 - return (dbColumn != null);
90.143 - }
90.144 - return false;
90.145 - }
90.146 -
90.147 - /**
90.148 * Overrides default implementation to return value based on memberwise comparison.
90.149 *
90.150 * @param obj Object against which we compare this instance
90.151 @@ -431,34 +382,6 @@
90.152 }
90.153
90.154 /**
90.155 - * Gets the DBColumn, if any, associated with the given name
90.156 - *
90.157 - * @param columnName column name
90.158 - * @return DBColumn associated with columnName, or null if none exists
90.159 - */
90.160 - public DBColumn getColumn(String columnName) {
90.161 - return (DBColumn) this.columns.get(columnName);
90.162 - }
90.163 -
90.164 - /**
90.165 - * @see org.netbeans.modules.model.database.DBTable#getColumnList
90.166 - */
90.167 - public List getColumnList() {
90.168 - List list = new ArrayList();
90.169 - list.addAll(this.columns.values());
90.170 -
90.171 - Collections.sort(list);
90.172 - return list;
90.173 - }
90.174 -
90.175 - /**
90.176 - * @see org.netbeans.modules.model.database.DBTable#getColumns
90.177 - */
90.178 - public Map getColumns() {
90.179 - return this.columns;
90.180 - }
90.181 -
90.182 - /**
90.183 * Gets the Create Statement SQL for creating table for a flat file
90.184 *
90.185 * @return SQL for this Flatfile with getTableName()
90.186 @@ -480,8 +403,8 @@
90.187 tableName = name;
90.188 }
90.189
90.190 - List pkList = new ArrayList();
90.191 - SortedSet fields = new TreeSet(this.columns.values());
90.192 + List<String> pkList = new ArrayList<String>();
90.193 + //SortedSet fields = new TreeSet(this.columns.values());
90.194 Iterator it = this.columns.values().iterator();
90.195 StringBuilder buffer = new StringBuilder(100);
90.196 buffer.append("CREATE EXTERNAL TABLE \"").append(tableName).append("\" ("); // NOI18N
90.197 @@ -551,13 +474,6 @@
90.198 return sql;
90.199 }
90.200
90.201 - /**
90.202 - * @see org.netbeans.modules.model.database.DBTable#getDescription
90.203 - */
90.204 - public String getDescription() {
90.205 - return this.description;
90.206 - }
90.207 -
90.208 public String getDropStatementSQL() {
90.209 return getDropStatementSQL(this.name);
90.210 }
90.211 @@ -652,34 +568,6 @@
90.212 }
90.213
90.214 /**
90.215 - * @see org.netbeans.modules.model.database.DBTable#getForeignKey(String)
90.216 - */
90.217 - public ForeignKey getForeignKey(String fkName) {
90.218 - return null;
90.219 - }
90.220 -
90.221 - /**
90.222 - * @see org.netbeans.modules.model.database.DBTable#getForeignKeys
90.223 - */
90.224 - public List getForeignKeys() {
90.225 - return Collections.EMPTY_LIST;
90.226 - }
90.227 -
90.228 - /**
90.229 - * @see org.netbeans.modules.model.database.DBTable#getIndex
90.230 - */
90.231 - public Index getIndex(String indexName) {
90.232 - return null;
90.233 - }
90.234 -
90.235 - /**
90.236 - * @see org.netbeans.modules.model.database.DBTable#getIndexes
90.237 - */
90.238 - public List getIndexes() {
90.239 - return Collections.EMPTY_LIST;
90.240 - }
90.241 -
90.242 - /**
90.243 * Gets local path to sample file.
90.244 *
90.245 * @return path (in local workstation file system) to file, excluding the filename.
90.246 @@ -689,20 +577,6 @@
90.247 }
90.248
90.249 /**
90.250 - * @see org.netbeans.modules.model.database.DBTable#getName
90.251 - */
90.252 - public synchronized String getName() {
90.253 - return this.name;
90.254 - }
90.255 -
90.256 - /**
90.257 - * @see org.netbeans.modules.model.database.DBTable#getParent
90.258 - */
90.259 - public DatabaseModel getParent() {
90.260 - return this.parent;
90.261 - }
90.262 -
90.263 - /**
90.264 * Gets parse type, if any, associated with this flatfile. To set this type, call
90.265 * setParseConfigurator with an appropriate ParseConfigurator instance from the
90.266 * ParseConfiguratorFactory.
90.267 @@ -714,16 +588,6 @@
90.268 return parserType;
90.269 }
90.270
90.271 - /**
90.272 - * @see org.netbeans.modules.model.database.DBTable#getPrimaryKey
90.273 - */
90.274 - public PrimaryKey getPrimaryKey() {
90.275 - return this.pk;
90.276 - }
90.277 -
90.278 - /**
90.279 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDBTable#getProperties
90.280 - */
90.281 public Map getProperties() {
90.282 return (properties != null) ? properties : Collections.EMPTY_MAP;
90.283 }
90.284 @@ -740,20 +604,6 @@
90.285 }
90.286
90.287 /**
90.288 - * @see org.netbeans.modules.model.database.DBTable#getReferencedTables
90.289 - */
90.290 - public Set getReferencedTables() {
90.291 - return Collections.EMPTY_SET;
90.292 - }
90.293 -
90.294 - /**
90.295 - * @see org.netbeans.modules.model.database.DBTable#getReferenceFor
90.296 - */
90.297 - public ForeignKey getReferenceFor(DBTable target) {
90.298 - return null;
90.299 - }
90.300 -
90.301 - /**
90.302 * @see org.netbeans.modules.model.database.DBTable#getSchema
90.303 */
90.304 public String getSchema() {
90.305 @@ -826,7 +676,7 @@
90.306 return myHash;
90.307 }
90.308
90.309 - public void parseXML(Element xmlElement) {
90.310 + public void parseXML(Element xmlElement) throws BaseException {
90.311 // In order to be compliant with lagacy JIBX generated XML, following structure
90.312 // needs to be adhered to.
90.313 // <pre>
90.314 @@ -858,7 +708,7 @@
90.315
90.316 /**
90.317 *Set defaults for any new property added in the UI property sheet
90.318 - *for flatfile OTD creation
90.319 + *for flatfile db creation
90.320 **/
90.321 private void upgradeProperties() {
90.322 if( !properties.containsKey(PropertyKeys.TRIMWHITESPACE) ) {
90.323 @@ -867,22 +717,6 @@
90.324 }
90.325
90.326 /**
90.327 - * @see org.netbeans.modules.model.database.DBTable#references
90.328 - */
90.329 - public boolean references(DBTable pkTarget) {
90.330 - return false;
90.331 - }
90.332 -
90.333 - /**
90.334 - * Sets description text for this instance.
90.335 - *
90.336 - * @param newDesc new descriptive text
90.337 - */
90.338 - public void setDescription(String newDesc) {
90.339 - this.description = newDesc;
90.340 - }
90.341 -
90.342 - /**
90.343 * Sets the encoding scheme.
90.344 *
90.345 * @param newEncoding encoding scheme
90.346 @@ -911,18 +745,6 @@
90.347 localPath = (localFile.isFile()) ? localFile.getParentFile().getAbsolutePath() : localFile.getAbsolutePath();
90.348 }
90.349
90.350 - /*
90.351 - * Setters and non-API helper methods for this implementation.
90.352 - */
90.353 - /**
90.354 - * Sets table name to new value.
90.355 - *
90.356 - * @param newName new value for table name
90.357 - */
90.358 - public void setName(String newName) {
90.359 - name = newName;
90.360 - }
90.361 -
90.362 public void setOrPutProperty(String key, Object value) {
90.363 if (value!= null && !setProperty(key, value)) {
90.364 Property prop = new Property(key, value.getClass(), true);
90.365 @@ -932,15 +754,6 @@
90.366 }
90.367
90.368 /**
90.369 - * Sets parent DatabaseModel to the given reference.
90.370 - *
90.371 - * @param newParent new DatabaseModel parent
90.372 - */
90.373 - public void setParent(FlatfileDatabaseModel newParent) {
90.374 - this.parent = newParent;
90.375 - }
90.376 -
90.377 - /**
90.378 * Sets MutableParseConfigurator instance associated with this flatfile.
90.379 *
90.380 * @param newConfig new MutableParseConfigurator to associate
90.381 @@ -980,10 +793,10 @@
90.382 public String toString() {
90.383 StringBuilder buf = new StringBuilder(50);
90.384
90.385 - if (parent != null) {
90.386 - buf.append(parent.getModelName());
90.387 + if (parentDBModel != null) {
90.388 + buf.append(parentDBModel.getModelName());
90.389 buf.append(":");
90.390 - buf.append(parent.getFullyQualifiedTableName(this));
90.391 + buf.append(parentDBModel.getFullyQualifiedTableName(this));
90.392 } else {
90.393 buf.append(getName());
90.394 }
90.395 @@ -997,7 +810,7 @@
90.396 * @param prefix
90.397 * @return XML string
90.398 */
90.399 - public String toXMLString(String prefix) {
90.400 + public String toXMLString(String prefix) throws BaseException {
90.401 StringBuilder sb = new StringBuilder();
90.402 if (prefix == null) {
90.403 prefix = "";
90.404 @@ -1051,7 +864,7 @@
90.405 }
90.406 }
90.407
90.408 - protected void parseColumns(Element mapNode) {
90.409 + protected void parseColumns(Element mapNode) throws BaseException {
90.410 NodeList entryNodeList = mapNode.getElementsByTagName("entry");
90.411 NodeList columnNodeList = null;
90.412 Element entry = null;
90.413 @@ -1111,7 +924,7 @@
90.414
90.415 sb.append(ATTR_PARENT);
90.416 sb.append(EQUAL_START_QUOTE);
90.417 - sb.append(this.parent.getModelName());
90.418 + sb.append(this.parentDBModel.getModelName());
90.419 sb.append("\"");
90.420 return sb.toString();
90.421 }
90.422 @@ -1140,7 +953,7 @@
90.423 return fullpath.toString().trim();
90.424 }
90.425
90.426 - private String getXMLColumnMap(String prefix) {
90.427 + private String getXMLColumnMap(String prefix) throws BaseException {
90.428 StringBuilder sb = new StringBuilder(prefix);
90.429 sb.append("<map size=\"");
90.430 sb.append(this.columns.size());
90.431 @@ -1151,7 +964,7 @@
90.432 return sb.toString();
90.433 }
90.434
90.435 - private String getXMLColumnMapEntries(String prefix) {
90.436 + private String getXMLColumnMapEntries(String prefix) throws BaseException {
90.437 StringBuilder sb = new StringBuilder();
90.438 FlatfileDBColumn column = null;
90.439 if ((this.columns != null) && (this.columns.size() > 0)) {
90.440 @@ -1219,7 +1032,19 @@
90.441 }
90.442
90.443 if (pkList.size() > 0){
90.444 - this.pk = new PrimaryKeyImpl("pk" + this.name, pkList, true);
90.445 + this.primaryKey = new PrimaryKeyImpl("pk" + this.name, pkList);
90.446 }
90.447 }
90.448 +
90.449 + public String toXMLString(String prefix, boolean tableOnly) throws BaseException {
90.450 + return toXMLString(prefix, true);
90.451 + }
90.452 +
90.453 + protected String getElementTagName() {
90.454 + throw new UnsupportedOperationException("Not supported yet.");
90.455 + }
90.456 +
90.457 + protected void parseChildren(NodeList childNodeList) throws BaseException {
90.458 + throw new UnsupportedOperationException("Not supported yet.");
90.459 + }
90.460 }
91.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/model/impl/FlatfileDatabaseModelImpl.java Sat Dec 08 10:04:51 2007 +0000
91.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/model/impl/FlatfileDatabaseModelImpl.java Sat Dec 08 10:24:35 2007 +0000
91.3 @@ -43,7 +43,6 @@
91.4
91.5 import java.sql.Connection;
91.6 import java.util.ArrayList;
91.7 -import java.util.Collection;
91.8 import java.util.Collections;
91.9 import java.util.HashMap;
91.10 import java.util.Iterator;
91.11 @@ -57,9 +56,6 @@
91.12 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
91.13 import org.netbeans.modules.mashup.db.model.FlatfileDatabaseModel;
91.14 import org.netbeans.modules.mashup.db.model.FlatfileDefinition;
91.15 -import org.netbeans.modules.model.database.DBConnectionDefinition;
91.16 -import org.netbeans.modules.model.database.DBTable;
91.17 -import org.netbeans.modules.model.database.DatabaseModel;
91.18 import org.netbeans.modules.sql.framework.common.utils.TagParserUtility;
91.19 import org.w3c.dom.Element;
91.20 import org.w3c.dom.Node;
91.21 @@ -67,16 +63,21 @@
91.22
91.23 import com.sun.sql.framework.exception.BaseException;
91.24 import com.sun.sql.framework.utils.Logger;
91.25 +import org.netbeans.modules.etl.model.ETLObject;
91.26 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
91.27 +import org.netbeans.modules.sql.framework.model.DBTable;
91.28 +import org.netbeans.modules.sql.framework.model.DatabaseModel;
91.29 +import org.netbeans.modules.sql.framework.model.impl.SQLDBModelImpl;
91.30
91.31 /**
91.32 - * Flatfile OTD-specific concrete implementation of DatabaseModel interface.
91.33 + * Flatfile DB specific concrete implementation of DatabaseModel interface.
91.34 *
91.35 * @author Jonathan Giron
91.36 * @author Girish Patil
91.37 * @author Ahimanikya Satapathy
91.38 * @version $Revision$
91.39 */
91.40 -public class FlatfileDatabaseModelImpl implements FlatfileDatabaseModel, Cloneable {
91.41 +public class FlatfileDatabaseModelImpl extends SQLDBModelImpl implements FlatfileDatabaseModel, Cloneable {
91.42
91.43 /** Constants used in XML tags * */
91.44 private static final String ATTR_MAJOR_VERSION = "majorVersion";
91.45 @@ -101,7 +102,6 @@
91.46 */
91.47 private static final String FQ_TBL_NAME_SEPARATOR = ".";
91.48
91.49 - /* Initial buffer size for StringBuilder used in marshalling OTDs to XML */
91.50 private static final String LOG_CATEGORY = FlatfileDatabaseModelImpl.class.getName();
91.51
91.52 private static final String QUOTE = "\"";
91.53 @@ -116,32 +116,18 @@
91.54
91.55 private static final String XML_DOC_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
91.56
91.57 - /** Connection definition used to retrieve metadata */
91.58 - protected FlatfileDBConnectionDefinition connectionDefinition;
91.59 -
91.60 /** Connection name */
91.61 protected volatile String connectionName;
91.62
91.63 - /** User-supplied description */
91.64 - protected volatile String description;
91.65 -
91.66 - /** User-supplied name */
91.67 - protected volatile String name;
91.68 -
91.69 - /** Map of DBTable instances */
91.70 - protected Map<String, FlatfileDBTable> tables;
91.71 -
91.72 - /* Major version number of DatabaseModel/OTD metadata */
91.73 + /* Major version number of DatabaseModel metadata */
91.74 private transient int majorVersion = 5;
91.75
91.76 - /* Micro (implementation) version number of DatabaseModel/OTD metadata */
91.77 + /* Micro (implementation) version number of DatabaseModel metadata */
91.78 private transient int microVersion = 0;
91.79
91.80 - /* Major version number of DatabaseModel/OTD metadata */
91.81 + /* Major version number of DatabaseModel metadata */
91.82 private transient int minorVersion = 1;
91.83
91.84 - private transient FlatfileDefinition source;
91.85 -
91.86 /** Constructs a new default instance of FlatfileDatabaseModelImpl. */
91.87 public FlatfileDatabaseModelImpl() {
91.88 tables = new HashMap<String, FlatfileDBTable>();
91.89 @@ -170,7 +156,7 @@
91.90 * @param modelName name of new DatabaseModel
91.91 * @param connDef FlatfileDBConnectionDefinition for this new instance
91.92 */
91.93 - public FlatfileDatabaseModelImpl(String modelName, FlatfileDBConnectionDefinition connDef) {
91.94 + public FlatfileDatabaseModelImpl(String modelName, DBConnectionDefinition connDef) {
91.95 this();
91.96
91.97 if (connDef == null) {
91.98 @@ -208,7 +194,6 @@
91.99 * @return shallow copy of this ETLDataSource
91.100 */
91.101 public Object clone() {
91.102 - try {
91.103 FlatfileDatabaseModelImpl myClone = (FlatfileDatabaseModelImpl) super.clone();
91.104
91.105 myClone.name = name;
91.106 @@ -221,9 +206,6 @@
91.107 myClone.connectionName = connectionName;
91.108
91.109 return myClone;
91.110 - } catch (CloneNotSupportedException e) {
91.111 - throw new InternalError(e.toString());
91.112 - }
91.113 }
91.114
91.115 /**
91.116 @@ -271,30 +253,6 @@
91.117 }
91.118
91.119 /**
91.120 - * Deletes all tables associated with this data source.
91.121 - *
91.122 - * @return true if all tables were deleted successfully, false otherwise.
91.123 - */
91.124 - public boolean deleteAllTables() {
91.125 - this.tables.clear();
91.126 - return true;
91.127 - }
91.128 -
91.129 - /**
91.130 - * Delete table from the ETLDataSource
91.131 - *
91.132 - * @param fqTableName fully qualified name of table to be deleted.
91.133 - * @return true if successful. false if failed.
91.134 - */
91.135 - public boolean deleteTable(String fqTableName) {
91.136 - if (fqTableName != null && fqTableName.trim().length() != 0) {
91.137 - this.tables.remove(fqTableName);
91.138 - return true;
91.139 - }
91.140 - return false;
91.141 - }
91.142 -
91.143 - /**
91.144 * @see java.lang.Object#equals
91.145 */
91.146 public boolean equals(Object refObj) {
91.147 @@ -336,21 +294,10 @@
91.148
91.149 return result;
91.150 }
91.151 -
91.152 -
91.153 - /**
91.154 - * Gets DBConnectionDefinition of the ETLDataSource object
91.155 - *
91.156 - * @return ConnectionDefinition of the ETLDataSource object
91.157 - */
91.158 - public DBConnectionDefinition getConnectionDefinition() {
91.159 - return connectionDefinition;
91.160 - }
91.161
91.162 -
91.163 - public FlatfileDBConnectionDefinition getFlatfileDBConnectionDefinition(boolean download) {
91.164 + public DBConnectionDefinition getFlatfileDBConnectionDefinition(boolean download) {
91.165 if(download) {
91.166 - return (FlatfileDBConnectionDefinition)getConnectionDefinition();
91.167 + return getConnectionDefinition();
91.168 } else {
91.169 return connectionDefinition;
91.170 }
91.171 @@ -506,93 +453,29 @@
91.172 return DRIVER_TYPE;
91.173 }
91.174
91.175 - /**
91.176 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDatabaseModel#getMajorVersion
91.177 - */
91.178 public int getMajorVersion() {
91.179 return majorVersion;
91.180 }
91.181
91.182 - /**
91.183 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDatabaseModel#getMicroVersion
91.184 - */
91.185 public int getMicroVersion() {
91.186 return microVersion;
91.187 }
91.188
91.189 - /**
91.190 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDatabaseModel#getMinorVersion
91.191 - */
91.192 public int getMinorVersion() {
91.193 return minorVersion;
91.194 }
91.195
91.196 /**
91.197 - * @see org.netbeans.modules.model.database.DatabaseModel#getModelDescription
91.198 - */
91.199 - public String getModelDescription() {
91.200 - return description;
91.201 - }
91.202 -
91.203 - /**
91.204 - * @see org.netbeans.modules.model.database.DatabaseModel#getModelName
91.205 - */
91.206 - public String getModelName() {
91.207 - return this.name;
91.208 - }
91.209 -
91.210 - /**
91.211 * Gets repository object, if any, providing underlying data for this DatabaseModel
91.212 * implementation.
91.213 *
91.214 * @return RepositoryObject hosting this object's metadata, or null if data are not
91.215 * held by a Object.
91.216 */
91.217 - public FlatfileDefinition getSource() {
91.218 + public ETLObject getSource() {
91.219 return source;
91.220 }
91.221
91.222 - /**
91.223 - * @see org.netbeans.modules.model.database.DatabaseModel#getTable(String)
91.224 - */
91.225 - public DBTable getTable(String fqTableName) {
91.226 - return (DBTable) this.tables.get(fqTableName);
91.227 - }
91.228 -
91.229 - /**
91.230 - * @see org.netbeans.modules.model.database.DatabaseModel#getTable(String, String, String)
91.231 - */
91.232 - public DBTable getTable(String tableName, String schemaName, String catalogName) {
91.233 - return getTable(getFullyQualifiedTableName(tableName, schemaName, catalogName));
91.234 - }
91.235 -
91.236 - /**
91.237 - * Gets a read-only Map of table names to available DBTable instances in this model.
91.238 - *
91.239 - * @return readonly Map of table names to DBTable instances
91.240 - */
91.241 - public Map getTableMap() {
91.242 - return Collections.unmodifiableMap(tables);
91.243 - }
91.244 -
91.245 - /**
91.246 - * @see org.netbeans.modules.model.database.DatabaseModel#getTables
91.247 - */
91.248 - public List getTables() {
91.249 - List list = Collections.EMPTY_LIST;
91.250 - Collection tableColl = tables.values();
91.251 -
91.252 - if (tableColl.size() != 0) {
91.253 - list = new ArrayList(tableColl.size());
91.254 - list.addAll(tableColl);
91.255 - }
91.256 -
91.257 - return Collections.unmodifiableList(list);
91.258 - }
91.259 -
91.260 - /**
91.261 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.repository.FlatfileDatabaseModel#getVersionString
91.262 - */
91.263 public String getVersionString() {
91.264 return majorVersion + "." + minorVersion + "." + microVersion;
91.265 }
91.266 @@ -622,13 +505,13 @@
91.267 *
91.268 * @param xmlElement
91.269 */
91.270 - public void parseXML(Element xmlElement) {
91.271 + public void parseXML(Element xmlElement) throws BaseException {
91.272 /*
91.273 * In order to be compliant with legacy JIBX generated XML following structure
91.274 * needs to be maintained. <FlatfileDatabaseModel majorVersion="5" .....> <map
91.275 * size="3"> // tables <entry key="PQ_EMPLOYEE_CSV"> <FlatfileTable
91.276 * name="PQ_EMPLOYEE_CSV" encoding="US-ASCII .... </FlatfileTable> </entry> </map>
91.277 - * <connectionDefinition name="otdFlatfileDB" .../> </FlatfileDatabaseModel>
91.278 + * <connectionDefinition name="FlatfileDB" .../> </FlatfileDatabaseModel>
91.279 * </pre>
91.280 */
91.281 Element tmpElement = null;
91.282 @@ -647,7 +530,7 @@
91.283
91.284 if (TAG_CONNECTION_DEFINITION.equals(tmpElement.getNodeName())) {
91.285 this.connectionDefinition = new FlatfileDBConnectionDefinitionImpl();
91.286 - this.connectionDefinition.parseXML(tmpElement);
91.287 + ((FlatfileDBConnectionDefinition)connectionDefinition).parseXML(tmpElement);
91.288 }
91.289 }
91.290 }
91.291 @@ -658,7 +541,7 @@
91.292 *
91.293 * @param theConnectionDefinition to be set
91.294 */
91.295 - public void setConnectionDefinition(FlatfileDBConnectionDefinition theConnectionDefinition) {
91.296 + public void setConnectionDefinition(DBConnectionDefinition theConnectionDefinition) {
91.297 this.connectionDefinition = theConnectionDefinition;
91.298 }
91.299
91.300 @@ -672,24 +555,6 @@
91.301 }
91.302
91.303 /**
91.304 - * Sets the description string of this DatabaseModel
91.305 - *
91.306 - * @param newDesc new description string
91.307 - */
91.308 - public void setDescription(String newDesc) {
91.309 - this.description = newDesc;
91.310 - }
91.311 -
91.312 - /**
91.313 - * Setter for Model Name
91.314 - *
91.315 - * @param theModelName
91.316 - */
91.317 - public void setModelName(String theModelName) {
91.318 - this.name = theModelName;
91.319 - }
91.320 -
91.321 - /**
91.322 * Sets repository object, if any, providing underlying data for this DatabaseModel
91.323 * implementation.
91.324 *
91.325 @@ -727,7 +592,7 @@
91.326 * @param prefix
91.327 * @return XML string
91.328 */
91.329 - public String toXMLString(String prefix) {
91.330 + public String toXMLString(String prefix) throws BaseException {
91.331 if (prefix == null) {
91.332 prefix = "";
91.333 }
91.334 @@ -807,7 +672,7 @@
91.335 name = (String) atts.get(ATTR_NAME);
91.336 }
91.337
91.338 - protected void parseTablesMap(Element mapNode) {
91.339 + protected void parseTablesMap(Element mapNode) throws BaseException {
91.340 // All child "entry" elements under "map" element
91.341 NodeList mapEntryNodeList = mapNode.getChildNodes();
91.342 Element entry = null;
91.343 @@ -896,13 +761,13 @@
91.344
91.345 private String getXMLConnectionDefition(String prefix) {
91.346 if (this.connectionDefinition != null) {
91.347 - return this.connectionDefinition.toXMLString(prefix);
91.348 + return ((FlatfileDBConnectionDefinition)connectionDefinition).toXMLString(prefix);
91.349 } else {
91.350 return "";
91.351 }
91.352 }
91.353
91.354 - private String getXMLTableMapEntries(String prefix) {
91.355 + private String getXMLTableMapEntries(String prefix) throws BaseException {
91.356 StringBuilder sb = new StringBuilder();
91.357 FlatfileDBTable table = null;
91.358 if ((this.tables != null) && (this.tables.size() > 0)) {
91.359 @@ -924,7 +789,7 @@
91.360 return sb.toString();
91.361 }
91.362
91.363 - private String getXMLTablesMap(String prefix) {
91.364 + private String getXMLTablesMap(String prefix) throws BaseException {
91.365 StringBuilder sb = new StringBuilder(prefix);
91.366 sb.append("<map size=\"");
91.367 sb.append(this.tables.size());
92.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/FlatfileNode.java Sat Dec 08 10:04:51 2007 +0000
92.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/FlatfileNode.java Sat Dec 08 10:24:35 2007 +0000
92.3 @@ -42,7 +42,6 @@
92.4
92.5 import java.beans.IntrospectionException;
92.6
92.7 -import org.netbeans.modules.mashup.db.common.FlatfileDBException;
92.8 import org.netbeans.modules.mashup.db.ui.model.FlatfileColumn;
92.9 import org.netbeans.modules.mashup.db.ui.model.FlatfileDatabase;
92.10 import org.netbeans.modules.mashup.db.ui.model.FlatfileTable;
92.11 @@ -139,19 +138,19 @@
92.12 if (model instanceof FlatfileDatabase) {
92.13 type = DATABASE;
92.14 super.setName(((FlatfileDatabase) model).getName());
92.15 - setIconBase("org/netbeans/modules/mashup/db/ui/resource/images/OTD");
92.16 + setIconBaseWithExtension("org/netbeans/modules/mashup/db/ui/resource/images/root.png");
92.17 } else if (model instanceof FlatfileTable) {
92.18 type = TABLE;
92.19 super.setName(((FlatfileTable) model).getTableName());
92.20 - setIconBase("org/netbeans/modules/mashup/db/ui/resource/images/Table");
92.21 + setIconBaseWithExtension("org/netbeans/modules/mashup/db/ui/resource/images/Table.gif");
92.22 } else if (model instanceof FlatfileColumn) {
92.23 type = COLUMN;
92.24 FlatfileColumn column = (FlatfileColumn) model;
92.25 super.setName(column.getName());
92.26 if (column.isNullable()) {
92.27 - setIconBase("org/netbeans/modules/mashup/db/ui/resource/images/Column");
92.28 + setIconBaseWithExtension("org/netbeans/modules/mashup/db/ui/resource/images/Column.gif");
92.29 } else {
92.30 - setIconBase("org/netbeans/modules/mashup/db/ui/resource/images/ColumnNotNull");
92.31 + setIconBaseWithExtension("org/netbeans/modules/mashup/db/ui/resource/images/ColumnNotNull.gif");
92.32 }
92.33 } else {
92.34 throw new IllegalArgumentException("Unrecognized model type: must be FlatfileDatabase, FlatfileTable, or FlatfileColumn");
92.35 @@ -323,23 +322,6 @@
92.36 * @param newName new table name.
92.37 */
92.38 public void setName(String newName) {
92.39 - // switch (type) {
92.40 - // case DATABASE:
92.41 - // ((FlatfileDatabase) userObject).setName(newName);
92.42 - // break;
92.43 - //
92.44 - // case COLUMN:
92.45 - // ((FlatfileColumn) userObject).setName(newName);
92.46 - // break;
92.47 - //
92.48 - // case TABLE:
92.49 - // ((FlatfileTable) userObject).setName(newName);
92.50 - // break;
92.51 - //
92.52 - // default:
92.53 - // break;
92.54 - // }
92.55 -
92.56 super.setName(newName);
92.57 }
92.58
92.59 @@ -349,9 +331,6 @@
92.60 * @param isSelected sets to true if node is selected, false otherwise
92.61 */
92.62 public void setSelected(boolean isSelected) {
92.63 - if (type == COLUMN) {
92.64 - // ((FlatfileColumn) userObject).setSelected(isSelected);
92.65 - }
92.66 selected = isSelected;
92.67 }
92.68
92.69 @@ -389,55 +368,6 @@
92.70 return firstDisplayName.compareTo(secondDisplayName);
92.71 }
92.72
92.73 - // // RECOMMENDED - handle cloning specially
92.74 - // //(so as not to invoke the overhead of FilterNode):
92.75 - //
92.76 - // public Node cloneNode() {
92.77 - // // Try to pass in similar constructor params to what you originally got:
92.78 - // return new OTDNode();
92.79 - // }
92.80 - //
92.81 - //
92.82 - // // Permit user to customize whole node at once (instead of per-property):
92.83 - //
92.84 - // public boolean hasCustomizer() {
92.85 - // return true;
92.86 - // }
92.87 - // public Component getCustomizer() {
92.88 - // return new MyCustomizingPanel(this);
92.89 - // }
92.90 - //
92.91 - //
92.92 - // // Permit node to be reordered (you may also want to put
92.93 - // // MoveUpAction and MoveDownAction on the subnodes, if you can,
92.94 - // // but ReorderAction on the parent is enough):
92.95 - //
92.96 - // private class ReorderMe extends Index.Support {
92.97 - //
92.98 - // public Node[] getNodes() {
92.99 - // return OTDNode.this.getChildren().getNodes();
92.100 - // }
92.101 - //
92.102 - // public int getNodesCount() {
92.103 - // return getNodes().length;
92.104 - // }
92.105 - //
92.106 - // // This assumes that there is exactly one child node per key.
92.107 - // // If you are using e.g. Children.Array, you can use shortcut
92.108 - // implementations
92.109 - // // of the Index cookie.
92.110 - // public void reorder(int[] perm) {
92.111 - // // Remember: {2, 0, 1} cycles three items forwards.
92.112 - // List old = OTDNode.this.getFlatfileChildren().myKeys;
92.113 - // if (list.size() != perm.length) throw new IllegalArgumentException();
92.114 - // List nue = new ArrayList(perm.length);
92.115 - // for (int i = 0; i < perm.length; i++)
92.116 - // nue.set(i, old.get(perm[i]));
92.117 - // OTDNode.this.getFlatfileChildren().setKeys(nue);
92.118 - // }
92.119 - //
92.120 - // }
92.121 -
92.122 /*
92.123 * Initializes Action and Cookies @param nodeType nodeType
92.124 */
93.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/FlatfileResulSetPanel.java Sat Dec 08 10:04:51 2007 +0000
93.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/FlatfileResulSetPanel.java Sat Dec 08 10:24:35 2007 +0000
93.3 @@ -127,7 +127,7 @@
93.4 Object obj = node.getUserObject();
93.5 if (obj instanceof FlatfileTable) {
93.6 FlatfileTable table = (FlatfileTable) obj;
93.7 - conn = otd.getJDBCConnection();
93.8 + conn = db.getJDBCConnection();
93.9 stmt = conn.createStatement();
93.10 String selectSQL = table.getSelectStatementSQL(ct);
93.11 Logger.print(Logger.DEBUG, FlatfileResulSetPanel.class.getName(), selectSQL);
93.12 @@ -179,7 +179,6 @@
93.13 recordCount.setEnabled(true);
93.14
93.15 if (stmt != null) {
93.16 - stmt.execute("shutdown");
93.17 stmt.close();
93.18 }
93.19
93.20 @@ -201,18 +200,17 @@
93.21
93.22 private static final String CMD_SHOW_DATA = "Show Data"; // NOI18N
93.23
93.24 - public static Icon getOTDIcon() {
93.25 + public static Icon getDbIcon() {
93.26 Icon icon = null;
93.27 try {
93.28 - icon = new ImageIcon(Utilities.loadImage("org/netbeans/modules/mashup/db/ui/resource/images/OTD.png"));
93.29 - ;
93.30 + icon = new ImageIcon(Utilities.loadImage("org/netbeans/modules/mashup/db/ui/resource/images/root.png"));
93.31 } catch (Exception ex) {
93.32 // Log exception
93.33 }
93.34 return icon;
93.35 }
93.36
93.37 - private FlatfileDefinition otd = null;
93.38 + private FlatfileDefinition db = null;
93.39 private JTextField recordCount;
93.40 private ResultSetTablePanel recordViewer;
93.41 private JButton showDataBtn;
93.42 @@ -220,9 +218,9 @@
93.43
93.44 private FlatfileTreeTableView treeView = null;
93.45
93.46 - public FlatfileResulSetPanel(FlatfileDefinition otdInstance) {
93.47 + public FlatfileResulSetPanel(FlatfileDefinition dbInstance) {
93.48 super();
93.49 - otd = otdInstance;
93.50 + db = dbInstance;
93.51
93.52 this.setBorder(BorderFactory.createTitledBorder("Selected Table Content"));
93.53 this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
94.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
94.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
94.3 @@ -56,6 +56,6 @@
94.4 LBL_indexed=Indexed
94.5 LBL_primary_key=Primary key
94.6 LBL_foreign_key=Foreign key
94.7 -LBL_otd_name=Flat file definition name
94.8 +LBL_mashup_db_name=Flat file definition name
94.9 LBL_description=Description
94.10 LBL_none_placeholder=<None>
94.11 \ No newline at end of file
95.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
95.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/DelimitedFlatfileBeanInfo.java Sat Dec 08 10:24:35 2007 +0000
95.3 @@ -0,0 +1,93 @@
95.4 +/*
95.5 + *
95.6 + * Copyright (c) 2005, SeeBeyond Technology Corporation,
95.7 + * All Rights Reserved
95.8 + *
95.9 + * This program, and all the routines referenced herein,
95.10 + * are the proprietary properties and trade secrets of
95.11 + * SEEBEYOND TECHNOLOGY CORPORATION.
95.12 + *
95.13 + * Except as provided for by license agreement, this
95.14 + * program shall not be duplicated, used, or disclosed
95.15 + * without written consent signed by an officer of
95.16 + * SEEBEYOND TECHNOLOGY CORPORATION.
95.17 + *
95.18 + */
95.19 +package org.netbeans.modules.mashup.db.ui.model;
95.20 +
95.21 +import java.beans.BeanDescriptor;
95.22 +import java.beans.IntrospectionException;
95.23 +import java.beans.PropertyDescriptor;
95.24 +import java.util.ArrayList;
95.25 +import java.util.Arrays;
95.26 +import java.util.List;
95.27 +
95.28 +import org.openide.util.NbBundle;
95.29 +
95.30 +/**
95.31 + * Concrete class to expose delimited-specific flatfile table properties. TODO Extend this
95.32 + * class to expose setters for read-write property sheets
95.33 + * (MutableDelimitedFlatfileBeanInfo?)
95.34 + *
95.35 + * @author Jonathan Giron
95.36 + * @author Ahimanikya Satapathy
95.37 + * @version $Revision$
95.38 + */
95.39 +public class DelimitedFlatfileBeanInfo extends FlatfileTableBeanInfo {
95.40 +
95.41 + private static BeanDescriptor beanDescriptor = null;
95.42 +
95.43 + private static PropertyDescriptor[] properties = null;
95.44 +
95.45 + /**
95.46 + * Gets the bean's <code>BeanDescriptor</code>s.
95.47 + *
95.48 + * @return BeanDescriptor describing the editable properties of this bean. May return
95.49 + * null if the information should be obtained by automatic analysis.
95.50 + */
95.51 + public BeanDescriptor getBeanDescriptor() {
95.52 + if (beanDescriptor == null) {
95.53 + beanDescriptor = new BeanDescriptor(DelimitedFlatfile.class);
95.54 + }
95.55 +
95.56 + return beanDescriptor;
95.57 + }
95.58 +
95.59 + /**
95.60 + * Gets the bean's <code>PropertyDescriptor</code>s.
95.61 + *
95.62 + * @return An array of PropertyDescriptors describing the editable properties
95.63 + * supported by this bean. May return null if the information should be
95.64 + * obtained by automatic analysis.
95.65 + * <p>
95.66 + * If a property is indexed, then its entry in the result array will belong to
95.67 + * the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client of
95.68 + * getPropertyDescriptors can use "instanceof" to check if a given
95.69 + * PropertyDescriptor is an IndexedPropertyDescriptor.
95.70 + */
95.71 + public PropertyDescriptor[] getPropertyDescriptors() {
95.72 + if (properties == null) {
95.73 + List myProps = new ArrayList(Arrays.asList(super.getPropertyDescriptors()));
95.74 +
95.75 + try {
95.76 + PropertyDescriptor pd = new PropertyDescriptor("fieldDelimiter", DelimitedFlatfile.class, "getFieldDelimiter", null); // NOI18N
95.77 + String label = NbBundle.getMessage(DelimitedFlatfileBeanInfo.class, "LBL_field_delimiter"); // NOI18N
95.78 + pd.setDisplayName(label);
95.79 + myProps.add(pd);
95.80 + } catch (IntrospectionException ignore) {
95.81 + }
95.82 +
95.83 + try {
95.84 + PropertyDescriptor pd = new PropertyDescriptor("fieldQualifier", DelimitedFlatfile.class, "getTextQualifier", null); // NOI18N
95.85 + String label = NbBundle.getMessage(DelimitedFlatfileBeanInfo.class, "LBL_prec_qualifier"); // NOI18N
95.86 + pd.setDisplayName(label);
95.87 + myProps.add(pd);
95.88 + } catch (IntrospectionException ignore) {
95.89 + }
95.90 +
95.91 + properties = (PropertyDescriptor[]) myProps.toArray(new PropertyDescriptor[myProps.size()]);
95.92 + }
95.93 +
95.94 + return properties;
95.95 + }
95.96 +}
95.97 \ No newline at end of file
96.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
96.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FixedWidthFlatfileBeanInfo.java Sat Dec 08 10:24:35 2007 +0000
96.3 @@ -0,0 +1,93 @@
96.4 +/*
96.5 + *
96.6 + * Copyright (c) 2005, SeeBeyond Technology Corporation,
96.7 + * All Rights Reserved
96.8 + *
96.9 + * This program, and all the routines referenced herein,
96.10 + * are the proprietary properties and trade secrets of
96.11 + * SEEBEYOND TECHNOLOGY CORPORATION.
96.12 + *
96.13 + * Except as provided for by license agreement, this
96.14 + * program shall not be duplicated, used, or disclosed
96.15 + * without written consent signed by an officer of
96.16 + * SEEBEYOND TECHNOLOGY CORPORATION.
96.17 + *
96.18 + */
96.19 +package org.netbeans.modules.mashup.db.ui.model;
96.20 +
96.21 +import java.beans.BeanDescriptor;
96.22 +import java.beans.IntrospectionException;
96.23 +import java.beans.PropertyDescriptor;
96.24 +import java.util.ArrayList;
96.25 +import java.util.Arrays;
96.26 +import java.util.List;
96.27 +
96.28 +import org.openide.util.NbBundle;
96.29 +
96.30 +/**
96.31 + * Concrete class to expose fixedwidth-specific flatfile table properties. TODO Extend
96.32 + * this class to expose setters for read-write property sheets
96.33 + * (MutableFixedWidthFlatfileBeanInfo?)
96.34 + *
96.35 + * @author Jonathan Giron
96.36 + * @version $Revision$
96.37 + */
96.38 +public class FixedWidthFlatfileBeanInfo extends FlatfileTableBeanInfo {
96.39 +
96.40 + private static BeanDescriptor beanDescriptor = null;
96.41 +
96.42 + private static PropertyDescriptor[] properties = null;
96.43 +
96.44 + /**
96.45 + * Gets the bean's <code>BeanDescriptor</code>s.
96.46 + *
96.47 + * @return BeanDescriptor describing the editable properties of this bean. May return
96.48 + * null if the information should be obtained by automatic analysis.
96.49 + */
96.50 + public BeanDescriptor getBeanDescriptor() {
96.51 + if (beanDescriptor == null) {
96.52 + beanDescriptor = new BeanDescriptor(FixedWidthFlatfile.class);
96.53 + }
96.54 +
96.55 + return beanDescriptor;
96.56 + }
96.57 +
96.58 + /**
96.59 + * Gets the bean's <code>PropertyDescriptor</code>s.
96.60 + *
96.61 + * @return An array of PropertyDescriptors describing the editable properties
96.62 + * supported by this bean. May return null if the information should be
96.63 + * obtained by automatic analysis.
96.64 + * <p>
96.65 + * If a property is indexed, then its entry in the result array will belong to
96.66 + * the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client of
96.67 + * getPropertyDescriptors can use "instanceof" to check if a given
96.68 + * PropertyDescriptor is an IndexedPropertyDescriptor.
96.69 + */
96.70 + public PropertyDescriptor[] getPropertyDescriptors() {
96.71 + if (properties == null) {
96.72 + List myProps = new ArrayList(Arrays.asList(super.getPropertyDescriptors()));
96.73 +
96.74 + try {
96.75 + // This is a derived property and should not be writable
96.76 + PropertyDescriptor pd = new PropertyDescriptor("recordLength", FixedWidthFlatfile.class, "getRecordLength", null); // NOI18N
96.77 + String label = NbBundle.getMessage(FixedWidthFlatfileBeanInfo.class, "LBL_record_length"); // NOI18N
96.78 + pd.setDisplayName(label);
96.79 + myProps.add(pd);
96.80 + } catch (IntrospectionException ignore) {
96.81 + }
96.82 +
96.83 + try {
96.84 + PropertyDescriptor pd = new PropertyDescriptor("headerBytesOffset", FixedWidthFlatfile.class, "getHeaderBytesOffset", null); // NOI18N
96.85 + String label = NbBundle.getMessage(FixedWidthFlatfileBeanInfo.class, "LBL_header_offset"); // NOI18N
96.86 + pd.setDisplayName(label);
96.87 + myProps.add(pd);
96.88 + } catch (IntrospectionException ignore) {
96.89 + }
96.90 +
96.91 + properties = (PropertyDescriptor[]) myProps.toArray(new PropertyDescriptor[myProps.size()]);
96.92 + }
96.93 +
96.94 + return properties;
96.95 + }
96.96 +}
96.97 \ No newline at end of file
97.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileColumn.java Sat Dec 08 10:04:51 2007 +0000
97.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileColumn.java Sat Dec 08 10:24:35 2007 +0000
97.3 @@ -43,10 +43,10 @@
97.4 import java.util.Map;
97.5
97.6 import org.netbeans.modules.mashup.db.model.FlatfileDBColumn;
97.7 -import org.netbeans.modules.model.database.DBTable;
97.8 import org.openide.util.NbBundle;
97.9
97.10 import com.sun.sql.framework.utils.StringUtil;
97.11 +import org.netbeans.modules.sql.framework.model.DBTable;
97.12
97.13 /**
97.14 * @author Jonathan Giron
98.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
98.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileColumnBeanInfo.java Sat Dec 08 10:24:35 2007 +0000
98.3 @@ -0,0 +1,191 @@
98.4 +/*
98.5 + *
98.6 + * Copyright (c) 2005, SeeBeyond Technology Corporation,
98.7 + * All Rights Reserved
98.8 + *
98.9 + * This program, and all the routines referenced herein,
98.10 + * are the proprietary properties and trade secrets of
98.11 + * SEEBEYOND TECHNOLOGY CORPORATION.
98.12 + *
98.13 + * Except as provided for by license agreement, this
98.14 + * program shall not be duplicated, used, or disclosed
98.15 + * without written consent signed by an officer of
98.16 + * SEEBEYOND TECHNOLOGY CORPORATION.
98.17 + *
98.18 + */
98.19 +package org.netbeans.modules.mashup.db.ui.model;
98.20 +
98.21 +import java.beans.BeanDescriptor;
98.22 +import java.beans.EventSetDescriptor;
98.23 +import java.beans.IntrospectionException;
98.24 +import java.beans.MethodDescriptor;
98.25 +import java.beans.PropertyDescriptor;
98.26 +import java.beans.SimpleBeanInfo;
98.27 +import java.util.ArrayList;
98.28 +import java.util.List;
98.29 +
98.30 +import org.openide.util.NbBundle;
98.31 +
98.32 +/**
98.33 + * Exposes getters for flatfile column table properties. TODO Extend this class to expose
98.34 + * setters for read-write property sheets (MutabledFlatfileColumnBeanInfo?)
98.35 + *
98.36 + * @author Jonathan Giron
98.37 + * @version $Revision$
98.38 + */
98.39 +public class FlatfileColumnBeanInfo extends SimpleBeanInfo {
98.40 +
98.41 + private static BeanDescriptor beanDescriptor = null;
98.42 +
98.43 + private static PropertyDescriptor[] properties = null;
98.44 +
98.45 + private static EventSetDescriptor[] eventSets = null;
98.46 +
98.47 + private static MethodDescriptor[] methods = null;
98.48 +
98.49 + /**
98.50 + * Gets the bean's <code>BeanDescriptor</code>s.
98.51 + *
98.52 + * @return BeanDescriptor describing the editable properties of this bean. May return
98.53 + * null if the information should be obtained by automatic analysis.
98.54 + */
98.55 + public BeanDescriptor getBeanDescriptor() {
98.56 + if (beanDescriptor == null) {
98.57 + beanDescriptor = new BeanDescriptor(FlatfileColumn.class);
98.58 + }
98.59 +
98.60 + return beanDescriptor;
98.61 + }
98.62 +
98.63 + /**
98.64 + * Gets the bean's <code>PropertyDescriptor</code>s.
98.65 + *
98.66 + * @return An array of PropertyDescriptors describing the editable properties
98.67 + * supported by this bean. May return null if the information should be
98.68 + * obtained by automatic analysis.
98.69 + * <p>
98.70 + * If a property is indexed, then its entry in the result array will belong to
98.71 + * the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client of
98.72 + * getPropertyDescriptors can use "instanceof" to check if a given
98.73 + * PropertyDescriptor is an IndexedPropertyDescriptor.
98.74 + */
98.75 + public PropertyDescriptor[] getPropertyDescriptors() {
98.76 + if (properties == null) {
98.77 + List myProps = new ArrayList();
98.78 +
98.79 + try {
98.80 + PropertyDescriptor pd = new PropertyDescriptor("name", FlatfileColumn.class, "getName", null); // NOI18N
98.81 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_column_name"); // NOI18N
98.82 + pd.setDisplayName(label);
98.83 + myProps.add(pd);
98.84 + } catch (IntrospectionException e) {
98.85 + }
98.86 +
98.87 + try {
98.88 + PropertyDescriptor pd = new PropertyDescriptor("ordinalPosition", FlatfileColumn.class, "getOrdinalPosition", null); // NOI18N
98.89 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_column_position"); // NOI18N
98.90 + pd.setDisplayName(label);
98.91 + myProps.add(pd);
98.92 + } catch (IntrospectionException e) {
98.93 + }
98.94 +
98.95 + try {
98.96 + PropertyDescriptor pd = new PropertyDescriptor("precision", FlatfileColumn.class, "getPrecision", null); // NOI18N
98.97 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_prec_length"); // NOI18N
98.98 + pd.setDisplayName(label);
98.99 + myProps.add(pd);
98.100 + } catch (IntrospectionException e) {
98.101 + }
98.102 +
98.103 + try {
98.104 + PropertyDescriptor pd = new PropertyDescriptor("scale", FlatfileColumn.class, "getScale", null); // NOI18N
98.105 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_scale"); // NOI18N
98.106 + pd.setDisplayName(label);
98.107 + myProps.add(pd);
98.108 + } catch (IntrospectionException e) {
98.109 + }
98.110 +
98.111 + try {
98.112 + PropertyDescriptor pd = new PropertyDescriptor("sqlType", FlatfileColumn.class, "getJdbcTypeString", null); // NOI18N
98.113 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_sql_type"); // NOI18N
98.114 + pd.setDisplayName(label);
98.115 + myProps.add(pd);
98.116 + } catch (IntrospectionException e) {
98.117 + }
98.118 +
98.119 + try {
98.120 + PropertyDescriptor pd = new PropertyDescriptor("nullable", FlatfileColumn.class, "isNullable", null); // NOI18N
98.121 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_nullable"); // NOI18N
98.122 + pd.setDisplayName(label);
98.123 + myProps.add(pd);
98.124 + } catch (IntrospectionException e) {
98.125 + }
98.126 +
98.127 + try {
98.128 + PropertyDescriptor pd = new PropertyDescriptor("indexed", FlatfileColumn.class, "isIndexed", null); // NOI18N
98.129 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_indexed"); // NOI18N
98.130 + pd.setDisplayName(label);
98.131 + myProps.add(pd);
98.132 + } catch (IntrospectionException e) {
98.133 + }
98.134 +
98.135 + try {
98.136 + PropertyDescriptor pd = new PropertyDescriptor("primaryKey", FlatfileColumn.class, "isPrimaryKey", null); // NOI18N
98.137 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_primary_key"); // NOI18N
98.138 + pd.setDisplayName(label);
98.139 + myProps.add(pd);
98.140 + } catch (IntrospectionException e) {
98.141 + }
98.142 +
98.143 + try {
98.144 + PropertyDescriptor pd = new PropertyDescriptor("foreignKey", FlatfileColumn.class, "isForeignKey", null); // NOI18N
98.145 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_foreign_key"); // NOI18N
98.146 + pd.setDisplayName(label);
98.147 + myProps.add(pd);
98.148 + } catch (IntrospectionException e) {
98.149 + }
98.150 +
98.151 + try {
98.152 + PropertyDescriptor pd = new PropertyDescriptor("defaultValue", FlatfileColumn.class, "getDefaultValue", null); // NOI18N
98.153 + String label = NbBundle.getMessage(FlatfileColumnBeanInfo.class, "LBL_default_value"); // NOI18N
98.154 + pd.setDisplayName(label);
98.155 + myProps.add(pd);
98.156 + } catch (IntrospectionException e) {
98.157 + }
98.158 +
98.159 + properties = (PropertyDescriptor[]) myProps.toArray(new PropertyDescriptor[myProps.size()]);
98.160 + }
98.161 +
98.162 + return properties;
98.163 + }
98.164 +
98.165 + /**
98.166 + * Gets the bean's <code>EventSetDescriptor</code>s.
98.167 + *
98.168 + * @return An array of EventSetDescriptors describing the kinds of events fired by
98.169 + * this bean. May return null if the information should be obtained by
98.170 + * automatic analysis.
98.171 + */
98.172 + public EventSetDescriptor[] getEventSetDescriptors() {
98.173 + if (eventSets == null) {
98.174 + eventSets = new EventSetDescriptor[0];
98.175 + }
98.176 +
98.177 + return eventSets;
98.178 + }
98.179 +
98.180 + /**
98.181 + * Gets the bean's <code>MethodDescriptor</code>s.
98.182 + *
98.183 + * @return An array of MethodDescriptors describing the methods implemented by this
98.184 + * bean. May return null if the information should be obtained by automatic
98.185 + * analysis.
98.186 + */
98.187 + public MethodDescriptor[] getMethodDescriptors() {
98.188 + if (methods == null) {
98.189 + methods = new MethodDescriptor[0];
98.190 + }
98.191 +
98.192 + return methods;
98.193 + }
98.194 +}
98.195 \ No newline at end of file
99.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
99.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileDatabaseBeanInfo.java Sat Dec 08 10:24:35 2007 +0000
99.3 @@ -0,0 +1,155 @@
99.4 +/*
99.5 + *
99.6 + * Copyright (c) 2005, SeeBeyond Technology Corporation,
99.7 + * All Rights Reserved
99.8 + *
99.9 + * This program, and all the routines referenced herein,
99.10 + * are the proprietary properties and trade secrets of
99.11 + * SEEBEYOND TECHNOLOGY CORPORATION.
99.12 + *
99.13 + * Except as provided for by license agreement, this
99.14 + * program shall not be duplicated, used, or disclosed
99.15 + * without written consent signed by an officer of
99.16 + * SEEBEYOND TECHNOLOGY CORPORATION.
99.17 + *
99.18 + */
99.19 +package org.netbeans.modules.mashup.db.ui.model;
99.20 +
99.21 +import java.beans.BeanDescriptor;
99.22 +import java.beans.EventSetDescriptor;
99.23 +import java.beans.IntrospectionException;
99.24 +import java.beans.MethodDescriptor;
99.25 +import java.beans.PropertyDescriptor;
99.26 +import java.beans.SimpleBeanInfo;
99.27 +import java.util.ArrayList;
99.28 +import java.util.List;
99.29 +
99.30 +import org.openide.util.NbBundle;
99.31 +
99.32 +/**
99.33 + * Exposes getters for flatfile database properties. TODO Extend this class to expose
99.34 + * setters for read-write property sheets (MutabledFlatfileDatabaseBeanInfo?)
99.35 + *
99.36 + * @author Jonathan Giron
99.37 + * @version $Revision$
99.38 + */
99.39 +public class FlatfileDatabaseBeanInfo extends SimpleBeanInfo {
99.40 +
99.41 + private static BeanDescriptor beanDescriptor = null;
99.42 +
99.43 + private static EventSetDescriptor[] eventSet = null;
99.44 +
99.45 + private static MethodDescriptor[] methods = null;
99.46 +
99.47 + private static PropertyDescriptor[] properties = null;
99.48 +
99.49 + private static int defaultPropertyIndex = -1; // GEN-BEGIN:Idx
99.50 + private static int defaultEventIndex = -1; // GEN-END:Idx
99.51 +
99.52 + /**
99.53 + * Gets the bean's <code>BeanDescriptor</code>s.
99.54 + *
99.55 + * @return BeanDescriptor describing the editable properties of this bean. May return
99.56 + * null if the information should be obtained by automatic analysis.
99.57 + */
99.58 + public BeanDescriptor getBeanDescriptor() {
99.59 + if (beanDescriptor == null) {
99.60 + beanDescriptor = new BeanDescriptor(FlatfileDatabase.class);
99.61 + }
99.62 +
99.63 + return beanDescriptor;
99.64 + }
99.65 +
99.66 + /**
99.67 + * Gets the bean's <code>PropertyDescriptor</code>s.
99.68 + *
99.69 + * @return An array of PropertyDescriptors describing the editable properties
99.70 + * supported by this bean. May return null if the information should be
99.71 + * obtained by automatic analysis.
99.72 + * <p>
99.73 + * If a property is indexed, then its entry in the result array will belong to
99.74 + * the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client of
99.75 + * getPropertyDescriptors can use "instanceof" to check if a given
99.76 + * PropertyDescriptor is an IndexedPropertyDescriptor.
99.77 + */
99.78 + public PropertyDescriptor[] getPropertyDescriptors() {
99.79 + if (properties == null) {
99.80 + List myProps = new ArrayList();
99.81 +
99.82 + try {
99.83 + PropertyDescriptor pd = new PropertyDescriptor("name", FlatfileDatabase.class, "getName", null); // NOI18N
99.84 + String label = NbBundle.getMessage(FlatfileDatabaseBeanInfo.class, "LBL_mashup_db_name"); // NOI18N
99.85 + pd.setDisplayName(label);
99.86 + myProps.add(pd);
99.87 + } catch (IntrospectionException e) {
99.88 + }
99.89 +
99.90 + try {
99.91 + PropertyDescriptor pd = new PropertyDescriptor("description", FlatfileDatabase.class, "getDescription", null); // NOI18N
99.92 + String label = NbBundle.getMessage(FlatfileDatabaseBeanInfo.class, "LBL_description"); // NOI18N
99.93 + pd.setDisplayName(label);
99.94 + myProps.add(pd);
99.95 + } catch (IntrospectionException e) {
99.96 + }
99.97 +
99.98 + properties = (PropertyDescriptor[]) myProps.toArray(new PropertyDescriptor[myProps.size()]);
99.99 + }
99.100 +
99.101 + return properties;
99.102 + }
99.103 +
99.104 + /**
99.105 + * Gets the bean's <code>EventSetDescriptor</code>s.
99.106 + *
99.107 + * @return An array of EventSetDescriptors describing the kinds of events fired by
99.108 + * this bean. May return null if the information should be obtained by
99.109 + * automatic analysis.
99.110 + */
99.111 + public EventSetDescriptor[] getEventSetDescriptors() {
99.112 + if (eventSet == null) {
99.113 + eventSet = new EventSetDescriptor[0];
99.114 + }
99.115 + return eventSet;
99.116 + }
99.117 +
99.118 + /**
99.119 + * Gets the bean's <code>MethodDescriptor</code>s.
99.120 + *
99.121 + * @return An array of MethodDescriptors describing the methods implemented by this
99.122 + * bean. May return null if the information should be obtained by automatic
99.123 + * analysis.
99.124 + */
99.125 + public MethodDescriptor[] getMethodDescriptors() {
99.126 + if (methods == null) {
99.127 + methods = new MethodDescriptor[0];
99.128 + }
99.129 +
99.130 + return methods;
99.131 + }
99.132 +
99.133 + /**
99.134 + * A bean may have a "default" property that is the property that will mostly commonly
99.135 + * be initially chosen for update by human's who are customizing the bean.
99.136 + *
99.137 + * @return Index of default property in the PropertyDescriptor array returned by
99.138 + * getPropertyDescriptors.
99.139 + * <P>
99.140 + * Returns -1 if there is no default property.
99.141 + */
99.142 + public int getDefaultPropertyIndex() {
99.143 + return defaultPropertyIndex;
99.144 + }
99.145 +
99.146 + /**
99.147 + * A bean may have a "default" event that is the event that will mostly commonly be
99.148 + * used by human's when using the bean.
99.149 + *
99.150 + * @return Index of default event in the EventSetDescriptor array returned by
99.151 + * getEventSetDescriptors.
99.152 + * <P>
99.153 + * Returns -1 if there is no default event.
99.154 + */
99.155 + public int getDefaultEventIndex() {
99.156 + return defaultEventIndex;
99.157 + }
99.158 +}
100.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileTable.java Sat Dec 08 10:04:51 2007 +0000
100.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileTable.java Sat Dec 08 10:24:35 2007 +0000
100.3 @@ -44,13 +44,13 @@
100.4
100.5 import org.netbeans.modules.mashup.db.common.PropertyKeys;
100.6 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
100.7 -import org.netbeans.modules.model.database.DBColumn;
100.8 -import org.netbeans.modules.model.database.ForeignKey;
100.9 -import org.netbeans.modules.model.database.Index;
100.10 -import org.netbeans.modules.model.database.PrimaryKey;
100.11 +import org.netbeans.modules.sql.framework.model.DBColumn;
100.12 import org.openide.util.NbBundle;
100.13
100.14 import com.sun.sql.framework.utils.StringUtil;
100.15 +import org.netbeans.modules.sql.framework.model.ForeignKey;
100.16 +import org.netbeans.modules.sql.framework.model.Index;
100.17 +import org.netbeans.modules.sql.framework.model.PrimaryKey;
100.18
100.19 /**
100.20 * Abstract bean wrapper for FlatfileDBTable instances to expose common read-only
101.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
101.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileTableBeanInfo.java Sat Dec 08 10:24:35 2007 +0000
101.3 @@ -0,0 +1,187 @@
101.4 +/*
101.5 + *
101.6 + * Copyright (c) 2005, SeeBeyond Technology Corporation,
101.7 + * All Rights Reserved
101.8 + *
101.9 + * This program, and all the routines referenced herein,
101.10 + * are the proprietary properties and trade secrets of
101.11 + * SEEBEYOND TECHNOLOGY CORPORATION.
101.12 + *
101.13 + * Except as provided for by license agreement, this
101.14 + * program shall not be duplicated, used, or disclosed
101.15 + * without written consent signed by an officer of
101.16 + * SEEBEYOND TECHNOLOGY CORPORATION.
101.17 + *
101.18 + */
101.19 +package org.netbeans.modules.mashup.db.ui.model;
101.20 +
101.21 +import java.beans.BeanDescriptor;
101.22 +import java.beans.EventSetDescriptor;
101.23 +import java.beans.IntrospectionException;
101.24 +import java.beans.MethodDescriptor;
101.25 +import java.beans.PropertyDescriptor;
101.26 +import java.beans.SimpleBeanInfo;
101.27 +import java.util.ArrayList;
101.28 +import java.util.List;
101.29 +
101.30 +import org.openide.util.NbBundle;
101.31 +
101.32 +/**
101.33 + * Abstract BeanInfo implementation to expose read-only access to selected table
101.34 + * properties.
101.35 + *
101.36 + * @author Jonathan Giron
101.37 + * @author Ahimanikya Satapathy
101.38 + * @version $Revision$
101.39 + */
101.40 +public abstract class FlatfileTableBeanInfo extends SimpleBeanInfo {
101.41 +
101.42 + private static PropertyDescriptor[] properties = null;
101.43 +
101.44 + private static EventSetDescriptor[] eventSets = null;
101.45 +
101.46 + private static MethodDescriptor[] methods = null;
101.47 +
101.48 + /**
101.49 + * Gets the bean's <code>BeanDescriptor</code>s.
101.50 + *
101.51 + * @return BeanDescriptor describing the editable properties of this bean. May return
101.52 + * null if the information should be obtained by automatic analysis.
101.53 + */
101.54 + public abstract BeanDescriptor getBeanDescriptor();
101.55 +
101.56 + /**
101.57 + * Gets the bean's <code>PropertyDescriptor</code>s.
101.58 + *
101.59 + * @return An array of PropertyDescriptors describing the editable properties
101.60 + * supported by this bean. May return null if the information should be
101.61 + * obtained by automatic analysis.
101.62 + * <p>
101.63 + * If a property is indexed, then its entry in the result array will belong to
101.64 + * the IndexedPropertyDescriptor subclass of PropertyDescriptor. A client of
101.65 + * getPropertyDescriptors can use "instanceof" to check if a given
101.66 + * PropertyDescriptor is an IndexedPropertyDescriptor.
101.67 + */
101.68 + public PropertyDescriptor[] getPropertyDescriptors() {
101.69 + if (properties == null) {
101.70 + List myProps = new ArrayList();
101.71 +
101.72 + try {
101.73 + PropertyDescriptor pd = new PropertyDescriptor("tableName", FlatfileTable.class, "getTableName", null); // NOI18N
101.74 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_table_name"); // NOI18N
101.75 + pd.setDisplayName(label);
101.76 + myProps.add(pd);
101.77 + } catch (IntrospectionException e) {
101.78 + }
101.79 +
101.80 + try {
101.81 + PropertyDescriptor pd = new PropertyDescriptor("fileType", FlatfileTable.class, "getFileType", null); // NOI18N
101.82 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_file_type"); // NOI18N
101.83 + pd.setDisplayName(label);
101.84 + myProps.add(pd);
101.85 + } catch (IntrospectionException e) {
101.86 + }
101.87 +
101.88 + try {
101.89 + PropertyDescriptor pd = new PropertyDescriptor("description", FlatfileTable.class, "getDescription", null); // NOI18N
101.90 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_description"); // NOI18N
101.91 + pd.setDisplayName(label);
101.92 + myProps.add(pd);
101.93 + } catch (IntrospectionException ignore) {
101.94 + }
101.95 +
101.96 + try {
101.97 + PropertyDescriptor pd = new PropertyDescriptor("fileName", FlatfileTable.class, "getFileName", null); // NOI18N
101.98 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_file_name"); // NOI18N
101.99 + pd.setDisplayName(label);
101.100 + myProps.add(pd);
101.101 + } catch (IntrospectionException e) {
101.102 + }
101.103 +
101.104 + try {
101.105 + PropertyDescriptor pd = new PropertyDescriptor("encodingScheme", FlatfileTable.class, "getEncodingScheme", null); // NOI18N
101.106 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_encoding_scheme"); // NOI18N
101.107 + pd.setDisplayName(label);
101.108 + myProps.add(pd);
101.109 + } catch (IntrospectionException ignore) {
101.110 + }
101.111 +
101.112 + try {
101.113 + PropertyDescriptor pd = new PropertyDescriptor("rowsToSkip", FlatfileTable.class, "getRowsToSkip", null); // NOI18N
101.114 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_rows_to_skip"); // NOI18N
101.115 + pd.setDisplayName(label);
101.116 + myProps.add(pd);
101.117 + } catch (IntrospectionException ignore) {
101.118 + }
101.119 +
101.120 + try {
101.121 + PropertyDescriptor pd = new PropertyDescriptor("maxFaults", FlatfileTable.class, "getMaxFaults", null); // NOI18N
101.122 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_max_faults"); // NOI18N
101.123 + pd.setDisplayName(label);
101.124 + myProps.add(pd);
101.125 + } catch (IntrospectionException ignore) {
101.126 + }
101.127 +
101.128 + try {
101.129 + PropertyDescriptor pd = new PropertyDescriptor("isFirstLineHeader", FlatfileTable.class, "isFirstLineHeader", null); // NOI18N
101.130 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_isfirstlineheader"); // NOI18N
101.131 + pd.setDisplayName(label);
101.132 + myProps.add(pd);
101.133 + } catch (IntrospectionException ignore) {
101.134 + }
101.135 +
101.136 + try {
101.137 + PropertyDescriptor pd = new PropertyDescriptor("recordDelimiter", FlatfileTable.class, "getRecordDelimiter", null); // NOI18N
101.138 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_record_delimiter"); // NOI18N
101.139 + pd.setDisplayName(label);
101.140 + myProps.add(pd);
101.141 + } catch (IntrospectionException ignore) {
101.142 + }
101.143 +
101.144 + try {
101.145 + PropertyDescriptor pd = new PropertyDescriptor("trimWhiteSpace",
101.146 + FlatfileTable.class, "enableWhiteSpaceTrimming", null); // NOI18N
101.147 + String label = NbBundle.getMessage(FlatfileTableBeanInfo.class, "LBL_white_space"); // NOI18N
101.148 + pd.setDisplayName(label);
101.149 + myProps.add(pd);
101.150 + } catch (IntrospectionException ignore) {
101.151 + }
101.152 +
101.153 +
101.154 +
101.155 + properties = (PropertyDescriptor[]) myProps.toArray(new PropertyDescriptor[myProps.size()]);
101.156 + }
101.157 +
101.158 + return properties;
101.159 + }
101.160 +
101.161 + /**
101.162 + * Gets the bean's <code>EventSetDescriptor</code>s.
101.163 + *
101.164 + * @return An array of EventSetDescriptors describing the kinds of events fired by
101.165 + * this bean. May return null if the information should be obtained by
101.166 + * automatic analysis.
101.167 + */
101.168 + public EventSetDescriptor[] getEventSetDescriptors() {
101.169 + if (eventSets == null) {
101.170 + eventSets = new EventSetDescriptor[0];
101.171 + }
101.172 +
101.173 + return eventSets;
101.174 + }
101.175 +
101.176 + /**
101.177 + * Gets the bean's <code>MethodDescriptor</code>s.
101.178 + *
101.179 + * @return An array of MethodDescriptors describing the methods implemented by this
101.180 + * bean. May return null if the information should be obtained by automatic
101.181 + * analysis.
101.182 + */
101.183 + public MethodDescriptor[] getMethodDescriptors() {
101.184 + if (methods == null) {
101.185 + methods = new MethodDescriptor[0];
101.186 + }
101.187 +
101.188 + return methods;
101.189 + }
101.190 +}
102.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileTreeTableModel.java Sat Dec 08 10:04:51 2007 +0000
102.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/model/FlatfileTreeTableModel.java Sat Dec 08 10:24:35 2007 +0000
102.3 @@ -150,6 +150,8 @@
102.4 ffTable = new DelimitedFlatfile(table);
102.5 } else if (PropertyKeys.FIXEDWIDTH.equalsIgnoreCase(fileType)) {
102.6 ffTable = new FixedWidthFlatfile(table);
102.7 + } else {
102.8 + ffTable = new FlatfileTable(table) {};
102.9 }
102.10
102.11 if (ffTable != null) {
103.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/resource/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
103.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/resource/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
103.3 @@ -30,14 +30,7 @@
103.4 CTL_EditorWindow=Flat File Database Definition Viewer
103.5 CTL_EditorWindowDescription=Views the metadata associated with a flat file definition
103.6
103.7 -#
103.8 -# OTD Pluggability module resources
103.9 -#
103.10 -OTDWizards/OTDWizards.flatfile=Flat File Database Definition
103.11 -TOOLTIP_Otd_Node={0}: Flat File Database Definition
103.12 -
103.13 LBL_WizardToolTip=Flat File Database Wizard
103.14 -LBL_WizardDescription=Uses flat files to create an OTD
103.15
103.16 # Sample ResourceBundle properties file
103.17 DELIMITED_DEFAULT_DISPLAYNAME=Delimited
104.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/Bundle.properties Sat Dec 08 10:04:51 2007 +0000
104.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/Bundle.properties Sat Dec 08 10:24:35 2007 +0000
104.3 @@ -26,14 +26,8 @@
104.4 # Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
104.5 # Microsystems, Inc. All Rights Reserved.
104.6 #
104.7 -#
104.8 -# OTD Pluggability module resources
104.9 -#
104.10 -OTDWizards/OTDWizards.flatfile=Flat File Database Definition
104.11 -TOOLTIP_Otd_Node={0}: Flat File Database Definition
104.12
104.13 LBL_WizardToolTip=Flat File Database Wizard
104.14 -LBL_WizardDescription=Uses flat files to create an OTD
104.15
104.16 #
104.17 # Sample file selection panel resource strings
104.18 @@ -79,15 +73,15 @@
104.19 #
104.20 # Preview database panel resource strings
104.21 #
104.22 -TITLE_configureotd=Preview Flat File Database Definition
104.23 -STEP_configureotd=Preview Flat File Database Definition
104.24 +TITLE_configure_ffdb=Preview Flat File Database Definition
104.25 +STEP_configure_ffdb=Preview Flat File Database Definition
104.26
104.27 LBL_import_preview_table=Preview Table Content
104.28
104.29 ERROR_importpanel_format_duplicatename=A project element already exists in this folder with the name "{0}". Please specify a unique name.
104.30 ERROR_importpanel_format_invalidname="{0}" is an invalid table name. Please enter a table name\nthat starts with a letter and contains only letters, numbers and underscores.
104.31 ERROR_importpanel_format_reservedname="{0}" is an invalid table name. Please supply a name that is not a SQL reserved word and contains only letters, numbers, and underscores.
104.32 -ERROR_configureotd_invalidname="{0}" is an invalid Flat File Database name.\n\nPlease enter a name without special characters.
104.33 +ERROR_configure_ffdb_invalidname="{0}" is an invalid Flat File Database name.\n\nPlease enter a name without special characters.
104.34
104.35 TITLE_specifyname=Specify Flat File Database Definition Name
104.36 STEP_specifyname=Specify Flat File Database Definition Name
105.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/FlatfileColumnTableModel.java Sat Dec 08 10:04:51 2007 +0000
105.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/FlatfileColumnTableModel.java Sat Dec 08 10:24:35 2007 +0000
105.3 @@ -207,7 +207,7 @@
105.4 public Object getValue(int index) {
105.5 switch (index) {
105.6 case COLUMN_ID:
105.7 - return new Integer(column.getOrdinalPosition());
105.8 + return new Integer(column.getCardinalPosition());
105.9
105.10 case COLUMN_PRECLENGTH:
105.11 return new Integer(column.getPrecision());
106.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/ParseContentPanel.java Sat Dec 08 10:04:51 2007 +0000
106.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/ParseContentPanel.java Sat Dec 08 10:24:35 2007 +0000
106.3 @@ -122,9 +122,6 @@
106.4 /* Descriptor for parse properties; generates JComponent */
106.5 private IPropertySheet propertySheet;
106.6
106.7 - /* PropertyViewManager instance for rendering of parse properties. */
106.8 - private static PropertyViewManager pvMgr;
106.9 -
106.10 private int currentIndex = -1;
106.11
106.12 private Component component;
106.13 @@ -135,9 +132,6 @@
106.14 public ParseContentPanel() {
106.15 }
106.16
106.17 - /**
106.18 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.ui.wizard.NestedWizardPanel.Content#canAdvance
106.19 - */
106.20 private boolean canAdvance() {
106.21 if (parseErrors != null) {
106.22 DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(parseErrors.trim(), NotifyDescriptor.WARNING_MESSAGE));
106.23 @@ -234,6 +228,7 @@
106.24 }
106.25
106.26 currentPropertyMap = Property.createKeyValueMapFrom(currentTable.getProperties());
106.27 +
106.28 propertySheet = pvMgr.getPropertySheet(currentPropertyMap, currentTable.getParserType());
106.29
106.30 propertySheet.getPropertyGroup("Default").addPropertyChangeListener(this);
106.31 @@ -271,14 +266,9 @@
106.32 * @see PropertyViewManager
106.33 */
106.34 private static PropertyViewManager getPropertyViewManager() {
106.35 - if (pvMgr == null) {
106.36 - InputStream stream = ParseContentPanel.class.getClassLoader().getResourceAsStream(
106.37 - "org/netbeans/modules/mashup/db/ui/resource/parse_properties.xml");
106.38 -
106.39 - pvMgr = new PropertyViewManager(stream, new FlatfileDBResourceManager());
106.40 - }
106.41 -
106.42 - return pvMgr;
106.43 + InputStream stream = ParseContentPanel.class.getClassLoader().getResourceAsStream(
106.44 + "org/netbeans/modules/mashup/db/ui/resource/parse_properties.xml");
106.45 + return new PropertyViewManager(stream, new FlatfileDBResourceManager());
106.46 }
106.47
106.48 /**
107.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/PreviewDataPanel.java Sat Dec 08 10:04:51 2007 +0000
107.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/PreviewDataPanel.java Sat Dec 08 10:24:35 2007 +0000
107.3 @@ -72,7 +72,8 @@
107.4 import org.openide.NotifyDescriptor;
107.5 import org.openide.util.NbBundle;
107.6
107.7 -import com.sun.sql.framework.utils.Logger;
107.8 +//import com.sun.sql.framework.utils.Logger;
107.9 +import java.util.logging.Logger;
107.10 import com.sun.sql.framework.utils.StringUtil;
107.11
107.12 /**
107.13 @@ -174,7 +175,8 @@
107.14 }
107.15
107.16 String url = FlatfileDBConnectionFactory.DEFAULT_FLATFILE_JDBC_URL_PREFIX + "preview:" + metadataDir;
107.17 - Logger.print(Logger.DEBUG, LOG_CATEGORY, "Preview URL: " + url);
107.18 + Logger.getLogger(LOG_CATEGORY).info("Preview URL: " + url);
107.19 + //Logger.print(Logger.DEBUG, LOG_CATEGORY, "Preview URL: " + url);
107.20
107.21 conn = FlatfileDBConnectionFactory.getInstance().getConnection(url);
107.22 Statement stmt = conn.createStatement();
107.23 @@ -182,7 +184,8 @@
107.24 stmt.execute("DROP TABLE IF EXISTS " + table.getTableName());
107.25 String create = table.getCreateStatementSQL();
107.26
107.27 - Logger.print(Logger.DEBUG, LOG_CATEGORY, this, "Generated create statement: " + create);
107.28 + Logger.getLogger(LOG_CATEGORY).info("Generated create statement: " + create);
107.29 + //Logger.print(Logger.DEBUG, LOG_CATEGORY, this, "Generated create statement: " + create);
107.30 stmt.execute(create);
107.31
107.32 ResultSet rs = stmt.executeQuery(table.getSelectStatementSQL(ct));
107.33 @@ -191,7 +194,8 @@
107.34
107.35 // get the count of all rows
107.36 String countSql = "Select count(*) From " + table.getName();
107.37 - Logger.print(Logger.DEBUG, FlatfileResulSetPanel.class.getName(), "Select count(*) statement used for total rows: \n" + countSql);
107.38 + Logger.getLogger(FlatfileResulSetPanel.class.getName()).info( "Select count(*) statement used for total rows: \n" + countSql);
107.39 + //Logger.print(Logger.DEBUG, FlatfileResulSetPanel.class.getName(), "Select count(*) statement used for total rows: \n" + countSql);
107.40
107.41 stmt = conn.createStatement();
107.42 ResultSet cntRs = stmt.executeQuery(countSql);
107.43 @@ -212,7 +216,8 @@
107.44 try {
107.45 errorMsg = NbBundle.getMessage(TableDefinitionPanel.class, "ERROR_bad_preview");
107.46 } catch (MissingResourceException mre) {
107.47 - Logger.printThrowable(Logger.ERROR, LOG_CATEGORY, this, "Could not locate resource string for ERROR_bad_preview.", mre);
107.48 + Logger.getLogger(LOG_CATEGORY).info("Could not locate resource string for ERROR_bad_preview."+ mre);
107.49 + //Logger.printThrowable(Logger.ERROR, LOG_CATEGORY, this, "Could not locate resource string for ERROR_bad_preview.", mre);
107.50 }
107.51 showError("Sample file may be corrupt, or does not match specified datatypes", errorMsg, nse);
107.52 isValid = false;
107.53 @@ -223,7 +228,8 @@
107.54 sqlExMsg = stripExceptionHeaderFromMessage(se);
107.55 errorMsg = NbBundle.getMessage(TableDefinitionPanel.class, "ERROR_bad_preview_sqlex", sqlExMsg);
107.56 } catch (MissingResourceException mre) {
107.57 - Logger.printThrowable(Logger.ERROR, LOG_CATEGORY, this, "Could not locate resource string for ERROR_bad_preview.", mre);
107.58 + Logger.getLogger(LOG_CATEGORY).info("Could not locate resource string for ERROR_bad_preview."+ mre);
107.59 + //Logger.printThrowable(Logger.ERROR, LOG_CATEGORY, this, "Could not locate resource string for ERROR_bad_preview.", mre);
107.60 }
107.61 showError(sqlExMsg, errorMsg, se);
107.62 isValid = false;
107.63 @@ -269,13 +275,15 @@
107.64 DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(errorMsg, NotifyDescriptor.WARNING_MESSAGE));
107.65 }
107.66 setEnabled(false);
107.67 - Logger.printThrowable(Logger.ERROR, LOG_CATEGORY, this, errorMsg, t);
107.68 + Logger.getLogger(LOG_CATEGORY).info(errorMsg);
107.69 + //Logger.printThrowable(Logger.ERROR, LOG_CATEGORY, this, errorMsg, t);
107.70 }
107.71
107.72 /**
107.73 * Overrides parent implementation to allow for addition of this instance as a
107.74 * listener for various child components.
107.75 */
107.76 + @Override
107.77 public void addNotify() {
107.78 super.addNotify();
107.79 if (previewBtn != null) {
107.80 @@ -294,6 +302,7 @@
107.81 * Overrides parent implementation to allow for removal of this instance as a listener
107.82 * for various child components.
107.83 */
107.84 + @Override
107.85 public void removeNotify() {
107.86 if (previewBtn != null) {
107.87 previewBtn.removeActionListener(this);
107.88 @@ -301,6 +310,7 @@
107.89 super.removeNotify();
107.90 }
107.91
107.92 + @Override
107.93 public void setEnabled(boolean enabled) {
107.94 if (previewBtn != null) {
107.95 previewBtn.setEnabled(enabled);
108.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/PreviewDatabasePanel.java Sat Dec 08 10:04:51 2007 +0000
108.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/PreviewDatabasePanel.java Sat Dec 08 10:24:35 2007 +0000
108.3 @@ -44,13 +44,11 @@
108.4 import java.awt.event.ActionEvent;
108.5 import java.awt.event.ActionListener;
108.6 import java.sql.Connection;
108.7 -import java.sql.SQLException;
108.8 import java.sql.Statement;
108.9 import java.util.Iterator;
108.10 import java.util.List;
108.11
108.12 import org.netbeans.modules.mashup.db.common.FlatfileDBConnectionFactory;
108.13 -import org.netbeans.modules.mashup.db.model.FlatfileDBConnectionDefinition;
108.14 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
108.15 import org.netbeans.modules.mashup.db.model.FlatfileDatabaseModel;
108.16 import org.netbeans.modules.mashup.tables.wizard.MashupTableWizardIterator;
108.17 @@ -60,6 +58,7 @@
108.18 import org.openide.util.NbBundle;
108.19
108.20 import com.sun.sql.framework.exception.BaseException;
108.21 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
108.22
108.23 /**
108.24 * Wizard panel to select tables and columns to be included in an Flatfile DB instance.
108.25 @@ -101,23 +100,14 @@
108.26 return null;
108.27 }
108.28
108.29 - /**
108.30 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.ui.wizard.AbstractWizardPanel#getStepLabel
108.31 - */
108.32 public String getStepLabel() {
108.33 - return NbBundle.getMessage(PreviewDatabasePanel.class, "STEP_configureotd");
108.34 + return NbBundle.getMessage(PreviewDatabasePanel.class, "STEP_configure_ffdb");
108.35 }
108.36
108.37 - /**
108.38 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.ui.wizard.AbstractWizardPanel#getTitle
108.39 - */
108.40 public String getTitle() {
108.41 return (component != null) ? component.getName() : "*** Preview Flat File Database ***";
108.42 }
108.43
108.44 - /**
108.45 - * @see com.sun.jbi.ui.devtool.flatfile.db.otd.ui.wizard.AbstractWizardPanel#getTitle
108.46 - */
108.47 public boolean isValid() {
108.48 return component.hasValidData();
108.49 }
108.50 @@ -152,7 +142,7 @@
108.51 Statement stmt = null;
108.52 try {
108.53 FlatfileDatabaseModel model = component.getModel();
108.54 - FlatfileDBConnectionDefinition def = model.getFlatfileDBConnectionDefinition(true);
108.55 + DBConnectionDefinition def = model.getFlatfileDBConnectionDefinition(true);
108.56 conn = FlatfileDBConnectionFactory.getInstance().getConnection(def.getConnectionURL());
108.57 List tables = model.getTables();
108.58 Iterator it = tables.iterator();
109.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/PreviewDatabaseVisualPanel.java Sat Dec 08 10:04:51 2007 +0000
109.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/PreviewDatabaseVisualPanel.java Sat Dec 08 10:24:35 2007 +0000
109.3 @@ -41,7 +41,6 @@
109.4 package org.netbeans.modules.mashup.db.ui.wizard;
109.5
109.6 import java.awt.BorderLayout;
109.7 -import java.awt.Color;
109.8 import java.util.MissingResourceException;
109.9
109.10 import javax.swing.JPanel;
109.11 @@ -49,7 +48,6 @@
109.12 import org.netbeans.modules.mashup.db.model.FlatfileDatabaseModel;
109.13 import org.netbeans.modules.mashup.db.ui.FlatfileTreeTableView;
109.14 import org.netbeans.modules.mashup.db.ui.model.FlatfileTreeTableModel;
109.15 -import org.netbeans.modules.mashup.db.wizard.FlatfileViewerTreePanel;
109.16 import org.openide.util.NbBundle;
109.17
109.18
109.19 @@ -85,7 +83,7 @@
109.20 setLayout(new BorderLayout());
109.21
109.22 try {
109.23 - setName(NbBundle.getMessage(PreviewDatabaseVisualPanel.class, "TITLE_configureotd"));
109.24 + setName(NbBundle.getMessage(PreviewDatabaseVisualPanel.class, "TITLE_configure_ffdb"));
109.25 } catch (MissingResourceException e) {
109.26 setName("*** Preview Flatfile Database ***");
109.27 }
109.28 @@ -103,7 +101,7 @@
109.29 setLayout(new BorderLayout());
109.30
109.31 try {
109.32 - setName(NbBundle.getMessage(PreviewDatabaseVisualPanel.class, "TITLE_configureotd"));
109.33 + setName(NbBundle.getMessage(PreviewDatabaseVisualPanel.class, "TITLE_configure_ffdb"));
109.34 } catch (MissingResourceException e) {
109.35 setName("*** Preview Flatfile Database ***");
109.36 }
110.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/SelectDatabasePanel.java Sat Dec 08 10:04:51 2007 +0000
110.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/SelectDatabasePanel.java Sat Dec 08 10:24:35 2007 +0000
110.3 @@ -1,12 +1,10 @@
110.4 package org.netbeans.modules.mashup.db.ui.wizard;
110.5
110.6 -import com.sun.sql.framework.exception.BaseException;
110.7 import java.awt.Component;
110.8 import java.sql.Connection;
110.9 import java.sql.SQLException;
110.10 import java.util.HashMap;
110.11
110.12 -import org.netbeans.modules.mashup.db.common.FlatfileDBConnectionFactory;
110.13 import org.netbeans.modules.mashup.db.model.FlatfileDBConnectionDefinition;
110.14 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
110.15 import org.netbeans.modules.mashup.db.model.FlatfileDatabaseModel;
111.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/TableDefinitionPanel.java Sat Dec 08 10:04:51 2007 +0000
111.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/ui/wizard/TableDefinitionPanel.java Sat Dec 08 10:24:35 2007 +0000
111.3 @@ -40,7 +40,6 @@
111.4 */
111.5 package org.netbeans.modules.mashup.db.ui.wizard;
111.6
111.7 -import com.sun.sql.framework.exception.BaseException;
111.8 import java.awt.BorderLayout;
111.9 import java.awt.Color;
111.10 import java.awt.Component;
111.11 @@ -48,7 +47,6 @@
111.12 import java.awt.GridLayout;
111.13 import java.awt.event.ItemEvent;
111.14 import java.awt.event.ItemListener;
111.15 -import java.sql.SQLException;
111.16 import java.sql.Types;
111.17 import java.util.ArrayList;
111.18 import java.util.Collection;
111.19 @@ -82,7 +80,6 @@
111.20 import javax.swing.table.TableColumnModel;
111.21 import javax.swing.table.TableModel;
111.22
111.23 -import org.netbeans.modules.mashup.db.common.FlatfileDBConnectionFactory;
111.24 import org.netbeans.modules.mashup.db.common.PropertyKeys;
111.25 import org.netbeans.modules.mashup.db.common.SQLUtils;
111.26 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
111.27 @@ -94,8 +91,6 @@
111.28 import org.openide.util.HelpCtx;
111.29 import org.openide.util.NbBundle;
111.30
111.31 -import java.sql.Connection;
111.32 -import java.sql.Statement;
111.33 import java.util.HashSet;
111.34 import java.util.Set;
111.35 import javax.swing.event.ChangeEvent;
112.1 --- a/etl.editor/src/org/netbeans/modules/mashup/db/wizard/FlatfileViewerTreePanel.java Sat Dec 08 10:04:51 2007 +0000
112.2 +++ b/etl.editor/src/org/netbeans/modules/mashup/db/wizard/FlatfileViewerTreePanel.java Sat Dec 08 10:24:35 2007 +0000
112.3 @@ -47,18 +47,14 @@
112.4 import javax.swing.event.ChangeEvent;
112.5 import javax.swing.event.ChangeListener;
112.6
112.7 -import org.netbeans.modules.jdbc.builder.DBMetaData;
112.8 -import org.netbeans.modules.jdbc.builder.Table;
112.9 -import org.netbeans.modules.jdbc.builder.TableColumn;
112.10 +import org.netbeans.modules.sql.framework.model.DBMetaDataFactory;
112.11 import org.netbeans.modules.mashup.db.common.Property;
112.12 -import org.netbeans.modules.mashup.db.model.FlatfileDBColumn;
112.13 -import org.netbeans.modules.mashup.db.model.FlatfileDBConnectionDefinition;
112.14 import org.netbeans.modules.mashup.db.model.FlatfileDBTable;
112.15 import org.netbeans.modules.mashup.db.model.FlatfileDatabaseModel;
112.16 -import org.netbeans.modules.mashup.db.model.impl.FlatfileDBColumnImpl;
112.17 import org.netbeans.modules.mashup.db.model.impl.FlatfileDBTableImpl;
112.18 import org.netbeans.modules.mashup.db.ui.wizard.PreviewDatabaseVisualPanel;
112.19 import org.netbeans.modules.mashup.tables.wizard.MashupTableWizardIterator;
112.20 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
112.21 import org.openide.WizardDescriptor;
112.22 import org.openide.util.HelpCtx;
112.23
112.24 @@ -160,10 +156,9 @@
112.25 }
112.26
112.27 private FlatfileDatabaseModel addDBTables(FlatfileDatabaseModel model) {
112.28 - DBMetaData dbMeta = new DBMetaData();
112.29 + DBMetaDataFactory dbMeta = new DBMetaDataFactory();
112.30 Connection conn = null;
112.31 String catalog = null;
112.32 - String schema = null;
112.33 String[][] tableList = null;
112.34 String[] types = {"TABLE"};
112.35 try {
112.36 @@ -180,16 +175,16 @@
112.37 return model;
112.38 }
112.39
112.40 - private FlatfileDatabaseModel createTable(String[][] tableList, FlatfileDatabaseModel model, DBMetaData meta) {
112.41 + private FlatfileDatabaseModel createTable(String[][] tableList, FlatfileDatabaseModel model, DBMetaDataFactory meta) throws Exception {
112.42 String[] currTable = null;
112.43 FlatfileDBTable dbTable = null;
112.44 - FlatfileDBConnectionDefinition def = model.getFlatfileDBConnectionDefinition(true);
112.45 + DBConnectionDefinition def = model.getFlatfileDBConnectionDefinition(true);
112.46 if (tableList != null) {
112.47 for(int i = 0; i < tableList.length; i ++) {
112.48 currTable = tableList[i];
112.49 - dbTable = new FlatfileDBTableImpl(currTable[DBMetaData.NAME],
112.50 - currTable[DBMetaData.SCHEMA], currTable[DBMetaData.CATALOG]);
112.51 - dbTable = addTableColumns(meta, dbTable);
112.52 + dbTable = new FlatfileDBTableImpl(currTable[DBMetaDataFactory.NAME],
112.53 + currTable[DBMetaDataFactory.SCHEMA], currTable[DBMetaDataFactory.CATALOG]);
112.54 + meta.populateColumns(dbTable);
112.55 HashMap map = getTableMetaData(def, dbTable);
112.56 dbTable.setProperties(map);
112.57 model.addTable(dbTable);
112.58 @@ -198,39 +193,18 @@
112.59 return model;
112.60 }
112.61
112.62 - private FlatfileDBTable addTableColumns(DBMetaData dbMeta, FlatfileDBTable dbTable) {
112.63 - Table tbl = null;
112.64 - try {
112.65 - tbl = dbMeta.getTableMetaData(dbTable.getCatalog(),
112.66 - dbTable.getSchema(), dbTable.getName(), "TABLE");
112.67 - } catch (Exception ex) {
112.68 - //ignore
112.69 - }
112.70 - TableColumn[] cols = tbl.getColumns();
112.71 - TableColumn tc = null;
112.72 - FlatfileDBColumn ffColumn = null;
112.73 - for (int j = 0; j < cols.length; j++) {
112.74 - tc = cols[j];
112.75 - ffColumn = new FlatfileDBColumnImpl(tc.getName(), tc
112.76 - .getSqlTypeCode(), tc.getNumericScale(), tc
112.77 - .getNumericPrecision(), tc
112.78 - .getIsPrimaryKey(), tc.getIsForeignKey(),
112.79 - false /* isIndexed */, tc.getIsNullable());
112.80 - dbTable.addColumn(ffColumn);
112.81 - }
112.82 - return dbTable;
112.83 - }
112.84 -
112.85 - private HashMap getTableMetaData(FlatfileDBConnectionDefinition condef, FlatfileDBTable element) {
112.86 - HashMap map = new HashMap();
112.87 + private HashMap getTableMetaData(DBConnectionDefinition condef, FlatfileDBTable element) {
112.88 + HashMap<String, Property> map = new HashMap<String, Property>();
112.89 Connection conn = null;
112.90 + Statement stmt = null;
112.91 + ResultSet rs = null;
112.92 try {
112.93 conn = DriverManager.getConnection(condef.getConnectionURL());
112.94 - Statement stmt = conn.createStatement();
112.95 + stmt = conn.createStatement();
112.96 String query = "select PROPERTY_NAME, PROPERTY_VALUE from AXION_TABLE_PROPERTIES "
112.97 + "where TABLE_NAME = '" + element.getName() + "' ORDER BY PROPERTY_NAME";
112.98 stmt.execute(query);
112.99 - ResultSet rs = stmt.getResultSet();
112.100 + rs = stmt.getResultSet();
112.101 while (rs.next()) {
112.102 rs.getMetaData().getColumnCount();
112.103 String value1 = rs.getString(1);
112.104 @@ -256,10 +230,21 @@
112.105 }
112.106 }
112.107 } catch (Exception e) {
112.108 - //ignore
112.109 + e.printStackTrace();
112.110 } finally {
112.111 try {
112.112 - conn.createStatement().execute("shutdown");
112.113 + rs.close();
112.114 + } catch (Exception ex) {
112.115 + //ignore
112.116 + }
112.117 +
112.118 + try {
112.119 + stmt.close();
112.120 + } catch (Exception ex) {
112.121 + //ignore
112.122 + }
112.123 +
112.124 + try {
112.125 conn.close();
112.126 } catch (Exception ex) {
112.127 //ignore
113.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/common/jdbc/SQLDBConnectionDefinition.java Sat Dec 08 10:04:51 2007 +0000
113.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/common/jdbc/SQLDBConnectionDefinition.java Sat Dec 08 10:24:35 2007 +0000
113.3 @@ -41,26 +41,15 @@
113.4
113.5 package org.netbeans.modules.sql.framework.common.jdbc;
113.6
113.7 -import java.util.Properties;
113.8 -
113.9 -import org.netbeans.modules.model.database.DBConnectionDefinition;
113.10 -
113.11 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
113.12
113.13 /**
113.14 * Extension of DBConnectionDefinition
113.15 - *
113.16 - * @author $Author$
113.17 - * @version $Revision$
113.18 */
113.19 -
113.20 public interface SQLDBConnectionDefinition extends DBConnectionDefinition, Cloneable , Comparable{
113.21
113.22 - public Properties getConnectionProperties();
113.23 -
113.24 public String getJNDIPath();
113.25
113.26 - public String getOTDPathName();
113.27 -
113.28 public void setConnectionURL(String url);
113.29
113.30 public void setDBType(String dbType);
113.31 @@ -71,8 +60,6 @@
113.32
113.33 public void setName(String name);
113.34
113.35 - public void setOTDPathName(String path);
113.36 -
113.37 public void setPassword(String password);
113.38
113.39 public void setUserName(String userName);
114.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/common/jdbc/SQLUtils.java Sat Dec 08 10:04:51 2007 +0000
114.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/common/jdbc/SQLUtils.java Sat Dec 08 10:24:35 2007 +0000
114.3 @@ -85,24 +85,24 @@
114.4 /** Undefined jdbc type */
114.5 public static final int JDBCSQL_TYPE_UNDEFINED = -65535;
114.6
114.7 - private static HashMap dataTypePrecedenceMap = new HashMap();
114.8 + private static HashMap<Integer, Integer> dataTypePrecedenceMap = new HashMap<Integer, Integer>();
114.9
114.10 - private static Map dbIdNameMap = new TreeMap();
114.11 - private static Map dbNameIdMap = new TreeMap();
114.12 + private static Map<Integer,String> dbIdNameMap = new TreeMap<Integer,String>();
114.13 + private static Map<String, Integer> dbNameIdMap = new TreeMap<String, Integer>();
114.14
114.15 - private static Map JDBC_SQL_MAP = new HashMap();
114.16 + private static Map<String, String> JDBC_SQL_MAP = new HashMap<String, String>();
114.17
114.18 - private static Map SQL_JDBC_MAP = new HashMap();
114.19 + private static Map<String, String> SQL_JDBC_MAP = new HashMap<String, String>();
114.20
114.21 - private static final List SUPPORTED_DATE_FORMATS = new ArrayList();
114.22 + private static final List<String> SUPPORTED_DATE_FORMATS = new ArrayList<String>();
114.23
114.24 - private static final List SUPPORTED_DATE_PARTS = new ArrayList();
114.25 + private static final List<String> SUPPORTED_DATE_PARTS = new ArrayList<String>();
114.26
114.27 - private static final List SUPPORTED_INTERVAL_TYPES = new ArrayList();
114.28 + private static final List<String> SUPPORTED_INTERVAL_TYPES = new ArrayList<String>();
114.29
114.30 - private static final List SUPPORTED_LITERAL_JDBC_TYPES = new ArrayList();
114.31 + private static final List<String> SUPPORTED_LITERAL_JDBC_TYPES = new ArrayList<String>();
114.32
114.33 - private static final List SUPPORTED_CAST_JDBC_TYPES = new ArrayList();
114.34 + private static final List<String> SUPPORTED_CAST_JDBC_TYPES = new ArrayList<String>();
114.35
114.36 static {
114.37 dbNameIdMap.put(DBConstants.ANSI92_STR, new Integer(DBConstants.ANSI92));
114.38 @@ -114,6 +114,9 @@
114.39 dbNameIdMap.put(DBConstants.DB2V8_STR, new Integer(DBConstants.DB2V8));
114.40 dbNameIdMap.put(DBConstants.DB2V5_STR, new Integer(DBConstants.DB2V5));
114.41 dbNameIdMap.put(DBConstants.SYBASE_STR, new Integer(DBConstants.SYBASE));
114.42 + dbNameIdMap.put(DBConstants.MYSQL_STR, new Integer(DBConstants.MYSQL));
114.43 + dbNameIdMap.put(DBConstants.DERBY_STR, new Integer(DBConstants.DERBY));
114.44 + dbNameIdMap.put(DBConstants.POSTGRES_STR, new Integer(DBConstants.POSTGRESQL));
114.45 }
114.46
114.47 static {
114.48 @@ -126,6 +129,10 @@
114.49 dbIdNameMap.put(new Integer(DBConstants.DB2V8), DBConstants.DB2V8_STR);
114.50 dbIdNameMap.put(new Integer(DBConstants.DB2V5), DBConstants.DB2V5_STR);
114.51 dbIdNameMap.put(new Integer(DBConstants.SYBASE), DBConstants.SYBASE_STR);
114.52 + dbIdNameMap.put(new Integer(DBConstants.DERBY), DBConstants.DERBY_STR);
114.53 + dbIdNameMap.put(new Integer(DBConstants.MYSQL), DBConstants.MYSQL_STR);
114.54 + dbIdNameMap.put(new Integer(DBConstants.POSTGRESQL), DBConstants.POSTGRES_STR);
114.55 +
114.56 }
114.57
114.58 static {
114.59 @@ -332,14 +339,14 @@
114.60 * @param paramList
114.61 * @return preparedStatement string
114.62 */
114.63 - public static String createPreparedStatement(String rawSql, Map attrMap, List paramList) {
114.64 + public static String createPreparedStatement(String rawSql, Map attrMap, List<String> paramList) {
114.65 Iterator iter = attrMap.values().iterator();
114.66 if (!iter.hasNext()) {
114.67 return rawSql;
114.68 }
114.69
114.70 if (paramList != null) {
114.71 - List orderedSymbolList = SQLUtils.getOrderedSymbolList(rawSql, attrMap);
114.72 + List<String> orderedSymbolList = SQLUtils.getOrderedSymbolList(rawSql, attrMap);
114.73 paramList.clear();
114.74 paramList.addAll(orderedSymbolList);
114.75 }
114.76 @@ -376,7 +383,7 @@
114.77 * @param paramList ordered list of above appearing in the statement
114.78 * @return preparedStatement string with binding parameter (?) for each occurence of the symbols.
114.79 */
114.80 - public static String createPreparedStatement(String rawSql, final List symbols, List orderedSymbols) {
114.81 + public static String createPreparedStatement(String rawSql, final List symbols, List<String> orderedSymbols) {
114.82 String symbol = null;
114.83 boolean noMore = false;
114.84 Iterator iter = symbols.iterator();
114.85 @@ -385,7 +392,7 @@
114.86 }
114.87
114.88 if (orderedSymbols != null) {
114.89 - List orderedSymbolList = SQLUtils.getOrderedSymbolList(rawSql, symbols);
114.90 + List<String> orderedSymbolList = SQLUtils.getOrderedSymbolList(rawSql, symbols);
114.91 orderedSymbols.clear();
114.92 orderedSymbols.addAll(orderedSymbolList);
114.93 }
114.94 @@ -583,8 +590,8 @@
114.95 */
114.96 public static int getResultantDataType(int dataType1, int dataType2) {
114.97
114.98 - Integer dPrecedence1 = (Integer) dataTypePrecedenceMap.get(new Integer(dataType1));
114.99 - Integer dPrecedence2 = (Integer) dataTypePrecedenceMap.get(new Integer(dataType1));
114.100 + Integer dPrecedence1 = dataTypePrecedenceMap.get(new Integer(dataType1));
114.101 + Integer dPrecedence2 = dataTypePrecedenceMap.get(new Integer(dataType1));
114.102
114.103 int retDataType;
114.104
114.105 @@ -642,8 +649,8 @@
114.106 *
114.107 * @return List of standard SQL datatypes.
114.108 */
114.109 - public static List getStdSqlTypes() {
114.110 - return new ArrayList(JDBC_SQL_MAP.keySet());
114.111 + public static List<String> getStdSqlTypes() {
114.112 + return new ArrayList<String>(JDBC_SQL_MAP.keySet());
114.113 }
114.114
114.115 public static List getSupportedDateParts() {
114.116 @@ -663,7 +670,7 @@
114.117 normalizedName = DBConstants.DB2V7_STR;
114.118 }
114.119
114.120 - Integer dbType = (Integer) dbNameIdMap.get(normalizedName);
114.121 + Integer dbType = dbNameIdMap.get(normalizedName);
114.122 if (dbType != null) {
114.123 return dbType.intValue();
114.124 }
114.125 @@ -672,7 +679,7 @@
114.126 }
114.127
114.128 public static String getSupportedDBType(int dbType) {
114.129 - String dbName = (String) dbIdNameMap.get(new Integer(dbType));
114.130 + String dbName = dbIdNameMap.get(new Integer(dbType));
114.131 if (dbName != null) {
114.132 return dbName;
114.133 }
114.134 @@ -780,6 +787,7 @@
114.135 ps.setTimestamp(index, new java.sql.Timestamp(ts));
114.136 } catch (java.sql.SQLException e) {
114.137 ps.setDate(index, new java.sql.Date(ts));
114.138 +
114.139 }
114.140 break;
114.141
114.142 @@ -802,7 +810,7 @@
114.143
114.144
114.145 public static Map getRuntimeInputNameValueMap(Map attribMap){
114.146 - Map values = new HashMap();
114.147 + Map<String, Object> values = new HashMap<String, Object>();
114.148 RuntimeAttribute ra = null;
114.149 int jdbcType = 0;
114.150 Object valueObj = null;
114.151 @@ -980,8 +988,8 @@
114.152 * @param attrMap
114.153 * @return
114.154 */
114.155 - private static List getOrderedSymbolList(String rawSql, final List symbolList) {
114.156 - Map map = new TreeMap();
114.157 + private static List<String> getOrderedSymbolList(String rawSql, final List symbolList) {
114.158 + Map<Integer, String> map = new TreeMap<Integer, String>();
114.159 String symbolName = null;
114.160
114.161 if ((rawSql != null) && (symbolList != null)) {
114.162 @@ -1006,7 +1014,7 @@
114.163 }
114.164 }
114.165
114.166 - return new ArrayList(map.values());
114.167 + return new ArrayList<String>(map.values());
114.168 }
114.169
114.170 /**
114.171 @@ -1017,8 +1025,8 @@
114.172 * @param attrMap
114.173 * @return
114.174 */
114.175 - private static List getOrderedSymbolList(String rawSql, Map attrMap) {
114.176 - Map map = new TreeMap();
114.177 + private static List<String> getOrderedSymbolList(String rawSql, Map attrMap) {
114.178 + Map<Integer, String> map = new TreeMap<Integer, String>();
114.179
114.180 if ((rawSql != null) && (attrMap != null)) {
114.181 Iterator iter = attrMap.values().iterator();
114.182 @@ -1044,7 +1052,7 @@
114.183 }
114.184 }
114.185
114.186 - return new ArrayList(map.values());
114.187 + return new ArrayList<String>(map.values());
114.188 }
114.189
114.190 /* Private no-arg constructor; this class should not be instantiable. */
115.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/common/utils/NativeColumnOrderComparator.java Sat Dec 08 10:04:51 2007 +0000
115.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/common/utils/NativeColumnOrderComparator.java Sat Dec 08 10:24:35 2007 +0000
115.3 @@ -41,22 +41,21 @@
115.4 package org.netbeans.modules.sql.framework.common.utils;
115.5
115.6 import java.util.Comparator;
115.7 -
115.8 -import org.netbeans.modules.sql.framework.model.SQLDBColumn;
115.9 -
115.10 +import org.netbeans.modules.sql.framework.model.DBColumn;
115.11
115.12 /**
115.13 * NativeColumnOrderComparator
115.14 - *
115.15 + *
115.16 * @author Ritesh Adval
115.17 * @version $Revision$
115.18 */
115.19 -public class NativeColumnOrderComparator implements Comparator {
115.20 +public class NativeColumnOrderComparator implements Comparator<DBColumn> {
115.21 +
115.22 private static NativeColumnOrderComparator instance;
115.23
115.24 /**
115.25 * Gets an instance of NativeColumnOrderComparator.
115.26 - *
115.27 + *
115.28 * @return instance of NativeColumnOrderComparator.
115.29 */
115.30 public static NativeColumnOrderComparator getInstance() {
115.31 @@ -69,23 +68,13 @@
115.32
115.33 /*
115.34 * Private constructor - to get an instance, use static method getInstance().
115.35 - *
115.36 + *
115.37 * @see #getInstance()
115.38 */
115.39 private NativeColumnOrderComparator() {
115.40 }
115.41
115.42 - /**
115.43 - * Compare
115.44 - *
115.45 - * @param o1 object1
115.46 - * @param o2 object2
115.47 - * @return int
115.48 - */
115.49 - public int compare(Object o1, Object o2) {
115.50 - SQLDBColumn col1 = (SQLDBColumn) o1;
115.51 - SQLDBColumn col2 = (SQLDBColumn) o2;
115.52 -
115.53 - return (col1.getOrdinalPosition() - col2.getOrdinalPosition());
115.54 + public int compare(DBColumn col1, DBColumn col2) {
115.55 + return col1.getOrdinalPosition() - col2.getOrdinalPosition();
115.56 }
115.57 }
116.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/common/utils/PhysicalTable.java Sat Dec 08 10:04:51 2007 +0000
116.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/common/utils/PhysicalTable.java Sat Dec 08 10:24:35 2007 +0000
116.3 @@ -43,29 +43,27 @@
116.4 import java.util.ArrayList;
116.5 import java.util.Iterator;
116.6 import java.util.List;
116.7 -
116.8 -import org.netbeans.modules.model.database.DBConnectionDefinition;
116.9 -import org.netbeans.modules.model.database.DBTable;
116.10 -import org.netbeans.modules.model.database.DatabaseModel;
116.11 -
116.12 import com.sun.sql.framework.utils.Logger;
116.13 +import org.netbeans.modules.sql.framework.model.DBConnectionDefinition;
116.14 +import org.netbeans.modules.sql.framework.model.DBTable;
116.15 +import org.netbeans.modules.sql.framework.model.DatabaseModel;
116.16
116.17 /**
116.18 * Class representing Physical table such that for any two instances t1 and t2 if
116.19 * (t1.equals(t2)) then both instances represents the same physical table.
116.20 - *
116.21 + *
116.22 * @author Girish Patil
116.23 * @version $Revision$
116.24 */
116.25 public class PhysicalTable {
116.26 +
116.27 private static boolean SKIP_CONNECTION_URL = false;
116.28 -
116.29 //Preferably one of the two should be true to assert two tables are equal.
116.30 - private static boolean SKIP_OTD_NAME = true;
116.31 + private static boolean SKIP_DB_NAME = true;
116.32
116.33 /**
116.34 * Creates new instance of PhysicalTable for given DBTable.
116.35 - *
116.36 + *
116.37 * @param sqlTable
116.38 * @return
116.39 */
116.40 @@ -79,7 +77,7 @@
116.41
116.42 DatabaseModel dbModel = sqlTable.getParent();
116.43 if (dbModel != null) {
116.44 - pt.setOtdName(dbModel.getModelName());
116.45 + pt.setDbName(dbModel.getModelName());
116.46 DBConnectionDefinition dbConnDef = dbModel.getConnectionDefinition();
116.47 if (dbConnDef != null) {
116.48 pt.setConnectionUrl(dbConnDef.getConnectionURL());
116.49 @@ -92,20 +90,18 @@
116.50
116.51 /**
116.52 * Returns list of PhysicalTable given given list of DBTable.
116.53 - *
116.54 + *
116.55 * @param sqlTable
116.56 * @return
116.57 */
116.58 - public static List getPhysicalTableList(List dbTableList) {
116.59 - List ptList = null;
116.60 + public static List<PhysicalTable> getPhysicalTableList(List<DBTable> dbTableList) {
116.61 + List<PhysicalTable> ptList = null;
116.62 PhysicalTable pt = null;
116.63 DBTable sqlTable;
116.64 if (dbTableList != null) {
116.65 - Iterator itr = dbTableList.iterator();
116.66 - ptList = new ArrayList();
116.67 -
116.68 - while (itr.hasNext()) {
116.69 - sqlTable = (DBTable) itr.next();
116.70 + ptList = new ArrayList<PhysicalTable>();
116.71 + for (Iterator<DBTable> itr = dbTableList.iterator(); itr.hasNext();) {
116.72 + sqlTable = itr.next();
116.73
116.74 pt = new PhysicalTable();
116.75 pt.setCatalog(sqlTable.getCatalog());
116.76 @@ -114,7 +110,7 @@
116.77
116.78 DatabaseModel dbModel = sqlTable.getParent();
116.79 if (dbModel != null) {
116.80 - pt.setOtdName(dbModel.getModelName());
116.81 + pt.setDbName(dbModel.getModelName());
116.82 DBConnectionDefinition dbConnDef = dbModel.getConnectionDefinition();
116.83 if (dbConnDef != null) {
116.84 pt.setConnectionUrl(dbConnDef.getConnectionURL());
116.85 @@ -129,10 +125,10 @@
116.86 private String mCatalog;
116.87 private String mConnectionUrl;
116.88 private String mName;
116.89 -
116.90 - private String mOtdName;
116.91 + private String mDbName;
116.92 private String mSchema;
116.93
116.94 + @Override
116.95 public boolean equals(Object other) {
116.96 boolean eql = true;
116.97 PhysicalTable otherTable = null;
116.98 @@ -184,14 +180,14 @@
116.99 }
116.100 }
116.101
116.102 - //Check OtdName
116.103 - if (eql && (!SKIP_OTD_NAME)) {
116.104 - if ((this.mOtdName == null) || blank.equals(mOtdName)) {
116.105 - if (!((otherTable.getOtdName() == null) || blank.equals(otherTable.getOtdName()))) {
116.106 + //Check DbName
116.107 + if (eql && (!SKIP_DB_NAME)) {
116.108 + if ((this.mDbName == null) || blank.equals(mDbName)) {
116.109 + if (!((otherTable.getDbName() == null) || blank.equals(otherTable.getDbName()))) {
116.110 eql = false;
116.111 }
116.112 } else {
116.113 - if (!this.mOtdName.equals(otherTable.getOtdName())) {
116.114 + if (!this.mDbName.equals(otherTable.getDbName())) {
116.115 eql = false;
116.116 }
116.117 }
116.118 @@ -213,6 +209,17 @@
116.119 return eql;
116.120 }
116.121
116.122 + @Override
116.123 + public int hashCode() {
116.124 + int hash = 7;
116.125 + hash = 53 * hash + (this.mCatalog != null ? this.mCatalog.hashCode() : 0);
116.126 + hash = 53 * hash + (this.mConnectionUrl != null ? this.mConnectionUrl.hashCode() : 0);
116.127 + hash = 53 * hash + (this.mName != null ? this.mName.hashCode() : 0);
116.128 + hash = 53 * hash + (this.mDbName != null ? this.mDbName.hashCode() : 0);
116.129 + hash = 53 * hash + (this.mSchema != null ? this.mSchema.hashCode() : 0);
116.130 + return hash;
116.131 + }
116.132 +
116.133 /**
116.134 * @return Returns the catalog.
116.135 */
116.136 @@ -235,10 +242,10 @@
116.137 }
116.138
116.139 /**
116.140 - * @return Returns the otdName.
116.141 + * @return Returns the dbName.
116.142 */
116.143 - public String getOtdName() {
116.144 - return mOtdName;
116.145 + public String getDbName() {
116.146 + return mDbName;
116.147 }
116.148
116.149 /**
116.150 @@ -270,10 +277,10 @@
116.151 }
116.152
116.153 /**
116.154 - * @param otdName The otdName to set.
116.155 + * @param dbName The dbName to set.
116.156 */
116.157 - public void setOtdName(String otdName) {
116.158 - this.mOtdName = otdName;
116.159 + public void setDbName(String dbName) {
116.160 + this.mDbName = dbName;
116.161 }
116.162
116.163 /**
116.164 @@ -282,6 +289,4 @@
116.165 public void setSchema(String schema) {
116.166 this.mSchema = schema;
116.167 }
116.168 -
116.169 }
116.170 -
117.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
117.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/model/utils/GeneratorUtil.java Sat Dec 08 10:24:35 2007 +0000
117.3 @@ -0,0 +1,122 @@
117.4 +/*
117.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
117.6 + *
117.7 + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
117.8 + *
117.9 + * The contents of this file are subject to the terms of either the GNU
117.10 + * General Public License Version 2 only ("GPL") or the Common
117.11 + * Development and Distribution License("CDDL") (collectively, the
117.12 + * "License"). You may not use this file except in compliance with the
117.13 + * License. You can obtain a copy of the License at
117.14 + * http://www.netbeans.org/cddl-gplv2.html
117.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
117.16 + * specific language governing permissions and limitations under the
117.17 + * License. When distributing the software, include this License Header
117.18 + * Notice in each file and include the License file at
117.19 + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
117.20 + * particular file as subject to the "Classpath" exception as provided
117.21 + * by Sun in the GPL Version 2 section of the License file that
117.22 + * accompanied this code. If applicable, add the following below the
117.23 + * License Header, with the fields enclosed by brackets [] replaced by
117.24 + * your own identifying information:
117.25 + * "Portions Copyrighted [year] [name of copyright owner]"
117.26 + *
117.27 + * Contributor(s):
117.28 + *
117.29 + * The Original Software is NetBeans. The Initial Developer of the Original
117.30 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
117.31 + * Microsystems, Inc. All Rights Reserved.
117.32 + *
117.33 + * If you wish your version of this file to be governed by only the CDDL
117.34 + * or only the GPL Version 2, indicate your decision by adding
117.35 + * "[Contributor] elects to include this software in this distribution
117.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
117.37 + * single choice of license, a recipient has the option to distribute
117.38 + * your version of this file under either the CDDL, the GPL Version 2 or
117.39 + * to extend the choice of license to its licensees as provided above.
117.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
117.41 + * Version 2 license, then the option applies only if the new code is
117.42 + * made subject to such option by the copyright holder.
117.43 + */
117.44 +package org.netbeans.modules.sql.framework.model.utils;
117.45 +
117.46 +import org.netbeans.modules.sql.framework.codegen.DB;
117.47 +import org.netbeans.modules.sql.framework.codegen.DBFactory;
117.48 +import org.netbeans.modules.sql.framework.codegen.StatementContext;
117.49 +import org.netbeans.modules.sql.framework.model.SQLObject;
117.50 +import com.sun.sql.framework.exception.BaseException;
117.51 +import com.sun.sql.framework.utils.Logger;
117.52 +import org.netbeans.modules.sql.framework.codegen.AbstractGeneratorFactory;
117.53 +
117.54 +/**
117.55 + * @author Ritesh Adval
117.56 + * @version $Revision$
117.57 + */
117.58 +public class GeneratorUtil {
117.59 +
117.60 + private static int currentDbType = DB.BASEDB;
117.61 + private static GeneratorUtil instance;
117.62 +
117.63 + /**
117.64 + * Gets an instance of GeneratorUtil.
117.65 + *
117.66 + * @return instance of GeneratorUtil
117.67 + */
117.68 + public static GeneratorUtil getInstance() throws BaseException {
117.69 + if (instance == null) {
117.70 + instance = new GeneratorUtil();
117.71 + }
117.72 +
117.73 + return instance;
117.74 + }
117.75 + private DB db;
117.76 + private AbstractGeneratorFactory genFactory;
117.77 + private StatementContext stmtContext = new StatementContext();
117.78 +
117.79 + /** Creates a new instance of GeneratorUtil */
117.80 + private GeneratorUtil() throws BaseException {
117.81 + db = DBFactory.getInstance().getDatabase(currentDbType);
117.82 + genFactory = db.getGeneratorFactory();
117.83 + }
117.84 +
117.85 + /**
117.86 + * Gets SQL expression (or fragment thereof) that can be generated from the given
117.87 + * SQLObject instance.
117.88 + *
117.89 + * @param sqlObj SQLObject instance from which SQL expression (or fragment) can be
117.90 + * generated
117.91 + * @return generated SQL expression, or empty string if no expression could be
117.92 + * generated.
117.93 + */
117.94 + public String getEvaluatedString(SQLObject sqlObj) {
117.95 + String sql = "";
117.96 + try {
117.97 + sql = genFactory.generate(sqlObj, stmtContext);
117.98 + } catch (Exception ex) {
117.99 + Logger.printThrowable(Logger.ERROR, GeneratorUtil.class.getName(), "getEvaluatedString", "Could not evaulate object " + sqlObj.getDisplayName(), ex);
117.100 + }
117.101 + return sql;
117.102 + }
117.103 +
117.104 + /**
117.105 + * Sets whether column alias should be used by the Generator or not, while evaluating
117.106 + * columns and tables.
117.107 + *
117.108 + * @param aliasUsed boolean
117.109 + */
117.110 + public void setColumnAliasUsed(boolean aliasUsed) {
117.111 + stmtContext.setUseSourceColumnAliasName(aliasUsed);
117.112 + stmtContext.setUseTargetColumnAliasName(aliasUsed);
117.113 + }
117.114 +
117.115 + /**
117.116 + * Sets whether table alias should be used by the Generator or not, while evaluating
117.117 + * columns and tables.
117.118 + *
117.119 + * @param aliasUsed boolean
117.120 + */
117.121 + public void setTableAliasUsed(boolean aliasUsed) {
117.122 + stmtContext.setUseSourceTableAliasName(aliasUsed);
117.123 + stmtContext.setUseTargetTableAliasName(aliasUsed);
117.124 + }
117.125 +}
117.126 \ No newline at end of file
118.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/parser/conditionparser/SQLConditionException.java Sat Dec 08 10:04:51 2007 +0000
118.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/parser/conditionparser/SQLConditionException.java Sat Dec 08 10:24:35 2007 +0000
118.3 @@ -45,7 +45,6 @@
118.4
118.5 /**
118.6 * @author Ritesh Adval
118.7 - * @version $Revision$
118.8 */
118.9 public class SQLConditionException extends BaseException {
118.10
119.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/parser/conditionparser/SQLConditionParser.java Sat Dec 08 10:04:51 2007 +0000
119.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/parser/conditionparser/SQLConditionParser.java Sat Dec 08 10:24:35 2007 +0000
119.3 @@ -24,7 +24,7 @@
119.4
119.5 /**
119.6 * JavaCC generated SQL parser.
119.7 - * Generated from SQLConditionParser.jj ($id$).
119.8 + * Generated from SQLConditionParser.jj
119.9 * Do not edit this (.java) file directly, it is programmaticly generated.
119.10 *
119.11 * @author Ahimanikya Satapathy
120.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/model/impl/AbstractSQLModel.java Sat Dec 08 10:04:51 2007 +0000
120.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/model/impl/AbstractSQLModel.java Sat Dec 08 10:24:35 2007 +0000
120.3 @@ -51,7 +51,6 @@
120.4 import javax.swing.undo.UndoManager;
120.5 import javax.swing.undo.UndoableEditSupport;
120.6
120.7 -import org.netbeans.modules.model.database.DBTable;
120.8 import org.netbeans.modules.sql.framework.model.SQLCanvasObject;
120.9 import org.netbeans.modules.sql.framework.model.SQLConnectableObject;
120.10 import org.netbeans.modules.sql.framework.model.SQLInputObject;
120.11 @@ -73,6 +72,7 @@
120.12
120.13 import com.sun.sql.framework.exception.BaseException;
120.14 import com.sun.sql.framework.utils.Logger;
120.15 +import org.netbeans.modules.sql.framework.model.DBTable;
120.16
120.17 /**
120.18 * @author Ritesh Adval
120.19 @@ -82,10 +82,10 @@
120.20
120.21 protected UndoableEditSupport editSupport = new UndoableEditSupport();
120.22 protected boolean isDirty = false;
120.23 - protected List listeners = new ArrayList();
120.24 + protected List<SQLDataListener> listeners = new ArrayList<SQLDataListener>();
120.25 protected SQLUndoManager undoManager = new SQLUndoManager();
120.26
120.27 - private List javaOperatorList = new ArrayList();
120.28 + private List<SQLOperator> javaOperatorList = new ArrayList<SQLOperator>();
120.29
120.30 protected AbstractSQLModel() {
120.31 UndoableEditSupport editSupt = this.getUndoEditSupport();
121.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/model/impl/CollabSQLUIModelImpl.java Sat Dec 08 10:04:51 2007 +0000
121.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/model/impl/CollabSQLUIModelImpl.java Sat Dec 08 10:24:35 2007 +0000
121.3 @@ -49,8 +49,7 @@
121.4 import java.util.List;
121.5 import java.util.Map;
121.6
121.7 -import org.netbeans.modules.model.database.DBColumn;
121.8 -import org.netbeans.modules.model.database.DBTable;
121.9 +import org.netbeans.modules.sql.framework.model.DBColumn;
121.10 import org.netbeans.modules.sql.framework.common.utils.XmlUtil;
121.11 import org.netbeans.modules.sql.framework.model.GUIInfo;
121.12 import org.netbeans.modules.sql.framework.model.RuntimeDatabaseModel;
121.13 @@ -83,12 +82,12 @@
121.14
121.15 import com.sun.sql.framework.exception.BaseException;
121.16 import com.sun.sql.framework.utils.Logger;
121.17 +import org.netbeans.modules.sql.framework.model.DBTable;
121.18
121.19 /**
121.20 * Concrete implementation of SQLBuilderModel for use in representing SQL object models.
121.21 *
121.22 * @author Ritesh Adval
121.23 - * @version $Revision$
121.24 */
121.25 public class CollabSQLUIModelImpl extends AbstractSQLModel implements CollabSQLUIModel {
121.26
122.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/utils/UIUtil.java Sat Dec 08 10:04:51 2007 +0000
122.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/utils/UIUtil.java Sat Dec 08 10:24:35 2007 +0000
122.3 @@ -58,9 +58,7 @@
122.4 import javax.swing.KeyStroke;
122.5 import org.netbeans.api.progress.ProgressHandle;
122.6 import org.netbeans.api.progress.ProgressHandleFactory;
122.7 -import org.netbeans.modules.model.database.DBColumn;
122.8 -import org.netbeans.modules.model.database.DBTable;
122.9 -import org.netbeans.modules.model.database.ForeignKey;
122.10 +import org.netbeans.modules.sql.framework.model.DBColumn;
122.11 import org.netbeans.modules.sql.framework.model.SQLConstants;
122.12 import org.netbeans.modules.sql.framework.model.SQLDBColumn;
122.13 import org.netbeans.modules.sql.framework.model.SQLDBTable;
122.14 @@ -70,11 +68,12 @@
122.15 import org.netbeans.modules.sql.framework.model.utils.SQLObjectUtil;
122.16
122.17 import com.sun.sql.framework.utils.StringUtil;
122.18 +import org.netbeans.modules.sql.framework.model.DBTable;
122.19 +import org.netbeans.modules.sql.framework.model.ForeignKey;
122.20 /**
122.21 * Provides UI-related facilities.
122.22 *
122.23 * @author Wei Han, Ritesh Adval, Jonathan Giron
122.24 -* @version $Revision$
122.25 */
122.26
122.27 public abstract class UIUtil {
122.28 @@ -199,7 +198,7 @@
122.29 return strBuf.toString();
122.30 }
122.31
122.32 - private static String getForeignKeyString(DBColumn column) {
122.33 + public static String getForeignKeyString(DBColumn column) {
122.34 String refString = column.getName() + " --> ";
122.35 StringBuilder str = new StringBuilder(refString);
122.36 DBTable table = column.getParent();
122.37 @@ -302,9 +301,15 @@
122.38 strBuf.append("</b> </td> </tr>");
122.39 }
122.40
122.41 - strBuf.append("<tr> <td> Connection URL </td> <td> : <b>");
122.42 - strBuf.append(table.getParent().getModelName()).append("</b> </td> </tr>");
122.43 -
122.44 + strBuf.append("<tr> <td> ConnectionURL </td> <td> : <b>");
122.45 +
122.46 + String URL = table.getParent().getModelName();
122.47 + if (URL.length() > 40) {
122.48 + strBuf.append("...").append(URL.substring(URL.length() - 40));
122.49 + } else {
122.50 + strBuf.append(URL).append("</b> </td> </tr>");
122.51 + }
122.52 +
122.53 strBuf.append("<tr> <td> DB Type </td> <td> : <b>");
122.54 strBuf.append(table.getParent().getConnectionDefinition().getDBType()).append("</b> </td> </tr>");
122.55
123.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/JoinConditionValidationHandler.java Sat Dec 08 10:04:51 2007 +0000
123.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/JoinConditionValidationHandler.java Sat Dec 08 10:24:35 2007 +0000
123.3 @@ -53,14 +53,14 @@
123.4
123.5 /**
123.6 * Implementation of ValidationHandler interface for join conditions.
123.7 - *
123.8 + *
123.9 * @author Ritesh Adval
123.10 */
123.11 public class JoinConditionValidationHandler implements ValidationHandler {
123.12
123.13 private IGraphView graphView;
123.14
123.15 - public JoinConditionValidationHandler(IGraphView gView, SQLCondition cond) {
123.16 + public JoinConditionValidationHandler(IGraphView gView) {
123.17 this.graphView = gView;
123.18 }
123.19
123.20 @@ -70,10 +70,7 @@
123.21 public void editValue(Object val) {
123.22 SQLCondition oldCondition = (SQLCondition) val;
123.23 SQLJoinOperator join = (SQLJoinOperator) oldCondition.getParent();
123.24 -
123.25 - ConditionBuilderView conditionView = ConditionBuilderUtil.getConditionBuilderView(join,
123.26 - (IGraphViewContainer) graphView.getGraphViewContainer());
123.27 -
123.28 + ConditionBuilderView conditionView = ConditionBuilderUtil.getConditionBuilderView(join, (IGraphViewContainer) graphView.getGraphViewContainer());
123.29 DialogDescriptor dd = new DialogDescriptor(conditionView, "Edit Join Condition", true, NotifyDescriptor.OK_CANCEL_OPTION, null, null);
123.30
123.31 if (DialogDisplayer.getDefault().notify(dd) == NotifyDescriptor.OK_OPTION) {
123.32 @@ -87,4 +84,3 @@
123.33 }
123.34 }
123.35 }
123.36 -
124.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/SQLValidationView.java Sat Dec 08 10:04:51 2007 +0000
124.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/SQLValidationView.java Sat Dec 08 10:24:35 2007 +0000
124.3 @@ -42,12 +42,18 @@
124.4
124.5 import java.awt.BorderLayout;
124.6 import java.awt.CardLayout;
124.7 +import java.awt.event.ActionEvent;
124.8 +import java.awt.event.ActionListener;
124.9 +import java.net.URL;
124.10 import java.util.List;
124.11 -
124.12 +import javax.swing.ImageIcon;
124.13 +import javax.swing.JButton;
124.14 import javax.swing.JPanel;
124.15 import javax.swing.JTextArea;
124.16 -
124.17 +import javax.swing.JToolBar;
124.18 +import org.netbeans.modules.sql.framework.model.SQLObject;
124.19 import org.netbeans.modules.sql.framework.ui.graph.IGraphView;
124.20 +import org.netbeans.modules.sql.framework.ui.view.IGraphViewContainer;
124.21
124.22
124.23 /**
124.24 @@ -56,16 +62,17 @@
124.25 public class SQLValidationView extends JPanel {
124.26
124.27 private static final String TABLE_VIEW = "table_view";
124.28 -
124.29 private static final String TEXT_VIEW = "text_view";
124.30 -
124.31 private ValidationTableView vTableView;
124.32 -
124.33 private JTextArea textArea;
124.34 -
124.35 private JPanel cardPanel;
124.36 -
124.37 private IGraphView graphView;
124.38 + private JPanel left;
124.39 + private JToolBar verticalBar;
124.40 + private JButton refreshButton;
124.41 + private ActionListener aListener;
124.42 + private SQLObject sqlObj;
124.43 + private IGraphViewContainer sqlView;
124.44
124.45 public SQLValidationView(IGraphView gView) {
124.46 this.graphView = gView;
124.47 @@ -75,9 +82,33 @@
124.48 private void initGui() {
124.49 this.setLayout(new BorderLayout());
124.50
124.51 + //Adding vertical toolbar
124.52 + left = new JPanel();
124.53 + left.setLayout(new BorderLayout());
124.54 + verticalBar = new JToolBar(JToolBar.VERTICAL);
124.55 + verticalBar.setFloatable(false);
124.56 + if (verticalBar != null)
124.57 + left.add(verticalBar, BorderLayout.WEST);
124.58 +
124.59 + //add refresh button
124.60 + URL url = getClass().getResource("/org/netbeans/modules/sql/framework/ui/resources/images/rerun.png");
124.61 + refreshButton = new JButton(new ImageIcon(url));
124.62 + refreshButton.setToolTipText("Refresh");
124.63 + refreshButton.addActionListener(aListener);
124.64 + verticalBar.add(refreshButton);
124.65 + ActionListener aListener = new ActionListener() {
124.66 +
124.67 + public void actionPerformed(ActionEvent e) {
124.68 + Object src = e.getSource();
124.69 + if (src.equals(refreshButton)) {
124.70 + validate();
124.71 + }
124.72 + }
124.73 + };
124.74 cardPanel = new JPanel();
124.75 cardPanel.setLayout(new CardLayout());
124.76 this.add(cardPanel, BorderLayout.CENTER);
124.77 + this.add(left, BorderLayout.WEST);
124.78
124.79 //add table panel
124.80 vTableView = new ValidationTableView(this.graphView);
124.81 @@ -86,7 +117,6 @@
124.82 //add text panel
124.83 textArea = new JTextArea();
124.84 cardPanel.add(textArea, TEXT_VIEW);
124.85 -
124.86 }
124.87
124.88 public void setValidationInfos(List vInfos) {
124.89 @@ -108,4 +138,3 @@
124.90 cl.show(cardPanel, TEXT_VIEW);
124.91 }
124.92 }
124.93 -
125.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/SourceConditionValidationHandler.java Sat Dec 08 10:04:51 2007 +0000
125.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/SourceConditionValidationHandler.java Sat Dec 08 10:24:35 2007 +0000
125.3 @@ -56,7 +56,7 @@
125.4 /**
125.5 * Handles request to edit a source table condition as referenced by a validation error
125.6 * message.
125.7 - *
125.8 + *
125.9 * @author Ritesh Adval
125.10 * @version $Revision$
125.11 */
125.12 @@ -67,17 +67,17 @@
125.13 /**
125.14 * Constructs a new instance of SourceConditionValidationHandler, referencing the
125.15 * given IGraphView instance and SQLCondition.
125.16 - *
125.17 + *
125.18 * @param gView IGraphView instance in which target table is displayed
125.19 * @param cond SQLCOndition to be edited
125.20 */
125.21 - public SourceConditionValidationHandler(IGraphView gView, SQLCondition cond) {
125.22 + public SourceConditionValidationHandler(IGraphView gView) {
125.23 this.graphView = gView;
125.24 }
125.25
125.26 /*
125.27 * (non-Javadoc)
125.28 - *
125.29 + *
125.30 * @see org.netbeans.modules.sql.framework.ui.view.validation.ValidationHandler#editValue(java.lang.Object)
125.31 */
125.32 public void editValue(Object val) {
125.33 @@ -118,4 +118,3 @@
125.34 }
125.35 }
125.36 }
125.37 -
126.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/TargetConditionValidationHandler.java Sat Dec 08 10:04:51 2007 +0000
126.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/TargetConditionValidationHandler.java Sat Dec 08 10:24:35 2007 +0000
126.3 @@ -46,6 +46,7 @@
126.4 import org.netbeans.modules.sql.framework.ui.view.IGraphViewContainer;
126.5 import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.ConditionBuilderUtil;
126.6 import org.netbeans.modules.sql.framework.ui.view.conditionbuilder.ConditionBuilderView;
126.7 +import org.netbeans.modules.sql.framework.ui.view.graph.SQLBasicTableArea;
126.8 import org.netbeans.modules.sql.framework.ui.view.graph.SQLTargetTableArea;
126.9 import org.openide.DialogDescriptor;
126.10 import org.openide.NotifyDescriptor;
126.11 @@ -56,7 +57,7 @@
126.12 /**
126.13 * Handles request to edit a target table condition as referenced by a validation error
126.14 * message.
126.15 - *
126.16 + *
126.17 * @author Ritesh Adval
126.18 * @version $Revision$
126.19 */
126.20 @@ -67,11 +68,11 @@
126.21 /**
126.22 * Constructs a new instance of TargetConditionValidationHandler, referencing the
126.23 * given IGraphView instance and SQLCondition.
126.24 - *
126.25 + *
126.26 * @param gView IGraphView instance in which target table is displayed
126.27 * @param cond SQLCOndition to be edited
126.28 */
126.29 - public TargetConditionValidationHandler(IGraphView gView, SQLCondition cond) {
126.30 + public TargetConditionValidationHandler(IGraphView gView) {
126.31 this.graphView = gView;
126.32 }
126.33
126.34 @@ -85,17 +86,17 @@
126.35 String title = null;
126.36 ConditionBuilderView conditionView = null;
126.37 DialogDescriptor dd = null;
126.38 -
126.39 +
126.40 if (TargetTable.JOIN_CONDITION.equals(oldCondition.getDisplayName())) {
126.41 - conditionView = ConditionBuilderUtil.getJoinConditionBuilderView(tTable, (IGraphViewContainer) graphView.getGraphViewContainer());
126.42 - title = NbBundle.getMessage(IGraphViewContainer.class, "LBL_edit_target_join_condition");
126.43 + conditionView = ConditionBuilderUtil.getJoinConditionBuilderView(tTable, (IGraphViewContainer) graphView.getGraphViewContainer());
126.44 + title = NbBundle.getMessage(SQLBasicTableArea.class, "LBL_edit_target_join_condition");
126.45 dd = new DialogDescriptor(conditionView, title, true, NotifyDescriptor.OK_CANCEL_OPTION, null, null);
126.46 } else {
126.47 - title = NbBundle.getMessage(IGraphViewContainer.class, "LBL_edit_target_filter_condition");
126.48 + title = NbBundle.getMessage(SQLBasicTableArea.class, "LBL_edit_target_filter_condition");
126.49 conditionView = ConditionBuilderUtil.getFilterConditionBuilderView(tTable, (IGraphViewContainer) graphView.getGraphViewContainer());
126.50 dd = new DialogDescriptor(conditionView, title, true, NotifyDescriptor.OK_CANCEL_OPTION, null, null);
126.51 }
126.52 -
126.53 +
126.54 conditionView.doValidation();
126.55
126.56 if (DialogDisplayer.getDefault().notify(dd) == NotifyDescriptor.OK_OPTION) {
127.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/ValidationHandlerFactory.java Sat Dec 08 10:04:51 2007 +0000
127.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/ValidationHandlerFactory.java Sat Dec 08 10:24:35 2007 +0000
127.3 @@ -41,7 +41,6 @@
127.4 package org.netbeans.modules.sql.framework.ui.view.validation;
127.5
127.6 import java.util.Iterator;
127.7 -
127.8 import org.netbeans.modules.sql.framework.model.SQLCastOperator;
127.9 import org.netbeans.modules.sql.framework.model.SQLCondition;
127.10 import org.netbeans.modules.sql.framework.model.SQLJoinOperator;
127.11 @@ -54,7 +53,7 @@
127.12 /**
127.13 * Factory for creating ValidationHandler instances, depending on the object type of the object
127.14 * being validated (as referenced in a ValidationInfo instance).
127.15 - *
127.16 + *
127.17 * @author Ritesh Adval
127.18 * @author Jonathan Giron
127.19 */
127.20 @@ -89,7 +88,7 @@
127.21 public ValidationHandler getValidationHandler(ValidationInfo vInfo) {
127.22 Object val = vInfo.getValidatedObject();
127.23 higlightInvalidNode(vInfo);
127.24 -
127.25 +
127.26 if (val instanceof SQLCondition) {
127.27 return getConditionValidationHandler((SQLCondition) val);
127.28 } else if (val instanceof SQLCastOperator) {
127.29 @@ -105,11 +104,11 @@
127.30 Object parent = condition.getParent();
127.31
127.32 if (parent instanceof SourceTable) {
127.33 - vHandler = new SourceConditionValidationHandler(this.graphView, condition);
127.34 + vHandler = new SourceConditionValidationHandler(this.graphView);
127.35 } else if (parent instanceof TargetTable) {
127.36 - vHandler = new TargetConditionValidationHandler(this.graphView, condition);
127.37 + vHandler = new TargetConditionValidationHandler(this.graphView);
127.38 } else if (parent instanceof SQLJoinOperator) {
127.39 - vHandler = new JoinConditionValidationHandler(this.graphView, condition);
127.40 + vHandler = new JoinConditionValidationHandler(this.graphView);
127.41 }
127.42
127.43 return vHandler;
128.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/ValidationTableModel.java Sat Dec 08 10:04:51 2007 +0000
128.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/ValidationTableModel.java Sat Dec 08 10:24:35 2007 +0000
128.3 @@ -41,9 +41,7 @@
128.4 package org.netbeans.modules.sql.framework.ui.view.validation;
128.5
128.6 import java.util.List;
128.7 -
128.8 import javax.swing.table.AbstractTableModel;
128.9 -
128.10 import org.netbeans.modules.sql.framework.model.ValidationInfo;
128.11
128.12
128.13 @@ -51,9 +49,9 @@
128.14 * @author Ritesh Adval
128.15 */
128.16 public class ValidationTableModel extends AbstractTableModel {
128.17 +
128.18 private List dataList;
128.19 -
128.20 - private static final String[] columnNames = { "", "Description"};
128.21 + private static final String[] columnNames = {"Type", "Description"};
128.22
128.23 public ValidationTableModel(List vInfos) {
128.24 this.dataList = vInfos;
128.25 @@ -61,7 +59,7 @@
128.26
128.27 /*
128.28 * (non-Javadoc)
128.29 - *
128.30 + *
128.31 * @see javax.swing.table.TableModel#getColumnCount()
128.32 */
128.33 public int getColumnCount() {
128.34 @@ -70,7 +68,7 @@
128.35
128.36 /*
128.37 * (non-Javadoc)
128.38 - *
128.39 + *
128.40 * @see javax.swing.table.TableModel#getRowCount()
128.41 */
128.42 public int getRowCount() {
128.43 @@ -79,7 +77,7 @@
128.44
128.45 /*
128.46 * (non-Javadoc)
128.47 - *
128.48 + *
128.49 * @see javax.swing.table.TableModel#getValueAt(int, int)
128.50 */
128.51 public Object getValueAt(int rowIndex, int columnIndex) {
128.52 @@ -90,12 +88,12 @@
128.53 return new Integer(vInfo.getValidationType());
128.54 case 1:
128.55 return vInfo.getDescription();
128.56 -
128.57 }
128.58
128.59 return "";
128.60 }
128.61
128.62 + @Override
128.63 public Class getColumnClass(int columnIndex) {
128.64 if (columnIndex == 0) {
128.65 return Integer.class;
128.66 @@ -104,6 +102,7 @@
128.67 return String.class;
128.68 }
128.69
128.70 + @Override
128.71 public String getColumnName(int column) {
128.72 return columnNames[column];
128.73 }
128.74 @@ -112,4 +111,3 @@
128.75 return (ValidationInfo) this.dataList.get(row);
128.76 }
128.77 }
128.78 -
129.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/ValidationTableView.java Sat Dec 08 10:04:51 2007 +0000
129.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/view/validation/ValidationTableView.java Sat Dec 08 10:24:35 2007 +0000
129.3 @@ -50,7 +50,6 @@
129.4 import java.util.Collections;
129.5 import java.util.Iterator;
129.6 import java.util.List;
129.7 -
129.8 import javax.swing.ImageIcon;
129.9 import javax.swing.JLabel;
129.10 import javax.swing.JPanel;
129.11 @@ -61,7 +60,6 @@
129.12 import javax.swing.table.DefaultTableCellRenderer;
129.13 import javax.swing.table.TableColumn;
129.14 import javax.swing.table.TableColumnModel;
129.15 -
129.16 import org.netbeans.modules.sql.framework.model.ValidationInfo;
129.17 import org.netbeans.modules.sql.framework.ui.graph.IGraphView;
129.18 import org.netbeans.modules.sql.framework.ui.view.ButtonTableHeader;
129.19 @@ -74,38 +72,33 @@
129.20 public class ValidationTableView extends JPanel {
129.21
129.22 private static URL warningImgUrl = ValidationTableView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/Warning.png");
129.23 -
129.24 private static URL errorImgUrl = ValidationTableView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/Error.png");
129.25 -
129.26 + private static URL infoImgUrl = ValidationTableView.class.getResource("/org/netbeans/modules/sql/framework/ui/resources/images/information.png");
129.27 private static ImageIcon errorImg;
129.28 -
129.29 private static ImageIcon warningImg;
129.30 -
129.31 + private static ImageIcon infoImg;
129.32 private JTable table;
129.33 -
129.34 private IGraphView graphView;
129.35 -
129.36 private TableCellRenderer cellRenderer;
129.37 -
129.38 private String maxLengthStr = "THIS IS MAX LENGTH STRING";
129.39 -
129.40 static {
129.41 errorImg = new ImageIcon(errorImgUrl);
129.42 warningImg = new ImageIcon(warningImgUrl);
129.43 + infoImg = new ImageIcon(infoImgUrl);
129.44 }
129.45
129.46 +
129.47 public ValidationTableView(IGraphView gView) {
129.48 this.graphView = gView;
129.49 -
129.50 initGui();
129.51 }
129.52
129.53 private void initGui() {
129.54 this.setLayout(new BorderLayout());
129.55 -
129.56 +
129.57 ValidationTableModel model = new ValidationTableModel(Collections.EMPTY_LIST);
129.58 SortableTableModel sortModel = new SortableTableModel(model);
129.59 -
129.60 +
129.61 table = new JTable(sortModel);
129.62 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
129.63 table.getSelectionModel().addListSelectionListener(new TableListSelectionListener());
129.64 @@ -138,7 +131,7 @@
129.65 SortableTableModel sortModel = new SortableTableModel(model);
129.66 table.setModel(sortModel);
129.67
129.68 - // set icon column size
129.69 + // set icon column size
129.70 TableColumn column1 = table.getColumnModel().getColumn(0);
129.71 column1.setResizable(false);
129.72 column1.setMinWidth(30);
129.73 @@ -158,7 +151,6 @@
129.74 maxLengthStr = vInfo.getDescription();
129.75 }
129.76 }
129.77 -
129.78 }
129.79
129.80 private void setDescriptionColumnWidth(int width) {
129.81 @@ -175,9 +167,11 @@
129.82 }
129.83
129.84 class TableMouseAdapter extends MouseAdapter {
129.85 +
129.86 /**
129.87 * Invoked when a mouse button has been pressed on a component.
129.88 */
129.89 + @Override
129.90 public void mousePressed(MouseEvent e) {
129.91 int row = table.getSelectedRow();
129.92 SortableTableModel sortModel = (SortableTableModel) table.getModel();
129.93 @@ -188,7 +182,7 @@
129.94 ValidationHandler vHandler = factory.getValidationHandler(vInfo);
129.95
129.96 if (e.getClickCount() == 2) {
129.97 - Object validatedObject = vInfo.getValidatedObject();
129.98 + Object validatedObject = vInfo.getValidatedObject();
129.99 if (vHandler != null && validatedObject != null) {
129.100 vHandler.editValue(validatedObject);
129.101 }
129.102 @@ -200,7 +194,7 @@
129.103
129.104 /**
129.105 * Returns the default table cell renderer.
129.106 - *
129.107 + *
129.108 * @param tbl the <code>JTable</code>
129.109 * @param value the value to assign to the cell at <code>[row, column]</code>
129.110 * @param isSelected true if cell is selected
129.111 @@ -209,28 +203,30 @@
129.112 * @param column the column of the cell to render
129.113 * @return the default table cell renderer
129.114 */
129.115 + @Override
129.116 public Component getTableCellRendererComponent(JTable tbl, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
129.117 JLabel label = null;
129.118
129.119 if (value instanceof Integer) {
129.120 int type = ((Integer) value).intValue();
129.121 -
129.122 if (type == ValidationInfo.VALIDATION_WARNING) {
129.123 label = new JLabel(warningImg);
129.124 label.setToolTipText("Warning");
129.125 - } else {
129.126 + } else if(type == ValidationInfo.VALIDATION_INFO){
129.127 + label = new JLabel(infoImg);
129.128 + label.setToolTipText("Information");
129.129 + }else {
129.130 label = new JLabel(errorImg);
129.131 label.setToolTipText("Error");
129.132 }
129.133 return label;
129.134 }
129.135 label = (JLabel) super.getTableCellRendererComponent(tbl, value, isSelected, hasFocus, row, column);
129.136 -
129.137 label.setToolTipText(value.toString());
129.138 return label;
129.139 -
129.140 }
129.141
129.142 + @Override
129.143 public void paint(Graphics g) {
129.144 FontMetrics fm = g.getFontMetrics();
129.145 if (fm != null) {
129.146 @@ -239,7 +235,6 @@
129.147
129.148 super.paint(g);
129.149 }
129.150 -
129.151 }
129.152
129.153 class TableListSelectionListener implements ListSelectionListener {
129.154 @@ -262,4 +257,3 @@
129.155 }
129.156 }
129.157 }
129.158 -
130.1 --- a/etl.editor/src/org/netbeans/modules/sql/framework/ui/zoom/ZoomComboBox.java Sat Dec 08 10:04:51 2007 +0000
130.2 +++ b/etl.editor/src/org/netbeans/modules/sql/framework/ui/zoom/ZoomComboBox.java Sat Dec 08 10:24:35 2007 +0000
130.3 @@ -48,10 +48,8 @@
130.4 import java.beans.PropertyChangeEvent;
130.5 import java.beans.PropertyChangeListener;
130.6 import java.util.Vector;
130.7 -
130.8 import javax.swing.JComboBox;
130.9 import javax.swing.JPanel;
130.10 -
130.11 import org.netbeans.modules.etl.ui.DataObjectProvider;
130.12 import org.netbeans.modules.etl.ui.view.ETLCollaborationTopComponent;
130.13 import org.openide.windows.TopComponent;
130.14 @@ -61,59 +59,51 @@
130.15 * @author Ritesh Adval
130.16 */
130.17 public class ZoomComboBox extends JPanel implements PropertyChangeListener {
130.18 -
130.19 +
130.20 private ZoomSupport zoomableComponent;
130.21 private JComboBox zoomBox;
130.22 private double lastValue;
130.23 private static final Dimension COMBO_BOX_SIZE = new Dimension(60, 20);
130.24 private static final Dimension ZOOM_PANEL_SIZE = new Dimension(70, 25);
130.25 -
130.26 +
130.27 /** Creates a new instance of ZoomComboBox */
130.28 public ZoomComboBox() {
130.29 this.setLayout(new FlowLayout(java.awt.FlowLayout.LEFT));
130.30 -
130.31 +
130.32 zoomBox = new JComboBox(initializeValues());
130.33 zoomBox.setSelectedIndex(4);
130.34 -
130.35 +
130.36 zoomBox.addItemListener(new ZoomFactorItemListener());
130.37 -
130.38 +
130.39 zoomBox.setPreferredSize(COMBO_BOX_SIZE);
130.40 zoomBox.setSize(COMBO_BOX_SIZE);
130.41 this.add(zoomBox);
130.42 this.setMaximumSize(ZOOM_PANEL_SIZE);
130.43 -
130.44 +
130.45 TopComponent.getRegistry().addPropertyChangeListener(this);
130.46 -
130.47 }
130.48 -
130.49 +
130.50 + private void createZoomValue(Vector<ZoomComboBox.ZoomValues> v, String str, double val) {
130.51 + ZoomValues zoomVal = new ZoomValues(str, val);
130.52 + v.add(zoomVal);
130.53 + }
130.54 +
130.55 private Vector initializeValues() {
130.56 - Vector vec = new Vector();
130.57 - ZoomValues val1 = new ZoomValues("400%", 4.0);
130.58 - vec.add(val1);
130.59 - ZoomValues val2 = new ZoomValues("300%", 3.0);
130.60 - vec.add(val2);
130.61 - ZoomValues val3 = new ZoomValues("200%", 2.0);
130.62 - vec.add(val3);
130.63 - ZoomValues val4 = new ZoomValues("150%", 1.5);
130.64 - vec.add(val4);
130.65 - ZoomValues val5 = new ZoomValues("100%", 1.0);
130.66 - vec.add(val5);
130.67 - ZoomValues val6 = new ZoomValues("75%", .75);
130.68 - vec.add(val6);
130.69 - ZoomValues val7 = new ZoomValues("66%", .66);
130.70 - vec.add(val7);
130.71 - ZoomValues val8 = new ZoomValues("50%", .50);
130.72 - vec.add(val8);
130.73 - ZoomValues val9 = new ZoomValues("33%", .33);
130.74 - vec.add(val9);
130.75 - ZoomValues val10 = new ZoomValues("25%", .25);
130.76 - vec.add(val10);
130.77 - ZoomValues val11 = new ZoomValues("Fit", 1.0);
130.78 - vec.add(val11);
130.79 -
130.80 + Vector<ZoomValues> vec = new Vector<ZoomValues>();
130.81 + createZoomValue(vec, "400%", 4.0);
130.82 + createZoomValue(vec, "300%", 3.0);
130.83 + createZoomValue(vec, "200%", 2.0);
130.84 + createZoomValue(vec, "150%", 1.5);
130.85 + createZoomValue(vec, "100%", 1.0);
130.86 + createZoomValue(vec, "75%", .75);
130.87 + createZoomValue(vec, "66%", .66);
130.88 + createZoomValue(vec, "50%", .50);
130.89 + createZoomValue(vec, "33%", .33);
130.90 + createZoomValue(vec, "25%", .25);
130.91 + createZoomValue(vec, "Fit", 1.0);
130.92 return vec;
130.93 }
130.94 -
130.95 +
130.96 /**
130.97 * This method gets called when a bound property is changed.
130.98 *
130.99 @@ -123,9 +113,9 @@
130.100 public void propertyChange(PropertyChangeEvent evt) {
130.101 zoomBox.setEnabled(true);
130.102 }
130.103 -
130.104 +
130.105 class ZoomFactorItemListener implements ItemListener {
130.106 -
130.107 +
130.108 /**
130.109 * Invoked when an item has been selected or deselected by the user. The code
130.110 * written for this method performs the operations that need to occur when an item
130.111 @@ -136,7 +126,7 @@
130.112 if (zoomableComponent != null && val.getValue() != lastValue) {
130.113 zoomableComponent.setZoomFactor(val.getValue());
130.114 }
130.115 -
130.116 +
130.117 lastValue = val.getValue();
130.118 ETLCollaborationTopComponent topComp = null;
130.119 try {
130.120 @@ -147,23 +137,24 @@
130.121 }
130.122 }
130.123 }
130.124 -
130.125 +
130.126 class ZoomValues {
130.127 +
130.128 private String displayValue;
130.129 private double value;
130.130 -
130.131 +
130.132 ZoomValues(String displayValue, double value) {
130.133 this.displayValue = displayValue;
130.134 this.value = value;
130.135 }
130.136 -
130.137 +
130.138 + @Override
130.139 public String toString() {
130.140 return displayValue;
130.141 }
130.142 -
130.143 +
130.144 public double getValue() {
130.145 return this.value;
130.146 }
130.147 }
130.148 }
130.149 -