Package org.apache.xindice.core.meta

Examples of org.apache.xindice.core.meta.MetaData


                throw new DBException(FaultCodes.GEN_UNKNOWN,
                                      "Mismatch type of meta data for collection " + getCanonicalName());
            }

            MetaSystemCollection metacol = getMetaSystemCollection();
            MetaData current = metacol.getCollectionMeta(this);
            current.copyDataFrom(meta);
            metacol.setCollectionMeta(this, current);
        }
    }
View Full Code Here


            if (log.isInfoEnabled()) {
                log.info(debugHeader() + "Set document meta " + id);
            }
            MetaSystemCollection metacol = getMetaSystemCollection();
            MetaData current = metacol.getDocumentMeta(this, id);
            current.copyDataFrom(meta);
            metacol.setDocumentMeta(this, id, current);
        }
    }
View Full Code Here

     */
    protected void updateCollectionMeta() {
        // update the meta data if necessary
        if (isMetaEnabled()) {
            MetaSystemCollection metacol = getMetaSystemCollection();
            MetaData meta = null;
            try {
                meta = metacol.getCollectionMeta(this);
            } catch (DBException e) {
                // something strange has happened.. can't get the
                // meta data for this collection
                if (log.isWarnEnabled()) {
                    log.warn("Error fetching meta for collection '" + getCanonicalName() + "'", e);
                }
                return;
            }

            if (log.isTraceEnabled()) {
                log.trace(debugHeader() + "Updating modified time for collection");
            }
            long now = System.currentTimeMillis();
            if (null == meta) {
                meta = new MetaData(MetaData.COLLECTION, getCanonicalName(), now, now);
            } else if (!meta.hasContext()) {
                // Newly created meta. Update its created and modified time.
                meta.setContext(now, now);
            } else {
                // This collection already has a meta. So update its modified time.
                meta.setContext(0, now);
            }

            try {
                metacol.setCollectionMeta(this, meta);
            } catch (DBException e) {
View Full Code Here

            throw new DBException(FaultCodes.COL_DOCUMENT_NOT_FOUND,
                                  "Resource '" + id + "' does not exist in '" + getCanonicalName() + "'");
        }

        MetaSystemCollection metacol = getMetaSystemCollection();
        MetaData meta = metacol.getDocumentMeta(this, id);
        String path = getCanonicalDocumentName(id);

        /*
        TimeRecord rec = null;
        if( null == meta || !meta.hasContext() )
           rec = getDatabase().getTime(path);

        long created = (null != rec) ? rec.getCreatedTime() : System.currentTimeMillis();
        long modified = (null != rec) ? rec.getModifiedTime() : System.currentTimeMillis();
        */

        // this is wrong.. but it should work for now...
        if (log.isTraceEnabled()) {
            log.trace(debugHeader() + "Updating modified time for document '" + id + "'");
        }
        long now = System.currentTimeMillis();
        if (null == meta) {
            meta = new MetaData(MetaData.DOCUMENT, path, now, now);
        } else if (!meta.hasContext()) {
            meta.setContext(now, now);
        } else {
            meta.setContext(0, now);
        }
        metacol.setDocumentMeta(this, id, meta);
    }
View Full Code Here

     */
    public MetaData getCollectionMeta(Collection collection) throws DBException {
        Collection mcol = getMetaCollection(collection, true);

        if (null != mcol) {
            MetaData meta = (MetaData) mcol.getObject(COLLECTION_META_DATA);
            if (meta == null) {
                meta = new MetaData();
            }

            if (meta.getType() == MetaData.UNKNOWN) {
                meta.setType(MetaData.COLLECTION);
            }
            meta.setOwner(collection.getCanonicalName());
            meta.setDirty(false);
            return meta;
        }
        return null;
    }
View Full Code Here

     * @return The requested MetaData
     */
    public MetaData getDocumentMeta(Collection collection, String id) throws DBException {
        Collection mcol = getMetaCollection(collection, true);
        if (null != mcol) {
            MetaData meta = (MetaData) mcol.getObject(id);

            if (meta == null) {
                meta = new MetaData();
            }

            if (meta.getType() == MetaData.UNKNOWN) {
                meta.setType(MetaData.DOCUMENT);
            }
            meta.setOwner(collection.getCanonicalName() + "/" + id);
            meta.setDirty(false);
            return meta;
        }
        return null;
    }
View Full Code Here

            }
            params.put(RPCDefaultMessage.COMPRESSED, "true");

            Object result = runRemoteCommand(id == null ? "GetCollectionMeta" : "GetDocumentMeta", params);
            Document metaDoc = DOMParser.toDocument(result.toString());
            MetaData meta = new MetaData(id);
            meta.streamFromXML(metaDoc.getDocumentElement(), true);
            return meta;
        } catch (Exception e) {
            throw FaultCodes.createXMLDBException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.xindice.core.meta.MetaData

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.