|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.derby.impl.services.monitor.StorageFactoryService
final class StorageFactoryService
This class implements the PersistentService interface using a StorageFactory class. It handles all subSubProtocols except for cache.
| Nested Class Summary | |
|---|---|
(package private) class |
StorageFactoryService.DirectoryList
|
private static class |
StorageFactoryService.FileOperationHelper
Helper class for common file operations on the service properties files. |
| Field Summary | |
|---|---|
private java.lang.String |
canonicalHome
|
private java.lang.String |
home
|
private StorageFactory |
rootStorageFactory
|
private char |
separatorChar
|
private static java.lang.String |
SERVICE_PROPERTIES_EOF_TOKEN
Marker printed as the last line of the service properties file. |
private java.lang.Class |
storageFactoryClass
|
private java.lang.String |
subSubProtocol
|
| Fields inherited from interface org.apache.derby.iapi.services.monitor.PersistentService |
|---|
CLASSPATH, DB_README_FILE_NAME, DIRECTORY, HTTP, HTTPS, INMEMORY, JAR, PROPERTIES_NAME, ROOT, TYPE |
| Constructor Summary | |
|---|---|
StorageFactoryService(java.lang.String subSubProtocol,
java.lang.Class storageFactoryClass)
|
|
| Method Summary | |
|---|---|
void |
createDataWarningFile(StorageFactory sf)
Put a readme file in database directory which will caution users against touching any files in the directory. |
java.lang.String |
createServiceRoot(java.lang.String name,
boolean deleteExisting)
Properties cannot be saved |
private boolean |
fileExists(java.io.File file)
Checks if the specified file exists. |
java.util.Enumeration |
getBootTimeServices()
Return a list of all the directoies in the system directory. |
java.lang.String |
getCanonicalServiceName(java.lang.String name)
Convert a service name into its canonical form. |
private java.lang.String |
getDirectoryPath(java.lang.String name)
|
private static java.lang.String |
getMostAccuratePath(StorageFile file)
Helper method returning the "best-effort-most-accurate" path. |
private java.lang.String |
getProtocolLeadIn()
Returns the protocol lead in for this service. |
java.util.Properties |
getServiceProperties(java.lang.String serviceName,
java.util.Properties defaultProperties)
Open the service properties in the directory identified by the service name. |
java.lang.Class |
getStorageFactoryClass()
Get the StorageFactory implementation for this PersistentService |
StorageFactory |
getStorageFactoryInstance(boolean useHome,
java.lang.String databaseName,
java.lang.String tempDirName,
java.lang.String uniqueName)
Get an initialized StorageFactoryInstance |
java.lang.String |
getType()
The type of the service is 'directory' |
java.lang.String |
getUserServiceName(java.lang.String serviceName)
Return the user form of a service name. |
boolean |
hasStorageFactory()
|
boolean |
isSameService(java.lang.String serviceName1,
java.lang.String serviceName2)
|
private StorageFactory |
privGetStorageFactoryInstance(boolean useHome,
java.lang.String databaseName,
java.lang.String tempDirName,
java.lang.String uniqueName)
|
protected java.lang.String |
recreateServiceRoot(java.lang.String serviceName,
java.util.Properties properties)
|
boolean |
removeServiceRoot(java.lang.String serviceName)
Remove a service's root and its contents. |
private void |
resolveServicePropertiesFiles(StorageFactory sf,
StorageFile spf)
Resolves situations where a failure condition left the service properties file, and/or the service properties file backup, in an inconsistent state. |
void |
saveServiceProperties(java.lang.String serviceName,
java.util.Properties properties)
Save service.properties during backup |
void |
saveServiceProperties(java.lang.String serviceName,
StorageFactory sf,
java.util.Properties properties,
boolean replace)
|
private void |
vetService(StorageFactory storageFactory,
java.lang.String serviceName)
Verify that the service directory looks ok before objecting that the database already exists. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String SERVICE_PROPERTIES_EOF_TOKEN
private java.lang.String home
private java.lang.String canonicalHome
private final java.lang.String subSubProtocol
private final java.lang.Class storageFactoryClass
private StorageFactory rootStorageFactory
private char separatorChar
| Constructor Detail |
|---|
StorageFactoryService(java.lang.String subSubProtocol,
java.lang.Class storageFactoryClass)
throws StandardException
StandardException| Method Detail |
|---|
public boolean hasStorageFactory()
hasStorageFactory in interface PersistentService
public StorageFactory getStorageFactoryInstance(boolean useHome,
java.lang.String databaseName,
java.lang.String tempDirName,
java.lang.String uniqueName)
throws StandardException,
java.io.IOException
getStorageFactoryInstance in interface PersistentServiceuseHome - If true and the database name is not absolute then the database directory will be
relative to the home directory, if one is defined in the properties file.databaseName - The name of the database (directory). The name does not include the subSubProtocol.
If null then the storage factory will only be used to deal with the directory containing
the databases.tempDirName - The name of the temporary file directory set in properties. If null then a default
directory should be used. Each database should get a separate temporary file
directory within this one to avoid collisions.uniqueName - A unique name that can be used to create the temporary file directory for this database.
If null then temporary files will not be created in this StorageFactory instance.
java.io.IOException - if create, the database directory does not exist, and it cannot be created;
if !create and the database does not exist as a directory.
StandardException
private StorageFactory privGetStorageFactoryInstance(boolean useHome,
java.lang.String databaseName,
java.lang.String tempDirName,
java.lang.String uniqueName)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.io.IOException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.io.IOExceptionpublic java.lang.String getType()
getType in interface PersistentServicePersistentService.getType()public java.util.Enumeration getBootTimeServices()
getBootTimeServices in interface PersistentServicePersistentService.getBootTimeServices()
public java.util.Properties getServiceProperties(java.lang.String serviceName,
java.util.Properties defaultProperties)
throws StandardException
getServiceProperties in interface PersistentServiceStandardException - Service appears valid but the properties cannot be created.
public void saveServiceProperties(java.lang.String serviceName,
StorageFactory sf,
java.util.Properties properties,
boolean replace)
throws StandardException
saveServiceProperties in interface PersistentServiceStandardException - Properties cannot be saved.
public void createDataWarningFile(StorageFactory sf)
throws StandardException
PersistentService
createDataWarningFile in interface PersistentServicesf - StorageFactory will be used to create the file
StandardException - File can't be createdPersistentService.createDataWarningFile(org.apache.derby.io.StorageFactory)
public void saveServiceProperties(java.lang.String serviceName,
java.util.Properties properties)
throws StandardException
saveServiceProperties in interface PersistentServiceserviceName - backup location of the serviceproperties - the properties to save
StandardException - Properties cannot be saved.
private void resolveServicePropertiesFiles(StorageFactory sf,
StorageFile spf)
throws StandardException
Note that this method doesn't resolve the situation where both the current service properties file and the backup file are missing.
sf - the storage factory for the servicespf - the service properties file
StandardException - if a file operation on a service properties
file fails
protected java.lang.String recreateServiceRoot(java.lang.String serviceName,
java.util.Properties properties)
throws StandardException
StandardException
public java.lang.String createServiceRoot(java.lang.String name,
boolean deleteExisting)
throws StandardException
createServiceRoot in interface PersistentServiceStandardException - Service root cannot be created.
private void vetService(StorageFactory storageFactory,
java.lang.String serviceName)
throws StandardException
StandardExceptionprivate java.lang.String getDirectoryPath(java.lang.String name)
public boolean removeServiceRoot(java.lang.String serviceName)
PersistentService
removeServiceRoot in interface PersistentService
public java.lang.String getCanonicalServiceName(java.lang.String name)
throws StandardException
PersistentService
getCanonicalServiceName in interface PersistentServiceStandardExceptionpublic java.lang.String getUserServiceName(java.lang.String serviceName)
PersistentService
getUserServiceName in interface PersistentService
public boolean isSameService(java.lang.String serviceName1,
java.lang.String serviceName2)
isSameService in interface PersistentServiceprivate final boolean fileExists(java.io.File file)
file - the file to check
true if the file exists, false if not.
java.lang.SecurityException - if the required privileges are missingpublic java.lang.Class getStorageFactoryClass()
private java.lang.String getProtocolLeadIn()
private static java.lang.String getMostAccuratePath(StorageFile file)
file - the file to get the path to
File.getCanonicalPath or
File.getPath.
|
Built on Wed 2013-06-12 15:21:56+0000, from revision ??? | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||