Class Connector

    • Method Detail

      • createConnector

        public static D2Connector createConnector​(java.lang.String connectionString,
                                                  D2ConnectorEventsListener eventsListener)
                                           throws ConnectorException
        Create a new instance of connector.
        Parameters:
        connectionString - where to connect
        eventsListener - listener for connector events
        Returns:
        new instance
        Throws:
        ConnectorException - when unable to connect
      • createConnector

        public static D2Connector createConnector​(java.lang.String connectionString,
                                                  java.lang.String certificatePath,
                                                  D2ConnectorEventsListener eventsListener)
                                           throws ConnectorException
        Create new instance of connector with TLS connection
        Parameters:
        connectionString - where to connect
        certificatePath - path to certificate used in TLS
        eventsListener - listener for connector events
        Returns:
        new instance
        Throws:
        ConnectorException - when unable to connect
      • createDictionaryConvertor

        public Convertor createDictionaryConvertor​(int languageIndex)
      • createDictionaryTranslator

        public Translator createDictionaryTranslator​(int languageIndex)
      • createObjectInfoCache

        public ObjectInfoCache createObjectInfoCache​(int cacheTimeMilliseconds)
      • createSession

        public java.util.concurrent.Future<D2Session> createSession​(D2SessionParameters sessionParams,
                                                                    D2SessionEventsListener eventsListener)
        Description copied from interface: D2SessionFactory
        Create new session object, connect it to D2000 and authorize it with valid D2000 user account.

        Operation is executed in background thread and goes through following steps:

        1. Create new instance.
        2. Connect session to the D2000 kernel.
        3. Logon to the D2000 kernel with provided user account.
        Future result may throw ExecutionException with cause:
        ConnectSessionException - when kernel refused connection of the session
        LoginFailedException - when kernel refused to logon with provided user account
        Specified by:
        createSession in interface D2SessionFactory
        Parameters:
        sessionParams - authentication information
        eventsListener - instance of event listener object to receive asynchronous events from D2000 session
        Returns:
        upcoming session object in form of future
      • createSession

        public java.util.concurrent.Future<D2Session> createSession​(D2SessionParameters sessionParams,
                                                                    D2SessionEventsListener eventsListener,
                                                                    java.util.Set<SharedResourceType> interestSet)
        Description copied from interface: D2SessionFactory
        Create new session object, connect it to D2000 and authorise it with valid D2000 user account.

        Operation is executed in background thread and goes through following steps:

        1. Create new instance.
        2. Report current state of shared resources to the sharedResourcesListener.
        3. Connect session to the D2000 kernel.
        4. Logon to the D2000 kernel with provided user account.
        Future result may throw ExecutionException with cause:
        ConnectSessionException - when kernel refused connection of the session
        LoginFailedException - when kernel refused to logon with provided user account
        Specified by:
        createSession in interface D2SessionFactory
        Parameters:
        sessionParams - authentication information
        eventsListener - instance of event listener object to receive asynchronous events from D2000 session
        interestSet - interesting shared resource types
        Returns:
        upcoming session object in form of future
      • createUnivalConvertor

        public UnivalConvertor createUnivalConvertor​()
      • getApplicationTimeZone

        public java.util.TimeZone getApplicationTimeZone​()
      • getConnectionExecutor

        public java.util.concurrent.Executor getConnectionExecutor​()
      • getConnectionName

        public java.lang.String getConnectionName​()
      • getCurrentServerTimeMilliseconds

        public long getCurrentServerTimeMilliseconds​()
      • getDefaultObjectInfoCache

        public ObjectInfoCache getDefaultObjectInfoCache​()
      • getDefaultUnivalConvertor

        public UnivalConvertor getDefaultUnivalConvertor​()
      • getTotalBytesRead

        public long getTotalBytesRead​()
        Description copied from interface: D2Connector
        Get number of bytes read from stream. Note that actual number of bytes received from socket may differ when TLS is used.
        Specified by:
        getTotalBytesRead in interface D2Connector
        Returns:
      • getTotalBytesSent

        public long getTotalBytesSent​()
        Description copied from interface: D2Connector
        Get number of bytes sent into stream. Note that actual number of bytes sent by socket may differ when TLS is used.
        Specified by:
        getTotalBytesSent in interface D2Connector
        Returns:
      • isClosed

        public boolean isClosed​()
        Description copied from interface: D2SessionFactory
        Get true after D2SessionFactory.close() has been called. Indicates that no new session can be created and all created sessions has been terminated.
        Specified by:
        isClosed in interface D2SessionFactory
        Returns:
        true when closed;
      • isConnected

        public boolean isConnected​()
      • registerStructureClasses

        public void registerStructureClasses​(java.util.List<? extends java.lang.Class<?>> types)
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object