Example #1
0
        public void test1() {

            Assert.False(persistenceDriver.GetPluginInterfacesNames().Count() > 0);
            Assert.False(persistenceDriver.ExistPluginInterface("test"));

            persistenceDriver.AddPluginInterface("test");

            Assert.True(persistenceDriver.GetPluginInterfacesNames().Count() > 0);
            Assert.True(persistenceDriver.ExistPluginInterface("test"));
            Assert.False(persistenceDriver.ExistPluginImplementation("test", "local:test"));

            persistenceDriver.AddPluginImplementation("test", "local:test");

            Assert.True(persistenceDriver.GetPluginImplementationsAddresses("test").Count() > 0);
            Assert.True(persistenceDriver.ExistPluginInterface("test"));
            Assert.True(persistenceDriver.ExistPluginImplementation("test", "local:test"));
            Assert.False(persistenceDriver.ExistPluginImplementation("test", "local:test2"));

            persistenceDriver.RemovePluginImplementation("test", "local:test");

            Assert.True(persistenceDriver.GetPluginInterfacesNames().Count() > 0);
            Assert.False(persistenceDriver.GetPluginImplementationsAddresses("test").Count() > 0);
            Assert.True(persistenceDriver.ExistPluginInterface("test"));
            Assert.False(persistenceDriver.ExistPluginImplementation("test", "local:test"));
            
            persistenceDriver.RemovePluginInterface("test");

            Assert.False(persistenceDriver.GetPluginInterfacesNames().Count() > 0);
            Assert.False(persistenceDriver.ExistPluginInterface("test"));

        }// END Method test1
        }    // END Property RemovePluginInterface

        public bool ExistPluginInterface(string pluginInterfaceName)
        {
            if (readWritePersistenceDriver.ExistPluginInterface(pluginInterfaceName))
            {
                return(true);
            }

            foreach (IPersistenceDriver driver in readOnlyPersistenceDrivers)
            {
                if (driver.ExistPluginInterface(pluginInterfaceName))
                {
                    return(true);
                }
            }

            return(false);
        }    // END Property ExistPluginInterface
Example #3
0
        }// END Method UnregisterSingletonPlugin

        public void UnregisterSingletonPlugin(Type pluginInterfaceClass, IPersistenceDriver persistenceDriver)
        {
            if (persistenceDriver.ExistPluginInterface(pluginInterfaceClass.AssemblyQualifiedName))
            {
                foreach (string implementationAddress in new List <string>(persistenceDriver.GetPluginImplementationsAddresses(pluginInterfaceClass.AssemblyQualifiedName)))
                {
                    persistenceDriver.RemovePluginImplementation(pluginInterfaceClass.AssemblyQualifiedName, implementationAddress);
                }

                persistenceDriver.RemovePluginInterface(pluginInterfaceClass.AssemblyQualifiedName);
            }
        }// END Method UnregisterSingletonPlugin
Example #4
0
        }// END Method UnregisterPlugin

        public void UnregisterPlugin(Type pluginInterfaceClass, string pluginImplementationAddress, IPersistenceDriver persistenceDriver)
        {
            if (persistenceDriver.ExistPluginInterface(pluginInterfaceClass.AssemblyQualifiedName) &&
                persistenceDriver.ExistPluginImplementation(pluginInterfaceClass.AssemblyQualifiedName, pluginImplementationAddress))
            {
                persistenceDriver.RemovePluginImplementation(pluginInterfaceClass.AssemblyQualifiedName, pluginImplementationAddress);

                if (!persistenceDriver.GetPluginImplementationsAddresses(pluginInterfaceClass.AssemblyQualifiedName).GetEnumerator().MoveNext())
                {
                    persistenceDriver.RemovePluginInterface(pluginInterfaceClass.AssemblyQualifiedName);
                }
            }
        }// END Method UnregisterPlugin
Example #5
0
        }// END Method RegisterPlugin

        public void RegisterPlugin(Type pluginInterfaceClass, string pluginImplementationAddress, IPersistenceDriver persistenceDriver)
        {
            if (!persistenceDriver.ExistPluginInterface(pluginInterfaceClass.AssemblyQualifiedName))
            {
                persistenceDriver.AddPluginInterface(pluginInterfaceClass.AssemblyQualifiedName);
            }

            if (!persistenceDriver.ExistPluginImplementation(pluginInterfaceClass.AssemblyQualifiedName, pluginImplementationAddress))
            {
                persistenceDriver.AddPluginImplementation(pluginInterfaceClass.AssemblyQualifiedName, pluginImplementationAddress);

                if (Configuration.PermissionsManager.AutoExposeLocalPlugins)
                {
                    Configuration.PermissionsManager.RescanAutoExposedLocalPlugins();
                }
            }
        }// END Method RegisterPlugin