You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(22) |
Nov
(308) |
Dec
(131) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(369) |
Feb
(171) |
Mar
(236) |
Apr
(187) |
May
(218) |
Jun
(217) |
Jul
(127) |
Aug
(448) |
Sep
(270) |
Oct
(231) |
Nov
(422) |
Dec
(255) |
2004 |
Jan
(111) |
Feb
(73) |
Mar
(338) |
Apr
(351) |
May
(349) |
Jun
(495) |
Jul
(394) |
Aug
(1048) |
Sep
(499) |
Oct
(142) |
Nov
(269) |
Dec
(638) |
2005 |
Jan
(825) |
Feb
(1272) |
Mar
(593) |
Apr
(690) |
May
(950) |
Jun
(958) |
Jul
(767) |
Aug
(839) |
Sep
(525) |
Oct
(449) |
Nov
(585) |
Dec
(455) |
2006 |
Jan
(603) |
Feb
(656) |
Mar
(195) |
Apr
(114) |
May
(136) |
Jun
(100) |
Jul
(128) |
Aug
(68) |
Sep
(7) |
Oct
(1) |
Nov
(1) |
Dec
(8) |
2007 |
Jan
(4) |
Feb
(3) |
Mar
(8) |
Apr
(16) |
May
(5) |
Jun
(4) |
Jul
(6) |
Aug
(23) |
Sep
(15) |
Oct
(5) |
Nov
(7) |
Dec
(5) |
2008 |
Jan
(5) |
Feb
(1) |
Mar
(1) |
Apr
(5) |
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <max...@us...> - 2006-02-08 08:02:11
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15969/META-INF Modified Files: MANIFEST.MF Log Message: integrate unit tests into eclipse test run Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/META-INF/MANIFEST.MF,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- MANIFEST.MF 25 Jan 2006 10:09:54 -0000 1.6 +++ MANIFEST.MF 8 Feb 2006 08:02:03 -0000 1.7 @@ -3,7 +3,10 @@ Bundle-Name: Hibernate Console Test Plug-in Bundle-SymbolicName: org.hibernate.eclipse.console.test Bundle-Version: 3.1.0.beta4 -Bundle-ClassPath: org.hibernate.eclipse.console.test.test/ +Bundle-ClassPath: org.hibernate.eclipse.console.test.test/, + lib/hibernate-tools-tests.jar, + lib/hsqldb.jar, + lib/jaxen-1.1-beta-7.jar Bundle-Vendor: Hibernate Team Bundle-Localization: plugin Export-Package: org.hibernate.eclipse.console.test @@ -22,3 +25,4 @@ org.hibernate.eclipse.console Eclipse-AutoStart: true Bundle-Activator: org.hibernate.eclipse.console.test.HibernateConsoleTestPlugin +Eclipse-RegisterBuddy: org.hibernate.eclipse |
From: <max...@us...> - 2006-02-08 08:01:21
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15921/lib Log Message: Directory /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/lib added to the repository |
From: <max...@us...> - 2006-02-08 08:00:53
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15588/META-INF Modified Files: MANIFEST.MF Log Message: enable eclipse buddy loading to allow hibernate to see test plugins persistent classes. Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/META-INF/MANIFEST.MF,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- MANIFEST.MF 7 Feb 2006 14:10:49 -0000 1.32 +++ MANIFEST.MF 8 Feb 2006 08:00:44 -0000 1.33 @@ -403,3 +403,4 @@ org.w3c.tidy.ant Require-Bundle: org.eclipse.core.runtime Eclipse-AutoStart: true +Eclipse-BuddyPolicy: registered |
From: <max...@us...> - 2006-02-08 08:00:53
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15588/src/org/hibernate/console Modified Files: ConsoleConfiguration.java Log Message: enable eclipse buddy loading to allow hibernate to see test plugins persistent classes. Index: ConsoleConfiguration.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/console/ConsoleConfiguration.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ConsoleConfiguration.java 7 Oct 2005 10:19:36 -0000 1.7 +++ ConsoleConfiguration.java 8 Feb 2006 08:00:45 -0000 1.8 @@ -331,6 +331,10 @@ public void removeConsoleConfigurationListener(ConsoleConfigurationListener sfListener) { consoleCfgListeners.remove(sfListener); } + + public ConsoleConfigurationListener[] getConsoleConfigurationListeners() { + return (ConsoleConfigurationListener[]) consoleCfgListeners.toArray(new ConsoleConfigurationListener[consoleCfgListeners.size()]); + } public void executeJavaQuery(final String text) { execute(new ExecutionContext.Command() { |
From: <max...@us...> - 2006-02-08 07:59:53
|
Update of /cvsroot/hibernate/HibernateExt/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14961 Modified Files: build.xml Log Message: build of jar with tests for usage in eclipse testing Index: build.xml =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/build.xml,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- build.xml 6 Feb 2006 09:08:09 -0000 1.28 +++ build.xml 8 Feb 2006 07:59:45 -0000 1.29 @@ -48,6 +48,27 @@ </copy> </target> + <target name="compiletest" depends="common-build.compiletest"> + <copy todir="${testclasses.dir}"> + <fileset dir="src/test"> + <exclude name="**/*.java"/> + </fileset> + </copy> + + <copy todir="${testclasses.dir}"> + <fileset dir="src/testsupport"/> + </copy> + + <copy todir="${testclasses.dir}"> + <fileset dir="src/testoutputdependent"/> + </copy> + <copy todir="${testclasses.dir}"> + <fileset dir="${src.dir}" includes="**/*jtidy.properties"/> + </copy> + </target> + + <target name="dist" depends="jartest,common-build.dist"/> + <!-- <target name="genjar" depends="init"> <taskdef resource="genjar.properties" classpath="C:\work\products\GenJar\genjar.jar"/> |
From: <max...@us...> - 2006-02-08 07:59:49
|
Update of /cvsroot/hibernate/HibernateExt/common In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14945 Modified Files: common-build.xml Log Message: build of jar with tests for usage in eclipse testing Index: common-build.xml =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/common/common-build.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- common-build.xml 15 Nov 2005 16:03:41 -0000 1.21 +++ common-build.xml 8 Feb 2006 07:59:41 -0000 1.22 @@ -15,6 +15,7 @@ <property name="lib.dir" location="lib"/> <property name="build.dir" location="build"/> <property name="classes.dir" location="${build.dir}/classes"/> + <property name="testclasses.dir" location="${build.dir}/testclasses"/> <property name="dist.target.dir" location="target"/> <property name="dist.dir" location="${dist.target.dir}/${name}"/> <property name="instrumenttest.out.dir" value="instrumenttestout"/> @@ -30,6 +31,7 @@ <property name="dist.lib.dir" location="${dist.dir}/lib"/> <property name="jar.name" value="${name}"/> <property name="jar.file.name" value="${dist.dir}/${jar.name}.jar"/> + <property name="jartest.file.name" value="${dist.dir}/${jar.name}-tests.jar"/> <property name="javadoc" value="http://java.sun.com/j2se/1.4/docs/api"/> <property name="javac.debug" value="on"/> @@ -109,7 +111,7 @@ </patternset> <!-- junit paths/filesets --> - <fileset dir="${classes.dir}" id="junit.batchtestset"> + <fileset dir="${testclasses.dir}" id="junit.batchtestset"> <include name="**/*Test.class"/> </fileset> @@ -127,6 +129,7 @@ <include name="*.jar"/> </fileset> <pathelement path="${classes.dir}"/> + <pathelement path="${testclasses.dir}"/> <path refid="lib.class.path"/> <path refid="junit.moduleclasspath"/> <path location="${clover.jar}"/> @@ -164,12 +167,14 @@ </tstamp> <echo message="Build ${Name}-${version} (${subversion})"/> <mkdir dir="${classes.dir}"/> + <mkdir dir="${testclasses.dir}"/> <copy todir="${classes.dir}"> <fileset dir="${src.dir}"> <patternset refid="support.files"/> </fileset> - </copy> - <copy todir="${build.dir}"> + </copy> + + <copy todir="${build.dir}"> <fileset dir="."> <include name="readme.txt"/> <include name="lgpl.txt"/> @@ -205,7 +210,9 @@ value="org.eclipse.jdt.core.JDTCompilerAdapter" classpath="${java.class.path}"/> <javac - destdir="${classes.dir}" + target="1.4" + source="1.4" + destdir="${testclasses.dir}" classpathref="junit.classpath" debug="${javac.debug}" optimize="${javac.optimize}" @@ -219,11 +226,12 @@ <taskdef name="instrument" classname="org.hibernate.tool.instrument.InstrumentTask"> <classpath path="${classes.dir}"/> + <classpath path="${testclasses.dir}"/> <classpath refid="lib.class.path"/> </taskdef> <instrument verbose="true"> - <fileset dir="${classes.dir}/org/hibernate/test"> + <fileset dir="${testclasses.dir}/org/hibernate/test"> <include name="**/*.class"/> <exclude name="**/*Test$*.class"/> <exclude name="**/*Test.class"/> @@ -294,6 +302,11 @@ <jar filesetmanifest="merge" jarfile="${jar.file.name}" basedir="${classes.dir}"/> </target> + <target name="jartest" depends="compiletest" description="Build the distribution .jar file"> + <mkdir dir="${dist.dir}"/> + <jar filesetmanifest="merge" jarfile="${jartest.file.name}" basedir="${testclasses.dir}"/> + </target> + <!-- DOCUMENTATION --> <target name="javadoc" description="Compile the Javadoc API documentation to dist dir"> |
From: <tu...@us...> - 2006-02-07 20:42:49
|
Update of /cvsroot/hibernate/Hibernate3/doc/reference/en/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv813/doc/reference/en/modules Modified Files: architecture.xml configuration.xml transactions.xml Log Message: Added "managed" option for current_session_context_class Index: architecture.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/doc/reference/en/modules/architecture.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- architecture.xml 7 Oct 2005 13:28:50 -0000 1.9 +++ architecture.xml 7 Feb 2006 20:42:41 -0000 1.10 @@ -265,7 +265,7 @@ </para> </sect1> - <sect1 id="architecture-current-session" revision="1"> + <sect1 id="architecture-current-session" revision="2"> <title>Contextual Sessions</title> <para> Most applications using Hibernate need some form of "contextual" sessions, where a given @@ -316,16 +316,24 @@ sessions are tracked by thread of execution. Again, see the Javadocs for details. </para> </listitem> + <listitem> + <para> + <literal>org.hibernate.context.ManagedSessionContext</literal> - current + sessions are tracked by thread of execution. However, you are responsible to + bind and unbind a <literal>Session</literal> instance with static methods + on this class, it does never open, flush, or close a <literal>Session</literal>. + </para> + </listitem> </itemizedlist> <para> - Both implementations provide a "one session - one database transaction" programming + The first two implementations provide a "one session - one database transaction" programming model, also known and used as <emphasis>session-per-request</emphasis>. The beginning and end of a Hibernate session is defined by the duration of a database transaction. - If you use programatic transaction demarcation (e.g. in pure J2SE or with - JTA/UserTransaction/BMT), you are adviced to use the Hibernate <literal>Transaction</literal> - API to hide the underlying transaction system from your code. If you execute in - an EJB container that supports CMT, transaction boundaries are defined declaratively + If you use programatic transaction demarcation in plain JSE without JTA, you are adviced to + use the Hibernate <literal>Transaction</literal> API to hide the underlying transaction system + from your code. If you use JTA, use the JTA interfaces to demarcate transactions. If you + execute in an EJB container that supports CMT, transaction boundaries are defined declaratively and you don't need any transaction or session demarcation operations in your code. Refer to <xref linkend="transactions"/> for more information and code examples. </para> @@ -337,8 +345,8 @@ but a <literal>org.hibernate.transaction.TransactionManagerLookup</literal> is configured, Hibernate will use the <literal>org.hibernate.context.JTASessionContext</literal>. Typically, the value of this parameter would just name the implementation class to - use; for the two out-of-the-box implementations, however, there are two corresponding - short names, "jta" and "thread". + use; for the three out-of-the-box implementations, however, there are two corresponding + short names, "jta", "thread", and "managed". </para> </sect1> Index: configuration.xml =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/doc/reference/en/modules/configuration.xml,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- configuration.xml 7 Oct 2005 13:28:50 -0000 1.44 +++ configuration.xml 7 Feb 2006 20:42:41 -0000 1.45 @@ -920,7 +920,7 @@ </tgroup> </table> - <table frame="topbot" id="configuration-misc-properties" revision="9"> + <table frame="topbot" id="configuration-misc-properties" revision="10"> <title>Miscellaneous Properties</title> <tgroup cols="2"> <colspec colname="c1" colwidth="1*"/> @@ -944,7 +944,7 @@ <para> <emphasis role="strong">eg.</emphasis> <literal>jta</literal> | <literal>thread</literal> | - <literal>custom.Class</literal> + <literal>managed</literal> | <literal>custom.Class</literal> </para> </entry> </row> |
From: <tu...@us...> - 2006-02-07 20:42:49
|
Update of /cvsroot/hibernate/Hibernate3/src/org/hibernate/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv813/src/org/hibernate/impl Modified Files: SessionFactoryImpl.java Log Message: Added "managed" option for current_session_context_class Index: SessionFactoryImpl.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate3/src/org/hibernate/impl/SessionFactoryImpl.java,v retrieving revision 1.104 retrieving revision 1.105 diff -u -d -r1.104 -r1.105 --- SessionFactoryImpl.java 1 Feb 2006 19:58:27 -0000 1.104 +++ SessionFactoryImpl.java 7 Feb 2006 20:42:41 -0000 1.105 @@ -36,6 +36,7 @@ import org.hibernate.context.CurrentSessionContext; import org.hibernate.context.ThreadLocalSessionContext; import org.hibernate.context.JTASessionContext; +import org.hibernate.context.ManagedSessionContext; import org.hibernate.cache.Cache; import org.hibernate.cache.CacheConcurrencyStrategy; import org.hibernate.cache.CacheFactory; @@ -945,6 +946,9 @@ else if ( "thread".equals( impl ) ) { return new ThreadLocalSessionContext( this ); } + else if ( "managed".equals( impl ) ) { + return new ManagedSessionContext( this ); + } else { try { Class implClass = ReflectHelper.classForName( impl ); |
From: <max...@us...> - 2006-02-07 20:26:37
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25715 Modified Files: .classpath Log Message: eclipse code formatting - now we detect the javaproject per file - making it work generically for all type of code generation. HBX-580 automatic refreshing for the output directory is now enabled by default. Index: .classpath =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/.classpath,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- .classpath 7 Feb 2006 16:17:53 -0000 1.30 +++ .classpath 7 Feb 2006 20:26:24 -0000 1.31 @@ -22,7 +22,7 @@ <classpathentry exported="true" kind="lib" path="lib/hibernate/oscache-2.1.jar"/> <classpathentry exported="true" kind="lib" path="lib/hibernate/proxool-0.8.3.jar"/> <classpathentry exported="true" kind="lib" path="lib/hibernate/swarmcache-1.0rc2.jar"/> - <classpathentry exported="true" kind="lib" path="lib/tools/hibernate-tools.jar"/> + <classpathentry exported="true" sourcepath="/hibernateext.tools" kind="lib" path="lib/tools/hibernate-tools.jar"/> <classpathentry exported="true" kind="lib" path="lib/tools/jtidy-r8-21122004.jar"/> <classpathentry exported="true" sourcepath="/freemarker" kind="lib" path="lib/tools/freemarker.jar"/> <classpathentry exported="true" kind="lib" path="lib/bsh-core-2.0b4.jar"/> |
From: <max...@us...> - 2006-02-07 20:26:35
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25715/lib/tools Modified Files: hibernate-tools.jar Log Message: eclipse code formatting - now we detect the javaproject per file - making it work generically for all type of code generation. HBX-580 automatic refreshing for the output directory is now enabled by default. Index: hibernate-tools.jar =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/tools/hibernate-tools.jar,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 Binary files /tmp/cvs7Dbqfx and /tmp/cvsUdAabq differ |
From: <max...@us...> - 2006-02-07 20:26:20
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25685/src/org/hibernate/eclipse/launch Modified Files: CodeGenerationLaunchDelegate.java Log Message: eclipse code formatting - now we detect the javaproject per file - making it work generically for all type of code generation. HBX-580 automatic refreshing for the output directory is now enabled by default. Index: CodeGenerationLaunchDelegate.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console/src/org/hibernate/eclipse/launch/CodeGenerationLaunchDelegate.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- CodeGenerationLaunchDelegate.java 7 Feb 2006 16:17:49 -0000 1.8 +++ CodeGenerationLaunchDelegate.java 7 Feb 2006 20:26:10 -0000 1.9 @@ -11,6 +11,7 @@ import org.eclipse.core.filebuffers.manipulation.FileBufferOperationRunner; import org.eclipse.core.filebuffers.manipulation.MultiTextEditWithProgress; import org.eclipse.core.filebuffers.manipulation.TextFileBufferOperation; +import org.eclipse.core.internal.resources.Workspace; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; @@ -26,6 +27,8 @@ import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.model.LaunchConfigurationDelegate; import org.eclipse.debug.ui.RefreshTab; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.ToolFactory; import org.eclipse.jdt.core.formatter.CodeFormatter; import org.eclipse.jface.text.Document; @@ -33,6 +36,7 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.jface.util.Assert; import org.eclipse.text.edits.TextEdit; +import org.eclipse.ui.actions.WorkspaceAction; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.JDBCMetaDataConfiguration; import org.hibernate.cfg.reveng.DefaultReverseEngineeringStrategy; @@ -56,6 +60,41 @@ public class CodeGenerationLaunchDelegate extends LaunchConfigurationDelegate { + private static final class FormatGeneratedCode extends TextFileBufferOperation { + private FormatGeneratedCode(String name) { + super( name ); + } + + protected DocumentRewriteSessionType getDocumentRewriteSessionType() { + return DocumentRewriteSessionType.SEQUENTIAL; + } + + protected MultiTextEditWithProgress computeTextEdit( + ITextFileBuffer textFileBuffer, IProgressMonitor progressMonitor) + throws CoreException, OperationCanceledException { + + IResource bufferRes = ResourcesPlugin.getWorkspace().getRoot().findMember(textFileBuffer.getLocation()); + Map options = null; + if(bufferRes!=null) { + IJavaProject project = JavaCore.create(bufferRes.getProject()); + options = project.getOptions(true); + } + + CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(options); + + IDocument document = textFileBuffer.getDocument(); + String string = document.get(); + TextEdit edit = codeFormatter.format(CodeFormatter.K_COMPILATION_UNIT, string, 0, string.length(), 0, null); + MultiTextEditWithProgress multiTextEditWithProgress = new MultiTextEditWithProgress(getOperationName()); + if(edit==null) { + //HibernateConsolePlugin.getDefault().log("empty format for " + textFileBuffer.getLocation().toOSString()); + } else { + multiTextEditWithProgress.addChild(edit); + } + return multiTextEditWithProgress; + } + } + private static final String PREFIX = "org.hibernate.tools."; // move to HibernateLaunchConstants public void launch(ILaunchConfiguration configuration, String mode, @@ -84,11 +123,17 @@ if(!useOwnTemplates) { templatedir = null; } - doFinish(consoleConfigurationName, pathOrNull(outputdir), packageName, pathOrNull(reverseEngineeringSettings), reverseEngineeringStrategy, reverseengineer, generatejava, generatedao, generatemappings, generatecfgfile, monitor, preferBasicCompositeIds, pathOrNull(templatedir), enableEJB3annotations, enableJDK5, generatedocs, generateseam, monitor); + + ArtifactCollector collector = runExporters(consoleConfigurationName, pathOrNull(outputdir), packageName, pathOrNull(reverseEngineeringSettings), reverseEngineeringStrategy, reverseengineer, generatejava, generatedao, generatemappings, generatecfgfile, monitor, preferBasicCompositeIds, pathOrNull(templatedir), enableEJB3annotations, enableJDK5, generatedocs, generateseam, monitor); - // refresh resources - RefreshTab.refreshResources(configuration, monitor); + refreshOutputDir( outputdir ); + if(collector==null) return; + + formatGeneratedCode( monitor, collector ); + + RefreshTab.refreshResources(configuration, monitor); + } catch(Exception e) { throw new CoreException(HibernateConsolePlugin.throwableToStatus(e, 666)); } finally { @@ -96,6 +141,43 @@ } } + + private void formatGeneratedCode(IProgressMonitor monitor, ArtifactCollector collector) { + final TextFileBufferOperation operation = new FormatGeneratedCode( "java-artifact-format" ); + + File[] javaFiles = collector.getFiles("java"); + if(javaFiles.length>0) { + IPath[] locations = new IPath[javaFiles.length]; + + for (int i = 0; i < javaFiles.length; i++) { + File file = javaFiles[i]; + locations[i] = new Path(file.getPath()); + } + + FileBufferOperationRunner runner= new FileBufferOperationRunner(FileBuffers.getTextFileBufferManager(), HibernateConsolePlugin.getShell()); + try { + runner.execute(locations, operation, monitor); + } + catch (OperationCanceledException e) { + HibernateConsolePlugin.getDefault().logErrorMessage("java format cancelled", e); + } + catch (CoreException e) { + HibernateConsolePlugin.getDefault().logErrorMessage("exception during java format", e); + } + } + } + + private void refreshOutputDir(String outputdir) { + IResource bufferRes = ResourcesPlugin.getWorkspace().getRoot().findMember(pathOrNull(outputdir)); + + if (bufferRes != null && bufferRes.isAccessible()) { + try { + bufferRes.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e) { + //ignore, maybe merge into possible existing status. + } + } + } private Path pathOrNull(String p) { if(p==null || p.trim().length()==0) { @@ -105,7 +187,7 @@ } } - private void doFinish( + private ArtifactCollector runExporters( String configName, IPath output, String outputPackage, IPath revengsettings, String reverseEngineeringStrategy, boolean reveng, final boolean genjava, final boolean gendao, final boolean genhbm, final boolean gencfg, final IProgressMonitor monitor, boolean preferBasicCompositeids, IPath templateDir, final boolean ejb3, final boolean generics, final boolean gendoc, final boolean generateseam, IProgressMonitor monitor2) throws CoreException { @@ -113,7 +195,7 @@ monitor.beginTask("Generating code for " + configName, 10); if (monitor.isCanceled()) - return; + return null; IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); @@ -149,62 +231,10 @@ monitor.worked(3); if (monitor.isCanceled()) - return; + return null; - cc.execute(new Command() { - private ArtifactCollector artifactCollector = new ArtifactCollector() { - public void formatFiles() { - super.formatFiles(); - - Map codeFormatterOptions = null; - final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(codeFormatterOptions); - final TextFileBufferOperation operation = new TextFileBufferOperation("java-artifact-format") { - - protected DocumentRewriteSessionType getDocumentRewriteSessionType() { - return DocumentRewriteSessionType.SEQUENTIAL; - } - - protected MultiTextEditWithProgress computeTextEdit( - ITextFileBuffer textFileBuffer, IProgressMonitor progressMonitor) - throws CoreException, OperationCanceledException { - - IDocument document = textFileBuffer.getDocument(); - String string = document.get(); - TextEdit edit = codeFormatter.format(CodeFormatter.K_UNKNOWN, string, 0, string.length(), 0, null); - MultiTextEditWithProgress multiTextEditWithProgress = new MultiTextEditWithProgress(getOperationName()); - if(edit==null) { - HibernateConsolePlugin.getDefault().log("empty format for " + textFileBuffer.getLocation().toOSString()); - } else { - - multiTextEditWithProgress.addChild(edit); - } - return multiTextEditWithProgress; - } - - }; - - File[] javaFiles = getFiles("java"); - if(javaFiles.length>0) { - IPath[] locations = new IPath[javaFiles.length]; - - for (int i = 0; i < javaFiles.length; i++) { - File file = javaFiles[i]; - locations[i] = new Path(file.getPath()); - } - FileBufferOperationRunner runner= new FileBufferOperationRunner(FileBuffers.getTextFileBufferManager(), HibernateConsolePlugin.getShell()); - try { - runner.execute(locations, operation, monitor); - } - catch (OperationCanceledException e) { - HibernateConsolePlugin.getDefault().logErrorMessage("java format cancelled", e); - } - catch (CoreException e) { - HibernateConsolePlugin.getDefault().logErrorMessage("exception during java format", e); - } - } - - } - }; + return (ArtifactCollector) cc.execute(new Command() { + private ArtifactCollector artifactCollector = new ArtifactCollector(); public Object execute() { File outputdir = getLocation( resource ).toFile(); @@ -280,7 +310,7 @@ } monitor.worked(10); - return null; + return getArtififactCollector(); } private void configureExporter(final Configuration cfg, File outputdir, String[] templatePaths, Properties props, Exporter exporter) { @@ -295,6 +325,8 @@ return artifactCollector ; } }); + + } private IPath getLocation(final IResource resource) { |
From: <max...@us...> - 2006-02-07 20:22:59
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24167/src/test/org/hibernate/tool/hbm2x Modified Files: Hbm2SeamTest.java Log Message: make seam report code generation to the artifact collector Index: Hbm2SeamTest.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/test/org/hibernate/tool/hbm2x/Hbm2SeamTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Hbm2SeamTest.java 25 Jan 2006 15:59:28 -0000 1.3 +++ Hbm2SeamTest.java 7 Feb 2006 20:22:46 -0000 1.4 @@ -15,6 +15,8 @@ */ public class Hbm2SeamTest extends NonReflectiveTestCase { + private ArtifactCollector artifactCollector; + public Hbm2SeamTest(String name) { super( name, "hbm2seamoutput" ); } @@ -25,6 +27,8 @@ SeamExporter exporter = new SeamExporter(getCfg(), getOutputDir() ); exporter.start(); + artifactCollector = exporter.getArtifactCollector(); + } protected void tearDown() throws Exception { @@ -35,7 +39,11 @@ assertFileAndExists(new File(getOutputDir(), "src/org/hibernate/tool/hbm2x/Article.java") ); assertFileAndExists(new File(getOutputDir(), "src/org/hibernate/tool/hbm2x/Author.java") ); assertFileAndExists(new File(getOutputDir(), "resources/jsp/editAuthor.jsp") ); - assertFileAndExists(new File(getOutputDir(), "build.xml") ); + assertFileAndExists(new File(getOutputDir(), "build.xml") ); + } + + public void testArtifactCollection() { + assertEquals(artifactCollector.getFileCount("java"), 2); } |
From: <max...@us...> - 2006-02-07 20:22:59
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/seam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24167/src/java/org/hibernate/tool/hbm2x/seam Modified Files: SeamExporter.java Log Message: make seam report code generation to the artifact collector Index: SeamExporter.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/seam/SeamExporter.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- SeamExporter.java 6 Feb 2006 09:08:09 -0000 1.13 +++ SeamExporter.java 7 Feb 2006 20:22:46 -0000 1.14 @@ -69,6 +69,7 @@ POJOExporter exporter = new POJOExporter(getConfiguration(),getOutputDirectory()); exporter.setProperties((Properties) getProperties().clone()); exporter.setTemplatePath(getTemplatePaths()); + exporter.setArtifactCollector(getArtifactCollector()); exporter.setEjb3(true); exporter.setJdk5(true); exporter.setFilePattern("src/{package-name}/{class-name}.java"); @@ -89,6 +90,7 @@ exporter.setTemplatePath(getTemplatePaths()); exporter.setTemplateName(template); exporter.setFilePattern(pattern); + exporter.setArtifactCollector(getArtifactCollector()); return exporter; } } |
From: <max...@us...> - 2006-02-07 20:22:59
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24167/src/java/org/hibernate/tool/hbm2x Modified Files: ArtifactCollector.java Log Message: make seam report code generation to the artifact collector Index: ArtifactCollector.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/ArtifactCollector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ArtifactCollector.java 7 Feb 2006 14:02:15 -0000 1.2 +++ ArtifactCollector.java 7 Feb 2006 20:22:46 -0000 1.3 @@ -18,7 +18,7 @@ */ public class ArtifactCollector { - Map files = new HashMap(); + final protected Map files = new HashMap(); /** * Called to inform that a file has been created by the exporter. @@ -37,6 +37,16 @@ return (existing==null) ? 0 : existing.size(); } + + public File[] getFiles(String type) { + List existing = (List) files.get(type); + + if(existing==null) { + return new File[0]; + } else { + return (File[]) existing.toArray(new File[existing.size()]); + } + } public Set getFileTypes() { return files.keySet(); |
From: <max...@us...> - 2006-02-07 20:01:52
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28441 Modified Files: hibernate-build.xml .classpath Log Message: cleanup Index: hibernate-build.xml =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/hibernate-build.xml,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- hibernate-build.xml 29 Jan 2006 18:07:07 -0000 1.20 +++ hibernate-build.xml 7 Feb 2006 14:10:48 -0000 1.21 @@ -37,8 +37,9 @@ <mkdir dir="${lib.annotations}"/> <!-- DONT BUILD H3 unless you have to use new features from the core. use the released binary if you can! --> - <ant antfile="${hibernate-core.home}\..\hibernate3\build.xml" inheritall="false" inheritrefs="false" target="jar"/> +<!-- <ant antfile="${hibernate-core.home}\..\hibernate3\build.xml" inheritall="false" inheritrefs="false" target="jar"/> <ant antfile="${hibernate-core.home}\..\hibernate3\build.xml" inheritall="false" inheritrefs="false" target="copylib"/> + --> <ant antfile="..\metadata\build.xml" inheritall="false" inheritrefs="false" target="jar"/> <ant antfile="..\metadata\build.xml" inheritall="false" inheritrefs="false" target="copylib"/> @@ -53,8 +54,7 @@ <ant antfile="..\tools\build.xml" inheritall="false" inheritrefs="false" target="jar"/> <ant antfile="..\tools\build.xml" inheritall="false" inheritrefs="false" target="copylib"/> <copy preservelastmodified="true" file="..\tools\target\hibernate-tools\hibernate-tools.jar" todir="${lib.tools}"/> - <copy preservelastmodified="true" file="..\tools\target\hibernate-tools\lib\velocity-1.4.jar" todir="${lib.tools}"/> - <copy preservelastmodified="true" file="..\tools\target\hibernate-tools\lib\velocity-tools-generic-1.1.jar" todir="${lib.tools}"/> + <copy preservelastmodified="true" file="..\tools\target\hibernate-tools\lib\freemarker.jar" todir="${lib.tools}"/> <copy preservelastmodified="true" file="..\tools\target\hibernate-tools\lib\jtidy-r8-21122004.jar" todir="${lib.tools}"/> <property file="${hibernate-core.lib.dir}/version.properties" prefix="h3"/> Index: .classpath =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/.classpath,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- .classpath 29 Jan 2006 18:07:07 -0000 1.28 +++ .classpath 7 Feb 2006 14:10:48 -0000 1.29 @@ -24,8 +24,8 @@ <classpathentry exported="true" kind="lib" path="lib/hibernate/swarmcache-1.0rc2.jar"/> <classpathentry exported="true" kind="lib" path="lib/tools/hibernate-tools.jar"/> <classpathentry exported="true" kind="lib" path="lib/tools/jtidy-r8-21122004.jar"/> - <classpathentry exported="true" kind="lib" path="lib/tools/velocity-1.4.jar"/> - <classpathentry exported="true" kind="lib" path="lib/tools/velocity-tools-generic-1.1.jar"/> + <classpathentry exported="true" kind="lib" path="lib/tools/freemarker.jar"/> + <classpathentry exported="true" kind="lib" path="lib/bsh-core-2.0b4.jar"/> <classpathentry exported="true" kind="lib" path="lib/annotations/ejb3-persistence.jar"/> <classpathentry exported="true" kind="lib" path="lib/annotations/hibernate-annotations.jar"/> <classpathentry exported="true" kind="lib" path="lib/annotations/lucene-1.4.3.jar"/> @@ -34,6 +34,5 @@ <classpathentry exported="true" kind="lib" path="lib/hibernate/jgroups-2.2.8.jar"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> - <classpathentry kind="lib" path="lib/bsh-core-2.0b4.jar"/> <classpathentry kind="output" path="build/eclipse"/> </classpath> |
From: <max...@us...> - 2006-02-07 19:05:09
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/META-INF In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28441/META-INF Modified Files: MANIFEST.MF Log Message: cleanup Index: MANIFEST.MF =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/META-INF/MANIFEST.MF,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- MANIFEST.MF 29 Jan 2006 18:25:19 -0000 1.31 +++ MANIFEST.MF 7 Feb 2006 14:10:49 -0000 1.32 @@ -28,10 +28,8 @@ lib/hibernate/swarmcache-1.0rc2.jar, lib/tools/hibernate-tools.jar, lib/tools/jtidy-r8-21122004.jar, - lib/tools/l2fprod-common.jar, - lib/tools/velocity-1.4.jar, - lib/tools/velocity-tools-generic-1.1.jar, lib/tools/bsh-2.0b1.jar, + lib/tools/freemarker.jar, lib/bsh-core-2.0b4.jar, lib/annotations/ejb3-persistence.jar, lib/annotations/hibernate-annotations.jar, @@ -107,6 +105,23 @@ com.sun.security.auth, com.sun.security.auth.login, dtd, + freemarker.cache, + freemarker.core, + freemarker.debug, + freemarker.debug.impl, + freemarker.ext.ant, + freemarker.ext.beans, + freemarker.ext.dom, + freemarker.ext.jdom, + freemarker.ext.jsp, + freemarker.ext.jython, + freemarker.ext.rhino, + freemarker.ext.servlet, + freemarker.ext.util, + freemarker.ext.xml, + freemarker.log, + freemarker.template, + freemarker.template.utility, hbm, javax.management, javax.management.loading, @@ -178,40 +193,6 @@ org.apache.lucene.search.spans, org.apache.lucene.store, org.apache.lucene.util, - org.apache.velocity, - org.apache.velocity.anakia, - org.apache.velocity.app, - org.apache.velocity.app.event, - org.apache.velocity.app.tools, - org.apache.velocity.context, - org.apache.velocity.convert, - org.apache.velocity.exception, - org.apache.velocity.io, - org.apache.velocity.runtime, - org.apache.velocity.runtime.compiler, - org.apache.velocity.runtime.configuration, - org.apache.velocity.runtime.defaults, - org.apache.velocity.runtime.directive, - org.apache.velocity.runtime.exception, - org.apache.velocity.runtime.log, - org.apache.velocity.runtime.parser, - org.apache.velocity.runtime.parser.node, - org.apache.velocity.runtime.resource, - org.apache.velocity.runtime.resource.loader, - org.apache.velocity.runtime.visitor, - org.apache.velocity.servlet, - org.apache.velocity.test, - org.apache.velocity.test.misc, - org.apache.velocity.test.provider, - org.apache.velocity.test.view, - org.apache.velocity.texen, - org.apache.velocity.texen.ant, - org.apache.velocity.texen.defaults, - org.apache.velocity.texen.util, - org.apache.velocity.tools.generic, - org.apache.velocity.tools.generic.log, - org.apache.velocity.util, - org.apache.velocity.util.introspection, org.apache.xerces.impl.xs, org.dom4j, org.dom4j.bean, @@ -229,6 +210,7 @@ org.dom4j.xpp, org.hibernate, org.hibernate.action, + org.hibernate.annotationfactory, org.hibernate.annotations, org.hibernate.cache, org.hibernate.cache.entry, @@ -285,6 +267,9 @@ org.hibernate.pretty, org.hibernate.property, org.hibernate.proxy, + org.hibernate.reflection, + org.hibernate.reflection.java, + org.hibernate.reflection.java.generics, org.hibernate.secure, org.hibernate.sql, org.hibernate.stat, |
From: <max...@us...> - 2006-02-07 18:54:14
|
Update of /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24110/src/java/org/hibernate/tool/hbm2x/doc Modified Files: DocHelper.java Log Message: hbm2hbmxml simplified Index: DocHelper.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/doc/DocHelper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- DocHelper.java 23 Jan 2006 11:24:37 -0000 1.4 +++ DocHelper.java 7 Feb 2006 14:02:14 -0000 1.5 @@ -25,7 +25,7 @@ /** * This helper class is used expose hibernate mapping information to the - * velocity templates. + * templates. * * @author Ricardo C. Moral * @author <a href="mailto:abh...@jb...">Amit Bhayani</a> |
From: <max...@us...> - 2006-02-07 18:48:54
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/console In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28441/src/org/hibernate/console Modified Files: KnownConfigurations.java QueryInputModel.java Log Message: cleanup Index: KnownConfigurations.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/console/KnownConfigurations.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- KnownConfigurations.java 26 Aug 2005 06:56:12 -0000 1.3 +++ KnownConfigurations.java 7 Feb 2006 14:10:48 -0000 1.4 @@ -20,7 +20,6 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.console.node.BaseNode; import org.hibernate.console.node.ConfigurationListNode; Index: QueryInputModel.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/console/QueryInputModel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- QueryInputModel.java 3 Oct 2005 22:18:57 -0000 1.2 +++ QueryInputModel.java 7 Feb 2006 14:10:48 -0000 1.3 @@ -8,7 +8,6 @@ import java.util.Set; import org.hibernate.Hibernate; -import org.hibernate.dialect.FirebirdDialect; /** * Class for managing misc parameters and other inputs to a Query, Criteria etc. |
From: <max...@us...> - 2006-02-07 18:47:33
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29042/lib/tools Removed Files: velocity-tools-generic-1.1.jar velocity-1.4.jar Log Message: bye bye velocity --- velocity-tools-generic-1.1.jar DELETED --- --- velocity-1.4.jar DELETED --- |
From: <max...@us...> - 2006-02-07 18:47:25
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27919/lib/tools Modified Files: hibernate-tools.jar Added Files: freemarker.jar Log Message: hibernatetools + freemarker in plugins --- NEW FILE: freemarker.jar --- (This appears to be a binary file; contents omitted.) Index: hibernate-tools.jar =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/tools/hibernate-tools.jar,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 Binary files /tmp/cvsC3QndR and /tmp/cvsGMqSNk differ |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/eclipse/logging In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28441/src/org/hibernate/eclipse/logging Modified Files: LoggingHelper.java PluginLogAppender.java PluginFileAppender.java PluginLogManager.java Log Message: cleanup Index: LoggingHelper.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/eclipse/logging/LoggingHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- LoggingHelper.java 29 Aug 2005 11:44:02 -0000 1.1 +++ LoggingHelper.java 7 Feb 2006 14:10:48 -0000 1.2 @@ -1,8 +1,11 @@ package org.hibernate.eclipse.logging; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + import org.eclipse.core.runtime.Plugin; import org.osgi.framework.BundleContext; -import java.util.*; public class LoggingHelper { Index: PluginLogAppender.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/eclipse/logging/PluginLogAppender.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PluginLogAppender.java 29 Aug 2005 11:44:02 -0000 1.1 +++ PluginLogAppender.java 7 Feb 2006 14:10:48 -0000 1.2 @@ -1,14 +1,14 @@ package org.hibernate.eclipse.logging; -import org.eclipse.core.runtime.ILog; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.apache.log4j.Level; import org.apache.log4j.AppenderSkeleton; +import org.apache.log4j.Level; import org.apache.log4j.Priority; import org.apache.log4j.spi.ErrorCode; import org.apache.log4j.spi.LoggingEvent; import org.apache.log4j.spi.ThrowableInformation; +import org.eclipse.core.runtime.ILog; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; /** * PluginLogAppender Index: PluginFileAppender.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/eclipse/logging/PluginFileAppender.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PluginFileAppender.java 29 Aug 2005 11:44:02 -0000 1.1 +++ PluginFileAppender.java 7 Feb 2006 14:10:48 -0000 1.2 @@ -1,8 +1,9 @@ package org.hibernate.eclipse.logging; import java.io.IOException; -import org.apache.log4j.RollingFileAppender; + import org.apache.log4j.Layout; +import org.apache.log4j.RollingFileAppender; import org.apache.log4j.spi.LoggingEvent; import org.eclipse.core.runtime.IPath; Index: PluginLogManager.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/src/org/hibernate/eclipse/logging/PluginLogManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- PluginLogManager.java 29 Aug 2005 11:44:02 -0000 1.1 +++ PluginLogManager.java 7 Feb 2006 14:10:48 -0000 1.2 @@ -4,7 +4,6 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; -import java.util.Properties; import org.apache.log4j.Appender; import org.apache.log4j.Category; @@ -12,14 +11,12 @@ import org.apache.log4j.Level; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; import org.apache.log4j.helpers.OptionConverter; import org.apache.log4j.spi.HierarchyEventListener; import org.apache.log4j.spi.LoggerFactory; import org.apache.log4j.spi.LoggerRepository; import org.apache.log4j.spi.RepositorySelector; import org.apache.log4j.spi.RootLogger; -import org.apache.log4j.xml.DOMConfigurator; import org.eclipse.core.runtime.ILog; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Plugin; |
From: <max...@us...> - 2006-02-07 18:47:18
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/annotations In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28441/lib/annotations Modified Files: hibernate-annotations.jar Log Message: cleanup Index: hibernate-annotations.jar =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse/lib/annotations/hibernate-annotations.jar,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 Binary files /tmp/cvsHituvg and /tmp/cvsGIcJeg differ |
Update of /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24110/src/java/org/hibernate/tool/hbm2x Modified Files: AbstractExporter.java DocExporter.java XMLPrettyPrinter.java ArtifactCollector.java TemplateHelper.java HibernateMappingExporter.java TemplateProducer.java HibernateConfigurationExporter.java GenericExporter.java Removed Files: ImportProducer.java FreeMarkerTemplateHelper.java Log Message: hbm2hbmxml simplified Index: AbstractExporter.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/AbstractExporter.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- AbstractExporter.java 6 Feb 2006 09:08:08 -0000 1.17 +++ AbstractExporter.java 7 Feb 2006 14:02:15 -0000 1.18 @@ -15,8 +15,8 @@ import org.hibernate.util.StringHelper; /** - * Base exporter for the velocity and direct output generation. - * Sets up the velocity environment + * Base exporter for the template and direct output generation. + * Sets up the template environment * * @author max and david */ @@ -87,11 +87,13 @@ } public void start() { + setTemplateHelper( new TemplateHelper() ); setupTemplates(); setupContext(); doStart(); - cleanUpContext(); + cleanUpContext(); setTemplateHelper(null); + getArtifactCollector().formatFiles(); } abstract public void doStart(); @@ -126,7 +128,6 @@ } protected void setupTemplates() { - setTemplateHelper( new FreeMarkerTemplateHelper() ); if(log.isDebugEnabled()) { log.debug(getClass().getName() + " outputdir:" + getOutputDirectory() + " templatePrefix: " + getTemplatePrefix() + " path: " + toString(templatePaths) ); } @@ -182,7 +183,7 @@ } } - // called to have "true"/"false" strings returned as real booleans in velocity code. + // called to have "true"/"false" strings returned as real booleans in templates code. private Object transformValue(Object value) { if("true".equals(value)) { return Boolean.TRUE; Index: DocExporter.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/DocExporter.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- DocExporter.java 6 Feb 2006 09:08:08 -0000 1.12 +++ DocExporter.java 7 Feb 2006 14:02:15 -0000 1.13 @@ -45,67 +45,67 @@ private static final String FILE_HEADER = "doc/header.html"; /** - * Velocity Template used for the index of the table documentation. + * Template used for the index of the table documentation. */ private static final String VM_TABLES_INDEX = "doc/tables/index.ftl"; /** - * Velocity Template used for index of the entity documentation + * Template used for index of the entity documentation */ private static final String VM_ENTITIES_INDEX = "doc/entities/index.ftl"; /** - * Velocity Template used for the Classes Summary + * Template used for the Classes Summary */ private static final String VM_ENTITIES_SUMMARY = "doc/entities/summary.ftl"; /** - * Velocity Template used for Class details + * Template used for Class details */ private static final String VM_ENTITIES_ENTITY = "doc/entities/entity.ftl"; /** - * Velocity Template used to create the Package List + * Template used to create the Package List */ private static final String VM_ENTITIES_PACKAGE_LIST = "doc/entities/package-list.ftl"; /** - * Velocity Template used to create the list of all Classes + * Template used to create the list of all Classes */ private static final String VM_ENTITIES_ENTITY_LIST = "doc/entities/allEntity-list.ftl"; /** - * Velocity Template used to create List of Classes specific to packages. + * Template used to create List of Classes specific to packages. */ private static final String VM_ENTITIES_PERPACKAGE_ENTITY_LIST = "doc/entities/perPackageEntity-list.ftl"; /** - * Velocity Template used to show the specific package details + * Template used to show the specific package details */ private static final String VM_ENTITIES_PACKAGE_SUMMARY = "doc/entities/package-summary.ftl"; /** - * Velocity Template used for the Tables Summary. + * Template used for the Tables Summary. */ private static final String VM_TABLES_SUMMARY = "doc/tables/summary.ftl"; /** - * Velocity Template used for table lists. + * Template used for table lists. */ private static final String VM_TABLES_TABLE_LIST = "doc/tables/table-list.ftl"; /** - * Velocity Template used for schema lists. + * Template used for schema lists. */ private static final String VM_TABLES_SCHEMA_LIST = "doc/tables/schema-list.ftl"; /** - * Velocity Template used for Schema Summary. + * Template used for Schema Summary. */ private static final String VM_TABLES_SCHEMA_SUMMARY = "doc/tables/schema-summary.ftl"; /** - * Velocity Template used for the Table Details. + * Template used for the Table Details. */ private static final String VM_TABLES_TABLE = "doc/tables/table.ftl"; @@ -460,9 +460,9 @@ } /** - * Run Velocity. + * Run templates. * - * @param parameters the parameters to pass to the velocity template. + * @param parameters the parameters to pass to the templates template. * @param templateName the template to use. * @param outputFile the output file. */ @@ -470,7 +470,6 @@ File outputFile) { TemplateProducer producer = new TemplateProducer(getTemplateHelper(), getArtifactCollector() ); - String filename = outputFile.toString(); producer.produce(parameters, templateName, outputFile, templateName); } Index: XMLPrettyPrinter.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/XMLPrettyPrinter.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- XMLPrettyPrinter.java 21 Sep 2005 18:20:07 -0000 1.5 +++ XMLPrettyPrinter.java 7 Feb 2006 14:02:15 -0000 1.6 @@ -17,6 +17,7 @@ import java.io.OutputStream; import java.io.PrintWriter; import java.io.Writer; +import java.util.Arrays; import java.util.Properties; import org.apache.commons.logging.Log; @@ -55,6 +56,7 @@ } public void write(char[] cbuf, int off, int len) throws IOException { + } } ) ); @@ -69,7 +71,7 @@ } public static void prettyPrintFiles(Tidy tidy, File[] inputfiles, - File[] outputfiles) throws IOException { + File[] outputfiles, boolean silent) throws IOException { if ( (inputfiles == null || outputfiles == null ) || (inputfiles.length != outputfiles.length ) ) { @@ -78,12 +80,12 @@ } for (int i = 0; i < outputfiles.length; i++) { - prettyPrintFile( tidy, inputfiles[i], outputfiles[i] ); + prettyPrintFile( tidy, inputfiles[i], outputfiles[i], silent ); } } public static void prettyPrintFile(Tidy tidy, File inputFile, - File outputFile) throws IOException { + File outputFile, boolean silent) throws IOException { log.debug( "XMLPrettyPrinting " + inputFile.getAbsolutePath() ); InputStream is; @@ -127,8 +129,12 @@ } if ( tidy.getParseErrors() > 0 ) { - throw new ExporterException( "Tidy was unable to process file " - + inputFile + ", " + tidy.getParseErrors() + " errors found." ); + if(silent) { + log.info("Tidy was unable to process file " + inputFile + ", " + tidy.getParseErrors() + " errors found." ); + } else { + throw new ExporterException( "Tidy was unable to process file " + + inputFile + ", " + tidy.getParseErrors() + " errors found." ); + } } } @@ -136,7 +142,7 @@ * @param outputdir * @throws IOException */ - public static void prettyPrintDirectory(File outputdir, final String prefix) + public static void prettyPrintDirectory(File outputdir, final String prefix, boolean silent) throws IOException { File[] files = outputdir.listFiles( new FilenameFilter() { public boolean accept(File dir, String name) { @@ -145,6 +151,6 @@ } ); Tidy tidy = getDefaultTidy(); - prettyPrintFiles( tidy, files, files ); + prettyPrintFiles( tidy, files, files, silent ); } } Index: ArtifactCollector.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/ArtifactCollector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ArtifactCollector.java 21 Sep 2005 18:20:07 -0000 1.1 +++ ArtifactCollector.java 7 Feb 2006 14:02:15 -0000 1.2 @@ -1,8 +1,10 @@ package org.hibernate.tool.hbm2x; import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -39,5 +41,24 @@ public Set getFileTypes() { return files.keySet(); } + + public void formatFiles() { + + List list = (List) files.get("xml"); + if(list!=null && !list.isEmpty()) { + for (Iterator iter = list.iterator(); iter.hasNext();) { + File xmlFile = (File) iter.next(); + try { + XMLPrettyPrinter.prettyPrintFile(XMLPrettyPrinter.getDefaultTidy(), xmlFile, xmlFile, true); + } + catch (IOException e) { + throw new ExporterException("Could not format XML file: " + xmlFile,e); + } + } + } + + list = (List) files.get("java"); + // format java + } } Index: TemplateHelper.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/TemplateHelper.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- TemplateHelper.java 6 Feb 2006 09:08:08 -0000 1.18 +++ TemplateHelper.java 7 Feb 2006 14:02:15 -0000 1.19 @@ -9,27 +9,50 @@ import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; import java.io.Writer; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import freemarker.cache.ClassTemplateLoader; +import freemarker.cache.FileTemplateLoader; +import freemarker.cache.MultiTemplateLoader; +import freemarker.cache.TemplateLoader; +import freemarker.template.Configuration; +import freemarker.template.ObjectWrapper; +import freemarker.template.SimpleDate; +import freemarker.template.SimpleHash; +import freemarker.template.Template; +import freemarker.template.TemplateDateModel; +import freemarker.template.TemplateException; +import freemarker.template.TemplateModel; +import freemarker.template.TemplateModelException; + /** * - * Helper and wrapper for a Template engine (currently only Velocity). + * Helper and wrapper for a Template engine (currently only FreeMarker). * Exposes only the essential functions to avoid too much coupling else where. * * @author max * */ -public abstract class TemplateHelper { +public class TemplateHelper { static final Log log = LogFactory.getLog(TemplateHelper.class); private String templatePrefix; private File outputDirectory; + protected Configuration freeMarkerEngine; + + protected SimpleHash context; + public TemplateHelper() { } @@ -37,10 +60,28 @@ public void init(File outputDirectory, String templatePrefix, String[] templatePaths) { this.outputDirectory = outputDirectory; this.templatePrefix = templatePrefix; - } - - public void setupContext() { - + + context = new SimpleHash(ObjectWrapper.BEANS_WRAPPER); + freeMarkerEngine = new Configuration(); + + List loaders = new ArrayList(); + + for (int i = 0; i < templatePaths.length; i++) { + File file = new File(templatePaths[i]); + if(file.exists() && file.isDirectory()) { + try { + loaders.add(new FileTemplateLoader(file)); + } + catch (IOException e) { + throw new ExporterException("Problems with templatepath " + file, e); + } + } else { + log.warn("template path" + file + " either does not exist or is not a directory"); + } + } + loaders.add(new ClassTemplateLoader(this.getClass(),"/")); // the template names are like pojo/Somewhere so have to be a rooted classpathloader + + freeMarkerEngine.setTemplateLoader(new MultiTemplateLoader((TemplateLoader[]) loaders.toArray(new TemplateLoader[loaders.size()]))); } @@ -97,33 +138,19 @@ } } - /** look up the template named templateName via the paths and print the content to the output */ - abstract public void processTemplate(String templateName, Writer output); public File getOutputDirectory() { return outputDirectory; } - /** - * Check if the template exists. Tries to search with the templatePrefix first and then secondly without the template prefix. - * - * @param name - * @return - */ - abstract String getTemplateName(String name); - + - /** Uses the contents of template string as the template and write it directly to the output */ - abstract public void processString(String template, Writer output); - public void putInContext(String key, Object value) { log.trace("putInContext " + key + "=" + value); if(value == null) throw new IllegalStateException("value must not be null for " + key); Object replaced = internalPutInContext(key,value); if(replaced!=null) throw new IllegalStateException(replaced + " found when setting " + key); } - - abstract protected Object internalPutInContext(String key, Object value); - + public void removeFromContext(String key, Object expected) { log.trace("removeFromContext " + key + "=" + expected); Object replaced = internalRemoveFromContext(key); @@ -133,10 +160,6 @@ }*/ } - abstract protected Object internalRemoveFromContext(String key); - - abstract public boolean templateExists(String name); - public void ensureExistence(File destination) { // if the directory exists, make sure it is a directory File dir = destination.getAbsoluteFile().getParentFile(); @@ -153,4 +176,113 @@ protected String getTemplatePrefix() { return templatePrefix; } + + protected SimpleHash getContext() { + return context; + } + + public void processString(String template, Writer output) { + + try { + Reader r = new StringReader(template); + Template t = new Template("unknown", r, freeMarkerEngine); + + t.process(getContext(), output); + } + catch (IOException e) { + throw new ExporterException("Error while processing template string", e); + } + catch (TemplateException te) { + throw new ExporterException("Error while processing template string", te); + } + catch (Exception e) { + throw new ExporterException("Error while processing template string", e); + } + } + + + + + public void setupContext() { + getContext().put("version", Version.getDefault()); + getContext().put("ctx", getContext() ); //TODO: I would like to remove this, but don't know another way to actually get the list possible "root" keys for debugging. + getContext().put("templates", new Templates()); + + getContext().put("date", new SimpleDate(new Date(), TemplateDateModel.DATETIME)); + + } + + protected Object internalPutInContext(String key, Object value) { + TemplateModel model = null; + try { + model = getContext().get(key); + } + catch (TemplateModelException e) { + throw new ExporterException("Could not get key " + key, e); + } + getContext().put(key, value); + return model; + } + + protected Object internalRemoveFromContext(String key) { + TemplateModel model = null; + try { + model = getContext().get(key); + } + catch (TemplateModelException e) { + throw new ExporterException("Could not get key " + key, e); + } + getContext().remove(key); + return model; + } + + /** look up the template named templateName via the paths and print the content to the output */ + public void processTemplate(String templateName, Writer output) { + try { + Template template = freeMarkerEngine.getTemplate(getTemplateName(templateName)); + template.process(getContext(), output); + } + catch (IOException e) { + throw new ExporterException("Error while processing template " + templateName, e); + } + catch (TemplateException te) { + throw new ExporterException("Error while processing template string", te); + } + catch (Exception e) { + throw new ExporterException("Error while processing template " + templateName, e); + } + } + + /** + * Check if the template exists. Tries to search with the templatePrefix first and then secondly without the template prefix. + * + * @param name + * @return + */ + protected String getTemplateName(String name) { + if(!name.endsWith(".ftl")) { + name = name + ".ftl"; + } + + if(getTemplatePrefix()!=null && templateExists(getTemplatePrefix() + name)) { + return getTemplatePrefix() + name; + } + + if(templateExists(name)) { + return name; + } + + throw new ExporterException("Could not find template with name: " + name); + } + + public boolean templateExists(String templateName) { + TemplateLoader templateLoader = freeMarkerEngine.getTemplateLoader(); + + try { + return templateLoader.findTemplateSource(templateName)!=null; + } + catch (IOException e) { + throw new ExporterException("templateExists for " + templateName + " failed", e); + } + } } Index: HibernateMappingExporter.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/HibernateMappingExporter.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- HibernateMappingExporter.java 6 Feb 2006 09:08:08 -0000 1.28 +++ HibernateMappingExporter.java 7 Feb 2006 14:02:15 -0000 1.29 @@ -3,158 +3,75 @@ */ package org.hibernate.tool.hbm2x; -import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; +import java.util.HashMap; +import java.util.Map; import org.hibernate.cfg.Configuration; -import org.hibernate.mapping.Component; import org.hibernate.mapping.PersistentClass; -import org.hibernate.mapping.Property; +import org.hibernate.tool.hbm2x.pojo.POJOClass; +import org.hibernate.util.StringHelper; /** * @author david and max */ -public class HibernateMappingExporter extends AbstractExporter implements ConfigurationVisitor { +public class HibernateMappingExporter extends GenericExporter { - protected HibernateMappingGlobalSettings globalSettings = new HibernateMappingGlobalSettings(); - private Writer writer; - private File file; - - public HibernateMappingExporter(Configuration cfg, File outputdir) { - super(cfg, outputdir); + protected HibernateMappingGlobalSettings globalSettings = new HibernateMappingGlobalSettings(); + + protected void setupContext() { + super.setupContext(); + getTemplateHelper().putInContext("hmgs", globalSettings); } - - public HibernateMappingExporter() { - + + public void setGlobalSettings(HibernateMappingGlobalSettings hgs) { + this.globalSettings = hgs; } - - public void endComponent(Component componenet) throws ExporterException { } - public void endMapping(Configuration cfg) { } - public boolean startMapping(Configuration cfg) {return true; } - - public boolean startPersistentClass(PersistentClass clazz) { - - try { - getTemplateHelper().putInContext("clazz", clazz); - - file = getFileForClassName(getOutputDirectory(), clazz.getEntityName(), ".hbm.xml"); - getTemplateHelper().ensureExistence(file); - if(writer!=null) throw new IllegalStateException("Writer must be null when starting a new persistent class!"); - writer = new BufferedWriter(new FileWriter(file)); - getTemplateHelper().processTemplate("hbm/hibernate-mapping.hbm.ftl", writer); - getTemplateHelper().processTemplate("hbm/persistentclass.hbm.ftl", writer); - } - catch (IOException e) { - throw new ExporterException("Error while starting on " + clazz, e); - } - return true; + + public void doStart() { + exportGeneralSettings(); + + super.doStart(); } - public void endPersistentClass(PersistentClass clazz) throws ExporterException { - - try { - writer.write("</" + getCfg2HbmTool().getTag(clazz) +">\n"); - getTemplateHelper().removeFromContext("clazz", clazz); - - writer.write("</hibernate-mapping>"); - writer.flush(); - writer.close(); - writer = null; - - XMLPrettyPrinter.prettyPrintFile(XMLPrettyPrinter.getDefaultTidy(), file, file); - } - catch (IOException e) { - throw new ExporterException("Error while processing template", e); - } - - } - - public void startIdentifierProperty(Property identifierProperty) { - getTemplateHelper().putInContext("property", identifierProperty); - getTemplateHelper().processTemplate("hbm/id.hbm.ftl", writer); - } - - public void endIdentifierProperty(Property identifierProperty) { - getTemplateHelper().removeFromContext("property", identifierProperty); - } - - public void startEmbeddedIdentifier(Component identifierProperty) { - getTemplateHelper().putInContext("embeddedid", identifierProperty); - getTemplateHelper().processTemplate("hbm/id.hbm.ftl", writer); - } - - public void endEmbeddedIdentifier(Component identifierProperty) { - getTemplateHelper().removeFromContext("embeddedid", identifierProperty); - } - - public boolean startProperty(Property prop) { - getTemplateHelper().putInContext("property", prop); - String tag = getCfg2HbmTool().getTag(prop); - getTemplateHelper().processTemplate("hbm/" + tag + ".hbm.ftl", writer); - getTemplateHelper().removeFromContext("property", prop); - return false; - } - - public void endProperty(Property prop) { } - - public boolean startComponent(Component component) throws ExporterException { - return false; // we don't care about components here! - } - - public boolean startGeneralConfiguration(Configuration cfg) throws ExporterException { + private void exportGeneralSettings() { Cfg2HbmTool c2h = getCfg2HbmTool(); - + Configuration cfg = getConfiguration(); if(c2h.isImportData(cfg) && (c2h.isNamedQueries(cfg)) && (c2h.isNamedSQLQueries(cfg)) && (c2h.isFilterDefinitions(cfg))) { - String baseLocPath = globalSettings != null ? globalSettings.getDefaultPackage() != null ? globalSettings.getDefaultPackage() + "." : "" : ""; - try { - File generalFile = getFileForClassName(getOutputDirectory(), baseLocPath + "GeneralHbmSettings", ".hbm.xml"); - if(writer!=null) throw new IllegalStateException("Writer must be null when starting a new hbm output stream!"); - writer = new BufferedWriter(new FileWriter(generalFile)); - getTemplateHelper().processTemplate("hbm/generalhbm.hbm.ftl", writer); - } - catch (IOException e) { - throw new ExporterException("Error while starting on " + cfg, e); - } - return true; - } else { - return false; + TemplateProducer producer = new TemplateProducer(getTemplateHelper(),getArtifactCollector()); + producer.produce(new HashMap(), "generalhbm.hbm.ftl", new File(getOutputDirectory(),"GeneralHbmSettings.hbm.xml"), templateName); } } - public void endGeneralConfiguration(Configuration cfg) throws ExporterException { - try { - writer.flush(); - writer.close(); - writer = null; - } - catch (IOException e) { - throw new ExporterException("Error while processing template", e); - } + public HibernateMappingExporter(Configuration cfg, File outputdir) { + super(cfg, outputdir); + init(); + } + + protected void init() { + setTemplateName("hibernate-mapping.hbm"); + setFilePattern("{package-name}/{class-name}.hbm.xml"); + setTemplatePrefix("hbm/"); } - public void finish() throws ExporterException { - // Empty - } + public HibernateMappingExporter() { + init(); + } - public void setGlobalSettings(HibernateMappingGlobalSettings hgs) { - this.globalSettings = hgs; - + protected String getClassNameForFile(POJOClass element) { + return StringHelper.unqualify(((PersistentClass)element.getDecoratedObject()).getEntityName()); } - public void doStart() { - ConfigurationNavigator navigator = new ConfigurationNavigator(); - navigator.export(getConfiguration(), this); + protected String getPackageNameForFile(POJOClass element) { + return StringHelper.qualifier(((PersistentClass)element.getDecoratedObject()).getClassName()); } - - protected void setupContext() { - super.setupContext(); - getTemplateHelper().putInContext("hmgs", globalSettings); + + + protected void exportComponent(Map additionalContext, POJOClass element) { + // we don't want component's exported. } public String getName() { - return "cfg2hbm"; + return "hbm2hbmxml"; } } Index: TemplateProducer.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/TemplateProducer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- TemplateProducer.java 6 Feb 2006 09:08:08 -0000 1.2 +++ TemplateProducer.java 7 Feb 2006 14:02:15 -0000 1.3 @@ -25,10 +25,8 @@ void produce(Map additionalContext, String templateName, File destination, String identifier, String fileType) { - String tempResult = firstPass( additionalContext, templateName ); + String tempResult = produceToString( additionalContext, templateName ); - /*secondPass( additionalContext, destination, identifier, fileType, tempResult );*/ - if(tempResult.trim().length()==0) { log.warn("Generated output is empty. Skipped creation for file " + destination); return; @@ -40,7 +38,6 @@ ac.addFile(destination, fileType); log.info("Writing " + identifier + " to " + destination.getAbsolutePath() ); - // Second run - writes to file (allows for placing imports correctly and optimized ;) fileWriter = new FileWriter(destination); fileWriter.write(tempResult); } @@ -57,48 +54,12 @@ } } } - - } - private void secondPass(Map additionalContext, File destination, String identifier, String fileType, String tempResult) { - if(tempResult.trim().length()==0) { - log.warn("Generated output is empty. Skipped creation for file " + destination); - return; - } - FileWriter fileWriter = null; - try { - Map spctx = getContextForSecondPass(additionalContext); - putInContext(th, spctx); - - th.ensureExistence( destination ); - - ac.addFile(destination, fileType); - log.info("Writing " + identifier + " to " + destination.getAbsolutePath() ); - // Second run - writes to file (allows for placing imports correctly and optimized ;) - fileWriter = new FileWriter(destination); - th.processString(tempResult, fileWriter); - removeFromContext(th, spctx); - } - catch (Exception e) { - throw new ExporterException("Error while processing template the second time", e); - } finally { - if(fileWriter!=null) { - try { - fileWriter.flush(); - fileWriter.close(); - } - catch (IOException e) { - log.warn("Exception while flushing/closing " + destination,e); - } - } - } - } - - private String firstPass(Map additionalContext, String templateName) { - Map contextForFirstPass = getContextForFirstPass(additionalContext); + private String produceToString(Map additionalContext, String templateName) { + Map contextForFirstPass = additionalContext; putInContext( th, contextForFirstPass ); StringWriter tempWriter = new StringWriter(); BufferedWriter bw = new BufferedWriter(tempWriter); @@ -129,18 +90,10 @@ th.putInContext((String) element.getKey(), element.getValue()); } } - - protected Map getContextForSecondPass(Map additionalContext) { - return additionalContext; - } - - protected Map getContextForFirstPass(Map additionalContext) { - return additionalContext; - } public void produce(Map additionalContext, String templateName, File outputFile, String identifier) { - String filename = outputFile.getName(); - filename = filename.substring(filename.indexOf('.')+1); - produce(additionalContext, templateName, outputFile, identifier, filename); + String fileType = outputFile.getName(); + fileType = fileType.substring(fileType.indexOf('.')+1); + produce(additionalContext, templateName, outputFile, identifier, fileType); } } Index: HibernateConfigurationExporter.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/HibernateConfigurationExporter.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- HibernateConfigurationExporter.java 3 Oct 2005 16:00:58 -0000 1.19 +++ HibernateConfigurationExporter.java 7 Feb 2006 14:02:15 -0000 1.20 @@ -120,15 +120,6 @@ } } - if(file!=null) { - try { - XMLPrettyPrinter.prettyPrintFile(XMLPrettyPrinter.getDefaultTidy(), file, file); - } - catch (IOException e) { - throw new ExporterException("Problems while creating hibernate.cfg.xml", e); - } - } - } /** Index: GenericExporter.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/tools/src/java/org/hibernate/tool/hbm2x/GenericExporter.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- GenericExporter.java 6 Feb 2006 09:08:08 -0000 1.8 +++ GenericExporter.java 7 Feb 2006 14:02:15 -0000 1.9 @@ -37,9 +37,10 @@ public void start() { if(exporterClassName!=null) { + Exporter exporter = null; try { Class exporterClass = ReflectHelper.classForName(exporterClassName); - Exporter exporter = (Exporter) exporterClass.newInstance(); + exporter = (Exporter) exporterClass.newInstance(); Properties p = getProperties(); if(getTemplateName()!=null) p.put(ExporterSettings.PREFIX_KEY + "template_name", getTemplateName()); if(filePattern!=null) p.put(ExporterSettings.PREFIX_KEY + "file_pattern", filePattern); @@ -47,13 +48,13 @@ exporter.setArtifactCollector(getArtifactCollector()); exporter.setConfiguration(getConfiguration()); exporter.setOutputDirectory(getOutputDirectory()); - exporter.setTemplatePath(getTemplatePaths()); - - exporter.start(); + exporter.setTemplatePath(getTemplatePaths()); } catch (Exception e) { - throw new ExporterException("Could not instantiate exporter of class " + exporterClassName,e); + throw new ExporterException("Could not instantiate/configure exporter of class " + exporterClassName,e); } + + exporter.start(); } else { super.start(); } @@ -101,20 +102,19 @@ } protected void exportPOJO(Map additionalContext, POJOClass element) { - TemplateProducer producer = new ImportProducer(getTemplateHelper(),getArtifactCollector(),element); + TemplateProducer producer = new TemplateProducer(getTemplateHelper(),getArtifactCollector()); additionalContext.put("pojo", element); additionalContext.put("clazz", element.getDecoratedObject()); - additionalContext.put("secondclassimports", "$secondpassclassimports"); String filename = resolveFilename( element ); - if(filename.indexOf('$')>=0) { - log.warn("Filename for " + element.getDeclarationName() + " contains a $. Innerclass generation is not supported."); + if(filename.endsWith(".java") && filename.indexOf('$')>=0) { + log.warn("Filename for " + getClassNameForFile( element ) + " contains a $. Innerclass generation is not supported."); } producer.produce(additionalContext, getTemplateName(), new File(getOutputDirectory(),filename), templateName); } - private String resolveFilename(POJOClass element) { - String filename = StringHelper.replace(filePattern, "{class-name}", element.getDeclarationName()); - String packageLocation = StringHelper.replace(element.getPackageName(),".", "/"); + protected String resolveFilename(POJOClass element) { + String filename = StringHelper.replace(filePattern, "{class-name}", getClassNameForFile( element )); + String packageLocation = StringHelper.replace(getPackageNameForFile( element ),".", "/"); if(StringHelper.isEmpty(packageLocation)) { packageLocation = "."; // done to ensure default package classes doesn't end up in the root of the filesystem when outputdir="" } @@ -122,6 +122,14 @@ return filename; } + protected String getPackageNameForFile(POJOClass element) { + return element.getPackageName(); + } + + protected String getClassNameForFile(POJOClass element) { + return element.getDeclarationName(); + } + public void setFilePattern(String filePattern) { this.filePattern = filePattern; } --- ImportProducer.java DELETED --- --- FreeMarkerTemplateHelper.java DELETED --- |
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14646/src/org/hibernate/eclipse/console/test Modified Files: HibernateConsoleTest.java JavaFormattingTest.java HibernateConsoleTestPlugin.java Log Message: HBX-374 Pass generated Java files to Eclipse code formatter + removal of too many non-used imports Index: HibernateConsoleTest.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/HibernateConsoleTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- HibernateConsoleTest.java 25 Jan 2006 10:09:54 -0000 1.2 +++ HibernateConsoleTest.java 7 Feb 2006 16:18:04 -0000 1.3 @@ -1,7 +1,5 @@ package org.hibernate.eclipse.console.test; -import java.lang.reflect.Field; - import junit.framework.TestCase; import org.eclipse.core.resources.IFile; Index: JavaFormattingTest.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/JavaFormattingTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- JavaFormattingTest.java 24 Jan 2006 14:48:59 -0000 1.1 +++ JavaFormattingTest.java 7 Feb 2006 16:18:04 -0000 1.2 @@ -2,29 +2,16 @@ import java.util.Map; -import javax.management.monitor.Monitor; - import junit.framework.TestCase; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.ToolFactory; import org.eclipse.jdt.core.formatter.CodeFormatter; -import org.eclipse.jdt.ui.actions.FormatAllAction; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.text.edits.MalformedTreeException; import org.eclipse.text.edits.TextEdit; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.PlatformUI; public class JavaFormattingTest extends TestCase { Index: HibernateConsoleTestPlugin.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.console.test/src/org/hibernate/eclipse/console/test/HibernateConsoleTestPlugin.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- HibernateConsoleTestPlugin.java 24 Jan 2006 14:48:59 -0000 1.1 +++ HibernateConsoleTestPlugin.java 7 Feb 2006 16:18:04 -0000 1.2 @@ -1,9 +1,11 @@ package org.hibernate.eclipse.console.test; -import org.eclipse.ui.plugin.*; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; -import java.util.*; /** * The main plugin class to be used in the desktop. |
From: <max...@us...> - 2006-02-07 16:18:16
|
Update of /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14545/src/org/hibernate/eclipse/mapper/extractor Modified Files: FieldPropertyHandler.java HBMInfoExtractor.java Log Message: HBX-374 Pass generated Java files to Eclipse code formatter + removal of too many non-used imports Index: FieldPropertyHandler.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/FieldPropertyHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- FieldPropertyHandler.java 26 Oct 2005 16:09:47 -0000 1.5 +++ FieldPropertyHandler.java 7 Feb 2006 16:17:59 -0000 1.6 @@ -8,12 +8,10 @@ import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.ui.text.java.IJavaCompletionProposal; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.hibernate.eclipse.hqleditor.CompletionHelper; import org.hibernate.eclipse.hqleditor.HibernateResultCollector; -import org.hibernate.util.StringHelper; import org.w3c.dom.Attr; import org.w3c.dom.Node; Index: HBMInfoExtractor.java =================================================================== RCS file: /cvsroot/hibernate/HibernateExt/org.hibernate.eclipse.mapper/src/org/hibernate/eclipse/mapper/extractor/HBMInfoExtractor.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- HBMInfoExtractor.java 2 Dec 2005 22:23:58 -0000 1.14 +++ HBMInfoExtractor.java 7 Feb 2006 16:17:59 -0000 1.15 @@ -454,7 +454,10 @@ if(att!=null && attributeName.equals(att.getNodeName() ) ) { String typename = att.getNodeValue(); if(typename!=null && typename.indexOf('.')<0) { - typename = getPackageName(node) + "." + typename; + String packageName = getPackageName(node); + if(packageName!=null) { + typename = packageName + "." + typename; + } } return typename; } |