Package de.innovationgate.wga.common.beans.csconfig.v3

Examples of de.innovationgate.wga.common.beans.csconfig.v3.CSConfig


    }

    public static Configuration loadConfiguration(File file) throws FileNotFoundException, IOException, InvalidCSConfigVersionException {
       
        DesignDefinition syncInfo = null;
        CSConfig csConfig = null;
        String licenseText = null;
       
        // Normal plugin file
        if (file.isFile()) {
            ZipInputStream zipIn = new ZipInputStream(new FileInputStream(file));
            try {
                ZipEntry entry;
                while ((entry = zipIn.getNextEntry()) != null) {
                   
                    String entryName = entry.getName();
                    if (entryName.equals(DesignDirectory.DESIGN_DEFINITION_FILE) || entryName.equals(DesignDirectory.SYNCINFO_FILE)) {
                        TemporaryFile tempFile = new TemporaryFile("design", zipIn, null);
                        syncInfo = DesignDefinition.load(tempFile.getFile());
                        tempFile.delete();
                    }
                    else if (entryName.equals(SystemContainerManager.CSCONFIG_PATH)) {
                        TemporaryFile tempFile = new TemporaryFile("csconfig", zipIn, null);
                        csConfig = CSConfig.load(tempFile.getFile());
                        tempFile.delete();
                    }
                    else if (entryName.equals(SystemContainerManager.LICENSE_PATH)) {
                        licenseText = WGUtils.readString(new InputStreamReader(zipIn,  "UTF-8")).trim();
                    }
                   
                    if (syncInfo != null && csConfig != null) {
                        break;
                    }
                }
            }
            finally {
                zipIn.close();
            }
        }
       
        // Developer plugin folder
        else {
            File syncInfoFile = DesignDirectory.getDesignDefinitionFile(file);
            if (syncInfoFile.exists()) {
                syncInfo = DesignDefinition.load(syncInfoFile);
            }
            File csConfigFile = new File(file, SystemContainerManager.CSCONFIG_PATH);
            if (csConfigFile.exists()) {
                csConfig = CSConfig.load(csConfigFile);
            }
            File licenseTextFile = new File(file, SystemContainerManager.LICENSE_PATH);
            if (licenseTextFile.exists()) {
                Reader reader = new InputStreamReader(new FileInputStream(licenseTextFile) , "UTF-8");
                licenseText = WGUtils.readString(reader).trim();
                reader.close();
            }
           
        }
       
        if (syncInfo != null && csConfig != null && csConfig.getPluginConfig() != null) {
            return new Configuration(syncInfo, csConfig, licenseText);
        }
        else {
            return null;
        }
View Full Code Here


    }

    public String getValueTitle(String value, Locale locale) {
       
        WGDatabase pluginDB = _core.getContentdbs().get(value);
        CSConfig csConfig = (CSConfig) pluginDB.getAttribute(WGACore.DBATTRIB_CSCONFIG);
        if (csConfig != null && csConfig.getPluginConfig() != null) {
            return csConfig.getPluginConfig().getTitle() + " (" + csConfig.getPluginConfig().getId().getUniqueName() + ")";
        }
       
        return value;
       
    }
View Full Code Here

            // Create TMLForm, if form information was issued
            if (form != null) {
                FormInfo formInfo = new FormInfo(form.getId(), false, false);
                formInfo.setSource("none");
                formInfo.setKeepOnValidate(false);
                CSConfig csConfig = (CSConfig) db.getAttribute(WGACore.DBATTRIB_CSCONFIG);
                if (csConfig != null) {
                    formInfo.setVersionCompliance(csConfig.getVersionCompliance());
                }
                de.innovationgate.wgpublisher.webtml.utils.TMLForm tmlForm = context.createform(formInfo);
                tmlForm.importServicesForm(form);
            }
           
