Ejemplo n.º 1
0
 @DELETE
 @Path("blueprint/{name}")
 public Response deleteStack(@PathParam("name") String name) {
   ZooKeeper zk = Controller.getInstance().getZKInstance();
   try {
     String path = ZookeeperUtil.getConfigManifestPath(name);
     Stat current = zk.exists(path, false);
     zk.delete(path, current.getVersion());
   } catch (Exception e) {
     LOG.error(ExceptionUtil.getStackTrace(e));
     throw new WebApplicationException(500);
   }
   Response res = Response.noContent().build();
   return res;
 }
Ejemplo n.º 2
0
 @GET
 @Path("blueprint/{name}")
 public ConfigManifest getBlueprint(@PathParam("name") String name) {
   try {
     ZooKeeper zk = Controller.getInstance().getZKInstance();
     Stat current = new Stat();
     String path = ZookeeperUtil.getConfigManifestPath(name);
     byte[] data = zk.getData(path, false, current);
     ConfigManifest res = JAXBUtil.read(data, ConfigManifest.class);
     return res;
   } catch (Exception e) {
     LOG.error(ExceptionUtil.getStackTrace(e));
     throw new WebApplicationException(500);
   }
 }
Ejemplo n.º 3
0
 @GET
 @Path("blueprint")
 public List<ConfigManifest> getList() {
   List<ConfigManifest> list = new ArrayList<ConfigManifest>();
   try {
     ZooKeeper zk = Controller.getInstance().getZKInstance();
     List<String> blueprints =
         zk.getChildren(CommonConfigurationKeys.ZOOKEEPER_CONFIG_BLUEPRINT_PATH_DEFAULT, false);
     Stat current = new Stat();
     for (String blueprint : blueprints) {
       byte[] data = zk.getData(ZookeeperUtil.getConfigManifestPath(blueprint), false, current);
       ConfigManifest x = JAXBUtil.read(data, ConfigManifest.class);
       list.add(x);
     }
   } catch (Exception e) {
     LOG.error(ExceptionUtil.getStackTrace(e));
     throw new WebApplicationException(500);
   }
   return list;
 }