internal static IStorageDiscoverer Create(string providerName) { if (string.IsNullOrEmpty(providerName)) { providerName = "local"; } return((IStorageDiscoverer)Activator.CreateInstance( PluginsDiscoverer.Instance().Plugins[providerName].RawType )); /*switch (providerName.ToLower()){ * //case "vmware": * // return new VMWareDisksDiscoverer(); * case "local":case "fs":case null: * if(Utilities.PlatForm.Instance().OS.ToLower() == "linux") * return new LinuxStorageDiscoverer(); * else if(Utilities.PlatForm.Instance().OS.ToLower().StartsWith("nt")) * return new NTStorageDiscoverer(); * else return new FallbackDiscoverer(); * default: * Logger.Append(Severity.ERROR, "Cannot select storage type'"+providerName+"' (doesn't exist or plugin not loaded)"); * return null; * * }*/ }
public static List <string> ListAvailableProviders() { /*List<string> providers = new List<string>(); * if(!Utilities.PlatForm.IsUnixClient()) * providers.Add("VSS"); * providers.Add("VMWARE"); * providers.Add ("VMWare VM configuration"); * providers.Add("MYSQL"); * providers.Add("LIBVIRT"); * return providers;*/ //var plugNames = from Plugin p in PluginsDiscoverer.Instance().Plugins.Values where p.Category == PluginCategory.ISpecialObject select p.Name; return((from Plugin p in PluginsDiscoverer.Instance().GetPlugins <ISpecialObject>() select p.Name).ToList()); }
/*public SPOProvider (){ * }*/ public static ISpecialObject GetByCategory(string objectName, Backup backup, P2PBackup.Common.BackupLevel level, ProxyTaskInfo pti) { /*switch(objectName){ * case "VSS": * return new VSS(level); * case "VMWare VM configuration": * return new VMWareVmConfig(pti); * case "StorageLayout": * return new StorageLayoutSPO(backup.StorageLayout); * * default: * throw new Exception("No Special object matching category '"+objectName+"'");*/ return((ISpecialObject)Activator.CreateInstance(PluginsDiscoverer.Instance().Plugins[objectName].RawType)); }
//public delegate void StorageSessionReceivedHandler (Session storageSession/*, int budget*/); //public static event StorageSessionReceivedHandler SessionReady;//BackupManager consume public User() { //backupsList = new List<Backup>(); //PluginsDiscoverer pd = PluginsDiscoverer.Instance(); this.LastReceivedAction = DateTime.Now; PluginsDiscoverer.Instance().LogEvent += HandleLogEvent; PluginsDiscoverer.Instance().Start(); currentJobs = new Dictionary <long, BackupManager>(); pendingHubMessages = new Queue <string>(); this.Version = Utilities.PlatForm.Instance().NodeVersion; this.OS = Utilities.PlatForm.Instance().OS; this.HostName = Environment.MachineName; this.Plugins = PluginsDiscoverer.Instance().Plugins.Values.ToList(); Console.WriteLine("User() : found " + this.Plugins.Count + " plugins"); }