private IPropertySource getSourceForNamespace(INamespace namespace) { Resource key = namespace.getSpecificationLocation(); IPropertySource result = (IPropertySource) _namespaceSources.get(key); if (result == null) { result = createSourceForNamespace(namespace); _namespaceSources.put(key, result); } return result; }
private IPropertySource getSourceForNamespace(INamespace namespace) { Resource key = namespace.getSpecificationLocation(); IPropertySource result = (IPropertySource) _namespaceSources.get(key); if (result == null) { result = createSourceForNamespace(namespace); _namespaceSources.put(key, result); } return result; }
private LocalizedPropertySource getLocalizedSourceForNamespace(INamespace namespace) { Resource key = namespace.getSpecificationLocation(); LocalizedPropertySource result = (LocalizedPropertySource) _localizedNamespaceSources.get(key); if (result == null) { result = new LocalizedPropertySource(getSourceForNamespace(namespace)); _localizedNamespaceSources.put(key, result); } return result; }
private LocalizedPropertySource getLocalizedSourceForNamespace(INamespace namespace) { Resource key = namespace.getSpecificationLocation(); LocalizedPropertySource result = (LocalizedPropertySource) _localizedNamespaceSources.get(key); if (result == null) { result = new LocalizedPropertySource(getSourceForNamespace(namespace)); _localizedNamespaceSources.put(key, result); } return result; }
private Properties getNamespaceProperties(IComponent component, Locale locale) { INamespace namespace = component.getNamespace(); Resource namespaceLocation = namespace.getSpecificationLocation(); Map propertiesMap = findPropertiesMapForResource(namespaceLocation); Properties result = (Properties) propertiesMap.get(locale); if (result == null) { result = new Properties(); // recurse through parent properties List spaceList = new ArrayList(); spaceList.add(namespace); INamespace parent = namespace; while (parent.getParentNamespace() != null) { parent = parent.getParentNamespace(); spaceList.add(parent); } // reverse it so top most namespace comes first for (int i=spaceList.size() - 1; i > -1; i--) { INamespace space = (INamespace)spaceList.get(i); result.putAll(assembleNamespaceProperties(space, findPropertiesMapForResource(space.getSpecificationLocation()), locale)); } propertiesMap.put(locale, result); } return result; }
private Properties getNamespaceProperties(IComponent component, Locale locale) { INamespace namespace = component.getNamespace(); Resource namespaceLocation = namespace.getSpecificationLocation(); Map propertiesMap = findPropertiesMapForResource(namespaceLocation); Properties result = (Properties) propertiesMap.get(locale); if (result == null) { result = new Properties(); // recurse through parent properties List spaceList = new ArrayList(); spaceList.add(namespace); INamespace parent = namespace; while (parent.getParentNamespace() != null) { parent = parent.getParentNamespace(); spaceList.add(parent); } // reverse it so top most namespace comes first for (int i=spaceList.size() - 1; i > -1; i--) { INamespace space = (INamespace)spaceList.get(i); result.putAll(assembleNamespaceProperties(space, findPropertiesMapForResource(space.getSpecificationLocation()), locale)); } propertiesMap.put(locale, result); } return result; }
private Properties assembleNamespaceProperties(INamespace namespace, Map propertiesMap, Locale locale) { List localizations = findLocalizationsForResource(namespace.getSpecificationLocation(), locale, namespace.getPropertyValue(NAMESPACE_PROPERTIES_NAME)); // Build them back up in reverse order. Properties parent = _emptyProperties; Iterator i = localizations.iterator(); while(i.hasNext()) { ResourceLocalization rl = (ResourceLocalization) i.next(); Locale l = rl.getLocale(); Properties properties = (Properties) propertiesMap.get(l); if (properties == null) { properties = readNamespaceProperties(namespace, l, rl.getResource(), parent); propertiesMap.put(l, properties); } parent = properties; } return parent; }
private Properties assembleNamespaceProperties(INamespace namespace, Map propertiesMap, Locale locale) { List localizations = findLocalizationsForResource(namespace.getSpecificationLocation(), locale, namespace.getPropertyValue(NAMESPACE_PROPERTIES_NAME)); // Build them back up in reverse order. Properties parent = _emptyProperties; Iterator i = localizations.iterator(); while(i.hasNext()) { ResourceLocalization rl = (ResourceLocalization) i.next(); Locale l = rl.getLocale(); Properties properties = (Properties) propertiesMap.get(l); if (properties == null) { properties = readNamespaceProperties(namespace, l, rl.getResource(), parent); propertiesMap.put(l, properties); } parent = properties; } return parent; }
IComponentSpecification searchForComponentClass(INamespace namespace, String type) { String packages = namespace.getPropertyValue("org.apache.tapestry.component-class-packages"); String className = type.replace('/', '.'); Class componentClass = _classFinder.findClass(packages, className); if (componentClass == null) return null; IComponentSpecification spec = new ComponentSpecification(); Resource namespaceResource = namespace.getSpecificationLocation(); Resource componentResource = namespaceResource.getRelativeResource(type + ".jwc"); // try classpath relative if namespace relative doesn't resolve if (componentResource.getResourceURL() == null) { componentResource = new ClasspathResource(_classResolver, componentClass.getName().replace('.', '/')); } Location location = new LocationImpl(componentResource); spec.setLocation(location); spec.setSpecificationLocation(componentResource); spec.setComponentClassName(componentClass.getName()); return spec; }
IComponentSpecification searchForComponentClass(INamespace namespace, String type) { String packages = namespace.getPropertyValue("org.apache.tapestry.component-class-packages"); String className = type.replace('/', '.'); Class componentClass = _classFinder.findClass(packages, className); if (componentClass == null) return null; IComponentSpecification spec = new ComponentSpecification(); Resource namespaceResource = namespace.getSpecificationLocation(); Resource componentResource = namespaceResource.getRelativeResource(type + ".jwc"); // try classpath relative if namespace relative doesn't resolve if (componentResource.getResourceURL() == null) { componentResource = new ClasspathResource(_classResolver, componentClass.getName().replace('.', '/')); } Location location = new LocationImpl(componentResource); spec.setLocation(location); spec.setSpecificationLocation(componentResource); spec.setComponentClassName(componentClass.getName()); return spec; }
public IComponentSpecification findPageSpecification(IRequestCycle cycle, INamespace namespace, String name) { if (namespace.isApplicationNamespace()) { String packages = namespace .getPropertyValue("org.apache.tapestry.page-class-packages"); String className = name.replace('/', '.'); Class pageClass = classFinder.findClass(packages, className); if (pageClass == null) { return null; } String fullPath = pageClass.getName().replace('.', '/'); ClasspathResource html = new ClasspathResource(new DefaultClassResolver(), fullPath + ".html"); if (html.getResourceURL() != null) { return setupImplicitPage(namespace.getSpecificationLocation(), new ClasspathResource(new DefaultClassResolver(), fullPath + ".page")); } } return null; }
IComponentSpecification searchForComponentClass(INamespace namespace, String componentType) { String packages = namespace .getPropertyValue("org.apache.tapestry.component-class-packages"); String className = componentType.replace('/', '.'); Class componentClass = classFinder.findClass(packages, className); if (componentClass == null) { return null; } Resource componentResource = null; Resource namespaceResource = namespace.getSpecificationLocation(); String fullPath = componentClass.getName().replace('.', '/'); ClasspathResource html = new ClasspathResource( new DefaultClassResolver(), fullPath + ".html"); // first check near the class, if the html is there then that's where // the (fictional) jwc should be - need exploded wars for this if (html.getResourceURL() != null && namespace.isApplicationNamespace()) { componentResource = new ClasspathResource( new DefaultClassResolver(), fullPath + ".jwc"); } else { componentResource = namespaceResource.getRelativeResource(componentType + ".jwc"); } Location location = new LocationImpl(componentResource); IComponentSpecification spec = new ComponentSpecification(); spec.setLocation(location); spec.setSpecificationLocation(componentResource); spec.setComponentClassName(componentClass.getName()); return spec; }
Resource namespaceLocation = namespace.getSpecificationLocation();
Resource namespaceLocation = namespace.getSpecificationLocation();
Resource namespaceLocation = namespace.getSpecificationLocation();
Resource namespaceLocation = namespace.getSpecificationLocation();
Resource namespaceLocation = namespace.getSpecificationLocation();