當前位置: 首頁>>代碼示例>>Java>>正文


Java Container.getIdentity方法代碼示例

本文整理匯總了Java中io.fabric8.api.Container.getIdentity方法的典型用法代碼示例。如果您正苦於以下問題:Java Container.getIdentity方法的具體用法?Java Container.getIdentity怎麽用?Java Container.getIdentity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.fabric8.api.Container的用法示例。


在下文中一共展示了Container.getIdentity方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: destroyContainerInternal

import io.fabric8.api.Container; //導入方法依賴的package包/類
private Container destroyContainerInternal(Container container) {

        ContainerIdentity identity = container.getIdentity();
        Set<ContainerIdentity> childIdentities = container.getChildIdentities();
        IllegalStateAssertion.assertTrue(childIdentities.isEmpty(), "Cannot destroy a container that has active child containers: " + container);

        // Stop the container
        if (container.getState() == State.STARTED) {
            container = stopContainer(identity);
        }

        LOGGER.info("Destroy container: {}", container);

        ContainerRegistry registry = containerRegistry.get();
        ContainerIdentity parentId = container.getParentIdentity();
        if (parentId != null) {
            LockHandle parentLock = aquireWriteLock(parentId);
            try {
                registry.removeChildFromParent(parentId, identity);
            } finally {
                parentLock.unlock();
            }
        }
        return registry.destroyContainer(container.getIdentity());
    }
 
開發者ID:tdiesler,項目名稱:fabric8poc,代碼行數:26,代碼來源:ContainerServiceImpl.java

示例2: storeInternal

import io.fabric8.api.Container; //導入方法依賴的package包/類
private void storeInternal(Container container) {
    LOGGER.debug("Storing container {}.", container.getIdentity());
    ContainerIdentity identity = container.getIdentity();
    String id = identity.getSymbolicName();
    Container existing = getContainer(identity);
    try {
        if (existing == null) {
            curator.get().create().creatingParentsIfNeeded().forPath(ZkPath.CONTAINER.getPath(id));
        }
        setParentInternal(identity, container.getParentIdentity());
        setChildIdentitiesInternal(identity, container.getChildIdentities());
        setRuntimeTypeInternal(identity, container.getRuntimeType());
        setProfilesInternal(identity, container.getProfileIdentities());
        setVersionInternal(identity, container.getProfileVersion());
        setAttributesInternal(ZkPath.CONTAINER_ATTRIBUTES.getPath(id), container.getAttributes());
        setStateInternal(identity, container.getState());
        setServiceEndpointsInternal(identity, container.getServiceEndpoints());
    } catch (Exception e) {
        throw FabricException.launderThrowable(e);
    }
}
 
開發者ID:tdiesler,項目名稱:fabric8poc,代碼行數:22,代碼來源:ContainerRegistry.java

示例3: testManagedKaraf

import io.fabric8.api.Container; //導入方法依賴的package包/類
@Test
@Ignore
public void testManagedKaraf() throws Exception {

    // Build the {@link CreateOptions}
    Runtime runtime = RuntimeLocator.getRequiredRuntime();
    File dataDir = new File((String) runtime.getProperty(RuntimeService.RUNTIME_DATA_DIR));

    CreateOptions options = KarafContainerBuilder.create()
            .identity("ManagedKaraf")
            .outputToConsole(true)
            .targetPath(dataDir.toPath())
            .getCreateOptions();

    ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
    Container cnt = cntManager.createContainer(options);
    ContainerIdentity cntId = cnt.getIdentity();
    try {
        // Start the container
        cnt = cntManager.startContainer(cntId, null);
        verifyContainer(cnt);
    } finally {
        cnt = cntManager.stopContainer(cntId);
        Assert.assertEquals(State.STOPPED, cnt.getState());
    }
}
 
開發者ID:tdiesler,項目名稱:fabric8poc,代碼行數:27,代碼來源:ManagedContainerTestBase.java

示例4: createAndStart

import io.fabric8.api.Container; //導入方法依賴的package包/類
private ContainerIdentity createAndStart(ContainerManager cntManager, int index) throws InterruptedException, ProvisionException {
    CreateOptions options = EmbeddedContainerBuilder.create(prefix + "#" + index).getCreateOptions();
    Container cnt = cntManager.createContainer(options);
    ContainerIdentity cntId = cnt.getIdentity();
    //System.out.println(cnt);
    Assert.assertSame(State.CREATED, cnt.getState());
    Thread.sleep(10);
    cnt = cntManager.startContainer(cntId, null);
    //System.out.println(cnt);
    Assert.assertSame(State.STARTED, cnt.getState());
    return cntId;
}
 
開發者ID:tdiesler,項目名稱:fabric8poc,代碼行數:13,代碼來源:ConcurrentConfigurationTest.java

示例5: testContainerLifecycle

