Package de.innovationgate.wgpublisher.plugins

Examples of de.innovationgate.wgpublisher.plugins.WGAPlugin


       
       
        List<String> designs = new ArrayList<String>();
        Iterator<WGAPlugin> plugins = _core.getPluginSet().getPlugins().iterator();
        while (plugins.hasNext()) {
            WGAPlugin plugin = (WGAPlugin) plugins.next();
            if (plugin.isActive() && plugin.isValid() && plugin.getCsConfig().getPluginConfig().isUsageAsDesignProvider()) {
                WGDatabase db = _core.getContentdbs().get(plugin.buildDatabaseKey());
                if (db != null) {
                    designs.add(plugin.getInstallationKey());
                }
            }
        }
       
        return designs;
View Full Code Here


    }

    public PluginDesignProvider createDesignProvider(WGADesign design, WGDatabase db, Map<String, String> options) throws WGADesignConfigurationException {
       
        try {
            WGAPlugin plugin = getPlugin(design);
            PluginDesignProvider designProvider = new PluginDesignProvider(design.createDesignReference(), _core, db, plugin.buildDatabaseKey(), options);
            return designProvider;
        }
        catch (WGADesignConfigurationException e) {
            throw e;
        }
View Full Code Here

       
       
    }

    private WGAPlugin getPlugin(WGADesign design) throws WGADesignConfigurationException {
        WGAPlugin plugin = _core.getPluginSet().getPluginsByInstallationKey().get(design.getName());
        if (plugin == null) {
            throw new WGADesignConfigurationException("Cannot find plugin with installation key " + design.getName());
        }
        return plugin;
    }
View Full Code Here

        return PluginDesignProvider.class;
    }

    public WGADesign getDesign(String name) throws WGADesignRetrievalException {
       
        WGAPlugin plugin = _core.getPluginSet().getPluginsByInstallationKey().get(name);
        if (plugin == null || !(plugin.isActive() && plugin.isValid() && plugin.getCsConfig().getPluginConfig().isUsageAsDesignProvider())) {
            return null;
        }
           
        WGDatabase db = _core.getContentdbs().get(plugin.buildDatabaseKey());
        if (db == null) {
            return null;
        }
       
        WGADesign design = new WGADesign();
        design.setSource(this);
        design.setName(plugin.getInstallationKey());
        design.setTitle(plugin.getCsConfig().getPluginConfig().getTitle());
        design.setDescription(plugin.getCsConfig().getPluginConfig().getDescription());
        design.setConfig(plugin.getCsConfig());
        return design;
       
    }
View Full Code Here

            // First connect all mandatory plugins
            try {

                Iterator mandatoryPlugins = plugin.getMandatoryPlugins().values().iterator();
                while (mandatoryPlugins.hasNext()) {
                    WGAPlugin mandatoryPlugin  = (WGAPlugin) mandatoryPlugins.next();
                    connectPlugin(mandatoryPlugin, domainConfigs);
                }
            }
            // A mandatory plugin is invalid. Cancel connect.
            catch (InvalidPluginException e) {
                throw e;
            }
  
            logCategoryInfo("Plugin " + plugin.getInstallationKey(), 2);
           
            // Mandatory db options (for plugins)
            Map<String, String> dbOptions = new HashMap<String, String>();
            dbOptions.put(WGDatabase.COPTION_DBREFERENCE, dbKey.toLowerCase());
            dbOptions.put(WGDatabase.COPTION_READERPROFILECREATION, "true");
            dbOptions.put(WGDatabase.COPTION_USERCACHELATENCY, String.valueOf(_wgaConfiguration.getUserCacheLatencyMinutes()));
           
            // We try to automatically migrate plugin content stores to CS5 format
            dbOptions.put(WGDatabase.COPTION_CONTENT_STORE_VERSION, String.valueOf(WGDatabase.CSVERSION_WGA5));
           
            // Clear the plugin database before connecting if the plugin is updated and should clear the db on update
            if (plugin.getRuntimeContext().isUpdated()) {
                if (plugin.getCsConfig().getPluginConfig() instanceof de.innovationgate.wga.common.beans.csconfig.v3.PluginConfig) {
                    de.innovationgate.wga.common.beans.csconfig.v3.PluginConfig v3Config = (de.innovationgate.wga.common.beans.csconfig.v3.PluginConfig) plugin.getCsConfig().getPluginConfig();
                    if (v3Config.isClearDatabaseOnUpdate()) {
                        getLog().info("Clearing plugin database for installation key " + plugin.getInstallationKey());
                        plugin.getParent().deletePluginDatabase(plugin);
                    }
                }
                plugin.getRuntimeContext().setUpdated(false);
            }
           
            // Connect
            getLog().info("Connecting plugin " + plugin.getPluginID().getUniqueName() + " Version " + plugin.getPluginID().getVersion().toString());
              
            try {
                db = WGFactory.getInstance().openDatabase(null, de.innovationgate.webgate.api.hsql.WGDatabaseImpl.class.getName(), plugin.buildDatabasePath(), null, null, dbOptions);
            }
            catch (Throwable e1) {
                throw new InvalidPluginException(plugin, "Could not connect plugin \"" + plugin.getPluginID().getUniqueName() + "\"", e1);
            }

            if (db == null || !db.isSessionOpen()) {
                throw new InvalidPluginException(plugin, "Could not connect plugin \"" + plugin.getPluginID().getUniqueName() + "\" - Check logged messages above for error details");
            }

            try {
                db.getSessionContext().setTask("Initializing database in WGA");
               
                // Plugin dbs are always CS5 since they are automatically migrated
                //getLog().info("Database of plugin " + plugin.getPluginID().getUniqueName() + " is content store version " + db.getContentStoreVersion());
               
                PluginConfig pc = plugin.getCsConfig().getPluginConfig();
                String auth = pc.getAuthentication();
                db.setTitle(pc.getTitle());
               
               
                // Set mandatory database attributes
                initializeDBAttributes(db, dbKey, dbKey, new HashSet());
               
                // Create authentication
                if (auth != null) {
                    String authImplClass = null;
                    Map<String,String> authOptions = new HashMap<String, String>();
                   
                    // Delegate authentication to the default domain
                    if (auth.equals(PluginConfig.AUTHSOURCE_DEFAULT_DOMAIN)) {
                        authImplClass = WGAAuthModuleFactory.AUTHMODULE_DELEGATE;
                        authOptions.put(DelegatingAuthModule.COPTION_DOMAIN, "default");
                    }
                    // Use some plugin for authentication
                    else {
                        WGAPlugin authPlugin = plugin.getParent().getPluginByUniqueName(auth);
                    if (authPlugin != null) {
                        authImplClass = CSAuthModule.class.getName();
                        authOptions.put(CSAuthModule.COPTION_DBKEY, authPlugin.buildDatabaseKey());
                    }
                    else {
                            getLog().error("Unable to find authentication plugin " + auth);
                        }
                    }
View Full Code Here

TOP

Related Classes of de.innovationgate.wgpublisher.plugins.WGAPlugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.