| author | Henrik Lynggaard Hansen | 2012-07-17 16:26:04 (EDT) |
|---|---|---|
| committer | Henrik Lynggaard Hansen | 2012-07-19 13:23:33 (EDT) |
| commit | 69ba5185ed3612ec0de2c9bccd1d42eeb8fbc97c (patch) (side-by-side diff) | |
| tree | 1eece7851f6f835947d1802f986bdee581b87c4f | |
| parent | 36e5719c9391e9470866da337653e236e5a3dc05 (diff) | |
| download | org.eclipse.hudson.core-69ba5185ed3612ec0de2c9bccd1d42eeb8fbc97c.zip org.eclipse.hudson.core-69ba5185ed3612ec0de2c9bccd1d42eeb8fbc97c.tar.gz org.eclipse.hudson.core-69ba5185ed3612ec0de2c9bccd1d42eeb8fbc97c.tar.bz2 | |
Reformat org.eclipse.hudson packagesrefs/changes/30/6830/2
Change-Id: I96c5e70d716683a5a80e0841e523442d7b4410fc
Signed-off-by: Henrik Lynggaard Hansen <henrik@hlyh.dk>
48 files changed, 681 insertions, 584 deletions
diff --git a/hudson-core/src/main/java/org/eclipse/hudson/ExpressionFactory2.java b/hudson-core/src/main/java/org/eclipse/hudson/ExpressionFactory2.java index 338de78..b7e8e74 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/ExpressionFactory2.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/ExpressionFactory2.java @@ -8,7 +8,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * + * * *******************************************************************************/ @@ -29,16 +29,17 @@ import java.util.logging.Level; import java.util.logging.Logger; /** - * {@link ExpressionFactory} so that security exception aborts the page rendering. + * {@link ExpressionFactory} so that security exception aborts the page + * rendering. * * @author Kohsuke Kawaguchi -*/ + */ public final class ExpressionFactory2 implements ExpressionFactory { + public Expression createExpression(String text) throws JellyException { try { return new JexlExpression( - org.apache.commons.jexl.ExpressionFactory.createExpression(text) - ); + org.apache.commons.jexl.ExpressionFactory.createExpression(text)); } catch (Exception e) { throw new JellyException("Unable to create expression: " + text, e); } @@ -61,7 +62,9 @@ public final class ExpressionFactory2 implements ExpressionFactory { */ static final class JexlExpression extends ExpressionSupport { - /** The Jexl expression object */ + /** + * The Jexl expression object + */ private org.apache.commons.jexl.Expression expression; public JexlExpression(org.apache.commons.jexl.Expression expression) { @@ -82,32 +85,32 @@ public final class ExpressionFactory2 implements ExpressionFactory { public Object evaluate(JellyContext context) { try { CURRENT_CONTEXT.set(context); - JexlContext jexlContext = new JellyJexlContext( context ); + JexlContext jexlContext = new JellyJexlContext(context); return expression.evaluate(jexlContext); } catch (SpringSecurityException e) { // let the security exception pass through throw e; } catch (Exception e) { - LOGGER.log(Level.WARNING,"Caught exception evaluating: " + expression + ". Reason: " + e, e); + LOGGER.log(Level.WARNING, "Caught exception evaluating: " + expression + ". Reason: " + e, e); return null; } finally { CURRENT_CONTEXT.set(null); } } - private static final Logger LOGGER = Logger.getLogger(JexlExpression.class.getName()); } static final class JellyJexlContext implements JexlContext { + private Map vars; JellyJexlContext(JellyContext context) { - this.vars = new JellyMap( context ); + this.vars = new JellyMap(context); } public void setVars(Map vars) { this.vars.clear(); - this.vars.putAll( vars ); + this.vars.putAll(vars); } public Map getVars() { @@ -115,7 +118,6 @@ public final class ExpressionFactory2 implements ExpressionFactory { } } - static final class JellyMap implements Map { private JellyContext context; @@ -125,7 +127,7 @@ public final class ExpressionFactory2 implements ExpressionFactory { } public Object get(Object key) { - return context.getVariable( (String) key ); + return context.getVariable((String) key); } public void clear() { @@ -133,7 +135,7 @@ public final class ExpressionFactory2 implements ExpressionFactory { } public boolean containsKey(Object key) { - return ( get( key ) != null ); + return (get(key) != null); } public boolean containsValue(Object value) { @@ -172,10 +174,9 @@ public final class ExpressionFactory2 implements ExpressionFactory { return null; } } - /** - * When called from within the JEXL expression evaluation, - * retains the current {@link JellyContext}. + * When called from within the JEXL expression evaluation, retains the + * current {@link JellyContext}. * * @see Functions#getCurrentJellyContext() */ diff --git a/hudson-core/src/main/java/org/eclipse/hudson/HudsonServletContextListener.java b/hudson-core/src/main/java/org/eclipse/hudson/HudsonServletContextListener.java index dcd330a..88c3e2e 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/HudsonServletContextListener.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/HudsonServletContextListener.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Kohsuke Kawaguchi, Winston Prakash, Jean-Baptiste Quenot, Tom Huybrechts - * + * *******************************************************************************/ package org.eclipse.hudson; @@ -54,16 +54,16 @@ import org.slf4j.LoggerFactory; /** * Entry point when Hudson is used as a webapp. * - * @author Kohsuke Kawaguchi, Winston Prakash + * @author Kohsuke Kawaguchi, Winston Prakash */ public final class HudsonServletContextListener implements ServletContextListener { - + private Logger logger = LoggerFactory.getLogger(InitialSetup.class); - private final RingBufferLogHandler handler = new RingBufferLogHandler(); /** - * Creates the sole instance of {@link Hudson} and register it to the {@link ServletContext}. + * Creates the sole instance of {@link Hudson} and register it to the + * {@link ServletContext}. */ @Override public void contextInitialized(ServletContextEvent event) { @@ -75,16 +75,14 @@ public final class HudsonServletContextListener implements ServletContextListene try { // Attempt to set the context controller.setContext(servletContext); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { // context already set ignore } // Setup the default install strategy if not already configured try { controller.setInstallStrategy(new DefaultInstallStrategy()); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { // strategy already set ignore } @@ -92,12 +90,14 @@ public final class HudsonServletContextListener implements ServletContextListene LocaleProvider.setProvider(new LocaleProvider() { @Override public Locale get() { - Locale locale=null; + Locale locale = null; StaplerRequest req = Stapler.getCurrentRequest(); - if(req!=null) + if (req != null) { locale = req.getLocale(); - if(locale==null) + } + if (locale == null) { locale = Locale.getDefault(); + } return locale; } }); @@ -106,8 +106,8 @@ public final class HudsonServletContextListener implements ServletContextListene JVM jvm; try { jvm = new JVM(); - new URLClassLoader(new URL[0],getClass().getClassLoader()); - } catch(SecurityException e) { + new URLClassLoader(new URL[0], getClass().getClassLoader()); + } catch (SecurityException e) { controller.install(new InsufficientPermissionDetected(e)); return; } @@ -124,8 +124,7 @@ public final class HudsonServletContextListener implements ServletContextListene File dir = getHomeDir(event); try { dir = dir.getCanonicalFile(); - } - catch (IOException e) { + } catch (IOException e) { dir = dir.getAbsoluteFile(); } final File home = dir; @@ -134,14 +133,14 @@ public final class HudsonServletContextListener implements ServletContextListene logger.info("Home directory: " + home); // check that home exists (as mkdirs could have failed silently), otherwise throw a meaningful error - if (! home.exists()) { + if (!home.exists()) { controller.install(new NoHomeDir(home)); return; } - - + + // make sure that we are using XStream in the "enhanced" (JVM-specific) mode - if(jvm.bestReflectionProvider().getClass()==PureJavaReflectionProvider.class) { + if (jvm.bestReflectionProvider().getClass() == PureJavaReflectionProvider.class) { // nope controller.install(new IncompatibleVMDetected()); return; @@ -149,7 +148,7 @@ public final class HudsonServletContextListener implements ServletContextListene // make sure this is servlet 2.4 container or above try { - ServletResponse.class.getMethod("setCharacterEncoding",String.class); + ServletResponse.class.getMethod("setCharacterEncoding", String.class); } catch (NoSuchMethodException e) { controller.install(new IncompatibleServletVersionDetected(ServletResponse.class)); return; @@ -164,7 +163,7 @@ public final class HudsonServletContextListener implements ServletContextListene } //make sure AWT is functioning. Needed for Graphing framework to work properly - if(ChartUtil.awtProblemCause!=null) { + if (ChartUtil.awtProblemCause != null) { controller.install(new AWTProblem(ChartUtil.awtProblemCause)); return; } @@ -187,21 +186,21 @@ public final class HudsonServletContextListener implements ServletContextListene // if this works we are all happy } catch (TransformerFactoryConfigurationError x) { // no it didn't. - logger.warn("XSLT not configured correctly. Hudson will try to fix this. See http://issues.apache.org/bugzilla/show_bug.cgi?id=40895 for more details",x); - System.setProperty(TransformerFactory.class.getName(),"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); + logger.warn("XSLT not configured correctly. Hudson will try to fix this. See http://issues.apache.org/bugzilla/show_bug.cgi?id=40895 for more details", x); + System.setProperty(TransformerFactory.class.getName(), "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); try { TransformerFactory.newInstance(); logger.info("XSLT is set to the JAXP RI in JRE"); - } catch(TransformerFactoryConfigurationError y) { + } catch (TransformerFactoryConfigurationError y) { logger.error("Failed to correct the problem."); } } installExpressionFactory(event); - + // Do the initial setup (if needed) before actually starting Hudson - - try { + + try { // Create the Security Manager temporarily. Since the plugins are not loaded yet // all permissions may not be loaded. The Security manager will reload when Hudson // fully starts later @@ -210,10 +209,10 @@ public final class HudsonServletContextListener implements ServletContextListene controller.install(new SecurityFailedToInit(ex)); return; } - + // Copy the bundled update-center.jso file to the local cached file copyUpdateCenterJson(servletContext, home); - + InitialSetup initSetup = new InitialSetup(home, servletContext); if (initSetup.needsInitSetup()) { logger.info("Initial setup required. Please go to the Hudson Dashboard and complete the setup"); @@ -226,13 +225,13 @@ public final class HudsonServletContextListener implements ServletContextListene initSetup.invokeHudson(); } - }catch (Exception exc) { - logger.error( "Failed to initialize Hudson", exc); - }catch (Error e) { - logger.error( "Failed to initialize Hudson",e); + } catch (Exception exc) { + logger.error("Failed to initialize Hudson", exc); + } catch (Error e) { + logger.error("Failed to initialize Hudson", e); } } - + protected void copyUpdateCenterJson(ServletContext servletContext, File hudsonHomeDir) throws IOException { URL updateCenterJsonUrl = servletContext.getResource("/WEB-INF/update-center.json"); if (updateCenterJsonUrl != null) { @@ -258,7 +257,7 @@ public final class HudsonServletContextListener implements ServletContextListene JellyFacet.setExpressionFactory(event, new ExpressionFactory2()); } - /** + /** * Installs log handler to monitor all Hudson logs. */ private void installLogger() { @@ -269,8 +268,8 @@ public final class HudsonServletContextListener implements ServletContextListene /** * Determines the home directory for Hudson. * - * People makes configuration mistakes, so we are trying to be nice - * with those by doing {@link String#trim()}. + * People makes configuration mistakes, so we are trying to be nice with + * those by doing {@link String#trim()}. */ private File getHomeDir(ServletContextEvent event) { // check JNDI for the home directory first @@ -278,50 +277,55 @@ public final class HudsonServletContextListener implements ServletContextListene InitialContext iniCtxt = new InitialContext(); Context env = (Context) iniCtxt.lookup("java:comp/env"); String value = (String) env.lookup("HUDSON_HOME"); - if(value!=null && value.trim().length()>0) + if (value != null && value.trim().length() > 0) { return new File(value.trim()); + } // look at one more place. See issue #1314 value = (String) iniCtxt.lookup("HUDSON_HOME"); - if(value!=null && value.trim().length()>0) + if (value != null && value.trim().length() > 0) { return new File(value.trim()); + } } catch (NamingException e) { // ignore } // finally check the system property String sysProp = System.getProperty("HUDSON_HOME"); - if(sysProp!=null) + if (sysProp != null) { return new File(sysProp.trim()); - + } + // look at the env var next String env = EnvVars.masterEnvVars.get("HUDSON_HOME"); - if(env!=null) + if (env != null) { return new File(env.trim()).getAbsoluteFile(); + } // otherwise pick a place by ourselves String root = event.getServletContext().getRealPath("/WEB-INF/workspace"); - if(root!=null) { + if (root != null) { File ws = new File(root.trim()); - if(ws.exists()) - // Hudson <1.42 used to prefer this before ~/.hudson, so - // check the existence and if it's there, use it. - // otherwise if this is a new installation, prefer ~/.hudson + if (ws.exists()) // Hudson <1.42 used to prefer this before ~/.hudson, so + // check the existence and if it's there, use it. + // otherwise if this is a new installation, prefer ~/.hudson + { return ws; + } } // if for some reason we can't put it within the webapp, use home directory. - return new File(new File(System.getProperty("user.home")),".hudson"); + return new File(new File(System.getProperty("user.home")), ".hudson"); } public void contextDestroyed(ServletContextEvent event) { Hudson instance = Hudson.getInstance(); - if(instance!=null) + if (instance != null) { instance.cleanUp(); + } // Logger is in the system classloader, so if we don't do this // the whole web app will never be undepoyed. java.util.logging.Logger.getLogger("hudson").removeHandler(handler); } - } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/WebAppController.java b/hudson-core/src/main/java/org/eclipse/hudson/WebAppController.java index a06580b..52467b7 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/WebAppController.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/WebAppController.java @@ -7,7 +7,7 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Jason Dillon * diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java index fa201a3..1ed8dce 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/matrix/IMatrixProject.java @@ -42,16 +42,19 @@ public interface IMatrixProject extends IBaseBuildableProject { public void setAxes(AxisList axes) throws IOException; /** - * Whether Hudson should run {@link hudson.matrix.MatrixRun}s are run sequentially. + * Whether Hudson should run {@link hudson.matrix.MatrixRun}s are run + * sequentially. * - * @return If true, {@link hudson.matrix.MatrixRun}s are run sequentially, instead of running in parallel. + * @return If true, {@link hudson.matrix.MatrixRun}s are run sequentially, + * instead of running in parallel. */ boolean isRunSequentially(); /** * Sets the mode of the running. * - * @param runSequentially If true, {@link hudson.matrix.MatrixRun}s are run sequentially, instead of running in parallel. + * @param runSequentially If true, {@link hudson.matrix.MatrixRun}s are run + * sequentially, instead of running in parallel. * @throws IOException exception. */ void setRunSequentially(boolean runSequentially) throws IOException; @@ -67,13 +70,16 @@ public interface IMatrixProject extends IBaseBuildableProject { /** * Obtains the combination filter, used to trim down the size of the matrix. * <p/> + * < + * p/> By default, a {@link hudson.matrix.MatrixConfiguration} is created + * for every possible combination of axes exhaustively. But by specifying a + * Dynamic Language Script expression as a combination filter, one can trim + * down the # of combinations built. * <p/> - * By default, a {@link hudson.matrix.MatrixConfiguration} is created for every possible combination of axes exhaustively. - * But by specifying a Dynamic Language Script expression as a combination filter, one can trim down the # of combinations built. - * <p/> - * <p/> - * Namely, this expression is evaluated for each axis value combination, and only when it evaluates to true, - * a corresponding {@link hudson.matrix.MatrixConfiguration} will be created and built. + * < + * p/> Namely, this expression is evaluated for each axis value combination, + * and only when it evaluates to true, a corresponding + * {@link hudson.matrix.MatrixConfiguration} will be created and built. * * @return can be null. * @since 1.279 @@ -118,20 +124,22 @@ public interface IMatrixProject extends IBaseBuildableProject { /** * Sets User-specified workspace directory, or null if it's up to Hudson. * <p/> + * < + * p/> Normally a matrix project uses the workspace location assigned by its + * parent container, but sometimes people have builds that have hard-coded + * paths. * <p/> - * Normally a matrix project uses the workspace location assigned by its parent container, - * but sometimes people have builds that have hard-coded paths. - * <p/> + * < + * p/> This is not {@link java.io.File} because it may have to hold a path + * representation on another OS. * <p/> - * This is not {@link java.io.File} because it may have to hold a path representation on another OS. - * <p/> - * <p/> - * If this path is relative, it's resolved against {@link hudson.model.Node#getRootPath()} on the node where this workspace + * < + * p/> If this path is relative, it's resolved against + * {@link hudson.model.Node#getRootPath()} on the node where this workspace * is prepared. * * @param customWorkspace custom workspace. * @throws java.io.IOException exception. */ void setCustomWorkspace(String customWorkspace) throws IOException; - }
\ No newline at end of file diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java index bf12fe3..d29c123 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IAbstractProject.java @@ -76,7 +76,8 @@ public interface IAbstractProject extends IJob { DescribableList<Trigger<?>, TriggerDescriptor> getTriggerDescribableList(); /** - * Gets the specific trigger, should be null if the property is not configured for this job. + * Gets the specific trigger, should be null if the property is not + * configured for this job. * * @param clazz class of trigger * @return T @@ -91,7 +92,8 @@ public interface IAbstractProject extends IJob { void setTriggers(List<Trigger<?>> triggerList); /** - * Adds a new {@link Trigger} to this {@link hudson.model.Project} if not active yet. + * Adds a new {@link Trigger} to this {@link hudson.model.Project} if not + * active yet. * * @param trigger new trigger. * @throws IOException if any. @@ -99,7 +101,8 @@ public interface IAbstractProject extends IJob { void addTrigger(Trigger<?> trigger) throws IOException; /** - * Removes {@link Trigger} frin this {@link hudson.model.Project} by {@link TriggerDescriptor}. + * Removes {@link Trigger} frin this {@link hudson.model.Project} by + * {@link TriggerDescriptor}. * * @param trigger descriptor of trigger. * @throws IOException if any. @@ -121,7 +124,8 @@ public interface IAbstractProject extends IJob { void setCleanWorkspaceRequired(boolean cleanWorkspaceRequired); /** - * Indicates whether build should be blocked while downstream project is building. + * Indicates whether build should be blocked while downstream project is + * building. * * @return true if yes, false - otherwise. */ @@ -136,7 +140,8 @@ public interface IAbstractProject extends IJob { void setBlockBuildWhenDownstreamBuilding(boolean b) throws IOException; /** - * Indicates whether build should be blocked while upstream project is building. + * Indicates whether build should be blocked while upstream project is + * building. * * @return true if yes, false - otherwise. */ @@ -165,7 +170,8 @@ public interface IAbstractProject extends IJob { int getQuietPeriod(); /** - * Sets the custom quiet period of this project, or revert to the global default if null is given. + * Sets the custom quiet period of this project, or revert to the global + * default if null is given. * * @param seconds quiet period * @throws IOException if any. @@ -173,15 +179,16 @@ public interface IAbstractProject extends IJob { void setQuietPeriod(Integer seconds) throws IOException; /** - * If this project is configured to be always built on this node, - * return that {@link hudson.model.Node}. Otherwise null. + * If this project is configured to be always built on this node, return + * that {@link hudson.model.Node}. Otherwise null. * * @return {@link hudson.model.Label} instance. */ Label getAssignedLabel(); /** - * Gets the textual representation of the assigned label as it was entered by the user. + * Gets the textual representation of the assigned label as it was entered + * by the user. * * @return string */ @@ -196,7 +203,8 @@ public interface IAbstractProject extends IJob { void setAssignedLabel(Label label) throws IOException; /** - * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}. + * Assigns this job to the given node. A convenience method over + * {@link #setAssignedLabel(Label)}. * * @param node node. * @throws java.io.IOException exception @@ -242,10 +250,11 @@ public interface IAbstractProject extends IJob { /** * Gets a workspace for some build of this project. * <p/> - * <p/> - * This is useful for obtaining a workspace for the purpose of form field validation, where exactly - * which build the workspace belonged is less important. The implementation makes a cursory effort - * to find some workspace. + * < + * p/> This is useful for obtaining a workspace for the purpose of form + * field validation, where exactly which build the workspace belonged is + * less important. The implementation makes a cursory effort to find some + * workspace. * * @return null if there's no available workspace. * @since 1.319 @@ -260,8 +269,8 @@ public interface IAbstractProject extends IJob { <R extends AbstractBuild> R getSomeBuildWithWorkspace(); /** - * Used in <tt>sidepanel.jelly</tt> to decide whether to display - * the config/delete/build links. + * Used in <tt>sidepanel.jelly</tt> to decide whether to display the + * config/delete/build links. * * @return true - if configurable, false - otherwise. */ @@ -294,7 +303,7 @@ public interface IAbstractProject extends IJob { * Cleans project workspace. * * @return true if success, false otherwise. - * @throws IOException if any. + * @throws IOException if any. * @throws InterruptedException if any. */ boolean cleanWorkspace() throws IOException, InterruptedException; @@ -325,20 +334,24 @@ public interface IAbstractProject extends IJob { void setJDK(JDK jdk) throws IOException; /** - * @return the other {@link AbstractProject}s that should be built when a build of this project is completed. + * @return the other {@link AbstractProject}s that should be built when a + * build of this project is completed. */ List<AbstractProject> getDownstreamProjects(); /** - * @return the other {@link AbstractProject}s that should be built before a build of this project is started. + * @return the other {@link AbstractProject}s that should be built before a + * build of this project is started. */ List<AbstractProject> getUpstreamProjects(); /** - * Returns only those upstream projects that defines {@link hudson.tasks.BuildTrigger} to this project. - * This is a subset of {@link #getUpstreamProjects()} + * Returns only those upstream projects that defines + * {@link hudson.tasks.BuildTrigger} to this project. This is a subset of + * {@link #getUpstreamProjects()} * - * @return A List of upstream projects that has a {@link hudson.tasks.BuildTrigger} to this project. + * @return A List of upstream projects that has a + * {@link hudson.tasks.BuildTrigger} to this project. */ List<AbstractProject> getBuildTriggerUpstreamProjects(); @@ -349,7 +362,8 @@ public interface IAbstractProject extends IJob { Set<AbstractProject> getTransitiveUpstreamProjects(); /** - * @return all the downstream projects including transitive downstream projects. + * @return all the downstream projects including transitive downstream + * projects. * @since 1.138 */ Set<AbstractProject> getTransitiveDownstreamProjects(); @@ -359,8 +373,8 @@ public interface IAbstractProject extends IJob { * and that project (as the sink.) * * @param that {@link AbstractProject} to find relations. - * @return can be empty but not null. build number of this project to the build - * numbers of that project. + * @return can be empty but not null. build number of this project to the + * build numbers of that project. */ SortedMap<Integer, Fingerprint.RangeSet> getRelationship(AbstractProject that); } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IBaseBuildableProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IBaseBuildableProject.java index c1f82a3..76384a1 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IBaseBuildableProject.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IBaseBuildableProject.java @@ -32,6 +32,7 @@ import java.util.Map; * @author Nikita Levyankov */ public interface IBaseBuildableProject extends IAbstractProject { + /** * @return list of project {@link hudson.tasks.Builder} */ @@ -54,7 +55,8 @@ public interface IBaseBuildableProject extends IAbstractProject { Publisher getPublisher(Descriptor<Publisher> descriptor); /** - * Adds a new {@link hudson.tasks.BuildStep} to this {@link IBaseBuildableProject} and saves the configuration. + * Adds a new {@link hudson.tasks.BuildStep} to this + * {@link IBaseBuildableProject} and saves the configuration. * * @param publisher publisher. * @throws java.io.IOException exception. diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/ICascadingJob.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/ICascadingJob.java index d424e64..7639db6 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/ICascadingJob.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/ICascadingJob.java @@ -27,7 +27,7 @@ import java.util.Set; * * @author Nikita Levyankov */ -public interface ICascadingJob<T extends Job<?,?>> extends IJob<T> { +public interface ICascadingJob<T extends Job<?, ?>> extends IJob<T> { /** * Returns cascading project name. @@ -64,7 +64,8 @@ public interface ICascadingJob<T extends Job<?,?>> extends IJob<T> { * Returns job property by specified key. * * @param key key. - * @return {@link org.eclipse.hudson.api.model.IProjectProperty} instance or null. + * @return {@link org.eclipse.hudson.api.model.IProjectProperty} instance or + * null. */ IProjectProperty getProperty(String key); @@ -134,8 +135,9 @@ public interface ICascadingJob<T extends Job<?,?>> extends IJob<T> { Set<String> getCascadingChildrenNames(); /** - * Renames cascading project name. For the properties processing and children links updating - * please use {@link #setCascadingProjectName} instead. + * Renames cascading project name. For the properties processing and + * children links updating please use {@link #setCascadingProjectName} + * instead. * * @param cascadingProjectName new project name. */ diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java index 21ac883..84b9781 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IFreeStyleProject.java @@ -37,18 +37,19 @@ public interface IFreeStyleProject extends IProject { /** * User-specified workspace directory, or null if it's up to Hudson. * - * <p> - * Normally a free-style project uses the workspace location assigned by its parent container, - * but sometimes people have builds that have hard-coded paths (which can be only built in - * certain locations. see http://www.nabble.com/Customize-Workspace-directory-tt17194310.html for + * <p> Normally a free-style project uses the workspace location assigned by + * its parent container, but sometimes people have builds that have + * hard-coded paths (which can be only built in certain locations. see + * http://www.nabble.com/Customize-Workspace-directory-tt17194310.html for * one such discussion.) * - * <p> - * This is not {@link java.io.File} because it may have to hold a path representation on another OS. + * <p> This is not {@link java.io.File} because it may have to hold a path + * representation on another OS. + * + * <p> If this path is relative, it's resolved against + * {@link hudson.model.Node#getRootPath()} on the node where this workspace + * is prepared. * - * <p> - * If this path is relative, it's resolved against {@link hudson.model.Node#getRootPath()} on the node where - * this workspace is prepared. * @param customWorkspace new custom workspace to set * @since 1.320 * @throws IOException if any. diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java index 2f0448a..d099343 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IJob.java @@ -97,7 +97,8 @@ public interface IJob<JobT extends Job> extends Item { boolean isBuilding(); /** - * @return flag, which shows whether all the build logs of dependency components will be kept. + * @return flag, which shows whether all the build logs of dependency + * components will be kept. */ boolean isKeepDependencies(); @@ -117,9 +118,9 @@ public interface IJob<JobT extends Job> extends Item { /** * Programatically updates the next build number. * <p/> - * <p/> - * Much of Hudson assumes that the build number is unique and monotonic, so - * this method can only accept a new value that's bigger than + * < + * p/> Much of Hudson assumes that the build number is unique and monotonic, + * so this method can only accept a new value that's bigger than * {@link #getLastBuild()} returns. Otherwise it'll be no-op. * * @param next build number to set. @@ -131,7 +132,7 @@ public interface IJob<JobT extends Job> extends Item { /** * Perform log rotation. * - * @throws IOException if any. + * @throws IOException if any. * @throws InterruptedException if any. */ void logRotate() throws IOException, InterruptedException; @@ -147,7 +148,8 @@ public interface IJob<JobT extends Job> extends Item { boolean isBuildable(); /** - * Gets all the {@link hudson.model.PermalinkProjectAction.Permalink}s defined for this job. + * Gets all the {@link hudson.model.PermalinkProjectAction.Permalink}s + * defined for this job. * * @return never null */ @@ -162,7 +164,8 @@ public interface IJob<JobT extends Job> extends Item { /** * @param rs target rangeSet. - * @return all the {@link Run}s whose build numbers matches the given {@link Fingerprint.RangeSet}. + * @return all the {@link Run}s whose build numbers matches the given + * {@link Fingerprint.RangeSet}. */ <RunT extends Run> List<RunT> getBuilds(Fingerprint.RangeSet rs); @@ -211,14 +214,16 @@ public interface IJob<JobT extends Job> extends Item { <RunT extends Run> RunT getFirstBuild(); /** - * @return the last successful build, if any. Otherwise null. A successful build - * would include either {@link Result#SUCCESS} or {@link Result#UNSTABLE}. + * @return the last successful build, if any. Otherwise null. A successful + * build would include either {@link Result#SUCCESS} or + * {@link Result#UNSTABLE}. * @see #getLastStableBuild() */ <RunT extends Run> RunT getLastSuccessfulBuild(); /** - * @return the last build that was anything but stable, if any. Otherwise null. + * @return the last build that was anything but stable, if any. Otherwise + * null. * @see #getLastSuccessfulBuild */ <RunT extends Run> RunT getLastUnsuccessfulBuild(); @@ -246,17 +251,20 @@ public interface IJob<JobT extends Job> extends Item { <RunT extends Run> RunT getLastCompletedBuild(); /** - * Returns the last 'numberOfBuilds' builds with a build result >= 'threshold' + * Returns the last 'numberOfBuilds' builds with a build result >= + * 'threshold' * * @param numberOfBuilds build count to return. * @param threshold required {@link Result} of the build. - * @return a list with the builds. May be smaller than 'numberOfBuilds' or even empty - * if not enough builds satisfying the threshold have been found. Never null. + * @return a list with the builds. May be smaller than 'numberOfBuilds' or + * even empty if not enough builds satisfying the threshold have been found. + * Never null. */ <RunT extends Run> List<RunT> getLastBuildsOverThreshold(int numberOfBuilds, Result threshold); /** - * @return build status image link. Info is taken from {@link BallColor#getImage()}. + * @return build status image link. Info is taken from + * {@link BallColor#getImage()}. * @see #getIconColor() * @see BallColor#getImage() */ diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java index 48d6c47..112b89a 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProject.java @@ -23,5 +23,4 @@ package org.eclipse.hudson.api.model; * @author Nikita Levyankov */ public interface IProject extends IBaseBuildableProject { - } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java index 0ccea08..6580a02 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/api/model/IProjectProperty.java @@ -46,10 +46,10 @@ public interface IProjectProperty<T> extends Serializable { void setJob(ICascadingJob job); /** - * Sets property value. - * If property has cascading value and properties' {@link #allowOverrideValue(Object, Object)} method returns true, - * than value will be set to current property.<br/> - * If property doesn't have cascading value, than value will be set directly. + * Sets property value. If property has cascading value and properties' + * {@link #allowOverrideValue(Object, Object)} method returns true, than + * value will be set to current property.<br/> If property doesn't have + * cascading value, than value will be set directly. * * @param value value to set. */ @@ -70,27 +70,31 @@ public interface IProjectProperty<T> extends Serializable { T getCascadingValue(); /** - * @return true if value inherited from cascading project, false - otherwise, + * @return true if value inherited from cascading project, false - + * otherwise, */ boolean isOverridden(); /** - * Returns property value. If originalValue is not null or value was overridden for this - * property - call {@link #getOriginalValue()}, otherwise call {@link #getCascadingValue()}. + * Returns property value. If originalValue is not null or value was + * overridden for this property - call {@link #getOriginalValue()}, + * otherwise call {@link #getCascadingValue()}. * * @return string. */ T getValue(); /** - * This value will be taken if both cascading project and current project don't have values. Null by default. + * This value will be taken if both cascading project and current project + * don't have values. Null by default. * * @return value */ T getDefaultValue(); /** - * Resets value for given job. Default implementation sets Null value and resets propertyOverridden flag to false. + * Resets value for given job. Default implementation sets Null value and + * resets propertyOverridden flag to false. */ void resetValue(); @@ -111,7 +115,8 @@ public interface IProjectProperty<T> extends Serializable { void setOverridden(boolean overridden); /** - * Method that is called while changing cascading parent. Update property internal states.l + * Method that is called while changing cascading parent. Update property + * internal states.l */ void onCascadingProjectChanged(); } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/graph/ChartLabel.java b/hudson-core/src/main/java/org/eclipse/hudson/graph/ChartLabel.java index 04d37f9..3ee3342 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/graph/ChartLabel.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/graph/ChartLabel.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * * *******************************************************************************/ @@ -20,11 +20,15 @@ import java.awt.Color; /** * Information about Chart Label + * * @author Winston Prakash * @since 3.0.0 */ -abstract public class ChartLabel implements Comparable<ChartLabel>{ +abstract public class ChartLabel implements Comparable<ChartLabel> { + abstract public Color getColor(int row, int column); + abstract public String getLink(int row, int column); + abstract public String getToolTip(int row, int column); } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/graph/ChartUtil.java b/hudson-core/src/main/java/org/eclipse/hudson/graph/ChartUtil.java index af8c4dc..95874a6 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/graph/ChartUtil.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/graph/ChartUtil.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Kohsuke Kawaguchi, Winston Prakash - * + * * *******************************************************************************/ @@ -19,7 +19,6 @@ package org.eclipse.hudson.graph; import hudson.model.AbstractBuild; import java.awt.Font; - /** * Chart generation utility code around JFreeChart. * @@ -29,32 +28,30 @@ import java.awt.Font; * @author Kohsuke Kawaguchi */ public class ChartUtil { - + /** - * @deprecated - * Use {@code awtProblemCause!=null} instead. As of 1.267. + * @deprecated Use {@code awtProblemCause!=null} instead. As of 1.267. */ public static boolean awtProblem = false; - /** * See issue 93. Detect an error in X11 and handle it gracefully. */ public static Throwable awtProblemCause = null; - + static { try { - new Font("SansSerif",Font.BOLD,18).toString(); + new Font("SansSerif", Font.BOLD, 18).toString(); } catch (Throwable t) { awtProblemCause = t; awtProblem = true; } } - - + /** * Can be used as a graph label. Only displays numbers. */ public static abstract class NumberOnlyBuildLabel extends ChartLabel { + public final AbstractBuild build; public NumberOnlyBuildLabel(AbstractBuild build) { @@ -62,14 +59,16 @@ public class ChartUtil { } public int compareTo(NumberOnlyBuildLabel that) { - return this.build.number-that.build.number; + return this.build.number - that.build.number; } @Override public boolean equals(Object o) { - if(!(o instanceof NumberOnlyBuildLabel)) return false; + if (!(o instanceof NumberOnlyBuildLabel)) { + return false; + } NumberOnlyBuildLabel that = (NumberOnlyBuildLabel) o; - return build==that.build; + return build == that.build; } @Override diff --git a/hudson-core/src/main/java/org/eclipse/hudson/graph/DataSet.java b/hudson-core/src/main/java/org/eclipse/hudson/graph/DataSet.java index 81451fa..3c14a2f 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/graph/DataSet.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/graph/DataSet.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Kohsuke Kawaguchi, Winston Prakash - * + * * *******************************************************************************/ package org.eclipse.hudson.graph; @@ -21,14 +21,11 @@ import java.util.List; /** * Builds {@link CategoryDataset}. * - * <p> - * This code works around an issue in {@link DefaultCategoryDataset} where + * <p> This code works around an issue in {@link DefaultCategoryDataset} where * order of addition changes the way they are drawn. * - * @param <Row> - * Names that identify different graphs drawn in the same chart. - * @param <Column> - * X-axis. + * @param <Row> Names that identify different graphs drawn in the same chart. + * @param <Column> X-axis. */ public final class DataSet<Row extends Comparable, Column extends Comparable> { diff --git a/hudson-core/src/main/java/org/eclipse/hudson/graph/Graph.java b/hudson-core/src/main/java/org/eclipse/hudson/graph/Graph.java index cd64aab..dbb0101 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/graph/Graph.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/graph/Graph.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Kohsuke Kawaguchi, Winston.Prakash@Oracle.com - * + * *******************************************************************************/ package org.eclipse.hudson.graph; @@ -30,19 +30,14 @@ import java.awt.image.BufferedImage; import java.util.List; /** - * A Graph interface for graphing support. Actual graph generation is delegated to GraphSupport object. - * Plugin can provide their own graphing support via GraphSupport Extension Point. + * A Graph interface for graphing support. Actual graph generation is delegated + * to GraphSupport object. Plugin can provide their own graphing support via + * GraphSupport Extension Point. + * + * <p> This object exposes two URLs: <dl> <dt>/png <dd>PNG image of a graph * - * <p> - * This object exposes two URLs: - * <dl> - * <dt>/png - * <dd>PNG image of a graph + * <dt>/map <dd>Clickable map </dl> * - * <dt>/map - * <dd>Clickable map - * </dl> - * * @since 2.3.0 */ public class Graph { @@ -56,9 +51,8 @@ public class Graph { private volatile GraphSupport graphSupport; /** - * @param timestamp - * Timestamp of this graph. Used for HTTP cache related headers. - * If the graph doesn't have any timestamp to tie it to, pass -1. + * @param timestamp Timestamp of this graph. Used for HTTP cache related + * headers. If the graph doesn't have any timestamp to tie it to, pass -1. */ public Graph(long timestamp, int defaultW, int defaultH) { this.timestamp = timestamp; @@ -155,10 +149,10 @@ public class Graph { os.close(); } catch (Error e) { /* OpenJDK on ARM produces an error like this in case of headless error - Caused by: java.lang.Error: Probable fatal error:No fonts found. - at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1088) - at sun.font.FontManager.initialiseDeferredFont(FontManager.java:967) - .. + Caused by: java.lang.Error: Probable fatal error:No fonts found. + at sun.font.FontManager.getDefaultPhysicalFont(FontManager.java:1088) + at sun.font.FontManager.initialiseDeferredFont(FontManager.java:967) + .. */ if (e.getMessage().contains("Probable fatal error:No fonts found")) { rsp.sendRedirect2(req.getContextPath() + "/images/headless.png"); @@ -170,18 +164,19 @@ public class Graph { rsp.sendRedirect2(req.getContextPath() + "/images/headless.png"); } } - + /** * Create a Image map with the given name, width and height + * * @param mapName * @param width * @param height - * @return + * @return */ - public String createImageMap(String mapName, int width, int height){ + public String createImageMap(String mapName, int width, int height) { return graphSupport.getImageMap(mapName, width, height); } - + /** * Send the a clickable map data information. */ diff --git a/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSeries.java b/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSeries.java index ed337b5..62c1d9d 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSeries.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSeries.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.graph; @@ -20,7 +20,8 @@ import java.util.ArrayList; import java.util.List; /** - * Data and definition of a chart GraphSeries + * Data and definition of a chart GraphSeries + * * @author Winstonp Prakash * @since 3.0.0 */ @@ -29,50 +30,57 @@ public class GraphSeries<E> { public static final int TYPE_AREA = 1; public static final int TYPE_BAR = 2; public static final int TYPE_LINE = 3; - private Color color; - - /** Caption for the series to display in the legend */ + /** + * Caption for the series to display in the legend + */ private String caption; - - /** Base URL to construct full URL for data Click on Graph */ + /** + * Base URL to construct full URL for data Click on Graph + */ private String baseURL; - - /** The series data */ + /** + * The series data + */ private List<E> data = new ArrayList<E>(); - - /** Should the label displayed inside the data point display area useful in Bar, Area */ + /** + * Should the label displayed inside the data point display area useful in + * Bar, Area + */ private boolean labelInside = true; - - /** How this series should be displayed - BAR, AREA, LINE etc */ + /** + * How this series should be displayed - BAR, AREA, LINE etc + */ private int type = TYPE_BAR; - - /** Should the value label be displayed */ + /** + * Should the value label be displayed + */ private boolean valueLabelDisplayed = true; - - /** Should this chart series be stacked over previous series*/ + /** + * Should this chart series be stacked over previous series + */ private boolean stacked = true; - - public GraphSeries(String caption){ + + public GraphSeries(String caption) { this.caption = caption; } - - public GraphSeries(int type, String caption, Color color){ + + public GraphSeries(int type, String caption, Color color) { this(type, caption, color, true, true); } - + public GraphSeries(int type, String caption, Color color, boolean valueLabelDisplayed) { this(type, caption, color, valueLabelDisplayed, true); } - + public GraphSeries(int type, String caption, Color color, boolean valueLabelDisplayed, boolean labelInside) { - this.type = type; + this.type = type; this.caption = caption; this.color = color; this.valueLabelDisplayed = valueLabelDisplayed; this.labelInside = labelInside; } - + public int getType() { return type; } @@ -116,15 +124,15 @@ public class GraphSeries<E> { public void add(E element) { data.add(element); } - - public boolean isStacked() { + + public boolean isStacked() { return stacked; } public void setStacked(boolean stacked) { this.stacked = stacked; } - + public boolean isLabelInside() { return labelInside; } @@ -132,7 +140,7 @@ public class GraphSeries<E> { public void setLabelInside(boolean labelInside) { this.labelInside = labelInside; } - + public boolean isValueLabelDisplayed() { return valueLabelDisplayed; } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSupport.java b/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSupport.java index 2e3b111..affff4e 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSupport.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSupport.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * * *******************************************************************************/ @@ -27,10 +27,9 @@ import java.util.List; /** * Extension point for adding Graph Support to Hudson * - * <p> - * This object can have an optional <tt>config.jelly</tt> to configure the Graph Support - * <p> - * A default constructor is needed to create GraphSupport in the default configuration. + * <p> This object can have an optional <tt>config.jelly</tt> to configure the + * Graph Support <p> A default constructor is needed to create GraphSupport in + * the default configuration. * * @author Winston Prakash * @since 3.0.0 @@ -46,14 +45,20 @@ public abstract class GraphSupport extends AbstractDescribableImpl<GraphSupport> } abstract public void setChartType(int chartType); + abstract public void setTitle(String title); + abstract public void setXAxisLabel(String xLabel); + abstract public void setYAxisLabel(String yLabel); + abstract public void setData(DataSet data); + abstract public void setMultiStageTimeSeries(List<MultiStageTimeSeries> multiStageTimeSeries); + abstract public BufferedImage render(int width, int height); - abstract public String getImageMap(String id, int width, int height); + abstract public String getImageMap(String id, int width, int height); @Override public GraphSupportDescriptor getDescriptor() { diff --git a/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSupportDescriptor.java b/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSupportDescriptor.java index 854a0e3..eaa9ecc 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSupportDescriptor.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/graph/GraphSupportDescriptor.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * * *******************************************************************************/ diff --git a/hudson-core/src/main/java/org/eclipse/hudson/graph/MultiStageTimeSeries.java b/hudson-core/src/main/java/org/eclipse/hudson/graph/MultiStageTimeSeries.java index fc58ea8..0607977 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/graph/MultiStageTimeSeries.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/graph/MultiStageTimeSeries.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Kohsuke Kawaguchi, Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.graph; @@ -39,8 +39,9 @@ import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; /** - * Maintains several {@link TimeSeries} with different update frequencies to satisfy three goals; - * (1) retain data over long timespan, (2) save memory, and (3) retain accurate data for the recent past. + * Maintains several {@link TimeSeries} with different update frequencies to + * satisfy three goals; (1) retain data over long timespan, (2) save memory, and + * (3) retain accurate data for the recent past. * * All in all, one instance uses about 8KB space. * @@ -83,8 +84,8 @@ public class MultiStageTimeSeries { } /** - * @deprecated since 2009-04-05. - * Use {@link #MultiStageTimeSeries(Localizable, Color, float, float)} + * @deprecated since 2009-04-05. Use + * {@link #MultiStageTimeSeries(Localizable, Color, float, float)} */ public MultiStageTimeSeries(float initialValue, float decay) { this(Messages._MultiStageTimeSeries_EMPTY_STRING(), Color.WHITE, initialValue, decay); @@ -135,13 +136,13 @@ public class MultiStageTimeSeries { * Choose which datapoint to use. */ public enum TimeScale { - + SEC10(TimeUnit2.SECONDS.toMillis(10)), MIN(TimeUnit2.MINUTES.toMillis(1)), HOUR(TimeUnit2.HOURS.toMillis(1)); /** - * Number of milliseconds (10 secs, 1 min, and 1 hour) - * that this constant represents. + * Number of milliseconds (10 secs, 1 min, and 1 hour) that this + * constant represents. */ public final long tick; @@ -150,8 +151,8 @@ public class MultiStageTimeSeries { } /** - * Creates a new {@link DateFormat} suitable for processing - * this {@link TimeScale}. + * Creates a new {@link DateFormat} suitable for processing this + * {@link TimeScale}. */ public DateFormat createDateFormat() { switch (this) { @@ -178,10 +179,10 @@ public class MultiStageTimeSeries { } /** - * Represents the trend chart that consists of several {@link MultiStageTimeSeries}. + * Represents the trend chart that consists of several + * {@link MultiStageTimeSeries}. * - * <p> - * This object is renderable as HTTP response. + * <p> This object is renderable as HTTP response. */ public static final class TrendChart implements HttpResponse { @@ -196,36 +197,37 @@ public class MultiStageTimeSeries { } /** - * Creates a {@link DefaultCategoryDataset} for rendering a graph from a set of {@link MultiStageTimeSeries}. + * Creates a {@link DefaultCategoryDataset} for rendering a graph from a + * set of {@link MultiStageTimeSeries}. */ private DataSet createDataset() { - + DataSet<String, String> ds = new DataSet<String, String>(); - + DateFormat format = timeScale.createDateFormat(); GraphSeries<String> xSeries = new GraphSeries<String>("Time"); ds.setXSeries(xSeries); - + float[] data = series.get(0).pick(timeScale).getHistory(); Date date = new Date(System.currentTimeMillis() - timeScale.tick * data.length); for (int j = data.length - 1; j >= 0; j--) { - date = new Date(date.getTime() + timeScale.tick); - String timeStr = format.format(date); - xSeries.add(timeStr); + date = new Date(date.getTime() + timeScale.tick); + String timeStr = format.format(date); + xSeries.add(timeStr); } - + for (MultiStageTimeSeries mstSeries : series) { GraphSeries<Number> ySeries = new GraphSeries<Number>(GraphSeries.TYPE_LINE, mstSeries.title.toString(), mstSeries.color, false, false); ySeries.setStacked(false); ds.addYSeries(ySeries); data = mstSeries.pick(timeScale).getHistory(); - + for (int j = data.length - 1; j >= 0; j--) { ySeries.add(data[j]); } } - + // For backward compatibility with JFreechart float[][] dataPoints = new float[series.size()][]; for (int i = 0; i < series.size(); i++) { @@ -239,18 +241,18 @@ public class MultiStageTimeSeries { date = new Date(date.getTime() + timeScale.tick); String timeStr = format.format(date); for (int j = 0; j < dataPoints.length; j++) { - ds.add((double)dataPoints[j][i], series.get(j).title.toString(), timeStr); + ds.add((double) dataPoints[j][i], series.get(j).title.toString(), timeStr); } } - + return ds; } - - public Graph createGraph(){ + + public Graph createGraph() { Graph graph = new Graph(-1, 500, 400); graph.setYAxisLabel(""); graph.setData(createDataset()); - graph.setChartType(Graph.TYPE_LINE); + graph.setChartType(Graph.TYPE_LINE); graph.setMultiStageTimeSeries(series); return graph; } @@ -259,11 +261,11 @@ public class MultiStageTimeSeries { * Renders this object as an image. */ public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { - createGraph().doPng(req, rsp); + createGraph().doPng(req, rsp); } } public static TrendChart createTrendChart(TimeScale scale, MultiStageTimeSeries... data) { - return new TrendChart(scale,data); + return new TrendChart(scale, data); } } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/init/InitialSetup.java b/hudson-core/src/main/java/org/eclipse/hudson/init/InitialSetup.java index b5618a6..aae182d 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/init/InitialSetup.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/init/InitialSetup.java @@ -56,40 +56,32 @@ import org.slf4j.LoggerFactory; /** * Provides support for initial setup during first run. Gives opportunity to - * Hudson Admin to - * - Install mandatory, featured and recommended plugins - * - Update mandatory, featured and recommended plugins suitable for current Hudson - * - Provide Authentication if needed - * - Setup proxy if required + * Hudson Admin to - Install mandatory, featured and recommended plugins - + * Update mandatory, featured and recommended plugins suitable for current + * Hudson - Provide Authentication if needed - Setup proxy if required * * @author Winston Prakash */ final public class InitialSetup { - - private Logger logger = LoggerFactory.getLogger(InitialSetup.class); + private Logger logger = LoggerFactory.getLogger(InitialSetup.class); private File pluginsDir; private URL initPluginsJsonUrl; private ServletContext servletContext; private UpdateSiteManager updateSiteManager; private InstalledPluginManager installedPluginManager; - private List<AvailablePluginInfo> installedRecommendedPlugins = new ArrayList<AvailablePluginInfo>(); private List<AvailablePluginInfo> installableRecommendedPlugins = new ArrayList<AvailablePluginInfo>(); private List<AvailablePluginInfo> updatableRecommendedPlugins = new ArrayList<AvailablePluginInfo>(); - private List<AvailablePluginInfo> installedFeaturedPlugins = new ArrayList<AvailablePluginInfo>(); private List<AvailablePluginInfo> installableFeaturedPlugins = new ArrayList<AvailablePluginInfo>(); private List<AvailablePluginInfo> updatableFeaturedPlugins = new ArrayList<AvailablePluginInfo>(); - private List<AvailablePluginInfo> installedMandatoryPlugins = new ArrayList<AvailablePluginInfo>(); private List<AvailablePluginInfo> installableMandatoryPlugins = new ArrayList<AvailablePluginInfo>(); private List<AvailablePluginInfo> updatableMandatoryPlugins = new ArrayList<AvailablePluginInfo>(); - private ProxyConfiguration proxyConfig; private ExecutorService installerService = Executors.newSingleThreadExecutor( new DaemonThreadFactory(new ThreadFactory() { - @Override public Thread newThread(Runnable r) { Thread t = new Thread(r); @@ -97,11 +89,8 @@ final public class InitialSetup { return t; } })); - private HudsonSecurityManager hudsonSecurityManager; - private XmlFile initSetupFile; - private File hudsonHomeDir; public InitialSetup(File homeDir, ServletContext context) throws MalformedURLException, IOException { @@ -125,21 +114,20 @@ final public class InitialSetup { // installedPluginManager = new InstalledPluginManager(pluginsDir); // check(); // } - - public boolean needsInitSetup(){ - if (!initSetupFile.exists()){ - return (installableMandatoryPlugins.size() > 0) || (updatableMandatoryPlugins.size() > 0) || - (installableFeaturedPlugins.size() > 0) || (updatableFeaturedPlugins.size() > 0) || - (installableRecommendedPlugins.size() > 0) || (updatableRecommendedPlugins.size() > 0); - }else{ + public boolean needsInitSetup() { + if (!initSetupFile.exists()) { + return (installableMandatoryPlugins.size() > 0) || (updatableMandatoryPlugins.size() > 0) + || (installableFeaturedPlugins.size() > 0) || (updatableFeaturedPlugins.size() > 0) + || (installableRecommendedPlugins.size() > 0) || (updatableRecommendedPlugins.size() > 0); + } else { return !canFinish(); } } - + public boolean needsAdminLogin() { return !hudsonSecurityManager.hasPermission(Permission.HUDSON_ADMINISTER); } - + public ServletContext getServletContext() { return servletContext; } @@ -163,7 +151,7 @@ final public class InitialSetup { public List<AvailablePluginInfo> getUpdatableRecommendedPlugins() { return updatableRecommendedPlugins; } - + public List<AvailablePluginInfo> getInstalledFeaturedPlugins() { return installedFeaturedPlugins; } @@ -210,7 +198,7 @@ final public class InitialSetup { proxyConfig.openUrl(new URL("http://www.google.com")); } catch (IOException ex) { logger.debug(ex.getLocalizedMessage()); - return true; + return true; } return false; } @@ -249,7 +237,7 @@ final public class InitialSetup { try { boolean proxySet = setProxy(server, port, noProxyFor, userName, password, authNeeded); - if (proxySet){ + if (proxySet) { proxyConfig.save(); } // Try opening a URL and see if the proxy works fine @@ -260,7 +248,7 @@ final public class InitialSetup { } return HttpResponses.ok(); } - + public HttpResponse doCheckFinish() { if (!canFinish()) { return HttpResponses.error(HttpServletResponse.SC_BAD_REQUEST, "Mandatory Plugins need to be installed first"); @@ -268,53 +256,53 @@ final public class InitialSetup { try { initSetupFile.write("Hudson 3.0 Initial Setup Done"); } catch (IOException ex) { - logger.error(ex.getLocalizedMessage()); + logger.error(ex.getLocalizedMessage()); } invokeHudson(); - + return HttpResponses.ok(); } } - - public void invokeHudson(){ + + public void invokeHudson() { final WebAppController controller = WebAppController.get(); - + controller.install(new HudsonIsLoading()); - new Thread("hudson initialization thread") { - @Override - public void run() { - try { - // Creating of the god object performs most of the booting muck - Hudson hudson = new Hudson(hudsonHomeDir, servletContext); - - //Now Hudson is fully loaded, reload Hudson Security Manager - HudsonSecurityEntitiesHolder.setHudsonSecurityManager(new HudsonSecurityManager(hudsonHomeDir)); - - // once its done, hook up to stapler and things should be ready to go - controller.install(hudson); - - // trigger the loading of changelogs in the background, - // but give the system 10 seconds so that the first page - // can be served quickly - Trigger.timer.schedule(new SafeTimerTask() { - public void doRun() { - User.getUnknown().getBuilds(); - } - }, 1000*10); - } catch (Error e) { - logger.error("Failed to initialize Hudson", e); - controller.install(new HudsonFailedToLoad(e)); - throw e; - } catch (Exception e) { - logger.error("Failed to initialize Hudson", e); - controller.install(new HudsonFailedToLoad(e)); - } + new Thread("hudson initialization thread") { + @Override + public void run() { + try { + // Creating of the god object performs most of the booting muck + Hudson hudson = new Hudson(hudsonHomeDir, servletContext); + + //Now Hudson is fully loaded, reload Hudson Security Manager + HudsonSecurityEntitiesHolder.setHudsonSecurityManager(new HudsonSecurityManager(hudsonHomeDir)); + + // once its done, hook up to stapler and things should be ready to go + controller.install(hudson); + + // trigger the loading of changelogs in the background, + // but give the system 10 seconds so that the first page + // can be served quickly + Trigger.timer.schedule(new SafeTimerTask() { + public void doRun() { + User.getUnknown().getBuilds(); + } + }, 1000 * 10); + } catch (Error e) { + logger.error("Failed to initialize Hudson", e); + controller.install(new HudsonFailedToLoad(e)); + throw e; + } catch (Exception e) { + logger.error("Failed to initialize Hudson", e); + controller.install(new HudsonFailedToLoad(e)); } - }.start(); + } + }.start(); } - - public boolean canFinish(){ + + public boolean canFinish() { reCheck(); return (getInstallableMandatoryPlugins().size() == 0) && (getUpdatableMandatoryPlugins().size() == 0); } @@ -340,10 +328,10 @@ final public class InitialSetup { Util.fixEmptyAndTrim(userName), Util.fixEmptyAndTrim(password), "on".equals(Util.fixNull(authNeeded))); return true; - }else{ - proxyConfig.getXmlFile().delete(); - proxyConfig.name = null; - return true; + } else { + proxyConfig.getXmlFile().delete(); + proxyConfig.name = null; + return true; } } @@ -376,7 +364,7 @@ final public class InitialSetup { } private void check() { - if (!pluginsDir.exists()){ + if (!pluginsDir.exists()) { pluginsDir.mkdirs(); } Set<String> installedPluginNames = installedPluginManager.getInstalledPluginNames(); @@ -395,7 +383,7 @@ final public class InitialSetup { //Installed Mandatory Plugin. No updates available installedMandatoryPlugins.add(availablePlugin); } - } else if (availablePlugin.getType().equals(UpdateSiteManager.FEATURED)) { + } else if (availablePlugin.getType().equals(UpdateSiteManager.FEATURED)) { if (isNewerThan(availablePlugin.getVersion(), installedPlugin.getVersion())) { //Updatabale featured Plugin update needed updatableFeaturedPlugins.add(availablePlugin); @@ -403,7 +391,7 @@ final public class InitialSetup { //Installed featured Plugin. No updates available installedFeaturedPlugins.add(availablePlugin); } - }else if (availablePlugin.getType().equals(UpdateSiteManager.RECOMMENDED)) { + } else if (availablePlugin.getType().equals(UpdateSiteManager.RECOMMENDED)) { if (isNewerThan(availablePlugin.getVersion(), installedPlugin.getVersion())) { //Updatabale recommended Plugin update needed updatableRecommendedPlugins.add(availablePlugin); @@ -418,10 +406,12 @@ final public class InitialSetup { if (availablePlugin.getType().equals(UpdateSiteManager.MANDATORY)) { //Mandatory Plugin. Need to be installed installableMandatoryPlugins.add(availablePlugin); - } if (availablePlugin.getType().equals(UpdateSiteManager.FEATURED)) { + } + if (availablePlugin.getType().equals(UpdateSiteManager.FEATURED)) { //Featured Plugin. Available for installation installableFeaturedPlugins.add(availablePlugin); - }if (availablePlugin.getType().equals(UpdateSiteManager.RECOMMENDED)) { + } + if (availablePlugin.getType().equals(UpdateSiteManager.RECOMMENDED)) { //Recommended Plugin. Available for installation installableRecommendedPlugins.add(availablePlugin); } @@ -431,7 +421,7 @@ final public class InitialSetup { private List<AvailablePluginInfo> getNeededDependencies(AvailablePluginInfo pluginInfo) { List<AvailablePluginInfo> deps = new ArrayList<AvailablePluginInfo>(); - + if ((pluginInfo != null) && (pluginInfo.getDependencies().size() > 0)) { for (Map.Entry<String, String> e : pluginInfo.getDependencies().entrySet()) { AvailablePluginInfo depPlugin = updateSiteManager.getAvailablePlugin(e.getKey()); @@ -446,8 +436,8 @@ final public class InitialSetup { } else if (current.isOlderThan(requiredVersion)) { deps.add(depPlugin); } - }else{ - logger.error("Could not find " + e.getKey() + " which is required by " + pluginInfo.getDisplayName()); + } else { + logger.error("Could not find " + e.getKey() + " which is required by " + pluginInfo.getDisplayName()); } } } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/init/InitialSetupLogin.java b/hudson-core/src/main/java/org/eclipse/hudson/init/InitialSetupLogin.java index 9498130..c364cae 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/init/InitialSetupLogin.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/init/InitialSetupLogin.java @@ -40,8 +40,8 @@ final public class InitialSetupLogin { public HudsonSecurityManager getHudsonSecurityManager() { return hudsonSecurityManager; } - - public boolean canFinish(){ + + public boolean canFinish() { return initialSetup.canFinish(); } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeAccessException.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeAccessException.java index 6dab003..276e9fa 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeAccessException.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeAccessException.java @@ -7,33 +7,30 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; - /** - * Exception to be thrown when a native function is not supported - * or when the function failed to execute - * + * Exception to be thrown when a native function is not supported or when the + * function failed to execute + * * @author Winston Prakash * @since 3.0.0 */ public class NativeAccessException extends RuntimeException { - + public static int PERMISSION = 1; - private int code; - public NativeAccessException(String errorMsg) { super(errorMsg); } - + public NativeAccessException(String errorMsg, int code) { super(errorMsg); this.code = code; @@ -42,7 +39,7 @@ public class NativeAccessException extends RuntimeException { public NativeAccessException(Throwable exc) { super(exc); } - + public int getCode() { return code; } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeFunction.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeFunction.java index 57dca4d..b31b1d5 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeFunction.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeFunction.java @@ -7,17 +7,17 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; /** * Constants Describing Native functions - * + * * @author Winston Prakash * @since 3.0.0 */ diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeMacSupport.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeMacSupport.java index 96875cb..57ef252 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeMacSupport.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeMacSupport.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; @@ -26,17 +26,16 @@ import java.util.List; /** * Extension point for adding Native Mac Support to Hudson * - * <p> - * This object can have an optional <tt>config.jelly</tt> to configure the Native Access Support - * <p> - * A default constructor is needed to create NativeAccessSupport in the default configuration. + * <p> This object can have an optional <tt>config.jelly</tt> to configure the + * Native Access Support <p> A default constructor is needed to create + * NativeAccessSupport in the default configuration. * * @author Winston Prakash * @since 3.0.0 * @see NativeAccessSupportDescriptor */ public abstract class NativeMacSupport extends AbstractDescribableImpl<NativeMacSupport> implements ExtensionPoint, - Serializable { + Serializable { /** * Returns all the registered {@link NativeAccessSupport} descriptors. @@ -52,6 +51,7 @@ public abstract class NativeMacSupport extends AbstractDescribableImpl<NativeMac /** * Check if this Extension has Support for specific native Operation + * * @param nativeFunc Native Operation * @return true if supported */ @@ -59,14 +59,16 @@ public abstract class NativeMacSupport extends AbstractDescribableImpl<NativeMac /** * Get the error associated with the last Operation + * * @return String error message */ abstract public String getLastError(); /** * Get the Native processes of a Mac System + * * @return - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public List<NativeProcess> getMacProcesses() throws NativeAccessException; } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeMacSupportDescriptor.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeMacSupportDescriptor.java index 9b2899b..271fed2 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeMacSupportDescriptor.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeMacSupportDescriptor.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeProcess.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeProcess.java index b763523..58951bb 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeProcess.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeProcess.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; @@ -19,7 +19,7 @@ import java.util.Map; /** * DataStructure that represents a Native Process - * + * * @author Winston Prakash * @since 3.0.0 */ @@ -27,36 +27,46 @@ public interface NativeProcess { /** * Get Process Id - * @return + * + * @return */ public int getPid(); + /** * Get Parent Process ID - * @return + * + * @return */ public int getPpid(); + /** * Kill this process and its children recursively */ public void killRecursively(); + /** * Kill this process */ public void kill(); + /** * Set the priority of this process - * @param priority + * + * @param priority */ public void setPriority(int priority); + /** * get the command line associated with this process - * @return + * + * @return */ public String getCommandLine(); + /** * get the environment variables associated with this process + * * @return map Environment variable pairs */ public Map<String, String> getEnvironmentVariables(); - } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeSystemMemory.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeSystemMemory.java index b0e3b85..78583d9 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeSystemMemory.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeSystemMemory.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; @@ -19,7 +19,7 @@ import java.io.Serializable; /** * DataStructure to hold the memory Usage data of a System - * + * * @author Winston Prakash * @since 3.0.0 */ @@ -27,25 +27,29 @@ public interface NativeSystemMemory extends Serializable { /** * Get the available System Memory - * @return + * + * @return */ public long getAvailablePhysicalMemory(); /** * Get the available Swap Space - * @return + * + * @return */ public long getAvailableSwapSpace(); /** * Get the available Total Physical memory - * @return + * + * @return */ public long getTotalPhysicalMemory(); - /** + /** * Get the available Total Swap Space - * @return + * + * @return */ - public long getTotalSwapSpace(); + public long getTotalSwapSpace(); } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUnixSupport.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUnixSupport.java index 1b5c1f2..d40474c 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUnixSupport.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUnixSupport.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; @@ -28,17 +28,16 @@ import java.util.Set; /** * Extension point for adding Native Unix Support to Hudson * - * <p> - * This object can have an optional <tt>config.jelly</tt> to configure the Native Access Support - * <p> - * A default constructor is needed to create NativeAccessSupport in the default configuration. + * <p> This object can have an optional <tt>config.jelly</tt> to configure the + * Native Access Support <p> A default constructor is needed to create + * NativeAccessSupport in the default configuration. * * @author Winston Prakash * @since 3.00 * @see NativeAccessSupportDescriptor */ public abstract class NativeUnixSupport extends AbstractDescribableImpl<NativeUnixSupport> implements ExtensionPoint, - Serializable { + Serializable { /** * Returns all the registered {@link NativeAccessSupport} descriptors. @@ -54,6 +53,7 @@ public abstract class NativeUnixSupport extends AbstractDescribableImpl<NativeUn /** * Check if this Extension has Support for specific native Operation + * * @param nativeFunc Native Operation * @return true if supported */ @@ -61,12 +61,14 @@ public abstract class NativeUnixSupport extends AbstractDescribableImpl<NativeUn /** * Get the error associated with the last Operation + * * @return String error message */ abstract public String getLastError(); /** * Do the Unix style chmod (change file permission) on a File + * * @param file * @param mask * @return true if the operation is successful @@ -74,14 +76,16 @@ public abstract class NativeUnixSupport extends AbstractDescribableImpl<NativeUn abstract public boolean chmod(File file, int mask) throws NativeAccessException; /** - * Make the file writable with native operation + * Make the file writable with native operation + * * @param file * @return true if the operation is successful */ abstract public boolean makeFileWritable(File file) throws NativeAccessException; /** - * Create unix style symlink + * Create unix style symlink + * * @param targetPath * @param file * @return true if the operation is successful @@ -90,13 +94,16 @@ public abstract class NativeUnixSupport extends AbstractDescribableImpl<NativeUn /** * Get the unix style mode (file permission) of a file + * * @param file * @return true if the operation is successful */ abstract public int mode(File file); /** - * Resolves symlink, if the given file is a symlink on a Unix System. Otherwise return null. + * Resolves symlink, if the given file is a symlink on a Unix System. + * Otherwise return null. + * * @param targetPath * @param file * @return @@ -105,79 +112,92 @@ public abstract class NativeUnixSupport extends AbstractDescribableImpl<NativeUn /** * Get the information about the System Memory + * * @return SystemMemory - * @throws hudson.util.jna.Native.ExecutionError + * @throws hudson.util.jna.Native.ExecutionError */ abstract public NativeSystemMemory getSystemMemory() throws NativeAccessException; /** * Get the effective User ID on a Unix System + * * @return int - * @throws hudson.util.jna.Native.ExecutionError + * @throws hudson.util.jna.Native.ExecutionError */ abstract public int getEuid() throws NativeAccessException; /** * Get the effective Group ID on a Unix System - * @return int - * @throws hudson.util.jna.Native.ExecutionError + * + * @return int + * @throws hudson.util.jna.Native.ExecutionError */ abstract public int getEgid() throws NativeAccessException; - /** * Restart current Java process (JVM in which this application is running) - * @throws hudson.util.jna.Native.NativeExecutionException + * + * @throws hudson.util.jna.Native.NativeExecutionException */ - abstract public void restartJavaProcess(Map<String,String> properties, boolean asDaemon) throws NativeAccessException; + abstract public void restartJavaProcess(Map<String, String> properties, boolean asDaemon) throws NativeAccessException; /** * Check if this Java process can be restarted - * @throws hudson.util.jna.Native.NativeExecutionException + * + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public boolean canRestartJavaProcess() throws NativeAccessException; /** * Check if the Unix user exists on the machine where this program runs + * * @param userName * @return - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public boolean checkUnixUser(String userName) throws NativeAccessException; - + /** * Check if the Unix group exists on the machine where this program runs + * * @param groupName * @return - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public boolean checkUnixGroup(String groupName) throws NativeAccessException; /** * Authenticate using Using Unix Pluggable Authentication Modules (PAM) + * * @param serviceName, sshd is the default * @param userName * @param password * @return Set<String> list of groups to which this user belongs - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public Set<String> pamAuthenticate(String serviceName, String userName, String password) throws NativeAccessException; /** - * Check if PAM Authentication available in the machine where this program runs + * Check if PAM Authentication available in the machine where this program + * runs + * * @return Message corresponding to the availability of PAM - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public String checkPamAuthentication() throws NativeAccessException; /** * Do the Unix style chown (change Owner permission) on a File + * * @param file * @param mask * @return true if the function executed successfully - * @throws hudson.util.jna.Native.ExecutionError + * @throws hudson.util.jna.Native.ExecutionError */ - abstract public boolean chown(File file, int uid, int gid) throws NativeAccessException;; + abstract public boolean chown(File file, int uid, int gid) throws NativeAccessException; + + ; - abstract public String getProcessUser() throws NativeAccessException;; + abstract public String getProcessUser() throws NativeAccessException; +; } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUnixSupportDescriptor.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUnixSupportDescriptor.java index 5ae2f95..c34fc85 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUnixSupportDescriptor.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUnixSupportDescriptor.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUtils.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUtils.java index 642f272..178fa81 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUtils.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeUtils.java @@ -50,28 +50,28 @@ public class NativeUtils implements Serializable { } private NativeUtils() { - try{ - List<NativeUnixSupport> nativeUnixSupports = getAvailableNativeUnixSupports(); - if (nativeUnixSupports.size() > 0) { - nativeUnixSupport = nativeUnixSupports.get(0); - } + try { + List<NativeUnixSupport> nativeUnixSupports = getAvailableNativeUnixSupports(); + if (nativeUnixSupports.size() > 0) { + nativeUnixSupport = nativeUnixSupports.get(0); + } - List<NativeWindowsSupport> nativeWindowsSupports = getAvailableNativeWindowSupports(); - if (nativeWindowsSupports.size() > 0) { - nativeWindowsSupport = nativeWindowsSupports.get(0); - } + List<NativeWindowsSupport> nativeWindowsSupports = getAvailableNativeWindowSupports(); + if (nativeWindowsSupports.size() > 0) { + nativeWindowsSupport = nativeWindowsSupports.get(0); + } - List<NativeMacSupport> nativeMacSupports = getAvailableNativeMacSupports(); - if (nativeMacSupports.size() > 0) { - nativeMacSupport = nativeMacSupports.get(0); - } - List<NativeZfsSupport> nativeZfsSupports = getAvailableNativeZfsSupports(); - if (nativeZfsSupports.size() > 0) { - nativeZfsSupport = nativeZfsSupports.get(0); + List<NativeMacSupport> nativeMacSupports = getAvailableNativeMacSupports(); + if (nativeMacSupports.size() > 0) { + nativeMacSupport = nativeMacSupports.get(0); + } + List<NativeZfsSupport> nativeZfsSupports = getAvailableNativeZfsSupports(); + if (nativeZfsSupports.size() > 0) { + nativeZfsSupport = nativeZfsSupports.get(0); + } + } catch (Exception exc) { + logger.info("Error getting Native Support Extensions", exc); } - }catch (Exception exc){ - logger.info("Error getting Native Support Extensions", exc); - } } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeWindowsSupport.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeWindowsSupport.java index 4d672f7..d766653 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeWindowsSupport.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeWindowsSupport.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; @@ -27,17 +27,16 @@ import java.util.List; /** * Extension point for adding Native Windows Support to Hudson * - * <p> - * This object can have an optional <tt>config.jelly</tt> to configure the Native Access Support - * <p> - * A default constructor is needed to create NativeAccessSupport in the default configuration. + * <p> This object can have an optional <tt>config.jelly</tt> to configure the + * Native Access Support <p> A default constructor is needed to create + * NativeAccessSupport in the default configuration. * * @author Winston Prakash * @since 3.0.0 * @see NativeWindowsSupportDescriptor */ public abstract class NativeWindowsSupport extends AbstractDescribableImpl<NativeWindowsSupport> implements ExtensionPoint, - Serializable { + Serializable { /** * Returns all the registered {@link NativeAccessSupport} descriptors. @@ -53,6 +52,7 @@ public abstract class NativeWindowsSupport extends AbstractDescribableImpl<Nativ /** * Check if this Extension has Support for specific native Operation + * * @param nativeFunc Native Operation * @return true if supported */ @@ -60,26 +60,30 @@ public abstract class NativeWindowsSupport extends AbstractDescribableImpl<Nativ /** * Get the error associated with the last Operation + * * @return String error message */ abstract public String getLastError(); /** * Check if .NET is installed on a the Windows machine + * * @return true if .NET is installed. - * @throws hudson.util.jna.Native.ExecutionError + * @throws hudson.util.jna.Native.ExecutionError */ abstract public boolean isDotNetInstalled(int major, int minor) throws NativeAccessException; /** * Get all the native processes on a Windows System + * * @return List of Native Window Processes - * @throws hudson.util.jna.Native.ExecutionError + * @throws hudson.util.jna.Native.ExecutionError */ abstract public List<NativeProcess> getWindowsProcesses() throws NativeAccessException; /** * Find the Native Process Id of the given java.lang.process + * * @param process (java.lang.process) * @return pid, the Native Process ID */ @@ -87,21 +91,23 @@ public abstract class NativeWindowsSupport extends AbstractDescribableImpl<Nativ /** * Run the Windows program natively in an elevated privilege + * * @param winExe, windows executable to run * @param args, arguments to pass * @param logFile, File where the logs of the process should go * @param pwd, Path of the working directory * @return int, process exit code - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public int windowsExec(File winExe, String args, String logFile, File pwd) throws NativeAccessException; /** * Move a Windows File using native win32 library + * * @param fromFile * @param toFile * @return - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public void windowsMoveFile(File fromFile, File toFile) throws NativeAccessException; } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeWindowsSupportDescriptor.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeWindowsSupportDescriptor.java index 796fffa..4fdbf24 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeWindowsSupportDescriptor.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeWindowsSupportDescriptor.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsFileSystem.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsFileSystem.java index 12e4022..e08b8be 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsFileSystem.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsFileSystem.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; @@ -19,12 +19,12 @@ import java.io.File; /** * Data Structure and operation defining a ZFS file Systems - * + * * @author Winston Prakash * @since 3.0.0 */ -public interface NativeZfsFileSystem{ - +public interface NativeZfsFileSystem { + public static final int MS_RDONLY = 1; public static final int MS_FSS = 2; public static final int MS_DATA = 4; @@ -36,7 +36,7 @@ public interface NativeZfsFileSystem{ public static final int MS_GLOBAL = 512; public static final int MS_FORCE = 1024; public static final int MS_NOMNTTAB = 2048; - + public String getName(); public void setMountPoint(File dir); @@ -44,7 +44,7 @@ public interface NativeZfsFileSystem{ public void mount(); public void unmount(); - + public void unmount(int flag); public void setProperty(String string, String string0); diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsSupport.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsSupport.java index e5407bf..859b328 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsSupport.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsSupport.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; @@ -27,17 +27,16 @@ import java.util.List; /** * Extension point for adding Native Access Support to ZFS FileSystem * - * <p> - * This object can have an optional <tt>config.jelly</tt> to configure the Native Access Support - * <p> - * A default constructor is needed to create NativeAccessSupport in the default configuration. + * <p> This object can have an optional <tt>config.jelly</tt> to configure the + * Native Access Support <p> A default constructor is needed to create + * NativeAccessSupport in the default configuration. * * @author Winston Prakash * @since 3.0.0 * @see NativeAccessSupportDescriptor */ public abstract class NativeZfsSupport extends AbstractDescribableImpl<NativeZfsSupport> implements ExtensionPoint, - Serializable { + Serializable { /** * Returns all the registered {@link NativeAccessSupport} descriptors. @@ -53,6 +52,7 @@ public abstract class NativeZfsSupport extends AbstractDescribableImpl<NativeZfs /** * Check if this Extension has Support for specific native Operation + * * @param nativeFunc Native Operation * @return true if supported */ @@ -60,44 +60,50 @@ public abstract class NativeZfsSupport extends AbstractDescribableImpl<NativeZfs /** * Fetch the list of mounted ZFS roots + * * @return - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public List<NativeZfsFileSystem> getZfsRoots() throws NativeAccessException; /** * Find the ZFS File System by its mount point + * * @return - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public NativeZfsFileSystem getZfsByMountPoint(File mountPoint) throws NativeAccessException; - /** + /** * Create ZFS File System corresponding to the mount name + * * @param mountPoint * @return ZFS File System if created successfully - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public NativeZfsFileSystem createZfs(String mountName) throws NativeAccessException; - /** - * Open the target ZFS File System + /** + * Open the target ZFS File System + * * @param mountPoint * @return ZFS File System if opened successfully - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ abstract public NativeZfsFileSystem openZfs(String target) throws NativeAccessException; /** * Check if the named ZFS exists + * * @param zfsName * @return - * @throws hudson.util.jna.Native.NativeExecutionException + * @throws hudson.util.jna.Native.NativeExecutionException */ - abstract public boolean zfsExists(String zfsName) throws NativeAccessException; + abstract public boolean zfsExists(String zfsName) throws NativeAccessException; /** * Get the error associated with the last Operation + * * @return String error message */ abstract public String getLastError(); diff --git a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsSupportDescriptor.java b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsSupportDescriptor.java index c2c7f38..07e433d 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsSupportDescriptor.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/jna/NativeZfsSupportDescriptor.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.jna; diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java index a37957a..c563d39 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/BaseProjectProperty.java @@ -21,16 +21,17 @@ import org.eclipse.hudson.api.model.ICascadingJob; import org.eclipse.hudson.api.model.IProjectProperty; /** - * Base property implementation. Contains common methods for setting and getting cascading and overridden properties. + * Base property implementation. Contains common methods for setting and getting + * cascading and overridden properties. * <p/> * Date: 9/22/11 * * @author Nikita Levyankov */ public class BaseProjectProperty<T> implements IProjectProperty<T> { + static final String INVALID_JOB_EXCEPTION = "Project property should have not null job"; static final String INVALID_PROPERTY_KEY_EXCEPTION = "Project property should have not null propertyKey"; - private transient String propertyKey; private transient ICascadingJob job; private T originalValue; @@ -91,8 +92,8 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> { if (null == getKey()) { throw new IllegalArgumentException(INVALID_PROPERTY_KEY_EXCEPTION); } - return getJob().hasCascadingProject() ? - (T) getJob().getCascadingProject().getProperty(propertyKey, this.getClass()).getValue() : getDefaultValue(); + return getJob().hasCascadingProject() + ? (T) getJob().getCascadingProject().getProperty(propertyKey, this.getClass()).getValue() : getDefaultValue(); } /** @@ -145,13 +146,15 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> { } /** - * Update value for cascading property. Before setting new value it will be checked for equality with cascading - * value. If two values are equals - current value will be cleared via {@link #clearOriginalValue(Object)} - * and will retrieved from parent. If not - value will be set directly. + * Update value for cascading property. Before setting new value it will be + * checked for equality with cascading value. If two values are equals - + * current value will be cleared via {@link #clearOriginalValue(Object)} and + * will retrieved from parent. If not - value will be set directly. * * @param value new value to be set. * @param cascadingValue current cascading value. - * @return true - if property was updated, false - otherwise if value was cleared. + * @return true - if property was updated, false - otherwise if value was + * cleared. */ protected boolean updateOriginalValue(T value, T cascadingValue) { T candidateValue = null == value ? getDefaultValue() : value; @@ -165,8 +168,8 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> { } /** - * Method that sets original value and mark it as overridden if needed. It was created to provide better flexibility - * in subclasses. + * Method that sets original value and mark it as overridden if needed. It + * was created to provide better flexibility in subclasses. * * @param originalValue value to set * @param overridden true - to mark as overridden. @@ -178,7 +181,8 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> { /** * Method that clears original value and marks it as overridden if needed. - * Default implementation uses {@link #resetValue()}. Subclasses can override this method. + * Default implementation uses {@link #resetValue()}. Subclasses can + * override this method. * * @param originalValue value to set. */ @@ -198,7 +202,7 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> { */ public boolean allowOverrideValue(T cascadingValue, T candidateValue) { return ObjectUtils.notEqual(cascadingValue, candidateValue) - && !DeepEquals.deepEquals(cascadingValue, candidateValue); + && !DeepEquals.deepEquals(cascadingValue, candidateValue); } /** @@ -230,18 +234,19 @@ public class BaseProjectProperty<T> implements IProjectProperty<T> { } /** - * Executes when cascading parent is cleared. Default implementation marks property as not overridden. + * Executes when cascading parent is cleared. Default implementation marks + * property as not overridden. */ protected void onCascadingProjectRemoved() { setOverridden(false); } /** - * Executes when cascading project is set. Default implementation compares cascading and current value. - * If values are not equal - mark property as overridden. + * Executes when cascading project is set. Default implementation compares + * cascading and current value. If values are not equal - mark property as + * overridden. */ protected void onCascadingProjectSet() { setOverridden(allowOverrideValue(getCascadingValue(), getValue())); } } - diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java index c1c1247..7db989f 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/DescribableListProjectProperty.java @@ -28,6 +28,7 @@ import org.eclipse.hudson.api.model.ICascadingJob; * @author Nikita Levyankov */ public class DescribableListProjectProperty extends BaseProjectProperty<DescribableList> { + public DescribableListProjectProperty(ICascadingJob job) { super(job); } @@ -64,5 +65,3 @@ public class DescribableListProjectProperty extends BaseProjectProperty<Describa return null != result ? result : getDefaultValue(); } } - - diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java index 6def695..9770fc4 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ExternalProjectProperty.java @@ -17,14 +17,15 @@ package org.eclipse.hudson.model.project.property; import org.eclipse.hudson.api.model.ICascadingJob; /** - * Class property is intended to be used for ProjectProperties without correct equals and hashCode methods, such as - * Builders, Publishers, etc. + * Class property is intended to be used for ProjectProperties without correct + * equals and hashCode methods, such as Builders, Publishers, etc. * <p/> - * This property has additional {@link #modified} flag, that is used to define, whether current property was changed - * from UI. If yes, cascading value will be updated. {@link #updateOriginalValue(Object, Object)} method for details. + * This property has additional {@link #modified} flag, that is used to define, + * whether current property was changed from UI. If yes, cascading value will be + * updated. {@link #updateOriginalValue(Object, Object)} method for details. * <p/> - * <p/> - * Date: 10/20/11 + * < + * p/> Date: 10/20/11 * * @author Nikita Levyankov */ @@ -53,11 +54,13 @@ public class ExternalProjectProperty<T> extends BaseProjectProperty<T> { } /** - * If property was not marked as {@link #isModified()} by calling {@link #setModified(boolean)} method with - * true parameter value, than property will not be updated. This was implemented as the workaround for absent - * equals methods for Publishers, BuildWrappers, etc. + * If property was not marked as {@link #isModified()} by calling + * {@link #setModified(boolean)} method with true parameter value, than + * property will not be updated. This was implemented as the workaround for + * absent equals methods for Publishers, BuildWrappers, etc. * <p/> - * Such properties could be normally compared and use in cascading functionality. + * Such properties could be normally compared and use in cascading + * functionality. * * @param value new value to be set. * @param cascadingValue current cascading value. @@ -76,4 +79,3 @@ public class ExternalProjectProperty<T> extends BaseProjectProperty<T> { setOverridden(isModified()); } } - diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java index 4565863..5ac6dab 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/LogRotatorProjectProperty.java @@ -25,6 +25,7 @@ import org.eclipse.hudson.api.model.ICascadingJob; * @author Nikita Levyankov */ public class LogRotatorProjectProperty extends BaseProjectProperty<LogRotator> { + public LogRotatorProjectProperty(ICascadingJob job) { super(job); } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java index 0f98732..e126b3e 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/ResultProjectProperty.java @@ -14,6 +14,7 @@ *******************************************************************************/ package org.eclipse.hudson.model.project.property; + import hudson.model.Result; import org.eclipse.hudson.api.model.ICascadingJob; diff --git a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java index 0be106a..d48ec7b 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/model/project/property/TriggerProjectProperty.java @@ -19,10 +19,11 @@ import hudson.triggers.Trigger; import org.eclipse.hudson.api.model.ICascadingJob; /** - * Property for triggers in case of we should use child project trigger - * instead of parent project if they are equals. + * Property for triggers in case of we should use child project trigger instead + * of parent project if they are equals. */ public class TriggerProjectProperty extends BaseProjectProperty<Trigger> { + public TriggerProjectProperty(ICascadingJob job) { super(job); } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/plugins/InstalledPluginManager.java b/hudson-core/src/main/java/org/eclipse/hudson/plugins/InstalledPluginManager.java index c39b67c..8ff4287 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/plugins/InstalledPluginManager.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/plugins/InstalledPluginManager.java @@ -64,7 +64,6 @@ public final class InstalledPluginManager { public void loadInstalledPlugins() { File[] hpiArchives = pluginsDir.listFiles(new FilenameFilter() { - @Override public boolean accept(File dir, String name) { return name.endsWith("hpi"); @@ -129,14 +128,14 @@ public final class InstalledPluginManager { File disabledMarker = new File(hpiArchive.getPath() + ".disabled"); return !disabledMarker.exists(); } - + public void setEnable(boolean enable) throws IOException { File disabledMarker = new File(hpiArchive.getPath() + ".disabled"); - if (enable && disabledMarker.exists()){ - FileUtils.deleteQuietly(disabledMarker); + if (enable && disabledMarker.exists()) { + FileUtils.deleteQuietly(disabledMarker); } - if (!enable && !disabledMarker.exists()){ - FileUtils.touch(disabledMarker);; + if (!enable && !disabledMarker.exists()) { + FileUtils.touch(disabledMarker);; } } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java b/hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java index 9c75b62..9a07aee 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/plugins/PluginCenter.java @@ -59,7 +59,6 @@ final public class PluginCenter { private ProxyConfiguration proxyConfig; private ExecutorService installerService = Executors.newSingleThreadExecutor( new DaemonThreadFactory(new ThreadFactory() { - @Override public Thread newThread(Runnable r) { Thread t = new Thread(r); @@ -95,7 +94,7 @@ final public class PluginCenter { } public List<AvailablePluginInfo> getAvailablePlugins(String pluginType) { - return updateSiteManager.getAvailablePlugins(pluginType); + return updateSiteManager.getAvailablePlugins(pluginType); } public List<AvailablePluginInfo> getCategorizedAvailablePlugins(String pluginType, String category) { @@ -184,7 +183,7 @@ final public class PluginCenter { public HttpResponse doupdatePlugin(@QueryParameter String pluginName) { return doinstallPlugin(pluginName); } - + public HttpResponse doinstallPlugin(@QueryParameter String pluginName) { if (!hudsonSecurityManager.hasPermission(Permission.HUDSON_ADMINISTER)) { return HttpResponses.forbidden(); diff --git a/hudson-core/src/main/java/org/eclipse/hudson/script/ScriptSupport.java b/hudson-core/src/main/java/org/eclipse/hudson/script/ScriptSupport.java index 7e9e889..39a704a 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/script/ScriptSupport.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/script/ScriptSupport.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.script; @@ -29,99 +29,102 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - - /** * Extension point for adding Scripting Support to Hudson. * - * A default constructor is needed to create ScriptSupport in - * the default configuration. + * A default constructor is needed to create ScriptSupport in the default + * configuration. * * @author Winston Prakash * @since 3.0.0 * @see ScriptSupportDescriptor */ public abstract class ScriptSupport extends AbstractDescribableImpl<ScriptSupport> implements ExtensionPoint { - + public static String SCRIPT_GROOVY = "groovy"; public static String SCRIPT_JAVASCRIPT = "javascript"; public static String SCRIPT_SCALA = "scala"; public static String SCRIPT_RUBY = "ruby"; public static String SCRIPT_ERLANG = "erlang"; public static String SCRIPT_PYTHON = "python"; - public static String DEFAULT = "SCRIPT_GROOVY"; - + /** * Returns all the registered {@link ScriptSupport} descriptors. */ public static DescriptorExtensionList<ScriptSupport, Descriptor<ScriptSupport>> all() { - if (Hudson.getInstance() != null){ + if (Hudson.getInstance() != null) { return Hudson.getInstance().<ScriptSupport, Descriptor<ScriptSupport>>getDescriptorList(ScriptSupport.class); - }else{ + } else { return null; } } - + /** * Return true if the give scriptType is supported + * * @param scriptType * @return true if supported */ - public abstract boolean hasSupport(String scriptType); - - + public abstract boolean hasSupport(String scriptType); + /** - * Return the type of Dynamic Language Supported ("groovy", "javascript", "scala", "ruby" etc) - * @return + * Return the type of Dynamic Language Supported ("groovy", "javascript", + * "scala", "ruby" etc) + * + * @return */ public abstract String getType(); - + /** * Evaluate the expression String and return the result - * @param expression - string to evaluate as expression - * @return Object, evaluated value + * + * @param expression - string to evaluate as expression + * @return Object, evaluated value */ public abstract Object evaluateExpression(String expression); - + /** * Evaluate the expression String and return the result - * @param expression - string to evaluate as expression + * + * @param expression - string to evaluate as expression * @param variableMap - map of variables and corresponding object to bind to - * @return Object, evaluated value + * @return Object, evaluated value */ public abstract Object evaluateExpression(String expression, Map<String, Object> variableMap); - + /** * Evaluate the script and write the result to print writer + * * @param script, string of script to evaluate - * @param printWriter - Standard output Print Writer + * @param printWriter - Standard output Print Writer */ - public abstract void evaluate(String script, PrintWriter printWriter); - + public abstract void evaluate(String script, PrintWriter printWriter); + /** * Evaluate the script and write the result to print writer + * * @param script, string of script to evaluate * @param variableMap - map of variables and corresponding object to bind to - * @param printWriter - Standard output Print Writer + * @param printWriter - Standard output Print Writer */ public abstract void evaluate(String script, Map<String, Object> variableMap, PrintWriter printWriter); - + /** * Evaluate the script and write the result to print writer - * @param classLoader - pass in the Class Loader to script JVM + * + * @param classLoader - pass in the Class Loader to script JVM * @param script, string of script to evaluate * @param variableMap - map of variables and corresponding object to bind to - * @param printWriter - Standard output Print Writer + * @param printWriter - Standard output Print Writer */ public abstract void evaluate(ClassLoader classLoader, String script, Map<String, Object> variableMap, PrintWriter printWriter); - @Override public ScriptSupportDescriptor getDescriptor() { - return (ScriptSupportDescriptor)super.getDescriptor(); + return (ScriptSupportDescriptor) super.getDescriptor(); } - + public static List<ScriptSupport> getAvailableScriptSupports() { List<ScriptSupport> scriptSupports = new ArrayList<ScriptSupport>(); if (ScriptSupport.all() != null && !ScriptSupport.all().isEmpty()) { @@ -136,8 +139,8 @@ public abstract class ScriptSupport extends AbstractDescribableImpl<ScriptSuppor } return scriptSupports; } - - public Logger getLogger(){ + + public Logger getLogger() { return LoggerFactory.getLogger(ScriptSupport.class); } } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/script/ScriptSupportDescriptor.java b/hudson-core/src/main/java/org/eclipse/hudson/script/ScriptSupportDescriptor.java index 3f52862..8cc973b 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/script/ScriptSupportDescriptor.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/script/ScriptSupportDescriptor.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.script; diff --git a/hudson-core/src/main/java/org/eclipse/hudson/security/HudsonSecurityManager.java b/hudson-core/src/main/java/org/eclipse/hudson/security/HudsonSecurityManager.java index d1d4d94..0c06a3f 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/security/HudsonSecurityManager.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/security/HudsonSecurityManager.java @@ -64,9 +64,8 @@ import org.xml.sax.SAXException; * @since 3.0.0 */ public class HudsonSecurityManager implements Saveable { - - private transient final String securityConfigFileName = "hudson-security.xml"; + private transient final String securityConfigFileName = "hudson-security.xml"; /** * Used to load/save Security configuration. */ @@ -143,16 +142,16 @@ public class HudsonSecurityManager implements Saveable { load(); } - + /** * Get the directory where hudson stores the User configuration - * @return + * + * @return */ public File getHudsonHome() { return hudsonHome; } - /** * Gets the markup formatter used in the system. * @@ -189,11 +188,10 @@ public class HudsonSecurityManager implements Saveable { public boolean hasPermission(Permission p) { return getACL().hasPermission(p); } - + /** - * Returns a secret key that survives across container start/stop. - * <p> - * This value is useful for implementing some of the security features. + * Returns a secret key that survives across container start/stop. <p> This + * value is useful for implementing some of the security features. */ public String getSecretKey() { return secretKey; @@ -201,6 +199,7 @@ public class HudsonSecurityManager implements Saveable { /** * Gets {@linkplain #getSecretKey() the secret key} as a key for AES-128. + * * @since 1.308 */ public SecretKey getSecretKeyAsAES128() { @@ -312,7 +311,7 @@ public class HudsonSecurityManager implements Saveable { if (security.has("markupFormatter")) { markupFormatter = req.bindJSON(MarkupFormatter.class, security.getJSONObject("markupFormatter")); - } + } } else { useSecurity = null; setSecurityRealm(SecurityRealm.NO_AUTHENTICATION); @@ -365,9 +364,9 @@ public class HudsonSecurityManager implements Saveable { try { if (config.exists()) { config.unmarshal(this); - }else{ + } else { // Compatibility. Hudson 2.x stores Security config in the Global Config file. - if (extractSecurityConfig()){ + if (extractSecurityConfig()) { config.unmarshal(this); } } @@ -428,13 +427,13 @@ public class HudsonSecurityManager implements Saveable { } return a; } - + private boolean extractSecurityConfig() { try { File globalConfigFile = new File(hudsonHome, "config.xml"); - - if (!globalConfigFile.exists()){ + + if (!globalConfigFile.exists()) { return false; } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/security/captcha/CaptchaSupport.java b/hudson-core/src/main/java/org/eclipse/hudson/security/captcha/CaptchaSupport.java index 54d0785..171b218 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/security/captcha/CaptchaSupport.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/security/captcha/CaptchaSupport.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.security.captcha; @@ -23,33 +23,32 @@ import hudson.model.Hudson; import java.io.IOException; import java.io.OutputStream; - /** - * Extension point for adding Captcha Support to User Registration Page {@link CaptchaSupport}. + * Extension point for adding Captcha Support to User Registration Page + * {@link CaptchaSupport}. * - * <p> - * This object can have an optional <tt>config.jelly</tt> to configure the Captcha Support - * <p> - * A default constructor is needed to create CaptchaSupport in - * the default configuration. + * <p> This object can have an optional <tt>config.jelly</tt> to configure the + * Captcha Support <p> A default constructor is needed to create CaptchaSupport + * in the default configuration. * * @author Winston Prakash * @since 3.0.0 * @see CaptchaSupportDescriptor */ public abstract class CaptchaSupport extends AbstractDescribableImpl<CaptchaSupport> implements ExtensionPoint { + /** * Returns all the registered {@link CaptchaSupport} descriptors. */ public static DescriptorExtensionList<CaptchaSupport, Descriptor<CaptchaSupport>> all() { return Hudson.getInstance().<CaptchaSupport, Descriptor<CaptchaSupport>>getDescriptorList(CaptchaSupport.class); } - - abstract public boolean validateCaptcha(String id, String text); - + + abstract public boolean validateCaptcha(String id, String text); + abstract public void generateImage(String id, OutputStream ios) throws IOException; public CaptchaSupportDescriptor getDescriptor() { - return (CaptchaSupportDescriptor)super.getDescriptor(); + return (CaptchaSupportDescriptor) super.getDescriptor(); } } diff --git a/hudson-core/src/main/java/org/eclipse/hudson/security/captcha/CaptchaSupportDescriptor.java b/hudson-core/src/main/java/org/eclipse/hudson/security/captcha/CaptchaSupportDescriptor.java index 82c9825..77832d3 100644 --- a/hudson-core/src/main/java/org/eclipse/hudson/security/captcha/CaptchaSupportDescriptor.java +++ b/hudson-core/src/main/java/org/eclipse/hudson/security/captcha/CaptchaSupportDescriptor.java @@ -7,10 +7,10 @@ * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * - * Contributors: + * Contributors: * * Winston Prakash - * + * *******************************************************************************/ package org.eclipse.hudson.security.captcha; |

