You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2009/12/10 01:00:09 UTC

svn commit: r889024 [2/4] - in /openjpa/trunk/contrib: ./ devtools/ devtools/openjpa-eclipse-testproject/ devtools/openjpa-eclipse-testproject/bin/ devtools/openjpa-eclipse-testproject/bin/test/ devtools/openjpa-eclipse-testproject/bin/test/test/ devto...

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/openjpa-eclipse App.launch
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/openjpa-eclipse%20App.launch?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/openjpa-eclipse App.launch (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/openjpa-eclipse App.launch Thu Dec 10 00:00:07 2009
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="true"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="true"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="false"/>
+<booleanAttribute key="clearws" value="false"/>
+<booleanAttribute key="clearwslog" value="true"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/openjpa-eclipse App"/>
+<booleanAttribute key="default" value="false"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc}/openjpa-eclipse-testproject-workspace"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:PermSize=64m -XX:MaxPermSize=256m -Xms128m -Xmx512m"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<stringAttribute key="selected_target_plugins" value="ch.ethz.iks.r_osgi.remote,ch.ethz.iks.slp,com.ibm.icu,com.ibm.icu.source,com.jcraft.jsch,com.jprofiler.integrations.eclipse,javax.servlet,javax.servlet.jsp,javax.servlet.jsp.source,javax.servlet.source,javax.xml,org.apache.ant,org.apache.ant.source,org.apache.commons.codec,org.apache.commons.el,org.apache.commons.el.source,org.apache.commons.httpclient,org.apache.commons.lang,org.apache.commons.logging,org.apache.commons.logging.source,org.apache.jasper,org.apache.jasper.source,org.apache.lucene,org.apache.lucene.analysis,org.apache.lucene.analysis.source,org.apache.lucene.source,org.apache.xerces,org.apache.xml.resolver,org.apache.xml.serializer,org.eclipse.ant.core,org.eclipse.ant.core.source,org.eclipse.ant.ui,org.eclipse.ant.ui.source,org.eclipse.compare,org.eclipse.compare.source,org.eclipse.core.boot,org.eclipse.core.commands,org.eclipse.core.commands.source,org.eclipse.core.contenttype,org.eclipse.core.contenttype.
 source,org.eclipse.core.databinding,org.eclipse.core.databinding.beans,org.eclipse.core.databinding.beans.source,org.eclipse.core.databinding.source,org.eclipse.core.expressions,org.eclipse.core.expressions.source,org.eclipse.core.filebuffers,org.eclipse.core.filebuffers.source,org.eclipse.core.filesystem,org.eclipse.core.filesystem.source,org.eclipse.core.filesystem.win32.x86,org.eclipse.core.jobs,org.eclipse.core.jobs.source,org.eclipse.core.net,org.eclipse.core.net.source,org.eclipse.core.net.win32.x86,org.eclipse.core.resources,org.eclipse.core.resources.compatibility,org.eclipse.core.resources.compatibility.source,org.eclipse.core.resources.source,org.eclipse.core.resources.win32.x86,org.eclipse.core.runtime,org.eclipse.core.runtime.compatibility,org.eclipse.core.runtime.compatibility.auth,org.eclipse.core.runtime.compatibility.auth.source,org.eclipse.core.runtime.compatibility.registry,org.eclipse.core.runtime.compatibility.registry.source,org.eclipse.core.runtime.comp
 atibility.source,org.eclipse.core.runtime.source,org.eclipse.core.variables,org.eclipse.core.variables.source,org.eclipse.cvs,org.eclipse.cvs.source,org.eclipse.debug.core,org.eclipse.debug.core.source,org.eclipse.debug.ui,org.eclipse.debug.ui.source,org.eclipse.draw2d,org.eclipse.ecf,org.eclipse.ecf.core.source,org.eclipse.ecf.datashare,org.eclipse.ecf.discovery,org.eclipse.ecf.discovery.ui,org.eclipse.ecf.doc,org.eclipse.ecf.docshare,org.eclipse.ecf.example.clients,org.eclipse.ecf.example.collab,org.eclipse.ecf.example.collab.editor,org.eclipse.ecf.examples.remoteservices.client,org.eclipse.ecf.examples.remoteservices.common,org.eclipse.ecf.examples.remoteservices.server,org.eclipse.ecf.examples.source,org.eclipse.ecf.examples.updatesite.client,org.eclipse.ecf.examples.updatesite.server,org.eclipse.ecf.filetransfer,org.eclipse.ecf.filetransfer.ui,org.eclipse.ecf.identity,org.eclipse.ecf.presence,org.eclipse.ecf.presence.bot,org.eclipse.ecf.presence.collab.ui,org.eclipse.ec
 f.presence.ui,org.eclipse.ecf.protocol.bittorrent,org.eclipse.ecf.protocol.msn,org.eclipse.ecf.provider,org.eclipse.ecf.provider.bittorrent,org.eclipse.ecf.provider.bittorrent.ui,org.eclipse.ecf.provider.datashare,org.eclipse.ecf.provider.discovery,org.eclipse.ecf.provider.filetransfer,org.eclipse.ecf.provider.filetransfer.efs,org.eclipse.ecf.provider.filetransfer.scp,org.eclipse.ecf.provider.filetransfer.ssl,org.eclipse.ecf.provider.irc,org.eclipse.ecf.provider.irc.ui,org.eclipse.ecf.provider.jmdns,org.eclipse.ecf.provider.jslp,org.eclipse.ecf.provider.msn,org.eclipse.ecf.provider.msn.ui,org.eclipse.ecf.provider.r_osgi,org.eclipse.ecf.provider.remoteservice,org.eclipse.ecf.provider.ui,org.eclipse.ecf.provider.xmpp,org.eclipse.ecf.provider.xmpp.ui,org.eclipse.ecf.remoteservice,org.eclipse.ecf.remoteservice.ui,org.eclipse.ecf.server,org.eclipse.ecf.server.generic,org.eclipse.ecf.sharedobject,org.eclipse.ecf.ssl,org.eclipse.ecf.storage,org.eclipse.ecf.sync,org.eclipse.ecf.tele
 phony.call,org.eclipse.ecf.telephony.call.ui,org.eclipse.ecf.ui,org.eclipse.emf.common,org.eclipse.emf.common.ui,org.eclipse.emf.ecore,org.eclipse.emf.ecore.change,org.eclipse.emf.ecore.change.edit,org.eclipse.emf.ecore.edit,org.eclipse.emf.ecore.xmi,org.eclipse.emf.edit,org.eclipse.emf.edit.ui,org.eclipse.epp.usagedata.gathering,org.eclipse.epp.usagedata.recording,org.eclipse.epp.usagedata.ui,org.eclipse.equinox.app,org.eclipse.equinox.app.source,org.eclipse.equinox.common,org.eclipse.equinox.common.source,org.eclipse.equinox.frameworkadmin,org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.frameworkadmin.equinox.source,org.eclipse.equinox.frameworkadmin.source,org.eclipse.equinox.http.jetty,org.eclipse.equinox.http.jetty.source,org.eclipse.equinox.http.registry,org.eclipse.equinox.http.registry.source,org.eclipse.equinox.http.servlet,org.eclipse.equinox.http.servlet.source,org.eclipse.equinox.jsp.jasper,org.eclipse.equinox.jsp.jasper.registry,org.eclipse.equino
 x.jsp.jasper.registry.source,org.eclipse.equinox.jsp.jasper.source,org.eclipse.equinox.launcher,org.eclipse.equinox.launcher.source,org.eclipse.equinox.launcher.win32.win32.x86,org.eclipse.equinox.p2.artifact.repository,org.eclipse.equinox.p2.artifact.repository.source,org.eclipse.equinox.p2.console,org.eclipse.equinox.p2.console.source,org.eclipse.equinox.p2.core,org.eclipse.equinox.p2.core.source,org.eclipse.equinox.p2.director,org.eclipse.equinox.p2.director.app,org.eclipse.equinox.p2.director.app.source,org.eclipse.equinox.p2.director.source,org.eclipse.equinox.p2.directorywatcher,org.eclipse.equinox.p2.directorywatcher.source,org.eclipse.equinox.p2.engine,org.eclipse.equinox.p2.engine.source,org.eclipse.equinox.p2.exemplarysetup,org.eclipse.equinox.p2.exemplarysetup.source,org.eclipse.equinox.p2.extensionlocation,org.eclipse.equinox.p2.extensionlocation.source,org.eclipse.equinox.p2.garbagecollector,org.eclipse.equinox.p2.garbagecollector.source,org.eclipse.equinox.p2.j
 arprocessor,org.eclipse.equinox.p2.jarprocessor.source,org.eclipse.equinox.p2.metadata,org.eclipse.equinox.p2.metadata.generator,org.eclipse.equinox.p2.metadata.generator.source,org.eclipse.equinox.p2.metadata.repository,org.eclipse.equinox.p2.metadata.repository.source,org.eclipse.equinox.p2.metadata.source,org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.reconciler.dropins.source,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.touchpoint.eclipse.source,org.eclipse.equinox.p2.touchpoint.natives,org.eclipse.equinox.p2.touchpoint.natives.source,org.eclipse.equinox.p2.ui,org.eclipse.equinox.p2.ui.sdk,org.eclipse.equinox.p2.ui.sdk.source,org.eclipse.equinox.p2.ui.source,org.eclipse.equinox.p2.updatechecker,org.eclipse.equinox.p2.updatechecker.source,org.eclipse.equinox.p2.updatesite,org.eclipse.equinox.p2.updatesite.source,org.eclipse.equinox.preferences,org.eclipse.equinox.preferences.source,org.eclipse.equinox.registry,org.eclipse.equinox.regi
 stry.source,org.eclipse.equinox.security,org.eclipse.equinox.security.source,org.eclipse.equinox.security.ui,org.eclipse.equinox.security.ui.source,org.eclipse.equinox.security.win32.x86,org.eclipse.equinox.security.win32.x86.source,org.eclipse.equinox.simpleconfigurator,org.eclipse.equinox.simpleconfigurator.manipulator,org.eclipse.equinox.simpleconfigurator.manipulator.source,org.eclipse.equinox.simpleconfigurator.source,org.eclipse.gef,org.eclipse.help,org.eclipse.help.appserver,org.eclipse.help.appserver.source,org.eclipse.help.base,org.eclipse.help.base.source,org.eclipse.help.source,org.eclipse.help.ui,org.eclipse.help.ui.source,org.eclipse.help.webapp,org.eclipse.help.webapp.source,org.eclipse.jdt,org.eclipse.jdt.apt.core,org.eclipse.jdt.apt.core.source,org.eclipse.jdt.apt.pluggable.core,org.eclipse.jdt.apt.pluggable.core.source,org.eclipse.jdt.apt.ui,org.eclipse.jdt.apt.ui.source,org.eclipse.jdt.compiler.apt,org.eclipse.jdt.compiler.apt.source,org.eclipse.jdt.compile
 r.tool,org.eclipse.jdt.compiler.tool.source,org.eclipse.jdt.core,org.eclipse.jdt.core.manipulation,org.eclipse.jdt.core.manipulation.source,org.eclipse.jdt.core.source,org.eclipse.jdt.debug,org.eclipse.jdt.debug.source,org.eclipse.jdt.debug.ui,org.eclipse.jdt.debug.ui.source,org.eclipse.jdt.doc.isv,org.eclipse.jdt.doc.user,org.eclipse.jdt.junit,org.eclipse.jdt.junit.runtime,org.eclipse.jdt.junit.runtime.source,org.eclipse.jdt.junit.source,org.eclipse.jdt.junit4.runtime,org.eclipse.jdt.junit4.runtime.source,org.eclipse.jdt.launching,org.eclipse.jdt.launching.source,org.eclipse.jdt.source,org.eclipse.jdt.ui,org.eclipse.jdt.ui.source,org.eclipse.jem.util,org.eclipse.jface,org.eclipse.jface.databinding,org.eclipse.jface.databinding.source,org.eclipse.jface.source,org.eclipse.jface.text,org.eclipse.jface.text.source,org.eclipse.jsch.core,org.eclipse.jsch.core.source,org.eclipse.jsch.ui,org.eclipse.jsch.ui.source,org.eclipse.ltk.core.refactoring,org.eclipse.ltk.core.refactoring.so
 urce,org.eclipse.ltk.ui.refactoring,org.eclipse.ltk.ui.refactoring.source,org.eclipse.mylyn,org.eclipse.mylyn.bugzilla.core,org.eclipse.mylyn.bugzilla.ide,org.eclipse.mylyn.bugzilla.ui,org.eclipse.mylyn.commons.core,org.eclipse.mylyn.commons.net,org.eclipse.mylyn.commons.ui,org.eclipse.mylyn.compatibility,org.eclipse.mylyn.context.core,org.eclipse.mylyn.context.ui,org.eclipse.mylyn.help.ui,org.eclipse.mylyn.ide.ant,org.eclipse.mylyn.ide.ui,org.eclipse.mylyn.java.tasks,org.eclipse.mylyn.java.ui,org.eclipse.mylyn.monitor.core,org.eclipse.mylyn.monitor.ui,org.eclipse.mylyn.pde.ui,org.eclipse.mylyn.resources.ui,org.eclipse.mylyn.tasks.bugs,org.eclipse.mylyn.tasks.core,org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.team.cvs,org.eclipse.mylyn.team.ui,org.eclipse.osgi,org.eclipse.osgi.services,org.eclipse.osgi.services.source,org.eclipse.osgi.source,org.eclipse.osgi.util,org.eclipse.osgi.util.source,org.eclipse.pde,org.eclipse.pde.api.tools,org.eclipse.pde.api.tools.source,org.eclips
 e.pde.api.tools.ui,org.eclipse.pde.api.tools.ui.source,org.eclipse.pde.build,org.eclipse.pde.build.source,org.eclipse.pde.core,org.eclipse.pde.core.source,org.eclipse.pde.doc.user,org.eclipse.pde.junit.runtime,org.eclipse.pde.junit.runtime.source,org.eclipse.pde.p2.ui,org.eclipse.pde.p2.ui.source,org.eclipse.pde.runtime,org.eclipse.pde.runtime.source,org.eclipse.pde.source,org.eclipse.pde.ui,org.eclipse.pde.ui.source,org.eclipse.pde.ui.templates,org.eclipse.pde.ui.templates.source,org.eclipse.platform,org.eclipse.platform.doc.isv,org.eclipse.platform.doc.user,org.eclipse.platform.source,org.eclipse.rcp,org.eclipse.rcp.source,org.eclipse.sdk,org.eclipse.search,org.eclipse.search.source,org.eclipse.swt,org.eclipse.swt.win32.win32.x86,org.eclipse.swt.win32.win32.x86.source,org.eclipse.team.core,org.eclipse.team.core.source,org.eclipse.team.cvs.core,org.eclipse.team.cvs.core.source,org.eclipse.team.cvs.ssh,org.eclipse.team.cvs.ssh.source,org.eclipse.team.cvs.ssh2,org.eclipse.tea
 m.cvs.ssh2.source,org.eclipse.team.cvs.ui,org.eclipse.team.cvs.ui.source,org.eclipse.team.ui,org.eclipse.team.ui.source,org.eclipse.text,org.eclipse.text.source,org.eclipse.ui,org.eclipse.ui.browser,org.eclipse.ui.browser.source,org.eclipse.ui.cheatsheets,org.eclipse.ui.cheatsheets.source,org.eclipse.ui.console,org.eclipse.ui.console.source,org.eclipse.ui.editors,org.eclipse.ui.editors.source,org.eclipse.ui.externaltools,org.eclipse.ui.externaltools.source,org.eclipse.ui.forms,org.eclipse.ui.forms.source,org.eclipse.ui.ide,org.eclipse.ui.ide.application,org.eclipse.ui.ide.application.source,org.eclipse.ui.ide.source,org.eclipse.ui.intro,org.eclipse.ui.intro.source,org.eclipse.ui.intro.universal,org.eclipse.ui.intro.universal.source,org.eclipse.ui.navigator,org.eclipse.ui.navigator.resources,org.eclipse.ui.navigator.resources.source,org.eclipse.ui.navigator.source,org.eclipse.ui.net,org.eclipse.ui.net.source,org.eclipse.ui.presentations.r21,org.eclipse.ui.presentations.r21.so
 urce,org.eclipse.ui.source,org.eclipse.ui.views,org.eclipse.ui.views.log,org.eclipse.ui.views.log.source,org.eclipse.ui.views.properties.tabbed,org.eclipse.ui.views.properties.tabbed.source,org.eclipse.ui.views.source,org.eclipse.ui.win32,org.eclipse.ui.win32.source,org.eclipse.ui.workbench,org.eclipse.ui.workbench.compatibility,org.eclipse.ui.workbench.compatibility.source,org.eclipse.ui.workbench.source,org.eclipse.ui.workbench.texteditor,org.eclipse.ui.workbench.texteditor.source,org.eclipse.update.configurator,org.eclipse.update.configurator.source,org.eclipse.update.core,org.eclipse.update.core.source,org.eclipse.update.core.win32,org.eclipse.update.core.win32.source,org.eclipse.update.scheduler,org.eclipse.update.scheduler.source,org.eclipse.update.ui,org.eclipse.update.ui.source,org.eclipse.wst.command.env,org.eclipse.wst.command.env.core,org.eclipse.wst.command.env.infopop,org.eclipse.wst.command.env.ui,org.eclipse.wst.common.core,org.eclipse.wst.common.emf,org.eclip
 se.wst.common.emfworkbench.integration,org.eclipse.wst.common.environment,org.eclipse.wst.common.frameworks,org.eclipse.wst.common.frameworks.ui,org.eclipse.wst.common.infopop,org.eclipse.wst.common.modulecore,org.eclipse.wst.common.project.facet.core,org.eclipse.wst.common.project.facet.ui,org.eclipse.wst.common.snippets,org.eclipse.wst.common.ui,org.eclipse.wst.common.uriresolver,org.eclipse.wst.dtd.core,org.eclipse.wst.dtd.ui,org.eclipse.wst.dtd.ui.infopop,org.eclipse.wst.dtdeditor.doc.user,org.eclipse.wst.internet.cache,org.eclipse.wst.sse.core,org.eclipse.wst.sse.doc.user,org.eclipse.wst.sse.ui,org.eclipse.wst.sse.ui.infopop,org.eclipse.wst.standard.schemas,org.eclipse.wst.validation,org.eclipse.wst.validation.infopop,org.eclipse.wst.validation.ui,org.eclipse.wst.xml.core,org.eclipse.wst.xml.ui,org.eclipse.wst.xml.ui.infopop,org.eclipse.wst.xmleditor.doc.user,org.eclipse.wst.xsd.core,org.eclipse.wst.xsd.ui,org.eclipse.wst.xsdeditor.doc.user,org.eclipse.xsd,org.eclipse.x
 sd.edit,org.jivesoftware.smack,org.junit,org.junit.source,org.junit4,org.junit4.source,org.mortbay.jetty,org.mortbay.jetty.source,org.objectweb.asm*3.1.0.v200803061910,org.objectweb.asm*3.0.0.v200803061811,org.objectweb.asm.source,org.sat4j.core,org.sat4j.pb"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<booleanAttribute key="useProduct" value="true"/>
