public HGAssetService(IConfigSource config, string configName) : base(config, configName) { m_log.Debug("[HGAsset Service]: Starting"); IConfig assetConfig = config.Configs[configName]; if (assetConfig == null) { throw new Exception("No HGAssetService configuration"); } string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty); if (userAccountsDll == string.Empty) { throw new Exception("Please specify UserAccountsService in HGAssetService configuration"); } Object[] args = new Object[] { config }; m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(userAccountsDll, args); if (m_UserAccountService == null) { throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); } // legacy configuration [obsolete] m_HomeURL = assetConfig.GetString("ProfileServerURI", string.Empty); // Preferred m_HomeURL = assetConfig.GetString("HomeURI", m_HomeURL); m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); // Permissions m_AssetPerms = new AssetPermissions(assetConfig); }
public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) { string name = moduleConfig.GetString("AssetServices", ""); if (name == Name) { IConfig assetConfig = source.Configs["AssetService"]; if (assetConfig == null) { m_log.Error("[REGIONASSETCONNECTOR]: AssetService missing from configuration files"); throw new Exception("Region asset connector init error"); } string localGridConnector = assetConfig.GetString("LocalGridAssetService", string.Empty); if (string.IsNullOrEmpty(localGridConnector)) { m_log.Error("[REGIONASSETCONNECTOR]: LocalGridAssetService missing from configuration files"); throw new Exception("Region asset connector init error"); } object[] args = new object[] { source }; m_localConnector = ServerUtils.LoadPlugin <IAssetService>(localGridConnector, args); if (m_localConnector == null) { m_log.Error("[REGIONASSETCONNECTOR]: Fail to load local asset service " + localGridConnector); throw new Exception("Region asset connector init error"); } string HGConnector = assetConfig.GetString("HypergridAssetService", string.Empty); if (!string.IsNullOrEmpty(HGConnector)) { m_HGConnector = ServerUtils.LoadPlugin <IAssetService>(HGConnector, args); if (m_HGConnector == null) { m_log.Error("[REGIONASSETCONNECTOR]: Fail to load HG asset service " + HGConnector); throw new Exception("Region asset connector init error"); } IConfig hgConfig = source.Configs["HGAssetService"]; if (hgConfig != null) { m_AssetPerms = new AssetPermissions(hgConfig); } } m_localRequestsQueue = new ObjectJobEngine(AssetRequestProcessor, "GetAssetsWorkers", 2000, 2); m_remoteRequestsQueue = new ObjectJobEngine(AssetRequestProcessor, "GetRemoteAssetsWorkers", 2000, 2); m_Enabled = true; m_log.Info("[REGIONASSETCONNECTOR]: enabled"); } } }
public HGAssetService(IConfigSource config, string configName) : base(config) { m_log.Debug("[HGAsset Service]: Starting"); IConfig assetConfig = config.Configs[configName]; if (assetConfig == null) { throw new Exception("No HGAssetService configuration"); } string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty); if (userAccountsDll == string.Empty) { throw new Exception("Please specify UserAccountsService in HGAssetService configuration"); } Object[] args = new Object[] { config }; m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(userAccountsDll, args); if (m_UserAccountService == null) { throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); } m_HomeURL = Util.GetConfigVarFromSections <string>(config, "HomeURI", new string[] { "Startup", "Hypergrid", configName }, string.Empty); if (m_HomeURL == string.Empty) { throw new Exception("[HGAssetService] No HomeURI specified"); } m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); // Permissions m_AssetPerms = new AssetPermissions(assetConfig); string str = assetConfig.GetString("BackingService", "OpenSim.Services.AssetService.dll:AssetService"); if (str != string.Empty) { args = new object[] { config }; m_assetService = LoadPlugin <IAssetService>(str, args); if (m_assetService != null) { m_log.InfoFormat("[HGASSETS]: Backing service loaded: {0}", str); } else { m_log.ErrorFormat("[HGASSETS]: Failed to load backing service {0}", str); } } }
public HGRemoteAssetService(IConfigSource config, string configName) { m_log.Debug("[HGRemoteAsset Service]: Starting"); IConfig assetConfig = config.Configs[configName]; if (assetConfig == null) { throw new Exception("No HGAssetService configuration"); } Object[] args = new Object[] { config }; string assetConnectorDll = assetConfig.GetString("AssetConnector", String.Empty); if (assetConnectorDll == String.Empty) { throw new Exception("Please specify AssetConnector in HGAssetService configuration"); } m_assetConnector = ServerUtils.LoadPlugin <IAssetService>(assetConnectorDll, args); if (m_assetConnector == null) { throw new Exception(String.Format("Unable to create AssetConnector from {0}", assetConnectorDll)); } string userAccountsDll = assetConfig.GetString("UserAccountsService", string.Empty); if (userAccountsDll == string.Empty) { throw new Exception("Please specify UserAccountsService in HGAssetService configuration"); } m_UserAccountService = ServerUtils.LoadPlugin <IUserAccountService>(userAccountsDll, args); if (m_UserAccountService == null) { throw new Exception(String.Format("Unable to create UserAccountService from {0}", userAccountsDll)); } m_HomeURL = Util.GetConfigVarFromSections <string>(config, "HomeURI", new string[] { "Startup", "Hypergrid", configName }, string.Empty); if (m_HomeURL == string.Empty) { throw new Exception("[HGAssetService] No HomeURI specified"); } m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); // Permissions m_AssetPerms = new AssetPermissions(assetConfig); }
public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) { string name = moduleConfig.GetString("AssetServices", ""); if (name == Name) { IConfig assetConfig = source.Configs["AssetService"]; if (assetConfig == null) { m_log.Error("[HG ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); return; } string localDll = assetConfig.GetString("LocalGridAssetService", String.Empty); string HGDll = assetConfig.GetString("HypergridAssetService", String.Empty); if (localDll == String.Empty) { m_log.Error("[HG ASSET CONNECTOR]: No LocalGridAssetService named in section AssetService"); return; } if (HGDll == String.Empty) { m_log.Error("[HG ASSET CONNECTOR]: No HypergridAssetService named in section AssetService"); return; } Object[] args = new Object[] { source }; m_GridService = ServerUtils.LoadPlugin <IAssetService>(localDll, args); m_HGService = ServerUtils.LoadPlugin <IAssetService>(HGDll, args); if (m_GridService == null) { m_log.Error("[HG ASSET CONNECTOR]: Can't load local asset service"); return; } if (m_HGService == null) { m_log.Error("[HG ASSET CONNECTOR]: Can't load hypergrid asset service"); return; } m_LocalAssetServiceURI = assetConfig.GetString("AssetServerURI", string.Empty); if (m_LocalAssetServiceURI == string.Empty) { IConfig netConfig = source.Configs["Network"]; m_LocalAssetServiceURI = netConfig.GetString("asset_server_url", string.Empty); } if (m_LocalAssetServiceURI != string.Empty) { m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/'); } IConfig hgConfig = source.Configs["HGAssetService"]; m_AssetPerms = new AssetPermissions(hgConfig); // it's ok if arg is null m_Enabled = true; m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled"); } } }
public void Initialise(IConfigSource source) { IConfig moduleConfig = source.Configs["Modules"]; if (moduleConfig != null) { string name = moduleConfig.GetString("AssetServices", ""); if (name == Name) { IConfig assetConfig = source.Configs["AssetService"]; if (assetConfig == null) { m_log.Error("[REGIONASSETCONNECTOR]: AssetService missing from configuration files"); throw new Exception("Region asset connector init error"); } string localGridConnector = assetConfig.GetString("LocalGridAssetService", string.Empty); if (string.IsNullOrEmpty(localGridConnector)) { m_log.Error("[REGIONASSETCONNECTOR]: LocalGridAssetService missing from configuration files"); throw new Exception("Region asset connector init error"); } object[] args = new object[] { source }; m_localConnector = ServerUtils.LoadPlugin <IAssetService>(localGridConnector, args); if (m_localConnector == null) { m_log.Error("[REGIONASSETCONNECTOR]: Fail to load local asset service " + localGridConnector); throw new Exception("Region asset connector init error"); } string HGConnector = assetConfig.GetString("HypergridAssetService", string.Empty); if (!string.IsNullOrEmpty(HGConnector)) { m_HGConnector = ServerUtils.LoadPlugin <IAssetService>(HGConnector, args); if (m_HGConnector == null) { m_log.Error("[REGIONASSETCONNECTOR]: Fail to load HG asset service " + HGConnector); throw new Exception("Region asset connector init error"); } IConfig hgConfig = source.Configs["HGAssetService"]; if (hgConfig != null) { m_AssetPerms = new AssetPermissions(hgConfig); } } //m_sendRetries = new List<AssetBase>[MAXSENDRETRIESLEN]; //m_sendCachedRetries = new List<string>[MAXSENDRETRIESLEN]; //m_retryTimer = new System.Timers.Timer(); //m_retryTimer.Elapsed += new ElapsedEventHandler(retryCheck); //m_retryTimer.AutoReset = true; //m_retryTimer.Interval = 60000; m_fetchThreads = new Thread[2]; for (int i = 0; i < m_fetchThreads.Length; i++) { m_fetchThreads[i] = WorkManager.StartThread(AssetRequestProcessor, string.Format("GetAssetsWorker{0}", i)); } m_Enabled = true; m_log.Info("[REGIONASSETCONNECTOR]: enabled"); } } }