Package io.fabric8.api

Examples of io.fabric8.api.RuntimeProperties


        String password;
        if (isExternalGitConfigured(properties)) {
            username = getExternalUser(properties);
            password = getExternalCredential(properties);
        } else {
            RuntimeProperties sysprops = runtimeProperties.get();
            username = ZooKeeperUtils.getContainerLogin(sysprops);
            password = ZooKeeperUtils.generateContainerToken(sysprops, curator.get());
        }
        return new UsernamePasswordCredentialsProvider(username, password);
    }
View Full Code Here


        return DataStoreUtils.toMap(fileconfigs.get(ensembleConfigName));
     }

    public void createCluster(List<String> containers) {
        assertValid();
        RuntimeProperties sysprops = runtimeProperties.get();
        createCluster(containers, CreateEnsembleOptions.builder().fromRuntimeProperties(sysprops).build());
    }
View Full Code Here

    }

    @Override
    public void createCluster() {
        assertValid();
        RuntimeProperties sysprops = runtimeProperties.get();
        bootstrap.get().create(CreateEnsembleOptions.builder().fromRuntimeProperties(sysprops).build());
    }
View Full Code Here

    }

    @Override
    public void createCluster(Map<String, Object> options) {
        assertValid();
        RuntimeProperties sysprops = runtimeProperties.get();
        CreateEnsembleOptions createEnsembleOptions = ClusterBootstrapManager.getCreateEnsembleOptions(sysprops, options);
        bootstrap.get().create(createEnsembleOptions);
    }
View Full Code Here

    private volatile Git git;

    @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);
View Full Code Here

        activateComponent(PERMIT, this);
    }

    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;
        }
    }
View Full Code Here

            LOGGER.info("Create fabric with: {}", options);

            stopBundles();

            RuntimeProperties runtimeProps = runtimeProperties.get();
            BootstrapConfiguration bootConfig = bootstrapConfiguration.get();
            BundleContext syscontext = bundleContext.getBundle(0).getBundleContext();
            if (options.isClean()) {
                bootConfig = cleanInternal(syscontext, bootConfig, runtimeProps);
            }
View Full Code Here

    void deactivate() {
        deactivateComponent();
    }

    private void activateInternal() {
        RuntimeProperties sysprops = runtimeProperties.get();
        runtimeIdentity = sysprops.getRuntimeIdentity();
        String version = sysprops.getProperty("fabric.version", ZkDefs.DEFAULT_VERSION);
        String profiles = sysprops.getProperty("fabric.profiles");
        try {
            if (profiles != null) {
                String versionNode = CONFIG_CONTAINER.getPath(runtimeIdentity);
                String profileNode = CONFIG_VERSIONS_CONTAINER.getPath(version, runtimeIdentity);
                createDefault(curator.get(), versionNode, version);
                createDefault(curator.get(), profileNode, profiles);
            }

            checkAlive();

            String domainsNode = CONTAINER_DOMAINS.getPath(runtimeIdentity);
            Stat stat = exists(curator.get(), domainsNode);
            if (stat != null) {
                deleteSafe(curator.get(), domainsNode);
            }

            boolean openshiftEnv = Strings.notEmpty(System.getenv("OPENSHIFT_FUSE_DIR"));

            ZooKeeperUtils.createDefault(curator.get(), CONTAINER_BINDADDRESS.getPath(runtimeIdentity), bootstrapConfiguration.get().getBindAddress());
            ZooKeeperUtils.createDefault(curator.get(), CONTAINER_RESOLVER.getPath(runtimeIdentity), getContainerResolutionPolicy(curator.get(), runtimeIdentity));
            setData(curator.get(), CONTAINER_LOCAL_HOSTNAME.getPath(runtimeIdentity), HostUtils.getLocalHostName());
            if (openshiftEnv) {
                setData(curator.get(), CONTAINER_LOCAL_IP.getPath(runtimeIdentity), System.getenv("OPENSHIFT_FUSE_IP"));
                setData(curator.get(), CONTAINER_PUBLIC_IP.getPath(runtimeIdentity), HostUtils.getLocalIp());
            } else {
                setData(curator.get(), CONTAINER_LOCAL_IP.getPath(runtimeIdentity), HostUtils.getLocalIp());
            }
            //Check if there are addresses specified as system properties and use them if there is not an existing value in the registry.
            //Mostly usable for adding values when creating containers without an existing ensemble.
            for (String resolver : ZkDefs.VALID_RESOLVERS) {
                String address = (String) bootstrapConfiguration.get().getConfiguration().get(resolver);
                if (address != null && !address.isEmpty() && exists(curator.get(), CONTAINER_ADDRESS.getPath(runtimeIdentity, resolver)) == null) {
                    setData(curator.get(), CONTAINER_ADDRESS.getPath(runtimeIdentity, resolver), address);
                }
            }

            ip =  getSubstitutedData(curator.get(), getContainerPointer(curator.get(), runtimeIdentity));
            setData(curator.get(), CONTAINER_IP.getPath(runtimeIdentity), ip);
            createDefault(curator.get(), CONTAINER_GEOLOCATION.getPath(runtimeIdentity), geoLocationService.get().getGeoLocation());

            //We are creating a dummy container object, since this might be called before the actual container is ready.
            Container current = new ImmutableContainerBuilder().id(runtimeIdentity).ip(ip).build();

            System.setProperty(SystemProperties.JAVA_RMI_SERVER_HOSTNAME, current.getIp());
            registerJmx(current);
            registerSsh(current);
            registerHttp(current);

            //Set the port range values
            String minimumPort = sysprops.getProperty(ZkDefs.MINIMUM_PORT);
            String maximumPort = sysprops.getProperty(ZkDefs.MAXIMUM_PORT);
            createDefault(curator.get(), CONTAINER_PORT_MIN.getPath(runtimeIdentity), minimumPort);
            createDefault(curator.get(), CONTAINER_PORT_MAX.getPath(runtimeIdentity), maximumPort);
        } catch (Exception e) {
            LOGGER.warn("Error updating Fabric Container information. This exception will be ignored.", e);
        }
View Full Code Here

            }
        }
    }

    private void checkAlive() throws Exception {
        RuntimeProperties sysprops = runtimeProperties.get();
        String runtimeIdentity = sysprops.getRuntimeIdentity();
        String nodeAlive = CONTAINER_ALIVE.getPath(runtimeIdentity);
        Stat stat = exists(curator.get(), nodeAlive);
        if (stat != null) {
            if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
                delete(curator.get(), nodeAlive);
View Full Code Here

    public void configurationEvent(ConfigurationEvent event) {
        if (isValid()) {
            try {
                Container current = new ImmutableContainerBuilder().id(runtimeIdentity).ip(ip).build();

                RuntimeProperties sysprops = runtimeProperties.get();
                String runtimeIdentity = sysprops.getRuntimeIdentity();
                if (event.getPid().equals(SSH_PID) && event.getType() == ConfigurationEvent.CM_UPDATED) {
                    Configuration config = configAdmin.get().getConfiguration(SSH_PID, null);
                    int sshPort = Integer.parseInt((String) config.getProperties().get(SSH_BINDING_PORT_KEY));
                    int sshConnectionPort = getSshConnectionPort(current, sshPort);
                    String sshUrl = getSshUrl(runtimeIdentity, sshConnectionPort);
View Full Code Here

TOP

Related Classes of io.fabric8.api.RuntimeProperties

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.