Пример #1
0
 public IXConnection(IXConnFactory iXConnFactory,
                     BClient_Indexserver bclient, IXAuthentication auth, string url,
                     IXProperties connProps, IXProperties sessOpts)
 {
     this.iXConnFactory     = iXConnFactory;
     this.bclient           = bclient;
     this.auth              = auth;
     this.url               = url;
     this.connPropsVal      = connProps;
     this.sessionOptionsVal = sessOpts;
     this.ixVal             = new IXCachedConnIXServicePortIF(bclient.getTransport(), connProps);
     this.disposed          = false;
 }
Пример #2
0
        public virtual void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                Logout();
                iXConnFactory     = null;
                auth              = null;
                url               = null;
                connPropsVal      = null;
                sessionOptionsVal = null;
                ixVal             = null;
                constVal          = null;
                eventBusApiVal    = null;
                bclient           = null;
            }
            disposed = true;
        }
Пример #3
0
        private void internalCreateConnection(IXAuthentication auth, BAsyncResult <IXConnection> asyncResult)
        {
            // Check version
            if (MajorVersion < 9)
            {
                BException ex = new BException(BExceptionC.CONNECTION_TO_SERVER_FAILED,
                                               "Received server version " + Version + ". At least server version 9.00.000 is required.");
                asyncResult(null, ex);
                return;
            }

            // IX-URL, e.g. http://localhost:8084/ix-elo80/ix
            String url = connProps[PROP_URL];

            // BYPS-URL, e.g. http://localhost:8084/ix-elo80/byps
            String bypsUrl = url;
            int    pos     = bypsUrl.LastIndexOf("/ix");

            if (pos >= 0)
            {
                bypsUrl = bypsUrl.Substring(0, pos) + "/byps";
                if (pos + 3 < url.Length)
                {
                    bypsUrl += url.Substring(pos + 3);
                }
            }

            // timeout
            String timeoutSecondsStr = connProps[PROP_TIMEOUT_SECONDS];
            int    timeoutSeconds    = Convert.ToInt32(timeoutSecondsStr != null && timeoutSecondsStr.Length != 0 ? timeoutSecondsStr : "120");

            // #reverse connections
            String reverseConnsStr        = connProps[NB_OF_REVERSE_CNNS];
            int    nbOfReverseConnections = Convert.ToInt32(reverseConnsStr != null && reverseConnsStr.Length != 0 ? reverseConnsStr : "1");

            // Wire, transport, client
            IXWireClient        wire             = new IXWireClient(bypsUrl, 0, timeoutSeconds);
            BTransportFactory   transportFactory = new HTransportFactoryClient(BApiDescriptor_Indexserver.instance, wire, nbOfReverseConnections);
            BClient_Indexserver bclient          = BClient_Indexserver.createClient(transportFactory);

            // Authentication
            bclient.setAuthentication(auth);

            // IXConnection
            IXConnection conn = new IXConnection(this, bclient, auth, url, connProps, sessOpts);

            BAsyncResult <bool> outerResult = (ignored, e) =>
            {
                if (e != null)
                {
                    asyncResult(conn, e);
                }
                else if (this.CONST != null)
                {
                    asyncResult(conn, e);
                }
                else
                {
                    // Read constants
                    BAsyncResult <IXServicePortC> constResult = (CONST, ex) =>
                    {
                        this.CONSTVal = CONST;
                        asyncResult(conn, ex);
                    };

                    conn.getCONST(constResult);
                }
            };

            // Start client
            bclient.start(outerResult, false);
        }