コード例 #1
0
        /// <summary>
        /// Initializes the broker.
        /// </summary>
        /// <exception cref="Exception">Failed creating Documentum client</exception>
        private void InitializeBroker()
        {
            //File.AppendAllText("DqlConnect.log", sessionId + " InitalizeBroker\r\n\r\n");

            _clientx = new DfClientX();
            _client  = _clientx.getLocalClient();
            if (_client == null)
            {
                throw new Exception("Failed creating Documentum client");
            }

            IDfTypedObject config = _client.getClientConfig();

            builder = new DqlConnectionStringBuilder(this.ConnectionString);

            config.setString("dfc.docbroker.host", DefaultBrokerHost ?? SetDefaultBrokerHost());
            //File.AppendAllText("DqlConnect.log", sessionId + " Broker set to: " + DefaultBrokerHost + Environment.NewLine);

            builder.SetExtendedProperties(config);

            //builder.GetExtendedProperties().ForEach(item =>
            //{ config.setString(item.Key, item.Value); });

            IDfDocbaseMap map = _client.getDocbaseMap();

            Catalogs = new List <string>();
            int count = map.getDocbaseCount();

            for (int i = 0; i < count; i++)
            {
                Catalogs.Add(map.getDocbaseName(i));
            }
            map    = null;
            config = null;
        }
コード例 #2
0
 /// <summary>
 /// Closes the connection to the database. This is the preferred method of closing any open connection.
 /// </summary>
 public override void Close()
 {
     _session      = null;
     _loginInfoObj = null;
     _clientx      = null;
     _client       = null;
     state         = ConnectionState.Closed;
 }
コード例 #3
0
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="T:System.ComponentModel.Component" /> and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            //File.AppendAllText("DqlConnect.log", sessionId + " Dispose\r\n");
            base.Dispose(disposing);

            if (disposing)
            {
                this._client       = null;
                this._clientx      = null;
                this._session      = null;
                this._loginInfoObj = null;
                state = ConnectionState.Closed;
                //   FreeDllsNow(0);
                GC.Collect();
                // GC.WaitForPendingFinalizers();
            }
        }
コード例 #4
0
        /// <summary>
        /// AUTHOR: Ashok Kolwal
        /// COMPANY: VITRANA
        /// Version: 1.0
        /// Description: This method is used for get the session variable based on documentum server info.
        /// Last Modified date: 11 Jul,2017
        /// </summary>
        /// <param name="sessionVariableObject"></param>
        /// <returns></returns>
        public object GetSessionManager(GetSessionEntity sessionVariableObject)
        {
            object sessionVariable = null;

            try
            {
                IDfClientX clientX = new DfClientX();
                // Console.WriteLine("[GetSessionManager] IDfClientX instance created");
                IDfClient client = clientX.getLocalClient();
                // Console.WriteLine("[GetSessionManager] IDfClient instance created");
                IDfSessionManager sMgr = client.newSessionManager();
                // Console.WriteLine("[GetSessionManager] IDfSessionManager instance created");
                IDfLoginInfo loginInfo = clientX.getLoginInfo();
                // Console.WriteLine("[GetSessionManager] IDfLoginInfo instance created");
                loginInfo.setUser(sessionVariableObject.UserName);
                loginInfo.setPassword(sessionVariableObject.Password);
                loginInfo.setDomain("");
                sMgr.setIdentity(sessionVariableObject.RepositoryName, loginInfo);
                // Console.WriteLine("[GetSessionManager] LoginInfo identity is set");
                IDfSession session = sMgr.getSession(sessionVariableObject.RepositoryName);
                // Console.WriteLine("[GetSessionManager] IDfSession instance created");
                switch (sessionVariableObject.SessionVariableType)
                {
                case IDFSessionVariableType.IDfSession:
                    sessionVariable = session;
                    break;

                case IDFSessionVariableType.IDfSessionManager:
                    sessionVariable = sMgr;
                    break;
                }
                ;
            }
            catch (Exception ex)
            {
                throw new Exception("Error in [GetSessionManager] ", ex);
            }

            return(sessionVariable);
        }