public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) :
                base(config, server, configName)
        {
            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

            string mapService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);

            if (mapService == String.Empty)
                throw new Exception("No LocalServiceModule in config file");

            Object[] args = new Object[] { config };
            m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args);

            string gridService = serverConfig.GetString("GridService", String.Empty);
            if (gridService != string.Empty)
                m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);

            if (m_GridService != null)
                m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
            else
                m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");

            bool proxy = serverConfig.GetBoolean("HasProxy", false);
            IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName);
            server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth));

        }
 public MapServerRemoveHandler(IMapImageService service, IGridService grid, bool proxy) :
     base("POST", "/removemap")
 {
     m_MapService  = service;
     m_GridService = grid;
     m_Proxy       = proxy;
 }
 public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) :
     base("POST", "/map", auth)
 {
     m_MapService  = service;
     m_GridService = grid;
     m_Proxy       = proxy;
 }
        ///<summary>
        ///
        ///</summary>
        public void Initialise(IConfigSource source)
        {
            IConfig moduleConfig = source.Configs["Modules"];

            if (moduleConfig != null)
            {
                string name = moduleConfig.GetString("MapImageService", "");
                if (name != Name)
                {
                    return;
                }
            }

            IConfig config = source.Configs["MapImageService"];

            if (config == null)
            {
                return;
            }

            int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime"));

            if (refreshminutes <= 0)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No refresh time given in config. Module disabled.");
                return;
            }

            m_refreshtime = refreshminutes * 60 * 1000; // convert from minutes to ms

            string service = config.GetString("LocalServiceModule", string.Empty);

            if (service == string.Empty)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No service dll given in config. Unable to proceed.");
                return;
            }

            Object[] args = new Object[] { source };
            m_MapService = ServerUtils.LoadPlugin <IMapImageService>(service, args);
            if (m_MapService == null)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service);
                return;
            }

            m_refreshTimer.Enabled   = true;
            m_refreshTimer.AutoReset = true;
            m_refreshTimer.Interval  = m_refreshtime;
            m_refreshTimer.Elapsed  += new ElapsedEventHandler(HandleMaptileRefresh);

            m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0}min and service object {1}",
                             refreshminutes, service);

            m_enabled = true;
        }
Example #5
0
        public MapGetServiceConnector(IConfigSource config, IHttpServer server, string configName) :
            base(config, server, configName)
        {
            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

            string gridService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);

            if (gridService == String.Empty)
                throw new Exception("No LocalServiceModule in config file");

            Object[] args = new Object[] { config };
            m_MapService = ServerUtils.LoadPlugin<IMapImageService>(gridService, args);

            server.AddStreamHandler(new MapServerGetHandler(m_MapService));
        }
        public MapAddServiceConnector(IConfigSource config, IHttpServer server, string configName) :
            base(config, server, configName)
        {
            IConfig serverConfig = config.Configs[m_ConfigName];

            if (serverConfig == null)
            {
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
            }

            string mapService = serverConfig.GetString("LocalServiceModule",
                                                       String.Empty);

            if (mapService == String.Empty)
            {
                throw new Exception("No LocalServiceModule in config file");
            }

            Object[] args = new Object[] { config };
            m_MapService = ServerUtils.LoadPlugin <IMapImageService>(mapService, args);

            string gridService = serverConfig.GetString("GridService", String.Empty);

            if (gridService != string.Empty)
            {
                m_GridService = ServerUtils.LoadPlugin <IGridService>(gridService, args);
            }

            if (m_GridService != null)
            {
                m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
            }
            else
            {
                m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
            }

            bool         proxy = serverConfig.GetBoolean("HasProxy", false);
            IServiceAuth auth  = ServiceAuth.Create(config, m_ConfigName);

            server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth));
        }
Example #7
0
        public MapGetServiceConnector(IConfigSource config, IHttpServer server, string configName) :
            base(config, server, configName)
        {
            IConfig serverConfig = config.Configs[m_ConfigName];

            if (serverConfig == null)
            {
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
            }

            string gridService = serverConfig.GetString("LocalServiceModule", string.Empty);

            if (string.IsNullOrWhiteSpace(gridService))
            {
                throw new Exception("No LocalServiceModule in config file");
            }

            object[] args = new object[] { config };
            m_MapService = ServerUtils.LoadPlugin <IMapImageService>(gridService, args);

            server.AddStreamHandler(new MapServerGetHandler(m_MapService));
        }
 public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) :
     base("POST", "/map", auth)
 {
     m_MapService = service;
     m_GridService = grid;
     m_Proxy = proxy;
 }
Example #9
0
 public MapServerGetHandler(IMapImageService service) :
     base("GET", "/map")
 {
     m_MapService = service;
 }
Example #10
0
 public MapServerGetHandler(IMapImageService service) :
         base("GET", "/map")
 {
     m_MapService = service;
 }
Example #11
0
        ///<summary>
        ///
        ///</summary>
        public void Initialise(IConfigSource source)
        {
            IConfig moduleConfig = source.Configs["Modules"];
            if (moduleConfig != null)
            {
                string name = moduleConfig.GetString("MapImageService", "");
                if (name != Name)
                    return;
            }

            IConfig config = source.Configs["MapImageService"];
            if (config == null)
                return;

            int refreshminutes = Convert.ToInt32(config.GetString("RefreshTime"));
            if (refreshminutes <= 0)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No refresh time given in config. Module disabled.");
                return;
            }

            m_refreshtime = refreshminutes * 60 * 1000; // convert from minutes to ms

            string service = config.GetString("LocalServiceModule", string.Empty);
            if (service == string.Empty)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: No service dll given in config. Unable to proceed.");
                return;
            }

            Object[] args = new Object[] { source };
            m_MapService = ServerUtils.LoadPlugin<IMapImageService>(service, args);
            if (m_MapService == null)
            {
                m_log.WarnFormat("[MAP IMAGE SERVICE MODULE]: Unable to load LocalServiceModule from {0}. MapService module disabled. Please fix the configuration.", service);
                return;
            }

            m_refreshTimer.Enabled = true;
            m_refreshTimer.AutoReset = true;
            m_refreshTimer.Interval = m_refreshtime;
            m_refreshTimer.Elapsed += new ElapsedEventHandler(HandleMaptileRefresh);

            m_log.InfoFormat("[MAP IMAGE SERVICE MODULE]: enabled with refresh time {0}min and service object {1}",
                             refreshminutes, service);

            m_enabled = true;
        }
 public MapServerPostHandler(IMapImageService service) :
     base("POST", "/map")
 {
     m_MapService = service;
 }
 public MapServerRemoveHandler(IMapImageService service, IGridService grid, bool proxy) :
     base("POST", "/removemap")
 {
     m_MapService = service;
     m_GridService = grid;
     m_Proxy = proxy;
 }
 public MapServerPostHandler(IMapImageService service) :
     base("POST", "/map")
 {
     m_MapService = service;
 }