private void checkModified() { Iterator iter = dirMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); File f = (File) entry.getKey(); QEntry qentry = (QEntry) entry.getValue(); if (qentry.isQBean() && qentry.isQPersist()) { ObjectName name = qentry.getObjectName(); if (getState(name) == QBean.STARTED && isModified(name)) { qentry.setDeployed(persist(f, name)); } } } }
private void deployBundle(File bundle, boolean encrypt) throws JDOMException, IOException, ISOException, GeneralSecurityException { SAXBuilder builder = createSAXBuilder(); Document doc = builder.build(bundle); Iterator iter = doc.getRootElement().getChildren().iterator(); for (int i = 1; iter.hasNext(); i++) { Element e = (Element) iter.next(); deployElement(e, String.format("%02d_%s.xml", i, e.getName()), encrypt, !encrypt); // the !encrypt above is tricky and deserves an explanation // if we are encrypting a QBean, we want it to stay in the deploy // directory for future runs. If on the other hand we are deploying // a bundle, we want it to be transient. } }
private void deploy() { List startList = new ArrayList(); Iterator iter = dirMap.entrySet().iterator(); try { while (iter.hasNext() && !shutdown) { Map.Entry entry = (Map.Entry) iter.next(); File f = (File) entry.getKey(); QEntry qentry = (QEntry) entry.getValue(); long deployed = qentry.getDeployed(); if (deployed == 0) { if (deploy(f)) { if (qentry.isQBean()) startList.add(qentry.getInstance()); qentry.setDeployed(f.lastModified()); } else { // deploy failed, clean up. iter.remove(); } } else if (deployed != f.lastModified()) { undeploy(f); iter.remove(); loader.forceNewClassLoaderOnNextScan(); } } iter = startList.iterator(); while (iter.hasNext()) { start((ObjectInstance) iter.next()); } } catch (Exception e) { log.error("deploy", e); } }