public static String getContainerLogin(RuntimeProperties sysprops) { String container = sysprops.getRuntimeIdentity(); return "container#" + container; }
@Override protected Object doExecute() throws Exception { String name = runtimeProperties.getRuntimeIdentity(); String appName = runtimeProperties.getProperty("karaf.app.name", "JBoss Fuse");
public FileSystem(RuntimeProperties sysprops) { fs = sysprops.getDataPath().toFile();; String path; try { path = fs.getCanonicalPath(); } catch (IOException e) { path = fs.getAbsolutePath(); } this.path = path; }
private OverlayAudit getOverlayAudit() { synchronized (runtimeProperties) { RuntimeProperties sysprops = runtimeProperties.get(); OverlayAudit audit = sysprops.getRuntimeAttribute(OverlayAudit.class); if (audit == null) { sysprops.putRuntimeAttribute(OverlayAudit.class, audit = new OverlayAudit()); } return audit; } }
@Override public B fromRuntimeProperties(RuntimeProperties sysprops) { super.fromRuntimeProperties(sysprops); this.ensembleStart = Boolean.parseBoolean(sysprops.getProperty(ENSEMBLE_AUTOSTART, "false")); this.agentEnabled = Boolean.parseBoolean(sysprops.getProperty(AGENT_AUTOSTART, "false")); this.zookeeperPassword = sysprops.getProperty(ZOOKEEPER_PASSWORD, generatePassword()); this.zooKeeperServerPort = Integer.parseInt(sysprops.getProperty(ZOOKEEPER_SERVER_PORT, "2181")); this.zooKeeperServerConnectionPort = Integer.parseInt(sysprops.getProperty(ZOOKEEPER_SERVER_CONNECTION_PORT, "2181")); this.importPath = sysprops.getProperty(PROFILES_AUTOIMPORT_PATH, DEFAULT_IMPORT_PATH); this.autoImportEnabled = Boolean.parseBoolean(sysprops.getProperty(PROFILES_AUTOIMPORT, "true")); return (B) this; }
String runtimeIdentity = runtimeProperties.getRuntimeIdentity(); CreateEnsembleOptions.Builder<?> builder = CreateEnsembleOptions.builder() .zooKeeperServerTickTime(zooKeeperTickTime) newUserPassword = newUserPassword != null ? newUserPassword : ShellUtils.retrieveFabricUserPassword(session); Path propsPath = runtimeProperties.getConfPath().resolve("users.properties"); Properties userProps = new Properties(propsPath.toFile()); zookeeperPassword = PasswordEncoder.decode(runtimeProperties.getProperty(CreateEnsembleOptions.ZOOKEEPER_PASSWORD, PasswordEncoder.encode(newUserPassword))); builder.zookeeperPassword(zookeeperPassword); } else {
@Override protected Object doExecute() throws Exception { String oldName = runtimeProperties.getRuntimeIdentity(); bootProperties.put("zookeeper.url", zookeeperUrl); Path propsPath = runtimeProperties.getConfPath().resolve("system.properties"); Properties systemProps = new Properties(propsPath.toFile()); systemProps.put(SystemProperties.KARAF_NAME, containerName);
String karafName = runtimeProperties.get().getRuntimeIdentity(); if (zooKeeperUrl == null) { if (containers.size() != 1 || !containers.get(0).equals(karafName)) { runtimeProperties.get().putRuntimeAttribute(DataStoreTemplate.class, new DataStoreTemplate() { @Override public void doWith(ProfileRegistry profileRegistry, DataStore dataStore) {
void bootstrapFabric(String containerId, File homeDir, CreateEnsembleOptions options) throws Exception { String connectionUrl = bootConfig.getConnectionUrl(options); DataStoreOptions bootOptions = new DataStoreOptions(containerId, homeDir, connectionUrl, options); runtimeProperties.putRuntimeAttribute(DataStoreTemplate.class, new DataStoreBootstrapTemplate(bootOptions)); bootConfig.createOrUpdateDataStoreConfig(options); boolean success = bootConfig.createZooKeeeperServerConfig(sysContext, options); if (!success) { throw new TimeoutException("Timeout waiting for " + Constants.ZOOKEEPER_SERVER_PID + " configuration update"); } success = bootConfig.createZooKeeeperClientConfig(sysContext, connectionUrl, options); if (!success) { throw new TimeoutException("Timeout waiting for " + Constants.ZOOKEEPER_CLIENT_PID + " configuration update"); } }
userProps = new org.apache.felix.utils.properties.Properties(sysprops.getConfPath().resolve("users.properties").toFile()); } catch (IOException e) { userProps = new org.apache.felix.utils.properties.Properties();
@Override public B fromRuntimeProperties(RuntimeProperties sysprops) { super.fromRuntimeProperties(sysprops); this.ensembleStart = Boolean.parseBoolean(sysprops.getProperty(ENSEMBLE_AUTOSTART, "false")); this.agentEnabled = Boolean.parseBoolean(sysprops.getProperty(AGENT_AUTOSTART, "false")); this.zookeeperPassword = sysprops.getProperty(ZOOKEEPER_PASSWORD, generatePassword()); this.zooKeeperServerPort = Integer.parseInt(sysprops.getProperty(ZOOKEEPER_SERVER_PORT, "2181")); this.zooKeeperServerConnectionPort = Integer.parseInt(sysprops.getProperty(ZOOKEEPER_SERVER_CONNECTION_PORT, "2181")); this.importPath = sysprops.getProperty(PROFILES_AUTOIMPORT_PATH, DEFAULT_IMPORT_PATH); this.autoImportEnabled = Boolean.parseBoolean(sysprops.getProperty(PROFILES_AUTOIMPORT, "true")); return (B) this; }
Path propsPath = runtimeProperties.getConfPath().resolve("users.properties"); Properties userProps = new Properties(propsPath.toFile()); String runtimeIdentity = runtimeProperties.getRuntimeIdentity(); CreateEnsembleOptions.Builder<?> builder = CreateEnsembleOptions.builder() .zooKeeperServerTickTime(zooKeeperTickTime) zookeeperPassword = PasswordEncoder.decode(runtimeProperties.getProperty(CreateEnsembleOptions.ZOOKEEPER_PASSWORD, PasswordEncoder.encode(newUserPassword))); builder.zookeeperPassword(zookeeperPassword); } else {
profile = "unmanaged"; String oldName = runtimeProperties.getRuntimeIdentity(); bootProperties.put("zookeeper.url", zookeeperUrl); Path propsPath = runtimeProperties.getConfPath().resolve("system.properties"); Properties systemProps = new Properties(propsPath.toFile()); systemProps.put(SystemProperties.KARAF_NAME, containerName);
void bootIfNeeded() throws IOException, InterruptedException { BundleContext bundleContext = componentContext.getBundleContext(); boolean isCreated = checkCreated(bundleContext); if (!Strings.isNotBlank(zookeeperUrl) && !isCreated && options.isEnsembleStart()) { String connectionUrl = getConnectionUrl(options); DataStoreOptions bootOptions = new DataStoreOptions(runtimeId, homeDir, connectionUrl, options); runtimeProperties.get().putRuntimeAttribute(DataStoreTemplate.class, new DataStoreBootstrapTemplate(bootOptions)); createOrUpdateDataStoreConfig(options); createZooKeeeperServerConfig(componentContext.getBundleContext(), options); createZooKeeeperClientConfig(componentContext.getBundleContext(), connectionUrl, options); // On restart, the configuration should be available in configadmin markCreated(bundleContext); } }
public static String getContainerLogin(RuntimeProperties sysprops) { String container = sysprops.getRuntimeIdentity(); return "container#" + container; }
@Override protected Object doExecute() throws Exception { String name = runtimeProperties.getRuntimeIdentity(); String appName = runtimeProperties.getProperty("karaf.app.name");
public B fromRuntimeProperties(RuntimeProperties sysprops) { this.bindAddress = sysprops.getProperty(BIND_ADDRESS, "0.0.0.0"); this.minimumPort = Integer.parseInt(sysprops.getProperty("minimum.port", String.valueOf(minimumPort))); this.maximumPort = Integer.parseInt(sysprops.getProperty("maximum.port", String.valueOf(maximumPort))); this.profiles(sysprops.getProperty(PROFILES, "")); this.version(sysprops.getProperty(VERSION, DEFAULT_VERSION)); return (B) this; }
@Activate @VisibleForTesting public void activate() throws IOException { RuntimeProperties sysprops = runtimeProperties.get(); localRepo = sysprops.getDataPath().resolve(DEFAULT_GIT_PATH).toFile(); if (!localRepo.exists() && !localRepo.mkdirs()) { throw new IOException("Failed to create local repository at:" + localRepo.getAbsolutePath()); } git = openOrInit(localRepo); activateComponent(); }
void bootIfNeeded() throws IOException { BundleContext bundleContext = componentContext.getBundleContext(); boolean isCreated = checkCreated(bundleContext); if (!Strings.isNotBlank(zookeeperUrl) && !isCreated && options.isEnsembleStart()) { String connectionUrl = getConnectionUrl(options); DataStoreOptions bootOptions = new DataStoreOptions(runtimeId, homeDir, connectionUrl, options); runtimeProperties.get().putRuntimeAttribute(DataStoreTemplate.class, new DataStoreBootstrapTemplate(bootOptions)); createOrUpdateDataStoreConfig(options); createZooKeeeperServerConfig(options); createZooKeeeperClientConfig(connectionUrl, options); // On restart, the configuration should be available in configadmin markCreated(bundleContext); } }
@Override public int complete(String s, int i, List<String> strings) { delegate.getStrings().clear(); delegate.getStrings().add(runtimeProperties.getRuntimeIdentity()); return delegate.complete(s,i,strings); }