Package org.apache.cayenne.resource

Examples of org.apache.cayenne.resource.Resource


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

        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, will use the first one: "
                    + configurationResource.getURL());
        }

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


            }
            else {
                newMap.setName(NamedObjectFactory.createName(DataMap.class, domain));
            }
           
            Resource baseResource = domain.getConfigurationSource();

            if (baseResource != null) {
                Resource dataMapResource = baseResource.getRelativeResource(newMap.getName());
                newMap.setConfigurationSource(dataMapResource);
            }

            getProjectController().addDataMap(this, newMap);
        }
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

        if (baseResource == null) {
            baseResource = unit.sourceConfiguration;
        }

        String targetLocation = nameMapper.configurationLocation(node);
        Resource targetResource = baseResource.getRelativeResource(targetLocation);

        // attempt to convert targetResource to a File... if that fails,
        // FileProjectSaver is not appropriate for handling a given project..

        URL targetUrl = targetResource.getURL();

        try {
            unit.targetFile = Util.toFile(targetUrl);
        }
        catch (IllegalArgumentException e) {
View Full Code Here

                DataMap.class,
                currentDomain,
                currentDomain.getName() + "Map");

        // set configuration source for new dataMap
        Resource baseResource = currentDomain.getConfigurationSource();

        if (baseResource != null) {
            Resource dataMapResource = baseResource.getRelativeResource(map.getName());

            map.setConfigurationSource(dataMapResource);
        }

        createDataMap(map);
View Full Code Here

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

        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, will use the first one: "
                    + configurationResource.getURL());
        }

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

    public void storeSQLAction() {
        JFileChooser fc = new JFileChooser();
        fc.setDialogType(JFileChooser.SAVE_DIALOG);
        fc.setDialogTitle("Save SQL Script");

        Resource projectDir = getApplication().getProject().getConfigurationResource();

        if (projectDir != null) {
            fc.setCurrentDirectory(new File(projectDir.getURL().getPath()));
        }

        if (fc.showSaveDialog(getView()) == JFileChooser.APPROVE_OPTION) {
            refreshGeneratorAction();
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

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

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

                String dataMapLocation = attributes.getValue("", "location");
                Resource dataMapResource = baseResource
                        .getRelativeResource(dataMapLocation);

                DataMap dataMap = mapLoader.load(dataMapResource);
                dataMap.setName(dataMapName);
                dataMap.setLocation(dataMapLocation);
                dataMap.setConfigurationSource(dataMapResource);

                descriptor.getDataMaps().add(dataMap);
            }
            else if (localName.equals(NODE_TAG)) {

                String nodeName = attributes.getValue("", "name");
                if (nodeName == null) {
                    // TODO: assign dummy name?
                    throw new ConfigurationException("Error: <node> without 'name'.");
                }

                DataNodeDescriptor nodeDescriptor = new DataNodeDescriptor();
                nodeDescriptor.setName(nodeName);

                String dataSourceFactory = attributes.getValue("", "factory");
                String dataSourceFactory6 = convertDataSourceFactory(dataSourceFactory);
                nodeDescriptor.setDataSourceFactoryType(dataSourceFactory6);

                // depending on the factory, "datasource" attribute is interpreted
                // differently
                String datasource = attributes.getValue("", "datasource");
                if (XMLPoolingDataSourceFactory.class
                        .getName()
                        .equals(dataSourceFactory6)) {
                    Resource baseResource = descriptor.getConfigurationSource();
                    Resource dataNodeResource = baseResource
                            .getRelativeResource(datasource);
                    nodeDescriptor.setConfigurationSource(dataNodeResource);

                    DataSourceInfo dataSourceInfo = dataSourceInfoLoader
                            .load(dataNodeResource);
View Full Code Here

    public void storeSQLAction() {
        JFileChooser fc = new JFileChooser();
        fc.setDialogType(JFileChooser.SAVE_DIALOG);
        fc.setDialogTitle("Save SQL Script");

        Resource projectDir = getApplication().getProject().getConfigurationResource();

        if (projectDir != null) {
            fc.setCurrentDirectory(new File(projectDir.getURL().getPath()));
        }

        if (fc.showSaveDialog(getView()) == JFileChooser.APPROVE_OPTION) {
            refreshGeneratorAction();
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.