| | |
| | | /** |
| | | * The license file name in Legal directory. |
| | | */ |
| | | private final static String LICENSE_FILE_NAME = "license_to_accept.txt"; |
| | | private static final String LICENSE_FILE_NAME = "license_to_accept.txt"; |
| | | |
| | | /** |
| | | * The Legal folder which contains license file. |
| | | */ |
| | | private final static String LEGAL_FOLDER_NAME = "Legal"; |
| | | private static final String LEGAL_FOLDER_NAME = "Legal"; |
| | | |
| | | /** |
| | | * The accepted license file name. |
| | | */ |
| | | private final static String ACCEPTED_LICENSE_FILE_NAME = "licenseAccepted"; |
| | | private static final String ACCEPTED_LICENSE_FILE_NAME = "licenseAccepted"; |
| | | |
| | | /** |
| | | * Get the directory in which legal files are stored. |
| | |
| | | /** |
| | | * The File object related to the license file. |
| | | */ |
| | | static private File licFile; |
| | | private static File licFile; |
| | | |
| | | /** |
| | | * The license file approval state. |
| | | */ |
| | | static private boolean approved; |
| | | private static boolean approved; |
| | | |
| | | /** |
| | | * Returns the license file name. |
| | | */ |
| | | static private String getName() |
| | | private static String getName() |
| | | { |
| | | return getInstanceLegalDirectory() + File.separatorChar |
| | | + LICENSE_FILE_NAME; |
| | |
| | | /** |
| | | * Returns the license file object. |
| | | */ |
| | | static private File getFile() |
| | | private static File getFile() |
| | | { |
| | | if (licFile == null) |
| | | { |
| | | licFile = new File(getName()); |
| | | } |
| | | |
| | | return licFile; |
| | | } |
| | | |
| | | /** |
| | | * Returns the URL to the license file when using jnlp / java web start. |
| | | */ |
| | | static private URL getWebStartLicenseFile() |
| | | private static URL getWebStartLicenseFile() |
| | | { |
| | | final String licenseResource = |
| | | LEGAL_FOLDER_NAME + File.separatorChar + LICENSE_FILE_NAME; |
| | |
| | | * in the top level installation directory <CODE>false</CODE> |
| | | * otherwise. |
| | | */ |
| | | static public boolean exists() |
| | | public static boolean exists() |
| | | { |
| | | if (Utils.isWebStart()) |
| | | { |
| | | return (getWebStartLicenseFile() != null); |
| | | return getWebStartLicenseFile() != null; |
| | | } |
| | | else |
| | | { |
| | |
| | | * |
| | | * @return the textual contents of the license file. |
| | | */ |
| | | static public String getText() |
| | | public static String getText() |
| | | { |
| | | InputStream input = null; |
| | | // Gets the inputstream of the license |
| | |
| | | * @return <CODE>true</CODE> if the license has been accepted by the user |
| | | * <CODE>false</CODE> otherwise. |
| | | */ |
| | | static public boolean getApproval() |
| | | public static boolean getApproval() |
| | | { |
| | | return approved; |
| | | } |
| | |
| | | * @param p_approved |
| | | * the license approval status |
| | | */ |
| | | static public void setApproval(boolean p_approved) |
| | | public static void setApproval(boolean p_approved) |
| | | { |
| | | approved = p_approved; |
| | | } |
| | |
| | | * @param installationPath |
| | | * The server installation's path. |
| | | */ |
| | | static public void createFileLicenseApproved(final String installationPath) |
| | | public static void createFileLicenseApproved(final String installationPath) |
| | | { |
| | | if (getApproval() && installationPath != null) |
| | | { |
| | |
| | | * @return <CODE>true</CODE> if the license had already been approved by the |
| | | * user <CODE>false</CODE> otherwise. |
| | | */ |
| | | static public boolean isAlreadyApproved() |
| | | public static boolean isAlreadyApproved() |
| | | { |
| | | final File f = |
| | | new File(getInstanceLegalDirectory() + File.separatorChar |