Search in sources :

Example 1 with FacesLibraryImpl

use of com.ibm.xsp.registry.FacesLibraryImpl in project org.openntf.nsfodp by OpenNTF.

the class AbstractCompilationEnvironment method getLibrary.

protected UpdatableLibrary getLibrary(String namespace) {
    SharableRegistryImpl facesRegistry = (SharableRegistryImpl) facesProject.getRegistry();
    UpdatableLibrary library = (UpdatableLibrary) facesRegistry.getLocalLibrary(namespace);
    if (library == null) {
        try {
            library = new FacesLibraryImpl(facesRegistry, namespace);
            // TODO this is probably properly done by creating a FacesProjectImpl
            // - it can then register the library fragments itself
            // Note: my first attempt at this ended with an infinite loop, so it's trickier than that
            // $NON-NLS-1$
            Field localLibsField = facesRegistry.getClass().getDeclaredField("_localLibs");
            localLibsField.setAccessible(true);
            @SuppressWarnings("unchecked") Map<String, UpdatableLibrary> localLibs = (Map<String, UpdatableLibrary>) localLibsField.get(facesRegistry);
            localLibs.put(namespace, library);
        } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
            throw new RuntimeException(e);
        }
    }
    return library;
}
Also used : UpdatableLibrary(com.ibm.xsp.registry.UpdatableLibrary) SharableRegistryImpl(com.ibm.xsp.registry.SharableRegistryImpl) Field(java.lang.reflect.Field) FacesLibraryImpl(com.ibm.xsp.registry.FacesLibraryImpl) Map(java.util.Map)

Aggregations

FacesLibraryImpl (com.ibm.xsp.registry.FacesLibraryImpl)1 SharableRegistryImpl (com.ibm.xsp.registry.SharableRegistryImpl)1 UpdatableLibrary (com.ibm.xsp.registry.UpdatableLibrary)1 Field (java.lang.reflect.Field)1 Map (java.util.Map)1