webadmin: do not run billing service if database flag is off

module:  webadmin (billing)

The billing service which contacts the billing cell should not attempt to retrieve data if the billing database has been disabled.

The original code had planned to enable this through Spring profiles, and the property was already in place to do so, but in the shuffle between versions the actual spring <beans> stanza was not implemented.

However, after some testing it was discovered that profiles do not seem to play with Wicket Spring injection, and the @SpringBean(required=false) annotation does nothing to stop the Spring NoSuchBeanDefinition error.

We have therefore adopted a slightly different solution.  It turns out that it is only minimally invasive and fairly clean.

Patch: http://rb.dcache.org/r/5641
Target: master
Request: 2.6
Require-book: no
Require-notes: yes
Acked-by: Gerd

Testing:

Before the fix, with billingToDB=no but generatePlots=true, one would get

13 Jun 2013 16:59:59 (System) [] Uncaught exception in thread StandardBillingServiceRefresher
java.lang.reflect.UndeclaredThrowableException: null
        at com.sun.proxy.$Proxy9.getDcBytesHistogram(Unknown Source) ~[na:na]
        at org.dcache.webadmin.controller.impl.StandardBillingService.load(StandardBillingService.java:148) ~[classes/:na]
        at org.dcache.webadmin.controller.impl.StandardBillingService.generatePlot(StandardBillingService.java:351) ~[classes/:na]
        at org.dcache.webadmin.controller.impl.StandardBillingService.refresh(StandardBillingService.java:294) ~[classes/:na]
        at org.dcache.webadmin.controller.impl.StandardBillingService.run(StandardBillingService.java:307) ~[classes/:na]
        at java.lang.Thread.run(Thread.java:722) ~[na:1.7.0_19]
Caused by: diskCacheV111.util.TimeoutCacheException: Request to [>billing@local] timed out.
        at org.dcache.cells.CellStub.sendAndWait(CellStub.java:321) ~[dcache-core-2.7.0-SNAPSHOT.jar:2.7.0-SNAPSHOT]
        at org.dcache.cells.CellStub.sendAndWait(CellStub.java:221) ~[dcache-core-2.7.0-SNAPSHOT.jar:2.7.0-SNAPSHOT]
        at org.dcache.cells.CellStub.sendAndWait(CellStub.java:212) ~[dcache-core-2.7.0-SNAPSHOT.jar:2.7.0-SNAPSHOT]
        at org.dcache.services.billing.histograms.data.TimeFrameHistogramDataProxy.invoke(TimeFrameHistogramDataProxy.java:93) ~[dcache-core-2.7.0-SNAPSHOT.jar:2.7.0-SNAPSHOT]

With the patch applied, the following combinations were tried:

billingToDb=no, generatePlots=true:   the page is not rendered (as expected)
billingToDb=yes, generatePlots=false: the page is not rendered (as expected)
billingToDb=yes, generatePlots=true:  the page is rendered (as expected)

The TimeoutCacheException does not occur, thus producing no proxy error (since the client is turned off).

RELEASE NOTES:

Fixes a bug in the new billing setup where billingToDb=no, generatePlots=true does not turn off the billing client and a TimeoutCacheException is returned since there is no database-based request service on the BillingCell side.