1 package org
.argeo
.cms
.ui
.script
;
3 import javax
.jcr
.Repository
;
5 import org
.argeo
.api
.cms
.CmsLog
;
6 import org
.osgi
.framework
.BundleActivator
;
7 import org
.osgi
.framework
.BundleContext
;
8 import org
.osgi
.framework
.FrameworkUtil
;
9 import org
.osgi
.framework
.ServiceReference
;
10 import org
.osgi
.util
.tracker
.ServiceTracker
;
12 public class ScriptAppActivator
implements BundleActivator
{
13 private final static CmsLog log
= CmsLog
.getLog(ScriptAppActivator
.class);
16 public void start(BundleContext context
) throws Exception
{
18 CmsScriptRwtApplication appConfig
= new CmsScriptRwtApplication();
19 appConfig
.init(context
);
20 CmsScriptApp app
= appConfig
.getApp();
21 ServiceTracker
<Repository
, Repository
> repoSt
= new ServiceTracker
<Repository
, Repository
>(context
,
22 FrameworkUtil
.createFilter("(&" + app
.getRepo() + "(objectClass=javax.jcr.Repository))"), null) {
25 public Repository
addingService(ServiceReference
<Repository
> reference
) {
26 Repository repository
= super.addingService(reference
);
27 appConfig
.setRepository(repository
);
28 CmsScriptApp app
= appConfig
.getApp();
29 app
.register(context
, appConfig
);
35 } catch (Exception e
) {
36 log
.error("Cannot initialise script bundle " + context
.getBundle().getSymbolicName(), e
);
42 public void stop(BundleContext context
) throws Exception
{