Package org.apache.ojb.broker.metadata

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


    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


        if (_fkInfo != null)
        {
            return;
        }

        DescriptorRepository repos = broker.getDescriptorRepository();
        _fkInfo = new HashMap();
        for (Iterator it = repos.iterator(); it.hasNext();)
        {
            ClassDescriptor desc = (ClassDescriptor) it.next();
            List ordList = desc.getObjectReferenceDescriptors();
            if (!ordList.isEmpty())
            {
                HashSet fkTables = getFKTablesFor(desc.getFullTableName());
                for (Iterator it2 = ordList.iterator(); it2.hasNext();)
                {
                    ObjectReferenceDescriptor ord = (ObjectReferenceDescriptor) it2.next();
                    ClassDescriptor oneDesc = repos.getDescriptorFor(ord.getItemClass());
                    fkTables.addAll(getFullTableNames(oneDesc, repos));
                }
            }

            List codList = desc.getCollectionDescriptors();
            for (Iterator it2 = codList.iterator(); it2.hasNext();)
            {
                CollectionDescriptor cod = (CollectionDescriptor) it2.next();
                ClassDescriptor manyDesc = repos.getDescriptorFor(cod.getItemClass());
                if (cod.isMtoNRelation())
                {
                    HashSet fkTables = getFKTablesFor(cod.getIndirectionTable());
                    fkTables.addAll(getFullTableNames(desc, repos));
                    fkTables.addAll(getFullTableNames(manyDesc, repos));
View Full Code Here

        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

        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

        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

     */
    private void insertOrDeleteMtoNImplementor(MtoNImplementor m2nImpl, boolean insert)
      throws PersistenceBrokerException
    {
        //look for a collection descriptor on left  such as left.element-class-ref='right'
        DescriptorRepository dr = pb.getDescriptorRepository();

        Object leftObject = m2nImpl.getLeftObject();
        Class leftClass = leftObject.getClass();
        Object rightObject = m2nImpl.getRightObject();
        Class rightClass = rightObject.getClass();

        //
        //are written per class, maybe referencing abstract classes or interfaces
        //so let's look for collection descriptors on the left class and try to handle extents on teh right class
        ClassDescriptor leftCld = dr.getDescriptorFor(leftClass);
        ClassDescriptor rightCld = dr.getDescriptorFor(rightClass);
        Vector leftColds = leftCld.getCollectionDescriptors();
        CollectionDescriptor wanted = findCollectionDescriptor(leftClass, rightClass, leftColds);

        if(leftObject == null || rightObject == null)
        {
View Full Code Here

      itemClasses = new ArrayList();
      itemClasses.add(ord.getItemClass());
    }

    List classDescriptors = new ArrayList(itemClasses.size());
    DescriptorRepository repo = ord.getClassDescriptor().getRepository();

    for (Iterator iter = itemClasses.iterator(); iter.hasNext();)
    {
      Class clazz = (Class) iter.next();
      classDescriptors.add(repo.getDescriptorFor(clazz));
    }

    return (ClassDescriptor) classDescriptors.get(0);
  }
View Full Code Here

        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

        System.out.println("time to build one HashMaps " + ((stop - start) / ITERATIONS) + " ms.");
    }
    public void testDescriptorRepositoryGetDescriptorForIterations()
    {
        long start = System.currentTimeMillis();
        DescriptorRepository descriptorRepository = MetadataManager.getInstance().getRepository();
        for (int i = 0; i < ITERATIONS; i++)
        {
            descriptorRepository.getDescriptorFor(Article.class);
        }
        long stop = System.currentTimeMillis();
        System.out.println("total time to getDescriptorFor " + ITERATIONS + " times " + (stop - start) + " ms.");
        System.out.println("time to call one getDescriptorFor " + ((stop - start) / ITERATIONS) + " ms.");
    }
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

TOP

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

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.