public PostgreSQLGridService(IConfig ownSection) { m_UseRegionDefaultServices = ownSection.GetBoolean("UseRegionDefaultServices", true); m_EnableOnConflict = ownSection.GetBoolean("EnableOnConflict", true); m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); m_TableName = ownSection.GetString("TableName", "regions"); }
public PostgreSQLSimulationDataStorage(IConfig ownSection) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); m_EnableOnConflict = ownSection.GetBoolean("EnableOnConflict", true); m_WhiteListStorage = new PostgreSQLSimulationDataParcelAccessListStorage(m_ConnectionString, "parcelaccesswhitelist", m_EnableOnConflict); m_BlackListStorage = new PostgreSQLSimulationDataParcelAccessListStorage(m_ConnectionString, "parcelaccessblacklist", m_EnableOnConflict); m_LandpassListStorage = new PostgreSQLSimulationDataParcelAccessListStorage(m_ConnectionString, "parcellandpasslist", m_EnableOnConflict); }
public PostgreSQLMaptileService(IConfig ownSection) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); m_EnableOnConflict = ownSection.GetBoolean("EnableOnConflict", true); }
public override void RegisterRegion(RegionInfo regionInfo, bool keepOnlineUnmodified) { foreach (RegionDefaultFlagsServiceInterface service in m_RegionDefaultServices) { regionInfo.Flags |= service.GetRegionDefaultFlags(regionInfo.ID); } using (var conn = new NpgsqlConnection(m_ConnectionString)) { conn.Open(); if (!m_AllowDuplicateRegionNames) { using (var cmd = new NpgsqlCommand("SELECT \"uuid\" FROM " + m_TableName + " WHERE \"regionName\" = @name LIMIT 1", conn)) { cmd.Parameters.AddParameter("@name", regionInfo.Name); using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) { if (dbReader.Read() && dbReader.GetUUID("uuid") != regionInfo.ID) { throw new GridRegionUpdateFailedException("Duplicate region name"); } } } } if (keepOnlineUnmodified) { using (var cmd = new NpgsqlCommand("SELECT \"flags\" FROM " + m_TableName + " WHERE \"uuid\" = @id LIMIT 1", conn)) { cmd.Parameters.AddParameter("@id", regionInfo.ID); using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) { if (dbReader.Read()) { RegionFlags flags = dbReader.GetEnum <RegionFlags>("flags"); regionInfo.Flags &= ~RegionFlags.RegionOnline; regionInfo.Flags |= (flags & RegionFlags.RegionOnline); } } } } /* we have to give checks for all intersection variants */ using (var cmd = new NpgsqlCommand("SELECT \"uuid\" FROM " + m_TableName + " WHERE (" + "(\"locX\" >= @minx AND \"locY\" >= @miny AND \"locX\" < @maxx AND \"locY\" < @maxy) OR " + "(\"locX\" + \"sizeX\" > @minx AND \"locY\"+\"sizeY\" > @miny AND \"locX\" + \"sizeX\" < @maxx AND \"locY\" + \"sizeY\" < @maxy)" + ") AND (NOT \"uuid\" = @regionid) LIMIT 1", conn)) { cmd.Parameters.AddParameter("@min", regionInfo.Location); cmd.Parameters.AddParameter("@max", regionInfo.Location + regionInfo.Size); cmd.Parameters.AddParameter("@regionid", regionInfo.ID); using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) { if (dbReader.Read() && dbReader.GetUUID("uuid") != regionInfo.ID) { throw new GridRegionUpdateFailedException("Overlapping regions"); } } } var regionData = new Dictionary <string, object> { ["uuid"] = regionInfo.ID, ["regionName"] = regionInfo.Name, ["loc"] = regionInfo.Location, ["size"] = regionInfo.Size, ["regionName"] = regionInfo.Name, ["serverIP"] = regionInfo.ServerIP, ["serverHttpPort"] = regionInfo.ServerHttpPort, ["serverURI"] = regionInfo.ServerURI, ["serverPort"] = regionInfo.ServerPort, ["regionMapTexture"] = regionInfo.RegionMapTexture, ["parcelMapTexture"] = regionInfo.ParcelMapTexture, ["access"] = regionInfo.Access, ["regionSecret"] = regionInfo.RegionSecret, ["owner"] = regionInfo.Owner, ["AuthenticatingToken"] = regionInfo.AuthenticatingToken, ["AuthenticatingPrincipalID"] = regionInfo.AuthenticatingPrincipal, ["flags"] = regionInfo.Flags, ["ProductName"] = regionInfo.ProductName }; PostgreSQLUtilities.ReplaceInto(conn, m_TableName, regionData, new string[] { "uuid" }, m_EnableOnConflict); } }
public PostgreSQLGroupsService(IConfig ownSection) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); m_AvatarNameServiceNames = ownSection.GetString("AvatarNameServices", "AvatarNameStorage"); m_EnableOnConflict = ownSection.GetBoolean("EnableOnConflict", true); }
public PostgreSQLRegionDefaultFlagsService(IConfig ownSection) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); }
public PostgreSQLMuteListService(IConfig ownConfig) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownConfig, m_Log); m_EnableOnConflict = ownConfig.GetBoolean("EnableOnConflict", true); }
public PostgreSQLUserAccountNameService(IConfig ownSection) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); }
public PostgreSQLOfflineIMService(IConfig ownSection) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); }
public PostgreSQLInventoryService(IConfig ownSection) { m_InventoryItemTable = ownSection.GetString("ItemTable", "inventoryitems"); m_InventoryFolderTable = ownSection.GetString("FolderTable", "inventoryfolders"); m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); m_EnableOnConflict = ownSection.GetBoolean("EnableOnConflict", true); m_ContentService = new DefaultInventoryFolderContentService(this); /* renaming of tables for NPCs required so creating those on the fly */ Migrations = new IMigrationElement[] { new SqlTable(m_InventoryFolderTable), new AddColumn <UUID>("ID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <UUID>("ParentFolderID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <UUID>("OwnerID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <string>("Name") { Cardinality = 64, IsNullAllowed = false, Default = string.Empty }, new AddColumn <InventoryType>("InventoryType") { IsNullAllowed = false, Default = InventoryType.Unknown }, new AddColumn <int>("Version") { IsNullAllowed = false, Default = 0 }, new PrimaryKeyInfo("ID"), new NamedKeyInfo("inventoryfolders_owner_index", "OwnerID"), new NamedKeyInfo("inventoryfolders_owner_folderid", "OwnerID", "ParentFolderID"), new NamedKeyInfo("inventoryfolders_owner_type", "OwnerID", "InventoryType"), new TableRevision(2), new ChangeColumn <AssetType>("DefaultType") { IsNullAllowed = false, Default = AssetType.Unknown, OldName = "InventoryType" }, new SqlTable(m_InventoryItemTable), new AddColumn <UUID>("ID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <UUID>("ParentFolderID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <string>("Name") { Cardinality = 64, IsNullAllowed = false, Default = string.Empty }, new AddColumn <string>("Description") { Cardinality = 128, IsNullAllowed = false, Default = string.Empty }, new AddColumn <InventoryType>("InventoryType") { IsNullAllowed = false, Default = InventoryType.Unknown }, new AddColumn <InventoryFlags>("Flags") { IsNullAllowed = false, Default = InventoryFlags.None }, new AddColumn <UUID>("OwnerID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <UUID>("LastOwnerID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <UUID>("CreatorID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <Date>("CreationDate") { IsNullAllowed = false, Default = Date.UnixTimeToDateTime(0) }, new AddColumn <InventoryPermissionsMask>("BasePermissionsMask") { IsNullAllowed = false, Default = InventoryPermissionsMask.None }, new AddColumn <InventoryPermissionsMask>("CurrentPermissionsMask") { IsNullAllowed = false, Default = InventoryPermissionsMask.None }, new AddColumn <InventoryPermissionsMask>("EveryOnePermissionsMask") { IsNullAllowed = false, Default = InventoryPermissionsMask.None }, new AddColumn <InventoryPermissionsMask>("NextOwnerPermissionsMask") { IsNullAllowed = false, Default = InventoryPermissionsMask.None }, new AddColumn <InventoryPermissionsMask>("GroupPermissionsMask") { IsNullAllowed = false, Default = InventoryPermissionsMask.None }, new AddColumn <int>("SalePrice") { IsNullAllowed = false, Default = 10 }, new AddColumn <InventoryItem.SaleInfoData.SaleType>("SaleType") { IsNullAllowed = false, Default = InventoryItem.SaleInfoData.SaleType.NoSale }, new AddColumn <InventoryPermissionsMask>("SalePermissionsMask") { IsNullAllowed = false, Default = InventoryPermissionsMask.None }, new AddColumn <UUID>("GroupID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <bool>("IsGroupOwned") { IsNullAllowed = false, Default = false }, new AddColumn <UUID>("AssetID") { IsNullAllowed = false, Default = UUID.Zero }, new AddColumn <AssetType>("AssetType") { IsNullAllowed = false, Default = AssetType.Unknown }, new PrimaryKeyInfo("ID"), new NamedKeyInfo("inventoryitems_OwnerID", "OwnerID"), new NamedKeyInfo("inventoryitems_OwnerID_ID", "OwnerID", "ID"), new NamedKeyInfo("inventoryitems_OwnerID_ParentFolderID", "OwnerID", "ParentFolderID"), }; }
public PostgreSQLAssetService(ConfigurationLoader loader, IConfig ownSection) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); m_EnableOnConflict = ownSection.GetBoolean("EnableOnConflict", true); m_ReferencesService = new PostgreSQLAssetReferencesService(this); }
public PostgreSQLFriendsService(IConfig ownSection) { m_ConnectionString = PostgreSQLUtilities.BuildConnectionString(ownSection, m_Log); m_EnableOnConflict = ownSection.GetBoolean("EnableOnConflict", true); m_AvatarNameServiceNames = ownSection.GetString("AvatarNameServices", string.Empty).Split(','); }