本文整理汇总了Java中lucee.loader.engine.CFMLEngine类的典型用法代码示例。如果您正苦于以下问题:Java CFMLEngine类的具体用法?Java CFMLEngine怎么用?Java CFMLEngine使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CFMLEngine类属于lucee.loader.engine包,在下文中一共展示了CFMLEngine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
public void init(String cacheName, Struct arguments) throws IOException, PageException {
CFMLEngine engine = CFMLEngineFactory.getInstance();
caster = engine.getCastUtil();
MongoConnection.init(arguments);
this.persists = caster.toBoolean(arguments.get("persist"));
this.database = caster.toString(arguments.get("database"));
this.collectionName = caster.toString(arguments.get("collection"));
//clean the collection on startup if required
if (!persists) {
getCollection().drop();
}
//create the indexes
createIndexes();
// start the cleaner schdule that remove entries by expires time and idle time
startCleaner();
}
示例2: doNew
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
public static UpdateInfo doNew(CFMLEngine engine, Resource contextDir, boolean readOnly) {
lucee.Info info = engine.getInfo();
try {
String strOldVersion;
final Resource resOldVersion = contextDir.getRealResource("version");
String strNewVersion = info.getVersion() + "-" + info.getRealeaseTime();
// fresh install
if (!resOldVersion.exists()) {
if(!readOnly) {
resOldVersion.createNewFile();
IOUtil.write(resOldVersion, strNewVersion, SystemUtil.getCharset(), false);
}
return UpdateInfo.NEW_FRESH;
}
// changed version
else if (!(strOldVersion=IOUtil.toString(resOldVersion, SystemUtil.getCharset())).equals(strNewVersion)) {
if(!readOnly) IOUtil.write(resOldVersion, strNewVersion, SystemUtil.getCharset(), false);
Version oldVersion = OSGiUtil.toVersion(strOldVersion);
return new UpdateInfo(oldVersion,oldVersion.getMajor()<5?NEW_FROM4:NEW_MINOR);
}
}
catch(Throwable t) {ExceptionUtil.rethrowIfNecessary(t);}
return UpdateInfo.NEW_NONE;
}
示例3: isRunning
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
public boolean isRunning() {
try{
CFMLEngine other = CFMLEngineFactory.getInstance();
// FUTURE patch, do better impl when changing loader
if(other!=this && controlerState.toBooleanValue() && !(other instanceof CFMLEngineWrapper)) {
SystemOut.printDate("CFMLEngine is still set to true but no longer valid, Lucee disable this CFMLEngine.");
controlerState.setValue(false);
reset();
return false;
}
}
catch(Throwable t){
ExceptionUtil.rethrowIfNecessary(t);
}
return controlerState.toBooleanValue();
}
示例4: setScheduler
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
/**
* sets the Schedule Directory
* @param scheduleDirectory sets the schedule Directory
* @param logger
* @throws PageException
*/
protected void setScheduler(CFMLEngine engine,Resource scheduleDirectory) throws PageException {
if(scheduleDirectory==null) {
if(this.scheduler==null) this.scheduler=new SchedulerImpl(engine,"<?xml version=\"1.0\"?>\n<schedule></schedule>",this);
return;
}
if(!isDirectory(scheduleDirectory)) throw new ExpressionException("schedule task directory "+scheduleDirectory+" doesn't exist or is not a directory");
try {
if(this.scheduler==null)
this.scheduler=new SchedulerImpl(engine,this,scheduleDirectory,SystemUtil.getCharset().name());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
}
示例5: getBaseComponentPageSource
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
public PageSource getBaseComponentPageSource(int dialect, PageContext pc) {
PageSource base = dialect==CFMLEngine.DIALECT_CFML?baseComponentPageSourceCFML:baseComponentPageSourceLucee;
if(base==null) {
base=PageSourceImpl.best(getPageSources(pc,null,getBaseComponentTemplate(dialect),false,false,true));
if(!base.exists()) {
String baseTemplate = getBaseComponentTemplate(dialect);
String mod = ContractPath.call(pc, baseTemplate, false);
if(!mod.equals(baseTemplate)) {
base=PageSourceImpl.best(getPageSources(pc,null,mod,false,false,true));
}
}
if(dialect==CFMLEngine.DIALECT_CFML)
this.baseComponentPageSourceCFML=base;
else
this.baseComponentPageSourceLucee=base;
}
return base;
}
示例6: str
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
public String str(PageContext pc, int off, int len) throws IOException, PageException {
if(staticTextLocation==null) {
PageSource ps = getPageSource();
Mapping m = ps.getMapping();
staticTextLocation=m.getClassRootDirectory();
staticTextLocation=staticTextLocation.getRealResource(ps.getJavaName()+".txt");
}
CFMLEngine e = CFMLEngineFactory.getInstance();
IO io = e.getIOUtil();
Reader reader = io.getReader(staticTextLocation, e.getCastUtil().toCharset("UTF-8"));
char[] carr=new char[len];
try {
if(off>0)reader.skip(off);
reader.read(carr);
}
finally {
io.closeSilent(reader);
}
//print.e(carr);
return new String(carr);
}
示例7: writeTo
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
@Override
public void writeTo(Node node, Resource file) throws PageException {
OutputStream os=null;
CFMLEngine e = CFMLEngineFactory.getInstance();
IO io = e.getIOUtil();
try {
os=io.toBufferedOutputStream(file.getOutputStream());
writeTo(node, new StreamResult(os),false,false,null,null,null);
}
catch(IOException ioe){
throw e.getCastUtil().toPageException(ioe);
}
finally {
e.getIOUtil().closeSilent(os);
}
}
示例8: getURLS
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
/**
* returns all urls in a html String
* @param html HTML String to search urls
* @param url Absolute URL path to set
* @return urls found in html String
*/
public List<URL> getURLS(String html, URL url) {
List<URL> urls=new ArrayList<URL>();
SourceCode cfml=new SourceCode(html,false,CFMLEngine.DIALECT_CFML);
while(!cfml.isAfterLast()) {
if(cfml.forwardIfCurrent('<')) {
for(int i=0;i<tags.length;i++) {
if(cfml.forwardIfCurrent(tags[i].tag+" ")) {
getSingleUrl(urls,cfml,tags[i],url);
}
}
}
else {
cfml.next();
}
}
return urls;
}
示例9: getDialect
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
@Override
public int getDialect() {
Config c = getMapping().getConfig();
if(!((ConfigImpl)c).allowLuceeDialect()) return CFMLEngine.DIALECT_CFML;
// MUST improve performance on this
ConfigWeb cw=null;
String ext=ResourceUtil.getExtension(relPath, Constants.getCFMLComponentExtension());
if(c instanceof ConfigWeb)
cw=(ConfigWeb) c;
else {
c=ThreadLocalPageContext.getConfig();
if(c instanceof ConfigWeb)
cw=(ConfigWeb) c;
}
if(cw!=null) {
return ((CFMLFactoryImpl)cw.getFactory())
.toDialect(ext,CFMLEngine.DIALECT_CFML);
}
return ConfigWebUtil.toDialect(ext, CFMLEngine.DIALECT_CFML);
}
示例10: getInstance
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
/**
* get singelton instance of the CFML Engine
*
* @param factory
* @return CFMLEngine
*/
public static synchronized CFMLEngine getInstance(CFMLEngineFactory factory, BundleCollection bc) {
if(engine == null) {
if(SystemUtil.getLoaderVersion() < 6.0D) {
// windows needs 6.0 because restart is not working with older versions
if(SystemUtil.isWindows())
throw new RuntimeException(
"You need to update a newer lucee.jar to run this version, you can download the latest jar from http://download.lucee.org.");
else if(SystemUtil.getLoaderVersion() < 5.8D)
throw new RuntimeException(
"You need to update your lucee.jar to run this version, you can download the latest jar from http://download.lucee.org.");
else if(SystemUtil.getLoaderVersion() < 5.9D)
SystemOut.printDate(
"To use all features Lucee provides, you need to update your lucee.jar, you can download the latest jar from http://download.lucee.org.");
}
engine = new CFMLEngineImpl(factory, bc);
}
return engine;
}
示例11: onStart
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
public void onStart(ConfigImpl config, boolean reload) {
String context = config instanceof ConfigWeb ? "Web" : "Server";
if(!ThreadLocalPageContext.callOnStart.get())
return;
Resource listenerTemplateLucee = config.getConfigDir().getRealResource(
"context/" + context + "." + lucee.runtime.config.Constants.getLuceeComponentExtension());
Resource listenerTemplateCFML = config.getConfigDir().getRealResource(
"context/" + context + "." + lucee.runtime.config.Constants.getCFMLComponentExtension());
// dialect
int dialect;
if(listenerTemplateLucee.isFile())
dialect = CFMLEngine.DIALECT_LUCEE;
else if(listenerTemplateCFML.isFile())
dialect = CFMLEngine.DIALECT_CFML;
else
return;
// we do not wait for this
new OnStart(config, dialect, context, reload).start();
}
示例12: doGetTLDs
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
/**
* @throws PageException
*
*/
private void doGetTLDs() throws PageException {
lucee.runtime.type.Query qry=new QueryImpl(
new String[]{"displayname","namespace","namespaceseparator","shortname","type","description","uri","elclass","elBundleName","elBundleVersion","source"},
new String[]{"varchar","varchar","varchar","varchar","varchar","varchar","varchar","varchar","varchar","varchar","varchar"},
0,"tlds");
int dialect="lucee".equalsIgnoreCase(getString("dialect","cfml"))?CFMLEngine.DIALECT_LUCEE:CFMLEngine.DIALECT_CFML;
TagLib[] libs = config.getTLDs(dialect);
for(int i=0;i<libs.length;i++) {
qry.addRow();
qry.setAt("displayname", i+1, libs[i].getDisplayName());
qry.setAt("namespace", i+1, libs[i].getNameSpace());
qry.setAt("namespaceseparator", i+1, libs[i].getNameSpaceSeparator());
qry.setAt("shortname", i+1, libs[i].getShortName());
qry.setAt("type", i+1, libs[i].getType());
qry.setAt("description", i+1, libs[i].getDescription());
qry.setAt("uri", i+1, Caster.toString(libs[i].getUri()));
qry.setAt("elclass", i+1, libs[i].getELClassDefinition().getClassName());
qry.setAt("elBundleName", i+1, libs[i].getELClassDefinition().getName());
qry.setAt("elBundleVersion", i+1, libs[i].getELClassDefinition().getVersionAsString());
qry.setAt("source", i+1, StringUtil.emptyIfNull(libs[i].getSource()));
}
pageContext.setVariable(getString("admin",action,"returnVariable"),qry);
}
示例13: doGetFLDs
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
/**
* @throws PageException
*
*/
private void doGetFLDs() throws PageException {
lucee.runtime.type.Query qry=new QueryImpl(
new String[]{"displayname","namespace","namespaceseparator","shortname","description","uri","source"},
new String[]{"varchar","varchar","varchar","varchar","varchar","varchar","varchar"},
0,"tlds");
int dialect="lucee".equalsIgnoreCase(getString("dialect","cfml"))?CFMLEngine.DIALECT_LUCEE:CFMLEngine.DIALECT_CFML;
FunctionLib[] libs = config.getFLDs(dialect);
for(int i=0;i<libs.length;i++) {
qry.addRow();
qry.setAt("displayname", i+1, libs[i].getDisplayName());
qry.setAt("namespace", i+1, "");// TODO support for namespace
qry.setAt("namespaceseparator", i+1, "");
qry.setAt("shortname", i+1, libs[i].getShortName());
qry.setAt("description", i+1, libs[i].getDescription());
qry.setAt("uri", i+1, Caster.toString(libs[i].getUri()));
qry.setAt("source", i+1, StringUtil.emptyIfNull(libs[i].getSource()));
}
pageContext.setVariable(getString("admin",action,"returnVariable"),qry);
}
示例14: getDatasource
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
public static Object getDatasource(PageContext pageContext, String datasource) throws ApplicationException {
if(StringUtil.isEmpty(datasource)){
Object ds=pageContext.getApplicationContext().getDefDataSource();
if(StringUtil.isEmpty(ds)) {
boolean isCFML=pageContext.getRequestDialect()==CFMLEngine.DIALECT_CFML;
throw new ApplicationException(
"attribute [datasource] is required, when no default datasource is defined",
"you can define a default datasource as attribute [defaultdatasource] of the tag "
+(isCFML?Constants.CFML_APPLICATION_TAG_NAME:Constants.LUCEE_APPLICATION_TAG_NAME)
+" or as data member of the "
+(isCFML?Constants.CFML_APPLICATION_EVENT_HANDLER:Constants.LUCEE_APPLICATION_EVENT_HANDLER)
+" (this.defaultdatasource=\"mydatasource\";)");
}
return ds;
}
return datasource;
}
示例15: getBundleFile
import lucee.loader.engine.CFMLEngine; //导入依赖的package包/类
public static BundleFile getBundleFile(String name, Version version,Identification id, boolean downloadIfNecessary, BundleFile defaultValue) {
name=name.trim();
CFMLEngine engine = CFMLEngineFactory.getInstance();
CFMLEngineFactory factory = engine.getCFMLEngineFactory();
StringBuilder versionsFound=new StringBuilder();
// is it in jar directory but not loaded
BundleFile bf=_getBundleFile(factory,name,version,versionsFound);
if(bf!=null) return bf;
// if not found try to download
if(downloadIfNecessary && version!=null) {
try{
bf=new BundleFile(factory.downloadBundle(name, version.toString(),id));
if(bf.isBundle()) return bf;
}
catch(Throwable t) {ExceptionUtil.rethrowIfNecessary(t);}
}
return defaultValue;
}