Package org.apache.tapestry5.ioc

Examples of org.apache.tapestry5.ioc.Resource


    @Test
    public void asset_to_asset2_wrapper()
    {
        Asset asset = mockAsset();
        Resource resource = mockResource();
        String clientURL = "clientURL";

        train_toClientURL(asset, clientURL);

        expect(asset.getResource()).andReturn(resource);
View Full Code Here


        // What would be cool is if we could maintain a cache of bundle id + locale -->
        // Resource. That would optimize quite a bit of this; may need to use an alternative to
        // LocalizedNameGenerator.

        Resource propertiesResource = bundle.getBaseResource().withExtension("properties");

        List<Resource> localizations = resourceLocator.locateMessageCatalog(propertiesResource, selector);

        // Localizations are now in least-specific to most-specific order.
View Full Code Here

            paths.put(path);

            writer.format("\n/* %s */;\n", path);

            Resource resource = library.getResource();

            description.append(sep).append(resource.toString());
            sep = ", ";

            StreamableResource streamable = streamableResourceSource.getStreamableResource(resource,
                    StreamableResourceProcessing.FOR_AGGREGATION, resourceChangeTracker);

View Full Code Here

        return this.getService(TemplateParser.class);
    }

    private synchronized ComponentTemplate parse(String file)
    {
        Resource resource = getResource(file);

        return getParser().parseTemplate(resource);
    }
View Full Code Here

    }

    @Test
    public void just_HTML()
    {
        Resource resource = getResource("justHTML.tml");

        ComponentTemplate template = getParser().parseTemplate(resource);

        assertSame(template.getResource(), resource);
View Full Code Here

    }

    @Test
    public void namespaced_element()
    {
        Resource resource = getResource("namespaced_element.tml");

        ComponentTemplate template = getParser().parseTemplate(resource);

        assertSame(template.getResource(), resource);
View Full Code Here

    }

    @Override
    public LessSource relativeSource(String filename) throws FileNotFound, CannotReadFile, StringSourceException
    {
        Resource relative = resource.forFile(filename);

        if (!relative.exists())
        {
            throw new FileNotFound();
        }

        dependencies.addDependency(relative);
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

                        // Based on the path, metaResource is where it should exist in a 5.4 and beyond world ... unless the expanded
                        // path was a bit too full of ../ sequences, in which case the expanded path is not valid and we adjust the
                        // error we write.

                        Resource metaResource = findLocalizedResource(null, metaPath, resources.getLocale());

                        Asset result = getComponentAsset(resources, expanded, metaResource);

                        if (result == null)
                        {
                            throw new RuntimeException(String.format("Unable to locate asset '%s' for component %s. It should be located at %s.",
                                    path, resources.getCompleteId(),
                                    metaPath));
                        }

                        // This is the best way to tell if the result is an asset for a Classpath resource.

                        Resource resultResource = result.getResource();

                        if (!resultResource.equals(metaResource))
                        {
                            if (firstWarning.getAndSet(false))
                            {
                                logger.error("Packaging of classpath assets has changed in release 5.4; " +
                                        "Assets should no longer be on the main classpath, " +
                                        "but should be moved to 'META-INF/assets/' or a sub-folder. Future releases of Tapestry may " +
                                        "no longer support assets on the main classpath.");
                            }

                            if (metaResource.getFolder().startsWith(metaRoot))
                            {
                                logger.warn(String.format("Classpath asset '/%s' should be moved to folder '/%s/'.",
                                        resultResource.getPath(),
                                        metaResource.getFolder()));
                            } else
                            {
                                logger.warn(String.format("Classpath asset '/%s' should be moved under folder '/%s', and the relative path adjusted.",
                                        resultResource.getPath(),
                                        metaRoot));
                            }
                        }

                        return result;
View Full Code Here

        if (metaResource.exists())
        {
            return getAssetForResource(metaResource);
        }

        Resource oldStyle = findLocalizedResource(resources.getBaseResource(), expandedPath, resources.getLocale());

        if (oldStyle == null || !oldStyle.exists())
        {
            return null;
        }

        return getAssetForResource(oldStyle);
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.