Package org.apache.ojb.broker.metadata

Examples of org.apache.ojb.broker.metadata.RepositoryPersistor


     * @throws Exception
     */
    public void init() throws Exception
    {
        MetadataManager metaManager = MetadataManager.getInstance();
        RepositoryPersistor persistor = new RepositoryPersistor();
        URL descriptorUrl = getClass().getClassLoader().getResource(repositoryPath);

        logger.info("Merging OJB respository "+descriptorUrl+" for DAO class "+getClass().getName());
        DescriptorRepository repo = persistor.readDescriptorRepository(descriptorUrl.openStream());
        metaManager.mergeDescriptorRepository(repo);
    }
View Full Code Here


     * @throws Exception
     */
    public void init() throws Exception
    {
        MetadataManager metaManager = MetadataManager.getInstance();
        RepositoryPersistor persistor = new RepositoryPersistor();
        URL descriptorUrl = getClass().getClassLoader().getResource(repositoryPath);

        logger.info("Merging OJB respository "+descriptorUrl+" for DAO class "+getClass().getName());
        DescriptorRepository repo = persistor.readDescriptorRepository(descriptorUrl.openStream());
        metaManager.mergeDescriptorRepository(repo);
    }
View Full Code Here

                log("Using properties file "+_ojbPropertiesFile.getAbsolutePath(), Project.MSG_INFO);
                System.setProperty("OJB.properties", _ojbPropertiesFile.getAbsolutePath());
            }

            MetadataManager     metadataManager = MetadataManager.getInstance();
            RepositoryPersistor persistor       = new RepositoryPersistor();

            if (_repositoryFile != null)
            {
                if (!_repositoryFile.exists())
                {
                    throw new BuildException("Could not load the specified repository file "+_repositoryFile);
                }
                log("Loading repository file "+_repositoryFile.getAbsolutePath(), Project.MSG_INFO);

                // this will load the info from the specified repository file
                // and merge it with the existing info (if it has been loaded)
                metadataManager.mergeConnectionRepository(persistor.readConnectionRepository(_repositoryFile.getAbsolutePath()));
                metadataManager.mergeDescriptorRepository(persistor.readDescriptorRepository(_repositoryFile.getAbsolutePath()));
            }
            else if (metadataManager.connectionRepository().getAllDescriptor().isEmpty() &&
                     metadataManager.getGlobalRepository().getDescriptorTable().isEmpty())
            {
                // Seems nothing was loaded, probably because we're not starting in the directory
                // that the properties file is in, and the repository file path is relative
                // So lets try to resolve this path and load the repository info manually
                Properties props = new Properties();

                props.load(new FileInputStream(_ojbPropertiesFile));
   
                String repositoryPath = props.getProperty("repositoryFile", "repository.xml");
                File   repositoryFile = new File(repositoryPath);
   
                if (!repositoryFile.exists())
                {
                    repositoryFile = new File(_ojbPropertiesFile.getParentFile(), repositoryPath);
                }
                metadataManager.mergeConnectionRepository(persistor.readConnectionRepository(repositoryFile.getAbsolutePath()));
                metadataManager.mergeDescriptorRepository(persistor.readDescriptorRepository(repositoryFile.getAbsolutePath()));
            }
            // we might have to determine the default pb key ourselves
            if (metadataManager.getDefaultPBKey() == null)
            {
                for (Iterator it = metadataManager.connectionRepository().getAllDescriptor().iterator(); it.hasNext();)
View Full Code Here

            {
                public void run()
                {
                    try
                    {
                        RepositoryPersistor persistor = new RepositoryPersistor ();
                        DescriptorRepository repository = persistor.readDescriptorRepository(selectedFile.getCanonicalPath());
                        JIFrmOJBRepository frm = new JIFrmOJBRepository(repository);
                        containingFrame.getContentPane().add(frm);
                        frm.setVisible(true);
                    }
                    catch (Throwable t)
View Full Code Here

    private TorqueTablePreprocessor tablePreprocessor;
    private TorqueTableGenerator tableGenerator;

    public TorqueRepositoryGenerator(String xmlInputFile, boolean ignoreAutoIncrement) throws Exception
    {
        RepositoryPersistor persistor = new RepositoryPersistor();
        DescriptorRepository repository = persistor.readDescriptorRepository(xmlInputFile);

        this.tablePreprocessor = new TorqueTablePreprocessor(repository);
        this.tablePreprocessor.buildStandardTables();
        this.tableGenerator = new TorqueTableGenerator(repository, ignoreAutoIncrement);
    }
View Full Code Here

    private TorqueTablePreprocessor tablePreprocessor;
    private TorqueTableGenerator tableGenerator;

    public TorqueRepositoryGenerator(String xmlInputFile, boolean ignoreAutoIncrement) throws Exception
    {
        RepositoryPersistor persistor = new RepositoryPersistor();
        DescriptorRepository repository = persistor.readDescriptorRepository(xmlInputFile);

        this.tablePreprocessor = new TorqueTablePreprocessor(repository);
        this.tablePreprocessor.buildStandardTables();
        this.tableGenerator = new TorqueTableGenerator(repository, ignoreAutoIncrement);
    }
View Full Code Here

    public TorqueRepositoryGeneratorTest(String name) {
        super(name);
    }

    public void setUp() throws Exception {
        RepositoryPersistor repositoryPersistor = new RepositoryPersistor();
        this.repository = repositoryPersistor.readDescriptorRepository(INPUT_FILE);
        this.torqueRepositoryGenerator = new TorqueRepositoryGenerator(INPUT_FILE, false);
    }
View Full Code Here

    public TorqueTablePreprocessorTest(String name) {
        super(name);
    }

    public void setUp() throws Exception {
        RepositoryPersistor repositoryPersistor = new RepositoryPersistor();
        DescriptorRepository descriptorRepository = repositoryPersistor.readDescriptorRepository(EXAMPLE_FILE);
        this.torqueTablePreprocessor = new TorqueTablePreprocessor(descriptorRepository);
    }
View Full Code Here

    public TorqueForeignKeyGeneratorTest(String name) {
        super(name);
    }

    public void setUp() throws Exception {
        RepositoryPersistor repositoryPersistor = new RepositoryPersistor();
        DescriptorRepository descriptorRepository = repositoryPersistor.readDescriptorRepository(EXAMPLE_FILE);
        this.foreignKeyGenerator = new TorqueForeignKeyGenerator(descriptorRepository);
    }
View Full Code Here

    public TorqueTableGeneratorTest(String name) {
        super(name);
    }

    public void setUp() throws Exception {
        RepositoryPersistor repositoryPersistor = new RepositoryPersistor();
        this.repository = repositoryPersistor.readDescriptorRepository(EXAMPLE_FILE);
        this.torqueTableGenerator = new TorqueTableGenerator(this.repository, false);
    }
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.metadata.RepositoryPersistor

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.