Examples of WGFileContainer


Examples of de.innovationgate.webgate.api.WGFileContainer

        // We do not want to publish files from the system file container.
        // They are the WGA pendant of J2EE's "WEB-INF" directory which is
        // also unpublished.
        if (container instanceof WGFileContainer) {
            WGFileContainer fc = (WGFileContainer) container;
            if (fc.getName().equals("system")) {
                _publishable = false;
            }
        }
    }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

    }

    public WGAResourceBundle getBundle(LabelContainerName containerName, String bundleName) throws WGAPIException, IOException {

        // Get the container first so we can determine the up-to-date state
        WGFileContainer labelContainer = _db.getFileContainer(containerName.toString());
        if (labelContainer != null) {

            // First try to get from cache
            String cacheKey = containerName.toString() + NAME_DIVIDER + bundleName;
            Object cacheObject = _cachedBundles.get(cacheKey);

            // A bundle is in cache: return it if it is not stale
            if (cacheObject != null && cacheObject instanceof WGAResourceBundle) {
                WGAResourceBundle bundle = (WGAResourceBundle) cacheObject;
                if (bundle.getTime() >= labelContainer.getFileLastModified(getBundleFileName(bundleName)).getTime()) {
                    return bundle;
                }
            }

            // If there is no NoBundleIndicator in cache we try to retrieve the
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

    public void databaseUpdate(WGDatabaseEvent event) {
        try {
            WGDocument doc = event.getEditedDocument();
            if (doc != null) {
                if (doc instanceof WGFileContainer) {
                    WGFileContainer con = (WGFileContainer) doc;
                    if (con.getName().equals("system")) {
                        checkForUpdates(event.getDatabase());
                    }
                }
            }
            else {
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

    }

    protected ContainerInfo checkForUpdates(WGDatabase database) throws WGAPIException, IOException, InvalidCSConfigVersionException {

        // Load container and old container info
        WGFileContainer con = database.getFileContainer("system");
        ContainerInfo info = _containerInfos.get(database.getDbReference());
       
        // Double checked locking check for update need
        if (needsUpdate(database, con, info)) {
           
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

          performInitialisation(null);
        }
       
        public void performInitialisation(Boolean dbIsEmptyContent) {
            try {
                WGFileContainer fc = _db.getFileContainer("system");
               
                // Build shortcuts so they are available in setup scripts
                _core.buildDesignShortcuts(_db);
               
                // Actions to perform on an db with empty acl (this will not be disabled with _initDisabled since even design provider plugins need general access)
                if (_info != null && _info.getCsConfig() != null && _initACL) {
                    doEmptyACLActions(_db, _info.getCsConfig());
                }
               
                // Actions to bypass if initialisation is disabled
                if (!_initDisabled) {
                   
                    // Actions to perform on a content-empty db
                    boolean isEmptyContent = _db.isContentEmpty();
                    if (dbIsEmptyContent != null) {
                        isEmptyContent = dbIsEmptyContent.booleanValue();
                    }

                    // Process init dump
                    if (fc != null && isEmptyContent) {

                        String initDump;
                        if (_db.hasAttribute(WGACore.DBATTRIB_PLUGIN_VERSION) && fc.hasFile(INITDUMP_PLUGIN)) {
                            initDump = INITDUMP_PLUGIN;
                        }
                        else {
                            initDump = INITDUMP_CS;
                        }
                       
                        if (fc.getFileNames().contains(initDump)) {
                            _log.info("Importing initial data for empty database '" + _db.getDbReference() + "'");
                            _core.importContentStoreDump(new ZipInputStream(fc.getFileData(initDump)), _db);
                        }
                    }
                   
                   
                    // We directly init HDB for this database if the system file container has a hdb model descriptor file
                    // So following scripts can use implicit model containers
                    if (fc != null && fc.hasFile(HDBModel.MODEL_FILE)) {
                        WGHierarchicalDatabase.getOrCreateInstance(_db);
                    }
                   
                    // Process schema
                    if (_info != null && _info.getSchema() != null) {
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

                                                            }
                                                        }
                                                    }
                                                } else if (container.getName().startsWith("filecontainer:")) {
                                                    String fileContainerName = container.getName().substring("filecontainer:".length());
                                                    WGFileContainer fileContainer = db.getFileContainer(fileContainerName);
                                                    if (fileContainer == null) {
                                                        // content has been deleted remove file data
                                                        _core.getLog().info("File container '" + fileContainerName + "' has been deleted. Clearing external file serving cache.");
                                                        WGUtils.delTree(container);
                                                        if (container.exists()) {
                                                            _core.getLog().warn("External file cache maintenance failed. Unable to remove directory '" + container.getAbsolutePath() + "'. Cache might serve stale file data.");           
                                                        }
                                                    } else {
                                                        // check for existence and size of files
                                                        File[] deployedFiles = container.listFiles();
                                                        for (File deployedFile : deployedFiles) {
                                                            if (deployedFile.isFile()) {
                                                                if (!fileContainer.hasFile(deployedFile.getName())) {
                                                                    _core.getLog().info("File '" + deployedFile.getName() + "' has been removed from file container '" + fileContainer.getName() + "' and will be removed from external file serving cache.");
                                                                    if (!deployedFile.delete()) {
                                                                        _core.getLog().warn("Unable to delete external file serving data '" + deployedFile.getAbsolutePath() + "'. File cache might serve stale data.");
                                                                    }
                                                                } else if (deployedFile.length() < config.getThreshold()) {
                                                                    _core.getLog().info("Deployed file '" + deployedFile.getName() + "' of file container '" + fileContainer.getName() + "' deceeds current file size threashold and will be removed from external file serving cache.");
                                                                    if (!deployedFile.delete()) {
                                                                        _core.getLog().warn("Unable to delete external file serving data '" + deployedFile.getAbsolutePath() + "'. File cache might serve stale data.");
                                                                    }
                                                                }
                                                            }
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

            return errorReturnContext;
        }
    }

    else if (contextFunction.equals("$filecontainer")) {
        WGFileContainer cont = db.getFileContainer(contextExpression);
        if (cont != null) {
            return context.getTMLContextForDocument(cont);
        }
        else {
            context.setLastError("Could not retrieve file container with name '" + contextExpression + "'");
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

        }

        private void readConfigurationProperties(WGDatabase db) throws WGAPIException {
            try {
                WGFileContainer system = db.getFileContainer("system");
                if (system == null) {
                    return;
                }
               
                if (system.hasFile(CSAUTH_PROPERTIES_FILE)) {
                    Properties props = new Properties();
                    props.load(system.getFileData(CSAUTH_PROPERTIES_FILE));
                    configure(props);
                    _internalConfiguration = true;
                }
            }
            catch (IOException e) {
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

        _definition = saxReader.read(new InputStreamReader(inputStream, "UTF-8"));
        inputStream.close();
       
        String redirection = _definition.getRootElement().attributeValue("redirect");
        if (redirection != null) {
            WGFileContainer redirectModel = model.getDatabase().getFileContainer(redirection);
            readDefinition(redirectModel);
            return;
        }
       
        _definitionTime = model.getLastModified().getTime();
View Full Code Here

Examples of de.innovationgate.webgate.api.WGFileContainer

            }
           
            // If so, we reread the definition in a master session task
            MasterSessionTask task = new MasterSessionTask(event.getDatabase()) {
                protected void exec(WGDatabase db) throws Throwable {
                    WGFileContainer system = db.getFileContainer("system");
                    if (system != null && system.getLastModified().getTime() > _definitionTime && system.hasFile(MODEL_FILE)) {
                        _core.getLog().info("Updating HDB model for database " + db.getDbReference());
                        readDefinition(system);
                    }
                }
            };
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.