this.accessor = init("SCFS", false, clientId);
noCacheDis = new NoCacheDirectoryService(clientId, accessor);
this.directoryService = new MetadataCacheOnSyncDirectoryService(noCacheDis);
}else{
SecretKey k = null;
this.directoryService = new NoSharingDirectoryService(disId, k, false);
}
//init PNS
if(config.isNonSharing()){
namespace = new NoSharingDirectoryService("", null, true);
}else{
try {
namespaceStats = directoryService.getPrivateNameSpaceMetadata();
} catch (DirectoryServiceException e) {
try {
String pathId = getNextIdPath();
SecretKey key = MyAESCipher.generateSecretKey();
namespaceStats = new PrivateNameSpaceStats(pathId, key);
directoryService.putPrivateNameSpaceMetadata(clientId, namespaceStats);
} catch (DirectoryServiceException e1) {
e1.printStackTrace();
if(e1 instanceof DirectoryServiceConnectionProblemException)
System.out.println("Cannot create the private namespace metadata");
} catch (Exception e1) { e1.printStackTrace(); }
}
namespace = new NoSharingDirectoryService(namespaceStats.getIdPath(), namespaceStats.getKey(), true);
}
DirectoryService redirect = new DirectoryServiceRedirect(clientId, directoryService, namespace);
this.lockService = new LockService(accessor, clientId);