public ParsedScript(ExpressionEvaluator evaluator, ValueConverter valueConverter, Location location) { super(location); _evaluator = evaluator; _valueConverter = valueConverter; _scriptResource = location.getResource(); }
public ParsedScript(ExpressionEvaluator evaluator, ValueConverter valueConverter, Location location) { super(location); _evaluator = evaluator; _valueConverter = valueConverter; _scriptResource = location.getResource(); }
static String duplicateModuleId(String moduleId, Location locationOfExisting, Location locationOfDuplicate) { return _formatter.format( "duplicate-module-id", moduleId, locationOfExisting.getResource(), locationOfDuplicate.getResource()); }
public boolean equals(Object other) { if (!(other instanceof Location)) return false; Location l = (Location) other; if (_lineNumber != l.getLineNumber()) return false; if (_columnNumber != l.getColumnNumber()) return false; return _resource.equals(l.getResource()); }
public void renderObject(Object object, IMarkupWriter writer, IRequestCycle cycle) { Location l = (Location) object; // Always print out the location as a string. writer.print(l.toString()); int lineNumber = l.getLineNumber(); if (lineNumber < 1) return; URL url = l.getResource().getResourceURL(); if (url == null) return; writeResourceContent(writer, url, lineNumber); }
public void renderObject(Object object, IMarkupWriter writer, IRequestCycle cycle) { Location l = (Location) object; // Always print out the location as a string. writer.print(l.toString()); int lineNumber = l.getLineNumber(); if (lineNumber < 1) return; URL url = l.getResource().getResourceURL(); if (url == null) return; writeResourceContent(writer, url, lineNumber); }
private void addAssets(IComponent component, IComponentSpecification specification) { List names = specification.getAssetNames(); if (names.isEmpty()) return; Iterator i = names.iterator(); while(i.hasNext()) { String name = (String) i.next(); IAssetSpecification assetSpec = specification.getAsset(name); IAsset asset = _assetSource.findAsset(assetSpec.getLocation().getResource(), specification, assetSpec.getPath(), _locale, assetSpec.getLocation()); component.addAsset(name, asset); } }
private void addAssets(IComponent component, IComponentSpecification specification) { List names = specification.getAssetNames(); if (names.isEmpty()) return; Iterator i = names.iterator(); while(i.hasNext()) { String name = (String) i.next(); IAssetSpecification assetSpec = specification.getAsset(name); IAsset asset = _assetSource.findAsset(assetSpec.getLocation().getResource(), specification, assetSpec.getPath(), _locale, assetSpec.getLocation()); component.addAsset(name, asset); } }
public synchronized Messages getMessages() { if (_messages == null) { ThreadLocale threadLocale = (ThreadLocale) _registry.getService( HiveMind.THREAD_LOCALE_SERVICE, ThreadLocale.class, this); MessageFinder finder = new MessageFinderImpl(getLocation().getResource()); _messages = new ModuleMessages(finder, threadLocale); } return _messages; }
Resource findAsset(IComponentSpecification spec, Resource baseResource, String path, Locale locale) { Resource assetResource = baseResource.getRelativeResource("/").getRelativeResource(path); Resource localized = _localizer.findLocalization(assetResource, locale); if (localized == null) { assetResource = baseResource.getRelativeResource(path); localized = _localizer.findLocalization(assetResource, locale); } if (localized == null && spec != null && spec.getLocation().getResource() != null) { // try relative to specification assetResource = spec.getLocation().getResource().getRelativeResource("/").getRelativeResource(path); localized = _localizer.findLocalization(assetResource, locale); } if (localized == null || localized.getResourceURL() == null) { // try relative to context root // paths must begin with "/" for context resolution if (path != null && !path.startsWith("/")) path = "/" + path; Resource base = new WebContextResource(_webContext, path); localized = _localizer.findLocalization(base, locale); } return localized; }
Resource findAsset(IComponentSpecification spec, Resource baseResource, String path, Locale locale) { Resource assetResource = baseResource.getRelativeResource("/").getRelativeResource(path); Resource localized = _localizer.findLocalization(assetResource, locale); if (localized == null) { assetResource = baseResource.getRelativeResource(path); localized = _localizer.findLocalization(assetResource, locale); } if (localized == null && spec != null && spec.getLocation().getResource() != null) { // try relative to specification assetResource = spec.getLocation().getResource().getRelativeResource("/").getRelativeResource(path); localized = _localizer.findLocalization(assetResource, locale); } if (localized == null || localized.getResourceURL() == null) { // try relative to context root // paths must begin with "/" for context resolution if (path != null && !path.startsWith("/")) path = "/" + path; Resource base = new WebContextResource(_webContext, path); localized = _localizer.findLocalization(base, locale); } return localized; }
/** * Finds the resource. If the inputValue is blank, then returns null. * Interprets the inputValue as a relative path from the contributing module's descriptor. * In addition, a localized resource will be returned if avaiable (localized to * the {@link org.apache.hivemind.Registry#getLocale() registry's locale}. * */ public Object translate( Module contributingModule, Class propertyType, String inputValue, Location location) { if (HiveMind.isBlank(inputValue)) return null; Locale locale = contributingModule.getLocale(); Resource descriptor = contributingModule.getLocation().getResource(); Resource baseResource = descriptor.getRelativeResource(inputValue); Resource result = baseResource.getLocalization(locale); if (result == null) throw new ApplicationRuntimeException( RulesMessages.resourceLocalizationError(inputValue, contributingModule)); return result; }
Resource resource = location.getResource().getRelativeResource(scriptName); IAsset scriptAsset = _assetSource.findAsset(location.getResource(), op.getSpecification(), scriptName, null, location);
Resource resource = location.getResource().getRelativeResource(scriptName); IAsset scriptAsset = _assetSource.findAsset(location.getResource(), op.getSpecification(), scriptName, null, location);