/*
* [Configuration.java]
*
* Summary: Use this class to customise the html static macro system to your website application.
*
* Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com
*
* Licence: This software may be copied and used freely for any purpose but military.
* http://mindprod.com/contact/nonmil.html
*
* Requires: JDK 1.8+
*
* Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/
*
* Version History:
* 1.8 2009-02-06 include go package in ZIP bundle.
* 1.9 2010-01-23 make configuration into an instance and interface rather than static.
*/
package com.mindprod.htmlmacros.support;
import com.mindprod.qf.AbstractGlossCustomiser;
import com.mindprod.stores.OnlineStore;
import com.mindprod.stores.StockStatus;
import java.io.File;
import java.util.List;
/**
* Use this class to customise the html static macro system to your website application.
*
* You need to write something similar to ConfigurationForMindprod that implements this Configuration.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.9 2010-01-23 make configuration into an instance and interface rather than static.
* @since 2009
*/
public abstract class Configuration implements JPrepConfiguration
{
/**
* Do we need to regenerate this file even if generated recently successfully and not changed since then.
*
* @param fileBeingDistributed file we are testing.
*
* @return tre if should force regeneration
*/
public abstract boolean alwaysRegenerate( File fileBeingDistributed ); // /method
/**
* get URL of corresponding blog for this page, possibly empty.
*
* @param fileBeingDistributed the file currently being processed.
*
* @return Url to blog, or ""
*/
public abstract String blogForPage( File fileBeingDistributed ); // /method
/**
* Figure out which page comes next.
*
* @param fileBeingDistributed the file currently being processed.
*
* @return relative link to the next page, null if no logical next page.
*/
public abstract String calcNextPage( final File fileBeingDistributed ); // /method
/**
* Figure out which page comes before this one.
*
* @param fileBeingDistributed the file currently being processed.
*
* @return relative link to the previous page, null if no logical previous page.
*/
public abstract String calcPrevPage( final File fileBeingDistributed ); // /method
/**
* get webroot relative url of corresponding feedback page for this page, defaulting to feedback/feedback.html,
* not empty.
*
* @param fileBeingDistributed the file currently being processed.
*
* @return webroot relative corresponding feedback page. Never empty
*/
public abstract String correspondingFeedbackPage( File fileBeingDistributed ); // /method
/**
* get Allposters.com account #
*
* @return AllPosters.com affiliate account number, aid, not account number, always an int is string form
*/
public abstract int getAccountForAllpostersCom(); // /method
/**
* get amazon.ca account #
*
* @return account number for amazon.ca bookstore, null if none.
*/
public abstract String getAccountForAmazonCa(); // /method
/**
* @return account number for amazon.cn China bookstore, null if none.
*/
public abstract String getAccountForAmazonCn(); // /method
/**
* get amazon.com account #
*
* @return account number for amazon.com bookstore, null if none.
*/
public abstract String getAccountForAmazonCom(); // /method
/**
* get amazon.de account #
*
* @return account number for amazon.de bookstore, null if none.
*/
public abstract String getAccountForAmazonDe(); // /method
/**
* get amazon.es account #
*
* @return account number for amazon.es bookstore, null if none.
*/
public abstract String getAccountForAmazonEs(); // /method
/**
* get amazon.fr account #
*
* @return account number for amazon.fr bookstore, null if none.
*/
public abstract String getAccountForAmazonFr(); // /method
/**
* get amazon.it account #
*
* @return account number for amazon.es bookstore, null if none.
*/
public abstract String getAccountForAmazonIt(); // /method
/**
* get amazon.uk account #
*
* @return account number for amazon.uk bookstore, null if none.
*/
public abstract String getAccountForAmazonUk(); // /method
/**
* get art.com account #
*
* @return Art.com affiliate account number. PID, always an integer in string form
*/
public abstract int getAccountForArtCom(); // /method
/**
* get barnes and noble account #
*
* @return account number for Barnes and Noble bookstore, &lkid=J12871747&pubid=K49036
*/
public abstract String getAccountForBarnesAndNoble(); // /method
/**
* @return account number, aka PID, for chapters indigo bookstore, null if none.
*/
public abstract String getAccountForChaptersIndigo(); // /method
/**
* @return Google adSense account number. cmp google account "pub-7275336356867641" Randy Richardson's google
* account
* "pub-3625079171090429" . We use his account in return for free website hosting.
*/
public abstract String getAccountForGoogleAdsense(); // /method
/**
* @return Google Custom Search Engine Account#.
*/
public abstract String getAccountForGoogleCSE(); // /method
/**
* get junglee.com account #
*
* @return account number for junglee.com (amazon india) bookstore, null if none.
*/
public abstract String getAccountForJungleeCom(); // /method
/**
* get Kobo account #
*
* @return account number for Kobo bookstore, &lkid=J12871747&pubid=K49036
*/
public abstract String getAccountForKobo(); // /method
/**
* @return account number for Powells bookstore, null if none.
*/
public abstract String getAccountForPowells(); // /method
/**
* @return account number for TigerDirect.ca
*/
public abstract String getAccountForTigerDirectCa(); // /method
/**
* @return account number for TigerDirect.com
*/
public abstract String getAccountForTigerDirectCom(); // /method
/**
* get webring account #
*
* @return account name for WebRing, null if none.
*/
public abstract String getAccountForWebring(); // /method
/**
* @return NCIX Canada affiliate number. PID, always an integer in string form
*/
public abstract String getAccountNCIXCaCom(); // /method
/**
* @return NCIX SU affiliate number. PID, always an integer in string form
*/
public abstract String getAccountNCIXUsCom(); // /method
/**
* get age in millis of changes to web pages that would be unpected. When age is longer than this we
* display how the page changed for analysis. Recent changes from edits are expected.
*
* @return age in miliis
*/
public abstract long getAgeOfUnexpectedChanges();
/**
* get CSS configuring configuration
*/
public abstract AssignCSSClasses getAssignCSSClasses();
/**
* get author of webpages
*
* @return default author for web pages
*/
public abstract String getAuthor(); // /method
/**
* get the string to use for
*
* @return either " " or " "
*/
public String getBr()
{
return isUsingXHTML() ? " \n" : " \n";
} // /method
/**
* get code-signing cert
*
* @return name of the code signing cert without .cer, possibly self-signed. e.g. "mindprodcert2017rsa";
*/
public abstract String getCodeSigningCert(); // /method
/**
* get compacting code
*
* @return *=compactStringStrippingMacrosAndComments, with separate masters
* +=compactStringKeepingMacrosAndComments, classical, expande macros in place.
* -=does nothing
* Q=Quick If first 400 chars contain a double space, compactStringKeepingMacrosAndComments,
* otherwise do nothing
*/
public abstract char getCompacting(); // /method
/**
* convert a webrootroot relative UNL to an absolute URL to the corresponding page on the companion website
*
* @param webrootRelative e.g. bgloss/dsk.html such as would be passed to Link, with /
*
* @return http://mindprod.com/bgloss/dsk.html or null if no equivalent
*/
public abstract String getCompanionURL( final String webrootRelative );
/**
* get name of logo file.
*
* @return corporate logo. Stored in image/logo as .png or .jpg file
*/
public abstract String getCompanyLogo(); // /method
/**
* get name of company responsible for this website.
*
* @return company responsible for the web pages, hard coded in
*/
public abstract String getCompanyName(); // /method
/**
* get name of company decorated with HTML
*
* @return Company responsible for the web pages
* Prettified as you please with HTML.
*/
public abstract String getCompanyNameFancyHtml(); // /method
/**
* get phone number of webmaster.
*
* @return phone number of webmaster as a string, no format restrictions.
*/
public abstract String getCompanyPhone(); // /method
/**
* get name copyright holder for this page
*
* @param fileBeingDistributed the file currently being processed.
*
* @return Case-sensitive name of coppright holder for this page. Might contain some markup or entities.
*/
public abstract String getCopyrightHolderForPage( final File fileBeingDistributed ); // /method
/**
* get dirs needing macro expansion
*
* @return array of Directories containing HTML files with macros. Does not include redir, includes, kjv,
* snippets, rss
* since these do not include HTML needing macro expansion.
* All Live in E:\mindprod\
*/
public abstract List getDirsContainingHTMLMacros(); // /method
/**
* get dirs used for includes
*
* @return include Directories containing HTML files. Distributed. All Live in E:\mindprod\
*/
public abstract List getDirsContainingIncludes(); // /method
/**
* get snippet dirs
*
* @return array of Directories containing snippet dirs, not the snippet dirs themselves.
* e.g applet, withhout E:\mindprod or \snippet
*/
public abstract List getDirsContainingSnippets(); // /method
/**
* get dirs that need to be seesorted
*
* @return array of Directories that are
* seesortad. All Live in E:\mindprod\
*/
public abstract List getDirsToSeeSort(); // /method
/**
* get dirs with hit counts macro expansion
*
* @return array of Directories that have hit counts. Does not include redir, includes, snippets, rss
* includes kjv
* All Live in E:\mindprod\
*/
public abstract List getDirsWithHitCounts(); // /method
/**
* DOCTYPE line to go at top of each page.
*
* @param fileBeingDistributed the file currently being processed.
*
* @return Case-sensitive default doctype to got at the top of generated webpages.
*/
public abstract String getDoctypeDefault( final File fileBeingDistributed ); // /method
/**
* DOCTYPE to go at top of frame documents
*
* @param fileBeingDistributed the file currently being processed.
*
* @return Case-sensitive frame doctype to be used on frames
*/
public abstract String getDoctypeForFrame( final File fileBeingDistributed ); // /method
/**
* DOCTYPE to go at top of iframes (snippets)
*
* @param fileBeingDistributed the file currently being processed.
*
* @return Case-sensitive frame doctype for iframe snippets
*/
public abstract String getDoctypeForIframe( final File fileBeingDistributed ); // /method
/**
* How frequently do we rotate the a Quotation embedded in a page? Customise frequency of rotation for different
* types of pages on the website.
*
* @param fileBeingDistributed the file currently being processed.
*
* @return rotation interval in milliseconds.
*/
public abstract long getEmbeddedQuotationRotateIntervalInMillis( File fileBeingDistributed ); // /method
/**
* Get the first year this page was first copyrighted.
*
* @param fileBeingDistributed file being distributed
*
* @return first copyright year for given page. 0 means no copyright.
*/
public abstract int getFirstCopyrightYear( File fileBeingDistributed ); // /method
/**
* How frequently do we rotate the PSA ad on a given page or quotations in the footer.
* Customise frequency of rotation for different
* types of pages on the website. Also how often permit flip psa <--> quotation.
*
* @param fileBeingDistributed the file currently being processed.
*
* @return rotation interval in milliseconds.
* @see PSA#psaOrQuoteOrNonMil(QuoteAggregate, java.io.File, java.io.File)
* @see com.mindprod.htmlmacros.support.PSAType#chooseAnAdVariant(int, java.io.File)
* @see #getQuoteAggregateForFooter(java.io.File)
*/
public abstract long getFooterRotateIntervalInMillis( File fileBeingDistributed ); // /method
/**
* get a list of the glossary customisers that need indexing
*
* @return array of AbstractGlossCustomisers
*/
public abstract AbstractGlossCustomiser[] getGlossCustomisers();
/**
* Tallest an image can be for a page header in pixels.
*
* @return tallest we allow an image to be to use in a page header
*/
public abstract int getHeaderImageMaxHeight(); // /method
/**
* Widest an image can be for a page header in pixels.
*
* @return widest we allow an image to be to use in a page header
*/
public abstract int getHeaderImageMaxWidth(); // /method
/**
* get the string to use for
*
* @return either "" or ""
*/
public String getHr()
{
return isUsingXHTML() ? "\n" : "\n";
} // /method
/**
* get language of the webpages e.g. "en-CA"
*
* @param fileBeingDistributed file being processed
*
* @return fr-FR en-CA en-US etc.
*/
public abstract String getLanguage( File fileBeingDistributed ); // /method
/**
* get E:\mindprod
*
* @return where the website is stored locally on author's machines. Use local separator conventions e.g. \\ for
* each \ for windows. Usually E:
*/
public abstract String getLocalWebrootWithBackslashes(); // /method
/**
* /**
* get E:/mindprod
*
* @return where the website is stored locally on author's machines. Use / for separator. Usually E: no trailing /.
*/
public abstract String getLocalWebrootWithSlashes(); // /method
/**
* line separator in generated web pages. hThe actual string, not a code for it.
*
* @return preferred line separator in generated files. Normally \n since this is most compact. Possibly set to
* System.getProperty( "line.separator" ); or "\r\n" or "\r".
* If you have compaction turned on, this ignored. The lineSeparator is always \n because it is the most
* compact
* and web-centric.
*/
public abstract String getPreferredLineSeparator(); // /method
/**
* get quotation Aggregate category to use an a footer for a given page.
*
* @param footerFile web page where ad will go
*
* @return html to display banner and link
*/
public abstract QuoteAggregate getQuoteAggregateForFooter( File footerFile ); // /method
/**
* How long to keep an RSS item displayed.
*
* @return how many days to keep RSS newsfeed items in the HTML display
*/
public abstract int getRSSDisplayDays(); // /method
/**
* How long to keep an RSS item.
*
* @return how many days to keep RSS newsfeed items in the RSS feed
*/
public abstract int getRSSKeepDays(); // /method
/**
* generate " or ">"
*/
public String getTagTail()
{
return isUsingXHTML() ? " />\n" : ">\n";
}
/**
* J:\mindprod
*
* @return where the website is stored locally on client site if visitor downloads a mirror of the entire
* websites. Use local separator conventions e.g. \\
* for each \ for windows. Uses J:, assuming windows client.
*/
public abstract String getWebrootOnJWithBackslashes(); // /method
/**
* J:/mindprod
*
* @return where the website is stored locally. use url separator conventions
*/
@SuppressWarnings( { "ConstantNamingConvention" } )
public abstract String getWebrootOnJWithSlashes(); // /method
/**
* mindprod.com
*
* @return name of website without http://
*/
public abstract String getWebsiteDomain(); // /method
/**
* IP of website
*
* @return IP of website. Displayed in footers.
*/
public abstract String getWebsiteIP(); // /method
/**
* How many Google ads should we put on this page.
*
* @param fileBeingDistributed file being distributed
*
* @return 0=no ads 1=one at bottom 2=one at top and one at bottom.
*/
public abstract int howManyGoogleAds( File fileBeingDistributed ); // /method
/**
* Do we include the blurb.css style sheet on this page.
*
* @param fileBeingDistributed file being distributed
*
* @return true if should include blurb style sheet.
*/
public abstract boolean includeStylesheetForBlurb( File fileBeingDistributed ); // /method
/**
* Do we include the seasonal (carols) style sheet on this page.
*
* @param fileBeingDistributed file being distributed
*
* @return true if should include carol style sheet.
*/
public abstract boolean includeStylesheetForCarols( File fileBeingDistributed ); // /method
/**
* Do we include the handbook.css style sheet on this page.
*
* @param fileBeingDistributed file being distributed
*
* @return true if should include handbook style sheet.
*/
public abstract boolean includeStylesheetForHandbook( File fileBeingDistributed ); // /method
/**
* Do we include the home style sheet on this page.
*
* @param fileBeingDistributed file being distributed
*
* @return true if should include home style sheet.
*/
public abstract boolean includeStylesheetForHome( File fileBeingDistributed ); // /method
/**
* Do we include the aux/jdisplay style sheet on this page.
*
* @param fileBeingDistributed file being distributed
*
* @return true if should include JDisplay style sheet.
*/
public abstract boolean includeStylesheetForJDisplay( File fileBeingDistributed ); // /method
/**
* Do we include the usual mindprod.css style sheet on this page.
*
* @param fileBeingDistributed file being distributed
*
* @return true if should include home style sheet.
*/
public abstract boolean includeStylesheetForUsual( File fileBeingDistributed ); // /method
/**
* do we want extra debugging output?
*
* @return true if you want extra debugging output
*/
public abstract boolean isDebugging(); // /method
/**
* do we generate stripped down kindle version of the HTML?
*
* @return true if kindle version
*/
public abstract boolean isKindle(); // /method
/**
* is this book rare, expected not to be stocked anywhere?
*
* @param isbn13 isbn of book
*
* @return true if rare
*/
public boolean isProductRare( final String product )
{
return false;
}
/**
* Should this file be restricted to adult viewers?
*
* @param fileBeingDistributed file in question
*
* @return true if only adults should view this page
*/
public abstract boolean isRestrictedToAdults( File fileBeingDistributed ); // /method
/**
* is this page restricted to non-military use only?
*
* @param fileBeingDistributed the file currently being processed.
*
* @return true if this page in non-mil use.
*/
public abstract boolean isRestrictedToNonMil( File fileBeingDistributed ); // /method
/**
* are we generating HTML5?
*
* @param fileBeingDistributed where we are generating code.
*
* @return true if using HTML 5 on the given page.
*/
public abstract boolean isUsingHTML5( final File fileBeingDistributed ); // /method
/**
* are we using Jet native compiler runtime?
*
* @return true if we are running under Excelsior Jet native compiler. configures itself automatically.
*/
public boolean isUsingJet()
{
return System.getProperty( "java.vm.name", "unknown" ).equals( "Excelsior JET" ); // /method
}
/**
* are we generating XHTML?
*
* @return true if XHTML with < .../> tags.
*/
public abstract boolean isUsingXHTML(); // /method
/**
* do we give the verbose informational messages?
*
* @return true if want verbose version.
*/
public abstract boolean isVerbose(); // /method
/**
* Does this product possibly have a newer version?
* If no, we have checked it out and the new product is not really a replacmenent.
*
* @param productId isbn, sku etc.
*
* @return false if we have researched and there is not really a newer replacement product.
*/
public abstract boolean possiblyNewer( String productId );
/**
* should we recompute footers, even if they have not yet expired?
* This should be true when run shortly after midnight to readjust footers for different birthday weightings.
*
* @param fileBeingDistributed, not the footer itself
*
* @return true if should recompute footers.
*/
public abstract boolean shouldWeUpdateThisFooterNow( final File fileBeingDistributed ); // /method
/**
* override the usual stock mechanism because of errors in vendor
* databbase.
*
* @param store
* @param product
*
* @return null if no override, stockStatus if override
*/
public abstract StockStatus stockStatusOverride( OnlineStore store, String product );
}