org.apache.sling.discovery.impl.cluster.voting
Class VotingHelper

java.lang.Object
  extended by org.apache.sling.discovery.impl.cluster.voting.VotingHelper

public class VotingHelper
extends Object

Helper class for voting


Constructor Summary
VotingHelper()
           
 
Method Summary
static VotingView getWinningVoting(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config)
          Return the still valid (ongoing) and winning (received a yes vote from everybody) voting
static VotingView getYesVotingOf(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config, String slingId)
          Returns the voting for which the given slingId has vote yes or was the initiator (which is equal to yes).
static List<VotingView> listOpenNonWinningVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config)
          List all the votings that are currently 'open' but 'not winning'.
static List<VotingView> listTimedoutVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver, Config config)
          List all the votings that have timed out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VotingHelper

public VotingHelper()
Method Detail

listOpenNonWinningVotings

public static List<VotingView> listOpenNonWinningVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                         Config config)
List all the votings that are currently 'open' but 'not winning'.

'Open' means that they have not expired yet, have zero no-votes, and match the view that this instance has of the cluster.

'Not winning' means that a voting still did not receive a vote from everybody

Returns:
the list of matching votings

listTimedoutVotings

public static List<VotingView> listTimedoutVotings(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                                   Config config)
List all the votings that have timed out

Returns:
the list of matching votings

getWinningVoting

public static VotingView getWinningVoting(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                          Config config)
Return the still valid (ongoing) and winning (received a yes vote from everybody) voting

Returns:
the valid and winning voting

getYesVotingOf

public static VotingView getYesVotingOf(org.apache.sling.api.resource.ResourceResolver resourceResolver,
                                        Config config,
                                        String slingId)
Returns the voting for which the given slingId has vote yes or was the initiator (which is equal to yes).

Parameters:
slingId - the instance for which its yes vote should be looked up
Returns:
the voting for which the given slingId has votes yes or was the initiator


Copyright © 2007–2014 The Apache Software Foundation. All rights reserved.