Manages FDO connections.
Inheritance: IFdoConnectionManager
        public void Decorate(IObjectExplorer explorer)
        {
            _explorer = explorer;
            _connMgr = ServiceManager.Instance.GetService<FdoConnectionManager>();
            _connMgr.ConnectionAdded += new ConnectionEventHandler(OnConnectionAdded);
            _connMgr.ConnectionRenamed += new ConnectionRenamedEventHandler(OnConnectionRenamed);
            _connMgr.ConnectionRemoved += new ConnectionEventHandler(OnConnectionRemoved);
            _connMgr.ConnectionRefreshed += new ConnectionEventHandler(OnConnectionRefreshed);

            _explorer.RegisterImage(IMG_ASSOC_PROPERTY);
            _explorer.RegisterImage(IMG_FEATURE_CLASS);
            _explorer.RegisterImage(IMG_CLASS);
            _explorer.RegisterImage(IMG_CONNECTION);
            _explorer.RegisterImage(IMG_DATA_PROPERTY);
            _explorer.RegisterImage(IMG_GEOM_PROPERTY);
            _explorer.RegisterImage(IMG_ID_PROPERTY);
            _explorer.RegisterImage(IMG_OBJECT_PROPERTY);
            _explorer.RegisterImage(IMG_RASTER_PROPERTY);
            _explorer.RegisterImage(IMG_SCHEMA);

            _explorer.RegisterImage(IMG_DB_CONNECTION);
            _explorer.RegisterImage(IMG_SERVER_CONNECTION);
            _explorer.RegisterImage(IMG_FILE_CONNECTION);

            _explorer.RegisterRootNode(RootNodeName, "FDO Data Sources", "database_connect", "/ObjectExplorer/ContextMenus/FdoConnections");
            _explorer.RegisterContextMenu(NODE_CONNECTION, PATH_SELECTED_CONNECTION);
            _explorer.RegisterContextMenu(NODE_SCHEMA, PATH_SELECTED_SCHEMA);
            _explorer.RegisterContextMenu(NODE_CLASS, PATH_SELECTED_CLASS);

            _explorer.AfterExpansion += new TreeViewEventHandler(OnAfterNodeExpansion);
            //_explorer.RegisterContextMenu(NODE_PROPERTY, "/ObjectExplorer/ContextMenus/SelectedProperty");
        }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            _connMgr = ServiceManager.Instance.GetService<FdoConnectionManager>();
            List<string> srcNames = new List<string>(_availNames);
            List<string> dstNames = new List<string>(_availNames);

            cmbSrcConnection.DataSource = srcNames;
            cmbDstConnection.DataSource = dstNames;

            cmbSrcConnection.SelectedIndex = 0;
            cmbDstConnection.SelectedIndex = 0;

            cmbSrcConnection_SelectionChangeCommitted(this, EventArgs.Empty);
            cmbDstConnection_SelectionChangeCommitted(this, EventArgs.Empty);

            base.OnLoad(e);
        }
        public void Decorate(IObjectExplorer explorer)
        {
            _explorer = explorer;
            _connMgr = ServiceManager.Instance.GetService<FdoConnectionManager>();
            _connMgr.BeforeConnectionRemove += new ConnectionBeforeRemoveHandler(OnBeforeConnectionRemove);
            _connMgr.ConnectionRenamed += new ConnectionRenamedEventHandler(OnConnectionRenamed);
            _taskMgr = ServiceManager.Instance.GetService<TaskManager>();
            _taskMgr.TaskAdded += new TaskEventHandler(OnTaskAdded);
            _taskMgr.TaskRemoved += new TaskEventHandler(OnTaskRemoved);
            _taskMgr.TaskRenamed += new TaskRenameEventHandler(OnTaskRenamed);

            _explorer.RegisterImage(IMG_TASK);
            _explorer.RegisterImage(IMG_JOIN);
            _explorer.RegisterImage(IMG_SEQPROC);

            _explorer.RegisterRootNode(RootNodeName, "Tasks", IMG_TASK, PATH_TASKS);
            _explorer.RegisterContextMenu(NODE_TASK, PATH_SELECTED_TASK);
        }
        internal CopyTaskNodeDecorator(TreeNode root, string srcConnName, string srcSchema, string srcClass, string dstConnName, string dstSchema, string dstClass, string taskName, bool createIfNotExists)
        {
            _node = new TreeNode();
            root.Nodes.Add(_node);

            _node.Nodes.Add(new TreeNode("Description"));
            _node.Nodes.Add(new TreeNode("Options"));
            _node.Nodes.Add(new TreeNode("Property Mappings"));
            _node.Nodes.Add(new TreeNode("Expression Mappings (Right click to add)"));

            this.Name = taskName;
            this.Description = "Copies features from " + srcClass + " to " + dstClass;

            InitDescription(srcConnName, srcSchema, srcClass, dstConnName, dstSchema, dstClass, createIfNotExists);

            _connMgr = ServiceManager.Instance.GetService<FdoConnectionManager>();

            _srcConnName = srcConnName;
            _dstConnName = dstConnName;
            this.CreateIfNotExists = createIfNotExists;

            using (FdoFeatureService srcSvc = GetSourceConnection().CreateFeatureService())
            using (FdoFeatureService dstSvc = GetTargetConnection().CreateFeatureService())
            {
                ClassDefinition sourceClass = srcSvc.GetClassByName(srcSchema, srcClass);
                Debug.Assert(sourceClass != null);

                ClassDefinition targetClass = dstSvc.GetClassByName(dstSchema, dstClass);
                if (targetClass == null && !this.CreateIfNotExists)
                    throw new InvalidOperationException("Target class " + dstClass + " does not exist. If you want this class created make sure you checked \"Create class of the name name\" when creating a new copy task");

                _srcClass = sourceClass;
                _dstClass = targetClass;
            }

            _options = new OptionsNodeDecorator(this, _node.Nodes[1]);
            _propMappings = new PropertyMappingsNodeDecorator(this, _node.Nodes[2]);
            _exprMappings = new ExpressionMappingsNodeDecorator(this, _node.Nodes[3]);

            _node.ExpandAll();
        }
