EnvManager.java revision f0a048d41a13eca4cba405da9403c2469ca3d1ea
/*
* 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-2009 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* A singleton class to manage the life-cycle of a JE database environment.
*/
public class EnvManager
{
/**
* A filename filter to match all kinds of JE files.
*/
private static final FilenameFilter jeAllFilesFilter;
static
{
// A filename filter to match all kinds of JE files.
// JE has a com.sleepycat.je.log.JEFileFilter that would be useful
// here but is not public.
jeAllFilesFilter = new FilenameFilter()
{
{
}
};
}
/**
* Creates the environment home directory, deleting any existing data files
* if the directory already exists.
* The environment must not be open.
*
* @param homeDir The backend home directory.
* @throws JebException If an error occurs in the JE backend.
*/
throws JebException
{
{
if (!dir.isDirectory())
{
}
}
else
{
try
{
}
catch (Exception e)
{
logger.traceException(e);
}
}
}
/**
* Deletes all the data files associated with the environment.
* The environment must not be open.
*
* @param homeDir The backend home directory
* @throws JebException If an error occurs in the JE backend or if the
* specified home directory does not exist.
*/
throws JebException
{
{
throw new JebException(message);
}
if (!dir.isDirectory())
{
}
try
{
{
f.delete();
}
}
catch (Exception e)
{
logger.traceException(e);
}
}
}