From 2b51cebb7e13fa118edc325ea6d47b4d119b8e29 Mon Sep 17 00:00:00 2001
From: Dave Casper <dcasper@uci.edu>
Date: Tue, 5 Feb 2019 16:06:03 -0800
Subject: [PATCH] Configure database lookup

---
 .../FaserAuthentication/CMakeLists.txt        | 50 +++++++++++++++++++
 ...erAuthenticationEnvironmentConfig.cmake.in | 15 ++++++
 .../FaserAuthentication/data/dblookup.xml     |  8 +++
 .../FaserAuthentication/data/dbreplica.config |  6 +++
 4 files changed, 79 insertions(+)
 create mode 100644 Database/ConnectionManagement/FaserAuthentication/CMakeLists.txt
 create mode 100644 Database/ConnectionManagement/FaserAuthentication/FaserAuthenticationEnvironmentConfig.cmake.in
 create mode 100644 Database/ConnectionManagement/FaserAuthentication/data/dblookup.xml
 create mode 100644 Database/ConnectionManagement/FaserAuthentication/data/dbreplica.config

diff --git a/Database/ConnectionManagement/FaserAuthentication/CMakeLists.txt b/Database/ConnectionManagement/FaserAuthentication/CMakeLists.txt
new file mode 100644
index 000000000..afedc76b3
--- /dev/null
+++ b/Database/ConnectionManagement/FaserAuthentication/CMakeLists.txt
@@ -0,0 +1,50 @@
+# $Id: CMakeLists.txt 720646 2016-01-29 14:01:10Z krasznaa $
+#
+# Build configuration for package AtlasAuthentication.
+#
+
+# Declare the package's name:
+atlas_subdir( FaserAuthentication )
+
+# If we are in release rebuilding mode, stop here:
+if( ATLAS_RELEASE_MODE )
+   return()
+endif()
+
+# Install the local file(s) of the package:
+atlas_install_xmls( data/*.xml )
+atlas_install_runtime( data/dbreplica.config )
+#atlas_install_scripts( share/setupLocalDBReplica_CERN.sh )
+
+# Find the ATLAS externals area:
+if( NOT SITEROOT )
+   if( ENV{SITEROOT} )
+      set( SITEROOT $ENV{SITEROOT} )
+   else()
+      set( SITEROOT "/afs/cern.ch" )
+   endif()
+endif()
+if( NOT FASER_EXTERNAL )
+   if( ENV{FASER_EXTERNAL} )
+      set( FASER_EXTERNAL $ENV{FASER_EXTERNAL} )
+   else()
+      set( FASER_EXTERNAL "${SITEROOT}/faser/offline/external" )
+   endif()
+endif()
+
+# Pick up authentication.xml:
+set( FaserAuthentication_native_version "v18" )
+set( FaserAuthentication_home
+   "${FASER_EXTERNAL}/FaserAuth/${FaserAuthentication_native_version}" )
+atlas_install_xmls( ${FaserAuthentication_home}/authentication.xml )
+
+# Configure the environment setup module:
+configure_file(
+   ${CMAKE_CURRENT_SOURCE_DIR}/FaserAuthenticationEnvironmentConfig.cmake.in
+   ${CMAKE_CURRENT_BINARY_DIR}/FaserAuthenticationEnvironmentConfig.cmake
+   @ONLY )
+
+# And now "find" it:
+set( FaserAuthenticationEnvironment_DIR ${CMAKE_CURRENT_BINARY_DIR}
+   CACHE PATH "Location of FaserAuthenticationEnvironmentConfig.cmake" )
+find_package( FaserAuthenticationEnvironment )
diff --git a/Database/ConnectionManagement/FaserAuthentication/FaserAuthenticationEnvironmentConfig.cmake.in b/Database/ConnectionManagement/FaserAuthentication/FaserAuthenticationEnvironmentConfig.cmake.in
new file mode 100644
index 000000000..82eb74c7d
--- /dev/null
+++ b/Database/ConnectionManagement/FaserAuthentication/FaserAuthenticationEnvironmentConfig.cmake.in
@@ -0,0 +1,15 @@
+# $Id: AtlasAuthenticationEnvironmentConfig.cmake.in 732717 2016-03-29 11:50:37Z krasznaa $
+#
+# This module is used to set up some environment variables for
+# using authentication correctly.
+#
+
+# Set the environment variables:
+set( FASERAUTHENTICATIONENVIRONMENT_ENVIRONMENT
+   FORCESET CORAL_AUTH_PATH
+   \${@CMAKE_PROJECT_NAME@_DIR}/@CMAKE_INSTALL_XMLDIR@/FaserAuthentication
+   FORCESET CORAL_DBLOOKUP_PATH
+   \${@CMAKE_PROJECT_NAME@_DIR}/@CMAKE_INSTALL_XMLDIR@/FaserAuthentication )
+
+# Silently declare the module found:
+set( FASERAUTHENTICATIONENVIRONMENT_FOUND TRUE )
diff --git a/Database/ConnectionManagement/FaserAuthentication/data/dblookup.xml b/Database/ConnectionManagement/FaserAuthentication/data/dblookup.xml
new file mode 100644
index 000000000..5c2e59b4f
--- /dev/null
+++ b/Database/ConnectionManagement/FaserAuthentication/data/dblookup.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" ?>
+<servicelist>
+
+<logicalservice name="FASERDD">
+ <service name="sqlite_file:data/geomDB_sqlite" accessMode="read" />
+</logicalservice>
+
+</servicelist>
diff --git a/Database/ConnectionManagement/FaserAuthentication/data/dbreplica.config b/Database/ConnectionManagement/FaserAuthentication/data/dbreplica.config
new file mode 100644
index 000000000..a3d53a19e
--- /dev/null
+++ b/Database/ConnectionManagement/FaserAuthentication/data/dbreplica.config
@@ -0,0 +1,6 @@
+# Configuration for DBReplicaSvc
+# lines are space-separated lists of domains, followed by = and list of 
+# Oracle servers (names as in tnsnames.ora file)
+# parser for this file is primative - all tokens must be separated by 1 space
+# autogenerated from TiersOfATLASCache.py - do not edit
+default = 
-- 
GitLab