Package org.apache.tapestry5.ioc

Examples of org.apache.tapestry5.ioc.Resource


        MultiKey key = new MultiKey(componentName, selector);

        // First cache is key to resource.

        Resource resource = templateResources.get(key);

        if (resource == null)
        {
            resource = locateTemplateResource(componentModel, selector);
            templateResources.put(key, resource);
View Full Code Here


    private Resource locateTemplateResource(ComponentModel initialModel, ComponentResourceSelector selector)
    {
        ComponentModel model = initialModel;
        while (model != null)
        {
            Resource localized = locator.locateTemplate(model, selector);

            if (localized != null)
                return localized;

            // Otherwise, this component doesn't have its own template ... lets work up to its
View Full Code Here

                {
                    return l.resource;
                }
            }

            Resource result = findLocalizedResource(locale);

            firstLocalization = new Localization(locale, result, firstLocalization);

            return result;
View Full Code Here

    private Resource findLocalizedResource(Locale locale)
    {
        for (String path : new LocalizedNameGenerator(this.path, locale))
        {
            Resource potential = createResource(path);

            if (potential.exists())
                return potential;
        }

        return null;
    }
View Full Code Here

        for (Map.Entry<String, AssetFactory> e : configuration.entrySet())
        {
            String prefix = e.getKey();
            AssetFactory factory = e.getValue();

            Resource rootResource = factory.getRootResource();

            byResourceClass.put(rootResource.getClass(), factory);

            prefixToRootResource.put(prefix, rootResource);
        }

        registry = StrategyRegistry.newInstance(AssetFactory.class, byResourceClass);
View Full Code Here

        assert InternalUtils.isNonBlank(path);
        int colonx = path.indexOf(':');

        if (colonx < 0)
        {
            Resource root = baseResource != null ? baseResource : prefixToRootResource.get(AssetConstants.CLASSPATH);

            return root.forFile(path);
        }

        String prefix = path.substring(0, colonx);

        Resource root = prefixToRootResource.get(prefix);

        if (root == null)
            throw new IllegalArgumentException(ServicesMessages.unknownAssetPrefix(path));

        return root.forFile(path.substring(colonx + 1));
    }
View Full Code Here

        return root.forFile(path.substring(colonx + 1));
    }

    private Asset getLocalizedAssetFromResource(Resource unlocalized, Locale locale)
    {
        Resource localized = locale == null ? unlocalized : unlocalized.forLocale(locale);

  if (localized == null || !localized.exists())
            throw new RuntimeException(ServicesMessages.assetDoesNotExist(unlocalized));

        return getAssetForResource(localized);
    }
View Full Code Here

        Context context = mockContext();
        Request request = mockRequest();

        BaseURLSource baseURLSource = newMock(BaseURLSource.class);

        Resource r = new ContextResource(context, "foo/Bar.txt");

        train_getContextPath(request, "/context");

        replay();
View Full Code Here

        Context context = mockContext();
        Request request = mockRequest();

        BaseURLSource baseURLSource = newMock(BaseURLSource.class);

        Resource r = new ContextResource(context, "foo/Bar.txt");

        train_getContextPath(request, "/context");
        train_getBaseSource(baseURLSource, request);

        replay();
View Full Code Here

        replay();

        forceCacheClear();

        Resource resource = simpleComponentResource.forFile("NoSuchAppCatalog.properties");
        List<Resource> resources = Arrays.asList(resource);

        ComponentMessagesSource source = new ComponentMessagesSourceImpl(true, resources,
                new PropertiesFileParserImpl(), resourceLocator, converter);
View Full Code Here

TOP

Related Classes of org.apache.tapestry5.ioc.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.