示例#1
0
文件: Q2.java 项目: rlishtaba/jPOS
 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;
 }
示例#2
0
文件: Q2.java 项目: rlishtaba/jPOS
 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;
 }
示例#3
0
文件: Q2.java 项目: rlishtaba/jPOS
 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;
 }