use of lucee.commons.io.res.Resource in project Lucee by lucee.
the class TaskFileFilter method createId.
private String createId(SpoolerTask task) {
Resource dir = getPersisDirectory().getRealResource(task.closed() ? "closed" : "open");
dir.mkdirs();
String id = null;
do {
id = StringUtil.addZeros(++count, 8);
} while (dir.getRealResource(id + ".tsk").exists());
return id;
}
use of lucee.commons.io.res.Resource in project Lucee by lucee.
the class TaskFileFilter method store.
private void store(SpoolerTask task) {
ObjectOutputStream oos = null;
Resource persis = getFile(task);
if (persis.exists())
persis.delete();
try {
oos = new ObjectOutputStream(persis.getOutputStream());
oos.writeObject(task);
} catch (IOException e) {
SystemOut.printDate(e);
} finally {
IOUtil.closeEL(oos);
}
}
use of lucee.commons.io.res.Resource in project Lucee by lucee.
the class Admin method getSSLCertificate.
public static Query getSSLCertificate(Config config, String host, int port) throws PageException {
Resource cacerts = config.getSecurityDirectory();
CertificateInstaller installer;
try {
installer = new CertificateInstaller(cacerts, host, port);
} catch (Exception e) {
throw Caster.toPageException(e);
}
X509Certificate[] certs = installer.getCertificates();
X509Certificate cert;
Query qry = new QueryImpl(new String[] { "subject", "issuer" }, certs.length, "certificates");
for (int i = 0; i < certs.length; i++) {
cert = certs[i];
qry.setAtEL("subject", i + 1, cert.getSubjectDN().getName());
qry.setAtEL("issuer", i + 1, cert.getIssuerDN().getName());
}
return qry;
}
use of lucee.commons.io.res.Resource in project Lucee by lucee.
the class Admin method doReadBundle.
private void doReadBundle() throws PageException {
String ret = getString("admin", action, "returnvariable");
Resource res = ResourceUtil.toResourceExisting(pageContext, getString("admin", action, "bundle"));
if (!res.isFile())
throw new ApplicationException("[" + res + "] is not a file");
try {
Struct sct = new StructImpl();
pageContext.setVariable(ret, new BundleFile(res).info());
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
use of lucee.commons.io.res.Resource in project Lucee by lucee.
the class Admin method doHeapDump.
private void doHeapDump() throws PageException {
String strDestination = getString("admin", action, "destination");
boolean live = getBoolV("live", true);
Resource destination = ResourceUtil.toResourceNotExisting(pageContext, strDestination);
try {
HeapDumper.dumpTo(destination, live);
} catch (IOException e) {
throw Caster.toPageException(e);
}
}
Aggregations