use of org.openntf.nsfodp.commons.odp.CustomControl in project org.openntf.nsfodp by OpenNTF.
the class ODPCompiler method compileCustomControls.
// *******************************************************************************
// * XSP compilation methods
// *******************************************************************************
private Map<CustomControl, XSPCompilationResult> compileCustomControls(JavaSourceClassLoader classLoader) throws Exception {
subTask(Messages.ODPCompiler_compilingCustomControls);
ConfigParser configParser = ConfigParserFactory.getParserInstance();
FacesClassLoader facesClassLoader = new DynamicFacesClassLoader(dynamicXPageBean, classLoader);
Map<CustomControl, XSPCompilationResult> result = new LinkedHashMap<>();
List<CustomControl> ccs = odp.getCustomControls();
for (CustomControl cc : ccs) {
Document xspConfig = cc.getXspConfig().get();
// $NON-NLS-1$
String namespace = StringUtil.trim(NSFODPDomUtil.node(xspConfig, "/faces-config/faces-config-extension/namespace-uri/text()").get().getTextContent());
Path fileName = odp.getBaseDirectory().relativize(cc.getXspConfigFile());
LibraryFragmentImpl fragment = (LibraryFragmentImpl) configParser.createFacesLibraryFragment(facesProject, facesClassLoader, fileName.toString(), xspConfig.getDocumentElement(), resourceBundleSource, iconUrlSource, namespace);
UpdatableLibrary library = getLibrary(namespace);
library.addLibraryFragment(fragment);
// Load the definition to refresh its parent ref
CompositeComponentDefinitionImpl def = (CompositeComponentDefinitionImpl) library.getDefinition(cc.getControlName());
def.refreshReferences();
}
// Now that they're all defined, try to compile them in a queue
for (CustomControl cc : ccs) {
XSPCompilationResult compilationResult = compileXSP(cc, classLoader);
result.put(cc, compilationResult);
}
return result;
}
use of org.openntf.nsfodp.commons.odp.CustomControl in project org.openntf.nsfodp by OpenNTF.
the class ODPCompiler method importCustomControls.
private void importCustomControls(NDXLImporter importer, NDatabase database, JavaSourceClassLoader classLoader, Set<String> compiledClassNames) throws Exception {
subTask(Messages.ODPCompiler_importingCustomControls);
List<CustomControl> ccs = odp.getCustomControls();
for (CustomControl cc : ccs) {
Document dxlDoc = importXSP(importer, database, classLoader, compiledClassNames, cc);
String xspConfig = cc.getXspConfigSource();
byte[] xspConfigData = xspConfig.getBytes(StandardCharsets.UTF_8);
// $NON-NLS-1$
DXLUtil.writeItemFileData(dxlDoc, "$ConfigData", xspConfigData);
// $NON-NLS-1$
DXLUtil.writeItemNumber(dxlDoc, "$ConfigSize", xspConfigData.length);
importDxl(importer, NSFODPDomUtil.getXmlString(dxlDoc, null), database, MessageFormat.format(Messages.ODPCompiler_customControlLabel, cc.getPageName()));
}
}
Aggregations