Package org.apache.hivemind.util

Examples of org.apache.hivemind.util.ClasspathResource


    {
        String newline = System.getProperty("line.separator");

        Location l = newLocation();
        ClassResolver resolver = new DefaultClassResolver();
        Resource filea = new ClasspathResource(resolver, "org/apache/tapestry/utils/filea.txt");
        Resource fileb = new ClasspathResource(resolver, "org/apache/tapestry/utils/fileb.txt");

        MockControl assetServicec = newControl(IEngineService.class);
        IEngineService assetService = (IEngineService) assetServicec.getMock();

        IRequestCycle cycle = newCycle();
View Full Code Here


{
    public void testOnClasspath() throws Exception
    {
        DefaultClassResolver cr = new DefaultClassResolver();

        Resource appSpecResource = new ClasspathResource(cr, "/foo/OnClasspath.application");

        ApplicationSpecificationInitializer i = new ApplicationSpecificationInitializer();

        Log log = (Log) newMock(Log.class);

        i.setLog(log);

        ClasspathResourceFactoryImpl cf = new ClasspathResourceFactoryImpl();
        cf.setClassResolver(cr);

        i.setClasspathResourceFactory(cf);

        HttpServlet servlet = new ServletFixture();

        MockControl configControl = newControl(ServletConfig.class);
        ServletConfig config = (ServletConfig) configControl.getMock();

        trainForServletInit(configControl, config);

        config.getInitParameter(ApplicationSpecificationInitializer.APP_SPEC_PATH_PARAM);
        configControl.setReturnValue(appSpecResource.getPath());

        IApplicationSpecification as = new ApplicationSpecification();

        MockControl parserControl = newControl(ISpecificationParser.class);
        ISpecificationParser parser = (ISpecificationParser) parserControl.getMock();
View Full Code Here

    protected Resource getSpecificationResourceLocation(String simpleName)
    {
        String adjustedClassName = "/" + getClass().getName().replace('.', '/') + ".class";

        Resource classResource = new ClasspathResource(_resolver, adjustedClassName);

        return classResource.getRelativeResource(simpleName);
    }
View Full Code Here

    private void writeExternalScripts(IMarkupWriter writer)
    {
        int count = Tapestry.size(_externalScripts);
        for (int i = 0; i < count; i++)
        {
            ClasspathResource scriptLocation = (ClasspathResource) _externalScripts.get(i);

            // This is still very awkward! Should move the code inside PrivateAsset somewhere
            // else, so that an asset does not have to be created to to build the URL.
            PrivateAsset asset = new PrivateAsset(scriptLocation, null);
            String url = asset.buildURL(getPage().getRequestCycle());
View Full Code Here

{
    private ClassResolver _classResolver;

    public ClasspathResource newResource(String path)
    {
        return new ClasspathResource(_classResolver, path);
    }
View Full Code Here

        // is in the context root is problematic, cause getRelativeLocation()
        // will still be looking in the context. Handle this case with the
        // following little kludge:

        if (location.getResourceURL() == null && path.startsWith("/"))
            location = new ClasspathResource(_resolver, path);

        ILibrarySpecification ls = _specificationSource.getLibrarySpecification(location);

        return new Namespace(id, this, ls, _specificationSource, _resolver);
    }
View Full Code Here

        finalSymbols.put(FIELD_SYMBOL, field);
        finalSymbols.put(FORM_SYMBOL, form);
        finalSymbols.put(VALIDATOR_SYMBOL, this);

        Resource location = new ClasspathResource(engine.getClassResolver(), scriptPath);

        IScript script = source.getScript(location);

        Body body = Body.get(cycle);
View Full Code Here

        // 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);
View Full Code Here

        }
    }

    private ClasspathResource newClassResource(Class clazz)
    {
        return new ClasspathResource(_classResolver, clazz.getName().replace('.', '/'));
    }
View Full Code Here

        return newMock(EnhancementOperation.class);
    }

    protected Resource newResource(Class clazz)
    {
        return new ClasspathResource(getClassResolver(), clazz.getName().replace('.', '/'));
    }
View Full Code Here

TOP

Related Classes of org.apache.hivemind.util.ClasspathResource

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.