use of org.apache.felix.cm.file.EncryptingPersistenceManager in project fabric8 by jboss-fuse.
the class EncryptedPropertyResolver method initialize.
/**
* When {@link FabricService} becomes available, we can initialize this {@link PlaceholderResolver}
* @param fabricService
*/
public void initialize(FabricService fabricService) {
this.fabricService = fabricService;
encryptor = getEncryptor(fabricService);
if (bundleContext != null) {
seRegistration = bundleContext.registerService(PBEStringEncryptor.class, encryptor, null);
BundleContext context = FrameworkUtil.getBundle(PersistenceManager.class).getBundleContext();
encryptingPersistenceManager = new EncryptingPersistenceManager(context, context.getProperty(ConfigurationManager.CM_CONFIG_DIR), encryptor);
originalPersistenceManager = inject(configAdmin, encryptingPersistenceManager);
passwordNodeCache = new NodeCacheExtended(fabricService.adapt(CuratorFramework.class), AUTHENTICATION_CRYPT_PASSWORD.getPath());
passwordNodeCache.getListenable().addListener(this);
alogrithmNodeCache = new NodeCacheExtended(fabricService.adapt(CuratorFramework.class), AUTHENTICATION_CRYPT_ALGORITHM.getPath());
alogrithmNodeCache.getListenable().addListener(this);
try {
passwordNodeCache.start();
alogrithmNodeCache.start();
} catch (Exception e) {
throw new FabricException(e);
}
}
}
Aggregations