Package ca.carleton.gcrc.couch.app

Examples of ca.carleton.gcrc.couch.app.Document


    ,AtlasProperties atlasProperties
    ,DocumentUpdateProcess updateProcess
    ) throws Exception {
   
    // Create _design/mobile document...
    Document doc = null;
    {
      File installDir = gs.getInstallDir();

      List<FSEntry> entries = new Vector<FSEntry>();
     
View Full Code Here


      String[] subDirNames = docsDir.list( gs.getFilenameFilter() );
      for(String subDirName : subDirNames){
        File subDir = new File(docsDir, subDirName);
        if( subDir.exists() && subDir.isDirectory() ) {
          // OK, let's create a document based on this
          Document doc = null;
          try {
            FSEntryFile entry = new FSEntryFile(subDir);
            doc = DocumentFile.createDocument(entry);
          } catch(Exception e){
            throw new Exception("Unable to read document at: "+subDir.getName(), e);
View Full Code Here

    if( false == ddDir.exists() || false == ddDir.isDirectory() ) {
      throw new ServletException("Invalid directory for server design doc: "+ddDir.getAbsolutePath());
    }

    // 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

    if( false == ddDir.exists() || false == ddDir.isDirectory() ) {
      throw new ServletException("Invalid directory for server design doc: "+ddDir.getAbsolutePath());
    }

    // 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

        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

    jsonWriter.key("features");
    jsonWriter.array();
   
    while( retrieval.hasNext() ){
      Document doc = retrieval.getNext();
      if( null != doc
       && docFilter.accepts(doc) ) {
        JSONObject jsonDoc = doc.getJSONObject();
       
        String schemaName = jsonDoc.optString("nunaliit_schema");
        if( null != schemaName ) {
          SchemaExportInfo exportInfo = schemaCache.getExportInfo(schemaName);
          if( null != exportInfo ){
            jsonWriter.object();
           
            jsonWriter.key("type");
            jsonWriter.value("Feature");

            jsonWriter.key("id");
            jsonWriter.value(doc.getId());
           
            jsonWriter.key("properties");
            jsonWriter.object();
           
            for(SchemaExportProperty exportProperty : exportInfo.getProperties()){
View Full Code Here

    if( null == jsonDoc ) {
      documentsFromSchemaName.put(schemaName, null);
      return null;
    }

    Document doc = new DocumentJSON(jsonDoc);
    documentsFromSchemaName.put(schemaName, doc);
   
    return doc;
  }
View Full Code Here

      return exportInfoFromSchemaName.get(schemaName);
    }
   
    SchemaExportInfo exportInfo = null;
    try {
      Document doc = getSchema(schemaName);
      if( null != doc ) {
        JSONArray jsonExport = doc.getJSONObject().optJSONArray("export");
        if( null != jsonExport ) {
          exportInfo = SchemaExportInfo.parseJson(jsonExport);
        }
      }
    } catch(Exception e) {
View Full Code Here

    if( false == ddDir.exists() || false == ddDir.isDirectory() ) {
      throw new ServletException("Invalid directory for server design doc: "+ddDir.getAbsolutePath());
    }

    // 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

TOP

Related Classes of ca.carleton.gcrc.couch.app.Document

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.