Search in sources :

Example 6 with PojoServiceRegistry

use of org.apache.felix.connect.launch.PojoServiceRegistry in project karaf by apache.

the class EncryptablePropertyPlaceholderTest method setUp.

@Before
public void setUp() throws Exception {
    StandardPBEStringEncryptor enc = new StandardPBEStringEncryptor();
    EnvironmentStringPBEConfig env = new EnvironmentStringPBEConfig();
    env.setAlgorithm("PBEWithMD5AndDES");
    env.setPassword("password");
    enc.setConfig(env);
    String val = enc.encrypt("bar");
    System.setProperty("foo", val);
    System.setProperty("org.bundles.framework.storage", "target/bundles/" + System.currentTimeMillis());
    System.setProperty("karaf.name", "root");
    List<BundleDescriptor> bundles = new ClasspathScanner().scanForBundles("(Bundle-SymbolicName=*)");
    bundles.add(getBundleDescriptor("target/jasypt.jar", bundle().add("OSGI-INF/blueprint/karaf-jaas-jasypt.xml", getClass().getResource("/OSGI-INF/blueprint/karaf-jaas-jasypt.xml")).set("Manifest-Version", "2").set("Bundle-ManifestVersion", "2").set("Bundle-SymbolicName", "jasypt").set("Bundle-Version", "0.0.0")));
    bundles.add(getBundleDescriptor("target/test.jar", bundle().add("OSGI-INF/blueprint/test.xml", getClass().getResource("test.xml")).set("Manifest-Version", "2").set("Bundle-ManifestVersion", "2").set("Bundle-SymbolicName", "test").set("Bundle-Version", "0.0.0")));
    Map config = new HashMap();
    config.put(PojoServiceRegistryFactory.BUNDLE_DESCRIPTORS, bundles);
    PojoServiceRegistry reg = new PojoServiceRegistryFactoryImpl().newPojoServiceRegistry(config);
    bundleContext = reg.getBundleContext();
}
Also used : PojoServiceRegistry(org.apache.felix.connect.launch.PojoServiceRegistry) StandardPBEStringEncryptor(org.jasypt.encryption.pbe.StandardPBEStringEncryptor) BundleDescriptor(org.apache.felix.connect.launch.BundleDescriptor) HashMap(java.util.HashMap) PojoServiceRegistryFactoryImpl(org.apache.felix.connect.PojoServiceRegistryFactoryImpl) EnvironmentStringPBEConfig(org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig) HashMap(java.util.HashMap) Map(java.util.Map) ClasspathScanner(org.apache.felix.connect.launch.ClasspathScanner) Before(org.junit.Before)

Example 7 with PojoServiceRegistry

use of org.apache.felix.connect.launch.PojoServiceRegistry in project jackrabbit-oak by apache.

the class WebConsoleSupport method postConstruct.

@PostConstruct
private void postConstruct() throws Exception {
    PojoServiceRegistry reg = ((ServiceRegistryProvider) repository).getServiceRegistry();
    //Configure repository backed SecurityProvider
    reg.registerService(WebConsoleSecurityProvider.class.getName(), new RepositorySecurityProvider(), null);
    //Expose the Spring Application context to Script Console access
    reg.registerService(ApplicationContext.class.getName(), context, null);
}
Also used : PojoServiceRegistry(org.apache.felix.connect.launch.PojoServiceRegistry) ApplicationContext(org.springframework.context.ApplicationContext) WebConsoleSecurityProvider(org.apache.felix.webconsole.WebConsoleSecurityProvider) ServiceRegistryProvider(org.apache.jackrabbit.oak.run.osgi.ServiceRegistryProvider) PostConstruct(javax.annotation.PostConstruct)

Aggregations

PojoServiceRegistry (org.apache.felix.connect.launch.PojoServiceRegistry)7 HashMap (java.util.HashMap)3 PojoServiceRegistryFactoryImpl (org.apache.felix.connect.PojoServiceRegistryFactoryImpl)3 BundleDescriptor (org.apache.felix.connect.launch.BundleDescriptor)3 Map (java.util.Map)2 ClasspathScanner (org.apache.felix.connect.launch.ClasspathScanner)2 WebConsoleSecurityProvider (org.apache.felix.webconsole.WebConsoleSecurityProvider)2 ServiceRegistryProvider (org.apache.jackrabbit.oak.run.osgi.ServiceRegistryProvider)2 StandardPBEStringEncryptor (org.jasypt.encryption.pbe.StandardPBEStringEncryptor)2 EnvironmentStringPBEConfig (org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig)2 Before (org.junit.Before)2 LinkedList (java.util.LinkedList)1 ExecutionException (java.util.concurrent.ExecutionException)1 TimeoutException (java.util.concurrent.TimeoutException)1 PostConstruct (javax.annotation.PostConstruct)1 Repository (javax.jcr.Repository)1 RepositoryException (javax.jcr.RepositoryException)1 JackrabbitRepository (org.apache.jackrabbit.api.JackrabbitRepository)1 BundleActivator (org.osgi.framework.BundleActivator)1 BundleException (org.osgi.framework.BundleException)1