Package org.apache.openjpa.meta

Examples of org.apache.openjpa.meta.MetaDataRepository


      Class<?> cls = meta.getDescribedType();
      Class<?> sup = cls.getSuperclass();
      if (sup == null || "java.lang.Object".equals(
          sup.getName()))
        return null;
      MetaDataRepository repos = meta.getRepository();
      ClassMetaData supMeta = repos.getCachedMetaData(sup);
      if (supMeta == null)
        supMeta = repos.getMetaData(sup, null, false);
      return supMeta;
    }
View Full Code Here


     */
    private void evictTypes(Collection<Class<?>> classes) {
        if (classes.isEmpty())
            return;

        MetaDataRepository mdr = _ctx.getConfiguration().getMetaDataRepositoryInstance();
        ClassLoader loader = _ctx.getClassLoader();

        DataCache cache;
        for (Class<?> cls : classes) {
            cache = mdr.getMetaData(cls, loader, false).getDataCache();
            if (cache != null && cache.getEvictOnBulkUpdate())
                cache.removeAll(cls, false);
        }
    }
View Full Code Here

        if (oids.isEmpty())
            return classes;
        if (classes == null)
            classes = new HashSet();

        MetaDataRepository repos = conf.getMetaDataRepositoryInstance();
        ClassMetaData meta;
        Object oid;
        for (Iterator itr = oids.iterator(); itr.hasNext();) {
            oid = itr.next();
            if (oid instanceof Id)
                classes.add(((Id) oid).getType());
            else {
                // ok if no metadata for oid; that just means the pc type
                // probably hasn't been loaded into this JVM yet, and therefore
                // there's no chance that it's in the cache anyway
                meta = repos.getMetaData(oid, null, false);
                if (meta != null)
                    classes.add(meta.getDescribedType());
            }
        }
        return classes;
View Full Code Here

        // Check for @DataCache annotations
        return meta.getDataCacheName() != null;
    }

    public void startCaching(String cls) {
        MetaDataRepository mdr = _conf.getMetaDataRepositoryInstance();
        ClassMetaData cmd = mdr.getCachedMetaData(cls);
        _cacheable.put(cmd, Boolean.TRUE);
    }
View Full Code Here

        ClassMetaData cmd = mdr.getCachedMetaData(cls);
        _cacheable.put(cmd, Boolean.TRUE);
    }

    public void stopCaching(String cls) {
        MetaDataRepository mdr = _conf.getMetaDataRepositoryInstance();
        ClassMetaData cmd = mdr.getCachedMetaData(cls);
        _cacheable.put(cmd, Boolean.FALSE);
    }
View Full Code Here

        return _factory.getSupportedProperties();
    }

    public MetamodelImpl getMetamodel() {
        if (_metaModel == null) {
            MetaDataRepository mdr = getConfiguration().getMetaDataRepositoryInstance();
            mdr.setValidate(MetaDataRepository.VALIDATE_RUNTIME, true);
            mdr.setResolve(MetaDataRepository.MODE_MAPPING_INIT, true);
            _metaModel = new MetamodelImpl(mdr);
        }
        return _metaModel;
    }
View Full Code Here

     * Returns the repository for this parser. If none has been set,
     * create a new repository and sets it.
     */
    public MetaDataRepository getRepository() {
        if (_repos == null) {
            MetaDataRepository repos = _conf.newMetaDataRepositoryInstance();
            MetaDataFactory mdf = repos.getMetaDataFactory();
            if (mdf instanceof DelegatingMetaDataFactory)
                mdf = ((DelegatingMetaDataFactory) mdf).getInnermostDelegate();
            if (mdf instanceof PersistenceMetaDataFactory)
                ((PersistenceMetaDataFactory) mdf).setAnnotationParser(this);
            _repos = repos;
View Full Code Here

            // setup transient state
            setup();

            // register the metdata repository to auto-load persistent types
            // and make sure types are enhanced
            MetaDataRepository repos = _conf.getMetaDataRepositoryInstance();
            repos.setValidate(MetaDataRepository.VALIDATE_RUNTIME, true);
            repos.setResolve(MetaDataModes.MODE_MAPPING_INIT, true);
            PCRegistry.addRegisterClassListener(repos);

            // freeze underlying configuration and eagerly initialize to
            // avoid synchronization
            _conf.setReadOnly(Configuration.INIT_STATE_FREEZING);
View Full Code Here

        // Don't get a MetaDataRepository yet if not preloading because it is possible that someone has extended the MDR
        // and the extension hasn't been plugged in yet.
        if (MetaDataRepository.needsPreload(_conf) == true) {
            // Don't catch any exceptions here because we want to fail-fast if something bad happens when we're
            // preloading.
            MetaDataRepository mdr = _conf.getMetaDataRepositoryInstance();
            mdr.setValidate(MetaDataRepository.VALIDATE_RUNTIME, true);
            mdr.setResolve(MetaDataRepository.MODE_MAPPING_INIT, true);

            // Load persistent classes and hook in subclasser
            loadPersistentTypes((ClassLoader) AccessController.doPrivileged(J2DoPrivHelper
                .getContextClassLoaderAction()));
            mdr.preload();
        }

        // Get a DataCacheManager instance up front to avoid threading concerns on first call.
        // _conf.getDataCacheManagerInstance();
View Full Code Here

            // cached instance?
            StateManagerImpl sm = null;
            if (!copy.isEmbedded())
                sm = getStateManagerImplById(oid, true);
            if (sm == null) {
                MetaDataRepository repos = _conf.
                    getMetaDataRepositoryInstance();
                ClassMetaData meta = repos.getMetaData(type, _loader, true);
                // construct a new state manager with all info known
                sm = newStateManagerImpl(oid, meta);
                sm.setObjectId(oid);
                sm.initialize(sm.getMetaData().getDescribedType(), state);
            }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.meta.MetaDataRepository

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.