Examples of FeedClient


Examples of org.atomojo.app.client.FeedClient

            assertTrue(status.isSuccess());
       */
      for (int j=0; j<10; j++)
         for (int i=0; i<100; i++) {
            Reference feedRef = new Reference(config.getServerLocation()+"R/"+i+"/");
            FeedClient feedClient = new FeedClient(client,feedRef);
            feedClient.setIdentity("admin","admin");

            Entry entry = null;
            if (!feedClient.exists()) {
               log.info("Creating feed "+i);
               Status status = feedClient.create("<feed xmlns='http://www.w3.org/2005/Atom'><title>Feed "+i+"</title></feed>");
               if (!status.isSuccess()) {
                  log.info("Failure, status="+status.getCode());
               }
               assertTrue(status.isSuccess());
            } else {

               log.info("Checking feed "+i);
               final AtomicReference<Entry> theEntry = new AtomicReference<Entry>();
               feedClient.get(new FeedDestination() {
                  public void onEntry(Document entryDoc) {
                     Entry entry = new Entry(entryDoc);
                     entry.index();
                     theEntry.set(entry);
                  }
               });
               entry = theEntry.get();
            }
            if (entry==null) {
               try {
                  log.info("Creating entry in "+i);
                  feedClient.createEntry("<entry xmlns='http://www.w3.org/2005/Atom'><title>Entry "+i+"</title></entry>");
               } catch (StatusException ex) {
                  log.info("Failure, status="+ex.getStatus().getCode());
                  assertTrue(false);
               }
            } else {
               log.info("Updating entry in "+i);
               entry.setTitle("Updated "+entry.getTitle());
               EntryClient entryClient = feedClient.getEntryClient(entry);
               Status status = entryClient.update();
               if (!status.isSuccess()) {
                  log.info("Failure, status="+status.getCode());
               }
               assertTrue(status.isSuccess());
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

            assertTrue(status.isSuccess());
       */
      for (int j=0; j<10; j++)
         for (int i=0; i<10; i++) {
            Reference feedRef = new Reference(config.getServerLocation()+"R/"+i+"/");
            FeedClient feedClient = new FeedClient(client,feedRef);
            feedClient.setIdentity("admin","admin");

            log.info("Checking feed "+j+","+i);
            Entry entry = null;
            final AtomicReference<Entry> theEntry = new AtomicReference<Entry>();
            Status status = feedClient.get(new FeedDestination() {
               public void onEntry(Document entryDoc) {
                  Entry entry = new Entry(entryDoc);
                  entry.index();
                  theEntry.set(entry);
               }
            }).getStatus();
            if (status.getCode()==404) {
               log.info("Creating feed "+j+","+i);
               status = feedClient.create("<feed xmlns='http://www.w3.org/2005/Atom'><title>Feed "+j+","+i+"</title></feed>");
               if (!status.isSuccess()) {
                  log.info("Failure, status="+status.getCode());
               }
               assertTrue(status.isSuccess());
            } else if (status.isSuccess()) {
               entry = theEntry.get();
            } else {
               if (!status.isSuccess()) {
                  log.info("Failure, status="+status.getCode());
               }
               assertTrue(status.isSuccess());
            }
            if (entry==null) {
               try {
                  log.info("Creating entry in "+j+","+i);
                  feedClient.createEntry("<entry xmlns='http://www.w3.org/2005/Atom'><title>Entry "+i+"</title></entry>");
               } catch (StatusException ex) {
                  log.info("Failure, status="+ex.getStatus().getCode());
                  assertTrue(false);
               }
            } else {
               log.info("Updating entry in "+i);
               entry.setTitle("Updated "+entry.getTitle());
               EntryClient entryClient = feedClient.getEntryClient(entry);
               status = entryClient.update();
               if (!status.isSuccess()) {
                  log.info("Failure, status="+status.getCode());
               }
               assertTrue(status.isSuccess());
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

      targets.add(new Target(directory,baseFeed));
      while (targets.size()>0) {
         final Target target = targets.remove(0);
         log.info("Syncing directory "+target.dir+" with feed "+target.feed);
        
         final FeedClient feedClient = new FeedClient(target.feed);
         feedClient.setIdentity(username,password);
         if (!feedClient.exists()) {
            log.info("Creating feed "+target.feed);
            try {
               Document doc = InfosetFactory.getDefaultInfoset().createItemConstructor().createDocument();
               Element feed = doc.createDocumentElement(FeedClient.FEED_NAME);
               Element title = feed.addElement(FeedClient.TITLE_NAME);
               title.addCharacters(target.dir.getName());
               Status status = feedClient.create(doc);
               if (!status.isSuccess()) {
                  log.log(Level.SEVERE,"Cannot create feed "+target.feed+" due to error "+status.getCode());
                  continue;
               }
            } catch (XMLException ex) {
               log.log(Level.SEVERE,"Cannot create feed "+target.feed+" due to exception.",ex);
               continue;
            }
         }
        
         final Map<String,Entry> entries = new HashMap<String,Entry>();
         try {
            feedClient.get(new FeedDestination() {
               public void onFeed(Document feedDoc) {}
               public void onEntry(Document entryDoc) {
                  Entry entry = new Entry(entryDoc);
                  Entry.Media media = entry.getMediaContent();
                  if (media!=null) {
                     //log.info("Caching entry for "+media.getName());
                     entries.put(media.getName(),entry);
                  }
               }
            });
         } catch (XMLException ex) {
            log.log(Level.SEVERE,"Cannot get feed "+target.feed+" due to XML exception.",ex);
            continue;
         } catch (IOException ex) {
            log.log(Level.SEVERE,"Cannot get feed "+target.feed+" due to I/O exception.",ex);
            continue;
         }
        
         String u = target.feed.toString();
         if (u.charAt(u.length()-1)!='/') {
            u += "/";
         }
         final String feedBase = u;
         final MetadataService metadataService = new MetadataService();
         target.dir.listFiles(new FileFilter() {
            public boolean accept(File file) {
               if (file.isDirectory()) {
                  URI subFeed = URI.create(feedBase+file.getName()+"/");
                  targets.add(new Target(file,subFeed));
               } else {
                  if (!excludeDot || file.getName().charAt(0)!='.') {
                     // Sync content
                     Entry entry = entries.get(file.getName());
                     Status status = null;
                     if (entry!=null) {
                        log.info("Updating "+file);
                        // update existing media
                        try {
                           FileInputStream is = new FileInputStream(file);
                           EntryClient client = feedClient.getEntryClient(entry);
                           status = client.updateMedia(new InputRepresentation(is,entry.getMediaContent().getMediaType()));
                           is.close();
                        } catch (IOException ex) {
                           log.log(Level.SEVERE,"Cannot update "+file+" due to I/O exception.",ex);
                        }
                        entries.remove(file.getName());
                     } else {
                        log.info("Creating "+file);
                        // create new media
                        try {
                           FileInputStream is = new FileInputStream(file);
                           int extPos = file.getName().lastIndexOf('.');
                           String ext = extPos<0 ? null : file.getName().substring(extPos+1);
                           Metadata metadata = ext==null ? null : metadataService.getMetadata(ext);
                           MediaType type = metadata==null ? MediaType.APPLICATION_OCTET_STREAM : MediaType.valueOf(metadata.getName());
                           Entry mediaEntry = feedClient.createMedia(file.getName(),new InputRepresentation(is,type));
                           is.close();
                        } catch (StatusException ex) {
                           log.log(Level.SEVERE,"Cannot create media entry from "+file+" due to status "+ex.getStatus().getCode(),ex);
                        } catch (Exception ex) {
                           log.log(Level.SEVERE,"Cannot create media entry from "+file+" due to exception.",ex);
                        }
                     }
                     if (status!=null && !status.isSuccess()) {
                        log.severe("Cannot update/create media entry for "+file+" due to status "+status.getCode());
                     }
                  }
               }
               return false;
            }
         });
         if (exact) {
            for (Entry entry : entries.values()) {
               EntryClient client = feedClient.getEntryClient(entry);
               Status status = client.delete();
               if (!status.isSuccess()) {
                  log.severe("Cannot delete extra entry "+entry.getId()+" due to status "+status.getCode());
               }
            }
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

      return errorCount;
   }
  
   public void run() {
      errorCount = 0;
      final FeedClient sourceClient = new FeedClient(source.getLink());
      sourceClient.setIdentity(source.getIdentity());
     
      final FeedClient targetClient = new FeedClient(target.getLink());
      targetClient.setIdentity(target.getIdentity());
     
      try {
         Response response = sourceClient.get(new FeedDestination() {
            Set<UUID> entries = additive ? null : new TreeSet<UUID>();
            boolean ok = true;
            public void onFeed(Document feedDoc) {
               URI baseURI = feedDoc.getBaseURI();
               // Make sure to remove the xml:base on the feed element for storage;
               feedDoc.getDocumentElement().getAttributes().remove(Attribute.XML_BASE);

               if (!targetClient.exists()) {
                  log.info("Creating target feed "+targetClient.getLocation());
                  Status status = targetClient.create(feedDoc);
                  if (!status.isSuccess()) {
                     log.severe("Cannot create target feed, status="+status.getCode());
                     errorCount++;
                     ok = false;
                  }
               }
            }
            public void onEntry(Document entryDoc) {
               if (!ok) {
                  return;
               }
               Entry entry = new Entry(entryDoc);
               entry.index();

               UUID entryId = null;
               try {
                  entryId = UUID.fromString(entry.getId().substring(9));
               } catch (IllegalArgumentException ex) {
                  log.severe("Ignoring entry with bad UUID: "+entry.getId());
                  errorCount++;
                  return;
               }
               log.info("Entry: "+entryId);
               EntryClient entryClient = new EntryClient(new Reference(targetClient.getEntryLocation(entryId).toString()),target.getIdentity());
               String src = null;
               Element content = entryDoc.getDocumentElement().getFirstElementNamed(CONTENT_NAME);
               URI baseURI = null;
               MediaType contentType = null;
               if (content!=null) {
                  src = content.getAttributeValue("src");
                  String type = content.getAttributeValue("type");
                  if (type!=null) {
                     contentType = MediaType.valueOf(type);
                  }
                  baseURI = content.getBaseURI();
               }
               if (entries!=null) {
                  entries.add(entryId);
               }
              
               Status exists = null;
               try {
                  exists = entryClient.get();
               } catch (Exception ex) {
                  log.log(Level.SEVERE,"Cannot get entry "+entryClient.getLocation()+", error: "+ex.getMessage(),ex);
                  errorCount++;
                  return;
               }
               if (exists.isSuccess()) {
                  entryClient.getEntry().index();
                  try {
                    
                     Status status = entryClient.update(entryDoc);
                     if (!status.isSuccess()) {
                        log.severe("Cannot update entry "+entryClient.getLocation()+", status="+status.getCode());
                        errorCount++;
                     }
                  } catch (Exception ex) {
                     log.log(Level.SEVERE,"Cannot update entry "+entryClient.getLocation()+", error: "+ex.getMessage(),ex);
                     errorCount++;
                  }
                  if (src!=null) {
                     // update media
                     Reference mediaLocation = new Reference(baseURI.resolve(src).toString());
                     Client client = new Client(mediaLocation.getSchemeProtocol());
                     Request getRequest = new Request(Method.GET,mediaLocation);
                     if (source.getIdentity()!=null) {
                        getRequest.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC,source.getUsername(),source.getPassword()));
                     }
                     Response getResponse = client.handle(getRequest);
                     if (getResponse.getStatus().isSuccess()) {
                        Reference targetLocation = new Reference(targetClient.getLocation().resolve(src).toString());
                        Client targetClient = new Client(targetLocation.getSchemeProtocol());
                        Request putRequest = new Request(Method.PUT,targetLocation);
                        if (target.getIdentity()!=null) {
                           putRequest.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC,target.getUsername(),target.getPassword()));
                        }
                        Representation rep = getResponse.getEntity();
                        if (contentType!=null) {
                           rep.setMediaType(contentType);
                        }
                        putRequest.setEntity(rep);
                        Response putResponse = targetClient.handle(putRequest);
                        if (!putResponse.getStatus().isSuccess()) {
                           log.severe("Cannot put media update to "+targetLocation+", status="+putResponse.getStatus().getCode());
                        }
                     } else {
                        if (!getResponse.getStatus().isSuccess()) {
                           log.severe("Cannot get media from "+mediaLocation+", status="+getResponse.getStatus().getCode());
                        }
                     }
                  }
               } else if (exists.getCode()==Status.CLIENT_ERROR_NOT_FOUND.getCode()) {
                  if (src==null) {
                     // regular entry
                     try {
                        targetClient.createEntry(entryDoc);
                     } catch (StatusException ex) {
                        log.severe("Cannot create entry "+entryClient.getLocation()+", status="+ex.getStatus().getCode());
                        errorCount++;
                     } catch (Exception ex) {
                        log.log(Level.SEVERE,"Cannot create entry "+entryClient.getLocation()+", error: "+ex.getMessage(),ex);
                        errorCount++;
                     }
                  } else {
                     // media entry
                     Reference mediaLocation = new Reference(baseURI.resolve(src).toString());
                     Client client = new Client(mediaLocation.getSchemeProtocol());
                     Request request = new Request(Method.GET,mediaLocation);
                     if (source.getIdentity()!=null) {
                        request.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC,source.getUsername(),source.getPassword()));
                     }
                     Response response = client.handle(request);
                     if (response.getStatus().isSuccess()) {
                        try {
                           Representation rep = response.getEntity();
                           if (contentType!=null) {
                              rep.setMediaType(contentType);
                           }
                           Entry mediaEntry = targetClient.createMedia(entryId, src, rep);
                           entryClient.setEntry(mediaEntry);
                           try {
                              Status status = entryClient.update(entryDoc);
                              if (!status.isSuccess()) {
                                 log.severe("Cannot update entry "+entryClient.getLocation()+", status="+status.getCode());
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

                  // We only process the first workspace
                  return;
               }
               URI location = collection.getLocation();
               log.info("Processing feed: "+location);
               FeedClient feedClient = new FeedClient(location);
               if (auth!=null) {
                  if (auth.getScheme().equals("cookie")) {
                     Cookie cookie = new Cookie(auth.getName(),auth.getPassword());
                     cookie.setPath("/");
                     feedClient.setCookie(cookie);
                  } else {
                     feedClient.setIdentity(auth.getName(),auth.getPassword());
                  }
               }
               try {
                  Response response = feedClient.get(new FeedDestination() {
                     Set<UUID> entries = additive ? null : new TreeSet<UUID>();
                     Feed feed = null;
                     public void onFeed(Document feedDoc) {
                        URI baseURI = feedDoc.getBaseURI();
                        // Make sure to remove the xml:base on the feed element for storage;
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

                  UUID entry = deleteEntry.getEntry();
                  URI feedURI = proc.getRemoteApp().getRoot().resolve(deleteEntry.getPath());
                  if (entry==null) {
                     // delete feed
                     log.info("Deleting feed "+feedURI);
                     FeedClient appClient = new FeedClient(feedURI);
                     if (auth!=null) {
                        appClient.setIdentity(auth.getName(),auth.getPassword());
                     }
                     Status status = appClient.delete();
                     if (!status.isSuccess() && !status.equals(Status.CLIENT_ERROR_NOT_FOUND)) {
                        errorCount++;
                        log.severe("Cannot delete feed "+feedURI+", stopping synchronization.");
                        throw new SyncException("Synchronization was incomplete.  Stopped due to failure to delete feed: "+feedURI);
                     }
                  } else {
                     // delete entry
                     log.info("Deleting entry "+entry+" in feed "+feedURI);
                     FeedClient appClient = new FeedClient(feedURI);
                     if (auth!=null) {
                        appClient.setIdentity(auth.getName(),auth.getPassword());
                     }
                     Status status = appClient.deleteEntry(entry);
                     if (!status.isSuccess() && !status.equals(Status.CLIENT_ERROR_NOT_FOUND)) {
                        errorCount++;
                        log.severe("Cannot delete feed "+feedURI+", stopping synchronization.");
                        throw new SyncException("Synchronization was incomplete.  Stopped due to failure to delete feed: "+feedURI);
                     }
                  }
               }
            }
            entries = db.getJournal().getUpdatesSince(lastSync,syncTime);
            while (entries.hasNext()) {

               Journal.UpdatedEntry updateEntry = (Journal.UpdatedEntry)entries.next();

               Feed feed = updateEntry.getFeed();
               Entry entry = updateEntry.getEntry();
               String path = feed.getPath();
               if (path.length()>0 && !path.endsWith("/")) {
                  path += "/";
               }
               URI feedURI = proc.getRemoteApp().getRoot().resolve(path);
               FeedClient appClient = new FeedClient(feedURI);
               if (auth!=null) {
                  appClient.setIdentity(auth.getName(),auth.getPassword());
               }


               if (updateEntry.getOperation()==Journal.CREATE_OPERATION) {
                  // Create feed or entry
                  if (entry==null) {
                     // Create feed
                     log.info("Creating feed "+feedURI);
                     try {
                        Representation feedRep = storage.getFeed(path,feed.getUUID(),feed.getEntries());
                        // Now, create the feed with the XML
                        try {
                           String xml = feedRep.getText();
                           if (!appClient.create(xml).isSuccess()) {
                              errorCount++;
                              log.severe("Cannot create feed on target for path "+path);
                              throw new SyncException("Synchronization was incomplete.  Stopped due to failure to create feed: "+path);
                           }
                        } catch (IOException ex) {
                           errorCount++;
                           log.log(Level.SEVERE,"Cannot get xml serialization of feed document for path "+path,ex);
                           throw new SyncException("Synchronization was incomplete.  Stopped due to failure of serialization at path "+path);
                        }
                     } catch (IOException ex) {
                        errorCount++;
                        log.log(Level.SEVERE,"Cannot get feed document for path "+path,ex);
                        throw new SyncException("Synchronization was incomplete.  Stopped due failure to get feed at "+path);
                     }
                  } else {
                     // Create entry

                     log.info("Creating entry "+entry.getUUID()+" for feed "+feedURI);

                     // Check for media entries
                     Iterator<EntryMedia> media = entry.getResources();
                     if (media.hasNext()) {

                        // We have a media entry and so we post the media first
                        EntryMedia resource = media.next();
                        if (media.hasNext()) {
                           while (media.hasNext()) {
                              media.next();
                           }
                           errorCount++;
                           log.severe("Media entries with more than one resource is not supported.");
                           throw new SyncException("Synchronization was incomplete.  Media entry for entry "+entry.getUUID()+" has more than one resource.");
                        }

                        // Get the media from the XML DB
                        try {
                           Representation rep = storage.getMedia(path,feed.getUUID(),resource.getName());
                           // Send the media to the server
                           rep.setMediaType(resource.getMediaType());
                           appClient.createMedia(entry.getUUID(),resource.getName(),rep);
                        } catch (StatusException ex) {
                           errorCount++;
                           log.severe("Cannot update media "+resource.getName()+" on target for path "+path+", status="+ex.getStatus().getCode());
                           throw new SyncException("Synchronization was incomplete.  Failure to update media "+resource.getName()+" for entry "+entry.getUUID()+", status="+ex.getStatus().getCode());
                        } catch (Exception ex) {
                           errorCount++;
                           log.log(Level.SEVERE,"Cannot get media "+resource.getName()+" for path "+path+" and id "+entry.getUUID().toString(),ex);
                           throw new SyncException("Synchronization was incomplete.  Failure to get media "+resource.getName()+" for entry "+entry.getUUID());
                        }
                     } else {

                        String xml = null;
                        // Get the entry document from the XML DB
                        try {
                           Representation entryRep = storage.getEntry(".",path,feed.getUUID(),entry.getUUID());

                           // Now, create the feed with the XML
                           try {
                              xml = entryRep.getText();
                           } catch (IOException ex) {
                              errorCount++;
                              log.log(Level.SEVERE,"Cannot get xml serialization of entry document for path "+path,ex);
                              throw new SyncException("Synchronization was incomplete.  Failure to get serialization of entry "+entry.getUUID());
                           }
                        } catch (IOException ex) {
                           errorCount++;
                           log.log(Level.SEVERE,"Cannot get entry document for path "+path+" and id "+entry.getUUID().toString(),ex);
                           throw new SyncException("Synchronization was incomplete.  Failure to get entry "+entry.getUUID());
                        }

                        // This is a regular entry
                        try {
                           appClient.createEntry(xml);
                        } catch (Exception ex) {
                           errorCount++;
                           log.severe("Cannot create entry on target for path "+path);
                           throw new SyncException("Synchronization was incomplete.  Failure to create entry "+entry.getUUID()+" for path "+path);
                        }
                     }
                  }
               } else {
                  EntryMedia resource = updateEntry.getResource();
                  if (entry==null) {
                     // Modify feed
                     log.info("Updating feed "+feedURI);
                     // Get the feed document from the XML DB
                     try {
                        Representation feedRep = storage.getFeed(path,feed.getUUID(),feed.getEntries());

                        // Now, create the feed with the XML
                        try {
                           String xml = feedRep.getText();
                           if (!appClient.update(xml).isSuccess()) {
                              errorCount++;
                              log.severe("Cannot update feed on target for path "+path);
                              throw new SyncException("Synchronization was incomplete.  Cannot update feed for path "+path);
                           }
                        } catch (IOException ex) {
                           errorCount++;
                           log.log(Level.SEVERE,"Cannot get xml serialization of feed document for path "+path,ex);
                           throw new SyncException("Synchronization was incomplete.  Cannot get serialization of feed for path "+path);
                        }
                     } catch (IOException ex) {
                        errorCount++;
                        log.log(Level.SEVERE,"Cannot get feed document for path "+path,ex);
                        throw new SyncException("Synchronization was incomplete.  Cannot get feed for path "+path);
                     }
                  } else if (resource==null) {
                     // Modify entry
                     log.info("Updating entry "+entry.getUUID()+" for feed "+feedURI);

                     // Get the entry document from the XML DB
                     try {
                        Representation entryRep = storage.getEntry(".",path,feed.getUUID(),entry.getUUID());

                        // Now, create the feed with the XML
                        try {
                           String xml = entryRep.getText();
                           if (!appClient.updateEntry(entry.getUUID(),xml).isSuccess()) {
                              errorCount++;
                              log.severe("Cannot update entry on target for path "+path);
                              throw new SyncException("Synchronization was incomplete.  Cannot update entry "+entry.getUUID()+" for path"+path);
                           }
                        } catch (IOException ex) {
                           errorCount++;
                           log.log(Level.SEVERE,"Cannot get xml serialization of entry document for path "+path,ex);
                           throw new SyncException("Synchronization was incomplete.  Cannot serialization of entry "+entry.getUUID()+" for path"+path);
                        }
                     } catch (IOException ex) {
                        errorCount++;
                        log.log(Level.SEVERE,"Cannot get entry document for path "+path+" and id "+entry.getUUID().toString(),ex);
                        throw new SyncException("Synchronization was incomplete.  Cannot get entry "+entry.getUUID()+" for path"+path);
                     }
                  } else {
                     // Modify resource
                     log.info("Updating resource "+resource.getName()+" for entry "+entry.getUUID()+" for feed "+feedURI);

                     // Get the media from the XML DB
                     try {
                        Representation mediaRep = storage.getMedia(path,feed.getUUID(),resource.getName());
                        mediaRep.setMediaType(resource.getMediaType());
                        if (!appClient.updateMedia(resource.getName(),mediaRep).isSuccess()) {
                           errorCount++;
                           log.severe("Cannot update media "+resource.getName()+" on target for path "+path);
                           throw new SyncException("Synchronization was incomplete.  Cannot update media "+resource.getName()+" for entry "+entry.getUUID()+" for path"+path);
                        }
                     } catch (IOException ex) {
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

         this.confHosts = ifaceHosts.get(iface.getKey());
         this.webClient = getContext().getClientDispatcher();
      }

      public void configure() {
         FeedClient client = new FeedClient(webClient,new Reference(link.getLink()));
         client.setIdentity(link.getUsername(), link.getPassword());

         getContext().getLogger().info("Loading configuration for " + iface.getAddress() + ":" + iface.getPort() + " from " + link.getLink());

         changes = false;
         final Map<String, Boolean> found = new TreeMap<String, Boolean>();
         try {
            client.get(new FeedDestination() {

               public void onFeed(Document feedDoc) {
               }

               public void onEntry(Document entryDoc) {
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

         termSet = new TermSet();
         termCache.put(path,termSet);
      }
      Reference ref = new Reference(metadata.getLink().toString()+path);
      log.info("Updating metadata for "+path+" from "+ref);
      FeedClient metadataClient = new FeedClient(client,ref);
      if (metadata.getUsername()!=null) {
         metadataClient.setIdentity(metadata.getUsername(),metadata.getPassword());
      }
      final Set<Term> updateSet = termSet.terms;
      try {
         Response response = metadataClient.get(new FeedDestination() {
            public void onFeed(Document feedDoc)
               throws XMLException
            {
               Feed feed = new Feed(feedDoc);
               feed.index();
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

         return;
      }
      // Load the layout locations
      URI protectedTermLoc = URI.create(autoConf.getLink().toString()+T_SECURITY_PROTECTED_PATH.toString());
      getLogger().info("Loading protected paths from "+protectedTermLoc);
      FeedClient layoutFeedClient = new FeedClient(client,new Reference(protectedTermLoc));
      if (autoConf.getUsername()!=null) {
         layoutFeedClient.setIdentity(autoConf.getUsername(),autoConf.getPassword());
      }
     
      try {
        
         FeedBuilder builder = new FeedBuilder();
         Response response = layoutFeedClient.get(builder);
         if (response.getStatus().isSuccess()) {
            Feed feed = builder.getFeed();
            feed.index();
           
            Set<String> names = new TreeSet<String>();
View Full Code Here

Examples of org.atomojo.app.client.FeedClient

  
   protected void configureLayouts() {
      // Load layouts
      URI layoutTemLoc = URI.create(autoConf.getLink().toString()+T_LAYOUT.toString());
      getLogger().info("Loading Layouts from "+layoutTemLoc);
      FeedClient appFeedClient = new FeedClient(client,new Reference(layoutTemLoc));
      if (autoConf.getUsername()!=null) {
         appFeedClient.setIdentity(autoConf.getUsername(),autoConf.getPassword());
      }
      try {
         FeedBuilder builder = new FeedBuilder();
         Response response = appFeedClient.get(builder);
         boolean found = false;
         if (!response.getStatus().isSuccess()) {
            if (response.getStatus().getCode()!=404) {
               getLogger().severe("Cannot get feed "+layoutTemLoc+", status="+response.getStatus().getCode());
            } else {
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.