Search in sources :

Example 1 with CreateEnsembleOptions

use of io.fabric8.api.CreateEnsembleOptions in project fabric8 by jboss-fuse.

the class GitDataStoreImplTestSupport method createGitDataStore.

protected GitDataStoreImpl createGitDataStore() throws Exception {
    RuntimeProperties runtimeProperties = createMockRuntimeProperties();
    CreateEnsembleOptions ensembleOptions = CreateEnsembleOptions.builder().zookeeperPassword("admin").build();
    recursiveDelete(runtimeProperties.getDataPath().toFile());
    BootstrapConfiguration.DataStoreOptions options = new BootstrapConfiguration.DataStoreOptions("root", new File("target/test-container"), zkURL, ensembleOptions);
    runtimeProperties.putRuntimeAttribute(DataStoreTemplate.class, new DataStoreBootstrapTemplate(options));
    FabricGitServiceImpl fabricGitService = new FabricGitServiceImpl();
    fabricGitService.bindRuntimeProperties(runtimeProperties);
    fabricGitService.activate();
    ComponentConfigurer componentConfigurer = new ComponentConfigurer();
    componentConfigurer.activate(null);
    ZkDataStoreImpl zkDataStore = new ZkDataStoreImpl() {

        @Override
        public String getDefaultVersion() {
            return "1.0";
        }
    };
    zkDataStore.bindCurator(curator);
    zkDataStore.bindRuntimeProperties(runtimeProperties);
    zkDataStore.activateComponent();
    final GitDataStoreImpl gitDataStore = new GitDataStoreImpl();
    gitDataStore.bindConfigurer(componentConfigurer);
    gitDataStore.bindGitService(fabricGitService);
    gitDataStore.bindRuntimeProperties(runtimeProperties);
    gitDataStore.bindGitProxyService(new GitProxyRegistrationHandler());
    gitDataStore.bindCurator(curator);
    gitDataStore.bindDataStore(zkDataStore);
    gitDataStore.activate(new HashMap<String, Object>());
    return gitDataStore;
}
Also used : BootstrapConfiguration(io.fabric8.zookeeper.bootstrap.BootstrapConfiguration) ZkDataStoreImpl(io.fabric8.service.ZkDataStoreImpl) ComponentConfigurer(io.fabric8.service.ComponentConfigurer) DataStoreBootstrapTemplate(io.fabric8.zookeeper.bootstrap.DataStoreBootstrapTemplate) AbstractRuntimeProperties(io.fabric8.api.scr.AbstractRuntimeProperties)

Example 2 with CreateEnsembleOptions

use of io.fabric8.api.CreateEnsembleOptions in project fabric8 by jboss-fuse.

the class ZooKeeperClusterBootstrapImpl method startBundles.

private void startBundles(CreateEnsembleOptions options) throws BundleException {
    BundleUtils bundleUtils = new BundleUtils(bundleContext);
    Bundle agentBundle = bundleUtils.findBundle("io.fabric8.fabric-agent");
    if (agentBundle != null && options.isAgentEnabled()) {
        agentBundle.start();
    }
// Bundle webBundle = bundleUtils.findBundle("org.ops4j.pax.web.pax-web-jetty");
// if (webBundle != null) {
// webBundle.start();
// }
}
Also used : Bundle(org.osgi.framework.Bundle) BundleUtils(io.fabric8.utils.BundleUtils)

Example 3 with CreateEnsembleOptions

use of io.fabric8.api.CreateEnsembleOptions in project fabric8 by jboss-fuse.

the class ClusterBootstrapManager method createCluster.

@Override
public void createCluster(Map<String, Object> options) {
    assertValid();
    RuntimeProperties sysprops = runtimeProperties.get();
    CreateEnsembleOptions createEnsembleOptions = ClusterBootstrapManager.getCreateEnsembleOptions(sysprops, options);
    bootstrap.get().create(createEnsembleOptions);
}
Also used : CreateEnsembleOptions(io.fabric8.api.CreateEnsembleOptions) RuntimeProperties(io.fabric8.api.RuntimeProperties)

Example 4 with CreateEnsembleOptions

use of io.fabric8.api.CreateEnsembleOptions in project fabric8 by jboss-fuse.

the class ClusterServiceManager method removeFromCluster.

@Override
public void removeFromCluster(List<String> containers, Map<String, Object> options) {
    assertValid();
    RuntimeProperties sysprops = runtimeProperties.get();
    CreateEnsembleOptions createEnsembleOptions = ClusterBootstrapManager.getCreateEnsembleOptions(sysprops, options);
    removeFromCluster(containers, createEnsembleOptions);
}
Also used : CreateEnsembleOptions(io.fabric8.api.CreateEnsembleOptions) RuntimeProperties(io.fabric8.api.RuntimeProperties)

Example 5 with CreateEnsembleOptions

use of io.fabric8.api.CreateEnsembleOptions in project fabric8 by jboss-fuse.

the class ZooKeeperClusterBootstrapImpl method activate.

@Activate
void activate(BundleContext bundleContext, Map<String, ?> configuration) throws Exception {
    this.bundleContext = bundleContext;
    this.configurer.configure(configuration, this);
    BootstrapConfiguration bootConfig = bootstrapConfiguration.get();
    CreateEnsembleOptions options = bootConfig.getBootstrapOptions();
    if (options.isEnsembleStart()) {
        startBundles(options);
    }
    activateComponent();
}
Also used : BootstrapConfiguration(io.fabric8.zookeeper.bootstrap.BootstrapConfiguration) CreateEnsembleOptions(io.fabric8.api.CreateEnsembleOptions) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

CreateEnsembleOptions (io.fabric8.api.CreateEnsembleOptions)6 RuntimeProperties (io.fabric8.api.RuntimeProperties)5 BootstrapConfiguration (io.fabric8.zookeeper.bootstrap.BootstrapConfiguration)4 FabricException (io.fabric8.api.FabricException)2 IOException (java.io.IOException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Container (io.fabric8.api.Container)1 FabricService (io.fabric8.api.FabricService)1 ZooKeeperClusterBootstrap (io.fabric8.api.ZooKeeperClusterBootstrap)1 AbstractRuntimeProperties (io.fabric8.api.scr.AbstractRuntimeProperties)1 ResolverPolicyEnum (io.fabric8.boot.commands.support.ResolverPolicyEnum)1 ComponentConfigurer (io.fabric8.service.ComponentConfigurer)1 ZkDataStoreImpl (io.fabric8.service.ZkDataStoreImpl)1 BundleUtils (io.fabric8.utils.BundleUtils)1 DataStoreBootstrapTemplate (io.fabric8.zookeeper.bootstrap.DataStoreBootstrapTemplate)1 Path (java.nio.file.Path)1 List (java.util.List)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 TimeoutException (java.util.concurrent.TimeoutException)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1