Package org.apache.jackrabbit.core.data

Examples of org.apache.jackrabbit.core.data.DataIdentifier


    @Override
    public List<DataIdentifier> deleteAllOlderThan(final long min) {
        log("deleteAllOlderThan " + min);
        List<DataIdentifier> tobeDeleted = new ArrayList<DataIdentifier>();
        for (Map.Entry<DataIdentifier, Long> entry : timeMap.entrySet()) {
            DataIdentifier identifier = entry.getKey();
            long timestamp = entry.getValue();
            if (timestamp < min) {
                tobeDeleted.add(identifier);
            }
        }
View Full Code Here


                KEY_PREFIX);
            while (true) {
                for (S3ObjectSummary s3ObjSumm : prevObjectListing.getObjectSummaries()) {
                    String id = getIdentifierName(s3ObjSumm.getKey());
                    if (id != null) {
                        ids.add(new DataIdentifier(id));
                    }
                }
                if (!prevObjectListing.isTruncated()) {
                    break;
                }
View Full Code Here

        List<DataIdentifier> diDeleteList = new ArrayList<DataIdentifier>(30);
        ObjectListing prevObjectListing = s3service.listObjects(bucket);
        while (true) {
            List<DeleteObjectsRequest.KeyVersion> deleteList = new ArrayList<DeleteObjectsRequest.KeyVersion>();
            for (S3ObjectSummary s3ObjSumm : prevObjectListing.getObjectSummaries()) {
                DataIdentifier identifier = new DataIdentifier(
                    getIdentifierName(s3ObjSumm.getKey()));
                if (!store.inUse.containsKey(identifier)
                    && s3ObjSumm.getLastModified().getTime() < min) {
                    LOG.info("add id :" + s3ObjSumm.getKey()
                        + " to delete lists");
                    deleteList.add(new DeleteObjectsRequest.KeyVersion(
                        s3ObjSumm.getKey()));
                    diDeleteList.add(new DataIdentifier(
                        getIdentifierName(s3ObjSumm.getKey())));
                }
            }
            if (deleteList.size() > 0) {
                DeleteObjectsRequest delObjsReq = new DeleteObjectsRequest(
View Full Code Here

            }
            // UPDATE DATASTORE SET DATA=? WHERE ID=?
            conn.executeStmt(updateDataSQL, new Object[]{wrapper, tempId});
            now = System.currentTimeMillis();
            long length = in.getPosition();
            DataIdentifier identifier = new DataIdentifier(digest.digest());
            usesIdentifier(identifier);
            id = identifier.toString();
            // UPDATE DATASTORE SET ID=?, LENGTH=?, LAST_MODIFIED=?
            // WHERE ID=?
            // AND NOT EXISTS(SELECT ID FROM DATASTORE WHERE ID=?)
            PreparedStatement prep = conn.executeStmt(updateSQL, new Object[]{
                    id, new Long(length), new Long(now),
View Full Code Here

    public synchronized int deleteAllOlderThan(long min) throws DataStoreException {
        ConnectionRecoveryManager conn = getConnection();
        try {
            Iterator it = new ArrayList(inUse.keySet()).iterator();
            while (it.hasNext()) {
                DataIdentifier identifier = (DataIdentifier) it.next();
                if (identifier != null) {
                    touch(identifier, 0);
                }
            }
            // DELETE FROM DATASTORE WHERE LAST_MODIFIED<?
View Full Code Here

            PreparedStatement prep = conn.executeStmt(selectAllSQL, new Object[0]);
            rs = prep.getResultSet();
            while (rs.next()) {
                String id = rs.getString(1);
                if (!id.startsWith(TEMP_PREFIX)) {
                    DataIdentifier identifier = new DataIdentifier(id);
                    list.add(identifier);
                }
            }
            return list.iterator();
        } catch (Exception e) {
View Full Code Here

        return buff.toString();
    }  
   
    static BLOBInDataStore getInstance(DataStore store, String s) {
        String id = s.substring(PREFIX.length());
        DataIdentifier identifier = new DataIdentifier(id);
        return new BLOBInDataStore(store, identifier);
    }
View Full Code Here

        return new BLOBInDataStore(store, identifier);
    }
   
    static BLOBInDataStore getInstance(DataStore store, InputStream in) throws DataStoreException {
        DataRecord rec = store.addRecord(in);
        DataIdentifier identifier = rec.getIdentifier();
        return new BLOBInDataStore(store, identifier);
    }   
View Full Code Here

    @Override
    public DataRecord addRecord(InputStream input) throws DataStoreException {
        File temporary = null;
        try {
            temporary = newTemporaryFile();
            DataIdentifier tempId = new DataIdentifier(temporary.getName());
            usesIdentifier(tempId);
            // Copy the stream to the temporary file and calculate the
            // stream length and the message digest of the stream
            MessageDigest digest = MessageDigest.getInstance(DIGEST);
            OutputStream output = new DigestOutputStream(new FileOutputStream(
                temporary), digest);
            try {
                IOUtils.copyLarge(input, output);
            } finally {
                output.close();
            }
            DataIdentifier identifier = new DataIdentifier(
                encodeHexString(digest.digest()));
            synchronized (this) {
                usesIdentifier(identifier);
                backend.write(identifier, temporary);
                String fileName = getFileName(identifier);
View Full Code Here

     * Upload file from {@link LocalCache} to {@link Backend}.
     * @param f file to uploaded.
     * @throws DataStoreException
     */
    private void loadFileToBackEnd(File f) throws DataStoreException {
        DataIdentifier identifier = new DataIdentifier(f.getName());
        usesIdentifier(identifier);
        backend.write(identifier, f);
        LOG.debug(f.getName() + "uploaded.");

    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.data.DataIdentifier

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.