Package org.atomojo.app.db

Examples of org.atomojo.app.db.SyncTarget


               ItemDestination dest = new WriterItemDestination(out,"UTF-8");
               ItemConstructor constructor = InfosetFactory.getDefaultInfoset().createItemConstructor();
               dest.send(constructor.createDocument());
               dest.send(constructor.createElement(AdminXML.NM_TARGETS));
               while (targets.hasNext()) {
                  SyncTarget target = targets.next();
                  target.marshall();
                  DocumentSource.generate(target.getElement(),false,dest);
               }
               dest.send(constructor.createElementEnd(AdminXML.NM_TARGETS));
               dest.send(constructor.createDocumentEnd());
               out.flush();
               out.close();
View Full Code Here


     
      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.");
         }
         if (target.create()) {
            getResponse().setStatus(Status.SUCCESS_NO_CONTENT);
            Reference ref = new Reference(getRequest().getResourceRef().toString()+"/"+target.getName());
            getResponse().setLocationRef(ref);
            return null;
         } else {
            getContext().getLogger().severe("Cannot store XML for target");
            getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
View Full Code Here

  
   public Representation get()
   {
      final DB db = (DB)getRequest().getAttributes().get(App.DB_ATTR);
      final String name = getRequest().getAttributes().get("name").toString();
      SyncTarget target = new SyncTarget(db,name);
      if (target.exists()) {
         return target.getRepresentation();
      } else {
         getResponse().setStatus(Status.CLIENT_ERROR_NOT_FOUND);
         return null;
      }
   }
View Full Code Here

     
      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.");
         }
         if (target.exists()) {
            if (target.update()) {
               getResponse().setStatus(Status.SUCCESS_NO_CONTENT);
               return null;
            } else {
               getContext().getLogger().severe("Cannot store XML for remote app.");
               getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
View Full Code Here

   }
  
   public Representation delete() {
      final DB db = (DB)getRequest().getAttributes().get(App.DB_ATTR);
      final String name = getRequest().getAttributes().get("name").toString();
      SyncTarget target = new SyncTarget(db,name);
      if (target.exists()) {
         if (target.delete()) {
            getResponse().setStatus(Status.SUCCESS_NO_CONTENT);
         } else {
            getResponse().setStatus(Status.SERVER_ERROR_INTERNAL);
         }
      } else {
View Full Code Here

                  RemoteApp app = new RemoteApp(db,"backup");
                  app.setIntrospection(introspectionURI);
                  app.setRoot(dbDir.toURI());

                  SyncTarget target = new SyncTarget(db,"");
                  SyncProcess proc = new SyncProcess(db,"restore",true,target,app,null);

                  PullSynchronizer restore = new PullSynchronizer(getLogger(),getApplication().getMetadataService(),user,db,storage,proc);
                  restore.setAdditive(false);
                  try {
View Full Code Here

            app = new RemoteApp(db,"backup");
            app.setIntrospection(introspect.toURI());
            app.setRoot(dir.toURI());
         }
        
         SyncTarget target = new SyncTarget(db,"");
        
         SyncProcess proc = new SyncProcess(db,"restore",true,target,app,null);
        
         User user = (User)getRequest().getAttributes().get(App.USER_ATTR);
        
View Full Code Here

TOP

Related Classes of org.atomojo.app.db.SyncTarget

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.