Exemplo n.º 1
0
 private boolean isModified(ObjectName name) {
   boolean modified = false;
   if (name != null) {
     try {
       modified = (Boolean) server.getAttribute(name, "Modified");
     } catch (Exception e) {
       // Okay to fail
     }
   }
   return modified;
 }
Exemplo n.º 2
0
 private int getState(ObjectName name) {
   int status = -1;
   if (name != null) {
     try {
       status = (Integer) server.getAttribute(name, "State");
     } catch (Exception e) {
       log.warn("getState", e);
     }
   }
   return status;
 }
Exemplo n.º 3
0
 private long persist(File f, ObjectName name) {
   long deployed = f.lastModified();
   try {
     Element e = (Element) server.getAttribute(name, "Persist");
     if (e != null) {
       XMLOutputter out = new XMLOutputter(Format.getPrettyFormat());
       Document doc = new Document();
       e.detach();
       doc.setRootElement(e);
       File tmp = new File(f.getAbsolutePath() + ".tmp");
       FileWriter writer = new FileWriter(tmp);
       out.output(doc, writer);
       writer.close();
       f.delete();
       tmp.renameTo(f);
       deployed = f.lastModified();
     }
   } catch (Exception ex) {
     log.warn("persist", ex);
   }
   return deployed;
 }