Package org.apache.cayenne.resource

Examples of org.apache.cayenne.resource.Resource


        ProjectUpgrader_V6 upgrader = new ProjectUpgrader_V6();
        Injector injector = DIBootstrap.createInjector(testModule);
        injector.injectMembers(upgrader);

        Resource source = new URLResource(url);
        UpgradeHandler handler = upgrader.getUpgradeHandler(source);

        assertNotNull(handler);
        assertSame(source, handler.getProjectSource());
View Full Code Here


        ProjectUpgrader_V6 upgrader = new ProjectUpgrader_V6();
        Injector injector = DIBootstrap.createInjector(testModule);
        injector.injectMembers(upgrader);

        Resource source = new URLResource(url);
        UpgradeHandler handler = upgrader.getUpgradeHandler(source);

        assertNotNull(handler);
        assertSame(source, handler.getProjectSource());
View Full Code Here

        ProjectUpgrader_V6 upgrader = new ProjectUpgrader_V6();
        Injector injector = DIBootstrap.createInjector(testModule);
        injector.injectMembers(upgrader);

        Resource source = new URLResource(targetsBefore.get(0).toURL());
        UpgradeHandler handler = upgrader.getUpgradeHandler(source);

        Resource upgraded = handler.performUpgrade();
        assertNotNull(upgraded);
        assertNotSame(source, upgrader);

        // check that all the new files are created...
        String[] targetsAfterNames = new String[] {
View Full Code Here

            logger.debug("No explicit DBCP config location, will use default location: "
                    + DBCP_PROPERTIES);
            location = DBCP_PROPERTIES;
        }

        Resource baseConfiguration = nodeDescriptor.getConfigurationSource();
        if (baseConfiguration == null) {
            throw new CayenneRuntimeException(
                    "Null 'configurationSource' for nodeDescriptor '%s'",
                    nodeDescriptor.getName());
        }

        Resource dbcpConfiguration = baseConfiguration.getRelativeResource(location);
        if (dbcpConfiguration == null) {
            throw new CayenneRuntimeException(
                    "Missing DBCP configuration '%s' for nodeDescriptor '%s'",
                    location,
                    nodeDescriptor.getName());
View Full Code Here

                }
            }
            else if (localName.equals(MAP_TAG)) {

                String dataMapName = attributes.getValue("", "name");
                Resource baseResource = descriptor.getConfigurationSource();

                String dataMapLocation = nameMapper.configurationLocation(
                        DataMap.class,
                        dataMapName);

                Resource dataMapResource = baseResource
                        .getRelativeResource(dataMapLocation);

                logger.info("Loading XML DataMap resource from " + dataMapResource.getURL());

                DataMap dataMap = dataMapLoader.load(dataMapResource);
                dataMap.setName(dataMapName);
                dataMap.setLocation(dataMapLocation);
                dataMap.setConfigurationSource(dataMapResource);
View Full Code Here

                throw new DataDomainLoadException(
                        "Configuration resource \"%s\" is not found.",
                        location);
            }

            Resource configurationResource = configurations.iterator().next();

            // no support for multiple configs yet, but this is not a hard error
            if (configurations.size() > 1) {
                logger.info("found "
                        + configurations.size()
                        + " configurations for "
                        + location
                        + ", will use the first one: "
                        + configurationResource.getURL());
            }

            ConfigurationTree<DataChannelDescriptor> tree = loader
                    .load(configurationResource);
            if (!tree.getLoadFailures().isEmpty()) {
View Full Code Here

    }

    public void testGetRelativeResource() throws Exception {
        URL url = new URL("http://cayenne.apache.org");
        URLResource resource = new URLResource(url);
        Resource relativeResource = resource.getRelativeResource("/docs");

        assertNotNull(relativeResource);
        assertEquals("http://cayenne.apache.org/docs", relativeResource
                .getURL()
                .toExternalForm());
    }
View Full Code Here

                .findResources("org/apache/cayenne/resource/ClassLoaderResourceLocatorTest.class");

        assertNotNull(resources);
        assertEquals(1, resources.size());

        Resource resource = resources.iterator().next();
        assertNotNull(resource);

        assertNotNull(resource.getURL());
        assertTrue(resource.getURL().toExternalForm().endsWith(
                "org/apache/cayenne/resource/ClassLoaderResourceLocatorTest.class"));
    }
View Full Code Here

TOP

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