import io.fabric8.api.Container; //導入方法依賴的package包/類
@Test
 public void testContainerLifecycle() throws Exception {

     CreateOptions options = EmbeddedContainerBuilder.create("cntA").getCreateOptions();

     ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
     Container cntA = cntManager.createContainer(options);
     ContainerIdentity cntIdA = cntA.getIdentity();

     Assert.assertEquals("cntA", cntIdA.getCanonicalForm());
     Assert.assertSame(State.CREATED, cntA.getState());
     Assert.assertEquals(ProfileVersion.DEFAULT_PROFILE_VERSION, cntA.getProfileVersion());

     cntA = cntManager.startContainer(cntIdA, null);
     Assert.assertSame(State.STARTED, cntA.getState());
     Assert.assertEquals(DEFAULT_PROFILE_VERSION, cntA.getProfileVersion());

     cntA = cntManager.stopContainer(cntIdA);
     Assert.assertSame(State.STOPPED, cntA.getState());

     cntA = cntManager.destroyContainer(cntIdA);
     Assert.assertSame(State.DESTROYED, cntA.getState());

     try {
         cntManager.startContainer(cntIdA, null);
         Assert.fail("IllegalStateException expected");
     } catch (IllegalStateException e) {
         // expected
     }
}
 
開發者ID:tdiesler,項目名稱:fabric8poc,代碼行數:31,代碼來源:BasicContainerLifecycleTest.java

示例6: testComposisteData

import io.fabric8.api.Container; //導入方法依賴的package包/類
@Test
public void testComposisteData() throws Exception {

    CreateOptions options = EmbeddedContainerBuilder.create("cntA")
        .addAttribute(AKEY, "AVal")
        .addAttribute(BKEY, "BVal")
        .getCreateOptions();

    ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
    Container cntA = cntManager.createContainer(options);
    ContainerIdentity idA = cntA.getIdentity();

    MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
    ContainerManagement cntManagement = ManagementUtils.getMBeanProxy(mbeanServer, ContainerManagement.OBJECT_NAME, ContainerManagement.class);
    CompositeData cdata = cntManagement.getContainer(idA.getCanonicalForm());
    Container cntB = ContainerOpenType.getContainer(cdata);
    Assert.assertEquals(idA, cntB.getIdentity());
    Assert.assertEquals(cntA.getAttributes(), cntB.getAttributes());

    cntManager.destroyContainer(idA);

    // Test the {@link CompositeDataOptionsProvider}
    EmbeddedContainerBuilder cntBuilder = EmbeddedContainerBuilder.create();
    cntBuilder.addOptions(new CompositeDataOptionsProvider(cdata));
    options = cntBuilder.getCreateOptions();

    Container cntC = cntManager.createContainer(options);
    ContainerIdentity idC = cntC.getIdentity();
    Assert.assertEquals("cntA", idC.getCanonicalForm());
    Assert.assertEquals(cntA.getAttributes(), cntC.getAttributes());

    cntManager.destroyContainer(idC);
}
 
開發者ID:tdiesler,項目名稱:fabric8poc,代碼行數:34,代碼來源:ContainerOpenTypeTest.java

示例7: testManagedTomcat

import io.fabric8.api.Container; //導入方法依賴的package包/類
@Test
@Ignore
public void testManagedTomcat() throws Exception {

    // Build the {@link CreateOptions}
    Runtime runtime = RuntimeLocator.getRequiredRuntime();
    File dataDir = new File((String) runtime.getProperty(RuntimeService.RUNTIME_DATA_DIR));

    CreateOptions options = TomcatContainerBuilder.create()
            .identity("ManagedTomcat")
            .outputToConsole(true)
            //.jvmArguments("-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n")
            .targetPath(dataDir.toPath())
            .getCreateOptions();

    ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
    Container cnt = cntManager.createContainer(options);
    ContainerIdentity cntId = cnt.getIdentity();
    try {
        // Start the container
        cnt = cntManager.startContainer(cntId, null);
        verifyContainer(cnt);
    } finally {
        cnt = cntManager.stopContainer(cntId);
        Assert.assertEquals(State.STOPPED, cnt.getState());
    }
}
 
開發者ID:tdiesler,項目名稱:fabric8poc,代碼行數:28,代碼來源:ManagedContainerTestBase.java

示例8: testManagedWildFly

import io.fabric8.api.Container; //導入方法依賴的package包/類
@Test
@Ignore
public void testManagedWildFly() throws Exception {

    // Build the {@link CreateOptions}
    Runtime runtime = RuntimeLocator.getRequiredRuntime();
    File dataDir = new File((String) runtime.getProperty(RuntimeService.RUNTIME_DATA_DIR));

    // [TODO] #49 Default port of the running WildFly server is available, why?
    CreateOptions options = WildFlyContainerBuilder.create()
            .identity("ManagedWildFly")
            .outputToConsole(true)
            .targetPath(dataDir.toPath())
            .managementNativePort(WildFlyCreateOptions.DEFAULT_MANAGEMENT_NATIVE_PORT + 1)
            .managementHttpPort(WildFlyCreateOptions.DEFAULT_MANAGEMENT_HTTP_PORT + 1)
            .getCreateOptions();

    ContainerManager cntManager = ContainerManagerLocator.getContainerManager();
    Container cnt = cntManager.createContainer(options);
    ContainerIdentity cntId = cnt.getIdentity();
    try {
        // Start the container
        cnt = cntManager.startContainer(cntId, null);
        verifyContainer(cnt);
    } finally {
        cnt = cntManager.stopContainer(cntId);
        Assert.assertEquals(State.STOPPED, cnt.getState());
    }
}
 
開發者ID:tdiesler,項目名稱:fabric8poc,代碼行數:30,代碼來源:ManagedContainerTestBase.java


注:本文中的io.fabric8.api.Container.getIdentity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。