use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class EvaluateComponent method invoke.
public static Component invoke(PageContext pc, String name, String md5, Struct sctThis, Struct sctVariables) throws PageException {
// Load comp
Component comp = null;
try {
comp = pc.loadComponent(name);
if (!ComponentUtil.md5(comp).equals(md5)) {
SystemOut.printDate(pc.getConfig().getErrWriter(), "component [" + name + "] in this enviroment has not the same interface as the component to load, it is possible that one off the components has Functions added dynamicly.");
// throw new ExpressionException("component ["+name+"] in this enviroment has not the same interface as the component to load");
}
} catch (Exception e) {
throw Caster.toPageException(e);
}
setInternalState(comp, sctThis, sctVariables);
return comp;
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class ConfigServerImpl method createClusterScope.
/*private static long _countx(ConfigWebImpl config) {
long count=0;
count+=_count(config.getMappings());
count+=_count(config.getCustomTagMappings());
count+=_count(config.getComponentMappings());
count+=_count(config.getFunctionMapping());
count+=_count(config.getServerFunctionMapping());
count+=_count(config.getTagMapping());
count+=_count(config.getServerTagMapping());
//count+=_count(((ConfigWebImpl)config).getServerTagMapping());
return count;
}*/
/*private static long _count(Mapping[] mappings) {
long count=0;
for(int i=0;i<mappings.length;i++){
count+=_count(mappings[i]);
}
return count;
}*/
/*private static long _countx(Mapping mapping) {
PCLCollection pcl = ((MappingImpl)mapping).getPCLCollection();
return pcl==null?0:pcl.count();
}*/
@Override
public Cluster createClusterScope() throws PageException {
Cluster cluster = null;
try {
if (Reflector.isInstaneOf(getClusterClass(), Cluster.class)) {
cluster = (Cluster) ClassUtil.loadInstance(getClusterClass(), ArrayUtil.OBJECT_EMPTY);
cluster.init(this);
} else if (Reflector.isInstaneOf(getClusterClass(), ClusterRemote.class)) {
ClusterRemote cb = (ClusterRemote) ClassUtil.loadInstance(getClusterClass(), ArrayUtil.OBJECT_EMPTY);
cluster = new ClusterWrap(this, cb);
// cluster.init(cs);
}
} catch (Exception e) {
throw Caster.toPageException(e);
}
return cluster;
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class ConfigWebImpl method getSearchEngine.
@Override
public SearchEngine getSearchEngine(PageContext pc) throws PageException {
if (searchEngine == null) {
try {
Object o = ClassUtil.loadInstance(getSearchEngineClassDefinition().getClazz());
if (o instanceof SearchEngine)
searchEngine = (SearchEngine) o;
else
throw new ApplicationException("class [" + o.getClass().getName() + "] does not implement the interface SearchEngine");
searchEngine.init(this, ConfigWebUtil.getFile(getConfigDir(), ConfigWebUtil.translateOldPath(getSearchEngineDirectory()), "search", getConfigDir(), FileUtil.TYPE_DIR, this));
} catch (Exception e) {
throw Caster.toPageException(e);
}
}
return searchEngine;
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class ResourceUtil method strAttrToBooleanFlags.
private static short[] strAttrToBooleanFlags(String attributes) throws IOException {
String[] arr;
try {
arr = ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(attributes.toLowerCase(), ','));
} catch (PageException e) {
arr = new String[0];
}
boolean hasNormal = false;
boolean hasReadOnly = false;
boolean hasHidden = false;
boolean hasArchive = false;
boolean hasSystem = false;
for (int i = 0; i < arr.length; i++) {
String str = arr[i].trim().toLowerCase();
if (str.equals("readonly") || str.equals("read-only") || str.equals("+r"))
hasReadOnly = true;
else if (str.equals("normal") || str.equals("temporary"))
hasNormal = true;
else if (str.equals("hidden") || str.equals("+h"))
hasHidden = true;
else if (str.equals("system") || str.equals("+s"))
hasSystem = true;
else if (str.equals("archive") || str.equals("+a"))
hasArchive = true;
else
throw new IOException("invalid attribute definition [" + str + "]");
}
short[] flags = new short[4];
if (hasReadOnly)
flags[READ_ONLY] = YES;
else if (hasNormal)
flags[READ_ONLY] = NO;
if (hasHidden)
flags[HIDDEN] = YES;
else if (hasNormal)
flags[HIDDEN] = NO;
if (hasSystem)
flags[SYSTEM] = YES;
else if (hasNormal)
flags[SYSTEM] = NO;
if (hasArchive)
flags[ARCHIVE] = YES;
else if (hasNormal)
flags[ARCHIVE] = NO;
return flags;
}
use of lucee.runtime.exp.PageException in project Lucee by lucee.
the class FormImpl method makeComparable.
private String makeComparable(String key) {
key = StringUtil.trim(key, "");
// form.x
if (StringUtil.startsWithIgnoreCase(key, "form."))
key = key.substring(5).trim();
// form . x
try {
Array array = ListUtil.listToArray(key, '.');
if (array.size() > 1 && array.getE(1).toString().trim().equalsIgnoreCase("form")) {
array.removeE(1);
key = ListUtil.arrayToList(array, ".").trim();
}
} catch (PageException e) {
}
return key;
}
Aggregations