Exemple #5
0
        /// <summary>
        /// Gets the default name of the connection based on its provider
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="file"></param>
        /// <returns></returns>
        public string GetDefaultConnectionName(string provider, string file)
        {
            if (!_namePrefixes.ContainsKey(provider))
            {
                using (var pnt = new ProviderNameTokens(provider))
                {
                    SetPreferredNamePrefix(provider, pnt.GetLocalName() + "_");
                }
            }

            if (!_counter.ContainsKey(provider))
            {
                _counter[provider] = 0;
            }

            if (_manager == null)
            {
                _manager = ServiceManager.Instance.GetService <FdoConnectionManager>();
            }

            string name = "";

            if (!string.IsNullOrEmpty(file)) //Try [PROVIDER]_[FileName] first before adding numbers
            {
                name = _namePrefixes[provider] + file;
            }
            else
            {
                name = _namePrefixes[provider] + file + _counter[provider];
            }
            while (_manager.NameExists(name))
            {
                _counter[provider]++;
                name = _namePrefixes[provider] + file + _counter[provider];
            }
            return(name);
        }
Exemple #6
0
        /// <summary>
        /// Gets the default name of the connection based on its provider
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="file"></param>
        /// <returns></returns>
        public string GetDefaultConnectionName(string provider, string file)
        {
            if (!_namePrefixes.ContainsKey(provider))
            {
                using (var pnt = new ProviderNameTokens(provider))
                {
                    SetPreferredNamePrefix(provider, pnt.GetLocalName() + "_");
                }
            }

            if (!_counter.ContainsKey(provider))
                _counter[provider] = 0;

            if (_manager == null)
                _manager = ServiceManager.Instance.GetService<FdoConnectionManager>();

            string name = "";
            if (!string.IsNullOrEmpty(file)) //Try [PROVIDER]_[FileName] first before adding numbers
                name = _namePrefixes[provider] + file;
            else 
                name = _namePrefixes[provider] + file + _counter[provider];
            while (_manager.NameExists(name))
            {
                _counter[provider]++;
                name = _namePrefixes[provider] + file + _counter[provider];
            }
            return name;
        }
 public CreateSdfPresenter(ICreateSdfView view)
 {
     _view = view;
     _connMgr = ServiceManager.Instance.GetService<FdoConnectionManager>();
     CheckConnect();
 }
 public FdoBulkCopyCtl()
 {
     InitializeComponent();
     _connMgr = ServiceManager.Instance.GetService<FdoConnectionManager>();
 }