use of org.apache.pluto.container.driver.DriverPortletContext in project uPortal by Jasig.
the class LocalPortletContextManager method register.
// Public Methods ----------------------------------------------------------
/**
* Retrieves the PortletContext associated with the given ServletContext. If one does not exist,
* it is created.
*
* @param config the servlet config.
* @return the InternalPortletContext associated with the ServletContext.
*/
@Override
public synchronized String register(ServletConfig config) throws PortletContainerException {
ServletContext servletContext = config.getServletContext();
String contextPath = servletContext.getContextPath();
if (!portletContexts.containsKey(contextPath)) {
PortletApplicationDefinition portletApp = this.getPortletAppDD(servletContext, contextPath, contextPath);
DriverPortletContext portletContext = new DriverPortletContextImpl(servletContext, portletApp, requestDispatcherService);
portletContexts.put(contextPath, portletContext);
fireRegistered(portletContext);
if (logger.isInfoEnabled()) {
logger.info("Registered portlet application for context '" + contextPath + "'");
logger.info("Registering " + portletApp.getPortlets().size() + " portlets for context " + portletContext.getApplicationName());
}
// TODO have the portlet servlet provide the portlet's classloader as parameter to this
// method
// This approach is needed as all pluto callbacks in uPortal have an aspect that
// switches the thread classloader back
// to uPortal's classloader.
ClassLoader classLoader = ThreadContextClassLoaderAspect.getPreviousClassLoader();
if (classLoader == null) {
classLoader = Thread.currentThread().getContextClassLoader();
}
classLoaders.put(portletApp.getName(), classLoader);
for (PortletDefinition portlet : portletApp.getPortlets()) {
String appName = portletContext.getApplicationName();
if (appName == null) {
throw new PortletContainerException("Portlet application name should not be null.");
}
portletConfigs.put(portletContext.getApplicationName() + "/" + portlet.getPortletName(), new DriverPortletConfigImpl(portletContext, portlet));
}
} else {
if (logger.isInfoEnabled()) {
logger.info("Portlet application for context '" + contextPath + "' already registered.");
}
}
return contextPath;
}
use of org.apache.pluto.container.driver.DriverPortletContext in project uPortal by Jasig.
the class LocalPortletContextManager method getPortletApplication.
@Override
public PortletApplicationDefinition getPortletApplication(String applicationName) throws PortletContainerException {
DriverPortletContext ipc = portletContexts.get(applicationName);
if (ipc != null) {
return ipc.getPortletApplicationDefinition();
}
String msg = "Unable to retrieve portlet application: '" + applicationName + "'";
logger.warn(msg);
throw new PortletContainerException(msg);
}
Aggregations