use of lucee.loader.engine.CFMLEngineFactory in project Lucee by lucee.
the class XMLConfigAdmin method runUpdate.
/**
* run update from cfml engine
* @throws PageException
*/
public void runUpdate(Password password) throws PageException {
checkWriteAccess();
ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
synchronized (factory) {
try {
cleanUp(factory);
factory.update(cs.getPassword(), cs.getIdentification());
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
}
use of lucee.loader.engine.CFMLEngineFactory in project Lucee by lucee.
the class XMLConfigAdmin method _removeUpdate.
private void _removeUpdate(Password password, boolean onlyLatest) throws PageException {
checkWriteAccess();
ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
try {
CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
if (onlyLatest) {
factory.removeLatestUpdate(cs.getPassword());
} else
factory.removeUpdate(cs.getPassword());
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
use of lucee.loader.engine.CFMLEngineFactory in project Lucee by lucee.
the class XMLConfigAdmin method changeVersionTo.
public void changeVersionTo(Version version, Password password, IdentificationWeb id) throws PageException {
checkWriteAccess();
ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
try {
CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
cleanUp(factory);
// do we have the core file?
final File patchDir = factory.getPatchDirectory();
File localPath = new File(version.toString() + ".lco");
if (!localPath.isFile()) {
localPath = null;
Version v;
final File[] patches = patchDir.listFiles(new ExtensionFilter(new String[] { ".lco" }));
for (final File patch : patches) {
v = CFMLEngineFactory.toVersion(patch.getName(), null);
// not a valid file get deleted
if (v == null) {
patch.delete();
} else {
if (v.equals(version)) {
// match!
localPath = patch;
} else // delete newer files
if (OSGiUtil.isNewerThan(v, version)) {
patch.delete();
}
}
}
}
// download patch
if (localPath == null) {
downloadCore(factory, version, id);
}
factory.restart(password);
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
use of lucee.loader.engine.CFMLEngineFactory in project Lucee by lucee.
the class XMLConfigAdmin method installBundle.
private static BundleFile installBundle(Config config, BundleFile bf) throws IOException, BundleException {
// does this bundle already exists
BundleFile _bf = OSGiUtil.getBundleFile(bf.getSymbolicName(), bf.getVersion(), null, false, null);
if (_bf != null)
return _bf;
CFMLEngine engine = CFMLEngineFactory.getInstance();
CFMLEngineFactory factory = engine.getCFMLEngineFactory();
// copy to jar directory
File jar = new File(factory.getBundleDirectory(), bf.getSymbolicName() + "-" + bf.getVersion().toString() + (".jar"));
InputStream is = bf.getInputStream();
OutputStream os = new FileOutputStream(jar);
try {
IOUtil.copy(is, os, false, false);
} finally {
IOUtil.closeEL(is, os);
}
return new BundleFile(jar);
}
use of lucee.loader.engine.CFMLEngineFactory in project Lucee by lucee.
the class XMLConfigAdmin method restart.
public void restart(ConfigServerImpl cs) throws PageException {
CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
synchronized (factory) {
try {
Method m = factory.getClass().getDeclaredMethod("_restart", new Class[0]);
if (m == null)
throw new ApplicationException("cannot restart Lucee.");
m.setAccessible(true);
m.invoke(factory, new Object[0]);
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
}
Aggregations