use of lucee.runtime.MappingImpl in project Lucee by lucee.
the class ExportImportHandler method exportMapping.
private static List<Object> exportMapping(Mapping[] mappings, Resource dir, String pathAppendix, String filter) throws IOException {
List<Object> list = new ArrayList<Object>();
Map<String, Object> m;
for (Mapping mapping : mappings) {
MappingImpl mi = (MappingImpl) mapping;
m = new HashMap<String, Object>();
list.add(m);
m.put("virtual", mapping.getVirtual());
m.put("inspect", ConfigWebUtil.inspectTemplate(mi.getInspectTemplateRaw(), ""));
m.put("toplevel", mapping.isTopLevel());
m.put("readonly", mapping.isReadonly());
m.put("hidden", mapping.isHidden());
m.put("physicalFirst", mapping.isPhysicalFirst());
m.put("hidden", mapping.isHidden());
// archive
if (mapping.hasArchive()) {
Resource archive = mapping.getArchive();
if (archive.isFile()) {
Resource arcDir = dir.getRealResource("archive/");
arcDir.mkdir();
m.put("archive", pathAppendix + "archive/" + archive.getName());
IOUtil.copy(archive, arcDir.getRealResource(archive.getName()));
}
}
// physical
if (mapping.hasPhysical()) {
Resource physical = mi.getPhysical();
if (physical.isDirectory()) {
String id = CreateUniqueId.invoke();
Resource phyDir = dir.getRealResource("physical/" + id);
phyDir.mkdirs();
m.put("physical", pathAppendix + "physical/" + id);
ResourceFilter f = null;
if (!StringUtil.isEmpty(filter)) {
f = new OrResourceFilter(new ResourceFilter[] { new WildcardPatternFilter(filter, ","), DirectoryResourceFilter.FILTER });
}
if (// PATCH this needs more digging
!physical.getAbsolutePath().equals("/"))
ResourceUtil.copyRecursive(physical, phyDir, f);
}
}
}
return list;
}
use of lucee.runtime.MappingImpl in project Lucee by lucee.
the class GetUsageData method templateCacheElements.
private static long[] templateCacheElements(Mapping[] mappings) {
long elements = 0, size = 0;
PageSourcePool psp;
String[] keys;
PageSourceImpl ps;
Resource res;
MappingImpl mapping;
for (int i = 0; i < mappings.length; i++) {
mapping = (MappingImpl) mappings[i];
psp = mapping.getPageSourcePool();
keys = psp.keys();
for (int y = 0; y < keys.length; y++) {
ps = (PageSourceImpl) psp.getPageSource(keys[y], false);
if (ps.isLoad()) {
elements++;
res = mapping.getClassRootDirectory().getRealResource(ps.getClassName().replace('.', '/') + ".class");
size += res.length();
}
}
}
return new long[] { elements, size };
}
use of lucee.runtime.MappingImpl in project Lucee by lucee.
the class PagePoolList method fill.
private static void fill(Array arr, Mapping[] mappings) throws PageException {
if (mappings == null)
return;
MappingImpl mapping;
for (int i = 0; i < mappings.length; i++) {
mapping = (MappingImpl) mappings[i];
toArray(arr, mapping.getPageSourcePool());
}
}
Aggregations