use of org.apache.pluto.container.PortletContainerException 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);
}
use of org.apache.pluto.container.PortletContainerException in project uPortal by Jasig.
the class LocalPortletContextManager method getPortlet.
@Override
public PortletDefinition getPortlet(String applicationName, String portletName) throws PortletContainerException {
DriverPortletConfig ipc = portletConfigs.get(applicationName + "/" + portletName);
if (ipc != null) {
return ipc.getPortletDefinition();
}
String msg = "Unable to retrieve portlet: '" + applicationName + "/" + portletName + "'";
logger.warn(msg);
throw new PortletContainerException(msg);
}
use of org.apache.pluto.container.PortletContainerException in project uPortal by Jasig.
the class LocalPortletContextManager method getPortletConfig.
@Override
public DriverPortletConfig getPortletConfig(String applicationName, String portletName) throws PortletContainerException {
DriverPortletConfig ipc = portletConfigs.get(applicationName + "/" + portletName);
if (ipc != null) {
return ipc;
}
String msg = "Unable to locate portlet config [applicationName=" + applicationName + "]/[" + portletName + "].";
logger.warn(msg);
throw new PortletContainerException(msg);
}
use of org.apache.pluto.container.PortletContainerException in project uPortal by Jasig.
the class PortletAdministrationHelper method getPortletApplications.
/**
* Retreive the list of portlet application contexts currently available in this portlet
* container.
*
* @return list of portlet context
*/
public List<PortletApplicationDefinition> getPortletApplications() {
final PortletRegistryService portletRegistryService = portalDriverContainerServices.getPortletRegistryService();
final List<PortletApplicationDefinition> contexts = new ArrayList<>();
for (final Iterator<String> iter = portletRegistryService.getRegisteredPortletApplicationNames(); iter.hasNext(); ) {
final String applicationName = iter.next();
final PortletApplicationDefinition applicationDefninition;
try {
applicationDefninition = portletRegistryService.getPortletApplication(applicationName);
} catch (PortletContainerException e) {
throw new RuntimeException("Failed to load PortletApplicationDefinition for '" + applicationName + "'");
}
final List<? extends PortletDefinition> portlets = applicationDefninition.getPortlets();
portlets.sort(new ComparableExtractingComparator<PortletDefinition, String>(String.CASE_INSENSITIVE_ORDER) {
@Override
protected String getComparable(PortletDefinition o) {
final List<? extends DisplayName> displayNames = o.getDisplayNames();
if (displayNames != null && displayNames.size() > 0) {
return displayNames.get(0).getDisplayName();
}
return o.getPortletName();
}
});
contexts.add(applicationDefninition);
}
contexts.sort(new ComparableExtractingComparator<PortletApplicationDefinition, String>(String.CASE_INSENSITIVE_ORDER) {
@Override
protected String getComparable(PortletApplicationDefinition o) {
final String portletContextName = o.getName();
if (portletContextName != null) {
return portletContextName;
}
final String applicationName = o.getContextPath();
if ("/".equals(applicationName)) {
return "ROOT";
}
if (applicationName.startsWith("/")) {
return applicationName.substring(1);
}
return applicationName;
}
});
return contexts;
}
use of org.apache.pluto.container.PortletContainerException in project uPortal by Jasig.
the class PortletAdministrationHelper method supportsConfigMode.
/**
* If the portlet is a portlet and if one of the supported portlet modes is {@link
* IPortletRenderer#CONFIG}
*/
public boolean supportsConfigMode(PortletDefinitionForm form) {
final Tuple<String, String> portletDescriptorKeys = this.getPortletDescriptorKeys(form);
if (portletDescriptorKeys == null) {
logger.trace("Unable to determine supportsConfig - portletDescriptorKeys is null.");
return false;
}
final String portletAppId = portletDescriptorKeys.first;
final String portletName = portletDescriptorKeys.second;
final PortletRegistryService portletRegistryService = this.portalDriverContainerServices.getPortletRegistryService();
final PortletDefinition portletDescriptor;
try {
portletDescriptor = portletRegistryService.getPortlet(portletAppId, portletName);
} catch (PortletContainerException e) {
this.logger.warn("Unable to determine supportsConfig - Failed to load portlet descriptor for appId='" + portletAppId + "', portletName='" + portletName + "'", e);
return false;
}
if (portletDescriptor == null) {
logger.trace("Unable to determine supportsConfig - portletDescriptor is null.");
return false;
}
logger.trace("Checking supportsConfig for portlet ID=[{}] and Name=[{}].", portletAppId, portletName);
// Iterate over supported portlet modes, this ignores the content types for now
final List<? extends Supports> supports = portletDescriptor.getSupports();
for (final Supports support : supports) {
logger.trace("Checking Supports instance: {}", support.getMimeType());
final List<String> portletModes = support.getPortletModes();
for (final String portletMode : portletModes) {
logger.trace("Checking portletMode {}.", portletMode);
if (IPortletRenderer.CONFIG.equals(PortletUtils.getPortletMode(portletMode))) {
logger.trace("Returning supportsConfig is true.");
return true;
}
}
}
logger.trace("Returning supportsConfig is false.");
return false;
}
Aggregations