return;
addUser();
if (!exists())
throw new OStorageException("Can't open the storage '" + name + "' because it not exists in path: " + url);
level2cache.startup();
open = true;
// OPEN BASIC SEGMENTS
int pos;
pos = registerDataSegment(new OStorageDataConfiguration(configuration, OStorage.DATA_DEFAULT_NAME));
dataSegments[pos].open();
pos = createClusterFromConfig(new OStoragePhysicalClusterConfiguration(configuration, OStorage.CLUSTER_INTERNAL_NAME,
clusters.length));
clusters[pos].open();
configuration.load();
pos = createClusterFromConfig(new OStoragePhysicalClusterConfiguration(configuration, OStorage.CLUSTER_INDEX_NAME,
clusters.length));
clusters[pos].open();
defaultClusterId = createClusterFromConfig(new OStoragePhysicalClusterConfiguration(configuration,
OStorage.CLUSTER_DEFAULT_NAME, clusters.length));
clusters[defaultClusterId].open();
// REGISTER DATA SEGMENT
OStorageDataConfiguration dataConfig;
for (int i = 0; i < configuration.dataSegments.size(); ++i) {
dataConfig = configuration.dataSegments.get(i);
pos = registerDataSegment(dataConfig);
if (pos == -1) {
// CLOSE AND REOPEN TO BE SURE ALL THE FILE SEGMENTS ARE
// OPENED
dataSegments[i].close();
dataSegments[i] = new ODataLocal(this, dataConfig, pos);
dataSegments[i].open();
} else
dataSegments[pos].open();
}
// REGISTER CLUSTER
OStorageClusterConfiguration clusterConfig;
for (int i = 0; i < configuration.clusters.size(); ++i) {
clusterConfig = configuration.clusters.get(i);
if (clusterConfig != null) {
pos = createClusterFromConfig(clusterConfig);
if (pos == -1) {
// CLOSE AND REOPEN TO BE SURE ALL THE FILE SEGMENTS ARE
// OPENED
clusters[i].close();
clusters[i] = new OClusterLocal(this, (OStoragePhysicalClusterConfiguration) clusterConfig);
clusterMap.put(clusters[i].getName(), clusters[i]);
clusters[i].open();
} else {
if (clusterConfig.getName().equals(OStorage.CLUSTER_DEFAULT_NAME))
defaultClusterId = pos;
clusters[pos].open();
}
}
}
loadVersion();
txManager.open();
} catch (Exception e) {
open = false;
dataSegments = new ODataLocal[0];
clusters = new OCluster[0];
clusterMap.clear();
throw new OStorageException("Can't open local storage: " + url + ", with mode=" + mode, e);
} finally {
lock.releaseExclusiveLock(locked);
OProfiler.getInstance().stopChrono("storage." + name + ".open", timer);
}