Votorola

votorola.a.poll
Class Poll

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

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

A poll provided as a voter service. A poll is a collection of votes that are stored in a public repository, from which vote counts are generated. The name of the poll is guaranteed to end with P_SUFFIX.

See Also:
../../s/manual.xht#Polls

Nested Class Summary
static class Poll.ConstructionContext
          A context for configuring a poll.
(package private) static class Poll.LeaderConfiguration
          The leader configuration 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.NoSuchServiceException, VoterService.UIdentified
 
Nested classes/interfaces inherited from interface InputStore
InputStore.X
 
Field Summary
static String P_SUFFIX
          The standard suffix for all poll names.
(package private) static String SEMANTIC_BASE_ID
          The standard base identifier for RDF applications, in URI format.
 
Fields inherited from class VoterService.UIdentified
uid
 
Fields inherited from class VoterService
constructionContext, lock, name, NAME_MAX_LENGTH, NAME_PATTERN, pollserverRun
 
Method Summary
 Count countToReport()
          The current count to report, if any.
 Exception dispatch(String[] argArray, CommandResponder.Session commandSession)
          Looks up the responder of the specified command, and sends the command to it.
 DivisionalPollNode divisionalNode()
          The divisional node for this poll.
 Issue issue()
          The issue of this poll.
 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.
 String pName()
          The p-name of this poll.
static String pName(String name)
          The p-name of a poll.
 long populationSize()
          The population base of this poll, if known.
 String populationSizeExplanation()
          An explanation of the population base, intended for the information of users.
(package private)  JavaScriptIncluder runtimeConfigurationScript()
          The runtime configuration file for the register.
 File startupConfigurationFile()
          The startup configuration file for this service.
 String summaryDescription()
          A brief description of this poll, up to a few sentences in length.
 String summaryDescription(BundleFormatter bun)
          Returns either the summary description; or, if there is none, a placeholder with localized configuration instructions.
 String title()
          Title of this poll, in wiki-style title case (leading letter only).
 InputTable voterInputTable()
          The relational store of voter input for this service.
 
Methods inherited from class VoterService.UIdentified
helpA_2, uid
 
Methods inherited from class VoterService
dispatch, equals, help, helpA_1, helpA_3, helpA, helpB, helpC, init, 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

P_SUFFIX

public static final String P_SUFFIX
The standard suffix for all poll names.

See Also:
VoterService.name(), pName(), Constant Field Values

SEMANTIC_BASE_ID

static final String SEMANTIC_BASE_ID
The standard base identifier for RDF applications, in URI format.

See Also:
Constant Field Values
Method Detail

countToReport

public Count countToReport()
                    throws IOException,
                           SQLException
The current count to report, if any.

Returns:
count, or null if none to report
Throws:
IOException
SQLException

divisionalNode

public DivisionalPollNode divisionalNode()
The divisional node for this poll.


issue

@ThreadSafe
public Issue issue()
The issue of this poll. The issue is leader configured.

See Also:
../manual.xht#leader-config, Leader.xsd (Poll/issue)

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.


pName

@ThreadSafe
public String pName()
The p-name of this poll. The p-name is the name without the P_SUFFIX. It is unique among all polls of the pollserver, and it never changes.

As a rule, the p-name is used only for aesthetic reasons, and only in the end-user interface. The administrative interface and internal code references always use the full service name.

See Also:
VoterService.name(), pName(String)

pName

@ThreadSafe
public static String pName(String name)
The p-name of a poll. The p-name is the name without the P_SUFFIX. It is unique among all polls of the pollserver, and it never changes.

As a rule, the p-name is used only for aesthetic reasons, and only in the end-user interface. The administrative interface and internal code references always use the full service name.

Parameters:
name - the full service name of the poll, which is assumed to end with the P_SUFFIX
Returns:
the name trucated by the length of P_SUFFIX
See Also:
VoterService.name(), pName()

populationSize

@ThreadSafe
public long populationSize()
The population base of this poll, if known. This an estimate of the number of people who are eligible to vote in the poll. Depending on the runtime configuration of the poll, the population base might be equal to the population of the surrounding district, or it might be something less.

Returns:
estimated population base, or zero if unknown
See Also:
Poll.ConstructionContext.setPopulationSize(long), District.populationSize()

populationSizeExplanation

@ThreadSafe
public String populationSizeExplanation()
An explanation of the population base, intended for the information of users. For example: "population of Ward 19 from 2008 census", or "neighbourhood of Trinity Bellwoods from 2008 census".

See Also:
Poll.ConstructionContext.setPopulationSizeExplanation(String)

runtimeConfigurationScript

@Warning(value="thread restricted object")
JavaScriptIncluder runtimeConfigurationScript()
The runtime configuration file for the register. The language is JavaScript. There are restrictions on the character encoding.

See Also:
poll-run.js (default example script), ../manual.xht#poll-run.js

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:
../manual.xht#poll.js

summaryDescription

@ThreadSafe
public String summaryDescription()
A brief description of this poll, up to a few sentences in length. The description is leader configured. The default value is the empty string "".

Specified by:
summaryDescription in class VoterService
See Also:
summaryDescription(BundleFormatter), ../manual.xht#leader-config, Leader.xsd (Poll/summaryDescription)

summaryDescription

@ThreadSafe
public String summaryDescription(BundleFormatter bun)
Returns either the summary description; or, if there is none, a placeholder with localized configuration instructions.


title

@ThreadSafe
public String title()
Title of this poll, in wiki-style title case (leading letter only). The title is leader configured.

Specified by:
title in class VoterService
See Also:
../manual.xht#leader-config, Leader.xsd (Poll/title)

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