Package de.innovationgate.wga.common.DesignDirectory

Examples of de.innovationgate.wga.common.DesignDirectory.ScriptInformation


            WGUtils.getOrCreateFolder(getBaseFolder(), DesignDirectory.FOLDERNAME_SCRIPT);
            WGUtils.getOrCreateFolder(getBaseFolder(), DesignDirectory.FOLDERNAME_FILES);

            Iterator scriptInfos = DesignDirectory.getScriptTypes().values().iterator();
            while (scriptInfos.hasNext()) {
                ScriptInformation info = (ScriptInformation) scriptInfos.next();
                if (info.isAutoCreate()) {
                    WGUtils.getOrCreateFolder(getScriptFolder(), info.getFolder());
                }
            }
           
            if (_fsResources.getJavaFolder().exists()) {
                _javaClassesPath = _fsResources.getJavaFolder().getName().getPath();
View Full Code Here


        if (script.isMetadataModule()) {
            return null;
        }

        ScriptInformation info = DesignDirectory.getScriptInformation(script.getCodeType());
        if (info == null) {
            _log.warn("Cannot deploy unknown script code type: " + script.getCodeType());
            return null;
        }

        // Get script type folder
        FileObject scriptTypeFolder = getScriptTypeFolder(info.getFolder());

        // Eventually create intermediate directories
        List<String> path = WGUtils.deserializeCollection(script.getName(), ":", true);
        String localName = (String) path.get(path.size() - 1);
        FileObject currentDir = scriptTypeFolder;
        for (int i = 0; i < path.size() - 1; i++) {
            currentDir = currentDir.resolveFile((String) path.get(i));
            if (!currentDir.exists()) {
                _log.info("Creating script category directory" + getRelativePath(currentDir));
                try {
                    currentDir.createFolder();
                }
                catch (FileSystemException e) {
                    throw new WGInitialDeployException("Could not create script category folder '" + getRelativePath(currentDir) + "'", e);
                }
            }
            else if (!currentDir.getType().equals(FileType.FOLDER)) {
                throw new WGInitialDeployException("Cannot deploy " + script.getDocumentKey() + " to sync folder because the directory name '" + path.get(i) + "' is already used by another file");
            }
        }

        // Create code file
        FileObject codeFile = currentDir.resolveFile(localName + info.getSuffix());
        _log.info("Creating script module file " + getRelativePath(codeFile));
        try {
            codeFile.createFile();
        }
        catch (FileSystemException e) {
View Full Code Here

                    if (!file.getName().getBaseName().contains(DesignDirectory.SUFFIX_TML)) {
                        continue;
                    }
                }
                else if (type == WGDocument.TYPE_CSSJS) {
                    ScriptInformation scriptInfo = DesignDirectory.getScriptInformationBySuffix("." + file.getName().getExtension());
                    if (scriptInfo == null) {
                        continue;
                    }
                }
                moduleFiles.add(new ModuleFile(file, prefix, category, type));
View Full Code Here

        List<ModuleFile> files = new ArrayList();

        // Get all files from script folders
        Iterator scriptInfos = DesignDirectory.getScriptTypes().values().iterator();
        while (scriptInfos.hasNext()) {
            ScriptInformation info = (ScriptInformation) scriptInfos.next();
            files.addAll(getModuleFiles(WGDocument.TYPE_CSSJS, getScriptTypeFolder(info.getFolder()), info.getType()));

        }
        return files;
    }
View Full Code Here

       
    }

    protected ModuleFile getScriptModuleFile(String name, String type) throws FileSystemException, WGDesignSyncException {

        ScriptInformation info = DesignDirectory.getScriptInformation(type);
        if (info == null) {
            return null;
        }
       
        FileObject scriptTypeFolder = getScriptTypeFolder(info.getFolder());
        if (scriptTypeFolder == null) {
            return null;
        }
       
        return resolveModuleFile(scriptTypeFolder, name, info.getFolder(), WGDocument.TYPE_CSSJS);

    }
View Full Code Here

    private void checkScriptDeployment(Set<DesignDeployment> deploymentsToUpdate, DesignSyncStatus currentDeployments, ModuleFile file) throws InstantiationException, IllegalAccessException, IOException, WGDesignSyncException {
       
        String fileName = file.getFile().getName().getBaseName().toLowerCase();
        String fileSuffix = "." + file.getFile().getName().getExtension();
       
        ScriptInformation info = DesignDirectory.getScriptInformationBySuffix(fileSuffix);
        if (info == null && !fileName.endsWith(DesignDirectory.SUFFIX_METADATA)) {
            // Won't process files of unknown suffix
            return;
        }
       
        // Filter out scripts that could collide with metadata module names
        if (info != null && info.getType().equals(WGCSSJSModule.CODETYPE_XML)) {
            if (fileName.startsWith(WGCSSJSModule.METADATA_MODULE_QUALIFIER)) {
                return;
            }
        }
       
        // Determine designName and see if there is an deployment
        String designDocumentKey = WGDesignDocument.buildDesignDocumentKey(WGDocument.TYPE_CSSJS, file.getModuleName(), file.getCategory());
        ScriptDeployment deployment = (ScriptDeployment) _syncStatus.getScriptDeployments().get(designDocumentKey);
        if (deployment != null && !deployment.isDeleted()) {
            currentDeployments.putDeployment(designDocumentKey, deployment);           
            if (deployment.isUpdated()) {
                deploymentsToUpdate.add(deployment);
                deployment.setWarnedAboutDuplicate(false);
            }
           
            checkForScriptDuplicate(file, info, deployment);

        }
        else {
           
            // We won't create an new deployment for a metadata file only. A code file must be present
            if (info == null) {
                return;
            }
           
            // Create a new deployment
            deployment = new ScriptDeployment(_syncStatus, designDocumentKey, file.getFile(), info.getType());
            ScriptDeployment oldDeployment = (ScriptDeployment) currentDeployments.putDeployment(designDocumentKey, deployment);
            if (oldDeployment != null) {
                checkForScriptDuplicate(file, info, oldDeployment);
            }
            deploymentsToUpdate.add(deployment);
View Full Code Here

    protected FileObject initialDeployScriptModule(WGCSSJSModule script) throws IOException, InstantiationException, IllegalAccessException, WGAPIException, WGDesignSyncException {
        FileObject codeFile = super.initialDeployScriptModule(script);
       
        // Create deployment object
        if (codeFile != null) {
            ScriptInformation info = DesignDirectory.getScriptInformation(script.getCodeType());
            DesignDeployment deployment = new ScriptDeployment(_syncStatus, script.getDocumentKey(), codeFile, info.getType());
            deployment.resetUpdateInformation();
            _syncStatus.putDeployment(script.getDocumentKey(), deployment);
        }
       
        return codeFile;
View Full Code Here

TOP

Related Classes of de.innovationgate.wga.common.DesignDirectory.ScriptInformation

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.