Package org.atomojo.app.client

Examples of org.atomojo.app.client.XMLRepresentationParser.load()


      Reference testUser1Loc = new Reference(adminUserLoc.toString()+"testuser.1");
      response = client.handle(makeGet(testUser1Loc));
      assertTrue(response.getStatus().isSuccess());
      try {
         XMLRepresentationParser parser = new XMLRepresentationParser();
         Document doc = parser.load(response.getEntity());
         Element top = doc.getDocumentElement();
         assertTrue("testuser.1".equals(top.getAttributeValue("alias")));
      } catch (Exception ex) {
         fail("Exception on get user testuser.1 response: "+ex.getMessage());
      }
View Full Code Here


      Reference testUser2Loc = new Reference(adminUserLoc.toString()+"testuser.2");
      response = client.handle(makeGet(testUser2Loc));
      assertTrue(response.getStatus().isSuccess());
      try {
         XMLRepresentationParser parser = new XMLRepresentationParser();
         Document doc = parser.load(response.getEntity());
         Element top = doc.getDocumentElement();
         assertTrue("testuser.2".equals(top.getAttributeValue("alias")));
      } catch (Exception ex) {
         fail("I/O exception on get user testuser.1 response: "+ex.getMessage());
      }
View Full Code Here

     
      response = client.handle(makeGet(testUser1Loc));
      assertTrue(response.getStatus().isSuccess());
      try {
         XMLRepresentationParser parser = new XMLRepresentationParser();
         Document doc = parser.load(response.getEntity());
         Element top = doc.getDocumentElement();
         assertTrue("Test User".equals(top.getFirstElementNamed(Name.create("{http://www.atomojo.org/Vocabulary/Admin/2007/1/0}name")).getText()));
      } catch (Exception ex) {
         fail("Exception on get user testuser.1 response: "+ex.getMessage());
      }
View Full Code Here

      dest.send(constructor.createDocument());
      dest.send(constructor.createElement(AtomResource.FEED_NAME));
      link(constructor,dest,"self",metaRef.toString());
      link(constructor,dest,"related",feedRef.toString());
      try {
         org.atomojo.app.client.Feed feedRep = new org.atomojo.app.client.Feed(xmlParser.load(storage.getFeedHead(feed.getPath(), feed.getUUID())));
         text(constructor,dest,AtomResource.TITLE_NAME,feedRep.getTitle());
         String summary = feedRep.getSummary();
         if (summary!=null) {
            text(constructor,dest,AtomResource.SUMMARY_NAME,summary);
         }
View Full Code Here

               ancestors.add(parent);
            }
         } while (parent!=null);
         Collections.reverse(ancestors);
         for (Feed ancestor : ancestors) {
            org.atomojo.app.client.Feed feedRep = new org.atomojo.app.client.Feed(xmlParser.load(storage.getFeedHead(ancestor.getPath(), ancestor.getUUID())));
            dest.send(constructor.createElement(AtomResource.ENTRY_NAME));
            text(constructor,dest,AtomResource.ID_NAME,ancestor.getUUID().toString());
            text(constructor,dest,AtomResource.PUBLISHED_NAME,AtomResource.toXSDDate(ancestor.getCreated()));
            text(constructor,dest,AtomResource.UPDATED_NAME,AtomResource.toXSDDate(ancestor.getEdited()));
            text(constructor,dest,AtomResource.TITLE_NAME,feedRep.getTitle());
View Full Code Here

         while (children.hasNext()) {
            Feed child = children.next();
            if (child.getTerm(hidden)!=null) {
               continue;
            }
            org.atomojo.app.client.Feed feedRep = new org.atomojo.app.client.Feed(xmlParser.load(storage.getFeedHead(child.getPath(), child.getUUID())));
            dest.send(constructor.createElement(AtomResource.ENTRY_NAME));
            text(constructor,dest,AtomResource.ID_NAME,child.getUUID().toString());
            text(constructor,dest,AtomResource.PUBLISHED_NAME,AtomResource.toXSDDate(child.getCreated()));
            text(constructor,dest,AtomResource.UPDATED_NAME,AtomResource.toXSDDate(child.getEdited()));
            text(constructor,dest,AtomResource.TITLE_NAME,feedRep.getTitle());
View Full Code Here

                        }
                     }

                     public void onFeed(Feed feed) throws QueryException {
                        try {
                           org.atomojo.app.client.Feed feedRep = new org.atomojo.app.client.Feed(xmlParser.load(app.getStorage().getFeedHead(feed.getPath(), feed.getUUID())));
                           dest.send(constructor.createCharacters("\n"));
                           dest.send(constructor.createElement(AtomResource.ENTRY_NAME));
                           text(constructor,dest,AtomResource.ID_NAME,feed.getUUID().toString());
                           text(constructor,dest,AtomResource.PUBLISHED_NAME,AtomResource.toXSDDate(feed.getCreated()));
                           text(constructor,dest,AtomResource.UPDATED_NAME,AtomResource.toXSDDate(feed.getEdited()));
View Full Code Here

         request.setChallengeResponse(new ChallengeResponse(ChallengeScheme.HTTP_BASIC,username,password));
         Response response = client.handle(request);
         if (response.getStatus().isSuccess()) {
            XMLRepresentationParser parser = new XMLRepresentationParser();
            try {
               Document doc = parser.load(response.getEntity());
               String session = doc.getDocumentElement().getAttributeValue("id");
               String id = doc.getDocumentElement().getAttributeValue("user-id");
               String alias = doc.getDocumentElement().getAttributeValue("user-alias");
               Element nameE = doc.getDocumentElement().getFirstElementNamed(NAME);
               Element emailE = doc.getDocumentElement().getFirstElementNamed(EMAIL);
View Full Code Here

  
   public void parse()
      throws IOException,XMLException
   {
      XMLRepresentationParser parser = new XMLRepresentationParser();
      xml = parser.load(getRepresentation()).getDocumentElement();
   }
  
   public Element getElement()
   {
      return xml;
View Full Code Here

   protected void copy(Feed source,Feed parent,String name)
   {
      XMLRepresentationParser parser = new XMLRepresentationParser();
      try {
         // get the feed document without the entries
         Document feedDoc = parser.load(app.getStorage().getFeedHead(source.getPath(), source.getUUID()));

         // Create the feed.  The ID will be changed since the feed exits
         Feed newFeed = app.createFeed(parent.getPath()+name, feedDoc);
        
         // copy the entries
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.