package votorola.a.position; // Copyright 2013, Michael Allan. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE. import java.io.*; import java.net.*; import java.util.regex.*; import votorola.g.*; import votorola.g.lang.*; /** A particular revision of a pipe. * * @see Category:Pipe */ public interface PipeRevision extends CoreRevision { /** The search pattern for the definitive template call in a pipe page. If the * pattern matches, then it splits the wikitext of the call into groups based on the * template parameter values, currently only (1) poll name. This method of * extracting properties from a revision is required because SemanticMediawiki's data * store does not attach properties to revisions, only to pages. * * @see ComponentPipeRevision#TEMPLATE_CALL_PATTERN */ static final Pattern TEMPLATE_CALL_PATTERN = Pattern.compile( "\\{\\s*\\{\\s*(?:\\w+ )?pipe\\s*" + "(?:\\|\\s*.+?\\s*=\\s*.+?\\s*)*" // * + "\\|\\s*poll\\s*=\\s*(.+?)\\s*" // POLL NAME + "(?:\\|\\s*.+?\\s*=\\s*.+?\\s*)*" // * + "\\}\\s*\\}" ); // * any other parameters are currently ignored // ==================================================================================== /** Thrown when a request cannot be met because the content of a page is not in the * form required for a pipe. */ static final @ThreadSafe class MalformedContent extends IOException implements UserInformative { /** @param wikiScriptURI the base URL for script execution in the wiki, without a * trailing slash (/). */ MalformedContent( final String message, final URI wikiScriptURI, final int rev ) { super( message + " | " + MediaWiki.revLoc(wikiScriptURI,rev) ); } } }