srm: Fix NPE and timer thread kill when restoring jobs

Fixes the fulling bug:

07 Nov 2013 10:11:35 (SRM-gonzo) [] Uncaught exception in thread Job expiration
java.lang.NullPointerException: null
        at org.dcache.srm.request.GetRequest.stateChanged(GetRequest.java:248) ~[srm-server-2.7.0~ndgf2.jar:2.7.0~ndgf2]
        at org.dcache.srm.request.Job.setState(Job.java:361) ~[srm-server-2.7.0~ndgf2.jar:2.7.0~ndgf2]
        at org.dcache.srm.request.Job.setState(Job.java:321) ~[srm-server-2.7.0~ndgf2.jar:2.7.0~ndgf2]
        at org.dcache.srm.request.Job.checkExpiration(Job.java:815) ~[srm-server-2.7.0~ndgf2.jar:2.7.0~ndgf2]
        at org.dcache.srm.scheduler.SharedMemoryCacheJobStorage$ExpirationTask.run(SharedMemoryCacheJobStorage.java:175) ~[srm-server-2.7.0~ndgf2.jar:2.7.0~ndgf2]
        at java.util.TimerThread.mainLoop(Timer.java:555) ~[na:1.7.0_45]
        at java.util.TimerThread.run(Timer.java:505) ~[na:1.7.0_45]

The exception kills the timer thread. This is fixed by this patch. The patch
also fixes the NPE itself. It is unknown why exactly some file requests
cannot be found in the database, but I suspect that old file requests are
removed concurrently.

Target: trunk
Require-notes: no
Require-book: no
Request: 2.7
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6215/
doors: Allow loginbroker property to be empty

It should be possible to not register with any loginbroker.

Target: trunk
Require-notes: no
Require-book: no
Request: 2.7
Acked-by: Dmitry Litvintsev <litvinse@fnal.gov>
Patch: http://rb.dcache.org/r/6219/
deb: Include cron job for billing compression and indexing

Target: trunk
Request: 2.7
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6216/
info-provider: Fix regression caused by info-provider using a deprecated property

Introduces the new property 'info-provider.http.port', which defines
the TCP port the info-provider will contact the httpd service on.

Sites that previously relied on redefining httpdPort will have to
set this new info-provider property.

Also fixed a bug that caused the HTTP_PORT and HTTP_HOST environment
variables to be ignored by the info-provider.

Target: trunk
Require-notes: no
Require-book: no
Request: 2.7
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6217/
srm: Fix regression in srmGetSpaceMetaData

The spec is not precise about what file requests level statuses should
be considered a non-success return code for the srmGetSpaceMetaData
operation itself. It seems however logical to not consider
space-lifetime-expired and exceeded-allocation as failures of the
getSpaceMetaData operation.

Atlas transfers currently fail at NDGF due to this problem.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6218/
srm: Fix space expiration check in space query

Target: trunk
Require-notes: no
Require-book: no
Request: 2.7
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6220/
    chimera: fix handling of bytea data in path2inode and path2inodes stored procedures

    when migrating from 8.4 to 9.2 postgresql it was noticed that assigning of bytea data
    to varchar produced unexpected result due to bytea_output='hex' as default in postgresql 9.2
    This patch addresses it by calling encode(ifiledata,'escape') before assigning it to
    varchar variables

    Ticket: #number
    Acked-by: Paul Millar, Tigra Mkrtchyan
    Target: trunk
    Request: 2.2
    Request: 2.6
    Request: 2.7
    Require-book: no
    Require-notes: no
info-provider: Fix publishing of SRM

When srm-loginbroker was removed as a service, publishing the
srm to loginbroker was altered to publish the family name as
'srm' rather than 'SRM'. This is in line with our other doors,
but I was unaware that info-provider checks for this particular
string and that the check is case sensitive.

This patch updates info-provider to check for the lower case
string.

Target: trunk
Request: 2.7
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6222/
srm: Improve error message on file_busy and duplication_errors

I think these messages are more to the point. The duplication error
message is taken from the SRM spec.

Target: trunk
Request: 2.7
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: http://rb.dcache.org/r/6223/
libs: update to nfs4j-0.6.2

Changelog for nfs4j-0.6.1..nfs4j-0.6.2
    * [2f24baa] nfsv3: fix creation of symbolic link

Acked-by: Albert Rossi
Target: master, 2.7
Require-book: no
Require-notes: no
srm: Add an access log

Adds an access log to the SRM. The access log writes a line to
/var/log/dcache/access-DOMAIN.log for each SRM access. The log
is rotated once a day and kept for 30 days. Log level and age
can be adjusted through the new properties dcache.log.level.access
and dcache.log.access.max-history. Currently only the SRM supports
this log file, but it is invisioned that other doors could
produce similar logs. Note that an access log file is generated
for every domain, but only domains with an srm service will write
anything to the file. The log format follows the NetLogger format.
Currently, only SRM v2 requests are logged.  IMPORTANT: To allow
dcache to generate the log file the /var/log/dcache directory will
be changed to dcache upon upgrade.

We have regularly found ourselves in the position of not knowing
whether some particular problem is to be attributed to the client
or the server. An access log which for each SRM request shows
some basic information would help alot in such situations.

I tried to keep the format generic enough that we could implement
similar functionality for other doors. Therefore I chose the
NetLogger format. The Common Logging Format used by web servers
does not apply to the kind of informatio I want to log.

The fields to be logged are a tradeoff between logging something
that is useful, but without logging too much or to log something
that can readily be extracted from the SRM database. Hence I
log client IP, DN, session, request method, request token if
available, surl if request token is not available, the return
status and the user-agent. More detailed information about
requests can often be found by looking up the request using the
request token.

Note that I had a change of heart regarding overship of the log
directory. I have always insisted on the directory to not be
writable by the dcache user, but concluded it is just too much
trouble for the default setup. A site that wants the extra
protection against log tampering can still customize their
setup. Our new default is no different from how other services
are setup by default on various distros. As a consequence of
that change I have also moved the events log to the log directory.
The events log too uses a rolling appender, but with a history
of 0 days (so it should delete log files after one day).

I adjusted the name of the events logger such that it too is
placed under the org.dcache hierarchy. Finally I adjusted the
timestamp to include the timezone (per NetLogger recomendations).

A few SRM status codes have been reclassified to not be errors.

The srmLs implementation has been altered to return a request
token no matter what. This is useful no matter whether the request
is processed synchronously or asynchronously as it bind the request
to the request identifier used in the database. I also remove
a useless status string for the ls implementation that I found
while looking at the access log output.

Target: trunk
Request: 2.7
Require-notes: yes
Require-book: yes
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6226/
Fix build failure in EventLogger class.

Target: trunk
Request: 2.7
Require-notes: no
Require-book: no
Patch: none
spacemanager: Fix S2 usecase.CheckGarbageSpaceCollector regression

S2 insists that a space expires immediately as soon as its lifetime
has passed. This conflicts with the lazy expiration implemented by
the spacemanager. The SRM used to have a workaround for this, but
that workaround was recently removed.

This patch adds a check to space manager that will report the state
as expired once the lifetime has been exceeded.

Target: trunk
Request: 2.7
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6227/
xrootd: Upgrade to xrootd4j 1.2.2

Fixes compatibility issues with xrootd plugins.

Target: trunk
Request: 2.7
Request: 2.6
Require-notes: yes
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6233
commons: make use try-with-resource in couters

Acked-by: Paul Millar
Target: master
Require-book: no
Require-notes: no
Fixed typo in logback configuration

Target: trunk
Request: 2.7
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: http://rb.dcache.org/r/6234/