+<booleanAttribute key="usefeatures" value="false"/>
+</launchConfiguration>

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/openjpa-eclipse.launch
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/openjpa-eclipse.launch?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/openjpa-eclipse.launch (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/openjpa-eclipse.launch Thu Dec 10 00:00:07 2009
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="true"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="false"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
+<booleanAttribute key="default" value="true"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location" value="${workspace_loc:openjpa-eclipse/src/test/junit-workspace}"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/openjpa-eclipse"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=openjpa-eclipse"/>
+<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
+<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
+<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="openjpa-eclipse"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms128m -Xmx512m -XX:PermSize=64m -XX:MaxPermSize=256m"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product" value="org.eclipse.platform.ide"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="true"/>
+<booleanAttribute key="useDefaultConfigArea" value="false"/>
+<booleanAttribute key="useProduct" value="true"/>
+</launchConfiguration>

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/plugin.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/plugin.xml?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/plugin.xml (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/plugin.xml Thu Dec 10 00:00:07 2009
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+
+   <extension
+         id="OpenJPAEnhancerBuilder"
+         name="OpenJPA PC-Enhancer Project Builder"
+         point="org.eclipse.core.resources.builders">
+      <builder
+            hasNature="true">
+         <run
+               class="org.apache.openjpa.eclipse.OpenJPAEnhancerBuilder">
+         </run>
+      </builder>
+   </extension>
+   <extension
+         id="OpenJPANature"
+         name="OpenJPA Project Nature"
+         point="org.eclipse.core.resources.natures">
+      <runtime>
+         <run
+               class="org.apache.openjpa.eclipse.OpenJPANature">
+         </run>
+      </runtime>
+      <builder
+            id="org.apache.openjpa.eclipse.OpenJPAEnhancerBuilder">
+      </builder>
+   </extension>
+   <extension
+         point="org.eclipse.ui.popupMenus">
+      <objectContribution
+            adaptable="true"
+            objectClass="org.eclipse.core.resources.IProject"
+            nameFilter="*"
+            id="org.apache.openjpa.eclipse.contribution1">
+         <action
+               label="Add/Remove OpenJPA Builder"
+               class="org.apache.openjpa.eclipse.ToggleNatureAction"
+               menubarPath="additions"
+               enablesFor="+"
+               id="org.apache.openjpa.eclipse.addRemoveNatureAction">
+         </action>
+      </objectContribution>
+   </extension>
+   <extension
+         id="openJPAEnhancementProblem"
+         name="OpenJPA Enhancement Problem"
+         point="org.eclipse.core.resources.markers">
+      <super
+            type="org.eclipse.core.resources.problemmarker">
+      </super>
+      <persistent
+            value="true">
+      </persistent>
+   </extension>
+
+</plugin>

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/plugin.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/pom.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/pom.xml?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/pom.xml (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/pom.xml Thu Dec 10 00:00:07 2009
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>org.apache.openjpa.eclipse.all</artifactId>
+    <groupId>org.apache.openjpa.eclipse</groupId>
+    <version>1.0.0-SNAPSHOT</version>
+  </parent>
+  <groupId>org.apache.openjpa.eclipse</groupId>
+  <artifactId>org.apache.openjpa.eclipse</artifactId>
+  <version>1.0.0</version>
+  <packaging>eclipse-plugin</packaging>
+</project>

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/Activator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/Activator.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/Activator.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/Activator.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ * 
+ * @author Eclipse PDE Example Wizard! ;-)
+ * @author Michael Vorburger (MVO)
+ */
+public class Activator extends AbstractUIPlugin {
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.apache.openjpa.eclipse";
+
+	// The shared instance
+	private static Activator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return imageDescriptorFromPlugin(PLUGIN_ID, path);
+	}
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/BuilderOptions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/BuilderOptions.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/BuilderOptions.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/BuilderOptions.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse;
+
+import org.apache.openjpa.eclipse.util.PathMatcherUtil;
+
+/**
+ * Helper class to pass through "options" (read from the project.xml) in the builder.
+ * 
+ * @author Michael Vorburger
+ */
+public class BuilderOptions {
+
+	public PathMatcherUtil pathMatcher;
+	
+	public boolean isVerboseLoggingEnabled; 
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/BuilderOptions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPAEnhancerBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPAEnhancerBuilder.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPAEnhancerBuilder.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPAEnhancerBuilder.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,295 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse;
+
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+
+import org.apache.openjpa.eclipse.util.ClassLoaderFromIProjectHelper;
+import org.apache.openjpa.eclipse.util.LogUtil;
+import org.apache.openjpa.eclipse.util.PCEnhancerHelper;
+import org.apache.openjpa.eclipse.util.PCEnhancerHelperImpl;
+import org.apache.openjpa.eclipse.util.PathMatcherUtil;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+
+/**
+ * Builder for the OpenJPA PCEnhancer.
+ * 
+ * @see org.apache.openjpa.enhance.PCEnhancer
+ * 
+ * @author Eclipse PDE Example Wizard! ;-)
+ * @author Michael Vorburger (MVO)
+ */
+public class OpenJPAEnhancerBuilder extends IncrementalProjectBuilder {
+
+	public static final String BUILDER_ID = "org.apache.openjpa.eclipse.OpenJPAEnhancerBuilder";
+
+	private static final String MARKER_TYPE = "org.apache.openjpa.eclipse.openJPAEnhancementProblem";
+
+	private class MyIncrementalBuildResourceDeltaVisitor implements IResourceDeltaVisitor {
+		private final IProgressMonitor monitor;
+		private final PCEnhancerHelper enhancerHelper;
+		private final BuilderOptions opts;
+
+		public MyIncrementalBuildResourceDeltaVisitor(IProgressMonitor monitor, PCEnhancerHelper enhancerHelper, BuilderOptions opts) {
+			this.monitor = monitor;
+			this.enhancerHelper = enhancerHelper;
+			this.opts = opts;
+		}
+
+		public boolean visit(IResourceDelta delta) throws CoreException {
+			// better do NOT use monitor.worked() & monitor.subTask() here, as this is fast enough and any UI will only slow it down
+			IResource resource = delta.getResource();
+			switch (delta.getKind()) {
+			// If Added or Changed, handle changed resource:
+			case IResourceDelta.ADDED:
+			case IResourceDelta.CHANGED:
+				if (needsEnhancement(resource, opts)) {
+					if (enhance(resource, this.enhancerHelper, opts)) {
+						delta.getResource().refreshLocal(IResource.DEPTH_ZERO, monitor);
+					}
+				}
+				break;
+			// If Removed, nothing to do:
+			case IResourceDelta.REMOVED:
+				break;
+			}
+			// return true to continue visiting children
+			return true;
+		}
+	}
+
+	private class MyFullBuildResourceVisitor implements IResourceVisitor {
+		private final IProgressMonitor monitor;
+		private final List<IResource> list = new LinkedList<IResource>();
+		private final BuilderOptions opts;
+
+		public MyFullBuildResourceVisitor(IProgressMonitor monitor, BuilderOptions opts) {
+			this.monitor = monitor;
+			this.opts = opts;
+		}
+
+		public boolean visit(IResource resource) throws CoreException {
+			// NO monitor.worked(1);
+
+			if (needsEnhancement(resource, opts))
+				list.add(resource);
+				
+			checkCancel(monitor);
+			
+			// return true to continue visiting children
+			return true;
+		}
+		
+		List<IResource> getResourcesPotentiallyNeedingEnhancement() {
+			return list;
+		}
+	}
+
+	
+	@Override
+	@SuppressWarnings("unchecked")
+	protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {
+		BuilderOptions opts = new BuilderOptions();
+		opts.pathMatcher = new PathMatcherUtil(args);
+		opts.isVerboseLoggingEnabled = isFullLoggingEnabled(args);
+		
+		if (kind == FULL_BUILD) {
+			fullBuild(monitor, opts);
+		} else {
+			IResourceDelta delta = getDelta(getProject());
+			if (delta == null) {
+				fullBuild(monitor, opts);
+			} else {
+				incrementalBuild(delta, monitor, opts);
+			}
+		}
+		return null;
+	}
+
+	private void fullBuild(final IProgressMonitor monitor, BuilderOptions opts) throws CoreException {
+		long startTime = System.currentTimeMillis();
+		monitor.subTask("OpenJPA Enhancement... (Full Build, collecting resources)");
+		MyFullBuildResourceVisitor visitor = new MyFullBuildResourceVisitor(monitor, opts);
+		getProject().accept(visitor);
+		long duration = System.currentTimeMillis() - startTime;
+		if (opts.isVerboseLoggingEnabled)
+			LogUtil.logOK("OpenJPA Enhancement (Full Build, collecting resources) took "
+				+ duration + "ms, found " + visitor.getResourcesPotentiallyNeedingEnhancement().size()
+				+ " classes potentially needing enhancement");
+	
+		List<IResource> resources = visitor.getResourcesPotentiallyNeedingEnhancement();
+		if (!resources.isEmpty()) {
+			SubMonitor subMonitor = SubMonitor.convert(monitor, "OpenJPA Enhancement... (Full Build, actual bytecode work)", resources.size());
+			try {
+				int actuallyEnhanced = 0;
+				startTime = System.currentTimeMillis();
+				ClassLoader classLoader = ClassLoaderFromIProjectHelper.createClassLoader(getProject());
+
+				PCEnhancerHelper enhancerHelper = new PCEnhancerHelperImpl(classLoader);
+				for (IResource resource : resources) {
+					subMonitor.subTask("OpenJPA Enhancement... (Full Build, enhancing " + resource.getName() + ")");
+					checkCancel(subMonitor);
+					if (enhance(resource, enhancerHelper, opts)) {
+						++actuallyEnhanced;
+					}
+					subMonitor.worked(1);
+				}
+				
+				duration = System.currentTimeMillis() - startTime;
+				if (opts.isVerboseLoggingEnabled)
+					LogUtil.logOK("OpenJPA Enhancement (Full Build) took " + duration + "ms, for " + resources.size()
+							+ " potential classes, of which " + actuallyEnhanced + " were actually enhanced");
+			} finally {
+				// LogUtil.logInfo("OpenJPA Enhancement (Full Build) will now cause a full project refresh");
+				getProject().refreshLocal(IResource.DEPTH_INFINITE, subMonitor.newChild(1));
+				// LogUtil.logOK("OpenJPA Enhancement (Full Build) completely done (after refresh), good bye.");
+				monitor.done();
+			}
+		}
+	}
+
+	private void incrementalBuild(IResourceDelta delta, IProgressMonitor monitor, BuilderOptions opts) throws CoreException {
+		monitor.subTask("OpenJPA Enhancement... (Incremental Build)");
+		try {
+			ClassLoader classLoader = ClassLoaderFromIProjectHelper.createClassLoader(getProject());
+			PCEnhancerHelper enhancerHelper = new PCEnhancerHelperImpl(classLoader);
+			delta.accept(new MyIncrementalBuildResourceDeltaVisitor(monitor, enhancerHelper, opts));
+		} finally {
+			monitor.done();
+		}
+	}
+
+	/**
+	 * Check if a resource needs enhancement.
+	 * Needs to be very fast, should NOT e.g. actually analyze any class files (do that later only).
+	 * @param opts 
+	 */
+	private boolean needsEnhancement(IResource resource, BuilderOptions opts) throws CoreException {
+		if (resource instanceof IFile && resource.getName().endsWith(".class")) {
+			IFile iFile = (IFile) resource;
+			String fileNameForLog = iFile.getFullPath().toString();
+			deleteMarkers(iFile);
+			
+			if (!opts.pathMatcher.match(iFile.getLocation().toString())) {
+				if (opts.isVerboseLoggingEnabled) {
+					LogUtil.logInfo("OpenJPA Enhancer skipped class because it did not match pattern " + fileNameForLog );
+				}
+				return false;
+			}
+			
+			return true;
+		} else {
+			return false;
+		}
+	}
+	
+	private boolean enhance(IResource resource, PCEnhancerHelper enhancerHelper, BuilderOptions opts) throws CoreException {
+		IFile iFile = (IFile) resource;
+		String fileNameForLog = iFile.getFullPath().toString();
+		try {
+			File file = iFile.getLocation().toFile();
+			boolean hasEnhanced = enhancerHelper.enhance(file);
+			if (opts.isVerboseLoggingEnabled) {
+				if (hasEnhanced)
+					LogUtil.logInfo("OpenJPA Enhancer ran on and actually bytecode enhanced " + fileNameForLog);
+				else
+					LogUtil.logInfo("OpenJPA Enhancer ran on but did not have to bytecode enhance " + fileNameForLog);
+			}
+			
+			return hasEnhanced;
+		} catch (Throwable e) {
+			String msg = "OpenJPA Enhancement Builder failed with message '" + e.toString() + "' for class: " + iFile.getLocation();
+			addMarkerAndThrowNewCoreException(iFile, msg, e);
+			return false;
+		}
+	}
+
+	/**
+	 * Note that if full/verbose logging is enabled, which writes to that Error
+	 * Log view, then something in Eclipse (3.4 at least) goes wrong with the
+	 * Progress view and the Monitor stuff - it doesn't update correctly, and
+	 * keeps running!
+	 */
+	private boolean isFullLoggingEnabled(Map<String, String> args) {
+		if (args.containsKey("debugLogs")) {
+			return "true".equalsIgnoreCase((String) args.get("debugLogs"));
+		}
+		return false;
+	}
+
+	private void addMarkerAndThrowNewCoreException(IFile iFile, String msg, Throwable e) throws CoreException {
+		addMarker(iFile, msg, 0, IMarker.SEVERITY_ERROR);
+		logAndThrowNewCoreException(msg, e);
+	}
+
+	private void logAndThrowNewCoreException(String msg, Throwable e) throws CoreException {
+		LogUtil.logError(msg, e);
+		IStatus status;
+		if (e != null) {
+			status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, msg, e);
+		} else {
+			status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, msg);
+		}
+		throw new CoreException(status);
+	}
+
+	private void addMarker(IFile file, String message, int lineNumber, int severity) {
+		try {
+			IMarker marker = file.createMarker(MARKER_TYPE);
+			marker.setAttribute(IMarker.MESSAGE, message);
+			marker.setAttribute(IMarker.SEVERITY, severity);
+			if (lineNumber == -1) {
+				lineNumber = 1;
+			}
+			marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
+		} catch (CoreException e) {
+		}
+	}
+
+	private void deleteMarkers(IFile file) {
+		try {
+			file.deleteMarkers(MARKER_TYPE, false, IResource.DEPTH_ZERO);
+		} catch (CoreException ce) {
+		}
+	}
+
+	private void checkCancel(IProgressMonitor monitor) {
+		// @see http://www.eclipse.org/articles/Article-Builders/builders.html
+		if (monitor.isCanceled()) {
+			// No monitor.done(); in example 
+			forgetLastBuiltState(); // not sure if this is really necessary for us, but probably doesn't hurt? 
+			throw new OperationCanceledException();
+		}
+	}
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPAEnhancerBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPANature.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPANature.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPANature.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPANature.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse;
+
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Eclipse Nature for a Project with OpenJPA Builder.
+ *
+ * @author Eclipse PDE Example Wizard! ;-)
+ * @author Michael Vorburger (MVO)
+ */
+public class OpenJPANature implements IProjectNature {
+
+	/**
+	 * ID of this project nature
+	 */
+	public static final String NATURE_ID = "org.apache.openjpa.eclipse.OpenJPANature";
+
+	private IProject project;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.resources.IProjectNature#configure()
+	 */
+	public void configure() throws CoreException {
+		IProjectDescription desc = project.getDescription();
+		ICommand[] commands = desc.getBuildSpec();
+
+		for (int i = 0; i < commands.length; ++i) {
+			if (commands[i].getBuilderName().equals(OpenJPAEnhancerBuilder.BUILDER_ID)) {
+				return;
+			}
+		}
+
+		ICommand[] newCommands = new ICommand[commands.length + 1];
+		System.arraycopy(commands, 0, newCommands, 0, commands.length);
+		ICommand command = desc.newCommand();
+		command.setBuilderName(OpenJPAEnhancerBuilder.BUILDER_ID);
+		newCommands[newCommands.length - 1] = command;
+		desc.setBuildSpec(newCommands);
+		project.setDescription(desc, null);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.resources.IProjectNature#deconfigure()
+	 */
+	public void deconfigure() throws CoreException {
+		IProjectDescription description = getProject().getDescription();
+		ICommand[] commands = description.getBuildSpec();
+		for (int i = 0; i < commands.length; ++i) {
+			if (commands[i].getBuilderName().equals(OpenJPAEnhancerBuilder.BUILDER_ID)) {
+				ICommand[] newCommands = new ICommand[commands.length - 1];
+				System.arraycopy(commands, 0, newCommands, 0, i);
+				System.arraycopy(commands, i + 1, newCommands, i,
+						commands.length - i - 1);
+				description.setBuildSpec(newCommands);
+				return;
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.resources.IProjectNature#getProject()
+	 */
+	public IProject getProject() {
+		return project;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.core.resources.IProjectNature#setProject(org.eclipse.core.resources.IProject)
+	 */
+	public void setProject(IProject project) {
+		this.project = project;
+	}
+
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/OpenJPANature.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/ToggleNatureAction.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/ToggleNatureAction.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/ToggleNatureAction.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/ToggleNatureAction.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * Action to Add/Remove OpenJPA Project Nature.
+ * 
+ * @author Eclipse PDE Example Wizard! ;-)
+ * @author Michael Vorburger (MVO)
+*/
+public class ToggleNatureAction implements IObjectActionDelegate {
+
+	private ISelection selection;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+	 */
+	@SuppressWarnings("unchecked")
+	public void run(IAction action) {
+		if (selection instanceof IStructuredSelection) {
+			for (Iterator it = ((IStructuredSelection) selection).iterator(); it
+					.hasNext();) {
+				Object element = it.next();
+				IProject project = null;
+				if (element instanceof IProject) {
+					project = (IProject) element;
+				} else if (element instanceof IAdaptable) {
+					project = (IProject) ((IAdaptable) element)
+							.getAdapter(IProject.class);
+				}
+				if (project != null) {
+					toggleNature(project);
+				}
+			}
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
+	 *      org.eclipse.jface.viewers.ISelection)
+	 */
+	public void selectionChanged(IAction action, ISelection selection) {
+		this.selection = selection;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
+	 *      org.eclipse.ui.IWorkbenchPart)
+	 */
+	public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+	}
+
+	/**
+	 * Toggles sample nature on a project
+	 * 
+	 * @param project
+	 *            to have sample nature added or removed
+	 */
+	private void toggleNature(IProject project) {
+		try {
+			IProjectDescription description = project.getDescription();
+			String[] natures = description.getNatureIds();
+
+			for (int i = 0; i < natures.length; ++i) {
+				if (OpenJPANature.NATURE_ID.equals(natures[i])) {
+					// Remove the nature
+					String[] newNatures = new String[natures.length - 1];
+					System.arraycopy(natures, 0, newNatures, 0, i);
+					System.arraycopy(natures, i + 1, newNatures, i,
+							natures.length - i - 1);
+					description.setNatureIds(newNatures);
+					project.setDescription(description, null);
+					return;
+				}
+			}
+
+			// Add the nature
+			String[] newNatures = new String[natures.length + 1];
+			System.arraycopy(natures, 0, newNatures, 0, natures.length);
+			newNatures[natures.length] = OpenJPANature.NATURE_ID;
+			description.setNatureIds(newNatures);
+			project.setDescription(description, null);
+		} catch (CoreException e) {
+		}
+	}
+
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/ToggleNatureAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/ClassLoaderFromIProjectHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/ClassLoaderFromIProjectHelper.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/ClassLoaderFromIProjectHelper.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/ClassLoaderFromIProjectHelper.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse.util;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+
+import org.apache.openjpa.eclipse.Activator;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.launching.JavaRuntime;
+
+/**
+ * Helper to get a ClassLoader from an Eclipse IProject. 
+ *
+ * @author Kai Kreuzer
+ * @author Michael Vorburger
+ */
+public class ClassLoaderFromIProjectHelper {
+
+	public static ClassLoader createClassLoader(IProject project) throws CoreException {
+		IJavaProject javaProject = JavaCore.create(project);
+        String[] classPath = JavaRuntime.computeDefaultRuntimeClassPath(javaProject);
+        URL[] urls = new URL[classPath.length];
+        for(int i=0;i<classPath.length;i++) {
+        	try {
+        		String urlString = "file:///" + classPath[i].replace('\\', '/');
+        		
+        		// make sure that directory URLs end with a slash as they are otherwise not 
+        		// treated as directories but as libraries by the URLClassLoader
+        		if(!classPath[i].endsWith(".jar") && !classPath[i].endsWith("/")) urlString += "/";
+				urls[i] = new URL(urlString);
+			} catch (MalformedURLException e) {
+				throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+						"Could not resolve classpath correctly.", e));
+			}
+        }
+        return URLClassLoader.newInstance(urls);
+	}
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/ClassLoaderFromIProjectHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/EclipseLogFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/EclipseLogFactory.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/EclipseLogFactory.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/EclipseLogFactory.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse.util;
+
+import org.apache.openjpa.lib.log.AbstractLog;
+import org.apache.openjpa.lib.log.Log;
+import org.apache.openjpa.lib.log.LogFactory;
+
+/**
+ * An OpenJPA LogFactory which logs using the Eclipse logging stuff.
+ * 
+ * @see LogFactory
+ * @see LogUtil
+ * 
+ * @author Michael Vorburger
+ */
+public class EclipseLogFactory implements LogFactory {
+
+	/**
+	 * @see http://openjpa.apache.org/builds/latest/docs/manual/ref_guide_logging_custom.html
+	 * 
+	 * @see org.apache.openjpa.lib.log.LogFactory#getLog(java.lang.String)
+	 */
+	public Log getLog(String channel) {
+		return new AbstractLog() {
+
+            protected boolean isEnabled(short logLevel) {
+                // log all levels
+                return true;
+            }
+
+            protected void log(short type, String message, Throwable t) {
+            	if (type == Log.ERROR || type == Log.FATAL)
+            		LogUtil.logError("OpenJPA Error: " + message, t);
+            	if (type == Log.WARN)
+            		LogUtil.logWarn("OpenJPA Warning: " + message, t);
+            	
+            	// Ignore other internal messages... could be made this configurable via Builder argument (like include pattern), if really needed 
+            	// else
+            		// LogUtil.logInfo("OpenJPA Info: " + message, t);
+            }
+        };
+	}
+
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/EclipseLogFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/LogUtil.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/LogUtil.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/LogUtil.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/LogUtil.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse.util;
+
+
+import org.apache.openjpa.eclipse.Activator;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * Helper for Logging.
+ * 
+ * @author Michael Vorburger
+ */
+public final class LogUtil {
+	private LogUtil() { };
+	
+	public static void logOK(String msg) {
+		log(Status.OK, msg);
+		
+	}
+	public static void logInfo(String msg) {
+		log(Status.INFO, msg);
+	}
+	
+	public static void logInfo(String msg, Throwable t) {
+		log(Status.INFO, msg, t);
+	}
+
+	public static void logWarn(String msg, Throwable t) {
+		log(Status.WARNING, msg, t);
+	}
+	
+	public static void logError(Throwable t) {
+		log(Status.ERROR, t.getMessage(), t);
+	}
+
+	public static void logError(String msg, Throwable t) {
+		log(Status.ERROR, msg, t);
+	}
+
+	private static void log(int status, String msg) {
+		Activator.getDefault().getLog().log(new Status(status, Activator.PLUGIN_ID, msg));
+	}
+
+	private static void log(int status, String msg, Throwable t) {
+		Activator.getDefault().getLog().log(new Status(status, Activator.PLUGIN_ID, msg, t));
+	}
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/LogUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelper.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelper.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelper.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * Interface to an OpenJPA Persistence Capable Enhancer Helper implementation.
+ * 
+ * @author Michael Vorburger
+ */
+public interface PCEnhancerHelper {
+
+	boolean enhance(File resource) throws CoreException, IOException, ClassNotFoundException;
+
+}
\ No newline at end of file

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperClassLoadingWrapper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperClassLoadingWrapper.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperClassLoadingWrapper.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperClassLoadingWrapper.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse.util;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * PCEnhancerHelper implementation wrapping around the original
+ * PCEnhancerHelperImpl, but delegating lookup of the actual OpenJPA classes to
+ * a passed-in classloader (the one of the project).
+ * 
+ * The idea is to use the OpenJPA JARs from the projects under enhancement, and
+ * in the future no longer bundle them in the plug-in. This way the plug-in is
+ * independent of the OpenJPA version. This is important as the enhancer
+ * implementation can change between OpenJPA versions, and the enhancer of the
+ * same OpenJPA version than the project has on it's classpath should naturally
+ * be used, not some fixed arbitrary version that happens to come with the
+ * plug-in.
+ * 
+ * @author Michael Vorburger
+ */
+public class PCEnhancerHelperClassLoadingWrapper implements PCEnhancerHelper {
+
+	/*
+	 * TODO PCEnhancerHelperClassLoadingWrapper does not yet work! FIXME!!!  
+	 * Thread.currentThread().setContextClassLoader seems to have no effect, how the h%#ยง ??? ;-)
+	 */
+	
+	private final ClassLoader classLoader;
+	private final PCEnhancerHelper delegateHelper;
+	
+	public PCEnhancerHelperClassLoadingWrapper(ClassLoader classLoader) {
+		this.classLoader = new FunkyClassLoader(classLoader, Thread.currentThread().getContextClassLoader());
+
+		ClassLoader currentCL = Thread.currentThread().getContextClassLoader();
+		Thread.currentThread().setContextClassLoader(this.classLoader);
+		try {
+			delegateHelper = new PCEnhancerHelperImpl(classLoader);
+		} finally {
+			Thread.currentThread().setContextClassLoader(currentCL);
+		}
+	}
+	
+	public boolean enhance(File resource) throws CoreException, IOException, ClassNotFoundException {
+		ClassLoader currentCL = Thread.currentThread().getContextClassLoader();
+		Thread.currentThread().setContextClassLoader(this.classLoader);
+		try {
+			return delegateHelper.enhance(resource);
+		} finally {
+			Thread.currentThread().setContextClassLoader(currentCL);
+		}
+	}
+	
+	private static class FunkyClassLoader extends ClassLoader {
+		final private ClassLoader delegate;
+		final private ClassLoader cl;
+
+		public FunkyClassLoader(ClassLoader cl, ClassLoader delegate) {
+			this.cl = cl;
+			this.delegate = delegate;
+		}
+		
+		// TODO Is it loadClass() or rather findClass() that needs overriding? 
+		
+		@Override
+		public Class<?> loadClass(String name) throws ClassNotFoundException {
+			try {
+				return cl.loadClass(name);
+			} catch(ClassNotFoundException e) {
+				return delegate.loadClass(name);
+			}
+		}
+	}
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperClassLoadingWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperImpl.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperImpl.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperImpl.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import javax.persistence.Embeddable;
+import javax.persistence.Entity;
+import javax.persistence.MappedSuperclass;
+
+import org.apache.openjpa.conf.OpenJPAConfiguration;
+import org.apache.openjpa.conf.OpenJPAConfigurationImpl;
+import org.apache.openjpa.enhance.PCEnhancer;
+import org.apache.openjpa.meta.ClassMetaData;
+import org.apache.openjpa.meta.MetaDataRepository;
+import org.apache.openjpa.persistence.ManagedInterface;
+import org.eclipse.core.runtime.CoreException;
+
+import serp.bytecode.Annotations;
+import serp.bytecode.BCClass;
+import serp.bytecode.Project;
+
+/**
+ * OpenJPA Enhancer helper, for efficient invocation from an Eclipse builder.
+ * 
+ * @author Pinaki Poddar
+ * @author Michael Vorburger (refactoring and extensions)
+ */
+public class PCEnhancerHelperImpl implements PCEnhancerHelper {
+
+	private final OpenJPAConfiguration conf;
+	private final MetaDataRepository repos;
+	private final ClassLoader loader;
+	// TODO, needed? private final ClassArgParser cap;
+
+	public PCEnhancerHelperImpl(ClassLoader classLoader) {
+		this.loader = classLoader;
+		conf = new OpenJPAConfigurationImpl();
+		Properties prop = new Properties();
+		prop.setProperty("openjpa.MetaDataFactory", "jpa");
+		prop.setProperty("openjpa.Log", EclipseLogFactory.class.getName());
+		conf.fromProperties(prop);
+		
+		repos = conf.getMetaDataRepositoryInstance();
+		repos.setSourceMode(MetaDataRepository.MODE_META);
+		
+		// TODO, needed? cap = conf.getMetaDataRepositoryInstance().getMetaDataFactory().newClassArgParser();
+        // cap.setClassLoader(loader);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.openjpa.eclipse.util.PCEnhancerHelper#enhance(java.io.File)
+	 */
+	public boolean enhance(File resource) throws CoreException, IOException, ClassNotFoundException {
+		// No try/catch here - let Exception propagate upwards
+		// Eclipse will catch them and abandon Build and show cause in the Error Log
+		// Build should stop; if caught here, big projects with some set-up problem will appear to "hang". 
+		
+		// TODO, needed? cap.parseTypes(resource.getAbsolutePath().toString())
+		
+		Project serp = new Project();
+		BCClass bcls = serp.loadClass(resource, loader);
+		
+		if (!needsEnhance(bcls))
+			return false;
+		
+		// Intentionally setting initializeClass to false;
+		// we do NOT want static class initialization to be executed during the builder!
+		Class<?> cls = Class.forName(bcls.getName(), false, loader);
+		
+		repos.removeMetaData(cls);
+		ClassMetaData meta = repos.addMetaData(cls);
+
+		PCEnhancer delegate = new PCEnhancer(repos, bcls, meta);
+		int result = delegate.run();
+		if ((result != PCEnhancer.ENHANCE_NONE)
+		 && (result != PCEnhancer.ENHANCE_INTERFACE)) 
+		{
+			delegate.record();
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	private boolean needsEnhance(BCClass bcls) {
+		Annotations annos = bcls.getDeclaredRuntimeAnnotations(false);
+		
+		if (annos == null) 
+			return false;
+		
+		return (annos.getAnnotation(Entity.class) != null 
+			 || annos.getAnnotation(MappedSuperclass.class) != null
+			 || annos.getAnnotation(Embeddable.class) != null
+			 || annos.getAnnotation(ManagedInterface.class) != null);
+		
+	}
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PCEnhancerHelperImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PathMatcherUtil.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PathMatcherUtil.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PathMatcherUtil.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PathMatcherUtil.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse.util;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.openjpa.eclipse.util.pathmatch.AntPathMatcher;
+
+/**
+ * Util to check matching of Ant-style path patterns. 
+ * 
+ * @author Michael Vorburger (MVO)
+ */
+public class PathMatcherUtil {
+
+	private static final AntPathMatcher antPathMatcher = new AntPathMatcher();
+	private final List<String> includePatterns = new LinkedList<String>();
+	
+	@SuppressWarnings("unchecked")
+	public PathMatcherUtil(Map args) {
+		if (args != null) {
+			Set<String> keys = args.keySet();
+			for (String key : keys) {
+				if (key.toLowerCase().startsWith("include")) {
+					includePatterns.add((String) args.get(key));
+				}
+			}
+		}
+	}
+
+	public boolean match(String fileName) {
+		if (includePatterns.isEmpty())
+			return true;
+		
+		for (String includePattern : includePatterns) {
+			if (antPathMatcher.match(includePattern, fileName))
+				return true;
+		}
+		return false;
+	}
+	
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/PathMatcherUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/pathmatch/AntPathMatcher.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/pathmatch/AntPathMatcher.java?rev=889024&view=auto
==============================================================================
--- openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/pathmatch/AntPathMatcher.java (added)
+++ openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/pathmatch/AntPathMatcher.java Thu Dec 10 00:00:07 2009
@@ -0,0 +1,419 @@
+/*
+ * Copyright 2002-2009 the original author or authors.
+ *
+ * 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 org.apache.openjpa.eclipse.util.pathmatch;
+
+import java.util.Comparator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * PathMatcher implementation for Ant-style path patterns. Examples are provided below.
+ *
+ * <p>Part of this mapping code has been kindly borrowed from <a href="http://ant.apache.org">Apache Ant</a>.
+ *
+ * <p>The mapping matches URLs using the following rules:<br> <ul> <li>? matches one character</li> <li>* matches zero
+ * or more characters</li> <li>** matches zero or more 'directories' in a path</li> </ul>
+ *
+ * <p>Some examples:<br> <ul> <li><code>com/t?st.jsp</code> - matches <code>com/test.jsp</code> but also
+ * <code>com/tast.jsp</code> or <code>com/txst.jsp</code></li> <li><code>com/*.jsp</code> - matches all
+ * <code>.jsp</code> files in the <code>com</code> directory</li> <li><code>com/&#42;&#42;/test.jsp</code> - matches all
+ * <code>test.jsp</code> files underneath the <code>com</code> path</li> <li><code>org/springframework/&#42;&#42;/*.jsp</code>
+ * - matches all <code>.jsp</code> files underneath the <code>org/springframework</code> path</li>
+ * <li><code>org/&#42;&#42;/servlet/bla.jsp</code> - matches <code>org/springframework/servlet/bla.jsp</code> but also
+ * <code>org/springframework/testing/servlet/bla.jsp</code> and <code>org/servlet/bla.jsp</code></li> </ul>
+ *
+ * @author Alef Arendsen
+ * @author Juergen Hoeller
+ * @author Rob Harrop
+ * @author Arjen Poutsma
+ * @since 16.07.2003
+ */
+public class AntPathMatcher implements PathMatcher {
+
+	/** Default path separator: "/" */
+	public static final String DEFAULT_PATH_SEPARATOR = "/";
+
+	private String pathSeparator = DEFAULT_PATH_SEPARATOR;
+
+	/** Set the path separator to use for pattern parsing. Default is "/", as in Ant. */
+	public void setPathSeparator(String pathSeparator) {
+		this.pathSeparator = (pathSeparator != null ? pathSeparator : DEFAULT_PATH_SEPARATOR);
+	}
+
+	public boolean isPattern(String path) {
+		return (path.indexOf('*') != -1 || path.indexOf('?') != -1);
+	}
+
+	public boolean match(String pattern, String path) {
+		return doMatch(pattern, path, true, null);
+	}
+
+	public boolean matchStart(String pattern, String path) {
+		return doMatch(pattern, path, false, null);
+	}
+
+	/**
+	 * Actually match the given <code>path</code> against the given <code>pattern</code>.
+	 *
+	 * @param pattern the pattern to match against
+	 * @param path the path String to test
+	 * @param fullMatch whether a full pattern match is required (else a pattern match as far as the given base path goes
+	 * is sufficient)
+	 * @return <code>true</code> if the supplied <code>path</code> matched, <code>false</code> if it didn't
+	 */
+	protected boolean doMatch(String pattern,
+			String path,
+			boolean fullMatch,
+			Map<String, String> uriTemplateVariables) {
+		if (path.startsWith(this.pathSeparator) != pattern.startsWith(this.pathSeparator)) {
+			return false;
+		}
+
+		String[] pattDirs = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator);
+		String[] pathDirs = StringUtils.tokenizeToStringArray(path, this.pathSeparator);
+
+		int pattIdxStart = 0;
+		int pattIdxEnd = pattDirs.length - 1;
+		int pathIdxStart = 0;
+		int pathIdxEnd = pathDirs.length - 1;
+
+		// Match all elements up to the first **
+		while (pattIdxStart <= pattIdxEnd && pathIdxStart <= pathIdxEnd) {
+			String patDir = pattDirs[pattIdxStart];
+			if ("**".equals(patDir)) {
+				break;
+			}
+			if (!matchStrings(patDir, pathDirs[pathIdxStart], uriTemplateVariables)) {
+				return false;
+			}
+			pattIdxStart++;
+			pathIdxStart++;
+		}
+
+		if (pathIdxStart > pathIdxEnd) {
+			// Path is exhausted, only match if rest of pattern is * or **'s
+			if (pattIdxStart > pattIdxEnd) {
+				return (pattern.endsWith(this.pathSeparator) ? path.endsWith(this.pathSeparator) :
+						!path.endsWith(this.pathSeparator));
+			}
+			if (!fullMatch) {
+				return true;
+			}
+			if (pattIdxStart == pattIdxEnd && pattDirs[pattIdxStart].equals("*") && path.endsWith(this.pathSeparator)) {
+				return true;
+			}
+			for (int i = pattIdxStart; i <= pattIdxEnd; i++) {
+				if (!pattDirs[i].equals("**")) {
+					return false;
+				}
+			}
+			return true;
+		}
+		else if (pattIdxStart > pattIdxEnd) {
+			// String not exhausted, but pattern is. Failure.
+			return false;
+		}
+		else if (!fullMatch && "**".equals(pattDirs[pattIdxStart])) {
+			// Path start definitely matches due to "**" part in pattern.
+			return true;
+		}
+
+		// up to last '**'
+		while (pattIdxStart <= pattIdxEnd && pathIdxStart <= pathIdxEnd) {
+			String patDir = pattDirs[pattIdxEnd];
+			if (patDir.equals("**")) {
+				break;
+			}
+			if (!matchStrings(patDir, pathDirs[pathIdxEnd], uriTemplateVariables)) {
+				return false;
+			}
+			pattIdxEnd--;
+			pathIdxEnd--;
+		}
+		if (pathIdxStart > pathIdxEnd) {
+			// String is exhausted
+			for (int i = pattIdxStart; i <= pattIdxEnd; i++) {
+				if (!pattDirs[i].equals("**")) {
+					return false;
+				}
+			}
+			return true;
+		}
+
+		while (pattIdxStart != pattIdxEnd && pathIdxStart <= pathIdxEnd) {
+			int patIdxTmp = -1;
+			for (int i = pattIdxStart + 1; i <= pattIdxEnd; i++) {
+				if (pattDirs[i].equals("**")) {
+					patIdxTmp = i;
+					break;
+				}
+			}
+			if (patIdxTmp == pattIdxStart + 1) {
+				// '**/**' situation, so skip one
+				pattIdxStart++;
+				continue;
+			}
+			// Find the pattern between padIdxStart & padIdxTmp in str between
+			// strIdxStart & strIdxEnd
+			int patLength = (patIdxTmp - pattIdxStart - 1);
+			int strLength = (pathIdxEnd - pathIdxStart + 1);
+			int foundIdx = -1;
+
+			strLoop:
+			for (int i = 0; i <= strLength - patLength; i++) {
+				for (int j = 0; j < patLength; j++) {
+					String subPat = pattDirs[pattIdxStart + j + 1];
+					String subStr = pathDirs[pathIdxStart + i + j];
+					if (!matchStrings(subPat, subStr, uriTemplateVariables)) {
+						continue strLoop;
+					}
+				}
+				foundIdx = pathIdxStart + i;
+				break;
+			}
+
+			if (foundIdx == -1) {
+				return false;
+			}
+
+			pattIdxStart = patIdxTmp;
+			pathIdxStart = foundIdx + patLength;
+		}
+
+		for (int i = pattIdxStart; i <= pattIdxEnd; i++) {
+			if (!pattDirs[i].equals("**")) {
+				return false;
+			}
+		}
+
+		return true;
+	}
+
+	/**
+	 * Tests whether or not a string matches against a pattern. The pattern may contain two special characters:<br> '*'
+	 * means zero or more characters<br> '?' means one and only one character
+	 *
+	 * @param pattern pattern to match against. Must not be <code>null</code>.
+	 * @param str string which must be matched against the pattern. Must not be <code>null</code>.
+	 * @return <code>true</code> if the string matches against the pattern, or <code>false</code> otherwise.
+	 */
+	private boolean matchStrings(String pattern, String str, Map<String, String> uriTemplateVariables) {
+		AntPathStringMatcher matcher = new AntPathStringMatcher(pattern, str, uriTemplateVariables);
+		return matcher.matchStrings();
+	}
+
+	/**
+	 * Given a pattern and a full path, determine the pattern-mapped part. <p>For example: <ul>
+	 * <li>'<code>/docs/cvs/commit.html</code>' and '<code>/docs/cvs/commit.html</code> -> ''</li>
+	 * <li>'<code>/docs/*</code>' and '<code>/docs/cvs/commit</code> -> '<code>cvs/commit</code>'</li>
+	 * <li>'<code>/docs/cvs/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>commit.html</code>'</li>
+	 * <li>'<code>/docs/**</code>' and '<code>/docs/cvs/commit</code> -> '<code>cvs/commit</code>'</li>
+	 * <li>'<code>/docs/**\/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>cvs/commit.html</code>'</li>
+	 * <li>'<code>/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>docs/cvs/commit.html</code>'</li>
+	 * <li>'<code>*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>/docs/cvs/commit.html</code>'</li>
+	 * <li>'<code>*</code>' and '<code>/docs/cvs/commit.html</code> -> '<code>/docs/cvs/commit.html</code>'</li> </ul>
+	 * <p>Assumes that {@link #match} returns <code>true</code> for '<code>pattern</code>' and '<code>path</code>', but
+	 * does <strong>not</strong> enforce this.
+	 */
+	public String extractPathWithinPattern(String pattern, String path) {
+		String[] patternParts = StringUtils.tokenizeToStringArray(pattern, this.pathSeparator);
+		String[] pathParts = StringUtils.tokenizeToStringArray(path, this.pathSeparator);
+
+		StringBuilder builder = new StringBuilder();
+
+		// Add any path parts that have a wildcarded pattern part.
+		int puts = 0;
+		for (int i = 0; i < patternParts.length; i++) {
+			String patternPart = patternParts[i];
+			if ((patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) && pathParts.length >= i + 1) {
+				if (puts > 0 || (i == 0 && !pattern.startsWith(this.pathSeparator))) {
+					builder.append(this.pathSeparator);
+				}
+				builder.append(pathParts[i]);
+				puts++;
+			}
+		}
+
+		// Append any trailing path parts.
+		for (int i = patternParts.length; i < pathParts.length; i++) {
+			if (puts > 0 || i > 0) {
+				builder.append(this.pathSeparator);
+			}
+			builder.append(pathParts[i]);
+		}
+
+		return builder.toString();
+	}
+
+	public Map<String, String> extractUriTemplateVariables(String pattern, String path) {
+		Map<String, String> variables = new LinkedHashMap<String, String>();
+		boolean result = doMatch(pattern, path, true, variables);
+		Assert.state(result, "Pattern \"" + pattern + "\" is not a match for \"" + path + "\"");
+		return variables;
+	}
+
+	/**
+	 * Combines two patterns into a new pattern that is returned. <p>This implementation simply concatenates the two
+	 * patterns, unless the first pattern contains a file extension match (such as {@code *.html}. In that case, the second
+	 * pattern should be included in the first, or an {@code IllegalArgumentException} is thrown. <p>For example: <table>
+	 * <tr><th>Pattern 1</th><th>Pattern 2</th><th>Result</th></tr> <tr><td>/hotels</td><td>{@code
+	 * null}</td><td>/hotels</td></tr> <tr><td>{@code null}</td><td>/hotels</td><td>/hotels</td></tr>
+	 * <tr><td>/hotels</td><td>/bookings</td><td>/hotels/bookings</td></tr> <tr><td>/hotels</td><td>bookings</td><td>/hotels/bookings</td></tr>
+	 * <tr><td>/hotels/*</td><td>/bookings</td><td>/hotels/bookings</td></tr> <tr><td>/hotels/&#42;&#42;</td><td>/bookings</td><td>/hotels/&#42;&#42;/bookings</td></tr>
+	 * <tr><td>/hotels</td><td>{hotel}</td><td>/hotels/{hotel}</td></tr> <tr><td>/hotels/*</td><td>{hotel}</td><td>/hotels/{hotel}</td></tr>
+	 * <tr><td>/hotels/&#42;&#42;</td><td>{hotel}</td><td>/hotels/&#42;&#42;/{hotel}</td></tr>
+	 * <tr><td>/*.html</td><td>/hotels.html</td><td>/hotels.html</td></tr> <tr><td>/*.html</td><td>/hotels</td><td>/hotels.html</td></tr>
+	 * <tr><td>/*.html</td><td>/*.txt</td><td>IllegalArgumentException</td></tr> </table>
+	 *
+	 * @param pattern1 the first pattern
+	 * @param pattern2 the second pattern
+	 * @return the combination of the two patterns
+	 * @throws IllegalArgumentException when the two patterns cannot be combined
+	 */
+	public String combine(String pattern1, String pattern2) {
+		if (!StringUtils.hasText(pattern1) && !StringUtils.hasText(pattern2)) {
+			return "";
+		}
+		else if (!StringUtils.hasText(pattern1)) {
+			return pattern2;
+		}
+		else if (!StringUtils.hasText(pattern2)) {
+			return pattern1;
+		}
+		else if (match(pattern1, pattern2)) {
+			return pattern2;
+		}
+		else if (pattern1.endsWith("/*")) {
+			if (pattern2.startsWith("/")) {
+				// /hotels/* + /booking -> /hotels/booking
+				return pattern1.substring(0, pattern1.length() - 1) + pattern2.substring(1);
+			}
+			else {
+				// /hotels/* + booking -> /hotels/booking
+				return pattern1.substring(0, pattern1.length() - 1) + pattern2;
+			}
+		}
+		else if (pattern1.endsWith("/**")) {
+			if (pattern2.startsWith("/")) {
+				// /hotels/** + /booking -> /hotels/**/booking
+				return pattern1 + pattern2;
+			}
+			else {
+				// /hotels/** + booking -> /hotels/**/booking
+				return pattern1 + "/" + pattern2;
+			}
+		}
+		else {
+			int dotPos1 = pattern1.indexOf('.');
+			if (dotPos1 == -1) {
+				// simply concatenate the two patterns
+				if (pattern1.endsWith("/") || pattern2.startsWith("/")) {
+					return pattern1 + pattern2;
+				}
+				else {
+					return pattern1 + "/" + pattern2;
+				}
+			}
+			String fileName1 = pattern1.substring(0, dotPos1);
+			String extension1 = pattern1.substring(dotPos1);
+			String fileName2;
+			String extension2;
+			int dotPos2 = pattern2.indexOf('.');
+			if (dotPos2 != -1) {
+				fileName2 = pattern2.substring(0, dotPos2);
+				extension2 = pattern2.substring(dotPos2);
+			}
+			else {
+				fileName2 = pattern2;
+				extension2 = "";
+			}
+			String fileName = fileName1.endsWith("*") ? fileName2 : fileName1;
+			String extension = extension1.startsWith("*") ? extension2 : extension1;
+
+			return fileName + extension;
+		}
+	}
+
+	/**
+	 * Given a full path, returns a {@link Comparator} suitable for sorting patterns in order of explicitness.
+	 *
+	 * <p>The returned <code>Comparator</code> will {@linkplain java.util.Collections#sort(java.util.List,
+	 * java.util.Comparator) sort} a list so that more specific patterns (without uri templates or wild cards) come before
+	 * generic patterns. So given a list with the following patterns: <ol> <li><code>/hotels/new</code></li>
+	 * <li><code>/hotels/{hotel}</code></li> <li><code>/hotels/*</code></li> </ol> the returned comparator will sort this
+	 * list so that the order will be as indicated.
+	 *
+	 * <p>The full path given as parameter is used to test for exact matches. So when the given path is {@code /hotels/2},
+	 * the pattern {@code /hotels/2} will be sorted before {@code /hotels/1}.
+	 *
+	 * @param path the full path to use for comparison
+	 * @return a comparator capable of sorting patterns in order of explicitness
+	 */
+	public Comparator<String> getPatternComparator(String path) {
+		return new AntPatternComparator(path);
+	}
+
+	private static class AntPatternComparator implements Comparator<String> {
+
+		private final String path;
+
+		private AntPatternComparator(String path) {
+			this.path = path;
+		}
+
+		public int compare(String pattern1, String pattern2) {
+			if (pattern1 == null && pattern2 == null) {
+				return 0;
+			}
+			else if (pattern1 == null) {
+				return 1;
+			}
+			else if (pattern2 == null) {
+				return -1;
+			}
+			boolean pattern1EqualsPath = pattern1.equals(path);
+			boolean pattern2EqualsPath = pattern2.equals(path);
+			if (pattern1EqualsPath && pattern2EqualsPath) {
+				return 0;
+			}
+			else if (pattern1EqualsPath) {
+				return -1;
+			}
+			else if (pattern2EqualsPath) {
+				return 1;
+			}
+			int wildCardCount1 = StringUtils.countOccurrencesOf(pattern1, "*");
+			int wildCardCount2 = StringUtils.countOccurrencesOf(pattern2, "*");
+			if (wildCardCount1 < wildCardCount2) {
+				return -1;
+			}
+			else if (wildCardCount2 < wildCardCount1) {
+				return 1;
+			}
+			int bracketCount1 = StringUtils.countOccurrencesOf(pattern1, "{");
+			int bracketCount2 = StringUtils.countOccurrencesOf(pattern2, "{");
+			if (bracketCount1 < bracketCount2) {
+				return -1;
+			}
+			else if (bracketCount2 < bracketCount1) {
+				return 1;
+			}
+			return 0;
+		}
+	}
+
+}

Propchange: openjpa/trunk/contrib/devtools/org.apache.openjpa.eclipse/src/main/java/org/apache/openjpa/eclipse/util/pathmatch/AntPathMatcher.java
------------------------------------------------------------------------------
    svn:eol-style = native