votorola.a.register
Class Register

java.lang.Object
  extended by ElectoralService
      extended by Register
All Implemented Interfaces:
InputStore

@ThreadRestricted(value="holds lock()")
public final class Register
extends ElectoralService
implements InputStore

A register, provided as a formal electoral service.

See Also:
../design.xht#electoral-register

Nested Class Summary
static class Register.ConfigurationContext
          A context for configuring a register.
 
Field Summary
 
Fields inherited from class ElectoralService
configurationContext, lock, name, serviceEmail, subserverRun
 
Method Summary
(package private)  File configurationDirectory()
          The directory containing this register's configuration files.
 File configurationFile()
          The primary configuration file for this electoral service.
 Exception dispatch(String[] argArray, CommandResponder.Session commandSession)
          Looks up the responder of the specified command, and sends the command to it.
 DoubtSignal.Table doubtTable()
          The relational store of doubt signals, backing this register's doubt signaling network.
(package private)  long electorateSize()
          The estimated size of the electorate, if known.
(package private)  String electorateSizeExplanation()
          An explanation of the estimate of the size of the electorate, for the information of users.
 String fieldDescription_link()
          A brief description of the allowable content of this register's link field, in sentence form.
 String fieldDescription_name()
          A brief description of the allowable content of this register's name field, in sentence form.
 String fieldDescription_note()
          A brief description of the allowable content of this register's note field, in sentence form.
 String fieldDescription_residence()
          A brief description of the allowable content of this register's residence field, in sentence form.
 String fieldExample_link()
          An example of the allowable content for this register's link field.
 String fieldExample_name()
          An example of the allowable content for this register's name field.
 String fieldExample_note()
          An example of the allowable content for this register's note field.
 String fieldExample_residence()
          An example of the allowable content for this register's residence field.
 Geocode.GoogleGeocoding geocodingMethod()
          The geocoding method, for conversion of addresses to cartographic coordinates in the trust script.
 ListNode getListNode(VoterList list, String voterEmail)
          Retrieves a voter's list node from a compiled voter list.
 Database listDatabase()
          Database for mounting the relational parts of this register's compiled voter lists, and its doubt table -- a reference to a shared instance (not thread safe).
 JavaScriptIncluder listScript()
          The script 'list.js', for configuring the compilation of voter lists.
 String listSummaryDescription()
          The summary description for newly compiled voter lists.
 VoterList listToReport()
          Returns the current voter list to report, if any.
static Register newRegister(ElectoralSubserver.Run subserverRun, JavaScriptIncluder s)
          Constructs a Register.
 int preRegistrationTrustLevel()
          The minimum level of trust that a registrant must have, in order to pre-register another registrant.
(package private)  List<TrustEdge.Primary> primaryTrustList()
          The configured list of primary trust edges, for the neighbourhood trust network.
 File readyToReportLink()
          Returns the symbolic link to the ready directory of the current voter list to report, if any.
 String snapshotOutputStoreFilebase()
          Path to the base directory of the snapshot output store, for this electoral service.
 String summaryDescription()
          A brief description of this service, in sentence form.
 String title()
          Title of this electoral register, in title case.
 JavaScriptIncluder trustScript()
          The script 'trust.js', for restricting the scope of trust edges among voters.
 VoterInputTable voterInputTable()
          The relational store of voter input, for this service.
 
Methods inherited from class ElectoralService
dispatch, ensureSchema, equals, help, helpA, helpB, helpC, init, lock, name, responderByClassName, responderForCommand, responders, serviceEmail, subserverRun, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newRegister

@ThreadSafe
public static Register newRegister(ElectoralSubserver.Run subserverRun,
                                              JavaScriptIncluder s)
                            throws ScriptException,
                                   SQLException
Constructs a Register.

Parameters:
s - the compiled configuration script
Throws:
ScriptException
SQLException

configurationDirectory

@ThreadSafe
File configurationDirectory()
The directory containing this register's configuration files.


doubtTable

@ThreadSafe
public DoubtSignal.Table doubtTable()
The relational store of doubt signals, backing this register's doubt signaling network. It is a schema.table named "register-name.doubt", stored in the list database.

See Also:
listDatabase()

electorateSize

@ThreadSafe
long electorateSize()
The estimated size of the electorate, if known. This a best guess of the number of people who would be eligible for the voter list, if they chose to register. It might be the population size, or it might be something less; it depends on the configuration of the voter list.

Returns:
estimated size of the electorate; or zero, if unknown
See Also:
Register.ConfigurationContext.setElectorateSize(long)

electorateSizeExplanation

@ThreadSafe
String electorateSizeExplanation()
An explanation of the estimate of the size of the electorate, for the information of users. For example:
"population of region (2008 census)"

See Also:
Register.ConfigurationContext.setElectorateSizeExplanation(String)

fieldDescription_link

@ThreadSafe
public String fieldDescription_link()
A brief description of the allowable content of this register's link field, in sentence form.

See Also:
Register.ConfigurationContext.setFieldDescription_link(String)

fieldExample_link

@ThreadSafe
public String fieldExample_link()
An example of the allowable content for this register's link field.

See Also:
Register.ConfigurationContext.setFieldExample_link(String)

fieldDescription_name

@ThreadSafe
public String fieldDescription_name()
A brief description of the allowable content of this register's name field, in sentence form.

See Also:
Register.ConfigurationContext.setFieldDescription_name(String)

fieldExample_name

@ThreadSafe
public String fieldExample_name()
An example of the allowable content for this register's name field.

