if (resourceKey.getResourceName().endsWith(ResourceLibraryRenderer.RESOURCE_LIBRARY_EXTENSION)) {
String libraryName = resourceKey.getLibraryName();
String resourceName = resourceKey.getResourceName().substring(0,
resourceKey.getResourceName().length() - ResourceLibraryRenderer.RESOURCE_LIBRARY_EXTENSION.length());
ResourceLibrary resourceLibrary = factory.getResourceLibrary(resourceName, libraryName);
if (resourceLibrary == null) {
throw new IllegalArgumentException("Resource library is null: " + libraryName + ":" + resourceName);
}
for (ResourceKey expandedKey : resourceLibrary.getResources()) {
expandedResources.add(expandedKey);
}
} else {
expandedResources.add(resourceKey);