Java Code Examples for org.eclipse.equinox.app.IApplicationContext#getArguments()

The following examples show how to use org.eclipse.equinox.app.IApplicationContext#getArguments() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataServer.java    From dawnsci with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Method replaces main(...) when running things with OSGi
 * 
 * Not called on GDA server will will probably start the Data Server by calling 'start' from spring, no arguments.
 */
@Override
public Object start(IApplicationContext context) throws Exception {

	@SuppressWarnings("rawtypes")
	final Map      args          = context.getArguments();
	final String[] configuration = (String[])args.get("application.args");
       
	Map<String, String> conf = new HashMap<String, String>(7);
	for (int i = 0; i < configuration.length; i++) {
		final String pkey = configuration[i];
		if (pkey.startsWith("-")) {
			conf.put(pkey.substring(1), configuration[i+1]);
		}
	}
     
   	if (conf.containsKey("port")) {
   		setPort(Integer.parseInt(conf.get("port").toString()));
   	} 
   	start(true); // blocking
   	
   	return server;// We are done with this application now.
}
 
Example 2
Source File: ReportDebugger.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Object start( IApplicationContext context ) throws Exception
{
	String[] appArgs = new String[0];

	if ( context.getArguments( ) != null )
	{
		Object args = context.getArguments( )
				.get( IApplicationContext.APPLICATION_ARGS );

		if ( args instanceof String[] )
		{
			appArgs = (String[]) args;
		}
	}

	ReportLauncher.main( appArgs );

	return null;
}
 
Example 3
Source File: Application.java    From depan with Apache License 2.0 5 votes vote down vote up
@Override
public Object start(IApplicationContext context) throws Exception {
  final Map<?, ?> args = context.getArguments();
  final String[] appArgs = (String[]) args.get("application.args");
  CommandDispatch cli = new CommandDispatch();
  cli.dispatch(Arrays.asList(appArgs));

  Object result = cli.getResult();
  if (IApplication.EXIT_OK != result) {
    CmdLogger.LOG.error("Depan Cmd failure with result: {}", result);
  }
  return result;
}
 
Example 4
Source File: Application.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Object start(final IApplicationContext context) throws Exception {

	DEBUG.OFF();

	final Map<String, String[]> mm = context.getArguments();
	final List<String> args = Arrays.asList(mm.get("application.args"));
	if (args.contains(GAMA_VERSION)) {

	} else if (args.contains(HELP_PARAMETER)) {
		DEBUG.ON();
		DEBUG.LOG(showHelp());
		DEBUG.OFF();

	} else if (args.contains(RUN_LIBRARY_PARAMETER)) {
		return ModelLibraryRunner.getInstance().start(args);
	} else if (args.contains(VALIDATE_LIBRARY_PARAMETER)) {
		return ModelLibraryValidator.getInstance().start(args);
	} else if (args.contains(TEST_LIBRARY_PARAMETER)) {
		return ModelLibraryTester.getInstance().start(args);
	} else if (args.contains(CHECK_MODEL_PARAMETER)) {
		ModelLibraryGenerator.start(this, args);
	} else if (args.contains(BUILD_XML_PARAMETER)) {
		buildXML(args);
	} else {
		runSimulation(args);
	}
	return null;
}