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


Java Administration類代碼示例

本文整理匯總了Java中org.wildfly.extras.creaper.core.online.operations.admin.Administration的典型用法代碼示例。如果您正苦於以下問題:Java Administration類的具體用法?Java Administration怎麽用?Java Administration使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Administration類屬於org.wildfly.extras.creaper.core.online.operations.admin包,在下文中一共展示了Administration類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public final void apply(OnlineCommandContext ctx) throws Exception {
    Address truststoreAuthAddress = securityRealmAddress.and("authentication", "truststore");

    Operations ops = new Operations(ctx.client);

    if (replaceExisting) {
        boolean truststoreAuthExist = ops.exists(truststoreAuthAddress);
        if (truststoreAuthExist) {
            ops.remove(truststoreAuthAddress);
        }
        new Administration(ctx.client).reloadIfRequired();
    }

    ops.add(truststoreAuthAddress, Values.empty()
            .and("keystore-password", truststorePassword)
            .andOptional("keystore-path", truststorePath)
            .andOptional("keystore-provider", truststoreProvider)
            .andOptional("keystore-relative-to", truststoreRelativeTo));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:21,代碼來源:AddTruststoreAuthentication.java

示例2: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
    if (assignGroups != null) {
        if (ctx.version.lessThan(ServerVersion.VERSION_1_7_0)
                || ctx.version.inRange(ServerVersion.VERSION_2_0_0, ServerVersion.VERSION_2_2_0)) {
            throw new AssertionError("Option assign-groups is available since WildFly 9 or in EAP 6.4.x.");
        }
    }

    Operations ops = new Operations(ctx.client);
    Address securityRealmJaasAuthnAddress = securityRealmAddress.and("authentication", "jaas");
    if (replaceExisting) {
        ops.removeIfExists(securityRealmJaasAuthnAddress);
        new Administration(ctx.client).reloadIfRequired();
    }
    ops.add(securityRealmJaasAuthnAddress, Values.empty()
            .andOptional("name", name)
            .andOptional("assign-groups", assignGroups));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:20,代碼來源:AddJaasAuthentication.java

示例3: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
    Address secretServerIdentitiesAddress = securityRealmAddress.and("server-identity", "secret");

    Operations ops = new Operations(ctx.client);

    if (replaceExisting) {
        boolean secretServerIdentityExists = ops.exists(secretServerIdentitiesAddress);
        if (secretServerIdentityExists) {
            ops.remove(secretServerIdentitiesAddress);
        }
        new Administration(ctx.client).reloadIfRequired();
    }

    ops.add(secretServerIdentitiesAddress, Values.empty()
            .and("value", password));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:18,代碼來源:AddSecretAuthentication.java

示例4: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws CliException, CommandFailedException, IOException,
        TimeoutException, InterruptedException {
    Operations ops = new Operations(ctx.client);
    Address securityDomainAddress = Address.subsystem("security").and("security-domain", securityDomainName);
    if (replaceExisting) {
        try {
            ops.removeIfExists(securityDomainAddress);
            new Administration(ctx.client).reloadIfRequired();
        } catch (OperationException e) {
            throw new IOException("Failed to remove existing security domain " + securityDomainName, e);
        }
    }
    ops.add(securityDomainAddress, Values.empty()
            .andOptional("cache-type", cacheType));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:17,代碼來源:AddSecurityDomain.java

示例5: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
    Operations ops = new Operations(ctx.client);
    Address interfaceAddress = Address.coreService("management").and("management-interface", "http-interface");
    if (this.replaceExisting) {
        try {
            ops.removeIfExists(interfaceAddress);
            new Administration(ctx.client).reloadIfRequired();
        } catch (OperationException e) {
            throw new IOException("Failed to remove existing http-interface.", e);
        }
    }
    ops.add(interfaceAddress, Values.of("security-realm", this.securityRealm)
            .andOptional("socket-binding", this.socketBinding)
            .andOptional("secure-socket-binding", this.secureSocketBinding)
            .andOptional("http-upgrade-enabled", this.httpUpgradeEnabled));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:18,代碼來源:AddHttpManagementInterface.java

示例6: connect

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Before
public void connect() throws Exception {
    client = ManagementClient.online(OnlineOptions.standalone().localDefault().build());
    ops = new Operations(client);
    administration = new Administration(client);

    AddSecurityRealm addSecurityRealm = new AddSecurityRealm.Builder(TEST_SECURITY_REALM_NAME).build();
    client.apply(addSecurityRealm);
    assertTrue("The security realm should be created", ops.exists(TEST_SECURITY_REALM_ADDRESS));

    AddLdapConnection addLdapConnection = new AddLdapConnection.Builder(TEST_LDAP_CONNECTION)
            .url("ldap://localhost:10389")
            .build();
    client.apply(addLdapConnection);
    assertTrue("Ldap outbound connection should be created", ops.exists(TEST_LDAP_CONNECTION_ADDRESS));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:17,代碼來源:AddLdapAuthenticationOnlineTest.java

示例7: connect

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Before
public void connect() throws IOException {
    client = ManagementClient.online(OnlineOptions.standalone().localDefault().build());
    ops = new Operations(client);
    admin = new Administration(client);

    if (client.version().lessThan(ServerVersion.VERSION_2_0_0)) { // AS7, JBoss Web
        webSubsystem = "web";
        defaultHostAddress = Address.subsystem("web").and("virtual-server", "default-host");
        jspConfigurationAddress = Address.subsystem("web").and("configuration", "jsp-configuration");
        httpConnectorAddress = Address.subsystem("web").and("connector", "http");
        requestCountAttribute = "requestCount";
    } else { // WildFly, Undertow
        webSubsystem = "undertow";
        defaultHostAddress = Address.subsystem("undertow").and("server", "default-server").and("host", "default-host");
        jspConfigurationAddress = Address.subsystem("undertow").and("servlet-container", "default").and("setting", "jsp");
        httpConnectorAddress = Address.subsystem("undertow").and("server", "default-server").and("http-listener", "default");
        requestCountAttribute = "request-count";
    }
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:21,代碼來源:OperationsTest.java

示例8: waitUntilRunning

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
/**
 * Waits until WildFly is in running state. If the given timeout value is greater than 0, then it'll also wait (at most the
 * given amount of seconds) until the management port is open on the wrapped node.
 */
public void waitUntilRunning(long timeoutForPortInSeconds) throws IOException {
    if (timeoutForPortInSeconds > 0) {
        LOGGER.debug("Waiting for management port on node '{}'", getName());
        waitForPorts(timeoutForPortInSeconds, mgmtPortUnmapped);
        LOGGER.debug("Management port {} is open on node '{}'", mgmtPortUnmapped, getName());
    }
    try (OnlineManagementClient managementClient = createManagementClient()) {
        Administration admin = new Administration(managementClient);
        LOGGER.debug("Waiting for WildFly server state running on node '{}'", getName());
        admin.waitUntilRunning();
        LOGGER.debug("WildFly Server is running on node '{}'", getName());
    }
}
 
開發者ID:wildfly-extras,項目名稱:sunstone,代碼行數:18,代碼來源:WildFlyNode.java

示例9: testReload

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Test
public void testReload() throws IOException, CliException, InterruptedException, TimeoutException {
    try (OnlineManagementClient managementClient = wildFlyNode.createManagementClient()) {
        Administration admin = new Administration(managementClient);
        admin.reload();
        Operations ops = new Operations(managementClient);
        assertEquals("admin", ops.whoami().get("result", "identity", "username").asString());
    }
}
 
開發者ID:wildfly-extras,項目名稱:sunstone,代碼行數:10,代碼來源:WildFlyNodeTest.java

示例10: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
    if (usernameLoad != null) {
        ctx.version.assertAtLeast(ServerVersion.VERSION_2_0_0,
                "Option username-load is available since WildFly 8");
    }

    Operations ops = new Operations(ctx.client);
    Address securityRealmLdapAuthnAddress = securityRealmAddress.and("authentication", "ldap");
    if (replaceExisting) {
        ops.removeIfExists(securityRealmLdapAuthnAddress);
        new Administration(ctx.client).reloadIfRequired();
    }
    ops.add(securityRealmLdapAuthnAddress, Values.empty()
            .andOptional("username-attribute", usernameAttribute)
            .andOptional("advanced-filter", advancedFilter)
            .andOptional("connection", connection)
            .andOptional("base-dn", baseDn)
            .andOptional("user-dn", userDn)
            .andOptional("username-load", usernameLoad)
            .andOptional("allow-empty-passwords", allowEmptyPasswords)
            .andOptional("recursive", recursive));

    if (cache != null) {
        String cacheType = null;
        if (cache.getByAccessTime()) {
            cacheType = "by-access-time";
        }
        if (cache.getBySearchTime()) {
            cacheType = "by-search-time";
        }
        ops.add(securityRealmLdapAuthnAddress.and("cache", cacheType), Values.empty()
                .andOptional("cache-failures", cache.getCacheFailures())
                .andOptional("eviction-time", cache.getEvictionTime())
                .andOptional("max-cache-size", cache.getMaxCacheSize()));
    }
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:38,代碼來源:AddLdapAuthentication.java

示例11: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
    Operations ops = new Operations(ctx.client);
    Address securityRealmPropertiesAuthzAddress = securityRealmAddress.and("authorization", "properties");
    if (replaceExisting) {
        ops.removeIfExists(securityRealmPropertiesAuthzAddress);
        new Administration(ctx.client).reloadIfRequired();
    }
    ops.add(securityRealmPropertiesAuthzAddress, Values.empty()
            .andOptional("path", path)
            .andOptional("relative-to", relativeTo));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:13,代碼來源:AddPropertiesAuthorization.java

示例12: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public final void apply(OnlineCommandContext ctx) throws Exception {
    Address sslServerIdentitiesAddress = securityRealmAddress.and("server-identity", "ssl");

    Operations ops = new Operations(ctx.client);

    if (replaceExisting) {
        boolean secretServerIdentityExists = ops.exists(sslServerIdentitiesAddress);
        if (secretServerIdentityExists) {
            ops.remove(sslServerIdentitiesAddress);
        }
        new Administration(ctx.client).reloadIfRequired();
    }

    Values params = Values.empty()
            .andOptional("alias", alias)
            .andListOptional(String.class, "enabled-cipher-suites", enabledCipherSuites)
            .andListOptional(String.class, "enabled-protocols", enabledProtocols)
            .andOptional("key-password", keyPassword)
            .and("keystore-password", keystorePassword)
            .andOptional("keystore-path", keystorePath)
            .andOptional("keystore-provider", keystoreProvider)
            .andOptional("keystore-relative-to", keystoreRelativeTo)
            .andOptional("protocol", protocol);

    if (ctx.version.greaterThanOrEqualTo(ServerVersion.VERSION_4_2_0)) {
        params = params.andOptional("generate-self-signed-certificate-host", generateSelfSignedCertHost);
    }

    ops.add(securityRealmAddress.and("server-identity", "ssl"), params);
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:32,代碼來源:AddSslServerIdentity.java

示例13: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
    Operations ops = new Operations(ctx.client);
    Address securityRealmJaasAuthnAddress = securityRealmAddress.and("authentication", "local");
    if (replaceExisting) {
        ops.removeIfExists(securityRealmJaasAuthnAddress);
        new Administration(ctx.client).reloadIfRequired();
    }
    ops.add(securityRealmJaasAuthnAddress, Values.empty()
            .andOptional("allowed-users", allowedUsers)
            .andOptional("default-user", defaultUser)
            .andOptional("skip-group-loading", skipGroupLoading));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:14,代碼來源:AddLocalAuthentication.java

示例14: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
    Operations ops = new Operations(ctx.client);
    Address securityRealmPropertiesAuthnAddress = securityRealmAddress.and("authentication", "properties");
    if (replaceExisting) {
        ops.removeIfExists(securityRealmPropertiesAuthnAddress);
        new Administration(ctx.client).reloadIfRequired();
    }
    ops.add(securityRealmPropertiesAuthnAddress, Values.empty()
            .andOptional("path", path)
            .andOptional("relative-to", relativeTo)
            .andOptional("plain-text", plainText));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:14,代碼來源:AddPropertiesAuthentication.java

示例15: apply

import org.wildfly.extras.creaper.core.online.operations.admin.Administration; //導入依賴的package包/類
@Override
public void apply(OnlineCommandContext ctx) throws Exception {
    Operations ops = new Operations(ctx.client);
    Address securityRealmAddress = Address.coreService("management").and("security-realm", securityRealmName);
    if (replaceExisting) {
        try {
            ops.removeIfExists(securityRealmAddress);
            new Administration(ctx.client).reloadIfRequired();
        } catch (OperationException e) {
            throw new IOException("Failed to remove existing security realm " + securityRealmName, e);
        }
    }
    ops.add(securityRealmAddress, Values.empty()
            .andOptional("map-groups-to-roles", mapGroupsToRoles));
}
 
開發者ID:wildfly-extras,項目名稱:creaper,代碼行數:16,代碼來源:AddSecurityRealm.java


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