LicenseFile.java revision 0e73432880f7c3bb60300bb00625772bef37e4b5
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2013-2015 ForgeRock AS.
*/
/**
* Represents information about the license file.
*
* NOTE: the license file location must be kept in sync with build.xml and
* org.opends.quicksetup.LicenseFile.
*/
class LicenseFile
{
/**
* The license file name in Legal directory.
*/
/**
* The Legal folder which contains license file.
*/
/** List of possible folder of the accepted license file. */
private static final String[] ACCEPTED_LICENSE_FOLDER_NAMES = new String[] { LEGAL_FOLDER_NAME, "Legal" };
/**
* The accepted license file name.
*/
/**
* Try to find the local instance path from system property or environment. If
* both are null, return the provided fallback value.
*/
{
{
{
return value;
}
}
return fallBackValue;
}
/** Get the directory in which legal files are stored. */
private static String getLegalDirectory()
{
}
/**
* Get the directory in which legal files are stored.
*/
private static String getInstanceLegalDirectory()
{
final String instanceDirname = UpgradeUtils.getInstancePathFromInstallPath(getInstanceRootPathFromSystem("."));
if (!instanceLegalDir.exists())
{
}
return instanceLegalDirName;
}
/**
* The File object related to the license file.
*/
/**
* The license file approval state.
*/
private static boolean approved;
/**
* Returns the license file name.
*/
{
}
/**
* Returns the license file object.
*/
{
{
}
return licFile;
}
/**
* Checks if the license file exists.
*
* @return <CODE>true</CODE> a license file exists in
* the Legal directory in the top level installation directory
* <CODE>false</CODE> otherwise.
*/
static boolean exists()
{
}
/**
* Get the textual contents of the license file.
*
* @return the textual contents of the license file.
*/
{
try
{
}
catch (Exception e)
{
return "";
}
try
{
}
catch (IOException ioe)
{
}
finally
{
}
}
/**
* Get the license approval status.
*
* @return <CODE>true</CODE> if the license has been accepted by the user
* <CODE>false</CODE> otherwise.
*/
static boolean getApproval()
{
return approved;
}
/**
* Sets the license approval status.
*
* @param p_approved
* the license approval status
*/
static void setApproval(boolean p_approved)
{
}
/**
* Create a file which indicates that the license has been approved.
*/
static void createFileLicenseApproved()
{
if (getApproval())
{
try
{
}
catch (IOException e)
{
}
}
}
/**
* Indicate if the license had already been approved..
*
* @return <CODE>true</CODE> if the license had already been approved by the
* user <CODE>false</CODE> otherwise.
*/
public static boolean isAlreadyApproved()
{
{
if (f.exists())
{
return true;
}
}
return false;
}
}