@Override
  public void activate(ComponentContext context) throws Exception {
    log.debug("Activate");
    bundle = context.getRuntimeContext();

    // Find a scheduler
    StdSchedulerFactory schedulerFactory = new StdSchedulerFactory();
    URL cfg = context.getRuntimeContext().getResource("config/quartz.properties");
    if (cfg != null) {
      InputStream stream = cfg.openStream();
      try {
        schedulerFactory.initialize(stream);
      } finally {
        stream.close();
      }
    } else {
      // use default config (unit tests)
      Properties props = new Properties();
      props.put("org.quartz.scheduler.instanceName", "Quartz");
      props.put("org.quartz.scheduler.threadName", "Quartz_Scheduler");
      props.put("org.quartz.scheduler.instanceId", "NON_CLUSTERED");
      props.put("org.quartz.scheduler.makeSchedulerThreadDaemon", "true");
      props.put("org.quartz.scheduler.skipUpdateCheck", "true");
      props.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
      props.put("org.quartz.threadPool.threadCount", "1");
      props.put("org.quartz.threadPool.threadPriority", "4");
      props.put("org.quartz.threadPool.makeThreadsDaemons", "true");
      schedulerFactory.initialize(props);
    }
    scheduler = schedulerFactory.getScheduler();
    scheduler.start();
    // server = MBeanServerFactory.createMBeanServer();
    // server.createMBean("org.quartz.ee.jmx.jboss.QuartzService",
    // quartzObjectName);

    // clean up all nuxeo jobs
    // https://jira.nuxeo.com/browse/NXP-7303
    String[] jobs = scheduler.getJobNames("nuxeo");
    for (String job : jobs) {
      unregisterSchedule(job);
    }
  }
  @Override
  public void activate(ComponentContext context) throws Exception {
    super.activate(context);
    ctx = context;
    String webDir = Framework.getProperty("org.nuxeo.ecm.web.root");
    File root = null;
    if (webDir != null) {
      root = new File(webDir);
    } else {
      root = new File(Framework.getRuntime().getHome(), "web");
    }
    root = root.getCanonicalFile();
    log.info("Using web root: " + root);
    if (!new File(root, "default").exists()) {
      try {
        root.mkdirs();
        // runtime predeployment is not supporting conditional unziping so we do the predeployment
        // here:
        deployWebDir(context.getRuntimeContext().getBundle(), root);
      } catch (Exception e) { // delete incomplete files
        FileUtils.deleteTree(root);
        throw e;
      }
    }
    // register contrib managers
    registerContributionManager(APPLICATION_XP, new ContributionManager(this));
    registerContributionManager(WEB_OBJ_XP, new ContributionManager(this));

    // load message bundle
    notifier = new FileChangeNotifier();
    notifier.start();
    notifier.addListener(this);

    engine = new DefaultWebEngine(root, notifier);
    deployer = new ConfigurationDeployer(notifier);
    deployer.addConfigurationChangedListener(this);
  }
 @Override
 public void activate(ComponentContext context) {
   super.activate(context);
   this.ctx = context.getRuntimeContext();
   storage = new FileSystemStorage();
 }
Esempio n. 4
0
 @Override
 public void activate(ComponentContext context) {
   super.activate(context);
   bundle = context.getRuntimeContext().getBundle();
 }