Start H2O node.

@param args  H2O parameters
@param relativeResourcePath  FIXME remove it
@param finalizeRestRegistration  close registration of REST API
353379
public static void start(String[] args, String relativeResourcePath, boolean finalizeRestRegistration) {
    long time0 = System.currentTimeMillis();
    // Fire up the H2O Cluster
    H2O.main(args);

    H2O.registerResourceRoot(new File(relativeResourcePath + File.separator + "h2o-web/src/main/resources/www"));
    H2O.registerResourceRoot(new File(relativeResourcePath + File.separator + "h2o-core/src/main/resources/www"));
    ExtensionManager.getInstance().registerRestApiExtensions();
    if (!H2O.ARGS.disable_web) {
      if (finalizeRestRegistration) {
        H2O.startServingRestApi();
      }
    }

    long timeF = System.currentTimeMillis();
    Log.info("H2O started in " + (timeF - time0) + "ms");
    if (!H2O.ARGS.disable_web) {
      Log.info("");
      Log.info("Open H2O Flow in your web browser: " + H2O.getURL(NetworkInit.h2oHttpView.getScheme()));
      Log.info("");
    }
  }
932422
public void deleteResource(final String resourcePath) {

        CmsDeleteWarningDialog dialog = new CmsDeleteWarningDialog(resourcePath);
        Command callback = new Command() {

            /**
             * @see com.google.gwt.user.client.Command#execute()
             */
            public void execute() {

                updateResultsTab(false);
            }
        };
        dialog.loadAndShow(callback);
    }
275641
@Start(priority = 100)
   // Start isn't called with any locks, but it runs before the component is accessible from other threads
   @GuardedBy("runningCaches")
   public void start() {
      if (trace) {
         log.tracef("Starting LocalTopologyManager on %s", transport.getAddress());
      }
      if (persistentUUID == null) {
         persistentUUID = PersistentUUID.randomUUID();
         globalStateManager.writeGlobalState();
      }
      persistentUUIDManager.addPersistentAddressMapping(transport.getAddress(), persistentUUID);
      running = true;
      latestStatusResponseViewId = transport.getViewId();
   }
536469
public void put(String fromPath, String toPath, Status status) {
        http.put(fromPath, redirectRoute(toPath, status));
    }
459879
public static void ws(@NotNull String path, @NotNull Consumer<WsHandler> ws) {
        staticInstance().ws(prefixPath(path), ws);
    }
356174
public static void main(final String... args) {
        if (args.length != 2) {
            System.err.println("Usage: XMLShredder input.xml output.tnk");
            System.exit(1);
        }

        System.out.print("Shredding '" + args[0] + "' to '" + args[1] + "' ... ");
        final long time = System.currentTimeMillis();
        final File target = new File(args[1]);

        Injector injector =
            Guice.createInjector(new ModuleSetter().setDataFacClass(TreeNodeFactory.class).setMetaFacClass(
                NodeMetaPageFactory.class).createModule());
        IBackendFactory storage = injector.getInstance(IBackendFactory.class);
        IRevisioning revision = injector.getInstance(IRevisioning.class);

        try {
            final StorageConfiguration config = new StorageConfiguration(target);
            Storage.createStorage(config);
            final IStorage db = Storage.openStorage(target);
            Properties props = new Properties();
            props
                .setProperty(org.treetank.access.conf.ConstructorProps.STORAGEPATH, target.getAbsolutePath());
            props.setProperty(org.treetank.access.conf.ConstructorProps.RESOURCE, "shredded");
            db.createResource(new ResourceConfiguration(props, storage, revision, new TreeNodeFactory(),
                new NodeMetaPageFactory()));
            final ISession session =
                db.getSession(new SessionConfiguration("shredded", StandardSettings.KEY));
            final INodeWriteTrx wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling);
            final XMLEventReader reader = createFileReader(new File(args[0]));
            final XMLUpdateShredder shredder =
                new XMLUpdateShredder(wtx, reader, EShredderInsert.ADDASFIRSTCHILD, new File(args[0]),
                    EShredderCommit.COMMIT);
            shredder.call();

            wtx.close();
            session.close();
        } catch (final TTException exc) {
            exc.printStackTrace();
        } catch (final IOException exc) {
            exc.printStackTrace();
        } catch (final XMLStreamException exc) {
            exc.printStackTrace();
        }

        System.out.println(" done [" + (System.currentTimeMillis() - time) + "ms].");
    }
