/// <summary> Constructor for a new instance of the Oai_MainWriter class </summary> /// <param name="RequestSpecificValues"> All the necessary, non-global data specific to the current request </param> /// <param name="Query_String"> URL Query string to parse for OAI-PMH verbs and other values </param> public Oai_MainWriter(NameValueCollection Query_String, RequestCache RequestSpecificValues) : base(RequestSpecificValues) { // Build list of valid arguments validArgs = new List<string> { "from", "until", "metadataPrefix", "set", "resumptionToken", "identifier", "verb", "portal", "urlrelative" }; // Load the list of OAI sets oaiSets = SobekCM_Database.Get_OAI_Sets(); queryString = Query_String; // Set the response type HttpContext.Current.Response.ContentType = "text/xml"; // Determine some global settings if (UI_ApplicationCache_Gateway.Configuration.OAI_PMH != null) { config = UI_ApplicationCache_Gateway.Configuration.OAI_PMH; oai_resource_identifier_base = UI_ApplicationCache_Gateway.Configuration.OAI_PMH.Identifier_Base; oai_repository_name = UI_ApplicationCache_Gateway.Configuration.OAI_PMH.Name; oai_repository_identifier = UI_ApplicationCache_Gateway.Configuration.OAI_PMH.Identifier; } else { config = new OAI_PMH_Configuration(); config.Set_Default(); config.Enabled = true; } if (String.IsNullOrEmpty(oai_resource_identifier_base)) oai_resource_identifier_base = "oai:" + UI_ApplicationCache_Gateway.Settings.System.System_Abbreviation + ":"; if (String.IsNullOrEmpty(oai_repository_name)) oai_repository_name = UI_ApplicationCache_Gateway.Settings.System.System_Name; if (String.IsNullOrEmpty(oai_repository_identifier)) oai_repository_identifier = UI_ApplicationCache_Gateway.Settings.System.System_Abbreviation; // Get the list of metadata prefixes permissiable by the system metadataPrefixes = new List<string>(); foreach (OAI_PMH_Metadata_Format thisConfig in config.Metadata_Prefixes) { metadataPrefixes.Add(thisConfig.Prefix); } }
/// <summary> Constructor for a new instance of the InstanceWide_Configuration class </summary> public InstanceWide_Configuration() { // Create some of the configuration stuff Authentication = new Authentication_Configuration(); BriefItemMapping = new BriefItemMapping_Configuration(); ContactForm = new ContactForm_Configuration(); Engine = new Engine_Server_Configuration(); Extensions = new Extension_Configuration(); QualityControlTool = new QualityControl_Configuration(); Metadata = new Metadata_Configuration(); OAI_PMH = new OAI_PMH_Configuration(); UI = new InstanceWide_UI_Configuration(); Source = new Configuration_Source_Info(); // Set some defaults HasData = false; }
private static void read_oai_details_metadataPrefixes(XmlReader readerXml, OAI_PMH_Configuration config) { while (readerXml.Read()) { if (readerXml.NodeType == XmlNodeType.Element) { switch (readerXml.Name.ToLower()) { case "clear": config.Clear_Metadata_Prefixes(); break; case "metadataformat": OAI_PMH_Metadata_Format component = new OAI_PMH_Metadata_Format(); if (readerXml.MoveToAttribute("Prefix")) component.Prefix = readerXml.Value.Trim(); if (readerXml.MoveToAttribute("Schema")) component.Schema = readerXml.Value.Trim(); if (readerXml.MoveToAttribute("MetadataNamespace")) component.MetadataNamespace = readerXml.Value.Trim(); if (readerXml.MoveToAttribute("Assembly")) component.Assembly = readerXml.Value.Trim(); if (readerXml.MoveToAttribute("Namespace")) component.Namespace = readerXml.Value.Trim(); if (readerXml.MoveToAttribute("Class")) component.Class = readerXml.Value.Trim(); if ((readerXml.MoveToAttribute("Enabled")) && (readerXml.Value.Trim().ToLower() == "false")) component.Enabled = false; if ((!String.IsNullOrEmpty(component.Prefix)) && (!String.IsNullOrEmpty(component.Schema)) && (!String.IsNullOrEmpty(component.MetadataNamespace)) && (!String.IsNullOrEmpty(component.Class))) { config.Add_Metadata_Prefix(component); } break; } } } }
private static void read_oai_details_identify(XmlReader readerXml, OAI_PMH_Configuration config, bool baseSpecified) { while (readerXml.Read()) { if (readerXml.NodeType == XmlNodeType.Element) { switch (readerXml.Name.ToLower()) { case "name": readerXml.Read(); config.Name = readerXml.Value.Trim(); break; case "identifier": readerXml.Read(); config.Identifier = readerXml.Value.Trim(); if (!baseSpecified) config.Identifier_Base = "oai:" + config.Identifier.ToLower() + ":"; break; case "adminemail": readerXml.Read(); config.Add_Admin_Email(readerXml.Value.Trim()); break; case "description": readerXml.Read(); config.Add_Description(readerXml.Value.Trim()); break; } } } }