Package ca.carleton.gcrc.couch.fsentry

Examples of ca.carleton.gcrc.couch.fsentry.FSEntry


    // Create _design/mobile document...
    Document doc = null;
    {
      File mobileDesignDir = PathComputer.computeMobileDesignDir(gs.getInstallDir());
         
      FSEntry fileEntry = new FSEntryFile(mobileDesignDir);
      doc = DocumentFile.createDocument(fileEntry);
    }

    // Update document
    updateProcess.update(doc);
View Full Code Here


    try {
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(couchDb);
      updateProcess.setListener(UpdateListener._singleton);
     
      FSEntry fileEntry = new FSEntryFile(ddDir);
      Document doc = DocumentFile.createDocument(fileEntry);

      updateProcess.update(
          doc
          ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
View Full Code Here

        String[] fileNames = documentsDir.list();
        for(String fileName : fileNames) {
          File file = new File(documentsDir, fileName);
   
          try {
            FSEntry fileEntry = new FSEntryFile(file);
            Document doc = DocumentFile.createDocument(fileEntry);

            updateProcess.update(doc);

          } catch(Exception e) {
            throw new ServletException("Problem pushing document: "+file.getAbsolutePath(), e);
          }
        }
      }
    }
   
    // Find root directory for updating documents
    {
      File documentsDir = null;
      {
        documentsDir = new File(webInfDirectory, "updateDocs");
        if( false == documentsDir.exists() || false == documentsDir.isDirectory() ) {
          documentsDir = null;
        }
      }
     
      if( null == documentsDir ) {
        logger.error("Unable to find document directory for updating");
      } else {
        String[] fileNames = documentsDir.list();
        for(String fileName : fileNames) {
          File file = new File(documentsDir, fileName);
   
          try {
            FSEntry fileEntry = new FSEntryFile(file);
            Document doc = DocumentFile.createDocument(fileEntry);

            updateProcess.update(
              doc
              ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
View Full Code Here

     
      // htdocs from atlas project
      {
        File htdocsDir = new File(atlasDir, "htdocs");
        if( htdocsDir.exists() && htdocsDir.isDirectory() ) {
          FSEntry positionedHtDocs = FSEntryFile.getPositionedFile("d/_attachments", htdocsDir);
          mergedEntries.add(positionedHtDocs);
        }
      }
     
      // site from atlas project
      {
        File siteDir = new File(atlasDir, "site");
        if( siteDir.exists() && siteDir.isDirectory() ) {
          FSEntry siteEntry = new FSEntryFile(siteDir);
          mergedEntries.add(siteEntry);
        }
      }

      // Create atlas designator
      {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
       
        pw.println("var n2atlas = {");
        pw.println("\tname: \""+atlasProperties.getAtlasName()+"\"");
        pw.println("\t,restricted: "+atlasProperties.isRestricted());
        pw.println("};");
        pw.println("if( typeof(exports) === 'object' ) {");
        pw.println("\texports.name = n2atlas.name;");
        pw.println("\texports.restricted = n2atlas.restricted;");
        pw.println("};");
       
        FSEntry f = FSEntryBuffer.getPositionedBuffer("a/vendor/nunaliit2/atlas.js", sw.toString());
        mergedEntries.add(f);
        f = FSEntryBuffer.getPositionedBuffer("a/_attachments/lib/atlas.js", sw.toString());
        mergedEntries.add(f);
      }
     
     
      // Template for _design/site
      {
        File siteDesignDocDir = PathComputer.computeSiteDesignDir( gs.getInstallDir() );
        if( siteDesignDocDir.exists() && siteDesignDocDir.isDirectory() ){
          FSEntry templateDir = new FSEntryFile(siteDesignDocDir);
          mergedEntries.add(templateDir);
        } else {
          throw new Exception("Unable to find internal template for _design/site");
        }
      }
     
      FSEntry merged = new FSEntryMerged(mergedEntries);
      doc = DocumentFile.createDocument(merged);
    }

    // Update document
    updateProcess.update(doc);
View Full Code Here

      List<FSEntry> entries = new Vector<FSEntry>();
     
      // Force identifier
      {
        FSEntry f = FSEntryBuffer.getPositionedBuffer("a/_id.txt", "_design/atlas");
        entries.add(f);
      }
     
      // Create atlas designator
      {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
       
        pw.println("{");
        pw.println("\t\"name\":\""+atlasProperties.getAtlasName()+"\"");
        pw.println("\t,\"restricted\":"+atlasProperties.isRestricted());
        pw.println("}");
       
        FSEntry f = FSEntryBuffer.getPositionedBuffer("a/nunaliit.json", sw.toString());
        entries.add(f);
      }
     
      // Create atlas designator
      {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
       
        pw.println("var n2atlas = {");
        pw.println("\tname: \""+atlasProperties.getAtlasName()+"\"");
        pw.println("\t,restricted: "+atlasProperties.isRestricted());
        pw.println("};");
        pw.println("if( typeof(exports) === 'object' ) {");
        pw.println("\texports.name = n2atlas.name;");
        pw.println("\texports.restricted = n2atlas.restricted;");
        pw.println("};");
       
        FSEntry f = FSEntryBuffer.getPositionedBuffer("a/vendor/nunaliit2/atlas.js", sw.toString());
        entries.add(f);
        f = FSEntryBuffer.getPositionedBuffer("a/_attachments/lib/atlas.js", sw.toString());
        entries.add(f);
      }
     
      // Atlas design template
      {
        File atlasDesignDir = PathComputer.computeAtlasDesignDir(installDir);
        if( null == atlasDesignDir ) {
          throw new Exception("Can not find _design/atlas template");
        } else {
          FSEntryFile f = new FSEntryFile(atlasDesignDir);
          entries.add(f);
        }
      }
     
      // Nunaliit2 javascript library
      {
        File n2Dir = PathComputer.computeNunaliit2JavascriptDir(installDir);
        if( null == n2Dir ) {
          throw new Exception("Can not find nunaliit2 javascript library");
        } else {
          // Libraries
          {
            FSEntry f = FSEntryFile.getPositionedFile("a/_attachments/nunaliit2", n2Dir);
            entries.add(f);
          }
         
          // Vendor file 'n2.couchUtils.js'
          {
            File file = new File(n2Dir,"n2.couchUtils.js");
            FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchUtils.js", file);
            entries.add(f);
          }
         
          // Vendor file 'n2.couchTiles.js'
          {
            File file = new File(n2Dir,"n2.couchTiles.js");
            FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchTiles.js", file);
            entries.add(f);
          }
        }
      }
     
      // External javascript library
      {
        File externalDir = PathComputer.computeExternalJavascriptDir(installDir);
        if( null == externalDir ) {
          throw new Exception("Can not find external javascript library");
        } else {
          FSEntry f = FSEntryFile.getPositionedFile("a/_attachments/js-external", externalDir);
          entries.add(f);
        }
      }
     
      // Install language
      {
        FSEntry f = FSEntryBuffer.getPositionedBuffer("a/language.txt", "javascript");
        entries.add(f);
      }
     
      // Create FSEntry to load document
      FSEntryMerged mergedEntry = new FSEntryMerged(entries);
View Full Code Here

      List<FSEntry> entries = new Vector<FSEntry>();
     
      // Force identifier
      {
        FSEntry f = FSEntryBuffer.getPositionedBuffer("a/_id.txt", "_design/mobile");
        entries.add(f);
      }
     
      // Create atlas designator
      {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
       
        pw.println("var n2atlas = {");
        pw.println("\tname: \""+atlasProperties.getAtlasName()+"\"");
        pw.println("};");
        pw.println("if( typeof(exports) === 'object' ) {");
        pw.println("\texports.name = n2atlas.name;");
        pw.println("};");
       
        FSEntry f = FSEntryBuffer.getPositionedBuffer("a/vendor/nunaliit2/atlas.js", sw.toString());
        entries.add(f);
      }
     
      // Nunaliit2 vendor libraries
      {
        File n2Dir = PathComputer.computeNunaliit2JavascriptDir(installDir);
        if( null == n2Dir ) {
          throw new Exception("Can not find nunaliit2 javascript library");
        } else {
          // Vendor file 'n2.couchUtils.js'
          {
            File file = new File(n2Dir,"n2.couchUtils.js");
            FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchUtils.js", file);
            entries.add(f);
          }
         
          // Vendor file 'n2.couchTiles.js'
          {
            File file = new File(n2Dir,"n2.couchTiles.js");
            FSEntry f = FSEntryFile.getPositionedFile("a/vendor/nunaliit2/n2.couchTiles.js", file);
            entries.add(f);
          }
        }
      }
     
      // Mobile design content
      {
        File mobileDesignDir = PathComputer.computeMobileDesignDir(gs.getInstallDir());
        FSEntry f = new FSEntryFile(mobileDesignDir);
        entries.add(f);
      }

      // Create FSEntry to load document
      FSEntryMerged mergedEntry = new FSEntryMerged(entries);
View Full Code Here

    }

    // Load server design document
    Document doc = null;
    try {
      FSEntry entry = new FSEntryFile(ddDir);
      doc = DocumentFile.createDocument(entry);
    } catch(Exception e){
      throw new ServletException("Unable to read server design document",e);
    }
   
View Full Code Here

    try {
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(couchDb);
      updateProcess.setListener(UpdateListener._singleton);
     
      FSEntry fileEntry = new FSEntryFile(ddDir);
      Document doc = DocumentFile.createDocument(fileEntry);

      updateProcess.update(
          doc
          ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
View Full Code Here

    try {
      CouchDb userDb = couchClient.getDatabase("_users");
      DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(userDb);
      updateProcess.setListener(UpdateListener._singleton);
     
      FSEntry fileEntry = new FSEntryFile(ddDir);
      Document doc = DocumentFile.createDocument(fileEntry);

      updateProcess.update(
          doc
          ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
View Full Code Here

        String[] fileNames = documentsDir.list();
        for(String fileName : fileNames) {
          File file = new File(documentsDir, fileName);
   
          try {
            FSEntry fileEntry = new FSEntryFile(file);
            Document doc = DocumentFile.createDocument(fileEntry);

            updateProcess.update(doc);

          } catch(Exception e) {
            throw new ServletException("Problem pushing document: "+file.getAbsolutePath(), e);
          }
        }
      }
    }
   
    // Find root directory for updating documents
    {
      File documentsDir = null;
      {
        documentsDir = new File(webInfDirectory, "updateDocs");
        if( false == documentsDir.exists() || false == documentsDir.isDirectory() ) {
          documentsDir = null;
        }
      }
     
      if( null == documentsDir ) {
        logger.error("Unable to find document directory for updating");
      } else {
        String[] fileNames = documentsDir.list();
        for(String fileName : fileNames) {
          File file = new File(documentsDir, fileName);
   
          try {
            FSEntry fileEntry = new FSEntryFile(file);
            Document doc = DocumentFile.createDocument(fileEntry);

            updateProcess.update(
              doc
              ,DocumentUpdateProcess.Schedule.UPDATE_EVEN_IF_MODIFIED
View Full Code Here

TOP

Related Classes of ca.carleton.gcrc.couch.fsentry.FSEntry

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.