855007
@SuppressWarnings("rawtypes")
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        for (String arg : args) {
            sb.append(arg).append(" ");
        }
        LOG.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        LOG.info("Begin to start worker:" + sb.toString());
        LOG.info("!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        if (args.length < 5) {
            LOG.error("The length of args is less than 5 ");
            System.exit(-1);
        }

        sb = new StringBuilder();
        try {
            String topologyId = args[0];
            String supervisorId = args[1];
            String portStr = args[2];
            String workerId = args[3];
            String jarPath = args[4];

            killOldWorker(portStr);

            Map conf = Utils.readStormConfig();
            StormConfig.validate_distributed_mode(conf);

            JStormServerUtils.startTaobaoJvmMonitor();

            sb.append("topologyId:").append(topologyId).append(", ").append("port:").append(portStr).append(", ")
                    .append("workerId:").append(workerId).append(", ").append("jarPath:").append(jarPath).append("\n");

            WorkerShutdown sd = mk_worker(conf, null, topologyId, supervisorId, Integer.parseInt(portStr), workerId, jarPath);
            sd.join();

            LOG.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
            LOG.info("Successfully shutdown worker " + sb.toString());
            LOG.info("@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
        } catch (Throwable e) {
            String errMsg = "Failed to create worker: " + sb.toString();
            LOG.error(errMsg, e);
            JStormUtils.halt_process(-1, errMsg);
        }
    }
623134
public void redirectToApplicationPath(String path) {
        if ("".equals(applicationPath)) {
            // application path is the root
            redirect(path);
        } else {
            redirect(applicationPath + StringUtils.addStart(path, "/"));
        }
    }
481343
@Override
    public void start(String[] arguments) {
        boolean notStarted = !started.getAndSet(true);
        if (notStarted) {
            start(new MultiInstanceWorkloadStrategy(factory, name, arguments, endpointRegistry, execService));
        }
    }
974787
@Override
    void start() throws InitializationException {
        if (hsqlServer == null) {
            hsqlServer = new Server();
            hsqlServer.setLogWriter(null);
            hsqlServer.setSilent(true);
            hsqlServer.setDatabaseName(0, EMBEDED_DB_NAME);
            hsqlServer.setDatabasePath(0, "file:" + EMBEDED_DB_FILE_NAME + ";user=" + getUname() + ";password="
                    + getPassword());
            hsqlServer.start();
        }
    }
274960
@Override
    public org.springframework.core.io.Resource createRelative(String relativePath) throws IOException {
        throw new FileNotFoundException("Cannot create a relative resource for " + getDescription());
    }
514103
public void start() {
        if (!raftIntegration.isReady()) {
            raftIntegration.schedule(new Runnable() {
                @Override
                public void run() {
                    start();
                }
            }, RAFT_NODE_INIT_DELAY_MILLIS, MILLISECONDS);
            return;
        }

        if (logger.isFineEnabled()) {
            logger.fine("Starting raft node: " + localMember + " for " + groupId
                    + " with " + state.memberCount() + " members: " + state.members());
        }
        raftIntegration.execute(new PreVoteTask(this, 0));

        scheduleLeaderFailureDetection();
    }
298914
@Override
    public void     start() throws Exception
    {
        if ( !state.compareAndSet(State.LATENT, State.STARTED) )
        {
            throw new IllegalStateException();
        }

        try
        {
            client.create().creatingParentContainersIfNeeded().forPath(queuePath);
        }
        catch ( KeeperException.NodeExistsException ignore )
        {
            // this is OK
        }
        if ( lockPath != null )
        {
            try
            {
                client.create().creatingParentContainersIfNeeded().forPath(lockPath);
            }
            catch ( KeeperException.NodeExistsException ignore )
            {
                // this is OK
            }
        }

        if ( !isProducerOnly || (maxItems != QueueBuilder.NOT_SET) )
        {
            childrenCache.start();
        }

        if ( !isProducerOnly )
        {
            service.submit
                (
                    new Callable<Object>()
                    {
                        @Override
                        public Object call()
                        {
                            runLoop();
                            return null;
                        }
                    }
                );
        }
    }
993955
public void delete(String fromPath, String toPath, Status status) {
        http.delete(fromPath, redirectRoute(toPath, status));
    }
