/** * Initialize configurator, check requirements and load current configuration * * @return returns true if current install is configurable, else returns false */ public boolean init() { return init(false); }
/** * Runs the configuration files generation. */ public void run() throws ConfigurationException { if (init()) { if (!serverConfigurator.isConfigured()) { log.info("No current configuration, generating files..."); generateFiles(); } else if (forceGeneration) { log.info("Configuration files generation (nuxeo.force.generation=" + userConfig.getProperty(PARAM_FORCE_GENERATION) + ")..."); generateFiles(); } else { log.info( "Server already configured (set nuxeo.force.generation=true to force configuration files generation)."); } } }
/** * @since 5.6 * @return Configured server URL (may differ from current URL) */ public String getServerURL() { if (cg == null) { cg = new ConfigurationGenerator(); cg.init(); } return cg.getUserConfig().getProperty(ConfigurationGenerator.PARAM_NUXEO_URL); }
@Factory(value = "setupConfigGenerator", scope = ScopeType.PAGE) public ConfigurationGenerator getConfigurationGenerator() { if (setupConfigGenerator == null) { setupConfigGenerator = new ConfigurationGenerator(); if (setupConfigGenerator.init()) { setParameters(); } } return setupConfigGenerator; }
/** * @since 5.6 * @return Configured server URL (may differ from current URL) */ public String getServerURL() { if (cg == null) { cg = new ConfigurationGenerator(); cg.init(); } return cg.getUserConfig().getProperty(ConfigurationGenerator.PARAM_NUXEO_URL); }
@Factory(value = "setupConfigGenerator", scope = ScopeType.PAGE) public ConfigurationGenerator getConfigurationGenerator() { if (setupConfigGenerator == null) { setupConfigGenerator = new ConfigurationGenerator(); if (setupConfigGenerator.init()) { setParameters(); } } return setupConfigGenerator; }
@Override public void write(OutputStream output) throws IOException { try { ConfigurationGenerator configurationGenerator = new ConfigurationGenerator(); configurationGenerator.init(); ConnectBroker connectBroker = new ConnectBroker(configurationGenerator.getEnv()); InstanceInfo info = configurationGenerator.getServerConfigurator().getInfo(getCLID(connectBroker), connectBroker.getPkgList()); JAXBContext context = JAXBContext.newInstance(InstanceInfo.class, DistributionInfo.class, PackageInfo.class, ConfigurationInfo.class, KeyValueInfo.class); Marshaller marshaller = context.createMarshaller(); marshaller.marshal(info, jsonWriter(context, output)); } catch (PackageException | JAXBException cause) { throw new IOException("Cannot write runtime configuration", cause); } }
public PlatformHelper() { cg = new ConfigurationGenerator(); cg.init(); name = cg.getUserConfig().getProperty(Environment.DISTRIBUTION_NAME); version = cg.getUserConfig().getProperty(Environment.DISTRIBUTION_VERSION); }
@Override protected Command doRun(Task task, Map<String, String> prefs) throws PackageException { Config rollback = new Config(); ConfigurationGenerator cg = new ConfigurationGenerator(); cg.init(); try { if (addtemplate != null) { cg.addTemplate(addtemplate); rollback.rmtemplate = addtemplate; } if (rmtemplate != null) { cg.rmTemplate(rmtemplate); rollback.addtemplate = rmtemplate; } if (set != null) { String[] newValue = set.split("=", 2); String previousValue = cg.setProperty(newValue[0], (newValue[1].length() > 0 ? newValue[1] : null)); if (previousValue == null) { previousValue = ""; } rollback.set = newValue[0] + "=" + previousValue; } } catch (ConfigurationException e) { throw new PackageException(e); } return rollback; }