{
// JSR 286 portlet-app attributes - default-namespace and resource-bundle.
if (object instanceof PortletApplication20MetaData)
{
PortletApplication20MetaData md = (PortletApplication20MetaData)object;
if ("resource-bundle".equals(localName))
{
md.setResourceBundle(value);
}
else if ("default-namespace".equals(localName))
{
try
{
md.setDefaultNamespace(new URI(value));
}
catch (URISyntaxException e)
{
log.error("Invalid syntax for default-namespace: " + value);
}
}
}
// portlet
if (object instanceof PortletMetaData)
{
PortletMetaData md = (PortletMetaData)object;
if ("portlet-name".equals(localName))
{
md.setPortletName(value);
}
else if ("portlet-class".equals(localName))
{
md.setPortletClass(value);
}
else if ("cache-scope".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
{
md.setCacheScope(PortletCacheScopeEnum.valueOf(value));
}
else if ("expiration-cache".equals(localName))
{
md.setExpirationCache(Integer.valueOf(value));
}
else if ("resource-bundle".equals(localName))
{
md.setResourceBundle(value);
}
else if ("supported-public-render-parameter".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
{
md.addSupportedPublicRenderParameter(value);
}
}
if (object instanceof LocalizedDescriptionMetaData)
{
LocalizedDescriptionMetaData localized = (LocalizedDescriptionMetaData)object;
if ("description".equals(localName))
{
localized.setDescription(value);
}
else if ("display-name".equals(localName))
{
localized.setDescription(value);
}
}
// init-param
if (object instanceof InitParamMetaData)
{
InitParamMetaData md = (InitParamMetaData)object;
if ("name".equals(localName))
{
md.setName(value);
}
else if ("value".equals(localName))
{
md.setValue(value);
}
}
// supports
if (object instanceof SupportsMetaData)
{
SupportsMetaData md = (SupportsMetaData)object;
if ("mime-type".equals(localName))
{
md.setMimeType(value);
}
}
// supports --- portlet-mode
if (object instanceof PortletModeMetaData)
{
PortletModeMetaData md = (PortletModeMetaData)object;
if ("portlet-mode".equals(localName))
{
md.setPortletMode(org.gatein.pc.api.Mode.create(value));
}
}
// supports --- window-state
if (object instanceof WindowStateMetaData)
{
WindowStateMetaData md = (WindowStateMetaData)object;
if ("window-state".equals(localName))
{
md.setWindowState(org.gatein.pc.api.WindowState.create(value));
}
}
// supported-locale
if (object instanceof SupportedLocaleMetaData)
{
SupportedLocaleMetaData md = (SupportedLocaleMetaData)object;
if ("supported-locale".equals(localName))
{
md.setLocale(value);
}
}
// portlet-info
if (object instanceof PortletInfoMetaData)
{
PortletInfoMetaData md = (PortletInfoMetaData)object;
if ("title".equals(localName))
{
md.setTitle(value);
}
else if ("short-title".equals(localName))
{
md.setShortTitle(value);
}
else if ("keywords".equals(localName))
{
md.setKeywords(value);
}
}
// portlet-preferences
if (object instanceof PortletPreferencesMetaData)
{
PortletPreferencesMetaData md = (PortletPreferencesMetaData)object;
if ("preferences-validator".equals(localName))
{
md.setPreferenceValidator(value);
}
}
// preference
if (object instanceof PortletPreferenceMetaData)
{
PortletPreferenceMetaData md = (PortletPreferenceMetaData)object;
if ("name".equals(localName))
{
md.setName(value);
}
else if ("value".equals(localName))
{
md.addValue(value);
}
else if ("read-only".equals(localName))
{
md.setReadOnly(Boolean.valueOf(value));
}
}
// security-role-ref
if (object instanceof SecurityRoleRefMetaData)
{
SecurityRoleRefMetaData md = (SecurityRoleRefMetaData)object;
if ("role-name".equals(localName))
{
md.setRoleName(value);
}
else if ("role-link".equals(localName))
{
md.setRoleLink(value);
}
}
// supported events
if (object instanceof EventDefinitionReferenceMetaData)
{
EventDefinitionReferenceMetaData md = (EventDefinitionReferenceMetaData)object;
if ("qname".equals(localName))
{
md.setQname(nav.resolveQName(value));
}
else if ("name".equals(localName))
{
md.setName(value);
}
}
// custom-portlet-mode
if (object instanceof CustomPortletModeMetaData)
{
CustomPortletModeMetaData mode = (CustomPortletModeMetaData)object;
if ("portlet-mode".equals(localName))
{
mode.setPortletMode(value);
}
else if ("portal-managed".equals(localName) && PORTLET_JSR_286_NS.equals(nsURI))
{
mode.setPortalManaged(Boolean.parseBoolean(value));
}
}
// custom-window-state
if (object instanceof CustomWindowStateMetaData)
{
CustomWindowStateMetaData md = (CustomWindowStateMetaData)object;
if ("window-state".equals(localName))
{
md.setWindowState(value);
}
}
// user-attribute
if (object instanceof UserAttributeMetaData)
{
UserAttributeMetaData md = (UserAttributeMetaData)object;
if ("name".equals(localName))
{
md.setName(value);
}
}
// user-data-constraint
if (object instanceof UserDataConstraintMetaData)
{
UserDataConstraintMetaData md = (UserDataConstraintMetaData)object;
if ("transport-guarantee".equals(localName))
{
md.setTransportGuarantee(TransportGuarantee.valueOf(value));
}
}
// portlet-collection in security-constraint
if (object instanceof PortletCollectionMetaData)
{
PortletCollectionMetaData md = (PortletCollectionMetaData)object;
if ("portlet-name".equals(localName))
{
md.addPortletname(value);
}
}
// filter
if (object instanceof FilterMetaData && PORTLET_JSR_286_NS.equals(nsURI))
{
FilterMetaData md = (FilterMetaData)object;
if ("filter-class".equals(localName))
{
md.setFilterClass(value);
}
else if ("filter-name".equals(localName))
{
md.setFilterName(value);
}
else if ("lifecycle".equals(localName))
{
int end = value.length() - "_PHASE".length();
String lifeCycle = value.substring(0, end > 0 ? end : 0);
try
{
md.addLifecycle(LifeCyclePhase.valueOf(lifeCycle));
}
catch (IllegalArgumentException e)
{
throw new IllegalArgumentException("Invalid value for lifecycle. Valid values are [RENDER_PHASE, RESOURCE_PHASE, ACTION_PHASE, EVENT_PHASE]");
}
}
}
// filter-mapping
if (object instanceof FilterMappingMetaData && PORTLET_JSR_286_NS.equals(nsURI))
{
FilterMappingMetaData md = (FilterMappingMetaData)object;
if ("filter-name".equals(localName))
{
md.setName(value);
}
if ("portlet-name".equals(localName))
{
md.addPortletName(value);
}
}
// event-defintion
if (object instanceof EventDefinitionMetaData && PORTLET_JSR_286_NS.equals(nsURI))
{
EventDefinitionMetaData md = (EventDefinitionMetaData)object;
if ("name".equals(localName))
{
md.setName(value);
}
else if ("qname".equals(localName))
{
md.setQname(nav.resolveQName(value));
}
else if ("value-type".equals(localName))
{
md.setValueType(value);
}
else if ("alias".equals(localName))
{
md.addAlias(nav.resolveQName(value));
}
}
// public-render-parameter
if (object instanceof PublicRenderParameterMetaData && PORTLET_JSR_286_NS.equals(nsURI))
{
PublicRenderParameterMetaData md = (PublicRenderParameterMetaData)object;
if ("identifier".equals(localName))
{
md.setIdentifier(value);
}
else if ("name".equals(localName))
{
md.setName(value);
}
else if ("qname".equals(localName))
{
md.setQname(nav.resolveQName(value));
}
else if ("alias".equals(localName))
{
md.addAlias(nav.resolveQName(value));
}
}
// container-runtime-option
if (object instanceof ContainerRuntimeMetaData && PORTLET_JSR_286_NS.equals(nsURI))
{
ContainerRuntimeMetaData md = (ContainerRuntimeMetaData)object;
if ("name".equals(localName))
{
md.setName(value);
}
else if ("value".equals(localName))
{
md.addValue(value);
}
}
// listener
if (object instanceof ListenerMetaData && PORTLET_JSR_286_NS.equals(nsURI))
{
ListenerMetaData md = (ListenerMetaData)object;
if ("listener-class".equals(localName))
{
md.setListenerClass(value);
}
}
}