Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1427 - in development/laboratory/spells/xdoclet: plugin-test/src/main/net/dpml/tutorial/magic/spell plugin/src/main/net/dpml/lab/spell/xdoclet standard-test standard-test/src/main/net/dpml/tutorial/magic/spell

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1427 - in development/laboratory/spells/xdoclet: plugin-test/src/main/net/dpml/tutorial/magic/spell plugin/src/main/net/dpml/lab/spell/xdoclet standard-test standard-test/src/main/net/dpml/tutorial/magic/spell
  • Date: Mon, 10 Jan 2005 08:47:11 +0100

Author: mcconnell
Date: Mon Jan 10 08:47:11 2005
New Revision: 1427

Added:

development/laboratory/spells/xdoclet/plugin/src/main/net/dpml/lab/spell/xdoclet/HibernateDocletAdapter.java
(contents, props changed)
Modified:

development/laboratory/spells/xdoclet/plugin-test/src/main/net/dpml/tutorial/magic/spell/HelloWorld.hbm.xml

development/laboratory/spells/xdoclet/plugin/src/main/net/dpml/lab/spell/xdoclet/antlib.xml
development/laboratory/spells/xdoclet/standard-test/build.xml

development/laboratory/spells/xdoclet/standard-test/src/main/net/dpml/tutorial/magic/spell/HelloWorld.hbm.xml
Log:
Add a task to fix Dave's problem.

Modified:
development/laboratory/spells/xdoclet/plugin-test/src/main/net/dpml/tutorial/magic/spell/HelloWorld.hbm.xml
==============================================================================
---
development/laboratory/spells/xdoclet/plugin-test/src/main/net/dpml/tutorial/magic/spell/HelloWorld.hbm.xml
(original)
+++
development/laboratory/spells/xdoclet/plugin-test/src/main/net/dpml/tutorial/magic/spell/HelloWorld.hbm.xml
Mon Jan 10 08:47:11 2005
@@ -12,6 +12,7 @@
dynamic-update="true"
dynamic-insert="false"
select-before-update="false"
+ optimistic-lock="version"
>

<id

Added:
development/laboratory/spells/xdoclet/plugin/src/main/net/dpml/lab/spell/xdoclet/HibernateDocletAdapter.java
==============================================================================
--- (empty file)
+++
development/laboratory/spells/xdoclet/plugin/src/main/net/dpml/lab/spell/xdoclet/HibernateDocletAdapter.java
Mon Jan 10 08:47:11 2005
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2005 Stephen McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.dpml.lab.spell.xdoclet;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.security.ProtectionDomain;
+import xdoclet.loader.ModuleFinder;
+
+import xdoclet.modules.hibernate.HibernateDocletTask;
+
+/**
+ * A quick workaround to deal with XDoclet classpath assumptions.
+ */
+public class HibernateDocletAdapter extends HibernateDocletTask
+{
+ private static final String SEPARATOR =
System.getProperty("path.separator");
+
+ public HibernateDocletAdapter()
+ {
+ super();
+ try
+ {
+ String classpath = resolveClasspath();
+ System.setProperty( "xdoclet.class.path", classpath );
+ ModuleFinder.initClasspath( getClass() );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "XDoclet workaround raised an error.";
+ throw new RuntimeException( error, e );
+ }
+ }
+
+ private String resolveClasspath() throws IOException
+ {
+ StringBuffer buffer = new StringBuffer();
+ ClassLoader loader = getClass().getClassLoader();
+ if( loader instanceof URLClassLoader )
+ {
+ URLClassLoader urlcl = (URLClassLoader) loader;
+ URL[] urls = urlcl.getURLs();
+ for( int i=0; i<urls.length; i++ )
+ {
+ if( i > 0 )
+ {
+ buffer.append( SEPARATOR );
+ }
+ addEntry( buffer, urls[i] );
+ }
+ }
+ return buffer.toString();
+ }
+
+ private void addEntry( StringBuffer buffer, URL url ) throws IOException
+ {
+ if( "artifact".equals( url.getProtocol() ) )
+ {
+ File local = (File) url.getContent( new Class[]{ File.class } );
+ buffer.append( local.getAbsolutePath() );
+ }
+ else
+ {
+ buffer.append( url.toString() );
+ }
+ }
+}

Modified:
development/laboratory/spells/xdoclet/plugin/src/main/net/dpml/lab/spell/xdoclet/antlib.xml
==============================================================================
---
development/laboratory/spells/xdoclet/plugin/src/main/net/dpml/lab/spell/xdoclet/antlib.xml
(original)
+++
development/laboratory/spells/xdoclet/plugin/src/main/net/dpml/lab/spell/xdoclet/antlib.xml
Mon Jan 10 08:47:11 2005
@@ -2,6 +2,6 @@
<antlib>

<!-- taskdefs -->
- <taskdef name="hibernate-doclet"
classname="xdoclet.modules.hibernate.HibernateDocletTask"/>
+ <taskdef name="hibernate-doclet"
classname="net.dpml.lab.spell.xdoclet.HibernateDocletAdapter"/>

</antlib>

Modified: development/laboratory/spells/xdoclet/standard-test/build.xml
==============================================================================
--- development/laboratory/spells/xdoclet/standard-test/build.xml
(original)
+++ development/laboratory/spells/xdoclet/standard-test/build.xml Mon
Jan 10 08:47:11 2005
@@ -4,7 +4,7 @@
xmlns:magic="antlib:net.dpml.magic"
xmlns:x="plugin:dpml/magic/dpml-magic-core" >

<magic:import uri="artifact:template:dpml/magic/standard"/>
- <property file="hibernate.build.properties"/>
+ <!--<property file="hibernate.build.properties"/>-->

<target name="install" depends="xdoclet.hibernate, standard.install"/>


Modified:
development/laboratory/spells/xdoclet/standard-test/src/main/net/dpml/tutorial/magic/spell/HelloWorld.hbm.xml
==============================================================================
---
development/laboratory/spells/xdoclet/standard-test/src/main/net/dpml/tutorial/magic/spell/HelloWorld.hbm.xml
(original)
+++
development/laboratory/spells/xdoclet/standard-test/src/main/net/dpml/tutorial/magic/spell/HelloWorld.hbm.xml
Mon Jan 10 08:47:11 2005
@@ -12,6 +12,7 @@
dynamic-update="true"
dynamic-insert="false"
select-before-update="false"
+ optimistic-lock="version"
>

<id



  • svn commit: r1427 - in development/laboratory/spells/xdoclet: plugin-test/src/main/net/dpml/tutorial/magic/spell plugin/src/main/net/dpml/lab/spell/xdoclet standard-test standard-test/src/main/net/dpml/tutorial/magic/spell, mcconnell, 01/10/2005

Archive powered by MHonArc 2.6.24.

Top of Page