//and the device on which data directorties existied has
//failed and user is trying to restore it some other device.
try
{
if( AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run()
throws IOException, StandardException, InstantiationException, IllegalAccessException
{
StorageFactory storageFactory
= privGetStorageFactoryInstance( true, serviceName, null, null);
try
{
StorageFile serviceDirectory = storageFactory.newStorageFile( null);
return serviceDirectory.exists() ? this : null;
}
finally {storageFactory.shutdown();}
}
}
) == null)
{
createRoot =true;
deleteExistingRoot = false;
}
}
catch( PrivilegedActionException pae)
{
throw Monitor.exceptionStartingModule( (IOException) pae.getException());
}
}
}
}
//restore the service properties from backup
if(restoreFrom != null)
{
//First make sure backup service directory exists in the specified path
File backupRoot = new File(restoreFrom);
if (fileExists(backupRoot))
{
//First make sure backup have service.properties
File bserviceProp = new File(restoreFrom, PersistentService.PROPERTIES_NAME);
if(fileExists(bserviceProp))
{
//create service root if required
if(createRoot)
createServiceRoot(serviceName, deleteExistingRoot);
try
{
AccessController.doPrivileged(
new PrivilegedExceptionAction()
{
public Object run()
throws IOException, StandardException, InstantiationException, IllegalAccessException
{
WritableStorageFactory storageFactory =