Port billing indexer to Java 8

Mostly this patch is about using the new date API of Java 8.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7447/
alarms: Detach alarms appender on shutdown

Otherwise alarms may be attemped to be logged to a datasource that is
already shut down - this causes hanging shutdown issues, in particular
when alarms shares a domain with other services.

Target: trunk
Request: 2.11
Require-notes: yes
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: https://rb.dcache.org/r/7553/
alarms: Fix several resource leak and shutdown problems

- Fixes issues with transactions not being rolled back in case of
  failures.

- Fixes issues with shutting persistence manager factory while
  writing to it (caused JDO exceptions stating that there were
  still active transactions).

Note that the AppenderBase base class already checks whether the
appender is started and synchronizes on the object when calling
append().

Target: trunk
Request: 2.11
Require-notes: yes
Require-book: no
Acked-by: Albert Rossi <arossi@fnal.gov>
Patch: https://rb.dcache.org/r/7557/
pool: Simplify synchronization in nearline storage handler

To allow parallellizaation in nearline storage request creation,
2.11 introduced the use of a Guava Striped object to lock a part
of the request key space. This was necessary as we didn't want
to rely on Java 8 in dCache 2.11. With master now using Java 8,
the code can be simplified by using ConcurrentHashMap's ability
to compute the value to be inserted on demand when not already
present. The map imeplementation locks hash table buckets, which
is potentially more fine-grained as the Striped object used.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7559/
Fix typo in PnfsManager

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7564/
ftp: Some simple refactorings identified by IntelliJ

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: https://rb.dcache.org/r/7565/
spacemanager: Move dcache.enable.space-reservation to proper file

It was originally declared in spacemanager.properties because it inherited
from a now deprecated space manager property. Since that's no longer the
case, we may just as well move it to the "normal" place.

Target: trunk
Require-notes: no
Require-book: no
Acked-by: Paul Milar <paul.millar@desy.de>
Patch: https://rb.dcache.org/r/7576/
spacemanager: Fix null constraints and other schema migration issues

The old space manager allowed null values for several fields. According
to the code, these fields should not actually become null, however at
least one site reported seeing records with null values. Either this
is from an undetected bug in the old code or because older versions of
dCache created records with null values. Such null values cause the schema
migration to fail. This patch resolves the issue by adding a default value
for some of the null fields.

For the remanining fields that could be null in the schema but which shouldn't
be null, the patch adds an explicit check to instruct sites to contact us.

The patch also adds a check for site local computed indexes on expiration
time - at least one site had this.

Target: trunk
Request: 2.11
Request: 2.10
Request: 2.9
Request: 2.8
Require-notes: yes
Require-book: no
Ticket: http://rt.dcache.org/Ticket/Display.html?id=8567
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7579/
loginmanager: Fix leak caused by absent child limit

A regression in 2.8 causes the door to not track child removal if the
connection limit is set to -1. This causes the door to eventually run out of
memory.

Rather than just restoring the pre-2.8 logic, the patch causes the login
manager to track children regardless of the limit. Even when the child count
isn't needed and even when the list of children isn't published to a login
broker, there are other features in the login manager that rely on it (such as
keep alive).

Target: trunk
Request: 2.11
Request: 2.10
Request: 2.9
Request: 2.8
Require-notes: yes
Require-book: no
Ticket: http://rt.dcache.org/Ticket/Display.html?id=8570
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: https://rb.dcache.org/r/7585
ftp: fix help output

The HELP command was added to allow better interoperability with
ncftp and Globus clients.  Unfortunately, the output for 'SITE HELP'
and 'HELP SITE' was incorrect.

While ncftp proved robust against this bug (it wasn't detected
during previous testing) and Globus code is likely OK too, I
request back-porting so dCache output conforms with RFC 959.

Target: master
Patch: https://rb.dcache.org/r/7575/
Acked-by: Gerd Behrmann
Request: 2.11
Request: 2.10
Request: 2.9
dcap: Fix regression in published protocol family

Prior to 2.7, gsidcap was published as gsidcap and the SRM used this
as the protocol name when negotiating the transfer protocol. 2.7
always publishes 'dcap', which is a regression compared to 2.6.

This patch resolves the problem.

Target: trunk
Request: 2.11
Request: 2.10
Request: 2.9
Request: 2.8
Request: 2.7
Require-notes: yes
Require-book: no
Reported-by: Yvan Calas <yvan.calas@cc.in2p3.fr>
Acked-by: Paul Millar <paul.millar@desy.de>
Patch: https://rb.dcache.org/r/7587/
chimera-cli: fix chown

chown updates gid of a current directory instead of required file.

Acked-by: Paul Millar
Target: master, 2.11, 2.10
Require-book: no
Require-notes: no
nfs: show current proxy-io transfers in the door

Acked-by: Paul Millar
Target: master, 2.11, 2.10
Require-book: no
Require-notes: no
chimera: handle setattr on levels as on a regular files

Acked-by: Gerd Behrmann
Target: master
Require-book: no
Require-notes: no
shell: fix shell oracle for configuration keys with a space

The shell oracle is built to speed up POSIX shell querying of
configuration properties.  If the property key contains a
space then the resulting oracle is broken and prevents
any 'dcache' command from working.

Target: master
Patch: https://rb.dcache.org/r/7592/
Acked-by: Gerd Behrmann
Requires-book: no
Requires-notes: yes
Request: 2.11
Request: 2.10
Request: 2.9
Request: 2.8
Request: 2.7
Request: 2.6
Merge branch 'master' of https://github.com/dCache/dcache
pool: Fix typo that breaks pool.mover.ftp.allow-incoming-connections

Target: trunk
Require-notes: yes
Require-book: no
Request: 2.11
Request: 2.10
Request: 2.9
Request: 2.8
Request: 2.7
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7596/
ftp: Clean up address handling

Both the variable naming and how we compose various addresses is most
confusing. This patch tries to clean this up to make the logic easier to
follow.

There is also one behavioural change in how we determine the pool facing
interface for proxied data channels: If not set explicitly in the
configuration, before we defaulted to the control channel interface. Whether a
control channel is established on one or the other interface has absolutely no
relationship to which interface faces the pools, nor does establishing the
control channel on a different interface suddently make the pools available on
another interface. Hence this patch changes this to default to the default
interface of the host (as determined by resolving the host name).

Target: trunk
Require-notes: yes
Require-book: no
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7594/
pool: Partially fix interface selection for FTP mover

The FTP mover tries to select an interface with the correct
protocol family and falls back to proxy mode if not possible.
Unfortunately the NetworkUtils utility class fails to return
null in case no suitable interface could be found.

On the other hand, the original protocol family less version
of the NetworkUtils method fails to handle null values.

This patch fixes the former to return null if the protocol
family could not be match, and fixes the latter by falling
back to ignoring the protocol family. The latter is likely
wrong, but it restore the previous functionality and resolves
the problem that existing callers of that method do not
handle a null return value.

There are plenty of issues with this piece of code. This
patch only sets out to fix the one.

Target: trunk
Require-notes: yes
Require-book: no
Request: 2.11
Request: 2.10
Request: 2.9
Acked-by: Paul Millar <paul.millar@desy.de>
Acked-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
Patch: https://rb.dcache.org/r/7597/
chimera: do not shutdown jdbc dataSource on close

Acked-by: Gerd Behrmann
Target: master
Require-book: no
Require-notes: no