com.h3c.sdn.misc

## Class PoolableResourceClient

- java.lang.Object
- - com.h3c.sdn.misc.ResourceClient
  - - com.h3c.sdn.misc.PoolableResourceClient

- Direct Known Subclasses:
    AdminRestComponent, ServiceRestComponent

      public abstract class PoolableResourceClient
      extends ResourceClient

  A base implementation of client services for accessing remote RESTful services, with built-in connection pool to allow a limited number of concurrent accesses to the remote RESTful services.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static String` | `CONFIG_CLIENT_AUTH_KEY`
    `protected static String` | `CONFIG_CONN_ROUTE_KEY`
    `protected static String` | `CONFIG_CONN_TIMEOUT`
    `protected static String` | `CONFIG_CONN_TOTAL_KEY`
    `protected static String` | `CONFIG_CONN_TTL_KEY`
    `protected static String` | `CONFIG_KEYSTORE_KEY`
    `protected static String` | `CONFIG_KEYSTORE_PASS_KEY`
    `protected static String` | `CONFIG_PORT_KEY`
    `protected static String` | `CONFIG_SELFSIGNED`
    `protected static String` | `CONFIG_SO_TIMEOUT`
    `protected static String` | `CONFIG_SSL_KEY`
    `protected static String` | `CONFIG_TRUSTSTORE_KEY`
    `protected static String` | `CONFIG_TRUSTSTORE_PASS_KEY`
    `protected boolean` | `isSSL`
    `protected static org.slf4j.Logger` | `log`
    `protected int` | `port`
    `protected SharedSecret` | `ss`

    - ### Fields inherited from class com.h3c.sdn.misc.ResourceClient

      `LOGIN_TOKEN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PoolableResourceClient()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `activate(Map<String,Object> config)` Provide the desired configurations.
    `protected void` | `bindSharedSecret(SharedSecret service)`
    `protected org.apache.http.client.HttpClient` | `client()`
    `protected void` | `deactivate()` Shut down the connection manager.
    `LoginContext` | `login()`
    `protected void` | `modified(Map<String,Object> config)`
    `protected void` | `unbindSharedSecret(SharedSecret service)`

    - ### Methods inherited from class com.h3c.sdn.misc.ResourceClient

      `annotate, delete, delete, get, getInputStream, post, post, post, post, put, put, put, request, response, response, uri, uri, webContext`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### log

          protected static final org.slf4j.Logger log

    - #### CONFIG_SSL_KEY

          @Property(boolValue=true)
          protected static final String CONFIG_SSL_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_PORT_KEY

          @Property(intValue=8443)
          protected static final String CONFIG_PORT_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_KEYSTORE_KEY

          @Property(value="/opt/sdn/admin/keystore")
          protected static final String CONFIG_KEYSTORE_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_KEYSTORE_PASS_KEY

          @Property(value="ENC()")
          protected static final String CONFIG_KEYSTORE_PASS_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_TRUSTSTORE_KEY

          @Property(value="/opt/sdn/admin/truststore")
          protected static final String CONFIG_TRUSTSTORE_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_TRUSTSTORE_PASS_KEY

          @Property(value="ENC()")
          protected static final String CONFIG_TRUSTSTORE_PASS_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_CLIENT_AUTH_KEY

          @Property(boolValue=false)
          protected static final String CONFIG_CLIENT_AUTH_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_SELFSIGNED

          @Property(boolValue=false)
          protected static final String CONFIG_SELFSIGNED

      See Also:
        Constant Field Values

    - #### CONFIG_CONN_TTL_KEY

          @Property(intValue=5000)
          protected static final String CONFIG_CONN_TTL_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_CONN_TOTAL_KEY

          @Property(intValue=20)
          protected static final String CONFIG_CONN_TOTAL_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_CONN_ROUTE_KEY

          @Property(intValue=2)
          protected static final String CONFIG_CONN_ROUTE_KEY

      See Also:
        Constant Field Values

    - #### CONFIG_CONN_TIMEOUT

          @Property(intValue=0)
          protected static final String CONFIG_CONN_TIMEOUT

      See Also:
        Constant Field Values

    - #### CONFIG_SO_TIMEOUT

          @Property(intValue=120000)
          protected static final String CONFIG_SO_TIMEOUT

      See Also:
        Constant Field Values

    - #### isSSL

          protected boolean isSSL

    - #### port

          protected int port

    - #### ss

          @Reference(name="SharedSecret",
                     policy=DYNAMIC,
                     cardinality=MANDATORY_UNARY)
          protected volatile SharedSecret ss

  - ### Constructor Detail

    - #### PoolableResourceClient

          public PoolableResourceClient()

  - ### Method Detail

    - #### bindSharedSecret

          protected void bindSharedSecret(SharedSecret service)

    - #### unbindSharedSecret

          protected void unbindSharedSecret(SharedSecret service)

    - #### login

          public LoginContext login()

    - #### activate

          @Activate
          protected void activate(Map<String,Object> config)

      Provide the desired configurations. If the supplied configuration does not contain an expected key, the defined default value for that key is used.
      Parameters:
        `config` - desired configuration

    - #### modified

          @Modified
          protected void modified(Map<String,Object> config)

    - #### deactivate

          @Deactivate
          protected void deactivate()

      Shut down the connection manager.

    - #### client

          protected org.apache.http.client.HttpClient client()

      Overrides:
        `client` in class `ResourceClient`

Copyright © 2014. All Rights Reserved.