Package de.innovationgate.wgpublisher.design

Examples of de.innovationgate.wgpublisher.design.WGADesign


                FileObject designFile = _dir.resolveFile(designName + ARCHIVED_DESIGN_EXTENSION);
                if (!designFile.exists()) {
                    return null;
                }
               
                WGADesign design = new WGADesign();
                design.setSource(this);
                design.setName(name);
                design.setTitle(designFile.getName().getBaseName());
                design.setDescription("Design at location " + designFile.getURL().toString());
                return design;
            }
           
            // Additional directory
            else if (name.startsWith(DESIGNNAMEPREFIX_ADDITIONALDIR)) {
                String designName = name.substring(DESIGNNAMEPREFIX_ADDITIONALDIR.length());
                String dirPath = _additionalDirs.get(designName);
                if (dirPath == null) {
                    return null;
                }
               
                FileObject dir = VFS.getManager().resolveFile((String) dirPath);
                if (!dir.exists() || !dir.getType().equals(FileType.FOLDER)) {
                    return null;
                }
                   
                FileObject syncInfo = DesignDirectory.getDesignDefinitionFile(dir);
               
                // Non-empty directories without syncinfo may not be used as design directories
                if (syncInfo == null && dir.getChildren().length != 0) {
                    return null;
                }

                WGADesign design = new WGADesign();
                design.setSource(this);
                design.setName(DESIGNNAMEPREFIX_ADDITIONALDIR + name);
                design.setTitle(dir.getName().getBaseName());
                design.setDescription("Design at location " + dir.getURL().toString());
                design.setConfig(loadConfig(syncInfo));
                return design;
               
            }
           
            // Regular design in configured directory
            else {
                _dir.refresh();
                FileObject child = _dir.getChild(name);
                if (child == null) {
                    return null;
                }
               
                FileObject resolvedChild = WGUtils.resolveDirLink(child);
                if (!resolvedChild.getType().equals(FileType.FOLDER)) {
                    return null;
                }
                
                FileObject syncInfo = DesignDirectory.getDesignDefinitionFile(resolvedChild);
               
                // Non-empty directories without syncinfo may not be used as design directories
                if (syncInfo == null && child.getChildren().length != 0) {
                    return null;
                }
               
               
                WGADesign design = new WGADesign();
                design.setSource(this);
                design.setName(child.getName().getBaseName());
                design.setTitle(child.getName().getBaseName());
                design.setDescription("Design at location " + child.getURL().toString());
                design.setConfig(loadConfig(syncInfo));                          
                return design;
            }
        }
        catch (FileSystemException e) {
            throw new WGADesignRetrievalException("Exception retrieving file system designs", e);
View Full Code Here


        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

        WGDatabase database = _core.getContentdbs().get(name);
        if (database == null || !database.getRoles().contains(WGDatabase.ROLE_DESIGN) || database.getDbReference().startsWith(PluginConfig.PLUGIN_DBKEY_PREFIX) || database.getDesignProvider() != null) {
            return null;
        }
       
        WGADesign design = new WGADesign();
        design.setSource(this);
        design.setName(database.getDbReference());
        design.setTitle(database.getTitle());
        design.setDescription("Design from database \"" + database.getTitle() + "\"");
       
        if (!database.isSessionOpen()) {
            try {
                database.openSession();
                WGFileContainer con = database.getFileContainer("system");
                if (con != null && con.getFileNames().contains(SystemContainerManager.CSCONFIG_FILE)) {
                    InputStream in = con.getFileData(SystemContainerManager.CSCONFIG_FILE);
                    design.setConfig(CSConfig.load(in, true));
                }
            }
            catch (Exception e) {
                _core.getLog().error("Exception reading design config for database " + database.getDbReference(), e);
            }
View Full Code Here

TOP

Related Classes of de.innovationgate.wgpublisher.design.WGADesign

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.