1280952
public void finalizeReplicaSync(int partitionId, int replicaIndex, ServiceNamespace namespace, long[] versions) {
        PartitionReplicaVersions replicaVersion = replicaVersions[partitionId];
        replicaVersion.clear(namespace);
        replicaVersion.set(namespace, versions, replicaIndex);
        clearReplicaSyncRequest(partitionId, namespace, replicaIndex);
    }
1194509
public static void main( String[] args ) {
   H2O.configureLogging();
   extManager.registerCoreExtensions();
   extManager.registerListenerExtensions();
   extManager.registerAuthExtensions();

   long time0 = System.currentTimeMillis();

   if (checkUnsupportedJava())
     throw new RuntimeException("Unsupported Java version");

    // Record system start-time.
    if( !START_TIME_MILLIS.compareAndSet(0L, System.currentTimeMillis()) )
      return;                   // Already started

    // Copy all ai.h2o.* system properties to the tail of the command line,
    // effectively overwriting the earlier args.
    ArrayList<String> args2 = new ArrayList<>(Arrays.asList(args));
    for( Object p : System.getProperties().keySet() ) {
      String s = (String)p;
      if( s.startsWith("ai.h2o.") ) {
        args2.add("-" + s.substring(7));
        // hack: Junits expect properties, throw out dummy prop for ga_opt_out
        if (!s.substring(7).equals("ga_opt_out") && !System.getProperty(s).isEmpty())
          args2.add(System.getProperty(s));
      }
    }

    // Parse args
    String[] arguments = args2.toArray(args);
    parseArguments(arguments);

    // Get ice path before loading Log or Persist class
    long time1 = System.currentTimeMillis();
    String ice = DEFAULT_ICE_ROOT();
    if( ARGS.ice_root != null ) ice = ARGS.ice_root.replace("\\", "/");
    try {
      ICE_ROOT = new URI(ice);
    } catch(URISyntaxException ex) {
      throw new RuntimeException("Invalid ice_root: " + ice + ", " + ex.getMessage());
    }

    // Always print version, whether asked-for or not!
    long time2 = System.currentTimeMillis();
    printAndLogVersion(arguments);
    if( ARGS.version ) {
      Log.flushStdout();
      exit(0);
    }

    // Print help & exit
    if (ARGS.help) {
      printHelp();
      exit(0);
    }

    // Validate arguments
    validateArguments();

    Log.info("X-h2o-cluster-id: " + H2O.CLUSTER_ID);
    Log.info("User name: '" + H2O.ARGS.user_name + "'");

    // Epic Hunt for the correct self InetAddress
    long time4 = System.currentTimeMillis();
    Log.info("IPv6 stack selected: " + IS_IPV6);
    SELF_ADDRESS = NetworkInit.findInetAddressForSelf();
    // Right now the global preference is to use IPv4 stack
    // To select IPv6 stack user has to explicitly pass JVM flags
    // to enable IPv6 preference.
    if (!IS_IPV6 && SELF_ADDRESS instanceof Inet6Address) {
      Log.err("IPv4 network stack specified but IPv6 address found: " + SELF_ADDRESS + "\n"
              + "Please specify JVM flags -Djava.net.preferIPv6Addresses=true and -Djava.net.preferIPv4Addresses=false to select IPv6 stack");
      H2O.exit(-1);
    }
    if (IS_IPV6 && SELF_ADDRESS instanceof Inet4Address) {
      Log.err("IPv6 network stack specified but IPv4 address found: " + SELF_ADDRESS);
      H2O.exit(-1);
    }

    // Start the local node.  Needed before starting logging.
    long time5 = System.currentTimeMillis();
    startLocalNode();

    // Allow core extensions to perform initialization that requires the network.
    long time6 = System.currentTimeMillis();
    for (AbstractH2OExtension ext: extManager.getCoreExtensions()) {
      ext.onLocalNodeStarted();
    }

    try {
      String logDir = Log.getLogDir();
      Log.info("Log dir: '" + logDir + "'");
    }
    catch (Exception e) {
      Log.info("Log dir: (Log4j configuration inherited)");
    }

    Log.info("Cur dir: '" + System.getProperty("user.dir") + "'");

    //Print extra debug info now that logs are setup
    long time7 = System.currentTimeMillis();
    RuntimeMXBean rtBean = ManagementFactory.getRuntimeMXBean();
    Log.debug("H2O launch parameters: "+ARGS.toString());
    if (rtBean.isBootClassPathSupported()) {
      Log.debug("Boot class path: " + rtBean.getBootClassPath());
    }
    Log.debug("Java class path: "+ rtBean.getClassPath());
    Log.debug("Java library path: "+ rtBean.getLibraryPath());

    // Load up from disk and initialize the persistence layer
    long time8 = System.currentTimeMillis();
    initializePersistence();

    // Initialize NPS
    {
      String flow_dir;

      if (ARGS.flow_dir != null) {
        flow_dir = ARGS.flow_dir;
      }
      else {
        flow_dir = DEFAULT_FLOW_DIR();
      }

      if (flow_dir != null) {
        flow_dir = flow_dir.replace("\\", "/");
        Log.info("Flow dir: '" + flow_dir + "'");
      }
      else {
        Log.info("Flow dir is undefined; saving flows not available");
      }

      NPS = new NodePersistentStorage(flow_dir);
    }

    // Start network services, including heartbeats
    long time9 = System.currentTimeMillis();
    startNetworkServices();   // start server services
    Log.trace("Network services started");

    // The "Cloud of size N formed" message printed out by doHeartbeat is the trigger
    // for users of H2O to know that it's OK to start sending REST API requests.
    long time10 = System.currentTimeMillis();
    Paxos.doHeartbeat(SELF);
    assert SELF._heartbeat._cloud_hash != 0 || ARGS.client;

    // Start the heartbeat thread, to publish the Clouds' existence to other
    // Clouds. This will typically trigger a round of Paxos voting so we can
    // join an existing Cloud.
    new HeartBeatThread().start();

    long time11 = System.currentTimeMillis();

    // Log registered parsers
    Log.info("Registered parsers: " + Arrays.toString(ParserService.INSTANCE.getAllProviderNames(true)));

    // Start thread checking client disconnections
    if (Boolean.getBoolean(H2O.OptArgs.SYSTEM_PROP_PREFIX + "debug.clientDisconnectAttack")) {
      // for development only!
      Log.warn("Client Random Disconnect attack is enabled - use only for debugging! More warnings to follow ;)");
      new ClientRandomDisconnectThread().start();
    } else {
      // regular mode of operation
      new ClientDisconnectCheckThread().start();
    }

    long time12 = System.currentTimeMillis();
    Log.debug("Timing within H2O.main():");
    Log.debug("    Args parsing & validation: " + (time1 - time0) + "ms");
    Log.debug("    Get ICE root: " + (time2 - time1) + "ms");
    Log.debug("    Print log version: " + (time4 - time2) + "ms");
    Log.debug("    Detect network address: " + (time5 - time4) + "ms");
    Log.debug("    Start local node: " + (time6 - time5) + "ms");
    Log.debug("    Extensions onLocalNodeStarted(): " + (time7 - time6) + "ms");
    Log.debug("    RuntimeMxBean: " + (time8 - time7) + "ms");
    Log.debug("    Initialize persistence layer: " + (time9 - time8) + "ms");
    Log.debug("    Start network services: " + (time10 - time9) + "ms");
    Log.debug("    Cloud up: " + (time11 - time10) + "ms");
    Log.debug("    Start GA: " + (time12 - time11) + "ms");
  }
1297816
public static void main(String[] args)
	{
		if (args.length != 1)
		{
			System.out.println("\nUse Parameter: path (to biopax OWL files)\n");
			System.exit(-1);
		}

		BioPAXIOHandler reader = new SimpleIOHandler();
		final String pathname = args[0];
		File testDir = new File(pathname);

		/*
				 * Customized Fetcher is to fix the issue with Level2
				 * - when NEXT-STEP leads out of the pathway...
				 * (do not worry - those pathway steps that are part of
				 * the pathway must be in the PATHWAY-COMPONENTS set)
				 */
		Filter<PropertyEditor> nextStepPropertyFilter = new Filter<PropertyEditor>()
		{
			public boolean filter(PropertyEditor editor)
			{
				return !editor.getProperty().equals("NEXT-STEP");
			}
		};
		fetcher = new Fetcher(SimpleEditorMap.L2, nextStepPropertyFilter);

		FilenameFilter filter = new FilenameFilter()
		{
			public boolean accept(File dir, String name)
			{
				return (name.endsWith("owl"));
			}
		};

		for (String s : testDir.list(filter))
		{
			try
			{
				process(pathname, s, reader);
			}
			catch (Exception e)
			{
				log.error("Failed at testing " + s, e);
			}
		}
	}