Author: vyemialyanchyk
Date: 2010-07-30 13:41:10 -0400 (Fri, 30 Jul 2010)
New Revision: 23842
Added:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLStrings.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/
Removed:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/CFS.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenJpa_test1.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenJpa_test2.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenReveng_test1.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenReveng_test2.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGen_test1.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGen_test2.xml
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6518 - adjust code (different names in code) after
code review
Deleted:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/CFS.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/CFS.java 2010-07-30
17:29:09 UTC (rev 23841)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/CFS.java 2010-07-30
17:41:10 UTC (rev 23842)
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.hibernate.console;
-
-/**
- * XML Ant code generation strings
- *
- * @author vitali
- */
-public class CFS {
- //
- public static final String JDBCCONFIGURATION = "jdbcconfiguration";
//$NON-NLS-1$
- public static final String ANNOTATIONCONFIGURATION =
"annotationconfiguration"; //$NON-NLS-1$
- public static final String JPACONFIGURATION = "jpaconfiguration";
//$NON-NLS-1$
- public static final String CONFIGURATION = "configuration"; //$NON-NLS-1$
- //
- public static final String CONFIGURATIONFILE = "configurationFile";
//$NON-NLS-1$
- public static final String PROPERTYFILE = "propertyFile"; //$NON-NLS-1$
- public static final String ENTITYRESOLVER = "entityResolver"; //$NON-NLS-1$
- public static final String NAMINGSTRATEGY = "namingStrategy"; //$NON-NLS-1$
- public static final String PERSISTENCEUNIT = "persistenceUnit"; //$NON-NLS-1$
- public static final String PREFERBASICCOMPOSITEIDS =
"preferBasicCompositeIds"; //$NON-NLS-1$
- public static final String DETECTMANYTOMANY = "detectManyToMany";
//$NON-NLS-1$
- public static final String DETECTONTTOONE = "detectOneToOne"; //$NON-NLS-1$
- public static final String DETECTOPTIMISTICLOCK = "detectOptimisticLock";
//$NON-NLS-1$
- public static final String PACKAGENAME = "packageName"; //$NON-NLS-1$
- public static final String REVENGFILE = "revEngFile"; //$NON-NLS-1$
- public static final String REVERSESTRATEGY = "reverseStrategy"; //$NON-NLS-1$
- public static final String ISREVENG = "isRevEng"; //$NON-NLS-1$
-}
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java 2010-07-30
17:29:09 UTC (rev 23841)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLFactory.java 2010-07-30
17:41:10 UTC (rev 23842)
@@ -59,30 +59,30 @@
protected Element createRoot(Properties properties) {
String rootName = null;
- Boolean jdbcConfig = Boolean.valueOf(additional.getProperty(CFS.ISREVENG,
"false")); //$NON-NLS-1$
+ Boolean jdbcConfig =
Boolean.valueOf(additional.getProperty(ConfigurationXMLStrings.ISREVENG,
"false")); //$NON-NLS-1$
if (jdbcConfig) {
- rootName = CFS.JDBCCONFIGURATION;
+ rootName = ConfigurationXMLStrings.JDBCCONFIGURATION;
} else if (prefs.getConfigurationMode().equals(ConfigurationMode.ANNOTATIONS)) {
- rootName = CFS.ANNOTATIONCONFIGURATION;
+ rootName = ConfigurationXMLStrings.ANNOTATIONCONFIGURATION;
} else if (prefs.getConfigurationMode().equals(ConfigurationMode.JPA)) {
- rootName = CFS.JPACONFIGURATION;
+ rootName = ConfigurationXMLStrings.JPACONFIGURATION;
} else if (prefs.getConfigurationMode().equals(ConfigurationMode.CORE)) {
- rootName = CFS.CONFIGURATION;
+ rootName = ConfigurationXMLStrings.CONFIGURATION;
} else {
rootName = "undef"; //$NON-NLS-1$
}
Element root = DocumentFactory.getInstance().createElement(rootName);
- updateAttr(root, file2Str(getPreferences().getConfigXMLFile()),
CFS.CONFIGURATIONFILE);
- updateAttr(root, file2Str(getPreferences().getPropertyFile()), CFS.PROPERTYFILE);
- updateAttr(root, getPreferences().getEntityResolverName(), CFS.ENTITYRESOLVER);
- updateAttr(root, getPreferences().getNamingStrategy(), CFS.NAMINGSTRATEGY);
- updateAttr(root, getPreferences().getPersistenceUnitName(), CFS.PERSISTENCEUNIT);
- updateAttr(root, additional, CFS.DETECTMANYTOMANY);
- updateAttr(root, additional, CFS.DETECTONTTOONE);
- updateAttr(root, additional, CFS.DETECTOPTIMISTICLOCK);
- updateAttr(root, additional, CFS.PACKAGENAME);
- updateAttr(root, additional, CFS.REVENGFILE);
- updateAttr(root, additional, CFS.REVERSESTRATEGY);
+ updateAttr(root, file2Str(getPreferences().getConfigXMLFile()),
ConfigurationXMLStrings.CONFIGURATIONFILE);
+ updateAttr(root, file2Str(getPreferences().getPropertyFile()),
ConfigurationXMLStrings.PROPERTYFILE);
+ updateAttr(root, getPreferences().getEntityResolverName(),
ConfigurationXMLStrings.ENTITYRESOLVER);
+ updateAttr(root, getPreferences().getNamingStrategy(),
ConfigurationXMLStrings.NAMINGSTRATEGY);
+ updateAttr(root, getPreferences().getPersistenceUnitName(),
ConfigurationXMLStrings.PERSISTENCEUNIT);
+ updateAttr(root, additional, ConfigurationXMLStrings.DETECTMANYTOMANY);
+ updateAttr(root, additional, ConfigurationXMLStrings.DETECTONTTOONE);
+ updateAttr(root, additional, ConfigurationXMLStrings.DETECTOPTIMISTICLOCK);
+ updateAttr(root, additional, ConfigurationXMLStrings.PACKAGENAME);
+ updateAttr(root, additional, ConfigurationXMLStrings.REVENGFILE);
+ updateAttr(root, additional, ConfigurationXMLStrings.REVERSESTRATEGY);
// includeMappings
File[] mappingFiles = prefs.getMappingFiles();
if (mappingFiles.length > 0) {
@@ -98,7 +98,7 @@
}
public static String file2Str(File file) {
- return file == null ? null : file.toString();
+ return file == null ? null : file.getPath();
}
public static void updateAttr(Element el, String val, String prName) {
@@ -115,13 +115,13 @@
}
public static void dump(OutputStream os, Element element) {
+ // try to "pretty print" it
+ OutputFormat outformat = OutputFormat.createPrettyPrint();
try {
- // try to "pretty print" it
- OutputFormat outformat = OutputFormat.createPrettyPrint();
XMLWriter writer = new XMLWriter(os, outformat);
writer.write(element);
writer.flush();
- } catch (Throwable t) {
+ } catch (IOException e1) {
// otherwise, just dump it
try {
os.write(element.asXML().getBytes());
Copied:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLStrings.java
(from rev 23786,
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/CFS.java)
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLStrings.java
(rev 0)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationXMLStrings.java 2010-07-30
17:41:10 UTC (rev 23842)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.hibernate.console;
+
+/**
+ * XML Ant code generation strings for definition of configuration part
+ *
+ * @author vitali
+ */
+public interface ConfigurationXMLStrings {
+ //
+ public static final String JDBCCONFIGURATION = "jdbcconfiguration";
//$NON-NLS-1$
+ public static final String ANNOTATIONCONFIGURATION =
"annotationconfiguration"; //$NON-NLS-1$
+ public static final String JPACONFIGURATION = "jpaconfiguration";
//$NON-NLS-1$
+ public static final String CONFIGURATION = "configuration"; //$NON-NLS-1$
+ //
+ public static final String CONFIGURATIONFILE = "configurationFile";
//$NON-NLS-1$
+ public static final String PROPERTYFILE = "propertyFile"; //$NON-NLS-1$
+ public static final String ENTITYRESOLVER = "entityResolver"; //$NON-NLS-1$
+ public static final String NAMINGSTRATEGY = "namingStrategy"; //$NON-NLS-1$
+ public static final String PERSISTENCEUNIT = "persistenceUnit"; //$NON-NLS-1$
+ public static final String PREFERBASICCOMPOSITEIDS =
"preferBasicCompositeIds"; //$NON-NLS-1$
+ public static final String DETECTMANYTOMANY = "detectManyToMany";
//$NON-NLS-1$
+ public static final String DETECTONTTOONE = "detectOneToOne"; //$NON-NLS-1$
+ public static final String DETECTOPTIMISTICLOCK = "detectOptimisticLock";
//$NON-NLS-1$
+ public static final String PACKAGENAME = "packageName"; //$NON-NLS-1$
+ public static final String REVENGFILE = "revEngFile"; //$NON-NLS-1$
+ public static final String REVERSESTRATEGY = "reverseStrategy"; //$NON-NLS-1$
+ public static final String ISREVENG = "isRevEng"; //$NON-NLS-1$
+}
Copied: trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample (from rev
23786, trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen)
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenJpa_test1.xml
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenJpa_test1.xml 2010-07-29
00:05:11 UTC (rev 23786)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenJpa_test1.xml 2010-07-30
17:41:10 UTC (rev 23842)
@@ -1,11 +1,11 @@
-<project name="CodeGen" default="JdbcCodeGen">
+<project name="CodeGen" default="hibernateAntCodeGeneration">
<property name="build.dir" location="ResLocation/test"/>
<path id="toolslib">
<path location="ejb3-persistence.jar"/>
<path location="hibernate3.jar"/>
<path location="hsqldb.jar"/>
</path>
- <target name="JdbcCodeGen">
+ <target name="hibernateAntCodeGeneration">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib"/>
<hibernatetool destdir="${build.dir}">
<jpaconfiguration namingStrategy="testNamingStrategy"
persistenceUnit="testPersistenceUnit">
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenJpa_test2.xml
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenJpa_test2.xml 2010-07-29
00:05:11 UTC (rev 23786)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenJpa_test2.xml 2010-07-30
17:41:10 UTC (rev 23842)
@@ -1,11 +1,11 @@
-<project name="CodeGen" default="JdbcCodeGen">
+<project name="CodeGen" default="hibernateAntCodeGeneration">
<property name="build.dir" location="ResLocation/test"/>
<path id="toolslib">
<path location="ejb3-persistence.jar"/>
<path location="hibernate3.jar"/>
<path location="hsqldb.jar"/>
</path>
- <target name="JdbcCodeGen">
+ <target name="hibernateAntCodeGeneration">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib"/>
<hibernatetool destdir="${build.dir}">
<jpaconfiguration namingStrategy="testNamingStrategy"
persistenceUnit="testPersistenceUnit">
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenReveng_test1.xml
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test1.xml 2010-07-29
00:05:11 UTC (rev 23786)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenReveng_test1.xml 2010-07-30
17:41:10 UTC (rev 23842)
@@ -1,7 +1,7 @@
-<project name="CodeGen" default="JdbcCodeGen">
+<project name="CodeGen" default="hibernateAntCodeGeneration">
<property name="build.dir" location="ResLocation/test"/>
<path id="toolslib"/>
- <target name="JdbcCodeGen">
+ <target name="hibernateAntCodeGeneration">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib"/>
<hibernatetool destdir="${build.dir}">
<jdbcconfiguration configurationFile="project\src\hibernate.cfg.xml"
detectManyToMany="true" detectOneToOne="true"
detectOptimisticLock="true" revEngFile="ResLocation/test"/>
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenReveng_test2.xml
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGenReveng_test2.xml 2010-07-29
00:05:11 UTC (rev 23786)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGenReveng_test2.xml 2010-07-30
17:41:10 UTC (rev 23842)
@@ -1,7 +1,7 @@
-<project name="CodeGen" default="JdbcCodeGen">
+<project name="CodeGen" default="hibernateAntCodeGeneration">
<property name="build.dir" location="ResLocation/test"/>
<path id="toolslib"/>
- <target name="JdbcCodeGen">
+ <target name="hibernateAntCodeGeneration">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib"/>
<hibernatetool destdir="${build.dir}">
<jdbcconfiguration configurationFile="project\src\hibernate.cfg.xml"
detectManyToMany="true" detectOneToOne="true"
detectOptimisticLock="true" revEngFile="ResLocation/test"/>
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGen_test1.xml
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test1.xml 2010-07-29
00:05:11 UTC (rev 23786)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGen_test1.xml 2010-07-30
17:41:10 UTC (rev 23842)
@@ -1,7 +1,7 @@
-<project name="CodeGen" default="JdbcCodeGen">
+<project name="CodeGen" default="hibernateAntCodeGeneration">
<property name="build.dir" location="ResLocation/test"/>
<path id="toolslib"/>
- <target name="JdbcCodeGen">
+ <target name="hibernateAntCodeGeneration">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib"/>
<hibernatetool destdir="${build.dir}">
<configuration configurationFile="project\src\hibernate.cfg.xml"/>
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGen_test2.xml
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/specimen/AntCodeGen_test2.xml 2010-07-29
00:05:11 UTC (rev 23786)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/res/sample/AntCodeGen_test2.xml 2010-07-30
17:41:10 UTC (rev 23842)
@@ -1,7 +1,7 @@
-<project name="CodeGen" default="JdbcCodeGen">
+<project name="CodeGen" default="hibernateAntCodeGeneration">
<property name="build.dir" location="ResLocation/test"/>
<path id="toolslib"/>
- <target name="JdbcCodeGen">
+ <target name="hibernateAntCodeGeneration">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib"/>
<hibernatetool destdir="${build.dir}">
<configuration configurationFile="project\src\hibernate.cfg.xml"/>
Modified:
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java
===================================================================
---
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java 2010-07-30
17:29:09 UTC (rev 23841)
+++
trunk/hibernatetools/tests/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/CodeGenXMLFactoryTest.java 2010-07-30
17:41:10 UTC (rev 23842)
@@ -46,7 +46,7 @@
*/
public class CodeGenXMLFactoryTest extends TestCase {
- public static final String SPECIMEN_PATH =
"res/specimen/".replaceAll("//", File.separator); //$NON-NLS-1$
//$NON-NLS-2$
+ public static final String SAMPLE_PATH =
"res/sample/".replaceAll("//", File.separator); //$NON-NLS-1$
//$NON-NLS-2$
public static final String PROJECT_LIB_PATH =
"res/project/lib/".replaceAll("//", File.separator); //$NON-NLS-1$
//$NON-NLS-2$
public static final String HBMTEMPLATE0 = "hbm2java"; //$NON-NLS-1$
@@ -183,8 +183,7 @@
} catch (MalformedURLException e) {
} catch (URISyntaxException e) {
}
- codeGen = CodeGenXMLFactory.replaceString(codeGen, repl + File.separator,
""); //$NON-NLS-1$
- return codeGen;
+ return codeGen.replace(repl + File.separator, ""); //$NON-NLS-1$
}
public String codeGenXMLFactory(boolean reveng, boolean exportersAll, boolean jpa) {
@@ -231,7 +230,7 @@
public String getSpecimen(String fileName) {
File resourceFile = null;
try {
- resourceFile = getResourceItem(SPECIMEN_PATH + fileName);
+ resourceFile = getResourceItem(SAMPLE_PATH + fileName);
} catch (IOException e1) {
}
if (resourceFile == null || !resourceFile.exists()) {