001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2014-2015 ForgeRock AS. 015 */ 016 017package org.forgerock.openig.config; 018 019import java.io.File; 020 021/** 022 * Encapsulate logic to access configuration files and other directories of the OpenIG base directory. 023 * A typical structure may looks like the following: 024 * <pre> 025 * {@code 026 * config/config.json 027 * scripts/groovy/**.groovy 028 * tmp/ 029 * } 030 * </pre> 031 * 032 * This interface provides an abstraction over the directory layout to protect against changes of naming, ... 033 */ 034public interface Environment { 035 036 /** 037 * Returns the base directory of the OpenIG file system. 038 * It can be used to access resources that are not part of the standard layout. 039 * @return the base directory of the OpenIG file system. 040 */ 041 File getBaseDirectory(); 042 043 /** 044 * Returns the temporary directory of OpenIG (where we have read+write permissions). 045 * It usually points to the {@literal tmp/} directory. 046 * @return the working directory. 047 */ 048 File getTempDirectory(); 049 050 /** 051 * Returns the directory that contains the files of the given type. It 052 * usually points to the {@literal scripts/<type>/} directory. 053 * 054 * @param type 055 * script's type (could be {@literal groovy} or {@literal js}) 056 * @return the scripting directory. 057 */ 058 File getScriptDirectory(String type); 059 060 /** 061 * Returns the directory that contains the configuration files. 062 * It usually points to the {@literal config/} directory. 063 * @return the configuration directory. 064 */ 065 File getConfigDirectory(); 066 067}