View Full Code Here

        }
    }
   
    protected boolean mayCallAction(WGDatabase db, String actionID) throws WGAPIException {
       
        CSConfig csConfig = (CSConfig) db.getAttribute(WGACore.DBATTRIB_CSCONFIG);
       
        // No cs config: All designers are permitted
        if (csConfig == null) {
            return db.getSessionContext().isDesigner();           
        }
       
        RemoteAction action = csConfig.findRemoteAction(actionID);
        if (action == null) {
            return false;
        }
       
        if (db.isMemberOfUserList(action.getCallers())) {
View Full Code Here

            status.formInfo.setDefinitionModule(getStatus().getTMLModuleName());
            status.formInfo.setDefinitionDatabase(getDesignDBKey());
           
            WGDatabase designDB = getCore().getContentdbs().get(getDesignDBKey());
            if (designDB != null) { // May be in StaticTML
                CSConfig csConfig = (CSConfig) designDB.getAttribute(WGACore.DBATTRIB_CSCONFIG);
                if (csConfig != null) {
                    status.formInfo.setVersionCompliance(csConfig.getVersionCompliance());
                }
            }
           
            updateDefaultAction(status.formInfo);
           
View Full Code Here

       
        Map metaMappings = (Map) db.getAttribute(DBATTRIB_META_MAPPINGS);
        Map itemMappings = (Map) db.getAttribute(DBATTRIB_ITEM_MAPPINGS);
        Map pluginShortcuts = (Map) db.getAttribute(DBATTRIB_PLUGIN_SHORTCUTS);
       
        CSConfig csconfig = (CSConfig) db.getAttribute(DBATTRIB_CSCONFIG);
        if (csconfig != null && csconfig instanceof de.innovationgate.wga.common.beans.csconfig.v2.CSConfig) {
            de.innovationgate.wga.common.beans.csconfig.v2.CSConfig v2 = (de.innovationgate.wga.common.beans.csconfig.v2.CSConfig) csconfig;
            Iterator shortcuts = v2.getShortcuts().iterator();
            while (shortcuts.hasNext()) {
                Shortcut shortcut = (Shortcut) shortcuts.next();
View Full Code Here

            updateLibraryLoader();
            info.setEnfordedLibraryUpdate(true);
        }
       
        // If no cxconfig.xml we are finished here
        CSConfig csConfig = info.getCsConfig();
        if (csConfig == null) {
            return;
        }
       
        // WGA wide configurations, that can be bypassed if the system file container is from a provider DB
        // (because they already were enforced by the provider db)
        if (!info.isFromProviderDB()) {
       
            // Add encoder mappings
            Iterator encoderMappings = csConfig.getEncoderMappings().iterator();
            while (encoderMappings.hasNext()) {
                EncoderMapping mapping = (EncoderMapping) encoderMappings.next();
                getLog().info("Adding WebTML encoder '" + mapping.getName() + "'");
                if (addEncoderMapping(mapping.getName(), mapping.getImplementationClass(), false)) {
                    info.getEnforcedEncoderMappings().add(mapping.getName());
                }
            }
           
           
            // Add element mappings
            Iterator elementMappings = csConfig.getElementMappings().iterator();
            while (elementMappings.hasNext()) {
                ElementMapping mapping = (ElementMapping) elementMappings.next();
                getLog().info("Adding WebTML element '" + mapping.getName() + "'");
                if (addElementMapping(mapping.getName(), mapping.getImplementationClass(), false)) {
                    info.getEnforcedElementMappings().add(mapping.getName());
                }
            }
           
            // Add media keys
            Iterator mediaKeys = csConfig.getMediaKeys().iterator();
            while (mediaKeys.hasNext()) {
                de.innovationgate.wga.common.beans.csconfig.v1.MediaKey mediaKey = (de.innovationgate.wga.common.beans.csconfig.v1.MediaKey) mediaKeys.next();
                getLog().info("Adding WebTML media key '" + mediaKey.getKey() + "' for MIME type '" + mediaKey.getMimeType() + "'");
                addMediaMapping(mediaKey, false);
                info.getEnforcedMediaMappings().add(mediaKey.getKey());
            }
           

            if (csConfig instanceof de.innovationgate.wga.common.beans.csconfig.v2.CSConfig) {
               
                // Add TMLScript global shortcuts
                de.innovationgate.wga.common.beans.csconfig.v2.CSConfig v2 = (de.innovationgate.wga.common.beans.csconfig.v2.CSConfig) csConfig;
                Iterator shortcuts = v2.getShortcuts().iterator();
                while (shortcuts.hasNext()) {
                    Shortcut shortcut = (Shortcut) shortcuts.next();
                    if (shortcut.getType() == Shortcut.TYPE_TMLSCRIPT_GLOBAL) {
                        getTmlscriptGlobalRegistry().registerGlobal(new TMLScriptGlobal(shortcut.getShortcut(), TMLScriptGlobal.TYPE_PACKAGE_OR_CLASS, shortcut.getReference()));
                    }
                }
               
            }
           
        }
       
        // Set WGA version compliance if not explicitly set via first level db option
        Set firstLevelOptions = (Set) db.getAttribute(DBATTRIB_FIRSTLEVELDBOPTIONS);
        if (!firstLevelOptions.contains(WGDatabase.COPTION_NOITEMBEHAVIOUR)) {
            db.getNoItemBehaviour().compliantTo(csConfig.getVersionCompliance());
        }
       
        // Add jobs
        Iterator jobs = csConfig.getJobDefinitions().iterator();
        while (jobs.hasNext()) {
            JobDefinition job = (JobDefinition) jobs.next();
            String jobName = db.getDbReference() + "." + job.getName();
            try {
                Task task = null;
View Full Code Here

    private CSConfig loadConfig(FileObject syncInfo) {
       
        try {
            if (syncInfo == null || !syncInfo.exists()) {
                return new CSConfig();
            }
           
            FileObject csConfig = syncInfo.getParent().resolveFile(SystemContainerManager.CSCONFIG_PATH);
            if (csConfig.exists()) {
                return CSConfig.load(csConfig);
View Full Code Here

            }
            File system = new File(files, "system");
            if (!system.exists()) {
                system.mkdir();
            }
            _csConfig = new CSConfig();
            _csConfig.write(_csConfigFile);
        }
        else {
            try {
                _csConfig = CSConfig.load(_csConfigFile);
View Full Code Here

        }

        // Convert CsConfig and PluginConfig object to proper version for WGA version compliance
        if (!_csConfig.getClass().equals(CSConfig.getCSConfigClassForCompliance(_csConfig.getVersionCompliance()))) {
           
            CSConfig correctVersionCSConfig = CSConfig.instantiateCSConfigForCompliance(_csConfig.getVersionCompliance());
            BeanUtils.copyProperties(correctVersionCSConfig, _csConfig);
           
            if (_csConfig.getPluginConfig() != null) {
                PluginConfig correctVersionPluginConfig = PluginConfig.instantiatePluginConfigForCompliance(_csConfig.getVersionCompliance());
                BeanUtils.copyProperties(correctVersionPluginConfig, _csConfig.getPluginConfig());
                correctVersionCSConfig.setPluginConfig(correctVersionPluginConfig);
            }
                       
            _csConfig = correctVersionCSConfig;

            // reload cached design shortcuts
View Full Code Here

TOP

Related Classes of de.innovationgate.wga.common.beans.csconfig.v3.CSConfig

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.