/*
 * Copyright 2014 hbz NRW (http://www.hbz-nrw.de/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package models;

import play.Play;
import archive.fedora.ApplicationProfile;
import archive.fedora.FedoraFactory;
import archive.fedora.FedoraInterface;
import archive.search.SearchFacade;

/**
 * Global Settings and accessors for Elasticsearch and Fedora
 * 
 * @author Jan Schnasse
 *
 */
public class Globals {

    /**
     * the server that hosts this app
     */
    public static String server = Play.application().configuration()
	    .getString("regal-api.serverName");

    /**
     * the server to where urns should point
     */
    public static String urnbase = Play.application().configuration()
	    .getString("regal-api.urnbase");

    /**
     * The Elasticsearch cluster
     */
    public static String escluster = Play.application().configuration()
	    .getString("regal-api.escluster");

    /**
     * An internal address available for requests from localhost
     */
    public static String fedoraIntern = Play.application().configuration()
	    .getString("regal-api.fedoraIntern");

    /**
     * A document to configure elasticsearch indexes used by this application
     */
    public static String contextDocument = "public-index-config.json";

    /**
     * a list of namespaces to create indexes for
     */
    public static String[] namespaces = Play.application().configuration()
	    .getString("regal-api.namespace").split("\\s*,[,\\s]*");

    /**
     * defines how objects will be referenced internally
     */
    public static boolean useHttpUris = false;

    /**
     * password to access fedora
     */
    public static String fedoraPassword = Play.application().configuration()
	    .getString("regal-api.fedoraUserPassword");
    /**
     * user to access fedora
     */
    public static String fedoraUser = Play.application().configuration()
	    .getString("regal-api.fedoraUser");

    /**
     * A config file for elasticsearch. Must be located at conf/ directory
     */
    public static String elasticsearchSettings = "public-index-config.json";

    /**
     * a globally available entry to elasticsearch
     */
    public static SearchFacade search = new SearchFacade(Globals.escluster,
	    Globals.namespaces);

    /**
     * a globally available entry to Fedora
     */
    public static FedoraInterface fedora = FedoraFactory.getFedoraImpl(
	    Globals.fedoraIntern, Globals.fedoraUser, Globals.fedoraPassword);

    /**
     * labels etc.
     */
    public static ApplicationProfile profile = new ApplicationProfile();

    /**
     * defines a protocol used by this app
     */
    public static String protocol = "http://";

    /**
     * if true the application will log a timestamp every 5 sec.
     */
    public static boolean heartbeatOn = Boolean.parseBoolean(Play.application()
	    .configuration().getString("regal-api.heartbeatOn"));

    public static String urnResolverAdress = Play.application().configuration()
	    .getString("regal-api.urnResolverAdress");
    public static String oaiMabXmlAdress = Play.application().configuration()
	    .getString("regal-api.oaiMabXmlAdress");
    public static String alephAdress = Play.application().configuration()
	    .getString("regal-api.alephAdress");
    public static String lobidAdress = Play.application().configuration()
	    .getString("regal-api.lobidAdress");
    public static String digitoolAdress = Play.application().configuration()
	    .getString("regal-api.digitoolAdress");

    public static final String PDFBOX_OCR_TYPE = "pdfbox-ocr";

    /**
     * prefix for fulltext index
     */
    public static final String PDFBOX_OCR_INDEX_PREF = "fulltext_";

    public static final String PUBLIC_INDEX_PREF = "public_";

}

@@ -3434,24 +3434,99 @@
 beatOn%22));%0A%0A
+    /**%0A     * Urn resolver used for testing urn resolving%0A     * %0A     */%0A
     public s
@@ -3633,32 +3633,125 @@
 solverAdress%22);%0A
+    /**%0A     * Adress of oai provider to test if mabxml is provided properly%0A     * %0A     */%0A
     public stati
@@ -3850,32 +3850,105 @@
 MabXmlAdress%22);%0A
+    /**%0A     * Catalog address to test if resource is in catalog%0A     */%0A
     public stati
@@ -4039,32 +4039,101 @@
 .alephAdress%22);%0A
+    /**%0A     * Lobid address to test if resource is in lobid%0A     */%0A
     public stati
@@ -4228,24 +4228,103 @@
 idAdress%22);%0A
+    /**%0A     * Digitool address to link back to old digitool resources%0A     */%0A
     public s
@@ -4430,24 +4430,93 @@
 lAdress%22);%0A%0A
+    /**%0A     * The type for fulltext-extracts made by pdfbox%0A     */%0A
     public s
@@ -4681,24 +4681,79 @@
 ulltext_%22;%0A%0A
+    /**%0A     * prefix used for public es index%0A     */%0A
     public s

add comments