Class.forName("jrun.servlet.JRunServletContext");
}
catch (Throwable t)
{
SecurityException se =
new SecurityException(new PropertyStringResourceLoader(PropertyStringResourceLoader.VENDORS_BUNDLE));
se.setMessage(NO_SEC_MANAGER);
throw se;
}
if (JRun.server != null)
{
try
{
ServletContext servletContext = servletConfig.getServletContext();
String webAppName = ((jrun.servlet.JRunServletContext)servletContext).getWebApplication().getName();
Set serviceMBeans = null;
ObjectInstance mbean = null;
//
// LOCATE WEB APP SECURITY SERVICE
//
ObjectName serviceName = new ObjectName("ServletEngineService." + webAppName + ":service=WebAppSecurityService");
serviceMBeans = JRun.server.queryMBeans(serviceName, null);
if (serviceMBeans != null)
{
// Just grab the first object instance
Iterator iterator = serviceMBeans.iterator();
if (iterator.hasNext())
{
mbean = (ObjectInstance)iterator.next();
}
}
if (mbean != null)
{
Object securityService = JRun.server.invoke(mbean.getObjectName(), "getWebAppSecurity", null, null);
if (securityService instanceof WebAppSecurityService)
{
appSecurity = (WebAppSecurityService)securityService;
}
}
// LOCATE SERVLET USERS SERVICE
serviceName = new ObjectName("ServletEngineService:service=ServletUsersService");
serviceMBeans = JRun.server.queryMBeans(serviceName, null);
if (serviceMBeans != null)
{
// Just grab the first object instance
Iterator iterator = serviceMBeans.iterator();
if (iterator.hasNext())
{
mbean = (ObjectInstance)iterator.next();
}
}
if (mbean != null)
{
Object usersService = JRun.server.invoke(mbean.getObjectName(), "getServletUsers", null, null);
if (usersService instanceof ServletUsers)
{
this.usersService = (ServletUsers)usersService;
}
}
}
catch (MalformedObjectNameException ex)
{
SecurityException se =
new SecurityException(new PropertyStringResourceLoader(PropertyStringResourceLoader.VENDORS_BUNDLE));
se.setMessage(NO_SEC_SRVC_OR_USERS);
se.setRootCause(ex);
throw se;
}
catch (InstanceNotFoundException ex)
{
SecurityException se =
new SecurityException(new PropertyStringResourceLoader(PropertyStringResourceLoader.VENDORS_BUNDLE));
se.setMessage(NO_SEC_SRVC_OR_USERS);
se.setRootCause(ex);
throw se;
}
catch (MBeanException ex)
{
Exception e = ex.getTargetException();
SecurityException se =
new SecurityException(new PropertyStringResourceLoader(PropertyStringResourceLoader.VENDORS_BUNDLE));
se.setMessage(NO_SEC_SRVC_OR_USERS);
se.setRootCause(e);
throw se;
}
catch (ReflectionException ex)
{
SecurityException se =
new SecurityException(new PropertyStringResourceLoader(PropertyStringResourceLoader.VENDORS_BUNDLE));
se.setMessage(NO_SEC_SRVC_OR_USERS);
se.setRootCause(ex);
throw se;
}
catch (NullPointerException npe)
{
SecurityException se =
new SecurityException(new PropertyStringResourceLoader(PropertyStringResourceLoader.VENDORS_BUNDLE));
se.setMessage(NO_SEC_SRVC_OR_USERS);
se.setRootCause(npe);
throw se;
}
}