Search in sources :

Example 1 with CompoundResourceRegistry

use of org.whole.lang.resources.CompoundResourceRegistry in project whole by wholeplatform.

the class ReusablesInterpreterVisitor method visit.

@Override
public void visit(Registry entity) {
    entity.getRegistryUri().accept(this);
    String registryId = getResult().wStringValue();
    if (!ResourceRegistry.hasRegistry(registryId))
        throw new WholeIllegalArgumentException("Undefined registry " + registryId).withSourceEntity(entity).withBindings(getBindings());
    IResourceRegistry<IResource> registry = ResourceRegistry.getRegistry(registryId);
    entity.getUri().accept(this);
    String uri = getResult().wStringValue();
    if (ResourceUtils.hasFragmentPart(uri) && registry instanceof CompoundResourceRegistry) {
        CompoundResourceRegistry<IResource> compoundRegistry = (CompoundResourceRegistry<IResource>) registry;
        setResult(compoundRegistry.getFunctionModel(uri, true, getBindings()));
    } else
        setResult(registry.getResourceModel(uri, true, getBindings()));
}
Also used : WholeIllegalArgumentException(org.whole.lang.exceptions.WholeIllegalArgumentException) CompoundResourceRegistry(org.whole.lang.resources.CompoundResourceRegistry) IResource(org.whole.lang.resources.IResource)

Aggregations

WholeIllegalArgumentException (org.whole.lang.exceptions.WholeIllegalArgumentException)1 CompoundResourceRegistry (org.whole.lang.resources.CompoundResourceRegistry)1 IResource (org.whole.lang.resources.IResource)1