Tabnine Logo
org.eclipse.hudson
Code IndexAdd Tabnine to your IDE (free)

How to use org.eclipse.hudson

Best Java code snippets using org.eclipse.hudson (Showing top 20 results out of 315)

origin: org.eclipse.hudson/hudson-core

public boolean containsKey(Object key) {
  return (get(key) != null);
}
origin: org.eclipse.hudson/hudson-core

JellyJexlContext(JellyContext context) {
  this.vars = new JellyMap(context);
}
origin: org.eclipse.hudson/hudson-core

public synchronized Object current() {
  return getContext().getAttribute(APP);
}
origin: org.eclipse.hudson/hudson-core

final WebAppController controller = WebAppController.get();
try {
  controller.setContext(servletContext);
} catch (IllegalStateException e) {
  controller.setInstallStrategy(new DefaultInstallStrategy());
} catch (IllegalStateException e) {
  new URLClassLoader(new URL[0], getClass().getClassLoader());
} catch (SecurityException e) {
  controller.install(new InsufficientPermissionDetected(e));
  return;
installLogger();
File dir = getHomeDir(event);
try {
  dir = dir.getCanonicalFile();
  controller.install(new NoHomeDir(home));
  return;
  controller.install(new IncompatibleVMDetected());
  return;
  ServletResponse.class.getMethod("setCharacterEncoding", String.class);
} catch (NoSuchMethodException e) {
  controller.install(new IncompatibleServletVersionDetected(ServletResponse.class));
origin: org.eclipse.hudson/hudson-test-framework

final WebAppController controller = WebAppController.get();
try {
  controller.setContext(hudson.servletContext);
} catch (IllegalStateException e) {
  controller.setInstallStrategy(new DefaultInstallStrategy());
} catch (IllegalStateException e) {
controller.install(hudson);
HudsonServletContextListener.installExpressionFactory(new ServletContextEvent(hudson.servletContext));
origin: org.eclipse.hudson/hudson-core

/**
 * Reloads the configuration synchronously.
 */
public void reload() throws IOException, InterruptedException, ReactorException {
  executeReactor(null, loadTasks());
  User.reload();
  initLevel = InitMilestone.COMPLETED;
  WebAppController.get().install(this);
}
origin: org.eclipse.hudson/hudson-core

  @Override
  public void run() {
    try {
      HudsonSecurityManager.grantFullControl();
      // Wait 'til we have no active executors.
      doQuietDown(true, 0);
      // Make sure isQuietingDown is still true.
      if (isQuietingDown) {
        WebAppController.get().install(new HudsonIsRestarting());
        // give some time for the browser to load the "reloading" page
        logger.info("Restart in 10 seconds");
        Thread.sleep(10000);
        logger.error(String.format("Restarting VM as requested by %s", exitUser));
        for (RestartListener listener : RestartListener.all()) {
          listener.onRestart();
        }
        lifecycle.restart();
      } else {
        logger.info("Safe-restart mode cancelled");
      }
    } catch (InterruptedException e) {
      logger.warn("Failed to restart Hudson", e);
    } catch (IOException e) {
      logger.warn("Failed to restart Hudson", e);
    } finally {
      Hudson.this.safeRestarting = false;
    }
  }
}.start();
origin: org.eclipse.hudson/hudson-core

    @Override
    public void run() {
      try {
        // Creating of the god object performs most of the booting muck
        Hudson hudson = new Hudson(hudsonHomeDir, servletContext, null, restart);

        //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));
      }
    }
  }
origin: org.eclipse.hudson/hudson-core

public void invokeHudson(boolean restart) {
  final WebAppController controller = WebAppController.get();
  if (initialClassLoader == null) {
    initialClassLoader = getClass().getClassLoader();
  }
  Class hudsonIsLoadingClass;
  try {
    outerClassLoader = new OuterClassLoader(initialClassLoader);
    hudsonIsLoadingClass = outerClassLoader.loadClass("hudson.util.HudsonIsLoading");
    HudsonIsLoading hudsonIsLoading = (HudsonIsLoading) hudsonIsLoadingClass.newInstance();
    Class runnableClass = outerClassLoader.loadClass("org.eclipse.hudson.init.InitialRunnable");
    Constructor ctor = runnableClass.getDeclaredConstructors()[0];
    ctor.setAccessible(true);
    InitialRunnable initialRunnable = (InitialRunnable) ctor.newInstance(controller, logger, hudsonHomeDir, servletContext, restart);
    controller.install(hudsonIsLoading);
    initThread = new Thread(initialRunnable, "hudson initialization thread " + (++highInitThreadNumber));
    initThread.setContextClassLoader(outerClassLoader);
    initThread.start();
  } catch (Exception ex) {
    logger.error("Hudson failed to load!!!", ex);
  }
  /**
   * Above replaces these lines controller.install(new HudsonIsLoading());
   *
   * new Thread("hudson initialization thread") { }.start();
   */
}
origin: org.eclipse.hudson/hudson-core

    if (ze.getCode() == NativeAccessException.PERMISSION) {
WebAppController.get().install(new HudsonIsRestarting());
origin: org.eclipse.hudson/hudson-core

public synchronized void install(final Object app) {
  if (app == null) {
    throw new NullPointerException();
  }
  if (log.isLoggable(Level.FINE)) {
    log.fine("Attempting to install app: " + app);
  }
  if (getInstallStrategy().isAllowed(app)) {
    getContext().setAttribute(APP, app);
  } else {
    log.warning("Strategy denied install");
  }
}
origin: org.eclipse.hudson/hudson-service

@Inject
public ReadyDetector(final EventPublisher publisher, final Hudson hudson) {
  this.publisher = checkNotNull(publisher);
  this.hudson = checkNotNull(hudson);
  this.controller = WebAppController.get();
  setDaemon(true);
}
origin: org.eclipse.hudson/hudson-core

public static void installExpressionFactory(ServletContextEvent event) {
  JellyFacet.setExpressionFactory(event, new ExpressionFactory2());
}
origin: org.eclipse.hudson/hudson-core

public Object evaluate(JellyContext context) {
  try {
    CURRENT_CONTEXT.set(context);
    JexlContext jexlContext = new JellyJexlContext(context);
    return expression.evaluate(jexlContext);
  } catch (AccessDeniedException e) {
    // let all Spring security exception pass through
    throw e;
  } catch (AclDataAccessException e) {
    // let all Spring security exception pass through
    throw e;
  }catch (AuthenticationException e) {
    // let all Spring security exception pass through
    throw e;
  }catch (Exception 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());
origin: org.eclipse.hudson/hudson-core

public Expression createExpression(String text) throws JellyException {
  try {
    return new JexlExpression(
        org.apache.commons.jexl.ExpressionFactory.createExpression(text));
  } catch (Exception e) {
    throw new JellyException("Unable to create expression: " + text, e);
  }
}
origin: org.eclipse.hudson/hudson-service

private boolean isReady() {
  // Hudson does not give us a nice InitMilestone when its really ready,
  // but if its not yet COMPLETED, don't bother trying to figure out more
  if (hudson.getInitLevel() != InitMilestone.COMPLETED) {
    return false;
  }
  HudsonFilter filter = HudsonFilter.get(hudson.servletContext);
  if (filter == null) {
    return false;
  }
  // Need to get access to the filter's filter field to see if its actually initialized or not
  // it does not expose it directly, so we have to use reflection to force access
  Filter delegate = getDelegate(filter);
  if (delegate == null) {
    return false;
  }
  // At this point we _should_ be ready, see if the app root object is installed... fingers crossed!
  try {
    Object app = controller.current(); // FIXME: This may actually be the only check needed?
    return app instanceof hudson.model.Hudson;
  } catch (IllegalStateException e) {
    return false; // context not yet available
  }
}
origin: org.eclipse.hudson/hudson-core

/**
 * Ignore the problem and go back to using Hudson.
 */
public void doIgnore(StaplerRequest req, StaplerResponse rsp) throws IOException {
  ignore = true;
  WebAppController.get().install(Hudson.getInstance());
  rsp.sendRedirect2(req.getContextPath() + '/');
}
private static final Logger LOGGER = Logger.getLogger(DoubleLaunchChecker.class.getName());
origin: org.eclipse.hudson/hudson-core

protected void execute() {
  File timestampFile = new File(home, ".owner");
  long t = timestampFile.lastModified();
  if (t != 0 && lastWriteTime != 0 && t != lastWriteTime && !ignore) {
    try {
      collidingId = FileUtils.readFileToString(timestampFile);
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Failed to read collision file", e);
    }
    // we noticed that someone else have updated this file.
    // switch GUI to display this error.
    WebAppController.get().install(this);
    LOGGER.severe("Collision detected. timestamp=" + t + ", expected=" + lastWriteTime);
    // we need to continue updating this file, so that the other Hudson would notice the problem, too.
  }
  try {
    FileUtils.writeStringToFile(timestampFile, getId());
    lastWriteTime = timestampFile.lastModified();
  } catch (IOException e) {
    // if failed to write, err on the safe side and assume things are OK.
    lastWriteTime = 0;
  }
  schedule();
}
origin: org.eclipse.hudson/hudson-core

/**
 * Performs a restart.
 */
public void restart() throws RestartNotSupportedException {
  final Lifecycle lifecycle = Lifecycle.get();
  lifecycle.verifyRestartable(); // verify that Hudson is restartable
  WebAppController.get().install(new HudsonIsRestarting());
  new Thread("restart thread") {
    final String exitUser = getAuthentication().getName();
    @Override
    public void run() {
      try {
        HudsonSecurityManager.grantFullControl();
        // give some time for the browser to load the "reloading" page
        Thread.sleep(5000);
        logger.error(String.format("Restarting VM as requested by %s", exitUser));
        for (RestartListener listener : RestartListener.all()) {
          listener.onRestart();
        }
        lifecycle.restart();
      } catch (InterruptedException e) {
        logger.warn("Failed to restart Hudson", e);
      } catch (IOException e) {
        logger.warn("Failed to restart Hudson", e);
      }
    }
  }.start();
}
origin: org.eclipse.hudson/hudson-core

/**
 * Reloads the configuration.
 */
@CLIMethod(name = "reload-configuration")
public synchronized HttpResponse doReload() throws IOException {
  checkPermission(ADMINISTER);
  // engage "loading ..." UI and then run the actual task in a separate thread
  WebAppController.get().install(new HudsonIsLoading());
  new Thread("Hudson config reload thread") {
    @Override
    public void run() {
      try {
        HudsonSecurityManager.grantFullControl();
        reload();
      } catch (IOException e) {
        logger.error("Failed to reload Hudson config", e);
      } catch (ReactorException e) {
        logger.error("Failed to reload Hudson config", e);
      } catch (InterruptedException e) {
        logger.error("Failed to reload Hudson config", e);
      }
    }
  }.start();
  return HttpResponses.redirectViaContextPath("/");
}
org.eclipse.hudson

Most used classes

  • WebAppController
    Handles management of the Stapler root "app" object.
  • HudsonSecurityManager
    Manager that manages Hudson Security. The configuration is written to the file hudson-security.xml
  • HudsonServletContextListener
    Entry point when Hudson is used as a webapp.
  • WebAppController$DefaultInstallStrategy
    Always install the given object.
  • DataSet
    Builds CategoryDataset. This code works around an issue in DefaultCategoryDataset where order of add
  • HudsonSecurityEntitiesHolder,
  • ExpressionFactory2$JellyJexlContext,
  • ExpressionFactory2$JellyMap,
  • ExpressionFactory2$JexlExpression,
  • ExpressionFactory2,
  • WebAppController$InstallStrategy,
  • ICascadingJob,
  • IJob,
  • IProjectProperty,
  • ChartLabel,
  • Graph,
  • GraphSeries,
  • GraphSupport,
  • MultiStageTimeSeries$TimeScale
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now