Package org.apache.ace.log

Examples of org.apache.ace.log.LogDescriptor


         * that the remote does not have. If we do not find a matching one at all, we send the complete local
         * log.
         */
        List<LogDescriptor> result = new ArrayList<LogDescriptor>();
        for (LogDescriptor s : source) {
            LogDescriptor diffs = s;
            for (LogDescriptor d : destination) {
                if ((s.getLogID() == d.getLogID()) && (s.getGatewayID().equals(d.getGatewayID()))) {
                    SortedRangeSet rangeDiff = d.getRangeSet().diffDest(s.getRangeSet());
                    if (!isEmptyRangeSet(rangeDiff)) {
                        diffs = new LogDescriptor(s.getGatewayID(), s.getLogID(), rangeDiff);
                    }
                    else {
                        diffs = null;
                    }
                }
View Full Code Here


        try {
            queryReader = new BufferedReader(new InputStreamReader(stream));

            for (String line = queryReader.readLine(); line != null; line = queryReader.readLine()) {
                try {
                    result.add(new LogDescriptor(line));
                }
                catch (IllegalArgumentException iae) {
                    throw new IOException("Could not determine highest remote event id, received malformed event range: " + line);
                }
            }
View Full Code Here

    // Handle a call to the query 'command'
    protected boolean handleQuery(String gatewayID, String logID, String filter, ServletOutputStream output) throws IOException {
        if ((gatewayID != null) && (logID != null)) {
            // gateway and log id are specified, return only the range that matches these id's
            LogDescriptor range = m_store.getDescriptor(gatewayID, Long.parseLong(logID));
            output.print(range.toRepresentation());
            return true;
        }
        else if ((gatewayID == null) && (logID == null)) {
            // no gateway or log id has been specified, return all ranges
            List<LogDescriptor> ranges = m_store.getDescriptors();
            for (LogDescriptor range : ranges) {
                output.print(range.toRepresentation() + "\n");
            }
            return true;
        }
        return false;
    }
View Full Code Here

    // Handle a call to the receive 'command'
    protected boolean handleReceive(String gatewayID, String logID, String range, String filter, ServletOutputStream output) throws IOException {
        if ((gatewayID != null) && (logID != null)) {
            // gateway and log id are specified, return only the events that are in the range that matches these id's
            if (range != null) {
                LogDescriptor storeDescriptor = m_store.getDescriptor(gatewayID, Long.parseLong(logID));
                outputRange(output, new LogDescriptor(storeDescriptor.getGatewayID(), storeDescriptor.getLogID(), new SortedRangeSet(range)));
            }
            else {
                outputRange(output, m_store.getDescriptor(gatewayID, Long.parseLong(logID)));
            }
            return true;
View Full Code Here

        Long high = m_fileToID.get(new File(new File(m_dir,
                gatewayIDToFilename(gatewayID)), String.valueOf(logID))
                .getAbsolutePath());
        if (high != null) {
            Range r = new Range(1, high);
            return new LogDescriptor(gatewayID, logID, new SortedRangeSet(
                    r.toRepresentation()));
        }
        List<LogEvent> events = get(new LogDescriptor(gatewayID, logID,
                SortedRangeSet.FULL_SET));

        long[] idsArray = new long[events.size()];
        int i = 0;
        for (LogEvent e : events) {
            idsArray[i++] = e.getID();
        }
        return new LogDescriptor(gatewayID, logID, new SortedRangeSet(idsArray));
    }
View Full Code Here

                cached = true;
            }
        }
        List<LogEvent> events = null;
        if (!cached) {
            events = get(new LogDescriptor(gatewayID, logID,
                    SortedRangeSet.FULL_SET));

            // remove duplicates first
            list.removeAll(events);
        }
View Full Code Here

    List<LogDescriptor> diffLogDescriptorLists(List<LogDescriptor> all, List<LogDescriptor> seen) {
        List<LogDescriptor> descriptors = new ArrayList<LogDescriptor>();

        // Find out what events should be returned
        for (LogDescriptor s : all) {
            LogDescriptor diffs = s;
            for (LogDescriptor d : seen) {
                if ((s.getLogID() == d.getLogID()) && (s.getGatewayID().equals(d.getGatewayID()))) {
                    diffs = new LogDescriptor(s.getGatewayID(), s.getLogID(), d.getRangeSet().diffDest(s.getRangeSet()));
                }
            }
            descriptors.add(diffs);
        }
        return descriptors;
View Full Code Here

TOP

Related Classes of org.apache.ace.log.LogDescriptor

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.