Examples of WGFileContainer


Examples of de.innovationgate.webgate.api.WGFileContainer

        return "storage".equals(content.getItemValue("$hdbmodel_type")) || _hdb.isStorage(content);
       
    }

    public static void createModelObject(WGACore core, WGDatabase db) throws WGAPIException, DocumentException, NoSuchAlgorithmException, IOException {
        WGFileContainer system = db.getFileContainer("system");
        if (system == null) {
            return;
        }

        if (!system.hasFile(MODEL_FILE)) {
            return;
        }
   
        core.getLog().info("Initializing HDB model for database " + db.getDbReference());
        HDBModel model = new HDBModel(core, db, system);
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

                }
            }
           
            // No database addressed. Try to find file in file container of design db. Else we use the current context db
            else {
                WGFileContainer container = null;
               
                WGDatabase designDB = context.designdb();
                if (designDB != null && designDB.isSessionOpen()) {
                    container = designDB.getFileContainer(containerName);
                }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

            }
        }

        // Deploy file containers
        Iterator containers = getDB().getFileContainers().iterator();
        WGFileContainer con;
        while (containers.hasNext()) {
            con = (WGFileContainer) containers.next();
            if (isValidDesignName(con.getName())) {
                initialDeployFileContainer(con);
            }
            else {
                _log.warn("Could not use '" + con.getDocumentKey() + "' for design deployment since the name contains invalid characters");
            }
        }

        // Deploy script modules
        Iterator scripts = getDB().getCSSJSModules().iterator();
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

        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

Examples of de.innovationgate.webgate.api.WGFileContainer

        // Check if file has been deleted in the meantime
        if (!codeFile.exists()) {
            return;
        }
       
        WGFileContainer con = (WGFileContainer) db.getDocumentByDocumentKey(getDocumentKey());
        if (con == null) {
            WGDocumentKey docKey = new WGDocumentKey(getDocumentKey());
            con = db.createFileContainer(docKey.getName());
            con.save();
        }

        // Find new and updated files
        FileObject[] filesArray = codeFile.getChildren();
        if (filesArray == null) {
            throw new WGDesignSyncException("Cannot collect files from directory '" + codeFile.getName().getPathDecoded() + "'. Please verify directory existence.");
        }
       
        List<FileObject> files = new ArrayList<FileObject>(Arrays.asList(filesArray));
        Collections.sort(files, new FileNameComparator());
       
        FileObject file;
        Map existingFiles = new HashMap();
        for (int i = 0; i < files.size(); i++) {
            file = (FileObject) files.get(i);
            if (isExcludedFileContainerFile(file)) {
                continue;
            }

            ContainerFile containerFile = getContainerFile(file);
            if (containerFile != null) {
                if (existingFiles.containsKey(containerFile.getName())) {
                    // Possible in case-sensitive file systems. Another file of the same name with another case is in the dir.
                    continue;                
                }
               
                if (file.getContent().getLastModifiedTime() != containerFile.getTimestamp()) {
                   doRemoveFile(con, file.getName().getBaseName());
                   doSaveDocument(con);
                   doAttachFile(con, file);
                   doSaveDocument(con);
                   containerFile.setTimestamp(file.getContent().getLastModifiedTime());
                }
            }
            else {
                containerFile = new ContainerFile(file);
                if (con.hasFile(file.getName().getBaseName())) {
                    doRemoveFile(con, file.getName().getBaseName());
                    doSaveDocument(con);
                }
                doAttachFile(con, file);
                doSaveDocument(con);
            }
            existingFiles.put(containerFile.getName(), containerFile);
        }

        // Remove deleted files from container
        _files = existingFiles;
        List fileNamesInContainer = WGUtils.toLowerCase(con.getFileNames());
        fileNamesInContainer.removeAll(existingFiles.keySet());
        Iterator deletedFiles = fileNamesInContainer.iterator();
        while (deletedFiles.hasNext()) {
            con.removeFile((String) deletedFiles.next());
            con.save();
        }

        // Update metadata and save
        FCMetadata metaData = (FCMetadata) readMetaData();
        metaData.writeToDocument(con);
        con.save();
        FileObject metadataFile = getMetadataFile();
        if (metadataFile.exists()) {
            _timestampOfMetadataFile = metadataFile.getContent().getLastModifiedTime();
        }
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.