Package org.apache.xindice.core.meta

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


        Map result = new HashMap(3);
        if (!col.isMetaEnabled()) {
            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }
        MetaData meta = col.getCollectionMeta();
        Document doc = new DocumentImpl();
        doc.appendChild(meta.streamToXML(doc, true));

        result.put(RESULT, TextWriter.toString(doc));
        return result;
    }
View Full Code Here


        return null;
    }

    public PartialResponse.Content getProperty(Collection col) {
        try {
            MetaData meta = col.getCollectionMeta();
            if (meta == null) {
                return null;
            }

            long date = meta.getLastModifiedTime();
            if (date != 0) {
                SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT, Locale.US);
                sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
                return new PartialResponse.Content(MODIFICATION_TIME, sdf.format(new Date(date)));
            }
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

        return null;
    }

    public PartialResponse.Content getProperty(Collection col) {
        try {
            MetaData meta = col.getCollectionMeta();
            long date = meta.getCreatedTime();
            if (date != 0) {
                SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT, Locale.US);
                sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
                return new PartialResponse.Content(CREATION_TIME, sdf.format(new Date(date)));
            }
View Full Code Here

            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }

        // Read and store sent meta data
        MetaData meta = new MetaData();
        Document doc = DOMParser.toDocument((String) message.get(META));
        meta.streamFromXML(doc.getDocumentElement());
        col.setCollectionMeta(meta);

        // Retreive stored meta data and sent back
        meta = col.getCollectionMeta();
        doc = new DocumentImpl();
        doc.appendChild(meta.streamToXML(doc, true));
        result.put(RESULT, TextWriter.toString(doc));
        return result;
    }
View Full Code Here

            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }

        // Read and store sent meta data
        MetaData meta = new MetaData();
        Document doc = DOMParser.toDocument((String) message.get(META));
        meta.streamFromXML(doc.getDocumentElement());
        col.setDocumentMeta(docname, meta);

        // Retreive stored meta data and sent back
        meta = col.getDocumentMeta(docname);
        doc = new DocumentImpl();
        meta.streamToXML(doc, true);
        result.put(RESULT, TextWriter.toString(doc));
        return result;
    }
View Full Code Here

        Hashtable result = new Hashtable();
        if (!col.isMetaEnabled()) {
            // meta information is not enabled !
            throw new Exception(MISSING_META_CONFIGURATION);
        }
        MetaData meta = col.getCollectionMeta();
        Document doc = new DocumentImpl();
        doc.appendChild(meta.streamToXML(doc, true));

        result.put(RESULT, TextWriter.toString(doc));
        return result;
    }
View Full Code Here

            }
            return null;
        }

        MetaSystemCollection metacol = getMetaSystemCollection();
        MetaData meta = metacol.getCollectionMeta(this);
        if (null == meta) {
            long now = System.currentTimeMillis();
            meta = new MetaData(MetaData.COLLECTION, getCanonicalName(), now, now);
            metacol.setCollectionMeta(this, meta);
        }

        return meta;
    }
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);

        /*
        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...
        long now = System.currentTimeMillis();
        if (null == meta) {
            meta = new MetaData(MetaData.DOCUMENT, getCanonicalDocumentName(id), now, now);
            metacol.setDocumentMeta(this, id, meta);
        } else if (!meta.hasContext()) {
            meta.setContext(now, now);
        }

        return meta;
    }
View Full Code Here

        if (!message.containsKey(NAME)) {
            throw new Exception(MISSING_NAME_PARAM);
        }
        String docname = (String) message.get(NAME);
        MetaData meta = col.getDocumentMeta(docname);
        Document doc = new DocumentImpl();
        doc.appendChild(meta.streamToXML(doc, true));

        result.put(RESULT, TextWriter.toString(doc));
        return result;
    }
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.