~/{@linkplain VoteServer#votorolaDirectory() * votorola}/trust/trustserver-run.js
* *The language is JavaScript. There are restrictions on the {@linkplain * votorola.g.script.JavaScriptIncluder character encoding}.
* * @see trustserver-run.js (example script) * @see ../manual.xht#trustserver-run.js (FIX broken docs) */ @Warning( "thread restricted object" ) public JavaScriptIncluder runtimeConfigurationScript() { assert lock.isHeldByCurrentThread(); // this method is safe, but not the object return runtimeConfigurationScript; } private final JavaScriptIncluder runtimeConfigurationScript = new JavaScriptIncluder( new File( serviceDirectory(), "trustserver-run.js" )); /** The current network trace to report, or null if there is none. * * @see votorola.a.trust.NetworkTrace.VoteServerScope#readyToReportLink() */ public NetworkTrace traceToReport() throws IOException, SQLException { assert lock.isHeldByCurrentThread(); final File readyToReportLink = vsRun.voteServer().scopeTrace().readyToReportLink(); ReadyDirectory readyDirectory = null; // so far if( readyToReportLink.exists() ) { readyDirectory = new ReadyDirectory( readyToReportLink.getCanonicalPath() ); } if( readyDirectory == null ) { if( traceToReport != null ) { logger.info( readyToReportLink + ": link is lost, stopping report: " + traceToReport.readyDirectory() ); traceToReport = null; } return traceToReport; } if( !readyDirectory.isMounted() ) { logger.warning( readyToReportLink + ": trace not mounted: " + readyDirectory ); traceToReport = null; return traceToReport; } if( traceToReport == null || !traceToReport.isObjectReadFromSerialFile( readyDirectory )) { logger.info( "starting new trace report: " + readyDirectory ); traceToReport = NetworkTrace.readObjectFromSerialFile( readyDirectory ); final Database d = vsRun.database(); traceToReport.init( new Membership.Table( readyDirectory, d ), new TraceNodeW.Table( readyDirectory, d )); } return traceToReport; } private NetworkTrace traceToReport; // lazily set/reset through traceToReport() /** The current network trace to report, or null if there is none. This is just a * thread safe wrapper that automatically siezes and releases the lock. */ public @ThreadSafe NetworkTrace traceToReportT() throws IOException, SQLException { lock.lock(); try { return traceToReport(); } finally { lock.unlock(); } } // - V o t e r - S e r v i c e -------------------------------------------------------- /** @see ../manual.xht#trustserver.js (FIX broken docs) */ public @ThreadSafe @Override File startupConfigurationFile() { return startupConfigurationFile; } /** @see ConstructionContext#setSummaryDescription(String) */ public @ThreadSafe @Override String summaryDescription() { return summaryDescription; } private final String summaryDescription = cc().getSummaryDescription(); /** @see ConstructionContext#setTitle(String) */ public @ThreadSafe @Override String title() { return title; } private final String title = cc().getTitle(); // ==================================================================================== /** A context for configuring the construction of a {@linkplain Trustserver * Trustserver}. Each construction is configured by the trusterver's {@linkplain * Trustserver#startupConfigurationFile startup configuration script} (s). During * construction, an instance of this context (tCC) is passed to s, via * s::constructingTrustserver(tCC). */ public static @ThreadRestricted("constructor") final class ConstructionContext extends VoterService.ConstructionContext { private ConstructionContext( VoteServer _voteServer, final JavaScriptIncluder s ) { super( "trustserver", s ); voteServer = _voteServer; setSummaryDescription( "This is the trustserver. " + "Further information is unavailable because the 'constructingTrustserver' function " + "of script " + startupConfigurationFile() + " " + "makes no call to 'setSummaryDescription'." ); } // -------------------------------------------------------------------------------- /** The primary trust to extend for each trace of the trust network. * * @see #addPrimaryTrust(IDPair,int) */ public TrustEdge.Primary[] getPrimaryTrustArray() { return primaryTrustList.toArray( new TrustEdge.Primary[primaryTrustList.size()] ); } private final ArrayList