Package org.apache.hivemind

Examples of org.apache.hivemind.Resource


    private void enqueueJar(File jarFile) throws IOException
    {
        URL jarRootURL = new URL("jar:" + jarFile.toURL() + "!/");

        Resource jarResource = new URLResource(jarRootURL);

        enqueueIfExists(jarResource, RegistryBuilder.HIVE_MODULE_SDL);
        enqueueIfExists(jarResource, RegistryBuilder.HIVE_MODULE_XML);
    }
View Full Code Here


        enqueueIfExists(jarResource, RegistryBuilder.HIVE_MODULE_XML);
    }

    private void enqueueIfExists(Resource jarResource, String path)
    {
        Resource r = jarResource.getRelativeResource(path);

        if (r.getResourceURL() != null)
            enqueue(r);
    }
View Full Code Here

    private ResourceLocalizer _localizer;

    public IAsset createAsset(Resource baseResource, String path, Locale locale, Location location)
    {
        Resource asset = baseResource.getRelativeResource(path);
        Resource localized = _localizer.findLocalization(asset, locale);

        if (localized == null)
            throw new ApplicationRuntimeException(AssetMessages.missingAsset(path, baseResource),
                    location, null);
View Full Code Here

        return createAsset(localized, location);
    }

    public IAsset createAbsoluteAsset(String path, Locale locale, Location location)
    {
        Resource base = new ClasspathResource(_classResolver, path);
        Resource localized = _localizer.findLocalization(base, locale);

        if (localized == null)
            throw new ApplicationRuntimeException(AssetMessages.missingClasspathResource(path),
                    location, null);
View Full Code Here

    private void writeExternalScripts(IMarkupWriter writer, IRequestCycle cycle)
    {
        int count = Tapestry.size(_externalScripts);
        for (int i = 0; i < count; i++)
        {
            Resource scriptLocation = (Resource) _externalScripts.get(i);
           
            IAsset asset = _assetFactory.createAsset(scriptLocation, null);
           
            String url = asset.buildURL();
           
View Full Code Here

     * @since 4.0
     */

    protected void addModuleIfExists(RegistryBuilder builder, ServletContext context, String path)
    {
        Resource r = new ContextResource(context, path);

        if (r.getResourceURL() == null)
            return;

        builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(_resolver, r));
    }
View Full Code Here

        _pageRenderSupport = TapestryUtils.getPageRenderSupport(cycle, field);
    }

    public void includeClasspathScript(String path)
    {
        Resource resource = new ClasspathResource(_resolver, path);

        _pageRenderSupport.addExternalScript(resource);
    }
View Full Code Here

    {
        // We always create a new asset relative to an existing resource; the type of resource
        // will jive with the type of asset returned. Path may start with a leading slash, which
        // yields an absolute, not relative, path to the resource.

        Resource assetResource = baseResource.getRelativeResource(path);

        // Here's the thing; In Tapestry 3.0 and earlier, you could specify
        // library path like /org/apache/tapestry/contrib/Contrib.library. In the new scheme
        // of things, that should be "classpath:/org/apache/tapestry/contrib/Contrib.library".
        // But to keep a lot of things from breaking, we'll kludgely allow that here.

        if (assetResource.getResourceURL() == null && path.startsWith("/"))
            return _classpathAssetFactory.createAbsoluteAsset(path, locale, location);

        Resource localized = _localizer.findLocalization(assetResource, locale);

        if (localized == null)
            throw new ApplicationRuntimeException(AssetMessages.missingAsset(path, baseResource),
                    location, null);
View Full Code Here

        return createAsset(localized, location);
    }

    public IAsset createAbsoluteAsset(String path, Locale locale, Location location)
    {
        Resource base = new WebContextResource(_webContext, path);
        Resource localized = _localizer.findLocalization(base, locale);

        if (localized == null)
            throw new ApplicationRuntimeException(AssetMessages.missingContextResource(path),
                    location, null);
View Full Code Here

    private void parseDocument()
    {
        InputStream stream = null;

        Resource resource = getResource();

        boolean success = false;

        try
        {
            if (_parser == null)
                _parser = _parserFactory.newSAXParser();

            URL resourceURL = resource.getResourceURL();

            if (resourceURL == null)
                throw new DocumentParseException(ParseMessages.missingResource(resource), resource);

            InputStream rawStream = resourceURL.openStream();
View Full Code Here

TOP

Related Classes of org.apache.hivemind.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.