Search in sources :

Example 11 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class ClientTcpDirectSelfTest method clientConfiguration.

/** {@inheritDoc} */
@Override
protected GridClientConfiguration clientConfiguration() throws GridClientException {
    GridClientConfiguration cfg = super.clientConfiguration();
    cfg.setServers(Collections.<String>emptySet());
    cfg.setRouters(Collections.singleton(HOST + ":" + BINARY_PORT));
    return cfg;
}
Also used : GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 12 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class RestProcessorStartSelfTest method testTcpStart.

/**
     *  @throws Exception If failed.
     */
public void testTcpStart() throws Exception {
    GridClientConfiguration clCfg = new GridClientConfiguration();
    clCfg.setProtocol(GridClientProtocol.TCP);
    clCfg.setServers(Collections.singleton(HOST + ":" + TCP_PORT));
    doTest(clCfg);
}
Also used : GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration)

Example 13 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class TaskCommandHandlerSelfTest method clientConfiguration.

/**
     * @return Client configuration.
     */
private GridClientConfiguration clientConfiguration() {
    GridClientConfiguration cfg = new GridClientConfiguration();
    GridClientDataConfiguration nullCache = new GridClientDataConfiguration();
    GridClientDataConfiguration cache = new GridClientDataConfiguration();
    cache.setName(CACHE_NAME);
    cfg.setDataConfigurations(Arrays.asList(nullCache, cache));
    cfg.setProtocol(TCP);
    cfg.setServers(Arrays.asList("localhost:" + BINARY_PORT));
    return cfg;
}
Also used : GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration) GridClientDataConfiguration(org.apache.ignite.internal.client.GridClientDataConfiguration)

Example 14 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class ClientCacheBenchmark method configuration.

/**
     * @return Test client configuration.
     */
private GridClientConfiguration configuration() {
    GridClientConfiguration cfg = new GridClientConfiguration();
    cfg.setServers(Collections.singleton("localhost:11211"));
    GridClientDataConfiguration cacheCfg = new GridClientDataConfiguration();
    cacheCfg.setName("partitioned");
    cacheCfg.setAffinity(new GridClientPartitionAffinity());
    cfg.setDataConfigurations(Collections.singletonList(cacheCfg));
    return cfg;
}
Also used : GridClientPartitionAffinity(org.apache.ignite.internal.client.GridClientPartitionAffinity) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration) GridClientDataConfiguration(org.apache.ignite.internal.client.GridClientDataConfiguration)

Example 15 with GridClientConfiguration

use of org.apache.ignite.internal.client.GridClientConfiguration in project ignite by apache.

the class CommandHandler method main.

/**
     * @param args Args.
     */
public static void main(String[] args) throws GridClientException {
    String host = "127.0.0.1";
    String port = "11212";
    Boolean activate = null;
    if (args.length == 1 && "help".equals(args[0])) {
        System.out.println("Example: --host {ip} --port {port} --{activate/deactivate} " + "or without command --host {ip} --port {port} then will print status.");
        return;
    }
    if (args.length > 5)
        throw new IllegalArgumentException("incorrect number of arguments");
    for (int i = 0; i < args.length; i++) {
        String str = args[i];
        if ("--host".equals(str))
            host = args[i + 1];
        else if ("--port".equals(str))
            port = args[i + 1];
        else if ("--activate".equals(str))
            activate = true;
        else if ("--deactivate".equals(str))
            activate = false;
    }
    if (host == null)
        throw new IllegalArgumentException("host can not be empty");
    if (port == null)
        throw new IllegalArgumentException("port can not be empty");
    GridClientConfiguration cfg = new GridClientConfiguration();
    cfg.setServers(Collections.singletonList(host + ":" + port));
    try (GridClient client = GridClientFactory.start(cfg)) {
        GridClientClusterState state = client.state();
        if (activate != null)
            try {
                state.active(activate);
                System.out.println(host + ":" + port + " - was " + (activate ? "activate" : "deactivate"));
            } catch (Exception e) {
                System.out.println("Something fail during " + (activate ? "activation" : "deactivation") + ", exception message: " + e.getMessage());
            }
        else
            System.out.println(host + ":" + port + " - " + (state.active() ? "active" : "inactive"));
    }
}
Also used : GridClientClusterState(org.apache.ignite.internal.client.GridClientClusterState) GridClient(org.apache.ignite.internal.client.GridClient) GridClientConfiguration(org.apache.ignite.internal.client.GridClientConfiguration) GridClientException(org.apache.ignite.internal.client.GridClientException)

Aggregations

GridClientConfiguration (org.apache.ignite.internal.client.GridClientConfiguration)23 GridClientDataConfiguration (org.apache.ignite.internal.client.GridClientDataConfiguration)5 ArrayList (java.util.ArrayList)4 GridClient (org.apache.ignite.internal.client.GridClient)3 GridClientException (org.apache.ignite.internal.client.GridClientException)3 GridClientPartitionAffinity (org.apache.ignite.internal.client.GridClientPartitionAffinity)2 File (java.io.File)1 IOException (java.io.IOException)1 Map (java.util.Map)1 Properties (java.util.Properties)1 UUID (java.util.UUID)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Ignite (org.apache.ignite.Ignite)1 Event (org.apache.ignite.events.Event)1 TaskEvent (org.apache.ignite.events.TaskEvent)1 GridClientClusterState (org.apache.ignite.internal.client.GridClientClusterState)1 GridClientRoundRobinBalancer (org.apache.ignite.internal.client.balancer.GridClientRoundRobinBalancer)1 GridClientJdkMarshaller (org.apache.ignite.internal.client.marshaller.jdk.GridClientJdkMarshaller)1 VisorNodePingTask (org.apache.ignite.internal.visor.node.VisorNodePingTask)1