use of org.glassfish.api.invocation.ApplicationEnvironment in project Payara by payara.
the class JavaModuleNamingProxy method getAppName.
private String getAppName() throws NamingException {
ComponentEnvManager namingMgr = habitat.getService(ComponentEnvManager.class);
String appName = null;
if (namingMgr != null) {
JndiNameEnvironment env = namingMgr.getCurrentJndiNameEnvironment();
BundleDescriptor bd = null;
if (env instanceof EjbDescriptor) {
bd = ((EjbDescriptor) env).getEjbBundleDescriptor();
} else if (env instanceof BundleDescriptor) {
bd = (BundleDescriptor) env;
}
if (bd != null) {
Application app = bd.getApplication();
appName = app.getAppName();
} else {
ApplicationEnvironment applicationEnvironment = namingMgr.getCurrentApplicationEnvironment();
if (applicationEnvironment != null) {
appName = applicationEnvironment.getName();
}
}
}
if (appName == null) {
throw new NamingException("Could not resolve " + JAVA_APP_NAME);
}
return appName;
}
Aggregations