Package com.volantis.mcs.dissection

Examples of com.volantis.mcs.dissection.RequestedShards


        }

        OutputDocument output = createOutputDocument();
        DissectedContentHandler outputHandler
            = createDissectedContentHandler(output);
        RequestedShards requestedShards = dissected.createRequestedShards();
        dissector.serialize(context, dissected,
                            requestedShards, outputHandler);
        int totalCost = dissected.getTotalCost();
        int outputSize = output.getSize();
        // Check output size is reasonable; we allow explicit output size to
View Full Code Here


        DissectedDocument dissectedDocument =
                dissector.createDissectedDocument(context, characteristics,
                dissectionDocument, urlManager, information);

        // Interate over the shards.
        RequestedShards shards = dissectedDocument.createRequestedShards();
        int dissectableArea = 0;
        ShardIterator iterator =
                dissectedDocument.getShardIterator(context, dissectableArea);
        int count = 0;
        while (iterator.hasMoreShards()) {
            iterator.populateNextShard();
            count += 1;
        }
        for (int i = 0; i < count; i += 1) {
            System.out.println();
            System.out.println("Shard " + (i+1) + " of " + count +
                    " of dissectable area " + dissectableArea);
            shards.setShard(0, i);

            // Create a producer for XML.
            CharArrayWriter textBuffer = new CharArrayWriter();
            CharacterEncoder pce = new DebugCharacterEncoder();
            EncodingWriter enc = new EncodingWriter(textBuffer, pce);
View Full Code Here

    public static RequestedShards getRequestedShards(FragmentationState fragmentationState,
                                                     DissectedDocument document) {

        // Create a SelectedShards object to hold the shards that have been
        // selected for each dissectable area.
        RequestedShards requestedShards = document.createRequestedShards();

        // Get the shard that has been selected for each dissectable area. This
        // is done by iterating over the dissectable areas looking to see if a
        // shard has been specified for them in the fragmentation state. If no
        // shard has been explicitly set then the first shard is used.
        int count = requestedShards.getCount();
        for (int i = 0; i < count; i += 1) {
            DissectableAreaIdentity identity
                = document.getDissectableAreaIdentity(i);

            // Get the shard index from the fragmentation state. Really we
            // should push the identity into the fragmentation state but for
            // now we will expand it here.
            String inclusionPath = identity.getInclusionPath();
            String name = identity.getName();
            int shardIndex;
            if (fragmentationState == null) {
                shardIndex = 0;
            } else {
                shardIndex = fragmentationState.getShardIndex(inclusionPath,
                                                              name);
            }

            // Store the index in the requested shards.
            requestedShards.setShard(i, shardIndex);
        }

        return requestedShards;
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dissection.RequestedShards

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.