Examples of MetadataRepository


Examples of org.apache.openjpa.meta.MetaDataRepository

        Log log = getLog();
        if (log.isTraceEnabled())
            log.trace(_loc.get("parse-class", _cls.getName()));

        MetaDataRepository repos = getRepository();
        ClassMetaData meta = repos.getCachedMetaData(_cls);
        if (meta != null
            && ((isMetaDataMode() && (meta.getSourceMode() & MODE_META) != 0)
            || (isMappingMode() && (meta.getSourceMode() & MODE_MAPPING) != 0)))
        {
            if(isDuplicateClass(meta)) {
                if (log.isWarnEnabled()) {
                    log.warn(_loc.get("dup-metadata", _cls, getSourceName()));
                }
                if(log.isTraceEnabled()) {
                    log.trace(String.format(
                        "MetaData originally obtained from source: %s under mode: %d with scope: %s, and type: %d",
                        meta.getSourceName(), meta.getSourceMode(), meta.getSourceScope(), meta.getSourceType()));
                }
            }
            _cls = null;
            return false;
        }
       
        int access = AccessCode.UNKNOWN;
        if (meta == null) {
            int accessCode = toAccessType(attrs.getValue("access"));
            // if access not specified and access was specified at
            // the system level, use the system default (which may
            // be UNKNOWN)
            if (accessCode == AccessCode.UNKNOWN)
                accessCode = _access;
            meta = repos.addMetaData(_cls, accessCode, metaDataComplete);
            FieldMetaData[] fmds = meta.getFields();
            if (metaDataComplete) {
                for (int i = 0; i < fmds.length; i++) {
                    fmds[i].setExplicit(true);
                }
View Full Code Here

Examples of org.apache.openjpa.meta.MetaDataRepository

        return lineNum;
    }
   
    private boolean startDatastoreId(Attributes attrs)
            throws SAXException {
        MetaDataRepository repos = getRepository();
        ClassMetaData meta = repos.getCachedMetaData(_cls);
       
        //Set default value if not specified
        String strategy = attrs.getValue("strategy");
        if (StringUtils.isEmpty(strategy)) {
            strategy ="AUTO"    ;
View Full Code Here

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

Examples of org.apache.openjpa.meta.MetaDataRepository

     */
    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

Examples of org.apache.openjpa.meta.MetaDataRepository

        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

Examples of org.apache.openjpa.meta.MetaDataRepository

        // 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

Examples of org.apache.openjpa.meta.MetaDataRepository

        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

Examples of org.apache.openjpa.meta.MetaDataRepository

        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

Examples of org.apache.openjpa.meta.MetaDataRepository

     * 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

Examples of org.apache.openjpa.meta.MetaDataRepository

            // 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
TOP
Copyright © 2018 www.massapi.com. 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.