示例#1
0
        private Service DoCreateService(IServiceAddress serviceAddress, ServiceType serviceType, IServiceConnector connector)
        {
            Service service = null;
            if (serviceType == ServiceType.Manager) {
                if (manager == null) {
                    string npath = Path.Combine(basePath, "manager");
                    if (!Directory.Exists(npath))
                        Directory.CreateDirectory(npath);

                    manager = new FileSystemManagerService(connector, basePath, npath, serviceAddress);
                }

                service = manager;
            } else if (serviceType == ServiceType.Root) {
                if (root == null) {
                    string npath = Path.Combine(basePath, "root");
                    if (!Directory.Exists(npath))
                        Directory.CreateDirectory(npath);

                    root = new FileSystemRootService(connector, npath);
                }

                service = root;
            } else if (serviceType == ServiceType.Block) {
                if (block == null) {
                    string npath = Path.Combine(basePath, "block");
                    if (!Directory.Exists(npath))
                        Directory.CreateDirectory(npath);

                    block = new FileSystemBlockService(connector, npath);
                }

                service = block;
            }

            if (service != null) {
                service.Started += ServiceStarted;
                service.Stopped += ServiceStopped;
            }

            return service;
        }
示例#2
0
            public PathAccess(RootService service, string pathName)
            {
                this.service = service;
                this.pathName = pathName;

                proposalQueue = new List<object>();
            }
示例#3
0
 public MessageProcessor(RootService service)
 {
     this.service = service;
 }
示例#4
0
            public PathConnection(RootService service, PathInfo pathInfo, IServiceConnector connector, IServiceAddress[] managerServers,
			                      INetworkCache cache, ServiceStatusTracker statusTracker)
            {
                this.service = service;
                this.pathInfo = pathInfo;
                treeSystem = new NetworkTreeSystem(connector, managerServers, cache, statusTracker);
            }
示例#5
0
 public MemoryPathAccess(RootService service, string pathName)
     : base(service, pathName)
 {
 }
示例#6
0
        protected override void OnStop()
        {
            if (configTimer != null) {
                configTimer.Dispose();
                configTimer = null;
            }

            if (manager != null) {
                manager.Dispose();
                manager = null;
            }
            if (root != null) {
                root.Dispose();
                root = null;
            }
            if (block != null) {
                block.Dispose();
                block = null;
            }
        }
示例#7
0
        protected override void Dispose(bool disposing)
        {
            if (disposing) {
                if (manager != null) {
                    manager.Dispose();
                    manager = null;
                }
                if (root != null) {
                    root.Dispose();
                    root = null;
                }
                if (block != null) {
                    block.Dispose();
                    block = null;
                }
            }

            base.Dispose(disposing);
        }
示例#8
0
 public void StopService(ServiceType serviceType)
 {
     lock (serverManagerLock) {
         if (serviceType == ServiceType.Manager && manager != null) {
             manager.Stop();
             manager = null;
         } else if (serviceType == ServiceType.Root && root != null) {
             root.Stop();
             root = null;
         } else if (serviceType == ServiceType.Block && block != null) {
             block.Stop();
             block = null;
         }
     }
 }
示例#9
0
        public void StartService(ServiceType serviceType)
        {
            // Start the services,
            lock (serverManagerLock) {
                IService service = serviceFactory.CreateService(address, serviceType, connector);
                if (service == null)
                    throw new ApplicationException("Unable to create service of tyoe  " + serviceType);

                service.Start();

                if (serviceType == ServiceType.Manager)
                    manager = (ManagerService)service;
                else if (serviceType == ServiceType.Root)
                    root = (RootService)service;
                else if (serviceType == ServiceType.Block)
                    block = (BlockService) service;
            }
        }
示例#10
0
 public PathConnection(RootService service, string pathName, 
     IServiceConnector connector, IServiceAddress manager,
     INetworkCache networkCache)
 {
     this.service = service;
     this.pathName = pathName;
     treeSystem = new NetworkTreeSystem(connector, manager, networkCache);
 }