public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
            switch (targetType.FullName)
            {
                case FileManager:
                    String storeID = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDatabase));

                    if (storeID != null)
                    {
                        //Supports using dnr:loadMode to specify the indexes to be used
                        String indices = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyLoadMode));
                        if (indices == null)
                        {
                            obj = new AlexandriaFileManager(ConfigurationLoader.ResolvePath(storeID));
                        }
                        else
                        {
                            obj = new AlexandriaFileManager(ConfigurationLoader.ResolvePath(storeID), this.ParseIndexTypes(indices));
                        }
                        return true;
                    }

                    //If we get here then the required dnr:database property was missing
                    throw new DotNetRdfConfigurationException("Unable to load the File Manager identified by the Node '" + objNode.ToString() + "' since there was no value given for the required property dnr:database");
                    break;

                case FileDataset:
                    INode managerNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, "dnr:genericManager"));
                    if (managerNode == null)
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the File Dataset identified by the Node '" + objNode.ToString() + "' since there we no value for the required property dnr:genericManager");
                    }

                    Object temp = ConfigurationLoader.LoadObject(g, managerNode);
                    if (temp is AlexandriaFileManager)
                    {
                        obj = new AlexandriaFileDataset((AlexandriaFileManager)temp);
                        return true;
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the File Dataset identified by the Node '" + objNode.ToString() + "' since the value for the dnr:genericManager property pointed to an Object which could not be loaded as an object of type AlexandriaFileManager");
                    }

                    break;
            }

            obj = null;
            return false;
        }
Beispiel #2
0
        public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
            switch (targetType.FullName)
            {
                case FileManager:
                    String storeID = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDatabase));

                    if (storeID != null)
                    {
                        //Supports using dnr:loadMode to specify the indexes to be used
                        String indices = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyLoadMode));
                        if (indices == null)
                        {
                            obj = new AlexandriaFileManager(ConfigurationLoader.ResolvePath(storeID));
                        }
                        else
                        {
                            obj = new AlexandriaFileManager(ConfigurationLoader.ResolvePath(storeID), this.ParseIndexTypes(indices));
                        }
                        return true;
                    }

                    //If we get here then the required dnr:database property was missing
                    throw new DotNetRdfConfigurationException("Unable to load the File Manager identified by the Node '" + objNode.ToString() + "' since there was no value given for the required property dnr:database");
                    break;

                case FileDataset:
                    INode managerNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, "dnr:genericManager"));
                    if (managerNode == null)
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the File Dataset identified by the Node '" + objNode.ToString() + "' since there we no value for the required property dnr:genericManager");
                    }

                    Object temp = ConfigurationLoader.LoadObject(g, managerNode);
                    if (temp is AlexandriaFileManager)
                    {
                        obj = new AlexandriaFileDataset((AlexandriaFileManager)temp);
                        return true;
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the File Dataset identified by the Node '" + objNode.ToString() + "' since the value for the dnr:genericManager property pointed to an Object which could not be loaded as an object of type AlexandriaFileManager");
                    }

                    break;
            }

            obj = null;
            return false;
        }
Beispiel #3
0
 public AlexandriaFileDataset(AlexandriaFileManager manager)
     : base(manager)
 {
     this._fileManager = manager;
 }
Beispiel #4
0
 public FileEnumerator(AlexandriaFileManager manager)
 {
     this._manager = manager;
 }