Package de.innovationgate.wga.modules

Examples of de.innovationgate.wga.modules.ModuleDefinition


        return false;
    }

    public WGDatabase openDatabase(Class<? extends WGDatabaseCore> implClass, WGDatabaseServer dbServer, Map<String, String> options, boolean prepareOnly) throws WGAPIException {
        try {
            ModuleDefinition serverDef = WGFactory.getModuleRegistry().getModuleDefinition(DatabaseServerModuleType.class, getDatabaseServerType());
            OptionReader serverOptionReader = OptionReader.create(dbServer.getOptions(), serverDef);
           
            String masterUser = (String) serverOptionReader.readOptionValueOrDefault(DatabaseServer.OPTION_MASTERLOGIN_USER);
            String masterPassword = (String) serverOptionReader.readOptionValueOrDefault(DatabaseServer.OPTION_MASTERLOGIN_PASSWORD);
           
View Full Code Here


        Iterator<ModuleDefinition> scalerModules = core.getModuleRegistry().getModulesForType(ImageScalerModuleType.class).values().iterator();
        if (!scalerModules.hasNext()) {
            throw new WGNotSupportedException("No image scaler implementation available");
        }
       
        ModuleDefinition scalerDef = scalerModules.next();
        ImageScaler scaler = (ImageScaler) core.getModuleRegistry().instantiate(scalerDef);
        return scaler;
    }
View Full Code Here

        ImageScaler scaler = (ImageScaler) core.getModuleRegistry().instantiate(scalerDef);
        return scaler;
    }
   
    public static MimeTypeSpecificImageScaler createMimeTypeSpecificImageScaler(WGACore core, String mimeType) throws WGNotSupportedException, ModuleInstantiationException {
        ModuleDefinition scalerDef = core.getModuleRegistry().getModuleDefinitionByKey(MimeTypeSpecificImageScalerModuleType.class, mimeType);
        if (scalerDef == null) {
            throw new WGNotSupportedException("No image scaler implementation available for mimetype " + mimeType);
        }
       
        MimeTypeSpecificImageScaler scaler = (MimeTypeSpecificImageScaler) core.getModuleRegistry().instantiate(scalerDef);
View Full Code Here

        _core = core;

        // Initialize singleton design sources
        Iterator<ModuleDefinition> singletons = core.getModuleRegistry().getModulesForType(DesignSourceModuleType.class).values().iterator();
        while (singletons.hasNext()) {
            ModuleDefinition sourceDefinition = singletons.next();
            try {
                sourceDefinition.testDependencies();
                final DesignSourceProperties properties = (DesignSourceProperties) sourceDefinition.getProperties();
                if (properties != null && properties.isSingleton()) {
                    try {
                        LocalizedInformation locInfo = new LocalizedInformation() {
                           
                            public String getTitle(Locale locale) {
                                return properties.getSingletonTitle(locale);
                            }
                           
                            public String getDescription(Locale locale) {
                                return properties.getSingletonDescription(locale);
                            }
                        };
                       
                        WGADesignSource designSource = (WGADesignSource) core.getModuleRegistry().instantiate(sourceDefinition);
                        designSource.init(_core, properties.getSingletonUID(), locInfo, new HashMap<String,String>());
                        core.getLog().info("Registering design source '" + designSource.getTitle(Locale.getDefault()) + "' (Automatically created)");
                        _designSources.put(properties.getSingletonUID(), designSource);
                    }
                    catch (Exception e) {
                        core.getLog().error("Exception registering design source " + sourceDefinition.getTitle(Locale.getDefault()), e);
                    }
                }
            }
            catch (ModuleDependencyException e) {
                core.getLog().warn("Design source " + sourceDefinition.getTitle(Locale.getDefault()) + " deactivated in current WGA runtime: " + e.getMessage());
            }
        }
       
       
        // Initialize configured design sources
View Full Code Here

   
        }
       
        public Object readOptionValueOrDefault(String optionName) {
            Map<String,String> options = (Map<String,String>) _jxPath.getValue(JXPathContext.newContext(getWgaConfiguration()));
            ModuleDefinition modDef = getModuleRegistry().getModuleDefinition(_typeClass, _implClass);
            if (modDef == null) {
                getLog().error("Cannot read module definition " + _typeClass.getName() + "/" + _implClass.getName());
                return null;
            }
           
           
            try {
                return getWgaConfiguration().getCachingOptionReader().readOptionValueOrDefault(options, optionName, modDef);
            }
            catch (OptionConversionException e) {
                getLog().error("Exception reading server option '" + optionName + "'. Falling back to default", e);
                OptionDefinition optDef = modDef.getOptionDefinitions().get(optionName);
                if (optDef != null) {
                    try {
                        return OptionReader.unconvertOptionValue(optDef, optDef.getDefaultValue());
                    }
                    catch (OptionConversionException e1) {
View Full Code Here

            updateDatabaseServers();
           
            // open content databases
            logCategoryInfo("Web applications and data sources", 1);
            Class defaultWorkflowEngine = WGFactory.getDefaultWorkflowEngine();
            ModuleDefinition wfDef = getModuleRegistry().getModuleDefinition(WorkflowEngineModuleType.class, defaultWorkflowEngine);
            if (wfDef != null) {
                getLog().info("Default workflow engine is: " + wfDef.getTitle(Locale.ENGLISH));
            }
            else {
                getLog().info("Default workflow engine is: " + defaultWorkflowEngine.getName() + " (custom unregistered engine)");
            }
           
View Full Code Here

        Map<String, WGDatabaseServer> newServers = new ConcurrentHashMap<String, WGDatabaseServer>();
       
        // Add singleton servers
        Iterator<ModuleDefinition> singletons = getModuleRegistry().getModulesForType(DatabaseServerModuleType.class).values().iterator();
        while (singletons.hasNext()) {
            ModuleDefinition serverDefinition = singletons.next();
            DatabaseServerProperties properties = (DatabaseServerProperties) serverDefinition.getProperties();
            if (properties == null) {
                   getLog().error("Database server type '" + serverDefinition.getTitle(Locale.getDefault()) + "' (" + serverDefinition.getImplementationClass().getName() + ") is invalid, misses neccessary properties definition");
            }
            else if (properties.isSingleton()) {
                try {
                    serverDefinition.testDependencies();
                    WGDatabaseServer server = (WGDatabaseServer) getModuleRegistry().instantiate(serverDefinition);
                    server.init(WGAConfiguration.SINGLETON_SERVER_PREFIX + server.getClass().getName(), null, new HashMap<String,String>());
                    newServers.put(server.getUid(), server);
                    getLog().info("Registering database server '" + server.getTitle(Locale.getDefault()) + "' (Automatically created)");
                }
                catch (ModuleDependencyException e) {
                    getLog().error("Database server " + serverDefinition.getTitle(Locale.getDefault()) + " deactivated in current WGA runtime: " + e.getMessage());
                }
                catch (Exception e) {
                    getLog().error("Exception instantiating  database server", e);
                }
            }
View Full Code Here

        updateModuleDefinitions(true);

        PasswordOptionEncoder encoder;
        String passwordEncoderKey = _wgaConfiguration.getPasswordEncoding();
        try {
            ModuleDefinition passwordEncoderModDef = _moduleRegistry.getModuleDefinitionByKey(PasswordEncodingType.class, passwordEncoderKey);
            if (passwordEncoderModDef != null) {
                Class passwordEncoderClass = passwordEncoderModDef.getImplementationClass();
                encoder = (PasswordOptionEncoder) passwordEncoderClass.newInstance();
            }
            else {
                getLog().error("Unknown password encoder key " + passwordEncoderKey);
                getLog().error("Falling back to Base64 encoder for encoding new passwords");
                encoder = new Base64();
            }
        }
        catch (Exception e1) {
            getLog().error("Exception creating password encoder " + passwordEncoderKey, e1);
            getLog().error("Falling back to Base64 encoder for encoding new passwords");
            encoder = new Base64();
        }
        _moduleRegistry.getContextObjects().put(PasswordEncodingType.class, encoder);
      

       
        Map<ModuleDefinition,Exception> dependencyFailures = new HashMap<ModuleDefinition, Exception>();
       
        Iterator<ModuleDefinition> serverMods =  _moduleRegistry.getModulesForType(DatabaseServerModuleType.class).values().iterator();
        if (serverMods.hasNext()) {
            logCategoryInfo("Database server types available in this runtime", 2);
            while (serverMods.hasNext()) {
                ModuleDefinition moduleDefinition = serverMods.next();
                try {
                    moduleDefinition.testDependencies();
                    DatabaseServerProperties props = (DatabaseServerProperties) moduleDefinition.getProperties();
                    if (props != null && props.isSingleton()) {
                        getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH) + " (Automatic instance)");
                    }
                    else {
                        getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                    }
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
        }

        Iterator<ModuleDefinition> dbMods =  _moduleRegistry.getModulesForType(ContentStoreModuleType.class).values().iterator();
        if (dbMods.hasNext()) {
            logCategoryInfo("Content store types available in this runtime", 2);
            while (dbMods.hasNext()) {
                ModuleDefinition moduleDefinition = dbMods.next();
                try {
                    moduleDefinition.testDependencies();
                    getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
        }
       
        Iterator<ModuleDefinition> customdbMods =  _moduleRegistry.getModulesForType(ContentDatabaseModuleType.class).values().iterator();
        if (customdbMods.hasNext()) {
            logCategoryInfo("Other content database types available in this runtime", 2);
            while (customdbMods.hasNext()) {
                ModuleDefinition moduleDefinition = customdbMods.next();
                try {
                    moduleDefinition.testDependencies();
                    getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
        }
       
        Iterator<ModuleDefinition> persdbMods =  _moduleRegistry.getModulesForType(PersonalisationDatabaseModuleType.class).values().iterator();
        if (persdbMods.hasNext()) {
            logCategoryInfo("Personalisation database types available in this runtime", 2);
            while (persdbMods.hasNext()) {
                ModuleDefinition moduleDefinition = persdbMods.next();
                try {
                    moduleDefinition.testDependencies();
                    getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
        }
       
       
        Iterator<ModuleDefinition> authMods =  _moduleRegistry.getModulesForType(AuthenticationSourceModuleType.class).values().iterator();
        if (authMods.hasNext()) {
            logCategoryInfo("Authentication types available in this runtime", 2);
            while (authMods.hasNext()) {
                ModuleDefinition moduleDefinition = authMods.next();
                try {
                    moduleDefinition.testDependencies();
                    getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
        }
       
        Iterator<ModuleDefinition> wfMods =  _moduleRegistry.getModulesForType(WorkflowEngineModuleType.class).values().iterator();
        if (wfMods.hasNext()) {
            logCategoryInfo("Workflow engine types available in this runtime", 2);
            while (wfMods.hasNext()) {
                ModuleDefinition moduleDefinition = wfMods.next();
                try {
                    moduleDefinition.testDependencies();
                    getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
        }
       
        Iterator<ModuleDefinition> designMods =  _moduleRegistry.getModulesForType(DesignSourceModuleType.class).values().iterator();
        if (designMods.hasNext()) {
            logCategoryInfo("Design source types available in this runtime", 2);
            while (designMods.hasNext()) {
                ModuleDefinition moduleDefinition = designMods.next();
                try {
                    moduleDefinition.testDependencies();
                    DesignSourceProperties props = (DesignSourceProperties) moduleDefinition.getProperties();
                    if (props != null && props.isSingleton()) {
                        getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH) + " (Automatic instance)");
                    }
                    else {
                        getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                    }
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
        }
       
        Iterator<ModuleDefinition> contentShareMods =  _moduleRegistry.getModulesForType(ShareModuleType.class).values().iterator();
        if (contentShareMods.hasNext()) {
            logCategoryInfo("Share types available in this runtime", 2);
            while (contentShareMods.hasNext()) {
                ModuleDefinition moduleDefinition = contentShareMods.next();
                try {
                    moduleDefinition.testDependencies();
                    getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
        }
       
        Iterator<ModuleDefinition> taskMods =  _moduleRegistry.getModulesForType(SchedulerTaskModuleType.class).values().iterator();
        if (taskMods.hasNext()) {
            logCategoryInfo("Scheduler tasks available in this runtime", 2);
            while (taskMods.hasNext()) {
                ModuleDefinition moduleDefinition = taskMods.next();
                try {
                    moduleDefinition.testDependencies();
                    getLog().info("- " + moduleDefinition.getTitle(Locale.ENGLISH));
                }
                catch (Exception e) {
                    dependencyFailures.put(moduleDefinition, e);
                }
            }
View Full Code Here

        }
        else if (encode.equalsIgnoreCase(ENCODER_URL)) {
            formatter = new URLEncodingFormatter();
        }
        else {
            ModuleDefinition modDef = null;
            Class formatterClass = _systemFormatters.get(encode);
            if (formatterClass == null) {
                formatterClass = _customFormatters.get(encode);
            }
           
            if (formatterClass == null) {
                modDef = getModuleRegistry().getModuleDefinitionByKey(WebTMLEncoderModuleType.class, encode);
                if (modDef != null) {
                    try {
                        modDef.testDependencies();
                    }
                    catch (ModuleDependencyException e) {
                        throw new FormattingException("WebTML encoder '" + encode + "' not available bc. of missing dependency: " + e.getMessage());
                    }
                    formatterClass = modDef.getImplementationClass();
                }
            }
           
            if (formatterClass != null) {
                try {
View Full Code Here

       
        LanguageBehaviour langBehaviour;
       
        // For applications
        if (getModuleRegistry() != null) {
            ModuleDefinition languageBehaviourMD = getModuleRegistry().getModuleDefinition(LanguageBehaviourModuleType.class, langBehaviourName);
            if (languageBehaviourMD == null) {
                getLog().error("Unable to load language behaviour " + langBehaviourName + ". Falling back to mode 'static'.");
                languageBehaviourMD = getModuleRegistry().getModuleDefinition(LanguageBehaviourModuleType.class, StaticLanguageBehaviour.class);
            }
           
           
            try {
                langBehaviour = (LanguageBehaviour) getModuleRegistry().instantiate(languageBehaviourMD);
            }
            catch (ModuleInstantiationException e) {
                getLog().error("Exception instantiating language behaviour '" + languageBehaviourMD.getTitle(Locale.getDefault()) + "'. Falling back to mode 'static'.", e);
                langBehaviour = new StaticLanguageBehaviour();
            }
        }
       
        // For Plugins (no registry yet)
View Full Code Here

TOP

Related Classes of de.innovationgate.wga.modules.ModuleDefinition

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.