Package org.infoset.xml.util

Examples of org.infoset.xml.util.DocumentDestination


      final DB db = (DB)getRequest().getAttributes().get(App.DB_ATTR);
      XMLRepresentationParser parser = new XMLRepresentationParser();
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,AdminApplication.createAdminDocumentDestination(dest,AdminXML.NM_APP));
         doc = dest.getDocument();
         RemoteApp app = new RemoteApp(db,doc.getDocumentElement());
         if (app.exists()) {
            getResponse().setStatus(Status.CLIENT_ERROR_CONFLICT);
            return new StringRepresentation("Remote app with name "+app.getName()+" already exists.");
         }
View Full Code Here


         return new StringRepresentation("Non-XML media type for entity body: "+entity.getMediaType().getName());
      }
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,dest);
         doc = dest.getDocument();
         Element top = doc.getDocumentElement();
         String sid = top.getAttributeValue("id");
         UUID id = sid==null ? UUID.randomUUID() : UUID.fromString(sid);
         String alias = top.getAttributeValue("alias");
View Full Code Here

      final DB db = (DB)getRequest().getAttributes().get(App.DB_ATTR);
      XMLRepresentationParser parser = new XMLRepresentationParser();
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,AdminApplication.createAdminDocumentDestination(dest,AdminXML.NM_TARGET));
         doc = dest.getDocument();
         SyncTarget target = new SyncTarget(db,doc.getDocumentElement());
         if (target.exists()) {
            getResponse().setStatus(Status.CLIENT_ERROR_CONFLICT);
            return new StringRepresentation("Target with name "+target.getName()+" already exists.");
         }
View Full Code Here

      XMLRepresentationParser postParser = XML.createParser();
      postParser.addAllowedElement(XML.PASSWORD_NAME);
     
      String password = null;
      try {
         DocumentDestination dest = new DocumentDestination();
         postParser.parse(entity,dest);
         password = dest.getDocument().getDocumentElement().getText();
      } catch (Exception ex) {
         getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
         return new StringRepresentation("XML parse error: "+ex.getMessage());
      }
     
View Full Code Here

      }
      XMLRepresentationParser parser = new XMLRepresentationParser();
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,AdminApplication.createAdminDocumentDestination(dest,AdminXML.NM_TARGET));
         doc = dest.getDocument();
         SyncTarget target = new SyncTarget(db,doc.getDocumentElement());
         String lname = target.getName();
         if (!lname.equals(name)) {
            getResponse().setStatus(Status.CLIENT_ERROR_EXPECTATION_FAILED);
            return new StringRepresentation("Cannot change the name of the target.");
View Full Code Here

         return new StringRepresentation("Non-XML media type for entity body: "+entity.getMediaType().getName());
      }
      Document doc = null;
     
      try {
         DocumentDestination dest = new DocumentDestination();
         parser.parse(entity,dest);
         doc = dest.getDocument();
         Element top = doc.getDocumentElement();
         String sid = top.getAttributeValue("id");
         UUID id = sid==null ? UUID.randomUUID() : UUID.fromString(sid);
         String alias = top.getAttributeValue("alias");
         String password = top.getAttributeValue("password");
View Full Code Here

   }
  
   public Document load(Response response)
      throws IOException,XMLException
   {
      DocumentDestination dest = new DocumentDestination();
      parse(response,dest);
      return dest.getDocument();
   }
View Full Code Here

   }
  
   public Document load(Representation rep)
      throws IOException,XMLException
   {
      DocumentDestination dest = new DocumentDestination();
      parse(rep,null,dest);
      return dest.getDocument();
   }
View Full Code Here

      Map<String,DBInfo> dbList = (Map<String,DBInfo>)getContext().getAttributes().get(DatabaseListResource.DB_LIST);
      Map<String,DBInfo> autodbList = (Map<String,DBInfo>)getContext().getAttributes().get(DatabaseListResource.AUTO_DB_LIST);
      StorageFactory storageFactory = (StorageFactory)getContext().getAttributes().get(DatabaseListResource.STORAGE_FACTORY);

      try {
         DocumentDestination dest = new DocumentDestination();
        
         parser.parse(entity,AdminApplication.createAdminDocumentDestination(dest,AdminXML.NM_RESTORE));
         Document doc = dest.getDocument();
        
         Element top = doc.getDocumentElement();
         String location = top.getAttributeValue("location");
         if (location==null) {
            getResponse().setStatus(Status.CLIENT_ERROR_BAD_REQUEST);
View Full Code Here

         if (entryResponse.isEntityAvailable()) {
            entryResponse.getEntity().release();
         }
         throw new StatusException("Cannot retrieve new entry from "+location,entryResponse.getStatus());
      }
      DocumentDestination docDest = new DocumentDestination();
      XMLRepresentationParser parser = new XMLRepresentationParser();
      parser.parse(entryResponse,docDest);
      Entry newEntry = new Entry(docDest.getDocument());
      newEntry.index();
      entryResponse.getEntity().release();
      return newEntry;
   }
View Full Code Here

TOP

Related Classes of org.infoset.xml.util.DocumentDestination

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.