use of lucee.commons.lang.types.RefBooleanImpl in project Lucee by lucee.
the class SelectParser method column.
private Expression column(ParserString raw) throws SQLParserException {
RefBoolean hb = new RefBooleanImpl(false);
String name = identifier(raw, hb);
if (name == null)
return null;
if (!hb.toBooleanValue()) {
if ("true".equalsIgnoreCase(name))
return ValueBoolean.TRUE;
if ("false".equalsIgnoreCase(name))
return ValueBoolean.FALSE;
if ("null".equalsIgnoreCase(name))
return ValueNull.NULL;
}
ColumnExpression column = new ColumnExpression(name, name.equals("?") ? columnIndex++ : 0);
raw.removeSpace();
while (raw.forwardIfCurrent(".")) {
raw.removeSpace();
String sub = identifier(raw, hb);
if (sub == null)
throw new SQLParserException("invalid column definition");
column.setSub(sub);
}
raw.removeSpace();
if (raw.forwardIfCurrent('(')) {
return new OperationN(column.getFullName(), readArguments(raw));
}
return column;
}
use of lucee.commons.lang.types.RefBooleanImpl in project Lucee by lucee.
the class ComponentImpl method getMetaData.
protected static Struct getMetaData(int access, PageContext pc, ComponentImpl comp, boolean ignoreCache) throws PageException {
// Cache
final Page page = MetadataUtil.getPageWhenMetaDataStillValid(pc, comp, ignoreCache);
if (page != null && page.metaData != null && page.metaData.get() != null) {
return page.metaData.get();
}
long creationTime = System.currentTimeMillis();
StructImpl sct = new StructImpl();
// fill udfs
metaUDFs(pc, comp, sct, access);
// meta
if (comp.properties.meta != null)
StructUtil.copy(comp.properties.meta, sct, true);
String hint = comp.properties.hint;
String displayname = comp.properties.dspName;
if (!StringUtil.isEmpty(hint))
sct.set(KeyConstants._hint, hint);
if (!StringUtil.isEmpty(displayname))
sct.set(KeyConstants._displayname, displayname);
sct.set(KeyConstants._persistent, comp.properties.persistent);
sct.set(KeyConstants._hashCode, comp.hashCode());
sct.set(KeyConstants._accessors, comp.properties.accessors);
sct.set(KeyConstants._synchronized, comp.properties._synchronized);
if (comp.properties.output != null)
sct.set(KeyConstants._output, comp.properties.output);
// extends
Struct ex = null;
if (comp.base != null)
ex = getMetaData(access, pc, comp.base, true);
if (ex != null)
sct.set(KeyConstants._extends, ex);
// implements
if (comp.absFin != null) {
Set<String> set = ListUtil.listToSet(comp.properties.implement, ",", true);
if (comp.absFin.hasInterfaces()) {
Iterator<InterfaceImpl> it = comp.absFin.getInterfaceIt();
Struct imp = new StructImpl();
InterfaceImpl inter;
while (it.hasNext()) {
inter = it.next();
if (!set.contains(inter.getCallPath()))
continue;
imp.setEL(KeyImpl.init(inter.getCallPath()), inter.getMetaData(pc, true));
}
sct.set(KeyConstants._implements, imp);
}
}
// PageSource
PageSource ps = comp.pageSource;
sct.set(KeyConstants._fullname, ps.getComponentName());
sct.set(KeyConstants._name, ps.getComponentName());
sct.set(KeyConstants._path, ps.getDisplayPath());
sct.set(KeyConstants._type, "component");
int dialect = comp.getPageSource().getDialect();
boolean supressWSBeforeArg = dialect != CFMLEngine.DIALECT_CFML || pc.getConfig().getSuppressWSBeforeArg();
Class<?> skeleton = comp.getJavaAccessClass(pc, new RefBooleanImpl(false), ((ConfigImpl) pc.getConfig()).getExecutionLogEnabled(), false, false, supressWSBeforeArg);
if (skeleton != null)
sct.set(KeyConstants._skeleton, skeleton);
HttpServletRequest req = pc.getHttpServletRequest();
try {
// MUST better impl !!!
String path = ContractPath.call(pc, ps.getDisplayPath());
sct.set("remoteAddress", "" + new URL(req.getScheme(), req.getServerName(), req.getServerPort(), req.getContextPath() + path + "?wsdl"));
} catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
}
// Properties
if (comp.properties.properties != null) {
ArrayImpl parr = new ArrayImpl();
Property p;
Iterator<Entry<String, Property>> pit = comp.properties.properties.entrySet().iterator();
while (pit.hasNext()) {
p = pit.next().getValue();
parr.append(p.getMetaData());
}
parr.sortIt(new ArrayOfStructComparator(KeyConstants._name));
sct.set(KeyConstants._properties, parr);
}
if (page != null)
page.metaData = new MetaDataSoftReference<Struct>(sct, creationTime);
return sct;
}
use of lucee.commons.lang.types.RefBooleanImpl in project Lucee by lucee.
the class CFMLEngineImpl method loadJSPFactory.
private CFMLFactoryImpl loadJSPFactory(ConfigServerImpl configServer, ServletConfig sg, int countExistingContextes) throws ServletException {
try {
if (XMLConfigWebFactory.LOG)
SystemOut.printDate("load Context");
// Load Config
RefBoolean isCustomSetting = new RefBooleanImpl();
Resource configDir = getConfigDirectory(sg, configServer, countExistingContextes, isCustomSetting);
if (XMLConfigWebFactory.LOG)
SystemOut.printDate("got context directory");
CFMLFactoryImpl factory = new CFMLFactoryImpl(this, sg);
if (XMLConfigWebFactory.LOG)
SystemOut.printDate("init factory");
ConfigWebImpl config = XMLConfigWebFactory.newInstance(this, factory, configServer, configDir, isCustomSetting.toBooleanValue(), sg);
if (XMLConfigWebFactory.LOG)
SystemOut.printDate("loaded config");
factory.setConfig(config);
return factory;
} catch (Exception e) {
ServletException se = new ServletException(e.getMessage());
se.setStackTrace(e.getStackTrace());
throw se;
}
}
use of lucee.commons.lang.types.RefBooleanImpl in project Lucee by lucee.
the class PageContextImpl method initApplicationContext.
/**
* @return return value of method "onApplicationStart" or true
* @throws PageException
*/
public boolean initApplicationContext(ApplicationListener listener) throws PageException {
boolean initSession = false;
// AppListenerSupport listener = (AppListenerSupport) config.get ApplicationListener();
KeyLock<String> lock = config.getContextLock();
String name = StringUtil.emptyIfNull(applicationContext.getName());
String token = name + ":" + getCFID();
Lock tokenLock = lock.lock(token, getRequestTimeout());
// print.o("outer-lock :"+token);
try {
// check session before executing any code
initSession = applicationContext.isSetSessionManagement() && listener.hasOnSessionStart(this) && !scopeContext.hasExistingSessionScope(this);
// init application
Lock nameLock = lock.lock(name, getRequestTimeout());
// print.o("inner-lock :"+token);
try {
RefBoolean isNew = new RefBooleanImpl(false);
// this is needed that the application scope is initilized
application = scopeContext.getApplicationScope(this, isNew);
if (isNew.toBooleanValue()) {
try {
if (!listener.onApplicationStart(this)) {
scopeContext.removeApplicationScope(this);
return false;
}
} catch (PageException pe) {
scopeContext.removeApplicationScope(this);
throw pe;
}
}
} finally {
// print.o("inner-unlock:"+token);
lock.unlock(nameLock);
}
// init session
if (initSession) {
// this is needed that the session scope is initilized
scopeContext.getSessionScope(this, DUMMY_BOOL);
listener.onSessionStart(this);
}
} finally {
// print.o("outer-unlock:"+token);
lock.unlock(tokenLock);
}
return true;
}
use of lucee.commons.lang.types.RefBooleanImpl in project Lucee by lucee.
the class CFMLTransformer method attribute.
/**
* Liest ein einzelnes Atribut eines tag ein (nicht NONAME).
* <br />
* EBNF:<br />
* <code>attribute-name spaces "=" spaces attribute-value;</code>
* @param tag Definition des Tag das dieses Attribut enthaelt.
* @param args Container zum Speichern einzelner Attribute Namen zum nachtraeglichen Prufen gegen die Tag-Lib.
* @return Element Attribute Element.
* @throws TemplateException
*/
private static Attribute attribute(TagData data, TagLibTag tag, ArrayList<String> args, RefBoolean allowDefaultValue) throws TemplateException {
Expression value = null;
// Name
StringBuffer sbType = new StringBuffer();
RefBoolean dynamic = new RefBooleanImpl(false);
boolean isDefaultValue = false;
boolean[] parseExpression = new boolean[2];
parseExpression[0] = true;
parseExpression[1] = false;
String name = attributeName(data.srcCode, dynamic, args, tag, sbType, parseExpression, allowDefaultValue.toBooleanValue());
// mixed in a noname attribute
if (StringUtil.isEmpty(name)) {
allowDefaultValue.setValue(false);
TagLibTagAttr attr = tag.getDefaultAttribute();
if (attr == null)
throw new TemplateException(data.srcCode, "Invalid Identifier.");
name = attr.getName();
sbType.append(attr.getType());
isDefaultValue = true;
}
comment(data.srcCode, true);
if (isDefaultValue || data.srcCode.forwardIfCurrent('=')) {
comment(data.srcCode, true);
// Value
value = attributeValue(data, tag, sbType.toString(), parseExpression[0], false, data.factory.createLitString(""));
} else // default value boolean true
{
TagLibTagAttr attr = tag.getAttribute(name);
if (attr != null)
value = attr.getUndefinedValue(data.factory);
else
value = tag.getAttributeUndefinedValue(data.factory);
if (sbType.toString().length() > 0) {
value = CastOther.toExpression(value, sbType.toString());
}
}
comment(data.srcCode, true);
return new Attribute(dynamic.toBooleanValue(), name, value, sbType.toString());
}
Aggregations