Package org.exist.util.io

Examples of org.exist.util.io.Resource


    public File getAdminDirectory() {
        return myAdminRoot;
    }

    public Resource getAdminFile(String name) {
        return new Resource(getAdminDirectory(), name);
    }
View Full Code Here


    public File getFile(String name) {
        if (name == null) {
            return null;
        }
        return new Resource(getRoot(), name);
    }
View Full Code Here

    protected abstract int writeExtraOptions(Writer writer, String entryName, Map entryAttrs, int emptyFields) throws SVNException, IOException;

    protected SVNAdminArea(File dir){
        myDirectory = dir;
        myAdminRoot = new Resource(dir, SVNFileUtil.getAdminDirectoryName());
    }
View Full Code Here

    public int getSupportedVersion() {
        return WC_FORMAT;
    }

    protected int doCheckWC(File path, Level logLevel) throws SVNException {
        File adminDir = new Resource(path, SVNFileUtil.getAdminDirectoryName());
        File entriesFile = new Resource(adminDir, "entries");
        if (!entriesFile.exists()) {
          return 0;
//            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Cannot read entries file ''{0}'': {1}", new Object[] {entriesFile, "This resource does not exist."});
//            throw new SVNException(err);
        }
         
        int formatVersion = -1;

        BufferedReader reader = null;
        String line = null;
   
        try {
            reader = new BufferedReader(new InputStreamReader(SVNFileUtil.openFileForReading(entriesFile, logLevel, SVNLogType.WC), "UTF-8"));
            line = reader.readLine();
        } catch (FileNotFoundException e) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Cannot read entries file ''{0}'': {1}", new Object[] {entriesFile, e.getLocalizedMessage()});
            throw new SVNException(err);
        } catch (IOException e) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Cannot read entries file ''{0}'': {1}", new Object[] {entriesFile, e.getLocalizedMessage()});
            SVNErrorManager.error(err, e, SVNLogType.WC);
        } catch (SVNException svne) {
            SVNFileType type = SVNFileType.getType(path);
            if (type != SVNFileType.DIRECTORY || !entriesFile.exists()) {
                if (type == SVNFileType.NONE) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "''{0}'' does not exist", path);
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
                return 0;
View Full Code Here

        }
        return formatVersion;
    }
   
    protected int getVersion(File path) throws SVNException {
        File adminDir = new Resource(path, SVNFileUtil.getAdminDirectoryName());
        File entriesFile = new Resource(adminDir, "entries");
        int formatVersion = -1;

        BufferedReader reader = null;
        String line = null;
   
View Full Code Here

                    continue;
                }
                if (entry.getDepth() == SVNDepth.EXCLUDE) {
                    continue;
                }
                File childPath = new Resource(path, entry.getName());
                try {
                    // this method will put created area into our map.
                    doOpen(childPath, writeLock, stealLock, upgradeFormat, depth, tmp, logLevel);
                } catch (SVNException e) {
                    if (e.getErrorMessage().getErrorCode() != SVNErrorCode.WC_NOT_DIRECTORY) {
                        doClose(tmp, false);
                        throw e;
                    }
                    // only for missing!
                    tmp.put(childPath, null);
                }
               
                SVNAdminArea childArea = (SVNAdminArea) tmp.get(childPath);               
                if (childArea != null) {
                    SVNEntry childRootEntry = childArea.getEntry(childArea.getThisDirName(), false);
                    SVNEntry thisRootEntry = area.getEntry(childArea.getThisDirName(), false);
                   
                    String childRoot = childRootEntry.getRepositoryRoot();
                    String expectedRoot = thisRootEntry.getRepositoryRoot();
                   
                    if (childRoot != null && !childRoot.equals(expectedRoot)) {
                        Map toClose = new SVNHashMap();
                        toClose.put(childPath, childArea);
                        String childPathAbs = childPath.getAbsolutePath().replace(File.separatorChar, '/');
                        for (Iterator paths = tmp.keySet().iterator(); paths.hasNext();) {
                            File p = (File) paths.next();
                            String pAbs = p.getAbsolutePath().replace(File.separatorChar, '/');
                            if (SVNPathUtil.isAncestor(childPathAbs, pAbs)) {
                                toClose.put(p, tmp.get(p));
View Full Code Here

        }
        return false;
    }

    public boolean isLocked(File path) throws SVNException {
        File lockFile = new Resource(path, SVNFileUtil.getAdminDirectoryName());
        lockFile = new Resource(lockFile, "lock");
        if (SVNFileType.getType(lockFile) == SVNFileType.FILE) {
            return true;
        } else if (SVNFileType.getType(lockFile) == SVNFileType.NONE) {
            return false;
        }
View Full Code Here

                } else if (subEntry.getKind() == SVNNodeKind.FILE && type == SVNFileType.DIRECTORY) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_NOT_LOCKED, "Expected ''{0}'' to be a file but found a directory", path);
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
            }
            File adminDir = new Resource(path, SVNFileUtil.getAdminDirectoryName());
            SVNFileType wcType = SVNFileType.getType(adminDir);
           
            if (type == SVNFileType.NONE) {
                SVNErrorMessage childErr = SVNErrorMessage.create(SVNErrorCode.WC_PATH_NOT_FOUND, "Directory ''{0}'' is missing", path);
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_NOT_LOCKED, "Directory ''{0}'' is missing", path);
View Full Code Here

        File file = null;
        if (item.getFile() != null) {
            file = item.getFile();
        } else if (item.getPath() != null) {
            file = new Resource(wcAccess.getAnchor(), item.getPath());
        }

        long rev = item.getRevision().getNumber();
        if (item.isAdded() && item.isDeleted()) {
            event = SVNEventFactory.createSVNEvent(file, item.getKind(), null, SVNRepository.INVALID_REVISION, SVNEventAction.COMMIT_REPLACED, null, null, null);
View Full Code Here

            String path = (String) paths.next();
            SVNCommitItem item = (SVNCommitItem) myModifiedFiles.get(path);
            SVNWCAccess wcAccess = item.getWCAccess();
            wcAccess.checkCancelled();

            SVNEvent event = SVNEventFactory.createSVNEvent(new Resource(wcAccess.getAnchor(), item.getPath()),SVNNodeKind.FILE, null, SVNRepository.INVALID_REVISION, SVNEventAction.COMMIT_DELTA_SENT, null, null, null);
            wcAccess.handleEvent(event, ISVNEventHandler.UNKNOWN);

            SVNAdminArea dir = wcAccess.retrieve(item.getFile().getParentFile());
            String name = SVNPathUtil.tail(item.getPath());
            SVNEntry entry = dir.getEntry(name, false);
View Full Code Here

TOP

Related Classes of org.exist.util.io.Resource

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.