Refine search
public static String[] getOriginalArguments(StartupContext sc) { Properties args = sc.getArguments(); String s = args.getProperty(Constants.ORIGINAL_ARGS); // See how ASMain packages the arguments if (s == null) return new String[0]; StringTokenizer st = new StringTokenizer(s, Constants.ARG_SEP, false); List<String> result = new ArrayList<String>(); while (st.hasMoreTokens()) { result.add(st.nextToken()); } return result.toArray(new String[result.size()]); }
public static ServiceLocator getNewHabitat(String root) { Properties p = new Properties(); p.put(com.sun.enterprise.glassfish.bootstrap.Constants.INSTALL_ROOT_PROP_NAME, root); p.put(com.sun.enterprise.glassfish.bootstrap.Constants.INSTANCE_ROOT_PROP_NAME, root); ModulesRegistry registry = new StaticModulesRegistry(Utils.class.getClassLoader(), new StartupContext(p)); ServiceLocator defaultSL = registry.createServiceLocator("default"); return defaultSL; }
private long getUptime() { RuntimeMXBean mxbean = ManagementFactory.getRuntimeMXBean(); long totalTime_ms = -1; if (mxbean != null) totalTime_ms = mxbean.getUptime(); if (totalTime_ms <= 0) { long start = env.getStartupContext().getCreationTime(); totalTime_ms = System.currentTimeMillis() - start; } return totalTime_ms; } }
final protected String startupArg(final String argName) { if (startupArgs == null) { if (startupContext != null) { startupArgs = startupContext.getArguments(); } else { startupArgs = new Properties(); // shouldn't happen } } return startupArgs.getProperty(argName); }
Properties cloned = new Properties(); cloned.putAll(glassFishProperties.getProperties()); final StartupContext startupContext = new StartupContext(gfProps.getProperties());
@Override public ServiceLocator createServiceLocator(String name) throws MultiException { ServiceLocator serviceLocator = super.createServiceLocator(name); StartupContext sc = startupContext; if (startupContext==null) { sc = new StartupContext(new Properties()); } DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(sc)); config.commit(); return serviceLocator; }
@Override public ServiceLocator createServiceLocator(ModulesRegistry mr, StartupContext context, List<PopulatorPostProcessor> postProcessors, DescriptorFileFinder descriptorFileFinder) throws BootException { HabitatInfo habitatInfo = new HabitatInfo(); habitatInfo.serviceLocator = super.createServiceLocator(mr, context, postProcessors, descriptorFileFinder); createHK2ServiceTracker(habitatInfo); //convert properties to Hashtable Properties contextArgs = context.getArguments(); Hashtable<String,String> contextArgTable = new Hashtable<String,String>(); for(Object propKey:contextArgs.stringPropertyNames()) { contextArgTable.put((String)propKey, (String)contextArgs.get(propKey)); } // register ServiceLocator as an OSGi service habitatInfo.habitatRegistration = ctx.registerService(ServiceLocator.class.getName(), habitatInfo.serviceLocator, contextArgTable); habitatInfos.put(habitatInfo.serviceLocator, habitatInfo); return habitatInfo.serviceLocator; }
/** Creates a new instance of ServerContextImpl */ public void postConstruct() { this.instanceRoot = env.getDomainRoot(); this.args = new String[startupContext.getArguments().size()*2]; int i=0; for (Map.Entry<Object, Object> entry : startupContext.getArguments().entrySet()) { args[i++] = entry.getKey().toString(); args[i++] = entry.getValue().toString(); } }
public void postConstruct() { boolean success; boolean readStdin = sc.getArguments().containsKey(STDIN_OPTION_TO_ASMAIN); if (readStdin) { success = setFromStdin(); } else { success = setFromMasterPasswordFile(); if (!success) { success = setFromAsMainArguments(); } } if (!success) { masterPassword = "changeit".toCharArray(); //the default; } }
public static File getInstanceRoot(StartupContext sc) { return getInstanceRoot(sc.getArguments()); }
private void prepareHabitat() { // Bootstrap a hk2 environment. ModulesRegistry registry = new StaticModulesRegistry(getClass().getClassLoader()); habitat = registry.createHabitat("default"); StartupContext startupContext = new StartupContext(); habitat.add(new ExistingSingletonInhabitant(startupContext)); habitat.addComponent(null, new ProcessEnvironment(ProcessEnvironment.ProcessType.Other)); }
/** * Start the server from the command line * * @param args * the command line arguments */ public void start(String[] args) throws BootException { File bootstrap = this.getBootstrapFile(); File root = bootstrap.getAbsoluteFile().getParentFile(); // root is the directory in which this bootstrap.jar is located // For most cases, this is the lib directory although this is completely // dependent on the usage of this facility. if (root == null) { throw new BootException("Cannot find root installation from " + bootstrap); } // get the ModuleStartup implementation. ModulesRegistry mr = AbstractFactory.getInstance().createModulesRegistry(); StartupContext context = new StartupContext( ArgumentManager.argsToMap(args)); launch(mr, context.getPlatformMainServiceName(), context); }
if ("upgrade".equals(context.getPlatformMainServiceName())) { upgrade();
Properties cloned = new Properties(); cloned.putAll(glassFishProperties.getProperties()); final StartupContext startupContext = new StartupContext(gfProps.getProperties());
@Override public ServiceLocator createServiceLocator(String name) throws MultiException { ServiceLocator serviceLocator = super.createServiceLocator(name); StartupContext sc = startupContext; if (startupContext==null) { sc = new StartupContext(new Properties()); } DynamicConfigurationService dcs = serviceLocator.getService(DynamicConfigurationService.class); DynamicConfiguration config = dcs.createDynamicConfiguration(); config.bind(BuilderHelper.createConstantDescriptor(sc)); config.commit(); return serviceLocator; }
public static File getInstallRoot(StartupContext sc) { return getInstallRoot(sc.getArguments()); }
private void prepareHabitat() { ModulesRegistry registry = new StaticModulesRegistry(getClass().getClassLoader()); ServiceLocator serviceLocator = registry.createServiceLocator("default"); habitat = serviceLocator.getService(ServiceLocator.class); StartupContext startupContext = new StartupContext(); ServiceLocatorUtilities.addOneConstant(habitat, startupContext); ServiceLocatorUtilities.addOneConstant(habitat, new ProcessEnvironment(ProcessEnvironment.ProcessType.Other)); }
/** * Start the server from the command line * * @param args * the command line arguments */ public void start(String[] args) throws BootException { File bootstrap = this.getBootstrapFile(); File root = bootstrap.getAbsoluteFile().getParentFile(); // root is the directory in which this bootstrap.jar is located // For most cases, this is the lib directory although this is completely // dependent on the usage of this facility. if (root == null) { throw new BootException("Cannot find root installation from " + bootstrap); } // get the ModuleStartup implementation. ModulesRegistry mr = AbstractFactory.getInstance().createModulesRegistry(); StartupContext context = new StartupContext( ArgumentManager.argsToMap(args)); launch(mr, context.getPlatformMainServiceName(), context); }
} else { try { final String mainServiceName = context.getPlatformMainServiceName();
public static String[] getOriginalArguments(StartupContext sc) { Properties args = sc.getArguments(); String s = args.getProperty(Constants.ORIGINAL_ARGS); // See how ASMain packages the arguments if (s == null) return new String[0]; StringTokenizer st = new StringTokenizer(s, Constants.ARG_SEP, false); List<String> result = new ArrayList<String>(); while (st.hasMoreTokens()) { result.add(st.nextToken()); } return result.toArray(new String[result.size()]); }