See Also:
Register.ConfigurationContext.setFieldExample_name(String)

fieldDescription_note

@ThreadSafe
public String fieldDescription_note()
A brief description of the allowable content of this register's note field, in sentence form.

See Also:
Register.ConfigurationContext.setFieldDescription_note(String)

fieldExample_note

@ThreadSafe
public String fieldExample_note()
An example of the allowable content for this register's note field.

See Also:
Register.ConfigurationContext.setFieldExample_note(String)

fieldDescription_residence

@ThreadSafe
public String fieldDescription_residence()
A brief description of the allowable content of this register's residence field, in sentence form.

See Also:
Register.ConfigurationContext.setFieldDescription_residence(String)

fieldExample_residence

@ThreadSafe
public String fieldExample_residence()
An example of the allowable content for this register's residence field.

See Also:
Register.ConfigurationContext.setFieldExample_residence(String)

geocodingMethod

@ThreadSafe
public Geocode.GoogleGeocoding geocodingMethod()
The geocoding method, for conversion of addresses to cartographic coordinates in the trust script.

Returns:
geocoding method, or null if none is used
See Also:
Register.ConfigurationContext.setGeocodingMethodGoogle(String)

getListNode

@ThreadSafe
public ListNode getListNode(VoterList list,
                                       String voterEmail)
                     throws IOException,
                            SQLException
Retrieves a voter's list node from a compiled voter list. This is a convenience method.

Parameters:
list - the voter list to use; or null, to lookup the currently reported list (which involves locking overhead in threaded runs)
Returns:
ListNodeC or ListNodeIC per getOrCreate(voterEmail); or, if lookup of the list itself fails, a ListNode0 with default values
Throws:
IOException
SQLException

listDatabase

@ThreadSafe
public Database listDatabase()
Database for mounting the relational parts of this register's compiled voter lists, and its doubt table -- a reference to a shared instance (not thread safe).

Although this method is thread safe, the object it returns is not; it has its own thread-saftety restrictions, q.v.

See Also:
doubtTable(), listToReport(), Register.ConfigurationContext.listDatabase()

listScript

public JavaScriptIncluder listScript()
The script 'list.js', for configuring the compilation of voter lists. It is located in the configuration directory. The language is JavaScript. There are restrictions on the character encoding.

See Also:
list.js (example script)

listSummaryDescription

@ThreadSafe
public String listSummaryDescription()
The summary description for newly compiled voter lists.

See Also:
VoterList.summaryDescription(), Register.ConfigurationContext.setListSummaryDescription(String)

listToReport

public VoterList listToReport()
                       throws IOException
Returns the current voter list to report, if any.

Returns:
voter list, or null if none to report
Throws:
IOException
See Also:
readyToReportLink()

preRegistrationTrustLevel

@ThreadSafe
public int preRegistrationTrustLevel()
The minimum level of trust that a registrant must have, in order to pre-register another registrant.

See Also:
Registration.isWriteableAll(), Register.ConfigurationContext.setPreRegistrationTrustLevel(int)

primaryTrustList

List<TrustEdge.Primary> primaryTrustList()
The configured list of primary trust edges, for the neighbourhood trust network.

Returns:
unmodifiable list of edges
See Also:
Register.ConfigurationContext.addPrimaryTrust(String,int)

readyToReportLink

@ThreadSafe
public File readyToReportLink()
Returns the symbolic link to the ready directory of the current voter list to report, if any.

Returns:
abstract path (never null) of symbolic link
See Also:
listToReport()

trustScript

public JavaScriptIncluder trustScript()
The script 'trust.js', for restricting the scope of trust edges among voters. It is located in the configuration directory. The language is JavaScript. There are restrictions on the character encoding.

See Also:
trust/trust.js (example script), ../manual.xht#trust-script

configurationFile

@ThreadSafe
public File configurationFile()
Description copied from class: ElectoralService
The primary configuration file for this electoral service. For an ordinary (non-meta) service, it is typically located at:
votorola-directory/services/service-name/service.js

The language is JavaScript. There are restrictions on the character encoding.

Specified by:
configurationFile in class ElectoralService

dispatch

public Exception dispatch(String[] argArray,
                          CommandResponder.Session commandSession)
Description copied from class: ElectoralService
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 ElectoralService
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)

summaryDescription

@ThreadSafe
public String summaryDescription()
Description copied from class: ElectoralService
A brief description of this service, in sentence form. It is intended for display, for example, as an introductory paragraph.

Specified by:
summaryDescription in class ElectoralService
See Also:
Register.ConfigurationContext.setSummaryDescription(String)

title

@ThreadSafe
public String title()
Title of this electoral register, in title case.

Specified by:
title in class ElectoralService
See Also:
Register.ConfigurationContext.setTitle(String)

snapshotOutputStoreFilebase

@ThreadSafe
public String snapshotOutputStoreFilebase()
Description copied from interface: InputStore
Path to the base directory of the snapshot output store, for this electoral service. The snapshot output store contains a series of snapshots, copied from the service's input store. It may also contain additional data, derived from the snapshot, such as mounted counts or voter lists.

Multiple services may share the same base directory. The output files for this particular service will be stored in a subdirectory named after the service: snapshotOutputStoreFilebase/service-name.

Specified by:
snapshotOutputStoreFilebase in interface InputStore

voterInputTable

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

Specified by:
voterInputTable in interface InputStore
See Also:
Register.ConfigurationContext.voterInputDatabase()