/** * Creates a new ComponentAddress using the given Page Name and ID Path relative on the provided * Namespace. * * @param namespace * the namespace of the page that contains the component * @param pageName * the name of the page that contains the component * @param idPath * the ID Path of the component */ public ComponentAddress(INamespace namespace, String pageName, String idPath) { this(namespace.constructQualifiedName(pageName), idPath); }
private void addPageNames(Set names, INamespace namespace) { String idPrefix = namespace.getExtendedId(); List pageNames = namespace.getPageNames(); int count = pageNames.size(); for (int i = 0; i < count; i++) { String name = (String) pageNames.get(i); if (idPrefix == null) names.add(name); else names.add(idPrefix + ":" + name); } List ids = namespace.getChildIds(); count = ids.size(); for (int i = 0; i < count; i++) { String id = (String) ids.get(i); addPageNames(names, namespace.getChildNamespace(id)); } }
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 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; }
Resource namespaceLocation = namespace.getSpecificationLocation(); return result; if (namespace.isApplicationNamespace()) { if (framework.containsComponentType(_type)) return framework.getComponentSpecification(_type);
Resource namespaceLocation = namespace.getSpecificationLocation(); return; if (namespace.isApplicationNamespace()) if (_frameworkNamespace.containsPage(_simpleName)) setSpecification(_frameworkNamespace.getPageSpecification(_simpleName)); return;
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; }
public String provideComponentClassName( ComponentClassProviderContext context) { // This may be null, if the namespace fails to define this meta data // value. return context.getNamespace().getPropertyValue( TapestryConstants.PAGE_CLASS_NAME); }
if (namespace.containsComponentType(type)) { setSpecification(namespace.getComponentSpecification(type)); return;
private String buildExtendedId() { if (_parent == null) return _id; String parentId = _parent.getExtendedId(); // If immediate child of application namespace if (parentId == null) return _id; return parentId + "." + _id; }
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; }
public INamespace getChildNamespace(String id) { String firstId = id; String nextIds = null; // Split the id into first and next if it is a dot separated sequence int index = id.indexOf('.'); if (index >= 0) { firstId = id.substring(0, index); nextIds = id.substring(index + 1); } // Get the first namespace INamespace result = (INamespace) _children.get(firstId); if (result == null) { result = createNamespace(firstId); _children.put(firstId, result); } // If the id is a dot separated sequence, recurse to find // the needed namespace if (result != null && nextIds != null) result = result.getChildNamespace(nextIds); return result; }
if (namespace.containsPage(_simpleName)) setSpecification(namespace.getPageSpecification(_simpleName)); return;
private void install() { INamespace namespace = getNamespace(); IComponentSpecification specification = getSpecification(); // if (_log.isDebugEnabled()) // _log.debug(ImplMessages.installingComponent(_type, namespace, // specification)); namespace.installComponentSpecification(type, specification); }
&& component.getNamespace().isApplicationNamespace()) result = findPageTemplateInApplicationRoot( cycle,
Resource namespaceLocation = namespace.getSpecificationLocation(); return result; if (namespace.isApplicationNamespace()) { if (framework.containsComponentType(_type)) return framework.getComponentSpecification(_type);
Resource namespaceLocation = namespace.getSpecificationLocation(); return; if (namespace.isApplicationNamespace()) if (_frameworkNamespace.containsPage(_simpleName)) setSpecification(_frameworkNamespace.getPageSpecification(_simpleName)); return;
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; }
public String provideComponentClassName( ComponentClassProviderContext context) { // This may be null, if the namespace fails to define this meta data // value. return context.getNamespace().getPropertyValue( TapestryConstants.PAGE_CLASS_NAME); }
if (namespace.containsComponentType(type)) setSpecification(namespace.getComponentSpecification(type)); return;