Package org.exist.util.io

Examples of org.exist.util.io.Resource


        builder.startDocument();
        builder.startElement(new QName("status", null, null), null);
   
        try {
      statusClient.doStatus(
          new Resource(uri),
          SVNRevision.HEAD,
          SVNDepth.getInfinityOrFilesDepth(true),
          true, true, false, false, 
          new AddStatusHandler(false, builder),
          null);
View Full Code Here


        String wcDir = args[0].getStringValue();
       
        try {
          WorkingCopy wc = new WorkingCopy("", "");

          wc.revert(new File[] { new Resource(wcDir) });

        } catch (SVNException svne) {
      svne.printStackTrace();
      throw new XPathException(this,
          "error while revert '" + wcDir + "'", svne);
View Full Code Here

    WorkingCopy wc = new WorkingCopy("", "");
       
        String uri = args[0].getStringValue();
        String lockComment = args[1].getStringValue();
      
        Resource wcDir = new Resource(uri);
       
        try {
      wc.lock(wcDir, false, lockComment);
    } catch (SVNException e) {
            throw new XPathException(this, e.getMessage(), e);
View Full Code Here

    }
        WorkingCopy wc = new WorkingCopy(login, password);
        String uri = args[0].getStringValue();
        String destPath = args[1].getStringValue();
       
        Resource wcDir = new Resource(destPath);
        if (wcDir.exists()) {
          IOException exception =
              new IOException("the destination directory '" + wcDir.getAbsolutePath() + "' already exists!");

          LOG.debug(exception);
         
          throw new XPathException(this, exception);
        }
View Full Code Here

        String wcDir = args[0].getStringValue();
       
        try {
        WorkingCopy wc = new WorkingCopy("", "");

          wc.delete(new Resource(wcDir), true);
    } catch (SVNException svne) {
      svne.printStackTrace();
      throw new XPathException(this,
          "error while scheduling deletion from version control of '"
                    + wcDir + "'", svne);
View Full Code Here

        String uri = args[0].getStringValue();
        DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true);
        SVNClientManager manager = SVNClientManager.newInstance(options, "", "");
       
        try {
      manager.getWCClient().doCleanup(new Resource(uri));
    } catch (SVNException e) {
      throw new XPathException(this, e.getMessage(), e);
    }
       
        return Sequence.EMPTY_SEQUENCE; 
View Full Code Here

       
    WorkingCopy wc = new WorkingCopy("", "");
       
        String uri = args[0].getStringValue();
      
        Resource wcDir = new Resource(uri);
      try {
       
            MemTreeBuilder builder = context.getDocumentBuilder();
       
            AttributesImpl attribs = new AttributesImpl();
View Full Code Here

    public final void createLocalDir(Resource aNewDir, Resource[] localFiles, String[] fileContents){
        if (!aNewDir.mkdirs()) {
            error("failed to create a new directory '" + aNewDir.getAbsolutePath() + "'.", null);
        }
        for(int i=0; i < localFiles.length; i++){
          Resource aNewFile = localFiles[i];
            try {
              if (!aNewFile.createNewFile()) {
                  error("failed to create a new file '"
                          + aNewFile.getAbsolutePath() + "'.", null);
              }
          } catch (IOException ioe) {
              aNewFile.delete();
              error("error while creating a new file '"
                      + aNewFile.getAbsolutePath() + "'", ioe);
          }
 
          String contents = null;
          if(i > fileContents.length-1){
              continue;
          }
            contents = fileContents[i];
         
          /*
           * writing a text into the file
           */
          OutputStream fos = null;
          try {
            fos = aNewFile.getOutputStream();
              fos.write(contents.getBytes());
          } catch (FileNotFoundException fnfe) {
              error("the file '" + aNewFile.getAbsolutePath() + "' is not found", fnfe);
          } catch (IOException ioe) {
              error("error while writing into the file '"
                      + aNewFile.getAbsolutePath() + "'", ioe);
          } finally {
              if (fos != null) {
                  try {
                      fos.close();
                  } catch (IOException ioe) {
View Full Code Here

            SVNErrorManager.error(err, SVNLogType.DEFAULT);
        }
        myCurrentRevision = fileRevision.getRevision();
        boolean known = fileRevision.getRevision() >= myStartRevision;
        if (myCancelBaton != null) {
            File file = SVNPathUtil.isURL(myPath) ? null : new Resource(myPath);
            SVNEvent event = SVNEventFactory.createSVNEvent(file, SVNNodeKind.NONE, null, myCurrentRevision, SVNEventAction.ANNOTATE, null, null, null);
            if (file == null) {
                event.setURL(SVNURL.parseURIDecoded(myPath));
            }
            myCancelBaton.handleEvent(event, ISVNEventHandler.UNKNOWN);
View Full Code Here

            error("error while making a new directory at '" + url + "'", svne);
        }
        System.out.println("Committed to revision " + committedRevision);
        System.out.println();

        Resource anImportDir = new Resource(myHomePath+importDir);
        Resource anImportFile = new Resource(anImportDir, SVNPathUtil.tail(importFile));
        /*
         * creates a new local directory - './importDir' and a new file -
         * './importDir/importFile.txt' that will be imported into the repository
         * into the '/MyRepos/importDir' directory
         */
        createLocalDir(anImportDir, new Resource[]{anImportFile}, new String[]{importFileText});
       
        System.out.println("Importing a new directory into '" + importToURL + "'...");
        try{
            /*
             * recursively imports an unversioned directory into a repository
             * and displays what revision the repository was committed to
             */
            boolean isRecursive = true;
            committedRevision = wc.importDirectory(anImportDir, importToURL, "importing a new directory '" + anImportDir.getAbsolutePath() + "'", isRecursive).getNewRevision();
        }catch(SVNException svne){
            error("error while importing a new directory '" + anImportDir.getAbsolutePath() + "' into '" + importToURL + "'", svne);
        }
        System.out.println("Committed to revision " + committedRevision);
        System.out.println();
       
       
        /*
         * creates a local directory where the working copy will be checked out into
         */
        Resource wcDir = new Resource(myHomePath+myWorkingCopyPath);
        if (wcDir.exists()) {
            error("the destination directory '"
                    + wcDir.getAbsolutePath() + "' already exists!", null);
        }
        wcDir.mkdirs();

        System.out.println("Checking out a working copy from '" + url + "'...");
        try {
            /*
             * recursively checks out a working copy from url into wcDir.
             * SVNRevision.HEAD means the latest revision to be checked out.
             */
          wc.checkout(url, SVNRevision.HEAD, wcDir, true);
        } catch (SVNException svne) {
            error("error while checking out a working copy for the location '"
                            + url + "'", svne);
        }
        System.out.println();
       
        /*
         * recursively displays info for wcDir at the current working revision
         * in the manner of 'svn info -R' command
         */
        try {
          wc.showInfo(wcDir, SVNRevision.WORKING, true, new InfoHandler());
        } catch (SVNException svne) {
            error("error while recursively getting info for the working copy at'"
                    + wcDir.getAbsolutePath() + "'", svne);
        }
        System.out.println();

        Resource aNewDir = new Resource(wcDir, newDir);
        Resource aNewFile = new Resource(aNewDir, SVNPathUtil.tail(newFile));
        Resource aNewFileXml = new Resource(aNewDir, SVNPathUtil.tail(newFileXml));
        /*
         * creates a new local directory - 'wcDir/newDir' and a new file -
         * '/MyWorkspace/newDir/newFile.txt'
         */
        createLocalDir(aNewDir, new Resource[]{aNewFile,aNewFileXml}, new String[]{fileText,fileTextXml});
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.