Package org.apache.openjpa.meta

Examples of org.apache.openjpa.meta.MetaDataRepository$CMDDependencyNode


     * 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


     */
    private void evictTypes(Collection classes) {
        if (classes.isEmpty())
            return;

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

        Class cls;
        DataCache cache;
        for (Iterator itr = classes.iterator(); itr.hasNext();) {
            cls = (Class) itr.next();
            cache = mdr.getMetaData(cls, loader, false).getDataCache();
            if (cache != null)
                cache.removeAll(cls, false);
        }
    }
View Full Code Here

                return sm;
        }

        // find metadata for the oid
        Class pcType = _store.getManagedType(oid);
        MetaDataRepository repos = _conf.getMetaDataRepositoryInstance();
        ClassMetaData meta;
        if (pcType != null)
            meta = repos.getMetaData(pcType, _loader, true);
        else
            meta = repos.getMetaData(oid, _loader, true);

        // copy the oid if needed
        if (copy && _compat.getCopyObjectIds()) {
            if (meta.getIdentityType() == ClassMetaData.ID_APPLICATION)
                oid = ApplicationIds.copy(oid, meta);
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 = new StateManagerImpl(oid, meta, this);
                sm.setObjectId(oid);
                sm.initialize(sm.getMetaData().getDescribedType(), state);
            }
View Full Code Here

     * Return a query executor of the proper type.
     */
    private StoreQuery.Executor createExecutor(boolean inMem) {
        assertCandidateType();

        MetaDataRepository repos = _broker.getConfiguration().
            getMetaDataRepositoryInstance();
        ClassMetaData meta = repos.getMetaData(_class,
            _broker.getClassLoader(), false);

        ClassMetaData[] metas;
        if (_class == null || _storeQuery.supportsAbstractExecutors())
            metas = new ClassMetaData[]{ meta };
        else if (_subclasses && (meta == null || meta.isManagedInterface()))
            metas = repos.getImplementorMetaDatas(_class,
                _broker.getClassLoader(), true);
        else if (meta != null && (_subclasses || meta.isMapped()))
            metas = new ClassMetaData[]{ meta };
        else
            metas = StoreQuery.EMPTY_METAS;
View Full Code Here

        return getClassMetaData(schemaName, true);
    }

    private ClassMetaData getClassMetaData(String alias, boolean assertValid) {
        ClassLoader loader = getClassLoader();
        MetaDataRepository repos = resolver.getConfiguration().
            getMetaDataRepositoryInstance();

        // first check for the alias
        ClassMetaData cmd = repos.getMetaData(alias, loader, false);

        if (cmd != null)
            return cmd;

        // now check for the class name; this is not technically permitted
        // by the JPA spec, but is required in order to be able to execute
        // JPQL queries from other facades (like JDO) that do not have
        // the concept of entity names or aliases
        Class c = resolver.classForName(alias, null);
        if (c != null)
            cmd = repos.getMetaData(c, loader, assertValid);
        else if (assertValid)
            cmd = repos.getMetaData(alias, loader, true);

        if (cmd == null && assertValid)
            throw parseException(EX_USER, "not-schema-name",
                new Object[]{ alias }, null);
View Full Code Here

            boolean trans = !_ignore && _broker.isActive();
            if (trans)
                chain.addIterator(new FilterNewIterator());

            // add database iterators for each implementing class
            MetaDataRepository repos = _broker.getConfiguration().
                getMetaDataRepositoryInstance();
            ClassMetaData meta = repos.getMetaData(_type,
                _broker.getClassLoader(), false);

            ClassMetaData[] metas;
            if (meta != null && (!_subs || !meta.isManagedInterface())
                && (meta.isMapped() || (_subs
                && meta.getMappedPCSubclassMetaDatas().length > 0)))
                metas = new ClassMetaData[]{ meta };
            else if (_subs && (meta == null || meta.isManagedInterface()))
                metas = repos.getImplementorMetaDatas(_type,
                    _broker.getClassLoader(), false);
            else
                metas = EMPTY_METAS;

            ResultObjectProvider rop;
View Full Code Here

     * Returns the repository for this parser. If none has been set, creates
     * 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).setXMLParser(this);
            _repos = repos;
View Full Code Here

        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

        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

TOP

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

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.