Package org.apache.jackrabbit.core.persistence.pool.util

Examples of org.apache.jackrabbit.core.persistence.pool.util.TrackingInputStream


                throw new DataStoreException(msg);
            }
            temporaryInUse.add(tempId);
            MessageDigest digest = getDigest();
            DigestInputStream dIn = new DigestInputStream(stream, digest);
            TrackingInputStream in = new TrackingInputStream(dIn);
            StreamWrapper wrapper;
            if (STORE_SIZE_MINUS_ONE.equals(storeStream)) {
                wrapper = new StreamWrapper(in, -1);
            } else if (STORE_SIZE_MAX.equals(storeStream)) {
                wrapper = new StreamWrapper(in, Integer.MAX_VALUE);
            } else if (STORE_TEMP_FILE.equals(storeStream)) {
                File temp = moveToTempFile(in);
                fileInput = new TempFileInputStream(temp);
                long length = temp.length();
                wrapper = new StreamWrapper(fileInput, length);
            } else {
                throw new DataStoreException("Unsupported stream store algorithm: " + storeStream);
            }
            // UPDATE DATASTORE SET DATA=? WHERE ID=?
            conHelper.exec(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=?
View Full Code Here


        try {         
            rs = conHelper.exec(bundleSelectSQL, getKey(id), false, 0);
            if (rs.next()) {
                InputStream input = rs.getBinaryStream(1);
                try {
                    TrackingInputStream cin = new TrackingInputStream(input);
                    DataInputStream din = new DataInputStream(cin);
                    NodePropBundle bundle = binding.readBundle(din, id);
                    bundle.setSize(cin.getPosition());
                    return bundle;
                } finally {
                    input.close();
                }
            } else {
View Full Code Here

            String path = buildNodeFilePath(null, id).toString();
            if (!itemFs.exists(path)) {
                return null;
            }
            InputStream in = itemFs.getInputStream(path);
            TrackingInputStream cin = new TrackingInputStream(in);
            din = new DataInputStream(cin);
            NodePropBundle bundle = binding.readBundle(din, id);
            bundle.setSize(cin.getPosition());
            return bundle;
        } catch (Exception e) {
            String msg = "failed to read bundle: " + id + ": " + e;
            log.error(msg);
            throw new ItemStateException(msg, e);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.persistence.pool.util.TrackingInputStream

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.