Votorola

votorola.a.poll
Class Poll

java.lang.Object
  extended by VoterService
      extended by Poll
All Implemented Interfaces:
InputStore

@ThreadRestricted(value="holds lock()")
public final class Poll
extends VoterService
implements InputStore

A poll provided as a voter service. A poll is a collection of votes on a prospective issue.

See Also:
u.zelea.com/w/Category:Poll, ../../s/manual.xht#Polls

Nested Class Summary
static class Poll.ConstructionContext
          A context for configuring the construction of a poll.
static class Poll.PollserverScope
          API for all polls within the scope of a pollserver.
 
Nested classes/interfaces inherited from class VoterService
VoterService.IllegalNameException, VoterService.NoSuchServiceException
 
Nested classes/interfaces inherited from interface InputStore
InputStore.X
 
Field Summary
static Pattern POLL_NAME_PATTERN
          The allowable pattern of a poll name.
static String TEST_POLL_NAME
          The standard name of the local test poll.
 
Fields inherited from class VoterService
constructionContext, lock, name, NAME_MAX_LENGTH, NAME_PATTERN, pollserverRun
 
Method Summary
(package private)  JavaScriptIncluder configurationScript()
          The compiled configuration script for the poll.
 Count countToReport()
          The current count to report, or null if there is none.
 Exception dispatch(String[] argArray, CommandResponder.Session commandSession)
          Looks up the responder of the specified command, and sends the command to it.
 Set<String> divisionalComponents()
          The set of divisions whose members are exclusively eligible to vote in this poll.
 String divisionPageName()
          The polling division, specified by its pollwiki pagename.
 String divisionSmallMapPageName()
          A small map of the polling division, specified by its pollwiki pagename.
 ActivityEvent newChangeEventOrNull(Vote oldVote, Vote newVote)
          Either constructs an event to record the change that occured between oldVote and newVote; or returns null, if no significant change occured.
 long populationSize()
          The estimated number of eligible voters for this poll.
 String populationSizeExplanation()
          An explanation of the population size.
 File startupConfigurationFile()
          The startup configuration file for this service.
 String summaryDescription()
          A short description that summarizes this service.
 String title()
          The display title of this service in wiki-style title case.
 InputTable voterInputTable()
          The relational store of voter input for this service.
 String wgLogoImageLocation()
          The wiki logo (wgLogo) image location for this poll; or null if none is specified.
 String wgLogoLinkTarget()
          The wiki logo (wgLogo) link target for this poll.
 
Methods inherited from class VoterService
dispatch, equals, help, helpA_1, helpA_2, helpA_3, helpA, helpB, helpC, init, isNonPoll, lock, name, pollserverRun, responderByClassName, responderForCommand, responders, serviceDirectory, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

POLL_NAME_PATTERN

public static final Pattern POLL_NAME_PATTERN
The allowable pattern of a poll name. This imposes a further restriction on the basic name pattern of voter services, in that the first character must be an uppercase letter.

See Also:
VoterService.name(), VoterService.NAME_PATTERN, u.zelea.com/w/Category:Poll

TEST_POLL_NAME

public static final String TEST_POLL_NAME
The standard name of the local test poll. It may serve as a system default in some contexts.

See Also:
Constant Field Values
Method Detail

configurationScript

@Warning(value="thread restricted object")
JavaScriptIncluder configurationScript()
The compiled configuration script for the poll.

See Also:
Poll.PollserverScope.configurationFile()

countToReport

public Count countToReport()
                    throws IOException,
                           SQLException
The current count to report, or null if there is none.

Throws:
IOException
SQLException

divisionalComponents

@ThreadSafe
public Set<String> divisionalComponents()
The set of divisions whose members are exclusively eligible to vote in this poll. If the set is empty, then divisional membership is not an eligibility criterion. Divisions of the local pollwiki are specified by page name, while all others are specified by URL.

Returns:
unmodifiable set of zero or more pollwiki pagenames and/or URLs
See Also:
Poll.ConstructionContext.addDivisionalComponent(String), u.zelea.com/w/Property:Division#Divisions

divisionPageName

@ThreadSafe
public String divisionPageName()
The polling division, specified by its pollwiki pagename.

Returns:
pollwiki pagename of division, or null if unspecified
See Also:
Poll.ConstructionContext.setDivisionPageName(String), u.zelea.com/w/Property:Division

divisionSmallMapPageName

@ThreadSafe
public String divisionSmallMapPageName()
A small map of the polling division, specified by its pollwiki pagename.

Returns:
pollwiki pagename of division map, or null if unspecified
See Also:
Poll.ConstructionContext.setDivisionSmallMapPageName(String), u.zelea.com/w/Property:Small_map

newChangeEventOrNull

public ActivityEvent newChangeEventOrNull(Vote oldVote,
                                          Vote newVote)
Either constructs an event to record the change that occured between oldVote and newVote; or returns null, if no significant change occured.


populationSize

@ThreadSafe
public long populationSize()
The estimated number of eligible voters for this poll.

Returns:
number of eligible voters, or zero if unknown
See Also:
Poll.ConstructionContext.setPopulationSize(long), u.zelea.com/w/Property:Population size

populationSizeExplanation

@ThreadSafe
public String populationSizeExplanation()
An explanation of the population size.

See Also:
Poll.ConstructionContext.setPopulationSizeExplanation(String), u.zelea.com/w/Property:Population size explanation

wgLogoImageLocation

@ThreadSafe
public String wgLogoImageLocation()
The wiki logo (wgLogo) image location for this poll; or null if none is specified.

See Also:
Poll.ConstructionContext.setWGLogoImageLocation(String), www.mediawiki.org/wiki/Manual:$wgLogo

wgLogoLinkTarget

@ThreadSafe
public String wgLogoLinkTarget()
The wiki logo (wgLogo) link target for this poll.

See Also:
Poll.ConstructionContext.setWGLogoLinkTarget(String), www.mediawiki.org/wiki/Manual:$wgLogo

dispatch

public Exception dispatch(String[] argArray,
                          CommandResponder.Session commandSession)
Description copied from class: VoterService
Looks up the responder of the specified command, and sends the command to it. Or, if the look-up fails, replies that the command is unrecognized.

Overrides:
dispatch in class VoterService
Parameters:
argArray - an array containing the command name and arguments, per CommandResponder.respond(argv,session)
Returns:
any soft exception, per CommandResponder.respond(argv,session); or null if none occured
See Also:
CommandResponder.respond(String[],CommandResponder.Session)

startupConfigurationFile

@ThreadSafe
public File startupConfigurationFile()
Description copied from class: VoterService
The startup configuration file for this service. The language is JavaScript. There are restrictions on the character encoding.

Specified by:
startupConfigurationFile in class VoterService
See Also:
Poll.PollserverScope.configurationFile()

summaryDescription

@ThreadSafe
public String summaryDescription()
Description copied from class: VoterService
A short description that summarizes this service.

Specified by:
summaryDescription in class VoterService
See Also:
Poll.ConstructionContext.setSummaryDescription(String)

title

@ThreadSafe
public String title()
Description copied from class: VoterService
The display title of this service in wiki-style title case.

Specified by:
title in class VoterService
See Also:
Poll.ConstructionContext.setTitle(String)

voterInputTable

@ThreadSafe
public InputTable voterInputTable()
Description copied from interface: InputStore
The relational store of voter input for this service. It is a table named "in_something", located in the pollserver's voter-input database.

Specified by:
voterInputTable in interface InputStore
See Also:
Pollserver.Run.voterInputDatabase()

Votorola