Package org.jboss.dashboard.commons.io

Examples of org.jboss.dashboard.commons.io.DirectoriesScanner


    public Set<File> getJarFiles() {
        if (jarFiles != null) return jarFiles;

        jarFiles = new HashSet<File>();
        File libDir = new File(libDirectory);
        File[] jars = new DirectoriesScanner("jar").findFiles(libDir);
        for (File jar : jars) {
            String jarName = jar.getName();
            if (jarName.startsWith("dashboard-")) {
                jarFiles.add(jar);
            }
View Full Code Here


        String dir = Application.lookup().getBaseAppDirectory() + "/" + getPanelDriversDir();

        File fdir = new File(dir);
        log.info("Loading panels. Scanning dir: " + fdir.getCanonicalPath());

        DirectoriesScanner scanner = new DirectoriesScanner("panel");
        File[] files = scanner.findFiles(fdir);

        for (int i = 0; i < files.length; i++) {
            File f = files[i];

            log.info("Reading file: " + f);

            PanelProvider p = null;
            try {
                p = loadPanelProvider(f);
                p.initialize();
            } catch (Exception e) {
                log.error("Error loading panel from file " + f, e);
            }
            if (p != null) {
                panels.put(p.getId(), p);
            } else {
                log.error("File format is not valid: " + f);
            }
        }

        DirectoriesScanner scannerHelp = new DirectoriesScanner("phelp");
        File[] helpFiles = scannerHelp.findFiles(fdir);
        for (int i = 0; i < helpFiles.length; i++) {
            File helpFile = helpFiles[i];
            PanelHelp pHelp = null;
            try {
                pHelp = loadHelpFile(helpFile);
View Full Code Here

    protected void loadFiles(Configuration hbmConfig) throws IOException {
        List<String> modules = Application.lookup().getGlobalFactory().getModules();
        String libPath = Application.lookup().getBaseAppDirectory() + File.separator + "WEB-INF" + File.separator + "lib";
        File libDir = new File(libPath);
        File[] jars = new DirectoriesScanner("jar").findFiles(libDir);
        for (int i = 0; i < jars.length; i++) {
            File jar = jars[i];
            for (String moduleName : modules) {
                String jarName = jar.getName();
                if (!processedJars.contains(jarName) && jarName.startsWith(moduleName)) {
View Full Code Here

    protected void createDatabase(String databaseName) throws Exception {
        // Search in the classpath for the SQL files for the given database.
        String sqlDir = Application.lookup().getBaseCfgDirectory() + File.separator + databaseConfigDir;
        Map<String, File> sqlFileMap = new HashMap<String, File>();
        DirectoriesScanner scanner = new DirectoriesScanner("sql");
        File[] sqlFiles = scanner.findFiles(new File(sqlDir));
        for (File sqlFile : sqlFiles) {
            // The file name must start with an ordinal which indicates the order of execution and finish with the databaseName.
            if (sqlFile.getName().endsWith(databaseName + ".sql") && Character.isDigit(sqlFile.getName().charAt(0))) {
                sqlFileMap.put(sqlFile.getName(), sqlFile);
            }
View Full Code Here

        addDescriptorFiles(descriptorFiles);
    }

    protected List<DescriptorFile> initModuleFromDir(File moduleDir) throws IOException {
        List<DescriptorFile> descriptorFiles = new ArrayList<DescriptorFile>();
        DirectoriesScanner scanner = new DirectoriesScanner(FACTORY_EXTENSION);
        File[] descriptorsInside = scanner.findFiles(moduleDir);
        int preffixLength = moduleDir.getCanonicalPath().length() + 1;
        for (int i = 0; i < descriptorsInside.length; i++) {
            File file = descriptorsInside[i];
            String componentName = file.getCanonicalPath();
            componentName = componentName.substring(preffixLength, componentName.length() - 1 - FACTORY_EXTENSION.length());
View Full Code Here

    protected List<DescriptorFile> initModuleFromJar(String moduleName) throws IOException {
        List<DescriptorFile> descriptorFiles = new ArrayList<DescriptorFile>();
        String libPath = Application.lookup().getBaseAppDirectory() + File.separator + "WEB-INF" + File.separator + "lib";
        File libDir = new File(libPath);
        DirectoriesScanner ds = new DirectoriesScanner("jar");
        File[] jars = ds.findFiles(libDir);
        for (int i = 0; i < jars.length; i++) {
            File jar = jars[i];
            if (jar.getName().startsWith(moduleName)) {
                List<DescriptorFile> jarDescriptors = initModuleFromZip(jar);
                descriptorFiles.addAll(jarDescriptors);
View Full Code Here

        return bundle;
    }

    public Map<Locale,Properties> read() throws Exception {
        Map<Locale,Properties> result = new HashMap<Locale, Properties>();
        File[] bundles = new DirectoriesScanner("properties").findFiles(bundleDir);
        for (File f : bundles) {
            Locale locale = extractLocale(StringUtils.remove(f.getName(), ".properties"));
            if (locale != null) {
                Properties bundle = new Properties();
                bundle.load(new FileReader(f));
View Full Code Here

        String dir = Application.lookup().getBaseAppDirectory() + "/" + getPanelDriversDir();

        File fdir = new File(dir);
        log.info("Loading panels. Scanning dir: " + fdir.getCanonicalPath());

        DirectoriesScanner scanner = new DirectoriesScanner("panel");
        File[] files = scanner.findFiles(fdir);

        for (int i = 0; i < files.length; i++) {
            File f = files[i];

            log.info("Reading file: " + f);

            PanelProvider p = null;
            try {
                p = loadPanelProvider(f);
                p.initialize();
            } catch (Exception e) {
                log.error("Error loading panel from file " + f, e);
            }
            if (p != null) {
                panels.put(p.getId(), p);
            } else {
                log.error("File format is not valid: " + f);
            }
        }

        DirectoriesScanner scannerHelp = new DirectoriesScanner("phelp");
        File[] helpFiles = scannerHelp.findFiles(fdir);
        for (int i = 0; i < helpFiles.length; i++) {
            File helpFile = helpFiles[i];
            PanelHelp pHelp = null;
            try {
                pHelp = loadHelpFile(helpFile);
View Full Code Here

        String dir = Application.lookup().getBaseAppDirectory() + "/" + getPanelDriversDir();

        File fdir = new File(dir);
        log.info("Loading panels. Scanning dir: " + fdir.getCanonicalPath());

        DirectoriesScanner scanner = new DirectoriesScanner("panel");
        File[] files = scanner.findFiles(fdir);

        for (int i = 0; i < files.length; i++) {
            File f = files[i];

            log.info("Reading file: " + f);

            PanelProvider p = null;
            try {
                p = loadPanelProvider(f);
                p.initialize();
            } catch (Exception e) {
                log.error("Error loading panel from file " + f, e);
            }
            if (p != null) {
                panels.put(p.getId(), p);
            } else {
                log.error("File format is not valid: " + f);
            }
        }

        DirectoriesScanner scannerHelp = new DirectoriesScanner("phelp");
        File[] helpFiles = scannerHelp.findFiles(fdir);
        for (int i = 0; i < helpFiles.length; i++) {
            File helpFile = helpFiles[i];
            PanelHelp pHelp = null;
            try {
                pHelp = loadHelpFile(helpFile);
View Full Code Here

    public Set<File> getJarFiles() {
        if (jarFiles != null) return jarFiles;

        jarFiles = new HashSet<File>();
        File libDir = new File(libDirectory);
        File[] jars = new DirectoriesScanner("jar").findFiles(libDir);
        for (int i = 0; i < jars.length; i++) {
            File jar = jars[i];
            String jarName = jar.getName();
            if (jarName.startsWith("dashboard-")) {
                jarFiles.add(jar);
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.commons.io.DirectoriesScanner

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.