Search in sources :

Example 1 with NodeCacheExtended

use of org.apache.curator.framework.recipes.cache.NodeCacheExtended 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);
        }
    }
}
Also used : NodeCacheExtended(org.apache.curator.framework.recipes.cache.NodeCacheExtended) EncryptingPersistenceManager(org.apache.felix.cm.file.EncryptingPersistenceManager) PersistenceManager(org.apache.felix.cm.PersistenceManager) FabricException(io.fabric8.api.FabricException) PBEStringEncryptor(org.jasypt.encryption.pbe.PBEStringEncryptor) StandardPBEStringEncryptor(org.jasypt.encryption.pbe.StandardPBEStringEncryptor) EncryptingPersistenceManager(org.apache.felix.cm.file.EncryptingPersistenceManager) FabricException(io.fabric8.api.FabricException) IOException(java.io.IOException) EncryptionOperationNotPossibleException(org.jasypt.exceptions.EncryptionOperationNotPossibleException) BundleContext(org.osgi.framework.BundleContext)

Example 2 with NodeCacheExtended

use of org.apache.curator.framework.recipes.cache.NodeCacheExtended in project fabric8 by jboss-fuse.

the class FabricCxfRegistrationHandler method activate.

@Activate
void activate() throws Exception {
    activateComponent();
    if (mBeanServer == null) {
        mBeanServer = ManagementFactory.getPlatformMBeanServer();
    }
    if (mBeanServer != null) {
        Object handback = null;
        mBeanServer.addNotificationListener(MBeanServerDelegate.DELEGATE_NAME, listener, filter, handback);
        this.registeredListener = true;
    }
    String id = getCurrentContainer().getId();
    String zkPath = ZkPath.CONFIG_CONTAINER.getPath(id);
    versionNodeMonitor = new NodeCacheExtended(curator.get(), zkPath);
    versionNodeMonitor.getListenable().addListener(this);
    versionNodeMonitor.start();
    replay();
}
Also used : NodeCacheExtended(org.apache.curator.framework.recipes.cache.NodeCacheExtended) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

NodeCacheExtended (org.apache.curator.framework.recipes.cache.NodeCacheExtended)2 FabricException (io.fabric8.api.FabricException)1 IOException (java.io.IOException)1 PersistenceManager (org.apache.felix.cm.PersistenceManager)1 EncryptingPersistenceManager (org.apache.felix.cm.file.EncryptingPersistenceManager)1 Activate (org.apache.felix.scr.annotations.Activate)1 PBEStringEncryptor (org.jasypt.encryption.pbe.PBEStringEncryptor)1 StandardPBEStringEncryptor (org.jasypt.encryption.pbe.StandardPBEStringEncryptor)1 EncryptionOperationNotPossibleException (org.jasypt.exceptions.EncryptionOperationNotPossibleException)1 BundleContext (org.osgi.framework.BundleContext)1