users@glassfish.java.net

injecting com.sun.enterprise.config.serverbeans.Domain to osgi bundle

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Wed, 29 Jul 2009 00:41:04 +0200

Hello,

I have an osgi bundle and I need to determine application name from
context root. I can do something like:

    public static String getAppName(String contextRoot) {
        if (contextRoot == null)
            return null;
        // first check in web modules
        List<WebModule> lm =
domain.getApplications().getModules(WebModule.class);
        for (WebModule wm : lm) {
            if (contextRoot.equals(wm.getContextRoot())) {
                return (wm.getName());
            }
        }
        // then check under applications (introduced in V3 not j2ee app)
        List<Application> la =
domain.getApplications().getModules(Application.class);
        for (Application sapp : la) {
            if (contextRoot.equals(sapp.getContextRoot())) {
                return (sapp.getName());
            }
        }
        return null;
    }


but I dont have a instance of Domain. Can it be injected somehow like in
hk2 class with @Service annotation? Or is there any other way to get
glassfish configuration / list of deployed applications?

Thanks,
Pavel