{
portletMD.addSupportedPublicRenderParameter(portletNav.getContent());
}
while (portletNav.next(Element.container_runtime_option))
{
ContainerRuntimeMetaData containerRuntimeOptionMD = new ContainerRuntimeMetaData();
containerRuntimeOptionMD.setName(getContent(portletNav, Element.name));
while (portletNav.next(Element.value))
{
containerRuntimeOptionMD.addValue(portletNav.getContent());
}
portletMD.addContainerRuntime(containerRuntimeOptionMD);
}
//
md.addPortlet(portletMD);
}
//
for (StaxNavigator<Element> customPortletModeNav : nav.fork(Element.custom_portlet_mode))
{
CustomPortletModeMetaData customPortletModeMD = new CustomPortletModeMetaData();
customPortletModeMD.setId(customPortletModeNav .getAttribute("id"));
customPortletModeMD.setDescription(readLocalizedString(customPortletModeNav , Element.description));
customPortletModeMD.setPortletMode(getContent(customPortletModeNav, Element.portlet_mode));
if (customPortletModeNav .next(Element.portal_managed))
{
customPortletModeMD.setPortalManaged(customPortletModeNav .parseContent(ValueType.BOOLEAN));
}
md.addCustomPortletMode(customPortletModeMD);
}
//
for (StaxNavigator<Element> customWindowStateNav : nav.fork(Element.custom_window_state))
{
CustomWindowStateMetaData customWindowStateMD = new CustomWindowStateMetaData();
customWindowStateMD.setId(customWindowStateNav.getAttribute("id"));
customWindowStateMD.setDescription(readLocalizedString(customWindowStateNav, Element.description));
customWindowStateMD.setWindowState(getContent(customWindowStateNav, Element.window_state));
md.addCustomWindowState(customWindowStateMD);
}
//
for (StaxNavigator<Element> userAttributeNav : nav.fork(Element.user_attribute))
{
UserAttributeMetaData userAttributeMD = new UserAttributeMetaData();
userAttributeMD.setId(userAttributeNav.getAttribute("id"));
userAttributeMD.setDescription(readLocalizedString(userAttributeNav, Element.description));
userAttributeMD.setName(getContent(userAttributeNav, Element.name));
md.addUserAttribute(userAttributeMD);
}
//
for (StaxNavigator<Element> securityConstraintNav : nav.fork(Element.security_constraint))
{
SecurityConstraintMetaData securityConstraintMD = new SecurityConstraintMetaData();
securityConstraintMD.setId(securityConstraintNav.getAttribute("id"));
securityConstraintMD.setDisplayName(readLocalizedString(securityConstraintNav, Element.display_name));
if (securityConstraintNav.next() != Element.portlet_collection)
{
throw new StaxNavException(nav.getLocation(), "Was expecting a portlet-collection element instead of " + securityConstraintNav.getName());
}
PortletCollectionMetaData portletCollectionMD = new PortletCollectionMetaData();
while (securityConstraintNav.next(Element.portlet_name))
{
portletCollectionMD.addPortletname(securityConstraintNav.getContent());
}
securityConstraintMD.setPortletList(portletCollectionMD);
if (securityConstraintNav.next() != Element.user_data_constraint)
{
throw new StaxNavException(nav.getLocation(), "Was expecting a security-constraint element instead of " + securityConstraintNav.getName());
}
UserDataConstraintMetaData userDataConstraintMD = new UserDataConstraintMetaData();
userDataConstraintMD.setDescription(readLocalizedString(securityConstraintNav, Element.description));
if (securityConstraintNav.next() != Element.transport_guarantee)
{
throw new StaxNavException(nav.getLocation(), "Was expecting a transport-guarantee element instead of " + securityConstraintNav.getName());
}
userDataConstraintMD.setTransportGuarantee(securityConstraintNav.parseContent(TRANSPORT_GUARANTEE));
securityConstraintMD.setUserDataConstraint(userDataConstraintMD);
md.addSecurityConstraint(securityConstraintMD);
}
//
if (nav.sibling(Element.resource_bundle))
{
md.setResourceBundle(nav.getContent());
nav.next();
}
//
for (StaxNavigator<Element> filterNav : nav.fork(Element.filter))
{
if (version < 2)
{
throw new DeploymentException("Cannot declare filter with " + PORTLET_1_0 + " descriptor");
}
FilterMetaData filterMD = new FilterMetaData();
filterMD.setDescription(readLocalizedString(filterNav, Element.description));
filterMD.setDisplayName(readLocalizedString(filterNav, Element.display_name));
filterMD.setFilterName(getContent(filterNav, Element.filter_name));
filterMD.setFilterClass(getContent(filterNav, Element.filter_class));
while (filterNav.next(Element.lifecycle))
{
filterMD.addLifecycle(filterNav.parseContent(LIFE_CYCLE));
}
for (InitParamMetaData initParamMD : readInitParams(filterNav))
{
filterMD.addInitParam(initParamMD);
}
md.addFilter(filterMD);
}
//
for (StaxNavigator<Element> filterMappingNav : nav.fork(Element.filter_mapping))
{
if (version < 2)
{
throw new DeploymentException("Cannot declare filter mapping with " + PORTLET_1_0 + " descriptor");
}
FilterMappingMetaData filterMappingMD = new FilterMappingMetaData();
filterMappingMD.setName(getContent(filterMappingNav, Element.filter_name));
while (filterMappingNav.next(Element.portlet_name))
{
filterMappingMD.addPortletName(filterMappingNav.getContent());
}
md.addFilterMapping(filterMappingMD);
}
//
if (nav.find(Element.default_namespace))
{
String val = nav.getContent();
try
{
md.setDefaultNamespace(new URI(val));
}
catch (URISyntaxException e)
{
throw new DeploymentException("Invalid URI " + val, e);
}
nav.next();
}
//
for (StaxNavigator<Element> eventDefinitionNav : nav.fork(Element.event_definition))
{
EventDefinitionMetaData eventDefinitionMD = new EventDefinitionMetaData();
eventDefinitionMD.setId(eventDefinitionNav.getAttribute("id"));
eventDefinitionMD.setDescription(readLocalizedString(eventDefinitionNav, Element.description));
switch (eventDefinitionNav.next(NAME_OR_QNAME))
{
case name:
eventDefinitionMD.setName(eventDefinitionNav.getContent());
break;
case qname:
eventDefinitionMD.setQname(readQName(eventDefinitionNav));
break;
}
while (eventDefinitionNav.next(Element.alias))
{
QName name = readQName(eventDefinitionNav);
eventDefinitionMD.addAlias(name);
}
if (eventDefinitionNav.next(Element.value_type))
{
eventDefinitionMD.setValueType(eventDefinitionNav.getContent());
}
md.addEventDefinition(eventDefinitionMD);
}
//
for (StaxNavigator<Element> publicRenderParameterNav : nav.fork(Element.public_render_parameter))
{
PublicRenderParameterMetaData publicRenderParameterMD = new PublicRenderParameterMetaData();
publicRenderParameterMD.setId(publicRenderParameterNav.getAttribute("id"));
publicRenderParameterMD.setDescription(readLocalizedString(publicRenderParameterNav, Element.description));
publicRenderParameterMD.setIdentifier(getContent(publicRenderParameterNav, Element.identifier));
switch (publicRenderParameterNav.next(NAME_OR_QNAME))
{
case name:
publicRenderParameterMD.setName(publicRenderParameterNav.getContent());
break;
case qname:
publicRenderParameterMD.setQname(readQName(publicRenderParameterNav));
break;
}
while (publicRenderParameterNav.next(Element.alias))
{
QName name = readQName(publicRenderParameterNav);
publicRenderParameterMD.addAlias(name);
}
md.addPublicRenderParameter(publicRenderParameterMD);
}
//
for (StaxNavigator<Element> listenerNav : nav.fork(Element.listener))
{
ListenerMetaData listenerMD = new ListenerMetaData();
listenerMD.setId(listenerNav.getAttribute("id"));
listenerMD.setDescription(readLocalizedString(listenerNav, Element.description));
listenerMD.setDisplayName(readLocalizedString(listenerNav, Element.display_name));
listenerMD.setListenerClass(getContent(listenerNav, Element.listener_class));
md.addListener(listenerMD);
}
//
for (StaxNavigator<Element> containerRuntimeNav : nav.fork(Element.container_runtime_option))
{
ContainerRuntimeMetaData containerRuntimeOptionMD = new ContainerRuntimeMetaData();
containerRuntimeOptionMD.setName(getContent(containerRuntimeNav, Element.name));
while (containerRuntimeNav.next(Element.value))
{
containerRuntimeOptionMD.addValue(containerRuntimeNav.getContent());
}
md.addContainerRuntime(containerRuntimeOptionMD);
}
//