1 package org
.argeo
.jackrabbit
;
3 import java
.util
.Properties
;
5 import javax
.jcr
.Repository
;
7 import org
.apache
.commons
.logging
.Log
;
8 import org
.apache
.commons
.logging
.LogFactory
;
9 import org
.osgi
.framework
.BundleContext
;
12 * OSGi-aware Jackrabbit repository factory which can retrieve/publish
13 * {@link Repository} as OSGi services.
15 public class OsgiJackrabbitRepositoryFactory
extends
16 JackrabbitRepositoryFactory
{
17 private final static Log log
= LogFactory
18 .getLog(OsgiJackrabbitRepositoryFactory
.class);
19 private BundleContext bundleContext
;
21 protected void publish(String alias
, Repository repository
,
22 Properties properties
) {
23 if (bundleContext
!= null) {
24 // do not modify reference
25 Properties props
= new Properties(properties
);
26 props
.setProperty(JCR_REPOSITORY_ALIAS
, alias
);
27 bundleContext
.registerService(Repository
.class.getName(),
32 public void setBundleContext(BundleContext bundleContext
) {
33 this.bundleContext
= bundleContext
;