Making code compatiable with OpenJPA coding standards

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@889031 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-12-10 00:18:20 +00:00
parent 658f01ee38
commit 2578261469
8 changed files with 41 additions and 42 deletions

View File

@ -6,15 +6,26 @@
provider-name="Michael Vorburger & others, for Apache.org">
<description url="http://www.example.com/description">
[Enter Feature Description here.]
Activates bytecode enhancement for persistence Java classes
during compilation for OpenJPA applications.
</description>
<copyright url="http://www.example.com/copyright">
[Enter Copyright Description here.]
Copyright 2009-2019 the original author or authors.
</copyright>
<license url="http://www.example.com/license">
[Enter License Description here.]
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.
</license>
<plugin

View File

@ -21,7 +21,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
* The activator class controls the plug-in life cycle.
*
* @author Eclipse PDE Example Wizard! ;-)
* @author Michael Vorburger (MVO)
@ -40,19 +40,13 @@ public class Activator extends AbstractUIPlugin {
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
@Override
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)
*/
@Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);

View File

@ -61,14 +61,16 @@ public class OpenJPAEnhancerBuilder extends IncrementalProjectBuilder {
private final PCEnhancerHelper enhancerHelper;
private final BuilderOptions opts;
public MyIncrementalBuildResourceDeltaVisitor(IProgressMonitor monitor, PCEnhancerHelper enhancerHelper, 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
// 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:
@ -150,7 +152,8 @@ public class OpenJPAEnhancerBuilder extends IncrementalProjectBuilder {
List<IResource> resources = visitor.getResourcesPotentiallyNeedingEnhancement();
if (!resources.isEmpty()) {
SubMonitor subMonitor = SubMonitor.convert(monitor, "OpenJPA Enhancement... (Full Build, actual bytecode work)", resources.size());
SubMonitor subMonitor = SubMonitor.convert(monitor,
"OpenJPA Enhancement... (Full Build, actual bytecode work)", resources.size());
try {
int actuallyEnhanced = 0;
startTime = System.currentTimeMillis();
@ -179,7 +182,8 @@ public class OpenJPAEnhancerBuilder extends IncrementalProjectBuilder {
}
}
private void incrementalBuild(IResourceDelta delta, IProgressMonitor monitor, BuilderOptions opts) throws CoreException {
private void incrementalBuild(IResourceDelta delta, IProgressMonitor monitor, BuilderOptions opts)
throws CoreException {
monitor.subTask("OpenJPA Enhancement... (Incremental Build)");
try {
ClassLoader classLoader = ClassLoaderFromIProjectHelper.createClassLoader(getProject());
@ -203,7 +207,8 @@ public class OpenJPAEnhancerBuilder extends IncrementalProjectBuilder {
if (!opts.pathMatcher.match(iFile.getLocation().toString())) {
if (opts.isVerboseLoggingEnabled) {
LogUtil.logInfo("OpenJPA Enhancer skipped class because it did not match pattern " + fileNameForLog );
LogUtil.logInfo("OpenJPA Enhancer skipped class because it did not match pattern "
+ fileNameForLog );
}
return false;
}
@ -214,7 +219,8 @@ public class OpenJPAEnhancerBuilder extends IncrementalProjectBuilder {
}
}
private boolean enhance(IResource resource, PCEnhancerHelper enhancerHelper, BuilderOptions opts) throws CoreException {
private boolean enhance(IResource resource, PCEnhancerHelper enhancerHelper, BuilderOptions opts)
throws CoreException {
IFile iFile = (IFile) resource;
String fileNameForLog = iFile.getFullPath().toString();
try {
@ -229,7 +235,8 @@ public class OpenJPAEnhancerBuilder extends IncrementalProjectBuilder {
return hasEnhanced;
} catch (Throwable e) {
String msg = "OpenJPA Enhancement Builder failed with message '" + e.toString() + "' for class: " + iFile.getLocation();
String msg = "OpenJPA Enhancement Builder failed with message '" + e.toString() + "' for class: "
+ iFile.getLocation();
addMarkerAndThrowNewCoreException(iFile, msg, e);
return false;
}

View File

@ -61,11 +61,6 @@ public class OpenJPANature implements IProjectNature {
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();
@ -81,20 +76,10 @@ public class OpenJPANature implements IProjectNature {
}
}
/*
* (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;
}

View File

@ -115,5 +115,4 @@ public class ToggleNatureAction implements IObjectActionDelegate {
} catch (CoreException e) {
}
}
}

View File

@ -49,9 +49,10 @@ public class EclipseLogFactory implements LogFactory {
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
// 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);
// LogUtil.logInfo("OpenJPA Info: " + message, t);
}
};
}

View File

@ -90,8 +90,7 @@ public class PCEnhancerHelperImpl implements PCEnhancerHelper {
PCEnhancer delegate = new PCEnhancer(repos, bcls, meta);
int result = delegate.run();
if ((result != PCEnhancer.ENHANCE_NONE)
&& (result != PCEnhancer.ENHANCE_INTERFACE))
{
&& (result != PCEnhancer.ENHANCE_INTERFACE)) {
delegate.record();
return true;
} else {

View File

@ -29,9 +29,12 @@ import java.util.Map;
* 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>
* <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>