Examples of BeeResource


Examples of org.sf.bee.commons.localstore.BeeResource

    }

    public String get(final String blockName){
        try {
            final String fileName = PathUtils.concat(_docRoot, blockName);
            final BeeResource file = new BeeResource(fileName);
            final String text = file.getText();
            return VLCManager.getInstance().evaluate(blockName,
                text, _context);
        } catch (Exception ex) {
            return ex.toString();
        }
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

    @Override
    protected AbstractRuntimeConfiguration onBeforeOpen() throws Exception {
        //-- (LOG4J) logging configuration file --//

        final String loggingFileName = super.getApplication().getAppPath() + "/configuration/logging.lcf";
        final BeeResource resLogging = this.getResource(loggingFileName);
        if (resLogging.exists()) {
            PropertyConfigurator.configure(resLogging.getUrl());
        }

        //-- ADD-ONS Folders initialization --//

        final BeeResource resAddOns = BeeLocalStore.getInstance().getResource(
                super.getApplication().getAddOnsPath().concat("/readme.txt"), true);
        if (!resAddOns.exists()) {
            resAddOns.setText("Copy in this folder all add-on libraries.");
        }
        final BeeResource resAddOnsRes = BeeLocalStore.getInstance().getResource(
                super.getApplication().getResourcesPath().concat("/readme.txt"), true);
        if (!resAddOnsRes.exists()) {
            resAddOnsRes.setText("Copy in this folder all add-on resources.");
        }
        // addons files
        final BeeResource resAddOnsFolder = BeeLocalStore.getInstance().getResource(
                super.getApplication().getAddOnsPath());
        final String[] addons = resAddOnsFolder.getChildren(0);
        if (!CollectionUtils.isEmpty(addons)) {
            this.initAddOns(addons);
        }


        //-- main configuration file --//
        final String beeingFileName = PathUtils.concat(
                super.getApplication().getAppPath(), RuntimeConfigFile.FILE_NAME);
        final BeeResource resConfig = this.getResource(beeingFileName);
        if (!resConfig.exists()) {
            return null;
        }
        final RuntimeConfigFile file = super.createConfigurationFile(resConfig.getUrl());
        final AbstractRuntimeConfiguration config = new BeeAppRuntimeConfigController(
                super.getApplication().getAppPath(), file);

        return config;
    }
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

    // ------------------------------------------------------------------------
    //                      p r i v a t e
    // ------------------------------------------------------------------------
    private BeeResource getResource(final String fileName) {
        final BeeResource resource = BeeLocalStore.getInstance().getResource(
                fileName, true);
        try {
            if (!resource.exists()) {
                final String name = PathUtils.getFilename(fileName, true);
                resource.copyFromPackage(BeeAppRuntimeConfigController.class, name);
            }
        } catch (IOException ex) {
            super.getLogger().log(Level.SEVERE, null, ex);
        }
        return resource;
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

        final String configValue = this.getPropertyValue(
                IConfigurationConstants.PARAM_SYSTEM,
                IConfigurationConstants.ATTR_HTTPSERVER_ROOT);
        final String path = PathUtils.merge(_appPath,
                configValue.endsWith("/") ? configValue : configValue + "/");
        final BeeResource resource = BeeLocalStore.getInstance().getResource(
                path.concat("foo.tmp"));
        if (!resource.exists()) {
            resource.mkdirs();
        }
        final String httpDocRoot = resource.getParentUrl();

        // retrieve parameters and load into httpConfiguration wrapper
        final HashMap<String, String> data = new HashMap<String, String>();
        data.put(IConfigurationConstants.ATTR_HTTPSERVER_PASSWORD,
                this.getPropertyValue(
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

    //                      p u b l i c
    // ------------------------------------------------------------------------
    public JSDB connect(final String dbname) throws IOException {
        if (StringUtils.hasText(dbname)) {
            _dbpath = PathUtils.concat(_storePath, dbname);
            _dbfile = new BeeResource(PathUtils.concat(_dbpath, DBFILENAME));
            this.initDB();
        }
        return this;
    }
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

        return LoggingUtils.getLogger();
    }

    private void mkdirs(final String path) {
        // check file exists
        final BeeResource dir = new BeeResource(path);
        this.mkdirs(dir);
    }
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

    private String deploy(final String targetFolder, final DeployerItem item) {
        String message = "";
        if (this.isDeployable(item.getFileName())) {
            final String targetPath = PathUtils.merge(targetFolder, item.getFileName());
            final BeeResource target = new BeeResource(targetPath);
            final boolean exists = target.exists();
            final boolean overwrite = this.isOverwritable(item.getFileName());
            Exception exc = null;
            int deployed = 0;
            if (!exists || overwrite) {
                if (!item.isDirectory()) {
                    try {
                        target.mkdirs();
                        deployed = target.copyFromPackage(item.getPackageName()) ? 1 : 0;
                    } catch (Exception ex) {
                        exc = ex;
                        deployed = -1;
                    }
                } else {
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

    }
   
    private void loadResources(final String startFolder) {
        final String root = JarResourceUtils.getFullpath(this.getClass(), "", false);
        final String folder = PathUtils.concat(root, startFolder);
        final BeeResource file = new BeeResource(folder);
        this.logInfo("LOADING resources from Root: '{0}', "
                + "Folder: '{1}', URL: '{2}'",
                root, folder, file.getUrl());
        final String[] children = file.getChildren();
        for (final String child : children) {
            _resources.add(new DeployerItem(this, root, child));
        }
    }
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

        }catch(Throwable t){
        }
    }

    private BeeResource getConfigurationResource(final String fileName) {
        final BeeResource resource = BeeLocalStore.getInstance().getResource(
                fileName, true);
        try {
            if (!resource.exists()) {
                final String name = PathUtils.getFilename(fileName, true);
                resource.copyFromPackage(BeePluginManager.class, name);
            }
        } catch (Exception ex) {
            this.getLogger().log(Level.SEVERE, null, ex);
        }
        return resource;
View Full Code Here

Examples of org.sf.bee.commons.localstore.BeeResource

    }

    private void loadConfiguration(final BeePluginRepository repository) throws Exception {
        _initialized = true;
        final String fileName = PathUtils.merge(_configurationRoot, FILENAME);
        final BeeResource res = this.getConfigurationResource(fileName);
        if (res.exists()) {
            _configuration = new Configuration(new File(res.getUrl()));
            this.loadData(repository, _configuration);
        }
    }
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.