Examples of FileSystemResource


Examples of org.apache.jackrabbit.core.fs.FileSystemResource

            throw new IllegalStateException("not initialized");
        }

        try {
            String propFilePath = buildPropFilePath(id);
            FileSystemResource propFile = new FileSystemResource(itemStateFS, propFilePath);
            return propFile.exists();
        } catch (FileSystemException fse) {
            String msg = "failed to check existence of item state: " + id;
            log.error(msg, fse);
            throw new ItemStateException(msg, fse);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.fs.FileSystemResource

            throw new IllegalStateException("not initialized");
        }

        try {
            String refsFilePath = buildNodeReferencesFilePath(id);
            FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
            return refsFile.exists();
        } catch (FileSystemException fse) {
            String msg = "failed to check existence of references: " + id;
            log.debug(msg);
            throw new ItemStateException(msg, fse);
        }
View Full Code Here

Examples of org.apache.jackrabbit.core.fs.FileSystemResource

            uriToIndex.put(uri, idx);
        }
    }

    private void load() throws RepositoryException {
        FileSystemResource propFile =
                new FileSystemResource(nsRegStore, NS_REG_RESOURCE);
        FileSystemResource idxFile =
                new FileSystemResource(nsRegStore, NS_IDX_RESOURCE);
        try {
            if (!propFile.exists()) {
                // clear existing mappings
                clear();

                // default namespace (if no prefix is specified)
                map(QName.NS_EMPTY_PREFIX, QName.NS_DEFAULT_URI);

                // declare the predefined mappings
                // rep:
                map(QName.NS_REP_PREFIX, QName.NS_REP_URI);
                // jcr:
                map(QName.NS_JCR_PREFIX, QName.NS_JCR_URI);
                // nt:
                map(QName.NS_NT_PREFIX, QName.NS_NT_URI);
                // mix:
                map(QName.NS_MIX_PREFIX, QName.NS_MIX_URI);
                // sv:
                map(QName.NS_SV_PREFIX, QName.NS_SV_URI);
                // xml:
                map(QName.NS_XML_PREFIX, QName.NS_XML_URI);

                // persist mappings
                store();
                return;
            }

            // check if index file exists
            Properties indexes = new Properties();
            if (idxFile.exists()) {
                InputStream in = idxFile.getInputStream();
                try {
                    indexes.load(in);
                } finally {
                    in.close();
                }
            }

            InputStream in = propFile.getInputStream();
            try {
                Properties props = new Properties();
                props.load(in);

                // clear existing mappings
                clear();

                // read mappings from properties
                Iterator iter = props.keySet().iterator();
                while (iter.hasNext()) {
                    String prefix = (String) iter.next();
                    String uri = props.getProperty(prefix);
                    String idx = indexes.getProperty(uri);
                    if (idx != null) {
                        map(prefix, uri, Integer.decode(idx));
                    } else {
                        map(prefix, uri);
                    }
                }
            } finally {
                in.close();
            }
            if (!idxFile.exists()) {
                store();
            }
        } catch (Exception e) {
            String msg = "failed to load namespace registry";
            log.debug(msg);
View Full Code Here

Examples of org.apache.jackrabbit.core.fs.FileSystemResource

            throw new RepositoryException(msg, e);
        }
    }

    private void store() throws RepositoryException {
        FileSystemResource propFile =
                new FileSystemResource(nsRegStore, NS_REG_RESOURCE);
        try {
            propFile.makeParentDirs();
            OutputStream os = propFile.getOutputStream();
            Properties props = new Properties();

            // store mappings in properties
            Iterator iter = prefixToURI.keySet().iterator();
            while (iter.hasNext()) {
                String prefix = (String) iter.next();
                String uri = (String) prefixToURI.get(prefix);
                props.setProperty(prefix, uri);
            }

            try {
                props.store(os, null);
            } finally {
                // make sure stream is closed
                os.close();
            }
        } catch (Exception e) {
            String msg = "failed to persist namespace registry";
            log.debug(msg);
            throw new RepositoryException(msg, e);
        }

        FileSystemResource indexFile =
                new FileSystemResource(nsRegStore, NS_IDX_RESOURCE);
        try {
            indexFile.makeParentDirs();
            OutputStream os = indexFile.getOutputStream();
            Properties props = new Properties();

            // store mappings in properties
            Iterator iter = uriToIndex.keySet().iterator();
            while (iter.hasNext()) {
View Full Code Here

Examples of org.apache.jackrabbit.core.fs.FileSystemResource

     */
    public StringIndex getNsIndex() {
        try {
            if (nsIndex == null) {
                // load name and ns index
                FileSystemResource nsFile = new FileSystemResource(context.getFileSystem(), RES_NS_INDEX);
                if (nsFile.exists()) {
                    nsIndex = new FileBasedIndex(nsFile);
                } else {
                    nsIndex = (StringIndex) context.getNamespaceRegistry();
                }
            }
View Full Code Here

Examples of org.apache.jackrabbit.core.fs.FileSystemResource

     * @throws IllegalStateException if an error occurs.
     */
    public StringIndex getNameIndex() {
        try {
            if (nameIndex == null) {
                nameIndex = new FileBasedIndex(new FileSystemResource(
                        context.getFileSystem(), RES_NAME_INDEX));
            }
            return nameIndex;
        } catch (Exception e) {
            IllegalStateException e2 = new IllegalStateException("Unable to create nameIndex.");
View Full Code Here

Examples of org.apache.syncope.console.resources.FilesystemResource

            private static final long serialVersionUID = -128426276529456602L;

            @Override
            public IResource getResource() {
                return new FilesystemResource(ACTIVITI_MODELER_CONTEXT, activitiModelerDirectory);
            }

        });
        mountResource("/workflowDefGET", new ResourceReference("workflowDefGET") {
View Full Code Here

Examples of org.drools.core.io.impl.FileSystemResource


    @Test
    public void testCompilationUndo() {
        KnowledgeBuilder knowledgeBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        knowledgeBuilder.add( new FileSystemResource( resources[ 0 ] ), ResourceType.CHANGE_SET );

        assertTrue( knowledgeBuilder.hasErrors() );

        knowledgeBuilder.undo();
View Full Code Here

Examples of org.drools.io.impl.FileSystemResource

            KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
            KnowledgeAgent kAgent = createKAgent( kbase, false );

            ChangeSetHelperImpl cs = new ChangeSetHelperImpl();
            FileSystemResource f = (FileSystemResource) ResourceFactory.newFileResource(res);
            f.setResourceType( ResourceType.DRL );
            cs.addNewResource( f );
            kAgent.applyChangeSet( cs.getChangeSet() );

            ksession = kAgent.getKnowledgeBase().newStatefulKnowledgeSession();
View Full Code Here

Examples of org.flywaydb.core.internal.util.scanner.filesystem.FileSystemResource

            int filesExecuted = 0;
            List<File> sqlFiles = new ArrayList<File>();
            collectSqlFiles(baseDirectory, sqlFiles);

            for (File sqlFile : sqlFiles) {
                Resource resource = new FileSystemResource(sqlFile.getAbsolutePath());
                SqlScript script = new SqlScript(resource.loadAsString("UTF-8"), support);
                System.out.format("execute sql file: %s%n", sqlFile.getAbsolutePath());
                script.execute(support.getJdbcTemplate());
                filesExecuted++;
            }
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.