text
stringlengths
30
1.67M
<s> package org . gatein . registration ; import org . gatein . pc . api . PortletContext ; import org . gatein . wsrp . registration . PropertyDescription ; import javax . xml . namespace . QName ; import java . util . Map ; public interface RegistrationPolicy { void validateRegistrationDataFor ( Map < QName , Object > registrationProperties , String consumerIdentity , final Map < QName , ? extends PropertyDescription > expectations , final RegistrationManager manager ) throws IllegalArgumentException , RegistrationException ; String createRegistrationHandleFor ( String registrationId ) throws IllegalArgumentException ; String getAutomaticGroupNameFor ( String consumerName ) throws IllegalArgumentException ; String getConsumerIdFrom ( String consumerName , Map < QName , Object > registrationProperties ) throws IllegalArgumentException , InvalidConsumerDataException ; void validateConsumerName ( String consumerName , final RegistrationManager manager ) throws IllegalArgumentException , RegistrationException ; void validateConsumerGroupName ( String groupName , RegistrationManager manager ) throws IllegalArgumentException , RegistrationException ; boolean allowAccessTo ( PortletContext portletContext , Registration registration , String operation ) ; boolean isWrapped ( ) ; String getClassName ( ) ; Class < ? extends RegistrationPolicy > getRealClass ( ) ; } </s>
<s> package org . gatein . registration ; public class RegistrationLocal { private static final ThreadLocal registrationLocal = new ThreadLocal ( ) ; public static void setRegistration ( Registration registration ) { registrationLocal . set ( registration ) ; } public static Registration getRegistration ( ) { return ( Registration ) registrationLocal . get ( ) ; } } </s>
<s> package org . gatein . registration ; public class NoSuchRegistrationException extends RegistrationException { public NoSuchRegistrationException ( ) { } public NoSuchRegistrationException ( String message ) { super ( message ) ; } public NoSuchRegistrationException ( String message , Throwable cause ) { super ( message , cause ) ; } public NoSuchRegistrationException ( Throwable cause ) { super ( cause ) ; } } </s>
<s> package org . gatein . registration ; import org . gatein . wsrp . registration . PropertyDescription ; import javax . xml . namespace . QName ; import java . util . Map ; public interface RegistrationPropertyChangeListener { void propertiesHaveChanged ( Map < QName , ? extends PropertyDescription > newRegistrationProperties ) ; } </s>
<s> package org . gatein . registration ; public class RegistrationException extends Exception { public RegistrationException ( ) { } public RegistrationException ( String message ) { super ( message ) ; } public RegistrationException ( String message , Throwable cause ) { super ( message , cause ) ; } public RegistrationException ( Throwable cause ) { super ( cause ) ; } } </s>
<s> package org . gatein . wsrp . producer . resources ; import org . gatein . common . util . ParameterValidation ; import org . gatein . wsrp . ResourceServingUtil ; import org . gatein . wsrp . producer . ProducerHolder ; import org . gatein . wsrp . producer . v2 . WSRP2Producer ; import org . oasis . wsrp . v2 . GetResource ; import org . oasis . wsrp . v2 . ResourceContext ; import org . oasis . wsrp . v2 . ResourceResponse ; import javax . servlet . ServletException ; import javax . servlet . http . HttpServlet ; import javax . servlet . http . HttpServletRequest ; import javax . servlet . http . HttpServletResponse ; import java . io . IOException ; public class ResourceServingServlet extends HttpServlet { @ Override protected void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { WSRP2Producer producer = ProducerHolder . getProducer ( ) ; GetResource getResource = ResourceServingUtil . decode ( req ) ; try { ResourceResponse resource = producer . getResource ( getResource ) ; ResourceContext resourceContext = resource . getResourceContext ( ) ; byte [ ] itemBinary = resourceContext . getItemBinary ( ) ; String itemString = resourceContext . getItemString ( ) ; resp . setContentType ( resourceContext . getMimeType ( ) ) ; if ( itemBinary != null && itemBinary . length > <NUM_LIT:0> ) { resp . getOutputStream ( ) . write ( itemBinary ) ; } if ( ! ParameterValidation . isNullOrEmpty ( itemString ) ) { resp . getWriter ( ) . write ( itemString ) ; } } catch ( Exception exception ) { throw new ServletException ( "<STR_LIT>" + getResource . getResourceParams ( ) . getResourceID ( ) + "<STR_LIT>" + getResource . getPortletContext ( ) , exception ) ; } } } </s>
<s> package org . gatein . wsrp . producer . v2 ; import org . gatein . wsrp . producer . MarkupInterface ; import org . gatein . wsrp . producer . PortletManagementInterface ; import org . gatein . wsrp . producer . RegistrationInterface ; import org . gatein . wsrp . producer . ServiceDescriptionInterface ; import org . gatein . wsrp . producer . WSRPProducer ; public interface WSRP2Producer extends WSRPProducer , MarkupInterface , PortletManagementInterface , RegistrationInterface , ServiceDescriptionInterface { } </s>
<s> package org . gatein . wsrp . producer ; import org . gatein . exports . ExportManager ; import org . gatein . pc . api . PortletInvoker ; import org . gatein . pc . portlet . container . managed . ManagedObjectRegistryEventListener ; import org . gatein . registration . RegistrationManager ; import org . gatein . wsrp . api . context . ProducerContext ; import org . gatein . wsrp . producer . config . ProducerConfigurationChangeListener ; import org . gatein . wsrp . producer . config . ProducerConfigurationService ; public interface WSRPProducer extends ProducerConfigurationChangeListener , ManagedObjectRegistryEventListener { RegistrationManager getRegistrationManager ( ) ; void setRegistrationManager ( RegistrationManager registrationManager ) ; ProducerConfigurationService getConfigurationService ( ) ; void setConfigurationService ( ProducerConfigurationService configurationService ) ; PortletInvoker getPortletInvoker ( ) ; void setPortletInvoker ( PortletInvoker invoker ) ; void start ( ) ; void stop ( ) ; ExportManager getExportManager ( ) ; void setExportManager ( ExportManager exportManager ) ; ProducerContext getProducerContext ( ) ; void setProducerContext ( ProducerContext producerContext ) ; } </s>
<s> package org . gatein . wsrp . producer ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . BlockingInteractionResponse ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . GetResource ; import org . oasis . wsrp . v2 . HandleEvents ; import org . oasis . wsrp . v2 . HandleEventsResponse ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InitCookie ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PerformBlockingInteraction ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . ReleaseSessions ; import org . oasis . wsrp . v2 . ResourceResponse ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import java . util . List ; public interface MarkupInterface { MarkupResponse getMarkup ( GetMarkup getMarkup ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState ; BlockingInteractionResponse performBlockingInteraction ( PerformBlockingInteraction performBlockingInteraction ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState ; HandleEventsResponse handleEvents ( HandleEvents handleEvents ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState ; ResourceResponse getResource ( GetResource getResource ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState ; List < Extension > releaseSessions ( ReleaseSessions releaseSessions ) throws AccessDenied , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; List < Extension > initCookie ( InitCookie initCookie ) throws AccessDenied , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . registration . Registration ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . RegistrationContext ; import java . util . List ; public interface ProducerHelper { Portlet getPortletWith ( org . gatein . pc . api . PortletContext portletContext , Registration registration ) throws InvalidHandle , PortletInvokerException ; PortletDescription getPortletDescription ( PortletContext portletContext , List < String > locales , Registration registration ) throws InvalidHandle , OperationFailed ; Registration getRegistrationOrFailIfInvalid ( RegistrationContext registrationContext ) throws InvalidRegistration , OperationFailed , ModifyRegistrationRequired ; void reset ( ) ; } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . common . net . URLTools ; import org . gatein . common . net . media . MediaType ; import org . gatein . pc . api . ContainerURL ; import org . gatein . pc . api . URLFormat ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . spi . PortalContext ; import org . gatein . pc . api . spi . PortletInvocationContext ; import org . gatein . pc . api . spi . SecurityContext ; import org . gatein . pc . api . spi . UserContext ; import org . gatein . pc . api . spi . WindowContext ; import org . gatein . pc . portlet . impl . spi . AbstractClientContext ; import org . gatein . pc . portlet . impl . spi . AbstractPortletInvocationContext ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationLocal ; import org . gatein . wsrp . WSRPPortletURL ; import org . gatein . wsrp . WSRPRewritingConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . api . servlet . ServletAccess ; import javax . servlet . http . HttpServletRequest ; import javax . servlet . http . HttpServletResponse ; class WSRPPortletInvocationContext extends AbstractPortletInvocationContext implements PortletInvocationContext { private SecurityContext securityContext ; private PortalContext portalContext ; private UserContext userContext ; private WSRPInstanceContext instanceContext ; private WindowContext windowContext ; private static final String EQ = "<STR_LIT:=>" ; private static final String AMP = "<STR_LIT>" ; private static final String EQ_TRUE = "<STR_LIT>" ; private HttpServletRequest request ; private HttpServletResponse response ; public WSRPPortletInvocationContext ( MediaType mediaType , SecurityContext securityContext , PortalContext portalContext , UserContext userContext , WSRPInstanceContext instanceContext , WindowContext windowContext ) { super ( mediaType ) ; this . securityContext = securityContext ; this . portalContext = portalContext ; this . userContext = userContext ; this . instanceContext = instanceContext ; this . windowContext = windowContext ; request = ServletAccess . getRequest ( ) ; response = ServletAccess . getResponse ( ) ; } public HttpServletRequest getClientRequest ( ) { return request ; } public HttpServletResponse getClientResponse ( ) { return response ; } public String encodeResourceURL ( String url ) { if ( url != null && ! url . startsWith ( WSRPRewritingConstants . BEGIN_WSRP_REWRITE ) ) { url = WSRPUtils . getAbsoluteURLFor ( url , false , URLTools . getServerAddressFrom ( getClientRequest ( ) ) ) ; url = URLTools . encodeXWWWFormURL ( url ) ; StringBuffer sb = new StringBuffer ( url . length ( ) * <NUM_LIT:2> ) ; sb . append ( WSRPRewritingConstants . BEGIN_WSRP_REWRITE ) . append ( WSRPRewritingConstants . URL_TYPE_NAME ) . append ( EQ ) . append ( WSRPRewritingConstants . URL_TYPE_RESOURCE ) . append ( AMP ) . append ( WSRPRewritingConstants . RESOURCE_URL ) . append ( EQ ) . append ( url ) . append ( AMP ) . append ( WSRPRewritingConstants . RESOURCE_REQUIRES_REWRITE ) . append ( EQ_TRUE ) . append ( WSRPRewritingConstants . END_WSRP_REWRITE ) ; return sb . toString ( ) ; } return url ; } public String renderURL ( ContainerURL containerURL , URLFormat urlFormat ) { if ( containerURL != null ) { Boolean wantSecureBool = urlFormat . getWantSecure ( ) ; boolean wantSecure = ( wantSecureBool != null ? wantSecureBool : false ) ; WSRPPortletURL . URLContext context = new WSRPPortletURL . URLContext ( WSRPPortletURL . URLContext . SERVER_ADDRESS , URLTools . getServerAddressFrom ( request ) , WSRPPortletURL . URLContext . PORTLET_CONTEXT , instanceContext . getPortletContext ( ) ) ; Registration registration = RegistrationLocal . getRegistration ( ) ; if ( registration != null ) { context . setValueFor ( WSRPPortletURL . URLContext . REGISTRATION_HANDLE , registration . getRegistrationHandle ( ) ) ; } context . setValueFor ( WSRPPortletURL . URLContext . INSTANCE_KEY , WSRPTypeFactory . getPortletInstanceKey ( instanceContext ) ) ; context . setValueFor ( WSRPPortletURL . URLContext . NAMESPACE , WSRPTypeFactory . getNamespacePrefix ( windowContext , instanceContext . getPortletContext ( ) . getId ( ) ) ) ; WSRPPortletURL url = WSRPPortletURL . create ( containerURL , wantSecure , context ) ; return url . toString ( ) ; } return null ; } public void contextualize ( PortletInvocation invocation ) { invocation . setClientContext ( new AbstractClientContext ( request ) ) ; invocation . setServerContext ( new WSRPServerContext ( request , response ) ) ; invocation . setSecurityContext ( securityContext ) ; invocation . setInstanceContext ( instanceContext ) ; invocation . setWindowContext ( windowContext ) ; invocation . setPortalContext ( portalContext ) ; invocation . setUserContext ( userContext ) ; invocation . setRequest ( request ) ; invocation . setResponse ( response ) ; } WindowContext getWindowContext ( ) { return windowContext ; } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletStateType ; import org . gatein . pc . api . StateEvent ; import org . gatein . pc . api . StatefulPortletContext ; import org . gatein . pc . api . spi . InstanceContext ; import org . gatein . pc . api . state . AccessMode ; public class WSRPInstanceContext implements InstanceContext { private PortletContext context ; private String instanceId ; private final AccessMode accessMode ; private boolean wasModified = false ; public WSRPInstanceContext ( PortletContext portletContext , AccessMode accessMode , String instanceId ) { ParameterValidation . throwIllegalArgExceptionIfNull ( portletContext , "<STR_LIT>" ) ; ParameterValidation . throwIllegalArgExceptionIfNull ( accessMode , "<STR_LIT>" ) ; this . context = portletContext ; this . accessMode = accessMode ; if ( ! ParameterValidation . isNullOrEmpty ( instanceId ) ) { this . instanceId = instanceId ; } else { this . instanceId = portletContext . getId ( ) ; } } public String getId ( ) { return instanceId ; } public AccessMode getAccessMode ( ) { return accessMode ; } public void onStateEvent ( StateEvent event ) { PortletContext portletContext = event . getPortletContext ( ) ; ParameterValidation . throwIllegalArgExceptionIfNull ( portletContext , "<STR_LIT>" ) ; wasModified = true ; context = portletContext ; } public boolean wasModified ( ) { return wasModified ; } public PortletContext getPortletContext ( ) { return context ; } public PortletStateType < ? > getStateType ( ) { if ( context instanceof StatefulPortletContext ) { StatefulPortletContext spc = ( StatefulPortletContext ) context ; return spc . getType ( ) ; } else { return PortletStateType . OPAQUE ; } } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . WindowState ; import org . gatein . wsrp . WSRPUtils ; import org . oasis . wsrp . v2 . MarkupType ; import java . util . HashSet ; import java . util . List ; import java . util . Locale ; import java . util . Set ; class MarkupRequest { private String mode ; private String windowState ; private MarkupType markupType ; private String characterSet ; private Portlet portlet ; private static final String CHARSET_SEPARATOR = "<STR_LIT>" ; public MarkupRequest ( MarkupType markupType , String mode , String windowState , String characterSet , Portlet portlet ) { this . characterSet = characterSet ; this . markupType = markupType ; this . mode = mode ; this . windowState = windowState ; this . portlet = portlet ; } public String getMediaTypeWithCharset ( ) { return getMediaType ( ) + CHARSET_SEPARATOR + getCharacterSet ( ) ; } public String getMediaType ( ) { return markupType . getMimeType ( ) ; } public String getLocale ( ) { List < String > locales = markupType . getLocales ( ) ; if ( locales != null && ! locales . isEmpty ( ) ) { return locales . get ( <NUM_LIT:0> ) ; } else { return WSRPUtils . toString ( Locale . ENGLISH ) ; } } public String getMode ( ) { return mode ; } public String getWindowState ( ) { return windowState ; } public MarkupType getMarkupType ( ) { return markupType ; } public String getCharacterSet ( ) { return characterSet ; } public Portlet getPortlet ( ) { return portlet ; } public Set < Mode > getSupportedModes ( ) { List < String > modes = markupType . getModes ( ) ; Set < Mode > result = new HashSet < Mode > ( modes . size ( ) ) ; for ( String mode : modes ) { result . add ( WSRPUtils . getJSR168PortletModeFromWSRPName ( mode ) ) ; } return result ; } public Set < WindowState > getSupportedWindowStates ( ) { List < String > states = markupType . getWindowStates ( ) ; Set < WindowState > result = new HashSet < WindowState > ( states . size ( ) ) ; for ( String state : states ) { result . add ( WSRPUtils . getJSR168WindowStateFromWSRPName ( state ) ) ; } return result ; } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . RenderInvocation ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . state . AccessMode ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . producer . handlers . MarkupHandler ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MarkupContext ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MimeRequest ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import java . util . List ; class RenderRequestProcessor extends MimeResponseProcessor < MarkupContext , MarkupResponse > { private final GetMarkup getMarkup ; public RenderRequestProcessor ( ProducerHelper producer , GetMarkup getMarkup ) throws UnsupportedMimeType , UnsupportedWindowState , InvalidHandle , UnsupportedMode , MissingParameters , InvalidRegistration , OperationFailed , ModifyRegistrationRequired , UnsupportedLocale { super ( producer ) ; this . getMarkup = getMarkup ; prepareInvocation ( ) ; } RegistrationContext getRegistrationContext ( ) { return getMarkup . getRegistrationContext ( ) ; } RuntimeContext getRuntimeContext ( ) { return getMarkup . getRuntimeContext ( ) ; } MimeRequest getParams ( ) { return getMarkup . getMarkupParams ( ) ; } public PortletContext getPortletContext ( ) { return getMarkup . getPortletContext ( ) ; } org . oasis . wsrp . v2 . UserContext getUserContext ( ) { return getMarkup . getUserContext ( ) ; } String getContextName ( ) { return MarkupHandler . GET_MARKUP ; } AccessMode getAccessMode ( ) { return AccessMode . READ_ONLY ; } @ Override List < Extension > getResponseExtensionsFor ( MarkupResponse markupResponse ) { return markupResponse . getExtensions ( ) ; } protected PortletInvocation internalInitInvocation ( WSRPPortletInvocationContext context ) { final RenderInvocation renderInvocation = new RenderInvocation ( context ) ; renderInvocation . setEncoding ( markupRequest . getCharacterSet ( ) ) ; return renderInvocation ; } @ Override protected MarkupResponse createResponse ( MarkupContext mimeResponse ) { return WSRPTypeFactory . createMarkupResponse ( mimeResponse ) ; } @ Override protected Class < MarkupContext > getReifiedClass ( ) { return MarkupContext . class ; } @ Override protected void additionallyProcessIfNeeded ( MarkupContext markupContext , PortletInvocationResponse response ) { markupContext . setPreferredTitle ( portletDescription . getTitle ( ) . getValue ( ) ) ; } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . pc . api . cache . CacheLevel ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . ResourceInvocation ; import org . gatein . pc . api . state . AccessMode ; import org . gatein . wsrp . WSRPResourceURL ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . producer . handlers . MarkupHandler ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetResource ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MimeRequest ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceContext ; import org . oasis . wsrp . v2 . ResourceParams ; import org . oasis . wsrp . v2 . ResourceResponse ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . UserContext ; import java . util . List ; class ResourceRequestProcessor extends MimeResponseProcessor < ResourceContext , ResourceResponse > { private final GetResource getResource ; public ResourceRequestProcessor ( ProducerHelper producer , GetResource getResource ) throws InvalidRegistration , OperationFailed , MissingParameters , InvalidHandle , UnsupportedMimeType , UnsupportedWindowState , UnsupportedMode , ModifyRegistrationRequired , UnsupportedLocale { super ( producer ) ; this . getResource = getResource ; prepareInvocation ( ) ; } public PortletContext getPortletContext ( ) { return getResource . getPortletContext ( ) ; } @ Override AccessMode getAccessMode ( ) throws MissingParameters { return AccessMode . READ_ONLY ; } @ Override List < Extension > getResponseExtensionsFor ( ResourceResponse resourceResponse ) { return resourceResponse . getExtensions ( ) ; } @ Override String getContextName ( ) { return MarkupHandler . GET_RESOURCE ; } @ Override MimeRequest getParams ( ) { return getResource . getResourceParams ( ) ; } @ Override RegistrationContext getRegistrationContext ( ) { return getResource . getRegistrationContext ( ) ; } @ Override RuntimeContext getRuntimeContext ( ) { return getResource . getRuntimeContext ( ) ; } @ Override UserContext getUserContext ( ) { return getResource . getUserContext ( ) ; } protected PortletInvocation internalInitInvocation ( WSRPPortletInvocationContext context ) { ResourceInvocation resourceInvocation = new ResourceInvocation ( context ) ; ResourceParams resourceParams = this . getResource . getResourceParams ( ) ; String id = this . getResource . getResourceParams ( ) . getResourceID ( ) ; if ( ! WSRPResourceURL . DEFAULT_RESOURCE_ID . equals ( id ) ) { resourceInvocation . setResourceId ( id ) ; } WSRPRequestContext requestContext = WSRPRequestContext . createRequestContext ( markupRequest , resourceParams ) ; resourceInvocation . setRequestContext ( requestContext ) ; resourceInvocation . setForm ( requestContext . getForm ( ) ) ; String validationToken = null ; resourceInvocation . setValidationToken ( validationToken ) ; resourceInvocation . setResourceState ( createNavigationalState ( resourceParams . getResourceState ( ) ) ) ; String resourceCacheability = resourceParams . getResourceCacheability ( ) ; if ( resourceCacheability != null ) { CacheLevel cacheLevel = WSRPUtils . getCacheLevelFromResourceCacheability ( resourceParams . getResourceCacheability ( ) ) ; resourceInvocation . setCacheLevel ( cacheLevel ) ; } else { resourceInvocation . setCacheLevel ( CacheLevel . PAGE ) ; } return resourceInvocation ; } @ Override protected ResourceResponse createResponse ( ResourceContext resourceContext ) { return WSRPTypeFactory . createResourceResponse ( resourceContext ) ; } @ Override protected Class < ResourceContext > getReifiedClass ( ) { return ResourceContext . class ; } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . common . net . URLTools ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . ContentResponse ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . wsrp . MIMEUtils ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . oasis . wsrp . v2 . MimeResponse ; abstract class MimeResponseProcessor < LocalMimeResponse extends MimeResponse , Response > extends RequestProcessor < Response > { private static final String EMPTY = "<STR_LIT>" ; protected MimeResponseProcessor ( ProducerHelper producer ) { super ( producer ) ; } @ Override PortletInvocation initInvocation ( WSRPPortletInvocationContext context ) { return internalInitInvocation ( context ) ; } protected String processFragmentString ( String renderString ) { if ( ! ParameterValidation . isNullOrEmpty ( renderString ) ) { if ( WSRPUtils . getPropertyAccessor ( ) . isURLRewritingActive ( ) ) { return URLTools . replaceURLsBy ( renderString , new WSRPUtils . AbsoluteURLReplacementGenerator ( ServletAccess . getRequest ( ) ) ) ; } } return renderString ; } protected Response internalProcessResponse ( PortletInvocationResponse response ) { ContentResponse content = ( ContentResponse ) response ; String itemString = null ; byte [ ] itemBinary = null ; String contentType = content . getContentType ( ) ; Boolean requiresRewriting = Boolean . FALSE ; switch ( content . getType ( ) ) { case ContentResponse . TYPE_CHARS : itemString = processFragmentString ( content . getChars ( ) ) ; requiresRewriting = Boolean . TRUE ; break ; case ContentResponse . TYPE_BYTES : itemBinary = content . getBytes ( ) ; if ( MIMEUtils . needsRewriting ( contentType ) ) { requiresRewriting = Boolean . TRUE ; } break ; case ContentResponse . TYPE_EMPTY : itemString = EMPTY ; contentType = markupRequest . getMediaType ( ) ; break ; } LocalMimeResponse mimeResponse = WSRPTypeFactory . createMimeResponse ( contentType , itemString , itemBinary , getReifiedClass ( ) ) ; mimeResponse . setLocale ( markupRequest . getLocale ( ) ) ; Boolean useCachedItem = false ; mimeResponse . setRequiresRewriting ( requiresRewriting ) ; mimeResponse . setUseCachedItem ( useCachedItem ) ; String ccppProfileWarning = null ; mimeResponse . setCcppProfileWarning ( ccppProfileWarning ) ; int expires = content . getCacheControl ( ) . getExpirationSecs ( ) ; if ( expires != <NUM_LIT:0> ) { if ( expires < <NUM_LIT:0> ) { expires = - <NUM_LIT:1> ; } mimeResponse . setCacheControl ( WSRPTypeFactory . createCacheControl ( expires , WSRPConstants . CACHE_PER_USER ) ) ; } additionallyProcessIfNeeded ( mimeResponse , response ) ; return createResponse ( mimeResponse ) ; } protected abstract Response createResponse ( LocalMimeResponse mimeResponse ) ; protected abstract Class < LocalMimeResponse > getReifiedClass ( ) ; protected void additionallyProcessIfNeeded ( LocalMimeResponse mimeResponse , PortletInvocationResponse response ) { } protected abstract PortletInvocation internalInitInvocation ( WSRPPortletInvocationContext context ) ; } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . common . NotYetImplemented ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . invocation . EventInvocation ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . invocation . response . UpdateNavigationalStateResponse ; import org . gatein . pc . api . state . AccessMode ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . payload . PayloadUtils ; import org . gatein . wsrp . producer . handlers . MarkupHandler ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . Event ; import org . oasis . wsrp . v2 . EventParams ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . HandleEvents ; import org . oasis . wsrp . v2 . HandleEventsResponse ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MimeRequest ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . StateChange ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . UpdateResponse ; import org . oasis . wsrp . v2 . UserContext ; import java . util . List ; class EventRequestProcessor extends UpdateNavigationalStateResponseProcessor < HandleEventsResponse > { private HandleEvents handleEvents ; public EventRequestProcessor ( ProducerHelper producer , HandleEvents handleEvents ) throws OperationFailed , UnsupportedMode , InvalidHandle , MissingParameters , UnsupportedMimeType , UnsupportedWindowState , InvalidRegistration , OperationNotSupported , ModifyRegistrationRequired , UnsupportedLocale { super ( producer ) ; this . handleEvents = handleEvents ; EventParams eventParams = handleEvents . getEventParams ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( eventParams , "<STR_LIT>" , getContextName ( ) ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( eventParams . getPortletStateChange ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; List < Event > events = eventParams . getEvents ( ) ; if ( ! ParameterValidation . existsAndIsNotEmpty ( events ) ) { throw WSRP2ExceptionFactory . createWSException ( MissingParameters . class , "<STR_LIT>" , null ) ; } if ( events . size ( ) > <NUM_LIT:1> ) { throw WSRP2ExceptionFactory . createWSException ( OperationNotSupported . class , "<STR_LIT>" , null ) ; } prepareInvocation ( ) ; } @ Override RegistrationContext getRegistrationContext ( ) { return handleEvents . getRegistrationContext ( ) ; } @ Override RuntimeContext getRuntimeContext ( ) { return handleEvents . getRuntimeContext ( ) ; } @ Override MimeRequest getParams ( ) { return handleEvents . getMarkupParams ( ) ; } @ Override public PortletContext getPortletContext ( ) { return handleEvents . getPortletContext ( ) ; } @ Override UserContext getUserContext ( ) { return handleEvents . getUserContext ( ) ; } @ Override String getContextName ( ) { return MarkupHandler . HANDLE_EVENTS ; } @ Override AccessMode getAccessMode ( ) throws MissingParameters { StateChange stateChange = handleEvents . getEventParams ( ) . getPortletStateChange ( ) ; return WSRPUtils . getAccessModeFromStateChange ( stateChange ) ; } @ Override PortletInvocation initInvocation ( WSRPPortletInvocationContext context ) { EventInvocation eventInvocation = new EventInvocation ( context ) ; final EventParams eventParams = handleEvents . getEventParams ( ) ; List < Event > events = eventParams . getEvents ( ) ; if ( events . size ( ) > <NUM_LIT:1> ) { throw new NotYetImplemented ( "<STR_LIT>" ) ; } Event event = events . get ( <NUM_LIT:0> ) ; eventInvocation . setName ( event . getName ( ) ) ; eventInvocation . setPayload ( PayloadUtils . getPayloadAsSerializable ( event ) ) ; processExtensionsFrom ( eventParams . getClass ( ) , eventParams . getExtensions ( ) ) ; return eventInvocation ; } @ Override List < Extension > getResponseExtensionsFor ( HandleEventsResponse handleEventsResponse ) { return handleEventsResponse . getExtensions ( ) ; } @ Override protected HandleEventsResponse internalProcessResponse ( PortletInvocationResponse response ) { if ( response instanceof UpdateNavigationalStateResponse ) { UpdateNavigationalStateResponse unsResponse = ( UpdateNavigationalStateResponse ) response ; HandleEventsResponse eventsResponse = WSRPTypeFactory . createHandleEventsReponse ( ) ; UpdateResponse updateResponse = createUpdateResponse ( unsResponse ) ; eventsResponse . setUpdateResponse ( updateResponse ) ; return eventsResponse ; } else { throw new IllegalArgumentException ( "<STR_LIT>" + response ) ; } } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . invocation . response . UpdateNavigationalStateResponse ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . oasis . wsrp . v2 . NavigationalContext ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . UpdateResponse ; import java . util . List ; abstract class UpdateNavigationalStateResponseProcessor < Response > extends RequestProcessor < Response > { public UpdateNavigationalStateResponseProcessor ( ProducerHelper producer ) { super ( producer ) ; } protected String getNewStateOrNull ( UpdateNavigationalStateResponse renderResult , boolean forMode ) { Object state = forMode ? renderResult . getMode ( ) : renderResult . getWindowState ( ) ; return state != null ? state . toString ( ) : null ; } protected UpdateResponse createUpdateResponse ( UpdateNavigationalStateResponse stateResponse ) { UpdateResponse updateResponse = WSRPTypeFactory . createUpdateResponse ( ) ; updateResponse . setNewMode ( WSRPUtils . convertJSR168PortletModeNameToWSRPName ( getNewStateOrNull ( stateResponse , true ) ) ) ; updateResponse . setNewWindowState ( WSRPUtils . convertJSR168WindowStateNameToWSRPName ( getNewStateOrNull ( stateResponse , false ) ) ) ; NavigationalContext navigationalContext = WSRPTypeFactory . createNavigationalContextOrNull ( stateResponse . getNavigationalState ( ) , stateResponse . getPublicNavigationalStateUpdates ( ) ) ; updateResponse . setNavigationalContext ( navigationalContext ) ; List < UpdateNavigationalStateResponse . Event > events = stateResponse . getEvents ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( events ) ) { for ( UpdateNavigationalStateResponse . Event event : events ) { updateResponse . getEvents ( ) . add ( WSRPTypeFactory . createEvent ( event . getName ( ) , event . getPayload ( ) ) ) ; } } if ( instanceContext . wasModified ( ) ) { PortletContext updatedPortletContext = WSRPUtils . convertToWSRPPortletContext ( instanceContext . getPortletContext ( ) ) ; updateResponse . setPortletContext ( updatedPortletContext ) ; } return updateResponse ; } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . apache . commons . fileupload . FileUpload ; import org . gatein . common . util . ParameterMap ; import org . gatein . pc . api . spi . RequestContext ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . NamedString ; import org . oasis . wsrp . v2 . ResourceParams ; import org . oasis . wsrp . v2 . UploadContext ; import javax . mail . MessagingException ; import javax . mail . internet . InternetHeaders ; import javax . mail . internet . MimeBodyPart ; import javax . mail . internet . MimeMultipart ; import java . io . BufferedReader ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; abstract class WSRPRequestContext implements RequestContext , org . apache . commons . fileupload . RequestContext { protected String characterEncoding ; protected WSRPRequestContext ( String characterEncoding ) { this . characterEncoding = characterEncoding ; } public String getCharacterEncoding ( ) { return characterEncoding ; } public int getContentLength ( ) { return - <NUM_LIT:1> ; } public BufferedReader getReader ( ) throws IOException { throw new UnsupportedOperationException ( "<STR_LIT>" ) ; } public InputStream getInputStream ( ) throws IOException { throw new UnsupportedOperationException ( "<STR_LIT>" ) ; } public abstract ParameterMap getForm ( ) ; static class WSRPSimpleRequestContext extends WSRPRequestContext { private ParameterMap formParameters ; private String contentType ; protected WSRPSimpleRequestContext ( String characterEncoding , String contentType , List < NamedString > formParams ) { super ( characterEncoding ) ; this . contentType = contentType ; if ( formParams != null && ! formParams . isEmpty ( ) ) { Map < String , String [ ] > params = new HashMap < String , String [ ] > ( formParams . size ( ) ) ; for ( NamedString formParam : formParams ) { String paramName = formParam . getName ( ) ; String paramValue = formParam . getValue ( ) ; if ( params . containsKey ( paramName ) ) { String [ ] oldValues = params . get ( paramName ) ; int valuesLength = oldValues . length ; String [ ] newValues = new String [ valuesLength + <NUM_LIT:1> ] ; System . arraycopy ( oldValues , <NUM_LIT:0> , newValues , <NUM_LIT:0> , valuesLength ) ; newValues [ valuesLength ] = paramValue ; params . put ( paramName , newValues ) ; } else { params . put ( paramName , new String [ ] { paramValue } ) ; } formParameters = new ParameterMap ( params ) ; } } else { formParameters = new ParameterMap ( ) ; } } public ParameterMap getForm ( ) { return formParameters ; } public String getContentType ( ) { return contentType ; } @ Override public int getContentLength ( ) { return <NUM_LIT:0> ; } } static class WSRPMultiRequestContext extends WSRPRequestContext { private byte [ ] content ; private boolean usingStream ; private boolean usingReader ; private String contentType ; protected WSRPMultiRequestContext ( String characterEncoding , List < NamedString > formParams , List < UploadContext > uploadContexts ) throws IOException , MessagingException { super ( characterEncoding ) ; MimeMultipart parts = new MimeMultipart ( ) ; if ( uploadContexts != null && ! uploadContexts . isEmpty ( ) ) { for ( UploadContext uploadContext : uploadContexts ) { InternetHeaders headers = new InternetHeaders ( ) ; headers . addHeader ( FileUpload . CONTENT_TYPE , uploadContext . getMimeType ( ) ) ; List < NamedString > attributes = uploadContext . getMimeAttributes ( ) ; if ( attributes != null && ! attributes . isEmpty ( ) ) { for ( NamedString attribute : attributes ) { headers . addHeader ( attribute . getName ( ) , attribute . getValue ( ) ) ; } } MimeBodyPart mimeBodyPart = new MimeBodyPart ( headers , uploadContext . getUploadData ( ) ) ; parts . addBodyPart ( mimeBodyPart ) ; } } final String paramContentDispositionHeader = FileUpload . FORM_DATA + "<STR_LIT>" ; if ( formParams != null ) { for ( NamedString formParam : formParams ) { InternetHeaders headers = new InternetHeaders ( ) ; StringBuffer paramContentDisposition = new StringBuffer ( paramContentDispositionHeader ) ; paramContentDisposition . append ( formParam . getName ( ) ) . append ( "<STR_LIT:\">" ) ; headers . addHeader ( FileUpload . CONTENT_DISPOSITION , paramContentDisposition . toString ( ) ) ; MimeBodyPart mimeBodyPart = new MimeBodyPart ( headers , formParam . getValue ( ) . getBytes ( ) ) ; parts . addBodyPart ( mimeBodyPart ) ; } } ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; parts . writeTo ( baos ) ; content = baos . toByteArray ( ) ; contentType = parts . getContentType ( ) ; } public ParameterMap getForm ( ) { return new ParameterMap ( ) ; } public String getContentType ( ) { return contentType ; } public int getContentLength ( ) { return content . length ; } public BufferedReader getReader ( ) throws IOException { if ( usingStream ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } usingReader = true ; return new BufferedReader ( new InputStreamReader ( getInputStreamFromContent ( ) ) ) ; } public InputStream getInputStream ( ) throws IOException { if ( usingReader ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } usingStream = true ; return getInputStreamFromContent ( ) ; } private InputStream getInputStreamFromContent ( ) { return new ByteArrayInputStream ( content ) ; } } public static WSRPRequestContext createRequestContext ( MarkupRequest markupRequest , InteractionParams interactionParams ) { return createRequestContext ( markupRequest , interactionParams . getFormParameters ( ) , interactionParams . getUploadContexts ( ) ) ; } public static WSRPRequestContext createRequestContext ( MarkupRequest markupRequest , ResourceParams resourceParams ) { return createRequestContext ( markupRequest , resourceParams . getFormParameters ( ) , resourceParams . getUploadContexts ( ) ) ; } public static WSRPRequestContext createRequestContext ( MarkupRequest markupRequest , List < NamedString > formParams , List < UploadContext > uploadContexts ) { if ( uploadContexts != null && ! uploadContexts . isEmpty ( ) ) { try { return new WSRPMultiRequestContext ( markupRequest . getCharacterSet ( ) , formParams , uploadContexts ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "<STR_LIT>" , e ) ; } } else { return new WSRPSimpleRequestContext ( markupRequest . getCharacterSet ( ) , markupRequest . getMediaType ( ) , formParams ) ; } } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . GetResource ; import org . oasis . wsrp . v2 . HandleEvents ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PerformBlockingInteraction ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; public class ProcessorFactory { public static RequestProcessor getProcessorFor ( ProducerHelper producer , Object request ) throws OperationFailed , UnsupportedMode , InvalidHandle , MissingParameters , UnsupportedMimeType , UnsupportedWindowState , InvalidRegistration , ModifyRegistrationRequired , UnsupportedLocale { if ( request instanceof GetMarkup ) { return new RenderRequestProcessor ( producer , ( GetMarkup ) request ) ; } else if ( request instanceof PerformBlockingInteraction ) { PerformBlockingInteraction performBlockingInteraction = ( PerformBlockingInteraction ) request ; return new ActionRequestProcessor ( producer , performBlockingInteraction ) ; } else if ( request instanceof HandleEvents ) { HandleEvents handleEvents = ( HandleEvents ) request ; try { return new EventRequestProcessor ( producer , handleEvents ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP2ExceptionFactory . createWSException ( OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } else if ( request instanceof GetResource ) { GetResource getResource = ( GetResource ) request ; return new ResourceRequestProcessor ( producer , getResource ) ; } else { throw new IllegalArgumentException ( "<STR_LIT>" + request . getClass ( ) . getSimpleName ( ) ) ; } } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . common . net . media . MediaType ; import org . gatein . common . util . MarkupInfo ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . StateString ; import org . gatein . pc . api . WindowState ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . spi . PortalContext ; import org . gatein . pc . api . spi . SecurityContext ; import org . gatein . pc . api . spi . UserContext ; import org . gatein . pc . api . spi . WindowContext ; import org . gatein . pc . api . state . AccessMode ; import org . gatein . pc . portlet . impl . jsr168 . PortletUtils ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationLocal ; import org . gatein . wsrp . UserContextConverter ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . api . extensions . ExtensionAccess ; import org . gatein . wsrp . api . extensions . UnmarshalledExtension ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . payload . PayloadUtils ; import org . gatein . wsrp . producer . Utils ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MarkupType ; import org . oasis . wsrp . v2 . MimeRequest ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . NamedString ; import org . oasis . wsrp . v2 . NavigationalContext ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . SessionParams ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import javax . servlet . http . HttpServletRequest ; import java . security . Principal ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; public abstract class RequestProcessor < Response > { private static final String WINDOW_STATE = "<STR_LIT>" ; private static final String PORTLET_MODE = "<STR_LIT>" ; private static final Logger log = LoggerFactory . getLogger ( RequestProcessor . class ) ; protected PortletInvocation invocation ; protected MarkupRequest markupRequest ; protected PortletDescription portletDescription ; protected Portlet portlet ; protected WSRPInstanceContext instanceContext ; protected ProducerHelper producer ; protected RequestProcessor ( ProducerHelper producer ) { this . producer = producer ; } void prepareInvocation ( ) throws InvalidRegistration , OperationFailed , InvalidHandle , UnsupportedMimeType , UnsupportedWindowState , UnsupportedMode , MissingParameters , ModifyRegistrationRequired , UnsupportedLocale { Registration registration = producer . getRegistrationOrFailIfInvalid ( getRegistrationContext ( ) ) ; final RuntimeContext runtimeContext = getRuntimeContext ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( runtimeContext , "<STR_LIT>" , getContextName ( ) ) ; checkForSessionIDs ( runtimeContext ) ; final MimeRequest params = getParams ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( params , "<STR_LIT>" , getContextName ( ) ) ; PortletContext wsrpPC = getPortletContext ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( wsrpPC , "<STR_LIT>" , getContextName ( ) ) ; org . gatein . pc . api . PortletContext portletContext = WSRPUtils . convertToPortalPortletContext ( wsrpPC ) ; final List < String > desiredLocales = params . getLocales ( ) ; for ( String locale : desiredLocales ) { try { WSRPUtils . getLocale ( locale ) ; } catch ( IllegalArgumentException e ) { throw WSRP2ExceptionFactory . throwWSException ( UnsupportedLocale . class , e . getLocalizedMessage ( ) , null ) ; } } try { portlet = producer . getPortletWith ( portletContext , registration ) ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + portletContext + "<STR_LIT:'>" , e ) ; } portletDescription = producer . getPortletDescription ( wsrpPC , null , registration ) ; if ( Boolean . TRUE . equals ( portletDescription . isUsesMethodGet ( ) ) ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } List < MarkupType > markupTypes = portletDescription . getMarkupTypes ( ) ; markupRequest = createMarkupRequestFrom ( markupTypes , params , portlet ) ; final org . oasis . wsrp . v2 . UserContext wsrpUserContext = getUserContext ( ) ; checkUserContext ( wsrpUserContext ) ; SecurityContext securityContext = createSecurityContext ( params , runtimeContext , wsrpUserContext ) ; final MediaType mediaType = createMediaType ( markupRequest ) ; PortalContext portalContext = createPortalContext ( params , markupRequest ) ; UserContext userContext = createUserContext ( wsrpUserContext , markupRequest . getLocale ( ) , desiredLocales ) ; String portletInstanceKey = runtimeContext . getPortletInstanceKey ( ) ; instanceContext = createInstanceContext ( portletContext , getAccessMode ( ) , portletInstanceKey ) ; WindowContext windowContext = createWindowContext ( portletContext . getId ( ) , runtimeContext ) ; WSRPPortletInvocationContext context = new WSRPPortletInvocationContext ( mediaType , securityContext , portalContext , userContext , instanceContext , windowContext ) ; PortletInvocation invocation = initInvocation ( context ) ; final HashMap < String , Object > attributes = new HashMap < String , Object > ( ) ; attributes . put ( WSRPConstants . FROM_WSRP_ATTRIBUTE_NAME , Boolean . TRUE ) ; invocation . setRequestAttributes ( attributes ) ; invocation . setTarget ( portlet . getContext ( ) ) ; invocation . setWindowState ( WSRPUtils . getJSR168WindowStateFromWSRPName ( markupRequest . getWindowState ( ) ) ) ; invocation . setMode ( WSRPUtils . getJSR168PortletModeFromWSRPName ( markupRequest . getMode ( ) ) ) ; NavigationalContext navigationalContext = params . getNavigationalContext ( ) ; if ( navigationalContext != null ) { StateString navigationalState = createNavigationalState ( navigationalContext . getOpaqueValue ( ) ) ; invocation . setNavigationalState ( navigationalState ) ; List < NamedString > publicParams = navigationalContext . getPublicValues ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( publicParams ) ) { Map < String , String [ ] > publicNS = WSRPUtils . createPublicNSFrom ( publicParams ) ; invocation . setPublicNavigationalState ( publicNS ) ; } } context . contextualize ( invocation ) ; setInvocation ( invocation ) ; } abstract RegistrationContext getRegistrationContext ( ) ; abstract RuntimeContext getRuntimeContext ( ) ; abstract MimeRequest getParams ( ) ; public abstract PortletContext getPortletContext ( ) ; abstract org . oasis . wsrp . v2 . UserContext getUserContext ( ) ; abstract String getContextName ( ) ; abstract AccessMode getAccessMode ( ) throws MissingParameters ; abstract PortletInvocation initInvocation ( WSRPPortletInvocationContext context ) ; abstract List < Extension > getResponseExtensionsFor ( Response response ) ; public Response processResponse ( PortletInvocationResponse response ) { try { final Response wsrpResponse = internalProcessResponse ( response ) ; List < Extension > extensions = ExtensionAccess . getProducerExtensionAccessor ( ) . getResponseExtensionsFor ( wsrpResponse . getClass ( ) ) ; getResponseExtensionsFor ( wsrpResponse ) . addAll ( extensions ) ; return wsrpResponse ; } finally { RegistrationLocal . setRegistration ( null ) ; ExtensionAccess . getProducerExtensionAccessor ( ) . clear ( ) ; } } protected abstract Response internalProcessResponse ( PortletInvocationResponse response ) ; private MarkupRequest createMarkupRequestFrom ( List < MarkupType > markupTypes , MimeRequest params , Portlet portlet ) throws UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState , UnsupportedLocale { List < String > desiredMIMETypes = params . getMimeTypes ( ) ; MarkupType markupType = null ; for ( String desiredMIMEType : desiredMIMETypes ) { desiredMIMEType = desiredMIMEType . trim ( ) ; if ( "<STR_LIT:*>" . equals ( desiredMIMEType ) || "<STR_LIT>" . equals ( desiredMIMEType ) ) { markupType = markupTypes . get ( <NUM_LIT:0> ) ; break ; } else { MediaType mt = MediaType . create ( desiredMIMEType ) ; String superType = mt . getType ( ) . getName ( ) ; String subType = mt . getSubtype ( ) . getName ( ) ; boolean isWildcard = "<STR_LIT:*>" . equals ( subType ) ; for ( MarkupType type : markupTypes ) { if ( isWildcard && type . getMimeType ( ) . startsWith ( superType ) ) { markupType = type ; break ; } else if ( desiredMIMEType . equals ( type . getMimeType ( ) ) ) { markupType = type ; break ; } } } if ( markupType != null ) { break ; } } if ( markupType == null ) { throw WSRP2ExceptionFactory . throwWSException ( UnsupportedMimeType . class , "<STR_LIT>" + portlet . getContext ( ) . getId ( ) + "<STR_LIT:'>" , null ) ; } List < String > desiredLocales = new ArrayList < String > ( params . getLocales ( ) ) ; List < String > supportedLocales = new ArrayList < String > ( markupType . getLocales ( ) ) ; desiredLocales . retainAll ( supportedLocales ) ; if ( desiredLocales . isEmpty ( ) ) { desiredLocales = params . getLocales ( ) ; } MarkupType markupTypeCopy = WSRPTypeFactory . createMarkupType ( markupType . getMimeType ( ) , markupType . getModes ( ) , markupType . getWindowStates ( ) , desiredLocales ) ; markupTypeCopy . getExtensions ( ) . addAll ( markupType . getExtensions ( ) ) ; String mode ; try { mode = getMatchingOrFailFrom ( markupTypeCopy . getModes ( ) , params . getMode ( ) , PORTLET_MODE ) ; } catch ( IllegalArgumentException e ) { throw WSRP2ExceptionFactory . throwWSException ( UnsupportedMode . class , "<STR_LIT>" + params . getMode ( ) + "<STR_LIT:'>" , e ) ; } String windowState ; try { windowState = getMatchingOrFailFrom ( markupTypeCopy . getWindowStates ( ) , params . getWindowState ( ) , WINDOW_STATE ) ; } catch ( IllegalArgumentException e ) { throw WSRP2ExceptionFactory . throwWSException ( UnsupportedWindowState . class , "<STR_LIT>" + params . getWindowState ( ) + "<STR_LIT:'>" , e ) ; } String characterSet = getMatchingOrDefaultFrom ( Collections . < String > emptyList ( ) , params . getMarkupCharacterSets ( ) , WSRPConstants . DEFAULT_CHARACTER_SET ) ; final List < Extension > extensions = params . getExtensions ( ) ; processExtensionsFrom ( params . getClass ( ) , extensions ) ; return new MarkupRequest ( markupTypeCopy , mode , windowState , characterSet , portlet ) ; } protected void processExtensionsFrom ( Class paramsClass , List < Extension > extensions ) { for ( Extension extension : extensions ) { try { final UnmarshalledExtension unmarshalledExtension = PayloadUtils . unmarshallExtension ( extension . getAny ( ) ) ; ExtensionAccess . getProducerExtensionAccessor ( ) . addRequestExtension ( paramsClass , unmarshalledExtension ) ; } catch ( Exception e ) { log . debug ( "<STR_LIT>" , e ) ; } } } private String getMatchingOrFailFrom ( List < String > possibleValues , String desired , String valueType ) throws IllegalArgumentException { if ( possibleValues . contains ( desired ) ) { return desired ; } throw new IllegalArgumentException ( desired + "<STR_LIT>" + valueType ) ; } private String getMatchingOrDefaultFrom ( List < String > possibleValues , List < String > preferredValues , String defaultValue ) { if ( preferredValues != null && possibleValues != null ) { for ( String preferredValue : preferredValues ) { if ( possibleValues . contains ( preferredValue ) ) { return preferredValue ; } } } return defaultValue ; } private void checkUserContext ( org . oasis . wsrp . v2 . UserContext wsrpUserContext ) throws MissingParameters { if ( wsrpUserContext != null ) { WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( wsrpUserContext . getUserContextKey ( ) , "<STR_LIT>" , "<STR_LIT>" ) ; } } private void checkForSessionIDs ( RuntimeContext runtimeContext ) throws OperationFailed { SessionParams sessionParams = runtimeContext . getSessionParams ( ) ; if ( sessionParams != null && sessionParams . getSessionID ( ) != null ) { Utils . throwOperationFaultOnSessionOperation ( ) ; } } protected StateString createNavigationalState ( String navigationalState ) { if ( navigationalState == null ) { return null ; } else { return StateString . create ( navigationalState ) ; } } private WSRPInstanceContext createInstanceContext ( org . gatein . pc . api . PortletContext portletContext , final AccessMode accessMode , String instanceId ) { return new WSRPInstanceContext ( portletContext , accessMode , instanceId ) ; } private WindowContext createWindowContext ( final String portletHandle , final RuntimeContext runtimeContext ) { String id = runtimeContext . getPortletInstanceKey ( ) ; if ( ParameterValidation . isNullOrEmpty ( id ) ) { id = portletHandle ; } String namespacePrefix = runtimeContext . getNamespacePrefix ( ) ; if ( ParameterValidation . isNullOrEmpty ( namespacePrefix ) ) { namespacePrefix = PortletUtils . generateNamespaceFrom ( portletHandle ) ; } return new WSRPWindowContext ( id , namespacePrefix ) ; } private UserContext createUserContext ( final org . oasis . wsrp . v2 . UserContext userContext , String preferredLocale , final List < String > supportedLocales ) { return UserContextConverter . createPortalUserContextFrom ( userContext , supportedLocales , preferredLocale ) ; } private PortalContext createPortalContext ( final MimeRequest params , final MarkupRequest markupRequest ) { return new PortalContext ( ) { public String getInfo ( ) { return PortalContext . VERSION . toString ( ) ; } public Set < WindowState > getWindowStates ( ) { List < String > validNewWindowStates = params . getValidNewWindowStates ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( validNewWindowStates ) ) { Set < WindowState > states = new HashSet < WindowState > ( validNewWindowStates . size ( ) ) ; for ( String state : validNewWindowStates ) { states . add ( WSRPUtils . getJSR168WindowStateFromWSRPName ( state ) ) ; } return states ; } return markupRequest . getSupportedWindowStates ( ) ; } public Set < Mode > getModes ( ) { List < String > validNewModes = params . getValidNewModes ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( validNewModes ) ) { Set < Mode > modes = new HashSet < Mode > ( validNewModes . size ( ) ) ; for ( String mode : validNewModes ) { modes . add ( WSRPUtils . getJSR168PortletModeFromWSRPName ( mode ) ) ; } return modes ; } return markupRequest . getSupportedModes ( ) ; } public Map < String , String > getProperties ( ) { return Collections . emptyMap ( ) ; } } ; } private MediaType createMediaType ( MarkupRequest markupRequest ) throws UnsupportedMimeType { try { return MediaType . create ( markupRequest . getMediaType ( ) ) ; } catch ( IllegalArgumentException e ) { throw WSRP2ExceptionFactory . throwWSException ( UnsupportedMimeType . class , e . getLocalizedMessage ( ) , e ) ; } } private SecurityContext createSecurityContext ( final MimeRequest params , final RuntimeContext runtimeContext , final org . oasis . wsrp . v2 . UserContext wsrpUserContext ) { final HttpServletRequest request = ServletAccess . getRequest ( ) ; final boolean useSecurity ; if ( request != null && request . getRemoteUser ( ) != null ) { useSecurity = true ; } else { useSecurity = false ; } return new SecurityContext ( ) { public boolean isSecure ( ) { if ( useSecurity ) { return request . isSecure ( ) ; } else { return params . isSecureClientCommunication ( ) ; } } public String getAuthType ( ) { if ( useSecurity ) { return request . getAuthType ( ) ; } else { return null ; } } public String getRemoteUser ( ) { if ( useSecurity ) { return request . getRemoteUser ( ) ; } else { return null ; } } public Principal getUserPrincipal ( ) { if ( useSecurity ) { return request . getUserPrincipal ( ) ; } else { return null ; } } public boolean isUserInRole ( String roleName ) { if ( useSecurity ) { return request . isUserInRole ( roleName ) ; } else { return wsrpUserContext != null && wsrpUserContext . getUserCategories ( ) . contains ( roleName ) ; } } public boolean isAuthenticated ( ) { return useSecurity && request . getUserPrincipal ( ) != null ; } } ; } public PortletInvocation getInvocation ( ) { return invocation ; } public void setInvocation ( PortletInvocation invocation ) { this . invocation = invocation ; } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . pc . api . StateString ; import org . gatein . pc . api . invocation . ActionInvocation ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . HTTPRedirectionResponse ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . invocation . response . UpdateNavigationalStateResponse ; import org . gatein . pc . api . state . AccessMode ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . producer . handlers . MarkupHandler ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . BlockingInteractionResponse ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MimeRequest ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PerformBlockingInteraction ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RuntimeContext ; import org . oasis . wsrp . v2 . StateChange ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . oasis . wsrp . v2 . UpdateResponse ; import java . util . List ; class ActionRequestProcessor extends UpdateNavigationalStateResponseProcessor < BlockingInteractionResponse > { private final PerformBlockingInteraction performBlockingInteraction ; ActionRequestProcessor ( ProducerHelper producer , PerformBlockingInteraction performBlockingInteraction ) throws UnsupportedMimeType , UnsupportedWindowState , InvalidHandle , UnsupportedMode , MissingParameters , InvalidRegistration , OperationFailed , ModifyRegistrationRequired , UnsupportedLocale { super ( producer ) ; this . performBlockingInteraction = performBlockingInteraction ; prepareInvocation ( ) ; } RegistrationContext getRegistrationContext ( ) { return performBlockingInteraction . getRegistrationContext ( ) ; } RuntimeContext getRuntimeContext ( ) { return performBlockingInteraction . getRuntimeContext ( ) ; } MimeRequest getParams ( ) { return performBlockingInteraction . getMarkupParams ( ) ; } public PortletContext getPortletContext ( ) { return performBlockingInteraction . getPortletContext ( ) ; } org . oasis . wsrp . v2 . UserContext getUserContext ( ) { return performBlockingInteraction . getUserContext ( ) ; } String getContextName ( ) { return MarkupHandler . PBI ; } AccessMode getAccessMode ( ) throws MissingParameters { StateChange stateChange = performBlockingInteraction . getInteractionParams ( ) . getPortletStateChange ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( stateChange , "<STR_LIT>" , "<STR_LIT>" ) ; return WSRPUtils . getAccessModeFromStateChange ( stateChange ) ; } PortletInvocation initInvocation ( WSRPPortletInvocationContext context ) { ActionInvocation invocation = new ActionInvocation ( context ) ; InteractionParams interactionParams = performBlockingInteraction . getInteractionParams ( ) ; WSRPRequestContext requestContext = WSRPRequestContext . createRequestContext ( markupRequest , interactionParams ) ; invocation . setRequestContext ( requestContext ) ; StateString interactionState = createNavigationalState ( interactionParams . getInteractionState ( ) ) ; invocation . setInteractionState ( interactionState ) ; invocation . setForm ( requestContext . getForm ( ) ) ; processExtensionsFrom ( interactionParams . getClass ( ) , interactionParams . getExtensions ( ) ) ; return invocation ; } @ Override List < Extension > getResponseExtensionsFor ( BlockingInteractionResponse blockingInteractionResponse ) { return blockingInteractionResponse . getExtensions ( ) ; } protected BlockingInteractionResponse internalProcessResponse ( PortletInvocationResponse response ) { if ( response instanceof UpdateNavigationalStateResponse ) { UpdateNavigationalStateResponse stateResponse = ( UpdateNavigationalStateResponse ) response ; UpdateResponse updateResponse = createUpdateResponse ( stateResponse ) ; return WSRPTypeFactory . createBlockingInteractionResponse ( updateResponse ) ; } else { HTTPRedirectionResponse redirectionResult = ( HTTPRedirectionResponse ) response ; return WSRPTypeFactory . createBlockingInteractionResponse ( redirectionResult . getLocation ( ) ) ; } } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . spi . WindowContext ; public class WSRPWindowContext implements WindowContext { private final String id ; private final String ns ; public WSRPWindowContext ( String id , String namespacePrefix ) { ParameterValidation . throwIllegalArgExceptionIfNullOrEmpty ( id , "<STR_LIT:id>" , "<STR_LIT>" ) ; ParameterValidation . throwIllegalArgExceptionIfNullOrEmpty ( namespacePrefix , "<STR_LIT>" , "<STR_LIT>" ) ; this . id = id ; this . ns = namespacePrefix ; } public String getId ( ) { return id ; } public String getNamespace ( ) { return ns ; } } </s>
<s> package org . gatein . wsrp . producer . handlers . processors ; import org . gatein . pc . portlet . impl . spi . AbstractServerContext ; import org . gatein . wci . RequestDispatchCallback ; import org . gatein . wci . ServletContainer ; import org . gatein . wci . ServletContainerFactory ; import javax . servlet . ServletContext ; import javax . servlet . ServletException ; import javax . servlet . http . HttpServletRequest ; import javax . servlet . http . HttpServletResponse ; import java . io . IOException ; public class WSRPServerContext extends AbstractServerContext { public WSRPServerContext ( HttpServletRequest clientRequest , HttpServletResponse clientResponse ) { super ( clientRequest , clientResponse ) ; } @ Override public void dispatch ( ServletContext target , HttpServletRequest request , HttpServletResponse response , final Callable callable ) throws Exception { ServletContainer container = ServletContainerFactory . getServletContainer ( ) ; container . include ( target , request , response , new RequestDispatchCallback ( ) { @ Override public Object doCallback ( ServletContext dispatchedServletContext , HttpServletRequest dispatchedRequest , HttpServletResponse dispatchedResponse , Object handback ) throws ServletException , IOException { callable . call ( dispatchedServletContext , dispatchedRequest , dispatchedResponse ) ; return null ; } } , null ) ; } } </s>
<s> package org . gatein . wsrp . producer . handlers ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . Mode ; import org . gatein . pc . api . WindowState ; import org . gatein . registration . Consumer ; import org . gatein . registration . ConsumerCapabilities ; import org . gatein . registration . NoSuchRegistrationException ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationException ; import org . gatein . registration . RegistrationStatus ; import org . gatein . registration . RegistrationUtils ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . producer . RegistrationInterface ; import org . gatein . wsrp . producer . WSRPProducerImpl ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetRegistrationLifetime ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . Property ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationData ; import org . oasis . wsrp . v2 . RegistrationState ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . SetRegistrationLifetime ; import javax . xml . namespace . QName ; import java . util . ArrayList ; import java . util . Arrays ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Map ; public class RegistrationHandler extends ServiceHandler implements RegistrationInterface { public RegistrationHandler ( WSRPProducerImpl producer ) { super ( producer ) ; } public RegistrationContext register ( RegistrationData registrationData ) throws MissingParameters , OperationFailed , OperationNotSupported { ProducerRegistrationRequirements registrationRequirements = producer . getProducerRegistrationRequirements ( ) ; WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( registrationData , "<STR_LIT>" ) ; String consumerName = registrationData . getConsumerName ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( consumerName , "<STR_LIT>" , "<STR_LIT>" ) ; String consumerAgent = registrationData . getConsumerAgent ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( consumerAgent , "<STR_LIT>" , "<STR_LIT>" ) ; Registration registration ; try { log . debug ( "<STR_LIT>" + consumerName + "<STR_LIT>" + consumerAgent + "<STR_LIT>" ) ; RegistrationUtils . validateConsumerAgent ( consumerAgent ) ; registration = producer . getRegistrationManager ( ) . addRegistrationTo ( consumerName , createRegistrationProperties ( registrationData ) , registrationRequirements . getRegistrationProperties ( ) , true ) ; updateRegistrationInformation ( registration , registrationData ) ; } catch ( Exception e ) { String msg = "<STR_LIT>" + consumerName + "<STR_LIT:'>" ; log . debug ( msg , e ) ; throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , msg , e ) ; } RegistrationContext registrationContext = WSRPTypeFactory . createRegistrationContext ( registration . getRegistrationHandle ( ) ) ; log . debug ( "<STR_LIT>" ) ; return registrationContext ; } private void updateRegistrationInformation ( Registration registration , RegistrationData registrationData ) throws RegistrationException { registration . setStatus ( RegistrationStatus . VALID ) ; Consumer consumer = registration . getConsumer ( ) ; consumer . setConsumerAgent ( registrationData . getConsumerAgent ( ) ) ; ConsumerCapabilities capabilities = consumer . getCapabilities ( ) ; List < String > modeStrings = registrationData . getConsumerModes ( ) ; int modesNb = modeStrings . size ( ) ; if ( modesNb > <NUM_LIT:0> ) { List < Mode > modes = new ArrayList < Mode > ( modesNb ) ; for ( String modeString : modeStrings ) { modes . add ( WSRPUtils . getJSR168PortletModeFromWSRPName ( modeString ) ) ; } capabilities . setSupportedModes ( modes ) ; } List < String > wsStrings = registrationData . getConsumerWindowStates ( ) ; int wsNb = wsStrings . size ( ) ; if ( wsNb > <NUM_LIT:0> ) { List < WindowState > windowStates = new ArrayList < WindowState > ( wsNb ) ; for ( String wsString : wsStrings ) { windowStates . add ( WSRPUtils . getJSR168WindowStateFromWSRPName ( wsString ) ) ; } capabilities . setSupportedWindowStates ( windowStates ) ; } capabilities . setSupportedUserScopes ( registrationData . getConsumerUserScopes ( ) ) ; capabilities . setSupportsGetMethod ( registrationData . isMethodGetSupported ( ) ) ; producer . getRegistrationManager ( ) . getPersistenceManager ( ) . saveChangesTo ( consumer ) ; } public List < Extension > deregister ( RegistrationContext deregister ) throws InvalidRegistration , OperationFailed , OperationNotSupported , ResourceSuspended { if ( producer . getProducerRegistrationRequirements ( ) . isRegistrationRequired ( ) ) { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( deregister , "<STR_LIT>" ) ; String registrationHandle = deregister . getRegistrationHandle ( ) ; if ( ParameterValidation . isNullOrEmpty ( registrationHandle ) ) { throwInvalidRegistrationFault ( "<STR_LIT>" ) ; } log . debug ( "<STR_LIT>" + registrationHandle + "<STR_LIT:'>" ) ; String msg = "<STR_LIT>" + registrationHandle + "<STR_LIT:'>" ; try { producer . getRegistrationManager ( ) . removeRegistration ( registrationHandle ) ; } catch ( NoSuchRegistrationException e ) { log . debug ( msg , e ) ; throwInvalidRegistrationFault ( e . getLocalizedMessage ( ) ) ; } catch ( RegistrationException e ) { log . debug ( msg , e ) ; throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , msg , e ) ; } return Collections . emptyList ( ) ; } throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } public RegistrationState modifyRegistration ( ModifyRegistration modifyRegistration ) throws InvalidRegistration , MissingParameters , OperationFailed , OperationNotSupported , ResourceSuspended { if ( producer . getProducerRegistrationRequirements ( ) . isRegistrationRequired ( ) ) { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( modifyRegistration , "<STR_LIT>" ) ; RegistrationContext registrationContext = modifyRegistration . getRegistrationContext ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( registrationContext , "<STR_LIT>" , "<STR_LIT>" ) ; String registrationHandle = registrationContext . getRegistrationHandle ( ) ; if ( ParameterValidation . isNullOrEmpty ( registrationHandle ) ) { throwInvalidRegistrationFault ( "<STR_LIT>" ) ; } RegistrationData registrationData = modifyRegistration . getRegistrationData ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( registrationData , "<STR_LIT>" , "<STR_LIT>" ) ; String consumerName = registrationData . getConsumerName ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( consumerName , "<STR_LIT>" , "<STR_LIT>" ) ; String consumerAgent = registrationData . getConsumerAgent ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( consumerAgent , "<STR_LIT>" , "<STR_LIT>" ) ; log . debug ( "<STR_LIT>" + registrationHandle + "<STR_LIT:'>" ) ; String msg = "<STR_LIT>" + registrationHandle + "<STR_LIT:'>" ; try { Registration registration = producer . getRegistrationManager ( ) . getRegistration ( registrationHandle ) ; Map < QName , Object > properties = createRegistrationProperties ( registrationData ) ; ProducerRegistrationRequirements req = producer . getProducerRegistrationRequirements ( ) ; req . getPolicy ( ) . validateRegistrationDataFor ( properties , consumerName , req . getRegistrationProperties ( ) , producer . getRegistrationManager ( ) ) ; registration . updateProperties ( properties ) ; updateRegistrationInformation ( registration , registrationData ) ; } catch ( NoSuchRegistrationException e ) { log . debug ( msg , e ) ; throwInvalidRegistrationFault ( e . getLocalizedMessage ( ) ) ; } catch ( RegistrationException e ) { log . debug ( msg , e ) ; throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , msg , e ) ; } log . debug ( "<STR_LIT>" + registrationHandle + "<STR_LIT:'>" ) ; return null ; } throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } public Lifetime getRegistrationLifetime ( GetRegistrationLifetime getRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw WSRP2ExceptionFactory . throwWSException ( OperationNotSupported . class , "<STR_LIT>" , null ) ; } public Lifetime setRegistrationLifetime ( SetRegistrationLifetime setRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw WSRP2ExceptionFactory . throwWSException ( OperationNotSupported . class , "<STR_LIT>" , null ) ; } public boolean isRegistrationValid ( Registration reg , boolean throwExceptionIfInvalid ) throws InvalidRegistration , OperationFailed , ModifyRegistrationRequired { if ( reg == null ) { if ( producer . getProducerRegistrationRequirements ( ) . isRegistrationRequired ( ) ) { log . debug ( "<STR_LIT>" ) ; if ( throwExceptionIfInvalid ) { throwInvalidRegistrationFault ( "<STR_LIT>" ) ; } return false ; } log . debug ( "<STR_LIT>" ) ; return true ; } else { boolean isValid = RegistrationStatus . VALID . equals ( reg . getStatus ( ) ) ; boolean isPending = RegistrationStatus . PENDING . equals ( reg . getStatus ( ) ) ; log . debug ( "<STR_LIT>" + ( isValid ? "<STR_LIT>" : ( isPending ? "<STR_LIT>" : "<STR_LIT>" ) ) ) ; if ( throwExceptionIfInvalid ) { if ( isPending ) { WSRP2ExceptionFactory . throwWSException ( ModifyRegistrationRequired . class , "<STR_LIT>" + reg . getRegistrationHandle ( ) + "<STR_LIT>" , null ) ; } else { if ( ! isValid ) { throwInvalidRegistrationFault ( "<STR_LIT>" + reg . getRegistrationHandle ( ) + "<STR_LIT>" ) ; } } } return isValid ; } } public Registration getRegistrationFrom ( RegistrationContext registrationContext ) throws InvalidRegistration , OperationFailed { if ( producer . getProducerRegistrationRequirements ( ) . isRegistrationRequired ( ) ) { if ( registrationContext == null ) { throwInvalidRegistrationFault ( "<STR_LIT>" ) ; } } if ( registrationContext != null ) { String regHandle = registrationContext . getRegistrationHandle ( ) ; if ( regHandle == null ) { throwInvalidRegistrationFault ( "<STR_LIT>" ) ; } try { Registration registration = producer . getRegistrationManager ( ) . getRegistration ( regHandle ) ; if ( registration == null ) { throwInvalidRegistrationFault ( "<STR_LIT>" + regHandle + "<STR_LIT>" ) ; } return registration ; } catch ( RegistrationException e ) { throwOperationFailedFault ( "<STR_LIT>" + regHandle , e ) ; return null ; } } else { try { Registration registration = producer . getRegistrationManager ( ) . getNonRegisteredRegistration ( ) ; if ( registration == null ) { throwInvalidRegistrationFault ( "<STR_LIT>" ) ; } return registration ; } catch ( RegistrationException e ) { throwOperationFailedFault ( "<STR_LIT>" , e ) ; return null ; } } } private void throwOperationFailedFault ( String message , RegistrationException e ) throws OperationFailed { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , message , e ) ; } boolean throwInvalidRegistrationFault ( String message ) throws InvalidRegistration { throw WSRP2ExceptionFactory . throwWSException ( InvalidRegistration . class , "<STR_LIT>" + message , null ) ; } private Map < QName , Object > createRegistrationProperties ( RegistrationData registrationData ) { List < Property > regProperties = registrationData . getRegistrationProperties ( ) ; Map < QName , Object > properties ; if ( regProperties != null && ! regProperties . isEmpty ( ) ) { properties = new HashMap < QName , Object > ( regProperties . size ( ) ) ; for ( Property property : regProperties ) { QName propName = property . getName ( ) ; String propValue = property . getStringValue ( ) ; if ( producer . getProducerRegistrationRequirements ( ) . acceptValueFor ( propName , propValue ) ) { properties . put ( propName , propValue ) ; } else { throw new IllegalArgumentException ( "<STR_LIT>" + propName + "<STR_LIT>" + propValue + "<STR_LIT>" ) ; } } } else { properties = Collections . emptyMap ( ) ; } return properties ; } private List getListFromArray ( String [ ] array , boolean useEmptyForNull ) { if ( array == null ) { return useEmptyForNull ? Collections . EMPTY_LIST : null ; } return Arrays . asList ( array ) ; } } </s>
<s> package org . gatein . wsrp . producer . handlers ; import org . gatein . common . net . media . MediaType ; import org . gatein . common . util . ParameterValidation ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . TransportGuarantee ; import org . gatein . pc . api . info . CapabilitiesInfo ; import org . gatein . pc . api . info . EventInfo ; import org . gatein . pc . api . info . EventingInfo ; import org . gatein . pc . api . info . MetaInfo ; import org . gatein . pc . api . info . ModeInfo ; import org . gatein . pc . api . info . NavigationInfo ; import org . gatein . pc . api . info . ParameterInfo ; import org . gatein . pc . api . info . PortletInfo ; import org . gatein . pc . api . info . RuntimeOptionInfo ; import org . gatein . pc . api . info . SecurityInfo ; import org . gatein . pc . api . info . WindowStateInfo ; import org . gatein . pc . portlet . container . managed . LifeCycleStatus ; import org . gatein . pc . portlet . container . managed . ManagedObject ; import org . gatein . pc . portlet . container . managed . ManagedObjectEvent ; import org . gatein . pc . portlet . container . managed . ManagedObjectLifeCycleEvent ; import org . gatein . pc . portlet . container . managed . ManagedObjectRegistryEvent ; import org . gatein . pc . portlet . container . managed . ManagedObjectRegistryEventListener ; import org . gatein . pc . portlet . container . managed . ManagedPortletContainer ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationLocal ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . producer . ServiceDescriptionInterface ; import org . gatein . wsrp . producer . Utils ; import org . gatein . wsrp . producer . WSRPProducerImpl ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . gatein . wsrp . spec . v2 . WSRP2Constants ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . EventDescription ; import org . oasis . wsrp . v2 . GetServiceDescription ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . MarkupType ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . ParameterDescription ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . ServiceDescription ; import javax . xml . namespace . QName ; import java . util . ArrayList ; import java . util . Collection ; import java . util . Collections ; import java . util . HashMap ; import java . util . List ; import java . util . Locale ; import java . util . Map ; import java . util . Set ; public class ServiceDescriptionHandler extends ServiceHandler implements ServiceDescriptionInterface , ManagedObjectRegistryEventListener { private static final CookieProtocol BEA_8_CONSUMER_FIX = CookieProtocol . PER_USER ; private ServiceDescriptionInfo serviceDescription ; private static final List < String > OPTIONS = new ArrayList < String > ( <NUM_LIT:5> ) ; static { OPTIONS . add ( WSRP2Constants . OPTIONS_EVENTS ) ; OPTIONS . add ( WSRP2Constants . OPTIONS_IMPORT ) ; OPTIONS . add ( WSRP2Constants . OPTIONS_EXPORT ) ; OPTIONS . add ( WSRP2Constants . OPTIONS_COPYPORTLETS ) ; } public ServiceDescriptionHandler ( WSRPProducerImpl producer ) { super ( producer ) ; reset ( ) ; } public ServiceDescription getServiceDescription ( GetServiceDescription gs ) throws InvalidRegistration , ModifyRegistrationRequired , OperationFailed , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( gs , "<STR_LIT>" ) ; try { RegistrationContext registrationContext = gs . getRegistrationContext ( ) ; Registration registration = null ; if ( registrationContext != null ) { registration = producer . getRegistrationOrFailIfInvalid ( registrationContext ) ; RegistrationLocal . setRegistration ( registration ) ; } ProducerRegistrationRequirements requirements = producer . getProducerRegistrationRequirements ( ) ; serviceDescription . updateRegistrationProperties ( requirements ) ; boolean needsRegistrationProperties = registration == null && requirements . isRegistrationRequired ( ) ; boolean needsPortletDescriptions = ! ( registration == null && requirements . isRegistrationRequired ( ) && requirements . isRegistrationRequiredForFullDescription ( ) ) ; return serviceDescription . getServiceDescription ( needsRegistrationProperties , needsPortletDescriptions , gs . getPortletHandles ( ) , gs . getDesiredLocales ( ) ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } public PortletDescription getPortletDescription ( PortletContext portletContext , List < String > desiredLocales , Registration registration ) throws InvalidHandle , OperationFailed { ParameterValidation . throwIllegalArgExceptionIfNull ( portletContext , "<STR_LIT>" ) ; return serviceDescription . getPortletDescription ( portletContext , desiredLocales , registration ) ; } public void onEvent ( ManagedObjectRegistryEvent event ) { if ( event instanceof ManagedObjectEvent ) { ManagedObjectEvent managedObjectEvent = ( ManagedObjectEvent ) event ; ManagedObject managedObject = managedObjectEvent . getManagedObject ( ) ; if ( managedObject instanceof ManagedPortletContainer ) { ManagedPortletContainer portletContainer = ( ManagedPortletContainer ) managedObject ; String applicationId = portletContainer . getManagedPortletApplication ( ) . getId ( ) ; String containerId = portletContainer . getId ( ) ; org . gatein . pc . api . PortletContext pc = org . gatein . pc . api . PortletContext . createPortletContext ( applicationId , containerId ) ; if ( managedObjectEvent instanceof ManagedObjectLifeCycleEvent ) { ManagedObjectLifeCycleEvent lifeCycleEvent = ( ManagedObjectLifeCycleEvent ) managedObjectEvent ; LifeCycleStatus status = lifeCycleEvent . getStatus ( ) ; if ( LifeCycleStatus . STARTED . equals ( status ) ) { final PortletInfo info = portletContainer . getInfo ( ) ; if ( isRemotable ( info . getRuntimeOptionsInfo ( ) ) ) { serviceDescription . addPortletDescription ( pc , info ) ; } } else { serviceDescription . removePortletDescription ( pc ) ; } } } } } private static List < String > getLocaleNamesFrom ( Collection < Locale > locales ) { if ( locales == null || locales . isEmpty ( ) ) { return null ; } List < String > localeNames = new ArrayList < String > ( locales . size ( ) ) ; for ( Locale locale : locales ) { localeNames . add ( WSRPUtils . toString ( locale ) ) ; } return localeNames ; } private static List < String > getWindowStateNamesFrom ( Collection < WindowStateInfo > windowStates ) { List < String > result = new ArrayList < String > ( windowStates . size ( ) ) ; for ( WindowStateInfo windowStateInfo : windowStates ) { result . add ( WSRPUtils . convertJSR168WindowStateNameToWSRPName ( windowStateInfo . getWindowStateName ( ) ) ) ; } return result ; } private static List < String > getModeNamesFrom ( Collection < ModeInfo > modes ) { List < String > result = new ArrayList < String > ( modes . size ( ) ) ; for ( ModeInfo modeInfo : modes ) { result . add ( WSRPUtils . convertJSR168PortletModeNameToWSRPName ( modeInfo . getModeName ( ) ) ) ; } return result ; } public void reset ( ) { serviceDescription = new ServiceDescriptionInfo ( ) ; } public boolean isRemotable ( Map < String , RuntimeOptionInfo > runtimeOptions ) { RuntimeOptionInfo runtimeOptionInfo = runtimeOptions . get ( RuntimeOptionInfo . REMOTABLE_RUNTIME_OPTION ) ; return runtimeOptionInfo != null && "<STR_LIT:true>" . equals ( runtimeOptionInfo . getValues ( ) . get ( <NUM_LIT:0> ) ) ; } private class ServiceDescriptionInfo { private long lastGenerated ; private Map < QName , EventDescription > eventDescriptions ; private Map < QName , Integer > eventReferenceCount ; private Map < String , PortletDescriptionInfo > portletDescriptions ; private ModelDescription registrationProperties ; private boolean initialized = false ; private boolean requireRegistrations ; private ServiceDescriptionInfo ( ) { reset ( ) ; } void reset ( ) { lastGenerated = <NUM_LIT:0> ; eventDescriptions = new HashMap < QName , EventDescription > ( <NUM_LIT> ) ; eventReferenceCount = new HashMap < QName , Integer > ( <NUM_LIT> ) ; portletDescriptions = new HashMap < String , PortletDescriptionInfo > ( <NUM_LIT> ) ; registrationProperties = null ; initialized = false ; requireRegistrations = false ; } private void updateRegistrationProperties ( ProducerRegistrationRequirements requirements ) { long lastModified = requirements . getLastModified ( ) ; if ( lastModified > lastGenerated ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "<STR_LIT>" ) ; } Map < QName , RegistrationPropertyDescription > info = requirements . getRegistrationProperties ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( info ) ) { registrationProperties = Utils . convertRegistrationPropertiesToModelDescription ( info ) ; } else { registrationProperties = null ; } requireRegistrations = requirements . isRegistrationRequired ( ) ; lastGenerated = System . nanoTime ( ) ; } } private void updatePortletDescriptions ( ) { try { Set < Portlet > portlets = producer . getRemotablePortlets ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( portlets ) ) { for ( Portlet portlet : portlets ) { addPortletDescription ( portlet . getContext ( ) , portlet . getInfo ( ) ) ; } } initialized = true ; } catch ( PortletInvokerException e ) { log . warn ( "<STR_LIT>" , e ) ; } } private ServiceDescription getServiceDescription ( boolean needsRegistrationProperties , boolean needsPortletDescriptions , List < String > portletHandles , List < String > desiredLocales ) { initIfNeeded ( ) ; ModelDescription registrationProperties = needsRegistrationProperties ? this . registrationProperties : null ; ServiceDescription serviceDescription = WSRPTypeFactory . createServiceDescription ( false ) ; serviceDescription . setRequiresInitCookie ( BEA_8_CONSUMER_FIX ) ; List < String > supportedLocales = producer . getSupportedLocales ( ) ; serviceDescription . getLocales ( ) . addAll ( supportedLocales ) ; serviceDescription . getSupportedOptions ( ) . addAll ( OPTIONS ) ; serviceDescription . setRegistrationPropertyDescription ( registrationProperties ) ; serviceDescription . setRequiresRegistration ( requireRegistrations ) ; Collection < PortletDescription > portlets ; if ( needsPortletDescriptions ) { if ( ! ParameterValidation . existsAndIsNotEmpty ( portletHandles ) ) { portletHandles = new ArrayList < String > ( portletDescriptions . keySet ( ) ) ; } portlets = new ArrayList < PortletDescription > ( portletHandles . size ( ) ) ; for ( String handle : portletHandles ) { PortletDescription description = getPortletDescription ( handle , desiredLocales ) ; if ( description != null ) { portlets . add ( description ) ; } } serviceDescription . getOfferedPortlets ( ) . addAll ( portlets ) ; } Collection < EventDescription > events = eventDescriptions . values ( ) ; serviceDescription . getEventDescriptions ( ) . addAll ( events ) ; return serviceDescription ; } private void initIfNeeded ( ) { if ( ! initialized ) { updatePortletDescriptions ( ) ; } } private void addEventInfo ( EventInfo info , Locale locale ) { QName name = info . getName ( ) ; if ( ! eventDescriptions . containsKey ( name ) ) { EventDescription desc = WSRPTypeFactory . createEventDescription ( name ) ; desc . setDescription ( Utils . convertToWSRPLocalizedString ( info . getDescription ( ) , locale ) ) ; desc . setLabel ( Utils . convertToWSRPLocalizedString ( info . getDisplayName ( ) , locale ) ) ; Collection < QName > aliases = info . getAliases ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( aliases ) ) { desc . getAliases ( ) . addAll ( aliases ) ; } eventDescriptions . put ( name , desc ) ; eventReferenceCount . put ( name , <NUM_LIT:1> ) ; } else { Integer current = eventReferenceCount . get ( name ) ; eventReferenceCount . put ( name , current + <NUM_LIT:1> ) ; } } private void removeEvent ( QName name ) { Integer current = eventReferenceCount . get ( name ) ; if ( current != null ) { if ( current == <NUM_LIT:1> ) { eventDescriptions . remove ( name ) ; eventReferenceCount . remove ( name ) ; } else { eventReferenceCount . put ( name , current - <NUM_LIT:1> ) ; } } } private void addPortletDescription ( org . gatein . pc . api . PortletContext context , PortletInfo info ) { String handle = context . getId ( ) ; PortletDescriptionInfo desc = createPortletDescription ( info , handle ) ; portletDescriptions . put ( handle , desc ) ; } private PortletDescriptionInfo createPortletDescription ( PortletInfo info , String handle ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "<STR_LIT>" + handle ) ; } CapabilitiesInfo capInfo = info . getCapabilities ( ) ; Collection < MediaType > allMediaTypes = capInfo . getMediaTypes ( ) ; List < MarkupType > markupTypes = new ArrayList < MarkupType > ( allMediaTypes . size ( ) ) ; for ( MediaType mediaType : allMediaTypes ) { MarkupType markupType = WSRPTypeFactory . createMarkupType ( mediaType . getValue ( ) , getModeNamesFrom ( capInfo . getModes ( mediaType ) ) , getWindowStateNamesFrom ( capInfo . getWindowStates ( mediaType ) ) , getLocaleNamesFrom ( capInfo . getLocales ( mediaType ) ) ) ; markupTypes . add ( markupType ) ; } MetaInfo metaInfo = info . getMeta ( ) ; Set < Locale > supportedLocales = info . getCapabilities ( ) . getAllLocales ( ) ; List < String > supportedLanguages ; if ( supportedLocales . size ( ) == <NUM_LIT:0> ) { supportedLocales = Collections . singleton ( Locale . ENGLISH ) ; supportedLanguages = Collections . singletonList ( "<STR_LIT:en>" ) ; } else { supportedLanguages = WSRPUtils . convertLocalesToRFC3066LanguageTags ( new ArrayList < Locale > ( supportedLocales ) ) ; } PortletDescriptionInfo descriptionInfo = portletDescriptions . get ( handle ) ; if ( descriptionInfo == null ) { descriptionInfo = new PortletDescriptionInfo ( supportedLanguages ) ; portletDescriptions . put ( handle , descriptionInfo ) ; } for ( Locale localeMatch : supportedLocales ) { PortletDescription desc = WSRPTypeFactory . createPortletDescription ( handle , markupTypes ) ; desc . setGroupID ( info . getApplicationName ( ) ) ; desc . setDescription ( Utils . convertToWSRPLocalizedString ( metaInfo . getMetaValue ( MetaInfo . DESCRIPTION ) , localeMatch ) ) ; desc . setShortTitle ( Utils . convertToWSRPLocalizedString ( metaInfo . getMetaValue ( MetaInfo . SHORT_TITLE ) , localeMatch ) ) ; desc . setTitle ( Utils . convertToWSRPLocalizedString ( metaInfo . getMetaValue ( MetaInfo . TITLE ) , localeMatch ) ) ; desc . setDisplayName ( Utils . convertToWSRPLocalizedString ( metaInfo . getMetaValue ( MetaInfo . DISPLAY_NAME ) , localeMatch ) ) ; org . oasis . wsrp . v2 . LocalizedString concatenatedKeywords = Utils . convertToWSRPLocalizedString ( metaInfo . getMetaValue ( MetaInfo . KEYWORDS ) , localeMatch ) ; if ( concatenatedKeywords != null ) { String commaSeparatedKeywords = concatenatedKeywords . getValue ( ) ; if ( commaSeparatedKeywords != null && commaSeparatedKeywords . length ( ) > <NUM_LIT:0> ) { String lang = concatenatedKeywords . getLang ( ) ; String [ ] keywordArray = commaSeparatedKeywords . split ( "<STR_LIT:U+002C>" ) ; for ( String keyword : keywordArray ) { desc . getKeywords ( ) . add ( WSRPTypeFactory . createLocalizedString ( lang , concatenatedKeywords . getResourceName ( ) , keyword . trim ( ) ) ) ; } } } EventingInfo eventsInfo = info . getEventing ( ) ; if ( eventsInfo != null ) { Map < QName , ? extends EventInfo > producedEvents = eventsInfo . getProducedEvents ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( producedEvents ) ) { List < QName > publishedEvents = desc . getPublishedEvents ( ) ; for ( Map . Entry < QName , ? extends EventInfo > entry : producedEvents . entrySet ( ) ) { publishedEvents . add ( entry . getKey ( ) ) ; addEventInfo ( entry . getValue ( ) , localeMatch ) ; } } Map < QName , ? extends EventInfo > consumedEvents = eventsInfo . getConsumedEvents ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( consumedEvents ) ) { List < QName > handledEvents = desc . getHandledEvents ( ) ; for ( Map . Entry < QName , ? extends EventInfo > entry : consumedEvents . entrySet ( ) ) { handledEvents . add ( entry . getKey ( ) ) ; addEventInfo ( entry . getValue ( ) , localeMatch ) ; } } } NavigationInfo navigationInfo = info . getNavigation ( ) ; if ( navigationInfo != null ) { Collection < ? extends ParameterInfo > parameterInfos = navigationInfo . getPublicParameters ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( parameterInfos ) ) { List < ParameterDescription > publicValueDescriptions = desc . getNavigationalPublicValueDescriptions ( ) ; for ( ParameterInfo parameterInfo : parameterInfos ) { String id = parameterInfo . getId ( ) ; ParameterDescription paramDesc = WSRPTypeFactory . createParameterDescription ( id ) ; paramDesc . setDescription ( Utils . convertToWSRPLocalizedString ( parameterInfo . getDescription ( ) , localeMatch ) ) ; paramDesc . setLabel ( WSRPTypeFactory . createLocalizedString ( id ) ) ; List < QName > names = paramDesc . getNames ( ) ; names . add ( parameterInfo . getName ( ) ) ; Collection < QName > aliases = parameterInfo . getAliases ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( aliases ) ) { names . addAll ( aliases ) ; } publicValueDescriptions . add ( paramDesc ) ; } } } SecurityInfo secInfo = info . getSecurity ( ) ; if ( secInfo . containsTransportGuarantee ( TransportGuarantee . INTEGRAL ) || secInfo . containsTransportGuarantee ( TransportGuarantee . CONFIDENTIAL ) ) { desc . setOnlySecure ( true ) ; } descriptionInfo . addDescriptionFor ( WSRPUtils . toString ( localeMatch ) , desc ) ; } return descriptionInfo ; } public PortletDescription getPortletDescription ( PortletContext context , List < String > desiredLocales , Registration registration ) { initIfNeeded ( ) ; org . gatein . pc . api . PortletContext pcContext = WSRPUtils . convertToPortalPortletContext ( context ) ; if ( producer . getRegistrationManager ( ) . getPolicy ( ) . allowAccessTo ( pcContext , registration , "<STR_LIT>" ) ) { PortletDescription description = getPortletDescription ( context . getPortletHandle ( ) , desiredLocales ) ; if ( description == null ) { if ( registration . knows ( pcContext ) ) { try { Portlet portlet = producer . getPortletWith ( pcContext , registration ) ; PortletInfo info = portlet . getInfo ( ) ; org . gatein . pc . api . PortletContext original = org . gatein . pc . api . PortletContext . createPortletContext ( info . getApplicationName ( ) , info . getName ( ) ) ; return getPortletDescription ( original . getId ( ) , desiredLocales ) ; } catch ( Exception e ) { log . debug ( "<STR_LIT>" + pcContext , e ) ; return null ; } } } return description ; } else { return null ; } } private PortletDescription getPortletDescription ( final String portletHandle , List < String > desiredLocales ) { PortletDescriptionInfo descriptionInfo = portletDescriptions . get ( portletHandle ) ; if ( descriptionInfo != null ) { return descriptionInfo . getBestDescriptionFor ( desiredLocales ) ; } else { return null ; } } public void removePortletDescription ( org . gatein . pc . api . PortletContext pc ) { String handle = WSRPUtils . convertToWSRPPortletContext ( pc ) . getPortletHandle ( ) ; PortletDescription description = getPortletDescription ( handle , null ) ; if ( description != null ) { for ( QName event : description . getHandledEvents ( ) ) { removeEvent ( event ) ; } for ( QName event : description . getPublishedEvents ( ) ) { removeEvent ( event ) ; } portletDescriptions . remove ( handle ) ; } } private class PortletDescriptionInfo { private Map < String , PortletDescription > languageToDescription ; private PortletDescriptionInfo ( List < String > supportedLanguages ) { languageToDescription = new HashMap < String , PortletDescription > ( supportedLanguages . size ( ) ) ; for ( String supportedLanguage : supportedLanguages ) { languageToDescription . put ( supportedLanguage , null ) ; } } public Set < String > getSupportedLanguages ( ) { return languageToDescription . keySet ( ) ; } public PortletDescription getBestDescriptionFor ( List < String > desiredLanguages ) { String language = null ; Set < String > supportedLanguages = getSupportedLanguages ( ) ; if ( desiredLanguages != null ) { for ( String languageTag : desiredLanguages ) { if ( supportedLanguages . contains ( languageTag ) ) { language = languageTag ; } } if ( language == null ) { for ( String desiredLanguage : desiredLanguages ) { for ( String supportedLanguage : supportedLanguages ) { if ( supportedLanguage . startsWith ( desiredLanguage ) ) { language = supportedLanguage ; } } } } } if ( language == null ) { language = "<STR_LIT:en>" ; } return languageToDescription . get ( language ) ; } public void addDescriptionFor ( String language , PortletDescription desc ) { languageToDescription . put ( language , desc ) ; } } } } </s>
<s> package org . gatein . wsrp . producer . handlers ; import com . google . common . base . Function ; import com . google . common . collect . HashMultimap ; import com . google . common . collect . Multimap ; import org . gatein . common . i18n . LocalizedString ; import org . gatein . common . logging . Logger ; import org . gatein . common . logging . LoggerFactory ; import org . gatein . common . util . ParameterValidation ; import org . gatein . exports . data . ExportContext ; import org . gatein . exports . data . ExportPortletData ; import org . gatein . pc . api . InvalidPortletIdException ; import org . gatein . pc . api . NoSuchPortletException ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . PortletStateType ; import org . gatein . pc . api . info . PortletInfo ; import org . gatein . pc . api . info . PreferenceInfo ; import org . gatein . pc . api . info . PreferencesInfo ; import org . gatein . pc . api . state . DestroyCloneFailure ; import org . gatein . pc . api . state . PropertyChange ; import org . gatein . pc . api . state . PropertyMap ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationLocal ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPExceptionFactory ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . producer . PortletManagementInterface ; import org . gatein . wsrp . producer . Utils ; import org . gatein . wsrp . producer . WSRPProducerImpl ; import org . gatein . wsrp . spec . v2 . ErrorCodes ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . ClonePortlet ; import org . oasis . wsrp . v2 . CopiedPortlet ; import org . oasis . wsrp . v2 . CopyPortlets ; import org . oasis . wsrp . v2 . CopyPortletsResponse ; import org . oasis . wsrp . v2 . DestroyPortlets ; import org . oasis . wsrp . v2 . DestroyPortletsResponse ; import org . oasis . wsrp . v2 . ExportByValueNotSupported ; import org . oasis . wsrp . v2 . ExportPortlets ; import org . oasis . wsrp . v2 . ExportPortletsResponse ; import org . oasis . wsrp . v2 . ExportedPortlet ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . FailedPortlets ; import org . oasis . wsrp . v2 . GetPortletDescription ; import org . oasis . wsrp . v2 . GetPortletProperties ; import org . oasis . wsrp . v2 . GetPortletPropertyDescription ; import org . oasis . wsrp . v2 . GetPortletsLifetime ; import org . oasis . wsrp . v2 . GetPortletsLifetimeResponse ; import org . oasis . wsrp . v2 . ImportPortlet ; import org . oasis . wsrp . v2 . ImportPortlets ; import org . oasis . wsrp . v2 . ImportPortletsFailed ; import org . oasis . wsrp . v2 . ImportPortletsResponse ; import org . oasis . wsrp . v2 . ImportedPortlet ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . PortletDescriptionResponse ; import org . oasis . wsrp . v2 . PortletPropertyDescriptionResponse ; import org . oasis . wsrp . v2 . Property ; import org . oasis . wsrp . v2 . PropertyDescription ; import org . oasis . wsrp . v2 . PropertyList ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ReleaseExport ; import org . oasis . wsrp . v2 . ResetProperty ; import org . oasis . wsrp . v2 . ResourceList ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . SetExportLifetime ; import org . oasis . wsrp . v2 . SetPortletProperties ; import org . oasis . wsrp . v2 . SetPortletsLifetime ; import org . oasis . wsrp . v2 . SetPortletsLifetimeResponse ; import org . oasis . wsrp . v2 . UserContext ; import javax . xml . datatype . DatatypeConfigurationException ; import javax . xml . datatype . DatatypeFactory ; import javax . xml . datatype . Duration ; import javax . xml . datatype . XMLGregorianCalendar ; import javax . xml . namespace . QName ; import java . util . ArrayList ; import java . util . Collections ; import java . util . Date ; import java . util . GregorianCalendar ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; public class PortletManagementHandler extends ServiceHandler implements PortletManagementInterface { private static final String GET_PORTLET_PROPERTY_DESCRIPTION = "<STR_LIT>" ; private static final String GET_PORTLET_PROPERTIES = "<STR_LIT>" ; private static final String PORTLET_CONTEXT = "<STR_LIT>" ; private static final String GET_PORTLET_DESCRIPTION = "<STR_LIT>" ; private static final Logger log = LoggerFactory . getLogger ( PortletManagementHandler . class ) ; public PortletManagementHandler ( WSRPProducerImpl producer ) { super ( producer ) ; } public PortletDescriptionResponse getPortletDescription ( GetPortletDescription getPortletDescription ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( getPortletDescription , GET_PORTLET_DESCRIPTION ) ; Registration registration = producer . getRegistrationOrFailIfInvalid ( getPortletDescription . getRegistrationContext ( ) ) ; PortletContext portletContext = getPortletDescription . getPortletContext ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletContext , PORTLET_CONTEXT , GET_PORTLET_DESCRIPTION ) ; UserContext userContext = getPortletDescription . getUserContext ( ) ; checkUserAuthorization ( userContext ) ; PortletDescription description = producer . getPortletDescription ( portletContext , getPortletDescription . getDesiredLocales ( ) , registration ) ; return WSRPTypeFactory . createPortletDescriptionResponse ( description ) ; } public PortletPropertyDescriptionResponse getPortletPropertyDescription ( GetPortletPropertyDescription getPortletPropertyDescription ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( getPortletPropertyDescription , GET_PORTLET_PROPERTY_DESCRIPTION ) ; PortletContext portletContext = getPortletPropertyDescription . getPortletContext ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletContext , PORTLET_CONTEXT , GET_PORTLET_PROPERTY_DESCRIPTION ) ; try { Registration registration = producer . getRegistrationOrFailIfInvalid ( getPortletPropertyDescription . getRegistrationContext ( ) ) ; RegistrationLocal . setRegistration ( registration ) ; UserContext userContext = getPortletPropertyDescription . getUserContext ( ) ; checkUserAuthorization ( userContext ) ; Portlet portlet = getPortletFrom ( portletContext , registration ) ; PortletInfo info = portlet . getInfo ( ) ; PreferencesInfo prefsInfo = info . getPreferences ( ) ; List < PropertyDescription > descs = Collections . emptyList ( ) ; if ( prefsInfo != null ) { Set keySet = prefsInfo . getKeys ( ) ; descs = new ArrayList < PropertyDescription > ( keySet . size ( ) ) ; for ( Object key : keySet ) { PreferenceInfo prefInfo = prefsInfo . getPreference ( ( String ) key ) ; Boolean readOnly = prefInfo . isReadOnly ( ) ; if ( readOnly != null && ! readOnly ) { List < String > desiredLocales = getPortletPropertyDescription . getDesiredLocales ( ) ; PropertyDescription desc = WSRPTypeFactory . createPropertyDescription ( prefInfo . getKey ( ) , WSRPConstants . XSD_STRING ) ; desc . setLabel ( Utils . convertToWSRPLocalizedString ( prefInfo . getDisplayName ( ) , desiredLocales ) ) ; desc . setHint ( Utils . convertToWSRPLocalizedString ( prefInfo . getDescription ( ) , desiredLocales ) ) ; descs . add ( desc ) ; } } } return WSRPTypeFactory . createPortletPropertyDescriptionResponse ( descs ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } public PortletContext clonePortlet ( ClonePortlet clonePortlet ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( clonePortlet , "<STR_LIT>" ) ; PortletContext portletContext = clonePortlet . getPortletContext ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletContext , "<STR_LIT>" , "<STR_LIT>" ) ; Registration registration = producer . getRegistrationOrFailIfInvalid ( clonePortlet . getRegistrationContext ( ) ) ; UserContext userContext = clonePortlet . getUserContext ( ) ; checkUserAuthorization ( userContext ) ; org . gatein . pc . api . PortletContext portalPC = WSRPUtils . convertToPortalPortletContext ( portletContext ) ; try { RegistrationLocal . setRegistration ( registration ) ; org . gatein . pc . api . PortletContext response = producer . getPortletInvoker ( ) . createClone ( PortletStateType . OPAQUE , portalPC ) ; return WSRPUtils . convertToWSRPPortletContext ( response ) ; } catch ( NoSuchPortletException e ) { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) , e ) ; } catch ( InvalidPortletIdException e ) { throw WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) , e ) ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } public DestroyPortletsResponse destroyPortlets ( DestroyPortlets destroyPortlets ) throws InconsistentParameters , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( destroyPortlets , "<STR_LIT>" ) ; List < String > handles = destroyPortlets . getPortletHandles ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( handles , "<STR_LIT>" , "<STR_LIT>" ) ; Registration registration = producer . getRegistrationOrFailIfInvalid ( destroyPortlets . getRegistrationContext ( ) ) ; List < org . gatein . pc . api . PortletContext > portletContexts = new ArrayList < org . gatein . pc . api . PortletContext > ( handles . size ( ) ) ; for ( String handle : handles ) { portletContexts . add ( org . gatein . pc . api . PortletContext . createPortletContext ( handle ) ) ; } try { RegistrationLocal . setRegistration ( registration ) ; List < DestroyCloneFailure > failuresList = producer . getPortletInvoker ( ) . destroyClones ( portletContexts ) ; int failuresNumber = failuresList . size ( ) ; List < FailedPortlets > failedPortlets ; if ( failuresNumber > <NUM_LIT:0> ) { Multimap < String , String > reasonToHandles = HashMultimap . create ( failuresNumber , <NUM_LIT:1> ) ; for ( DestroyCloneFailure failure : failuresList ) { reasonToHandles . put ( failure . getMessage ( ) , failure . getPortletId ( ) ) ; } failedPortlets = new ArrayList < FailedPortlets > ( reasonToHandles . size ( ) ) ; for ( String reason : reasonToHandles . keys ( ) ) { failedPortlets . add ( WSRPTypeFactory . createFailedPortlets ( reasonToHandles . get ( reason ) , ErrorCodes . Codes . OPERATIONFAILED , reason ) ) ; } } else { failedPortlets = null ; } return WSRPTypeFactory . createDestroyPortletsResponse ( failedPortlets ) ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } public GetPortletsLifetimeResponse getPortletsLifetime ( GetPortletsLifetime getPortletsLifetime ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw WSRP2ExceptionFactory . throwWSException ( OperationNotSupported . class , "<STR_LIT>" , null ) ; } public SetPortletsLifetimeResponse setPortletsLifetime ( SetPortletsLifetime setPortletsLifetime ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { throw WSRP2ExceptionFactory . throwWSException ( OperationNotSupported . class , "<STR_LIT>" , null ) ; } public CopyPortletsResponse copyPortlets ( CopyPortlets copyPortlets ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( copyPortlets , "<STR_LIT>" ) ; List < PortletContext > portletContexts = copyPortlets . getFromPortletContexts ( ) ; if ( ! ParameterValidation . existsAndIsNotEmpty ( portletContexts ) ) { throw WSRP2ExceptionFactory . createWSException ( MissingParameters . class , "<STR_LIT>" , null ) ; } Registration fromRegistration = producer . getRegistrationOrFailIfInvalid ( copyPortlets . getFromRegistrationContext ( ) ) ; RegistrationContext toRegistationContext = copyPortlets . getToRegistrationContext ( ) ; if ( toRegistationContext == null ) { toRegistationContext = copyPortlets . getFromRegistrationContext ( ) ; } Registration toRegistration = producer . getRegistrationOrFailIfInvalid ( toRegistationContext ) ; UserContext fromUserContext = copyPortlets . getFromUserContext ( ) ; checkUserAuthorization ( fromUserContext ) ; UserContext toUserContext = copyPortlets . getToUserContext ( ) ; checkUserAuthorization ( toUserContext ) ; try { RegistrationLocal . setRegistration ( fromRegistration ) ; Map < String , FailedPortlets > failedPortletsMap = new HashMap < String , FailedPortlets > ( portletContexts . size ( ) ) ; List < CopiedPortlet > copiedPortlets = new ArrayList < CopiedPortlet > ( portletContexts . size ( ) ) ; for ( PortletContext portletContext : portletContexts ) { try { org . gatein . pc . api . PortletContext portalPC = WSRPUtils . convertToPortalPortletContext ( portletContext ) ; org . gatein . pc . api . PortletContext exportedPortletContext = producer . getPortletInvoker ( ) . exportPortlet ( PortletStateType . OPAQUE , portalPC ) ; RegistrationLocal . setRegistration ( toRegistration ) ; org . gatein . pc . api . PortletContext copiedPortletContext = producer . getPortletInvoker ( ) . importPortlet ( PortletStateType . OPAQUE , exportedPortletContext ) ; PortletContext wsrpClonedPC = WSRPUtils . convertToWSRPPortletContext ( copiedPortletContext ) ; CopiedPortlet copiedPortlet = WSRPTypeFactory . createCopiedPortlet ( wsrpClonedPC , portletContext . getPortletHandle ( ) ) ; copiedPortlets . add ( copiedPortlet ) ; } catch ( Exception e ) { if ( log . isWarnEnabled ( ) ) { log . warn ( "<STR_LIT>" , e ) ; } ErrorCodes . Codes errorCode ; String reason ; final String message = e . getLocalizedMessage ( ) ; if ( e instanceof NoSuchPortletException || e instanceof InvalidHandle || ( e instanceof IllegalArgumentException && message != null && message . contains ( org . gatein . pc . api . PortletContext . INVALID_PORTLET_CONTEXT ) ) ) { errorCode = ErrorCodes . Codes . INVALIDHANDLE ; reason = "<STR_LIT>" ; } else { errorCode = ErrorCodes . Codes . OPERATIONFAILED ; reason = "<STR_LIT>" ; } if ( ! failedPortletsMap . containsKey ( errorCode . name ( ) ) ) { List < String > portletHandles = new ArrayList < String > ( ) ; portletHandles . add ( portletContext . getPortletHandle ( ) ) ; FailedPortlets failedPortlets = WSRPTypeFactory . createFailedPortlets ( portletHandles , errorCode , reason ) ; failedPortletsMap . put ( errorCode . name ( ) , failedPortlets ) ; } else { FailedPortlets failedPortlets = failedPortletsMap . get ( errorCode . name ( ) ) ; failedPortlets . getPortletHandles ( ) . add ( portletContext . getPortletHandle ( ) ) ; } } } List < FailedPortlets > failedPortlets = new ArrayList < FailedPortlets > ( failedPortletsMap . values ( ) ) ; ResourceList resourceList = null ; return WSRPTypeFactory . createCopyPortletsResponse ( copiedPortlets , failedPortlets , resourceList ) ; } catch ( Exception e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } public PortletContext setPortletProperties ( SetPortletProperties setPortletProperties ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( setPortletProperties , "<STR_LIT>" ) ; PortletContext portletContext = setPortletProperties . getPortletContext ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletContext , "<STR_LIT>" , "<STR_LIT>" ) ; PropertyList propertyList = setPortletProperties . getPropertyList ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( propertyList , "<STR_LIT>" , "<STR_LIT>" ) ; Registration registration = producer . getRegistrationOrFailIfInvalid ( setPortletProperties . getRegistrationContext ( ) ) ; checkUserAuthorization ( setPortletProperties . getUserContext ( ) ) ; List < Property > properties = propertyList . getProperties ( ) ; List < ResetProperty > resetProperties = propertyList . getResetProperties ( ) ; int changesCount = <NUM_LIT:0> ; if ( ParameterValidation . existsAndIsNotEmpty ( properties ) ) { changesCount += properties . size ( ) ; if ( ParameterValidation . existsAndIsNotEmpty ( resetProperties ) ) { List < QName > names = new ArrayList < QName > ( WSRPUtils . transform ( properties , new Function < Property , QName > ( ) { public QName apply ( Property from ) { return from . getName ( ) ; } } ) ) ; names . retainAll ( WSRPUtils . transform ( resetProperties , new Function < ResetProperty , QName > ( ) { public QName apply ( ResetProperty from ) { return from . getName ( ) ; } } ) ) ; if ( ! names . isEmpty ( ) ) { WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , "<STR_LIT>" + names , null ) ; } } } if ( ParameterValidation . existsAndIsNotEmpty ( resetProperties ) ) { changesCount += resetProperties . size ( ) ; } if ( changesCount > <NUM_LIT:0> ) { List < PropertyChange > changes = new ArrayList < PropertyChange > ( changesCount ) ; if ( properties != null ) { for ( Property property : properties ) { String value = property . getStringValue ( ) ; changes . add ( PropertyChange . newUpdate ( property . getName ( ) . toString ( ) , value ) ) ; } } if ( resetProperties != null ) { for ( ResetProperty resetProperty : resetProperties ) { changes . add ( PropertyChange . newReset ( resetProperty . getName ( ) . toString ( ) ) ) ; } } try { RegistrationLocal . setRegistration ( registration ) ; org . gatein . pc . api . PortletContext resultContext = producer . getPortletInvoker ( ) . setProperties ( WSRPUtils . convertToPortalPortletContext ( portletContext ) , changes . toArray ( new PropertyChange [ changes . size ( ) ] ) ) ; return WSRPUtils . convertToWSRPPortletContext ( resultContext ) ; } catch ( NoSuchPortletException e ) { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) + "<STR_LIT:'>" , e ) ; } catch ( InvalidPortletIdException e ) { throw WSRP2ExceptionFactory . throwWSException ( InconsistentParameters . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) + "<STR_LIT:'>" , e ) ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) + "<STR_LIT:'>" , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } return portletContext ; } public PropertyList getPortletProperties ( GetPortletProperties getPortletProperties ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( getPortletProperties , GET_PORTLET_PROPERTIES ) ; PortletContext portletContext = getPortletProperties . getPortletContext ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( portletContext , PORTLET_CONTEXT , GET_PORTLET_PROPERTIES ) ; Registration registration = producer . getRegistrationOrFailIfInvalid ( getPortletProperties . getRegistrationContext ( ) ) ; UserContext userContext = getPortletProperties . getUserContext ( ) ; checkUserAuthorization ( userContext ) ; List < String > names = getPortletProperties . getNames ( ) ; if ( names . size ( ) == <NUM_LIT:1> ) { final String name = names . get ( <NUM_LIT:0> ) ; if ( ParameterValidation . isNullOrEmpty ( name ) ) { names = Collections . emptyList ( ) ; } } Set < String > keys = new HashSet < String > ( names ) ; try { PropertyMap properties ; org . gatein . pc . api . PortletContext jbpContext = WSRPUtils . convertToPortalPortletContext ( portletContext ) ; RegistrationLocal . setRegistration ( registration ) ; if ( ! keys . isEmpty ( ) ) { properties = producer . getPortletInvoker ( ) . getProperties ( jbpContext , keys ) ; } else { properties = producer . getPortletInvoker ( ) . getProperties ( jbpContext ) ; } Portlet portlet = getPortletFrom ( portletContext , registration ) ; PortletInfo info = portlet . getInfo ( ) ; PropertyList result = WSRPTypeFactory . createPropertyList ( ) ; int propertyNb = properties . size ( ) ; if ( propertyNb > <NUM_LIT:0> ) { PreferenceInfo prefInfo ; String key ; List < String > values ; LocalizedString displayName ; for ( Map . Entry < String , List < String > > entry : properties . entrySet ( ) ) { key = entry . getKey ( ) ; values = entry . getValue ( ) ; prefInfo = info . getPreferences ( ) . getPreference ( key ) ; displayName = prefInfo . getDisplayName ( ) ; String lang = WSRPUtils . toString ( displayName . getDefaultLocale ( ) ) ; if ( values . size ( ) != <NUM_LIT:1> ) { throw new UnsupportedOperationException ( "<STR_LIT>" ) ; } result . getProperties ( ) . add ( WSRPTypeFactory . createProperty ( key , lang , values . get ( <NUM_LIT:0> ) ) ) ; } } return result ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + portletContext + "<STR_LIT:'>" , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } public ExportPortletsResponse exportPortlets ( ExportPortlets exportPortlets ) throws AccessDenied , ExportByValueNotSupported , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( exportPortlets , "<STR_LIT>" , "<STR_LIT>" ) ; List < PortletContext > portletContexts = exportPortlets . getPortletContext ( ) ; if ( ! ParameterValidation . existsAndIsNotEmpty ( portletContexts ) ) { throw WSRP2ExceptionFactory . createWSException ( MissingParameters . class , "<STR_LIT>" , null ) ; } Registration registration = producer . getRegistrationOrFailIfInvalid ( exportPortlets . getRegistrationContext ( ) ) ; UserContext userContext = exportPortlets . getUserContext ( ) ; checkUserAuthorization ( userContext ) ; boolean exportByValueRequired ; if ( exportPortlets . isExportByValueRequired ( ) != null ) { exportByValueRequired = exportPortlets . isExportByValueRequired ( ) ; } else { exportByValueRequired = false ; } if ( exportByValueRequired && ! producer . getExportManager ( ) . supportsExportByValue ( ) ) { WSRP2ExceptionFactory . throwWSException ( ExportByValueNotSupported . class , "<STR_LIT>" , null ) ; } List < ExportedPortlet > exportedPortlets = new ArrayList < ExportedPortlet > ( portletContexts . size ( ) ) ; Map < String , FailedPortlets > failedPortletsMap = new HashMap < String , FailedPortlets > ( portletContexts . size ( ) ) ; try { RegistrationLocal . setRegistration ( registration ) ; ExportContext exportContext ; if ( exportPortlets . getLifetime ( ) != null ) { long currentTime = toLongDate ( exportPortlets . getLifetime ( ) . getCurrentTime ( ) ) ; long terminationTime = toLongDate ( exportPortlets . getLifetime ( ) . getTerminationTime ( ) ) ; long refreshDuration = exportPortlets . getLifetime ( ) . getRefreshDuration ( ) . getTimeInMillis ( exportPortlets . getLifetime ( ) . getCurrentTime ( ) . toGregorianCalendar ( ) ) ; exportContext = producer . getExportManager ( ) . createExportContext ( exportByValueRequired , currentTime , terminationTime , refreshDuration ) ; } else { exportContext = producer . getExportManager ( ) . createExportContext ( exportByValueRequired , - <NUM_LIT:1> , - <NUM_LIT:1> , - <NUM_LIT:1> ) ; } for ( PortletContext portletContext : exportPortlets . getPortletContext ( ) ) { try { byte [ ] exportData ; String portletHandle = portletContext . getPortletHandle ( ) ; byte [ ] portletState = portletContext . getPortletState ( ) ; WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( portletHandle , "<STR_LIT>" ) ; org . gatein . pc . api . PortletContext portalPC = WSRPUtils . convertToPortalPortletContext ( portletContext ) ; producer . getPortletInvoker ( ) . getPortlet ( portalPC ) ; org . gatein . pc . api . PortletContext exportedPortalPC = producer . getPortletInvoker ( ) . exportPortlet ( PortletStateType . OPAQUE , portalPC ) ; PortletContext exportedPortalContext = WSRPUtils . convertToWSRPPortletContext ( exportedPortalPC ) ; portletHandle = exportedPortalContext . getPortletHandle ( ) ; portletState = exportedPortalContext . getPortletState ( ) ; if ( exportedPortalPC == null ) { WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + portletHandle + "<STR_LIT>" , null ) ; } ExportPortletData exportPortletData = producer . getExportManager ( ) . createExportPortletData ( exportContext , portletHandle , portletState ) ; byte [ ] exportPortletBytes = producer . getExportManager ( ) . encodeExportPortletData ( exportContext , exportPortletData ) ; ExportedPortlet exportedPortlet = WSRPTypeFactory . createExportedPortlet ( portletHandle , exportPortletData . encodeAsBytes ( ) ) ; exportedPortlets . add ( exportedPortlet ) ; } catch ( Exception e ) { if ( log . isWarnEnabled ( ) ) { log . warn ( "<STR_LIT>" , e ) ; } ErrorCodes . Codes errorCode ; String reason ; if ( e instanceof NoSuchPortletException || e instanceof InvalidHandle ) { errorCode = ErrorCodes . Codes . INVALIDHANDLE ; reason = "<STR_LIT>" ; } else { errorCode = ErrorCodes . Codes . OPERATIONFAILED ; reason = "<STR_LIT>" ; } if ( ! failedPortletsMap . containsKey ( errorCode . name ( ) ) ) { List < String > portletHandles = new ArrayList < String > ( ) ; portletHandles . add ( portletContext . getPortletHandle ( ) ) ; FailedPortlets failedPortlets = WSRPTypeFactory . createFailedPortlets ( portletHandles , errorCode , reason ) ; failedPortletsMap . put ( errorCode . name ( ) , failedPortlets ) ; } else { FailedPortlets failedPortlets = failedPortletsMap . get ( errorCode . name ( ) ) ; failedPortlets . getPortletHandles ( ) . add ( portletContext . getPortletHandle ( ) ) ; } } } ResourceList resourceList = null ; byte [ ] exportContextBytes = producer . getExportManager ( ) . encodeExportContextData ( exportContext ) ; Lifetime lifetime = null ; if ( exportContext . getCurrentTime ( ) > <NUM_LIT:0> ) { lifetime = new Lifetime ( ) ; lifetime . setCurrentTime ( toXMLGregorianCalendar ( exportContext . getCurrentTime ( ) ) ) ; lifetime . setTerminationTime ( toXMLGregorianCalendar ( exportContext . getTermintationTime ( ) ) ) ; lifetime . setRefreshDuration ( toDuration ( exportContext . getRefreshDuration ( ) ) ) ; } return WSRPTypeFactory . createExportPortletsResponse ( exportContextBytes , exportedPortlets , new ArrayList < FailedPortlets > ( failedPortletsMap . values ( ) ) , lifetime , resourceList ) ; } catch ( Exception e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } public ImportPortletsResponse importPortlets ( ImportPortlets importPortlets ) throws OperationFailed , InvalidRegistration , MissingParameters , ModifyRegistrationRequired { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( importPortlets , "<STR_LIT>" ) ; List < ImportPortlet > importPortletList = importPortlets . getImportPortlet ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( importPortletList , "<STR_LIT>" , "<STR_LIT>" ) ; Registration registration = producer . getRegistrationOrFailIfInvalid ( importPortlets . getRegistrationContext ( ) ) ; UserContext userContext = importPortlets . getUserContext ( ) ; checkUserAuthorization ( userContext ) ; try { RegistrationLocal . setRegistration ( registration ) ; byte [ ] importContext = importPortlets . getImportContext ( ) ; Lifetime lifeTime = importPortlets . getLifetime ( ) ; List < ImportedPortlet > importedPortlets = new ArrayList < ImportedPortlet > ( ) ; Map < String , ImportPortletsFailed > failedPortletsMap = new HashMap < String , ImportPortletsFailed > ( ) ; ExportContext exportContext ; try { exportContext = producer . getExportManager ( ) . createExportContext ( importContext ) ; } catch ( Exception e ) { throw WSRPExceptionFactory . createWSException ( OperationFailed . class , "<STR_LIT>" , e ) ; } for ( ImportPortlet importPortlet : importPortletList ) { try { byte [ ] portletData = importPortlet . getExportData ( ) ; ExportPortletData exportPortletData ; if ( lifeTime != null ) { long currentTime = toLongDate ( lifeTime . getCurrentTime ( ) ) ; long terminationTime = toLongDate ( lifeTime . getTerminationTime ( ) ) ; long refreshDuration = lifeTime . getRefreshDuration ( ) . getTimeInMillis ( lifeTime . getCurrentTime ( ) . toGregorianCalendar ( ) ) ; exportPortletData = producer . getExportManager ( ) . createExportPortletData ( exportContext , currentTime , terminationTime , refreshDuration , portletData ) ; } else { exportPortletData = producer . getExportManager ( ) . createExportPortletData ( exportContext , - <NUM_LIT:1> , - <NUM_LIT:1> , - <NUM_LIT:1> , portletData ) ; } String portletHandle = exportPortletData . getPortletHandle ( ) ; byte [ ] portletState = exportPortletData . getPortletState ( ) ; PortletContext pc = WSRPTypeFactory . createPortletContext ( portletHandle , portletState ) ; org . gatein . pc . api . PortletContext pcPortletContext = WSRPUtils . convertToPortalPortletContext ( pc ) ; org . gatein . pc . api . PortletContext cpc = producer . getPortletInvoker ( ) . importPortlet ( PortletStateType . OPAQUE , pcPortletContext ) ; PortletContext wpc = WSRPUtils . convertToWSRPPortletContext ( cpc ) ; ImportedPortlet importedPortlet = WSRPTypeFactory . createImportedPortlet ( importPortlet . getImportID ( ) , wpc ) ; importedPortlets . add ( importedPortlet ) ; } catch ( Exception e ) { if ( log . isWarnEnabled ( ) ) { log . warn ( "<STR_LIT>" , e ) ; } ErrorCodes . Codes errorCode ; String reason ; if ( e instanceof NoSuchPortletException || e instanceof InvalidHandle ) { errorCode = ErrorCodes . Codes . INVALIDHANDLE ; reason = "<STR_LIT>" ; } else if ( e instanceof OperationFailed ) { errorCode = ErrorCodes . Codes . OPERATIONFAILED ; reason = e . getMessage ( ) ; } else if ( e instanceof PortletInvokerException || e instanceof UnsupportedOperationException || e instanceof IllegalArgumentException ) { errorCode = ErrorCodes . Codes . OPERATIONFAILED ; reason = "<STR_LIT>" ; } else { errorCode = ErrorCodes . Codes . OPERATIONFAILED ; reason = "<STR_LIT>" ; } if ( ! failedPortletsMap . containsKey ( errorCode . name ( ) ) ) { List < String > portleIDs = new ArrayList < String > ( ) ; portleIDs . add ( importPortlet . getImportID ( ) ) ; ImportPortletsFailed failedPortlets = WSRPTypeFactory . createImportPortletsFailed ( portleIDs , errorCode , reason ) ; failedPortletsMap . put ( errorCode . name ( ) , failedPortlets ) ; } else { ImportPortletsFailed failedPortlets = failedPortletsMap . get ( errorCode . name ( ) ) ; failedPortlets . getImportID ( ) . add ( importPortlet . getImportID ( ) ) ; } } } ResourceList resourceList = null ; return WSRPTypeFactory . createImportPortletsResponse ( importedPortlets , new ArrayList < ImportPortletsFailed > ( failedPortletsMap . values ( ) ) , resourceList ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } public List < Extension > releaseExport ( ReleaseExport releaseExport ) { try { if ( releaseExport != null && releaseExport . getExportContext ( ) != null ) { producer . getExportManager ( ) . releaseExport ( releaseExport . getExportContext ( ) ) ; } } catch ( Exception e ) { if ( log . isWarnEnabled ( ) ) { log . warn ( "<STR_LIT>" , e ) ; } } return WSRPTypeFactory . createReturnAny ( ) . getExtensions ( ) ; } public Lifetime setExportLifetime ( SetExportLifetime setExportLifetime ) throws OperationFailed , InvalidRegistration , OperationNotSupported , ModifyRegistrationRequired { if ( producer . getExportManager ( ) . getPersistenceManager ( ) == null ) { WSRP2ExceptionFactory . throwWSException ( OperationNotSupported . class , "<STR_LIT>" , null ) ; } WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( setExportLifetime , "<STR_LIT>" ) ; byte [ ] exportContextBytes = setExportLifetime . getExportContext ( ) ; if ( exportContextBytes == null ) { WSRPExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } Registration registration = producer . getRegistrationOrFailIfInvalid ( setExportLifetime . getRegistrationContext ( ) ) ; UserContext userContext = setExportLifetime . getUserContext ( ) ; checkUserAuthorization ( userContext ) ; try { RegistrationLocal . setRegistration ( registration ) ; ExportContext exportContext ; long currentTime = toLongDate ( setExportLifetime . getLifetime ( ) . getCurrentTime ( ) ) ; long terminationTime = toLongDate ( setExportLifetime . getLifetime ( ) . getTerminationTime ( ) ) ; long refreshDuration = setExportLifetime . getLifetime ( ) . getRefreshDuration ( ) . getTimeInMillis ( setExportLifetime . getLifetime ( ) . getCurrentTime ( ) . toGregorianCalendar ( ) ) ; exportContext = producer . getExportManager ( ) . setExportLifetime ( exportContextBytes , currentTime , terminationTime , refreshDuration ) ; return getLifetime ( exportContext ) ; } catch ( Exception e ) { throw WSRPExceptionFactory . createWSException ( OperationFailed . class , "<STR_LIT>" , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } private void checkUserAuthorization ( UserContext userContext ) { if ( userContext != null ) { } } private Portlet getPortletFrom ( PortletContext portletContext , Registration registration ) throws InvalidHandle { Portlet portlet ; try { RegistrationLocal . setRegistration ( registration ) ; portlet = producer . getPortletInvoker ( ) . getPortlet ( WSRPUtils . convertToPortalPortletContext ( portletContext ) ) ; return portlet ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + portletContext . getPortletHandle ( ) + "<STR_LIT:'>" , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } } private XMLGregorianCalendar toXMLGregorianCalendar ( long time ) throws DatatypeConfigurationException { Date date = new Date ( time ) ; GregorianCalendar gregorianCalendar = new GregorianCalendar ( ) ; gregorianCalendar . setTime ( date ) ; return DatatypeFactory . newInstance ( ) . newXMLGregorianCalendar ( gregorianCalendar ) ; } private long toLongDate ( XMLGregorianCalendar calendar ) { return calendar . toGregorianCalendar ( ) . getTime ( ) . getTime ( ) ; } private Duration toDuration ( long duration ) throws DatatypeConfigurationException { return DatatypeFactory . newInstance ( ) . newDuration ( duration ) ; } private Lifetime getLifetime ( ExportContext exportContext ) throws DatatypeConfigurationException { if ( exportContext . getCurrentTime ( ) >= <NUM_LIT:0> ) { Lifetime lifetime = new Lifetime ( ) ; XMLGregorianCalendar currentTime = toXMLGregorianCalendar ( exportContext . getCurrentTime ( ) ) ; XMLGregorianCalendar terminationTime = toXMLGregorianCalendar ( exportContext . getTermintationTime ( ) ) ; Duration duration = toDuration ( exportContext . getRefreshDuration ( ) ) ; lifetime . setCurrentTime ( currentTime ) ; lifetime . setTerminationTime ( terminationTime ) ; lifetime . setRefreshDuration ( duration ) ; return lifetime ; } else { return null ; } } } </s>
<s> package org . gatein . wsrp . producer . handlers ; import org . gatein . wsrp . producer . WSRPProducerImpl ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; class ServiceHandler { protected WSRPProducerImpl producer ; protected static final Logger log = LoggerFactory . getLogger ( ServiceHandler . class ) ; ServiceHandler ( WSRPProducerImpl producer ) { this . producer = producer ; } } </s>
<s> package org . gatein . wsrp . producer . handlers ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . ContentResponse ; import org . gatein . pc . api . invocation . response . ErrorResponse ; import org . gatein . pc . api . invocation . response . FragmentResponse ; import org . gatein . pc . api . invocation . response . HTTPRedirectionResponse ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . invocation . response . UpdateNavigationalStateResponse ; import org . gatein . pc . portlet . state . producer . PortletStateChangeRequiredException ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationLocal ; import org . gatein . wsrp . api . extensions . InvocationHandlerDelegate ; import org . gatein . wsrp . api . servlet . ServletAccess ; import org . gatein . wsrp . producer . MarkupInterface ; import org . gatein . wsrp . producer . Utils ; import org . gatein . wsrp . producer . WSRPProducerImpl ; import org . gatein . wsrp . producer . handlers . processors . ProcessorFactory ; import org . gatein . wsrp . producer . handlers . processors . RequestProcessor ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . BlockingInteractionResponse ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . GetResource ; import org . oasis . wsrp . v2 . HandleEvents ; import org . oasis . wsrp . v2 . HandleEventsResponse ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InitCookie ; import org . oasis . wsrp . v2 . InteractionParams ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PerformBlockingInteraction ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . ReleaseSessions ; import org . oasis . wsrp . v2 . ResourceResponse ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import javax . portlet . PortletModeException ; import javax . portlet . WindowStateException ; import java . util . Collections ; import java . util . List ; public class MarkupHandler extends ServiceHandler implements MarkupInterface { public static final String PBI = "<STR_LIT>" ; public static final String GET_MARKUP = "<STR_LIT>" ; public static final String GET_RESOURCE = "<STR_LIT>" ; public static final String HANDLE_EVENTS = "<STR_LIT>" ; public MarkupHandler ( WSRPProducerImpl producer ) { super ( producer ) ; } public MarkupResponse getMarkup ( GetMarkup getMarkup ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( getMarkup , GET_MARKUP ) ; RequestProcessor < MarkupResponse > requestProcessor = ProcessorFactory . getProcessorFor ( producer , getMarkup ) ; String handle = requestProcessor . getPortletContext ( ) . getPortletHandle ( ) ; PortletInvocationResponse response ; try { response = invoke ( requestProcessor , getMarkup . getRegistrationContext ( ) , GET_MARKUP , handle ) ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , e ) ; } checkForError ( response ) ; return requestProcessor . processResponse ( response ) ; } public ResourceResponse getResource ( GetResource getResource ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( getResource , GET_RESOURCE ) ; RequestProcessor < ResourceResponse > requestProcessor = ProcessorFactory . getProcessorFor ( producer , getResource ) ; String handle = requestProcessor . getPortletContext ( ) . getPortletHandle ( ) ; PortletInvocationResponse response ; try { response = invoke ( requestProcessor , getResource . getRegistrationContext ( ) , GET_RESOURCE , handle ) ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , e ) ; } checkForError ( response ) ; return requestProcessor . processResponse ( response ) ; } public BlockingInteractionResponse performBlockingInteraction ( PerformBlockingInteraction performBlockingInteraction ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( performBlockingInteraction , PBI ) ; final InteractionParams interactionParams = performBlockingInteraction . getInteractionParams ( ) ; WSRP2ExceptionFactory . throwMissingParametersIfValueIsMissing ( interactionParams , "<STR_LIT>" , PBI ) ; RequestProcessor < BlockingInteractionResponse > requestProcessor = ProcessorFactory . getProcessorFor ( producer , performBlockingInteraction ) ; PortletInvocationResponse response ; String handle = requestProcessor . getPortletContext ( ) . getPortletHandle ( ) ; try { response = invoke ( requestProcessor , performBlockingInteraction . getRegistrationContext ( ) , PBI , handle ) ; } catch ( PortletStateChangeRequiredException e ) { throw WSRP2ExceptionFactory . throwWSException ( PortletStateChangeRequired . class , e . getLocalizedMessage ( ) , e ) ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , e ) ; } checkForError ( response ) ; return requestProcessor . processResponse ( response ) ; } public List < Extension > releaseSessions ( ReleaseSessions releaseSessions ) throws AccessDenied , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { Utils . throwOperationFaultOnSessionOperation ( ) ; return null ; } public List < Extension > initCookie ( InitCookie initCookie ) throws AccessDenied , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { WSRP2ExceptionFactory . throwOperationFailedIfValueIsMissing ( initCookie , "<STR_LIT>" ) ; producer . getRegistrationOrFailIfInvalid ( initCookie . getRegistrationContext ( ) ) ; String sessionId = ServletAccess . getRequest ( ) . getSession ( ) . getId ( ) ; log . debug ( "<STR_LIT>" + sessionId ) ; return Collections . emptyList ( ) ; } public HandleEventsResponse handleEvents ( HandleEvents handleEvents ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { RequestProcessor < HandleEventsResponse > requestProcessor = ProcessorFactory . getProcessorFor ( producer , handleEvents ) ; PortletInvocationResponse response ; String handle = requestProcessor . getPortletContext ( ) . getPortletHandle ( ) ; try { response = invoke ( requestProcessor , handleEvents . getRegistrationContext ( ) , HANDLE_EVENTS , handle ) ; } catch ( PortletStateChangeRequiredException e ) { throw WSRP2ExceptionFactory . throwWSException ( PortletStateChangeRequired . class , e . getLocalizedMessage ( ) , e ) ; } catch ( PortletInvokerException e ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + handle + "<STR_LIT:'>" , e ) ; } checkForError ( response ) ; return requestProcessor . processResponse ( response ) ; } private PortletInvocationResponse invoke ( RequestProcessor requestProcessor , RegistrationContext registrationContext , String invocationType , String handle ) throws PortletInvokerException , OperationFailed , ModifyRegistrationRequired , InvalidRegistration { log . debug ( invocationType + "<STR_LIT>" + handle + "<STR_LIT:'>" ) ; Registration registration = producer . getRegistrationOrFailIfInvalid ( registrationContext ) ; RegistrationLocal . setRegistration ( registration ) ; final PortletInvocation invocation = requestProcessor . getInvocation ( ) ; final InvocationHandlerDelegate delegate = InvocationHandlerDelegate . producerDelegate ( ) ; if ( delegate != null ) { delegate . processInvocation ( invocation ) ; } final PortletInvocationResponse response = producer . getPortletInvoker ( ) . invoke ( invocation ) ; if ( delegate != null ) { delegate . processInvocationResponse ( response , invocation ) ; } log . debug ( invocationType + "<STR_LIT>" ) ; return response ; } private void checkForError ( PortletInvocationResponse response ) throws UnsupportedMode , OperationFailed , UnsupportedWindowState { if ( response instanceof ErrorResponse ) { ErrorResponse errorResult = ( ErrorResponse ) response ; Throwable cause = errorResult . getCause ( ) ; if ( cause instanceof PortletModeException ) { throw WSRP2ExceptionFactory . throwWSException ( UnsupportedMode . class , "<STR_LIT>" + ( ( PortletModeException ) cause ) . getMode ( ) , null ) ; } if ( cause instanceof WindowStateException ) { throw WSRP2ExceptionFactory . throwWSException ( UnsupportedWindowState . class , "<STR_LIT>" + ( ( WindowStateException ) cause ) . getState ( ) , null ) ; } throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , errorResult . getMessage ( ) , cause ) ; } else if ( ! ( response instanceof HTTPRedirectionResponse || response instanceof FragmentResponse || response instanceof UpdateNavigationalStateResponse || response instanceof ContentResponse ) ) { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" + response . getClass ( ) . getName ( ) , null ) ; } } } </s>
<s> package org . gatein . wsrp . producer ; import org . oasis . wsrp . v2 . GetServiceDescription ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . ServiceDescription ; public interface ServiceDescriptionInterface { ServiceDescription getServiceDescription ( GetServiceDescription gs ) throws InvalidRegistration , ModifyRegistrationRequired , OperationFailed , ResourceSuspended ; } </s>
<s> package org . gatein . wsrp . producer . invoker ; import org . gatein . common . logging . Logger ; import org . gatein . common . logging . LoggerFactory ; import org . gatein . pc . api . NoSuchPortletException ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletContext ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . PortletStateType ; import org . gatein . pc . api . PortletStatus ; import org . gatein . pc . api . invocation . PortletInvocation ; import org . gatein . pc . api . invocation . response . PortletInvocationResponse ; import org . gatein . pc . api . spi . InstanceContext ; import org . gatein . pc . api . state . DestroyCloneFailure ; import org . gatein . pc . api . state . PropertyChange ; import org . gatein . pc . api . state . PropertyMap ; import org . gatein . pc . portlet . PortletInvokerInterceptor ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationDestructionListener ; import org . gatein . registration . RegistrationException ; import org . gatein . registration . RegistrationLocal ; import org . gatein . registration . RegistrationManager ; import org . gatein . registration . RegistrationPolicy ; import org . gatein . registration . spi . RegistrationSPI ; import org . gatein . wsrp . producer . handlers . processors . WSRPInstanceContext ; import java . util . ArrayList ; import java . util . Collections ; import java . util . HashSet ; import java . util . List ; import java . util . Set ; public class RegistrationCheckingPortletInvoker extends PortletInvokerInterceptor implements RegistrationDestructionListener { private RegistrationManager registrationManager ; private static final Logger log = LoggerFactory . getLogger ( RegistrationCheckingPortletInvoker . class ) ; public void setRegistrationManager ( RegistrationManager registrationManager ) { this . registrationManager = registrationManager ; registrationManager . addRegistrationDestructionListener ( this ) ; } private RegistrationPolicy getPolicy ( ) { return registrationManager . getPolicy ( ) ; } public Portlet getPortlet ( PortletContext portletContext ) throws IllegalArgumentException , PortletInvokerException { Registration registration = RegistrationLocal . getRegistration ( ) ; if ( registration != null ) { if ( registration . knows ( portletContext ) || PortletStatus . OFFERED == super . getStatus ( portletContext ) ) { return super . getPortlet ( portletContext ) ; } else { String id = portletContext . getId ( ) ; throw new NoSuchPortletException ( "<STR_LIT>" + registration . getRegistrationHandle ( ) + "<STR_LIT>" + id + "<STR_LIT>" , id ) ; } } else { return super . getPortlet ( portletContext ) ; } } public Set < Portlet > getPortlets ( ) throws PortletInvokerException { Set < Portlet > portlets = new HashSet < Portlet > ( super . getPortlets ( ) ) ; Registration registration = RegistrationLocal . getRegistration ( ) ; if ( registration != null ) { Set < PortletContext > contexts = registration . getKnownPortletContexts ( ) ; for ( PortletContext context : contexts ) { portlets . add ( super . getPortlet ( context ) ) ; } } return portlets ; } private RegistrationSPI getRegistrationAsSPI ( ) throws PortletInvokerException { Registration registration = RegistrationLocal . getRegistration ( ) ; if ( registration == null ) { return null ; } if ( registration instanceof RegistrationSPI ) { return ( RegistrationSPI ) registration ; } else { throw new PortletInvokerException ( "<STR_LIT>" ) ; } } public PortletInvocationResponse invoke ( PortletInvocation invocation ) throws IllegalArgumentException , PortletInvokerException { PortletContext portletContext = invocation . getTarget ( ) ; RegistrationSPI registration = getRegistrationAsSPI ( ) ; if ( registration != null ) { checkOperationIsAllowed ( portletContext , registration , "<STR_LIT>" ) ; PortletInvocationResponse response = super . invoke ( invocation ) ; InstanceContext instanceContext = invocation . getInstanceContext ( ) ; if ( instanceContext instanceof WSRPInstanceContext ) { WSRPInstanceContext wsrpIC = ( WSRPInstanceContext ) instanceContext ; PortletContext responseContext = wsrpIC . getPortletContext ( ) ; if ( wsrpIC . wasModified ( ) && ! responseContext . getId ( ) . equals ( portletContext . getId ( ) ) ) { try { registration . addPortletContext ( responseContext ) ; } catch ( RegistrationException e ) { throw new PortletInvokerException ( "<STR_LIT>" + responseContext + "<STR_LIT>" + registration . getRegistrationHandle ( ) + "<STR_LIT:'>" , e ) ; } } } return response ; } else { return super . invoke ( invocation ) ; } } private void checkOperationIsAllowed ( PortletContext portletContext , Registration registration , String operation ) throws NoSuchPortletException { if ( ! getPolicy ( ) . allowAccessTo ( portletContext , registration , operation ) ) { String id = portletContext . getId ( ) ; throw new NoSuchPortletException ( "<STR_LIT>" + id + "<STR_LIT>" + operation + "<STR_LIT:'>" , id ) ; } } public PortletContext createClone ( PortletStateType stateType , PortletContext portletContext ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { RegistrationSPI registration = getRegistrationAsSPI ( ) ; if ( registration != null ) { checkOperationIsAllowed ( portletContext , registration , "<STR_LIT>" ) ; PortletContext clonedPortletContext = super . createClone ( stateType , portletContext ) ; try { registration . addPortletContext ( clonedPortletContext ) ; } catch ( RegistrationException e ) { throw new PortletInvokerException ( "<STR_LIT>" + clonedPortletContext + "<STR_LIT>" + registration . getRegistrationHandle ( ) + "<STR_LIT:'>" , e ) ; } return clonedPortletContext ; } else { return super . createClone ( stateType , portletContext ) ; } } public List < DestroyCloneFailure > destroyClones ( List < PortletContext > portletContexts ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { RegistrationSPI registration = getRegistrationAsSPI ( ) ; if ( registration != null ) { for ( PortletContext portletContext : portletContexts ) { checkOperationIsAllowed ( portletContext , registration , "<STR_LIT>" ) ; } } List < DestroyCloneFailure > cloneFailures = super . destroyClones ( portletContexts ) ; boolean noFailures = cloneFailures . isEmpty ( ) ; if ( registration != null ) { for ( PortletContext portletContext : portletContexts ) { if ( noFailures || ! cloneFailures . contains ( new DestroyCloneFailure ( portletContext . getId ( ) ) ) ) { try { registration . removePortletContext ( portletContext ) ; } catch ( RegistrationException e ) { throw new PortletInvokerException ( "<STR_LIT>" + portletContext + "<STR_LIT>" + registration . getRegistrationHandle ( ) + "<STR_LIT:'>" , e ) ; } } } } return cloneFailures ; } public PropertyMap getProperties ( PortletContext portletContext ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { checkOperationIsAllowed ( portletContext , RegistrationLocal . getRegistration ( ) , "<STR_LIT>" ) ; return super . getProperties ( portletContext ) ; } public PropertyMap getProperties ( PortletContext portletContext , Set < String > keys ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { checkOperationIsAllowed ( portletContext , RegistrationLocal . getRegistration ( ) , "<STR_LIT>" ) ; return super . getProperties ( portletContext , keys ) ; } public PortletContext setProperties ( PortletContext portletContext , PropertyChange [ ] changes ) throws IllegalArgumentException , PortletInvokerException , UnsupportedOperationException { RegistrationSPI registration = getRegistrationAsSPI ( ) ; if ( registration != null ) { checkOperationIsAllowed ( portletContext , registration , "<STR_LIT>" ) ; PortletContext updatedPortletContext = super . setProperties ( portletContext , changes ) ; if ( ! portletContext . getId ( ) . equals ( updatedPortletContext . getId ( ) ) ) { try { registration . addPortletContext ( updatedPortletContext ) ; } catch ( RegistrationException e ) { throw new PortletInvokerException ( "<STR_LIT>" + updatedPortletContext + "<STR_LIT>" + registration . getRegistrationHandle ( ) + "<STR_LIT:'>" , e ) ; } } return updatedPortletContext ; } else { return super . setProperties ( portletContext , changes ) ; } } public PortletContext importPortlet ( PortletStateType stateType , PortletContext originalPortletContext ) throws PortletInvokerException , IllegalArgumentException { RegistrationSPI registration = getRegistrationAsSPI ( ) ; if ( registration != null ) { checkOperationIsAllowed ( originalPortletContext , registration , "<STR_LIT>" ) ; PortletContext newPortletContext = super . importPortlet ( stateType , originalPortletContext ) ; if ( ! newPortletContext . getId ( ) . equals ( originalPortletContext . getId ( ) ) ) { try { registration . addPortletContext ( newPortletContext ) ; } catch ( RegistrationException e ) { throw new PortletInvokerException ( "<STR_LIT>" + newPortletContext + "<STR_LIT>" + registration . getRegistrationHandle ( ) + "<STR_LIT:'>" , e ) ; } } return newPortletContext ; } else { return super . importPortlet ( stateType , originalPortletContext ) ; } } public PortletContext exportPortlet ( PortletStateType stateType , PortletContext portletContext ) throws PortletInvokerException , IllegalArgumentException { checkOperationIsAllowed ( portletContext , RegistrationLocal . getRegistration ( ) , "<STR_LIT>" ) ; return super . exportPortlet ( stateType , portletContext ) ; } public Vote destructionScheduledFor ( Registration registration ) { if ( registration != null ) { List < PortletContext > portletContexts = new ArrayList < PortletContext > ( registration . getKnownPortletContexts ( ) ) ; List < DestroyCloneFailure > failures = Collections . emptyList ( ) ; try { failures = super . destroyClones ( portletContexts ) ; } catch ( Exception e ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "<STR_LIT>" , e ) ; } return Vote . negativeVote ( "<STR_LIT>" + failures ) ; } } return RegistrationDestructionListener . SUCCESS ; } } </s>
<s> package org . gatein . wsrp . producer . v1 ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1BlockingInteractionResponse ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InitCookie ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MarkupResponse ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PerformBlockingInteraction ; import org . oasis . wsrp . v1 . V1PortletStateChangeRequired ; import org . oasis . wsrp . v1 . V1ReleaseSessions ; import org . oasis . wsrp . v1 . V1ReturnAny ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; public interface V1MarkupInterface { V1MarkupResponse getMarkup ( V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType ; V1BlockingInteractionResponse performBlockingInteraction ( V1PerformBlockingInteraction performBlockingInteraction ) throws V1InvalidSession , V1UnsupportedMode , V1UnsupportedMimeType , V1OperationFailed , V1UnsupportedWindowState , V1UnsupportedLocale , V1AccessDenied , V1PortletStateChangeRequired , V1InvalidRegistration , V1MissingParameters , V1InvalidUserCategory , V1InconsistentParameters , V1InvalidHandle , V1InvalidCookie ; V1ReturnAny releaseSessions ( V1ReleaseSessions releaseSessions ) throws V1InvalidRegistration , V1OperationFailed , V1MissingParameters , V1AccessDenied ; V1ReturnAny initCookie ( V1InitCookie initCookie ) throws V1AccessDenied , V1OperationFailed , V1InvalidRegistration ; } </s>
<s> package org . gatein . wsrp . producer . v1 ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1ClonePortlet ; import org . oasis . wsrp . v1 . V1DestroyPortlets ; import org . oasis . wsrp . v1 . V1DestroyPortletsResponse ; import org . oasis . wsrp . v1 . V1GetPortletDescription ; import org . oasis . wsrp . v1 . V1GetPortletProperties ; import org . oasis . wsrp . v1 . V1GetPortletPropertyDescription ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PortletContext ; import org . oasis . wsrp . v1 . V1PortletDescriptionResponse ; import org . oasis . wsrp . v1 . V1PortletPropertyDescriptionResponse ; import org . oasis . wsrp . v1 . V1PropertyList ; import org . oasis . wsrp . v1 . V1SetPortletProperties ; public interface V1PortletManagementInterface { V1PortletDescriptionResponse getPortletDescription ( V1GetPortletDescription getPortletDescription ) throws V1AccessDenied , V1InvalidHandle , V1InvalidUserCategory , V1InconsistentParameters , V1MissingParameters , V1InvalidRegistration , V1OperationFailed ; V1PortletContext clonePortlet ( V1ClonePortlet clonePortlet ) throws V1InvalidUserCategory , V1AccessDenied , V1OperationFailed , V1InvalidHandle , V1InvalidRegistration , V1InconsistentParameters , V1MissingParameters ; V1DestroyPortletsResponse destroyPortlets ( V1DestroyPortlets destroyPortlets ) throws V1InconsistentParameters , V1MissingParameters , V1InvalidRegistration , V1OperationFailed ; V1PortletContext setPortletProperties ( V1SetPortletProperties setPortletProperties ) throws V1OperationFailed , V1InvalidHandle , V1MissingParameters , V1InconsistentParameters , V1InvalidUserCategory , V1AccessDenied , V1InvalidRegistration ; V1PropertyList getPortletProperties ( V1GetPortletProperties getPortletProperties ) throws V1InvalidHandle , V1MissingParameters , V1InvalidRegistration , V1AccessDenied , V1OperationFailed , V1InconsistentParameters , V1InvalidUserCategory ; V1PortletPropertyDescriptionResponse getPortletPropertyDescription ( V1GetPortletPropertyDescription getPortletPropertyDescription ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidUserCategory , V1InvalidRegistration , V1AccessDenied , V1InvalidHandle , V1OperationFailed ; } </s>
<s> package org . gatein . wsrp . producer . v1 ; import org . oasis . wsrp . v1 . V1GetServiceDescription ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1ServiceDescription ; public interface V1ServiceDescriptionInterface { V1ServiceDescription getServiceDescription ( V1GetServiceDescription gs ) throws V1InvalidRegistration , V1OperationFailed ; } </s>
<s> package org . gatein . wsrp . producer . v1 ; import org . gatein . exports . ExportManager ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvoker ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . portlet . container . managed . ManagedObjectRegistryEvent ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationManager ; import org . gatein . wsrp . api . context . ProducerContext ; import org . gatein . wsrp . producer . ProducerHolder ; import org . gatein . wsrp . producer . WSRPProducer ; import org . gatein . wsrp . producer . WSRPProducerImpl ; import org . gatein . wsrp . producer . config . ProducerConfigurationService ; import org . gatein . wsrp . producer . handlers . processors . ProducerHelper ; import org . gatein . wsrp . producer . v2 . WSRP2Producer ; import org . gatein . wsrp . spec . v1 . V1ToV2Converter ; import org . gatein . wsrp . spec . v1 . V2ToV1Converter ; import org . gatein . wsrp . spec . v1 . WSRP1ExceptionFactory ; import org . oasis . wsrp . v1 . V1AccessDenied ; import org . oasis . wsrp . v1 . V1BlockingInteractionResponse ; import org . oasis . wsrp . v1 . V1ClonePortlet ; import org . oasis . wsrp . v1 . V1DestroyPortlets ; import org . oasis . wsrp . v1 . V1DestroyPortletsResponse ; import org . oasis . wsrp . v1 . V1GetMarkup ; import org . oasis . wsrp . v1 . V1GetPortletDescription ; import org . oasis . wsrp . v1 . V1GetPortletProperties ; import org . oasis . wsrp . v1 . V1GetPortletPropertyDescription ; import org . oasis . wsrp . v1 . V1GetServiceDescription ; import org . oasis . wsrp . v1 . V1InconsistentParameters ; import org . oasis . wsrp . v1 . V1InitCookie ; import org . oasis . wsrp . v1 . V1InvalidCookie ; import org . oasis . wsrp . v1 . V1InvalidHandle ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1InvalidSession ; import org . oasis . wsrp . v1 . V1InvalidUserCategory ; import org . oasis . wsrp . v1 . V1MarkupResponse ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1ModifyRegistration ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1PerformBlockingInteraction ; import org . oasis . wsrp . v1 . V1PortletContext ; import org . oasis . wsrp . v1 . V1PortletDescriptionResponse ; import org . oasis . wsrp . v1 . V1PortletPropertyDescriptionResponse ; import org . oasis . wsrp . v1 . V1PortletStateChangeRequired ; import org . oasis . wsrp . v1 . V1PropertyList ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1RegistrationData ; import org . oasis . wsrp . v1 . V1RegistrationState ; import org . oasis . wsrp . v1 . V1ReleaseSessions ; import org . oasis . wsrp . v1 . V1ReturnAny ; import org . oasis . wsrp . v1 . V1ServiceDescription ; import org . oasis . wsrp . v1 . V1SetPortletProperties ; import org . oasis . wsrp . v1 . V1UnsupportedLocale ; import org . oasis . wsrp . v1 . V1UnsupportedMimeType ; import org . oasis . wsrp . v1 . V1UnsupportedMode ; import org . oasis . wsrp . v1 . V1UnsupportedWindowState ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . BlockingInteractionResponse ; import org . oasis . wsrp . v2 . DestroyPortletsResponse ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . PortletDescriptionResponse ; import org . oasis . wsrp . v2 . PortletPropertyDescriptionResponse ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . PropertyList ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationState ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . ServiceDescription ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import java . util . List ; public class WSRP1Producer implements WSRPProducer , V1MarkupInterface , V1PortletManagementInterface , V1RegistrationInterface , V1ServiceDescriptionInterface , ProducerHelper { public Portlet getPortletWith ( org . gatein . pc . api . PortletContext portletContext , Registration registration ) throws InvalidHandle , PortletInvokerException { return ( ( ProducerHelper ) producer ) . getPortletWith ( portletContext , registration ) ; } public PortletDescription getPortletDescription ( PortletContext portletContext , List < String > locales , Registration registration ) throws InvalidHandle , OperationFailed { return ( ( ProducerHelper ) producer ) . getPortletDescription ( portletContext , locales , registration ) ; } public Registration getRegistrationOrFailIfInvalid ( RegistrationContext registrationContext ) throws InvalidRegistration , OperationFailed , ModifyRegistrationRequired { return ( ( ProducerHelper ) producer ) . getRegistrationOrFailIfInvalid ( registrationContext ) ; } public void reset ( ) { ( ( ProducerHelper ) producer ) . reset ( ) ; } private static final class InstanceHolder { public static final WSRP1Producer producer = new WSRP1Producer ( ) ; } public static WSRP1Producer getInstance ( ) { return InstanceHolder . producer ; } private WSRP1Producer ( ) { } private final WSRP2Producer producer = ProducerHolder . getProducer ( true ) ; public RegistrationManager getRegistrationManager ( ) { return producer . getRegistrationManager ( ) ; } public void setRegistrationManager ( RegistrationManager registrationManager ) { producer . setRegistrationManager ( registrationManager ) ; } public ProducerConfigurationService getConfigurationService ( ) { return producer . getConfigurationService ( ) ; } public void setConfigurationService ( ProducerConfigurationService configurationService ) { producer . setConfigurationService ( configurationService ) ; } public PortletInvoker getPortletInvoker ( ) { return producer . getPortletInvoker ( ) ; } public void setPortletInvoker ( PortletInvoker invoker ) { producer . setPortletInvoker ( invoker ) ; } public void start ( ) { producer . start ( ) ; } public void stop ( ) { producer . stop ( ) ; } public void usingStrictModeChangedTo ( boolean strictMode ) { producer . usingStrictModeChangedTo ( strictMode ) ; } public ExportManager getExportManager ( ) { return producer . getExportManager ( ) ; } public void setExportManager ( ExportManager exportManager ) { producer . setExportManager ( exportManager ) ; } public ProducerContext getProducerContext ( ) { return producer . getProducerContext ( ) ; } public void setProducerContext ( ProducerContext producerContext ) { producer . setProducerContext ( producerContext ) ; } public V1ServiceDescription getServiceDescription ( V1GetServiceDescription gs ) throws V1InvalidRegistration , V1OperationFailed { try { ServiceDescription description = producer . getServiceDescription ( V1ToV2Converter . toV2GetServiceDescription ( gs ) ) ; return V2ToV1Converter . toV1ServiceDescription ( description ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } } public V1RegistrationContext register ( V1RegistrationData register ) throws V1MissingParameters , V1OperationFailed { try { RegistrationContext registrationContext = producer . register ( V1ToV2Converter . toV2RegistrationData ( register ) ) ; return V2ToV1Converter . toV1RegistrationContext ( registrationContext ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1ReturnAny deregister ( V1RegistrationContext deregister ) throws V1OperationFailed , V1InvalidRegistration { try { producer . deregister ( V1ToV2Converter . toV2RegistrationContext ( deregister ) ) ; return null ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1RegistrationState modifyRegistration ( V1ModifyRegistration modifyRegistration ) throws V1MissingParameters , V1OperationFailed , V1InvalidRegistration { try { RegistrationState registrationState = producer . modifyRegistration ( V1ToV2Converter . toV2ModifyRegistration ( modifyRegistration ) ) ; return V2ToV1Converter . toV1RegistrationState ( registrationState ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , invalidRegistration ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1PortletDescriptionResponse getPortletDescription ( V1GetPortletDescription getPortletDescription ) throws V1AccessDenied , V1InvalidHandle , V1InvalidUserCategory , V1InconsistentParameters , V1MissingParameters , V1InvalidRegistration , V1OperationFailed { try { PortletDescriptionResponse portletDescriptionResponse = producer . getPortletDescription ( V1ToV2Converter . toV2GetPortletDescription ( getPortletDescription ) ) ; return V2ToV1Converter . toV1PortletDescriptionResponse ( portletDescriptionResponse ) ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( InvalidHandle invalidHandle ) { throw V2ToV1Converter . toV1Exception ( V1InvalidHandle . class , invalidHandle ) ; } catch ( InvalidUserCategory invalidUserCategory ) { throw V2ToV1Converter . toV1Exception ( V1InvalidUserCategory . class , invalidUserCategory ) ; } catch ( InconsistentParameters inconsistentParameters ) { throw V2ToV1Converter . toV1Exception ( V1InconsistentParameters . class , inconsistentParameters ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1MarkupResponse getMarkup ( V1GetMarkup getMarkup ) throws V1UnsupportedWindowState , V1InvalidCookie , V1InvalidSession , V1AccessDenied , V1InconsistentParameters , V1InvalidHandle , V1UnsupportedLocale , V1UnsupportedMode , V1OperationFailed , V1MissingParameters , V1InvalidUserCategory , V1InvalidRegistration , V1UnsupportedMimeType { try { MarkupResponse markupResponse = producer . getMarkup ( V1ToV2Converter . toV2GetMarkup ( getMarkup ) ) ; return V2ToV1Converter . toV1MarkupResponse ( markupResponse ) ; } catch ( UnsupportedMimeType unsupportedMimeType ) { throw V2ToV1Converter . toV1Exception ( V1UnsupportedMimeType . class , unsupportedMimeType ) ; } catch ( UnsupportedWindowState unsupportedWindowState ) { throw V2ToV1Converter . toV1Exception ( V1UnsupportedWindowState . class , unsupportedWindowState ) ; } catch ( InvalidCookie invalidCookie ) { throw V2ToV1Converter . toV1Exception ( V1InvalidCookie . class , invalidCookie ) ; } catch ( InvalidSession invalidSession ) { throw V2ToV1Converter . toV1Exception ( V1InvalidSession . class , invalidSession ) ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( InconsistentParameters inconsistentParameters ) { throw V2ToV1Converter . toV1Exception ( V1InconsistentParameters . class , inconsistentParameters ) ; } catch ( InvalidHandle invalidHandle ) { throw V2ToV1Converter . toV1Exception ( V1InvalidHandle . class , invalidHandle ) ; } catch ( UnsupportedLocale unsupportedLocale ) { throw V2ToV1Converter . toV1Exception ( V1UnsupportedLocale . class , unsupportedLocale ) ; } catch ( UnsupportedMode unsupportedMode ) { throw V2ToV1Converter . toV1Exception ( V1UnsupportedMode . class , unsupportedMode ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( InvalidUserCategory invalidUserCategory ) { throw V2ToV1Converter . toV1Exception ( V1InvalidUserCategory . class , invalidUserCategory ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } } public V1PortletContext clonePortlet ( V1ClonePortlet clonePortlet ) throws V1InvalidUserCategory , V1AccessDenied , V1OperationFailed , V1InvalidHandle , V1InvalidRegistration , V1InconsistentParameters , V1MissingParameters { try { PortletContext portletContext = producer . clonePortlet ( V1ToV2Converter . toV2ClonePortlet ( clonePortlet ) ) ; return V2ToV1Converter . toV1PortletContext ( portletContext ) ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( InvalidUserCategory invalidUserCategory ) { throw V2ToV1Converter . toV1Exception ( V1InvalidUserCategory . class , invalidUserCategory ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( InvalidHandle invalidHandle ) { throw V2ToV1Converter . toV1Exception ( V1InvalidHandle . class , invalidHandle ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( InconsistentParameters inconsistentParameters ) { throw V2ToV1Converter . toV1Exception ( V1InconsistentParameters . class , inconsistentParameters ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1BlockingInteractionResponse performBlockingInteraction ( V1PerformBlockingInteraction performBlockingInteraction ) throws V1InvalidSession , V1UnsupportedMode , V1UnsupportedMimeType , V1OperationFailed , V1UnsupportedWindowState , V1UnsupportedLocale , V1AccessDenied , V1PortletStateChangeRequired , V1InvalidRegistration , V1MissingParameters , V1InvalidUserCategory , V1InconsistentParameters , V1InvalidHandle , V1InvalidCookie { try { BlockingInteractionResponse blockingInteractionResponse = producer . performBlockingInteraction ( V1ToV2Converter . toV2PerformBlockingInteraction ( performBlockingInteraction ) ) ; return V2ToV1Converter . toV1BlockingInteractionResponse ( blockingInteractionResponse ) ; } catch ( InvalidSession invalidSession ) { throw V2ToV1Converter . toV1Exception ( V1InvalidSession . class , invalidSession ) ; } catch ( UnsupportedMode unsupportedMode ) { throw V2ToV1Converter . toV1Exception ( V1UnsupportedMode . class , unsupportedMode ) ; } catch ( UnsupportedMimeType unsupportedMimeType ) { throw V2ToV1Converter . toV1Exception ( V1UnsupportedMimeType . class , unsupportedMimeType ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( UnsupportedWindowState unsupportedWindowState ) { throw V2ToV1Converter . toV1Exception ( V1UnsupportedWindowState . class , unsupportedWindowState ) ; } catch ( UnsupportedLocale unsupportedLocale ) { throw V2ToV1Converter . toV1Exception ( V1UnsupportedLocale . class , unsupportedLocale ) ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( PortletStateChangeRequired portletStateChangeRequired ) { throw V2ToV1Converter . toV1Exception ( V1PortletStateChangeRequired . class , portletStateChangeRequired ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( InvalidUserCategory invalidUserCategory ) { throw V2ToV1Converter . toV1Exception ( V1InvalidUserCategory . class , invalidUserCategory ) ; } catch ( InconsistentParameters inconsistentParameters ) { throw V2ToV1Converter . toV1Exception ( V1InconsistentParameters . class , inconsistentParameters ) ; } catch ( InvalidHandle invalidHandle ) { throw V2ToV1Converter . toV1Exception ( V1InvalidHandle . class , invalidHandle ) ; } catch ( InvalidCookie invalidCookie ) { throw V2ToV1Converter . toV1Exception ( V1InvalidCookie . class , invalidCookie ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } } public V1DestroyPortletsResponse destroyPortlets ( V1DestroyPortlets destroyPortlets ) throws V1InconsistentParameters , V1MissingParameters , V1InvalidRegistration , V1OperationFailed { try { DestroyPortletsResponse destroyportletResponse = producer . destroyPortlets ( V1ToV2Converter . toV2DestroyPortlets ( destroyPortlets ) ) ; return V2ToV1Converter . toV1DestroyPortlesResponse ( destroyportletResponse ) ; } catch ( InconsistentParameters inconsistentParameters ) { throw V2ToV1Converter . toV1Exception ( V1InconsistentParameters . class , inconsistentParameters ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1PortletContext setPortletProperties ( V1SetPortletProperties setPortletProperties ) throws V1OperationFailed , V1InvalidHandle , V1MissingParameters , V1InconsistentParameters , V1InvalidUserCategory , V1AccessDenied , V1InvalidRegistration { try { PortletContext portletContext = producer . setPortletProperties ( V1ToV2Converter . toV2SetPortletProperties ( setPortletProperties ) ) ; return V2ToV1Converter . toV1PortletContext ( portletContext ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( InvalidHandle invalidHandle ) { throw V2ToV1Converter . toV1Exception ( V1InvalidHandle . class , invalidHandle ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( InconsistentParameters inconsistentParameters ) { throw V2ToV1Converter . toV1Exception ( V1InconsistentParameters . class , inconsistentParameters ) ; } catch ( InvalidUserCategory invalidUserCategory ) { throw V2ToV1Converter . toV1Exception ( V1InvalidUserCategory . class , invalidUserCategory ) ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1ReturnAny releaseSessions ( V1ReleaseSessions releaseSessions ) throws V1InvalidRegistration , V1OperationFailed , V1MissingParameters , V1AccessDenied { try { producer . releaseSessions ( V1ToV2Converter . toV2ReleaseSessions ( releaseSessions ) ) ; return null ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1PropertyList getPortletProperties ( V1GetPortletProperties getPortletProperties ) throws V1InvalidHandle , V1MissingParameters , V1InvalidRegistration , V1AccessDenied , V1OperationFailed , V1InconsistentParameters , V1InvalidUserCategory { try { PropertyList propertyList = producer . getPortletProperties ( V1ToV2Converter . toV2GetPortletProperties ( getPortletProperties ) ) ; return V2ToV1Converter . toV1PropertyList ( propertyList ) ; } catch ( InvalidHandle invalidHandle ) { throw V2ToV1Converter . toV1Exception ( V1InvalidHandle . class , invalidHandle ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( InconsistentParameters inconsistentParameters ) { throw V2ToV1Converter . toV1Exception ( V1InconsistentParameters . class , inconsistentParameters ) ; } catch ( InvalidUserCategory invalidUserCategory ) { throw V2ToV1Converter . toV1Exception ( V1InvalidUserCategory . class , invalidUserCategory ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1ReturnAny initCookie ( V1InitCookie initCookie ) throws V1AccessDenied , V1OperationFailed , V1InvalidRegistration { try { producer . initCookie ( V1ToV2Converter . toV2InitCookie ( initCookie ) ) ; return null ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public V1PortletPropertyDescriptionResponse getPortletPropertyDescription ( V1GetPortletPropertyDescription getPortletPropertyDescription ) throws V1MissingParameters , V1InconsistentParameters , V1InvalidUserCategory , V1InvalidRegistration , V1AccessDenied , V1InvalidHandle , V1OperationFailed { try { PortletPropertyDescriptionResponse portletPropertyDescriptionResponse = producer . getPortletPropertyDescription ( V1ToV2Converter . toV2GetPortletPropertyDescription ( getPortletPropertyDescription ) ) ; return V2ToV1Converter . toV1PortletPropertyDescriptionResponse ( portletPropertyDescriptionResponse ) ; } catch ( MissingParameters missingParameters ) { throw V2ToV1Converter . toV1Exception ( V1MissingParameters . class , missingParameters ) ; } catch ( InconsistentParameters inconsistentParameters ) { throw V2ToV1Converter . toV1Exception ( V1InconsistentParameters . class , inconsistentParameters ) ; } catch ( InvalidUserCategory invalidUserCategory ) { throw V2ToV1Converter . toV1Exception ( V1InvalidUserCategory . class , invalidUserCategory ) ; } catch ( InvalidRegistration invalidRegistration ) { throw V2ToV1Converter . toV1Exception ( V1InvalidRegistration . class , invalidRegistration ) ; } catch ( AccessDenied accessDenied ) { throw V2ToV1Converter . toV1Exception ( V1AccessDenied . class , accessDenied ) ; } catch ( InvalidHandle invalidHandle ) { throw V2ToV1Converter . toV1Exception ( V1InvalidHandle . class , invalidHandle ) ; } catch ( OperationFailed operationFailed ) { throw V2ToV1Converter . toV1Exception ( V1OperationFailed . class , operationFailed ) ; } catch ( ModifyRegistrationRequired modifyRegistrationRequired ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , modifyRegistrationRequired ) ; } catch ( ResourceSuspended resourceSuspended ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , resourceSuspended ) ; } catch ( OperationNotSupported operationNotSupported ) { throw WSRP1ExceptionFactory . createWSException ( V1OperationFailed . class , "<STR_LIT>" , operationNotSupported ) ; } } public void onEvent ( ManagedObjectRegistryEvent event ) { producer . onEvent ( event ) ; } } </s>
<s> package org . gatein . wsrp . producer . v1 ; import org . oasis . wsrp . v1 . V1InvalidRegistration ; import org . oasis . wsrp . v1 . V1MissingParameters ; import org . oasis . wsrp . v1 . V1ModifyRegistration ; import org . oasis . wsrp . v1 . V1OperationFailed ; import org . oasis . wsrp . v1 . V1RegistrationContext ; import org . oasis . wsrp . v1 . V1RegistrationData ; import org . oasis . wsrp . v1 . V1RegistrationState ; import org . oasis . wsrp . v1 . V1ReturnAny ; public interface V1RegistrationInterface { V1RegistrationContext register ( V1RegistrationData register ) throws V1MissingParameters , V1OperationFailed ; V1ReturnAny deregister ( V1RegistrationContext deregister ) throws V1OperationFailed , V1InvalidRegistration ; V1RegistrationState modifyRegistration ( V1ModifyRegistration modifyRegistration ) throws V1MissingParameters , V1OperationFailed , V1InvalidRegistration ; } </s>
<s> package org . gatein . wsrp . producer ; import org . gatein . wsrp . producer . v1 . WSRP1Producer ; import org . gatein . wsrp . producer . v2 . WSRP2Producer ; public class ProducerHolder { private ProducerHolder ( ) { } public static WSRP2Producer getProducer ( ) { return getProducer ( false ) ; } public static WSRP1Producer getV1Producer ( ) { return WSRP1Producer . getInstance ( ) ; } public static WSRP2Producer getV2Producer ( ) { return getProducer ( ) ; } public static WSRP2Producer getProducer ( boolean allowUnstartedProducer ) { if ( allowUnstartedProducer || WSRPProducerImpl . isProducerStarted ( ) ) { return WSRPProducerImpl . getInstance ( ) ; } else { throw new IllegalStateException ( "<STR_LIT>" ) ; } } } </s>
<s> package org . gatein . wsrp . producer . config ; public interface ProducerConfigurationChangeListener { void usingStrictModeChangedTo ( boolean strictMode ) ; } </s>
<s> package org . gatein . wsrp . producer . config ; import org . gatein . registration . RegistrationPolicy ; import org . gatein . registration . RegistrationPolicyChangeListener ; import org . gatein . registration . RegistrationPropertyChangeListener ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . gatein . wsrp . registration . ValueChangeListener ; import javax . xml . namespace . QName ; import java . util . List ; import java . util . Map ; import java . util . Set ; public interface ProducerRegistrationRequirements extends ValueChangeListener { String DEFAULT_POLICY_CLASS_NAME = "<STR_LIT>" ; String DEFAULT_VALIDATOR_CLASS_NAME = "<STR_LIT>" ; boolean isRegistrationRequired ( ) ; void setRegistrationRequired ( boolean requiresRegistration ) ; boolean isRegistrationRequiredForFullDescription ( ) ; void setRegistrationRequiredForFullDescription ( boolean fullServiceDescriptionRequiresRegistration ) ; Map < QName , RegistrationPropertyDescription > getRegistrationProperties ( ) ; void addRegistrationProperty ( RegistrationPropertyDescription propertyDescription ) ; RegistrationPropertyDescription removeRegistrationProperty ( String propertyName ) ; RegistrationPropertyDescription removeRegistrationProperty ( QName propertyName ) ; void clearRegistrationProperties ( ) ; boolean acceptValueFor ( QName propertyName , Object value ) ; boolean acceptValueFor ( String propertyName , Object value ) ; RegistrationPropertyDescription getRegistrationPropertyWith ( String name ) ; RegistrationPropertyDescription getRegistrationPropertyWith ( QName name ) ; void notifyRegistrationPropertyChangeListeners ( ) ; void addRegistrationPropertyChangeListener ( RegistrationPropertyChangeListener listener ) ; void clearRegistrationPropertyChangeListeners ( ) ; void removeRegistrationPropertyChangeListener ( RegistrationPropertyChangeListener listener ) ; void setPolicy ( RegistrationPolicy policy ) ; RegistrationPolicy getPolicy ( ) ; void reloadPolicyFrom ( String policyClassName , String validatorClassName ) ; void propertyHasBeenRenamed ( RegistrationPropertyDescription propertyDescription , QName oldName ) ; RegistrationPropertyDescription addEmptyRegistrationProperty ( String name ) ; void addRegistrationPolicyChangeListener ( RegistrationPolicyChangeListener listener ) ; void removeRegistrationPolicyChangeListener ( RegistrationPolicyChangeListener listener ) ; void clearRegistrationPolicyChangeListeners ( ) ; Set < RegistrationPropertyChangeListener > getPropertyChangeListeners ( ) ; Set < RegistrationPolicyChangeListener > getPolicyChangeListeners ( ) ; long getLastModified ( ) ; void setRegistrationProperties ( Map < QName , RegistrationPropertyDescription > registrationProperties ) ; String getPolicyClassName ( ) ; List < String > getAvailableRegistrationPolicies ( ) ; List < String > getAvailableRegistrationPropertyValidators ( ) ; } </s>
<s> package org . gatein . wsrp . producer . config ; public interface ProducerConfigurationService { public ProducerConfiguration getConfiguration ( ) ; void reloadConfiguration ( ) throws Exception ; void reloadConfiguration ( boolean triggerListeners ) throws Exception ; void saveConfiguration ( ) throws Exception ; } </s>
<s> package org . gatein . wsrp . producer . config . impl ; import org . gatein . registration . RegistrationPolicyChangeListener ; import org . gatein . registration . RegistrationPropertyChangeListener ; import org . gatein . wsrp . producer . WSRPValidator ; import org . gatein . wsrp . producer . config . ProducerConfiguration ; import org . gatein . wsrp . producer . config . ProducerConfigurationChangeListener ; import org . gatein . wsrp . producer . config . ProducerConfigurationService ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import java . util . List ; import java . util . Set ; public abstract class AbstractProducerConfigurationService implements ProducerConfigurationService { protected ProducerConfiguration configuration ; public ProducerConfiguration getConfiguration ( ) { return configuration ; } public void reloadConfiguration ( ) throws Exception { reloadConfiguration ( false ) ; } public void reloadConfiguration ( boolean triggerListeners ) throws Exception { List < ProducerConfigurationChangeListener > listeners = null ; Set < RegistrationPolicyChangeListener > policyListeners = null ; Set < RegistrationPropertyChangeListener > propertyListeners = null ; ProducerRegistrationRequirements registrationRequirements ; if ( configuration != null ) { listeners = configuration . getChangeListeners ( ) ; registrationRequirements = configuration . getRegistrationRequirements ( ) ; if ( registrationRequirements != null ) { policyListeners = registrationRequirements . getPolicyChangeListeners ( ) ; propertyListeners = registrationRequirements . getPropertyChangeListeners ( ) ; } } loadConfiguration ( ) ; WSRPValidator . setStrict ( configuration . isUsingStrictMode ( ) ) ; if ( listeners != null ) { for ( ProducerConfigurationChangeListener listener : listeners ) { configuration . addChangeListener ( listener ) ; if ( triggerListeners ) { listener . usingStrictModeChangedTo ( configuration . isUsingStrictMode ( ) ) ; } } } registrationRequirements = configuration . getRegistrationRequirements ( ) ; if ( registrationRequirements != null ) { if ( propertyListeners != null ) { for ( RegistrationPropertyChangeListener listener : propertyListeners ) { registrationRequirements . addRegistrationPropertyChangeListener ( listener ) ; if ( triggerListeners ) { listener . propertiesHaveChanged ( registrationRequirements . getRegistrationProperties ( ) ) ; } } } if ( policyListeners != null ) { for ( RegistrationPolicyChangeListener listener : policyListeners ) { registrationRequirements . addRegistrationPolicyChangeListener ( listener ) ; if ( triggerListeners ) { listener . policyUpdatedTo ( registrationRequirements . getPolicy ( ) ) ; } } } } } protected abstract void loadConfiguration ( ) throws Exception ; } </s>
<s> package org . gatein . wsrp . producer . config . impl . xml ; import org . gatein . common . util . ParameterValidation ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . producer . config . ProducerConfiguration ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import org . gatein . wsrp . producer . config . impl . ProducerConfigurationImpl ; import org . gatein . wsrp . producer . config . impl . ProducerRegistrationRequirementsImpl ; import org . gatein . wsrp . registration . LocalizedString ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . jboss . util . StringPropertyReplacer ; import org . jboss . xb . binding . ObjectModelFactory ; import org . jboss . xb . binding . UnmarshallingContext ; import org . xml . sax . Attributes ; import javax . xml . namespace . QName ; import java . util . Locale ; public class ProducerConfigurationFactory implements ObjectModelFactory { private static final String REGISTRATION_CONFIG = "<STR_LIT>" ; private static final boolean DEBUG = false ; private boolean registrationDone = false ; private static final String LEGACY_XSD_STRING = "<STR_LIT>" ; public Object newRoot ( Object root , UnmarshallingContext nav , String nsURI , String localName , Attributes attrs ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } if ( "<STR_LIT>" . equals ( localName ) ) { ProducerConfiguration producerConfiguration = new ProducerConfigurationImpl ( ) ; producerConfiguration . setUsingStrictMode ( getBooleanAttributeValue ( attrs , "<STR_LIT>" , true ) ) ; return producerConfiguration ; } throw new IllegalArgumentException ( "<STR_LIT>" + "<STR_LIT>" + localName ) ; } public Object newChild ( ProducerConfigurationImpl producerConfiguration , UnmarshallingContext nav , String nsURI , String localName , Attributes attrs ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } if ( REGISTRATION_CONFIG . equals ( localName ) ) { if ( registrationDone ) { throw new IllegalArgumentException ( "<STR_LIT>" ) ; } ProducerRegistrationRequirements registrationRequirements = new ProducerRegistrationRequirementsImpl ( ) ; registrationRequirements . setRegistrationRequired ( true ) ; registrationRequirements . setRegistrationRequiredForFullDescription ( getBooleanAttributeValue ( attrs , "<STR_LIT>" , false ) ) ; registrationDone = true ; return registrationRequirements ; } return null ; } public Object completeRoot ( Object root , UnmarshallingContext nav , String nsURI , String localName ) { return root ; } public Object newChild ( ProducerRegistrationRequirementsImpl regReq , UnmarshallingContext nav , String nsURI , String localName , Attributes attrs ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } if ( "<STR_LIT>" . equals ( localName ) ) { return new RegistrationPropertyDescription ( ) ; } else { return null ; } } public void setValue ( ProducerRegistrationRequirementsImpl regReq , UnmarshallingContext nav , String nsURI , String localName , String value ) { if ( "<STR_LIT>" . equals ( localName ) ) { value = StringPropertyReplacer . replaceProperties ( value ) ; regReq . setPolicyClassName ( value ) ; } else if ( "<STR_LIT>" . equals ( localName ) ) { value = StringPropertyReplacer . replaceProperties ( value ) ; regReq . setValidatorClassName ( value ) ; } } public void setValue ( RegistrationPropertyDescription desc , UnmarshallingContext nav , String nsURI , String localName , String value ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } if ( "<STR_LIT:name>" . equals ( localName ) ) { value = StringPropertyReplacer . replaceProperties ( value ) ; desc . setName ( new QName ( value ) ) ; } else if ( "<STR_LIT:type>" . equals ( localName ) ) { value = StringPropertyReplacer . replaceProperties ( value ) ; if ( ! LEGACY_XSD_STRING . equals ( value ) ) { QName type = nav . resolveQName ( value ) ; if ( ! WSRPConstants . XSD_STRING . equals ( type ) ) { throw new IllegalArgumentException ( "<STR_LIT:'>" + value + "<STR_LIT>" ) ; } } desc . setType ( WSRPConstants . XSD_STRING ) ; } } public Object newChild ( RegistrationPropertyDescription desc , UnmarshallingContext nav , String nsURI , String localName , Attributes attrs ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } if ( "<STR_LIT>" . equals ( localName ) || "<STR_LIT:label>" . equals ( localName ) || "<STR_LIT:description>" . equals ( localName ) ) { String lang = attrs . getValue ( "<STR_LIT>" ) ; ParameterValidation . throwIllegalArgExceptionIfNullOrEmpty ( lang , "<STR_LIT>" , localName ) ; Locale locale = WSRPUtils . getLocale ( lang ) ; String resourceName = attrs . getValue ( "<STR_LIT>" ) ; LocalizedString string = new LocalizedString ( ) ; string . setLocale ( locale ) ; if ( resourceName != null && resourceName . length ( ) > <NUM_LIT:0> ) { string . setResourceName ( resourceName ) ; } return string ; } return null ; } public void setValue ( LocalizedString string , UnmarshallingContext nav , String nsURI , String localName , String value ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } value = StringPropertyReplacer . replaceProperties ( value ) ; string . setValue ( value ) ; } public void addChild ( ProducerConfigurationImpl conf , ProducerRegistrationRequirementsImpl regReq , UnmarshallingContext nav , String nsURI , String localName ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } if ( ! ProducerRegistrationRequirementsImpl . DEFAULT_POLICY_CLASS_NAME . equals ( regReq . getPolicyClassName ( ) ) && regReq . getValidatorClassName ( ) != null ) { throw new IllegalStateException ( "<STR_LIT>" ) ; } conf . setRegistrationRequirements ( regReq ) ; } public void addChild ( ProducerRegistrationRequirementsImpl regReq , RegistrationPropertyDescription desc , UnmarshallingContext nav , String nsURI , String localName ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } regReq . addRegistrationProperty ( desc ) ; } public void addChild ( RegistrationPropertyDescription desc , LocalizedString string , UnmarshallingContext nav , String nsURI , String localName ) { if ( DEBUG ) { System . out . println ( "<STR_LIT>" + localName ) ; } if ( "<STR_LIT>" . equals ( localName ) ) { desc . setHint ( string ) ; } else if ( "<STR_LIT:label>" . equals ( localName ) ) { desc . setLabel ( string ) ; } else if ( "<STR_LIT:description>" . equals ( localName ) ) { desc . setDescription ( string ) ; } } private boolean getBooleanAttributeValue ( Attributes attrs , String attributeName , boolean defaultValue ) { String value = attrs . getValue ( attributeName ) ; String defaultString = "<STR_LIT:false>" ; String other = "<STR_LIT:true>" ; if ( defaultValue ) { defaultString = "<STR_LIT:true>" ; other = "<STR_LIT:false>" ; } if ( other . equals ( value ) ) { return ! defaultValue ; } else if ( value == null || defaultString . equals ( value ) ) { return defaultValue ; } else { throw new IllegalArgumentException ( "<STR_LIT>" + attributeName + "<STR_LIT>" ) ; } } } </s>
<s> package org . gatein . wsrp . producer . config . impl . xml ; import org . gatein . registration . RegistrationPolicy ; import org . gatein . registration . policies . DefaultRegistrationPolicy ; import org . gatein . registration . policies . RegistrationPolicyWrapper ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import org . gatein . wsrp . producer . config . impl . ProducerConfigurationImpl ; import org . gatein . wsrp . producer . config . impl . ProducerRegistrationRequirementsImpl ; import org . gatein . wsrp . registration . LocalizedString ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . jboss . xb . binding . MarshallingContext ; import org . jboss . xb . binding . ObjectModelProvider ; public class ProducerConfigurationProvider implements ObjectModelProvider { public Object getRoot ( Object o , MarshallingContext marshallingContext , String s , String s1 ) { return o ; } public Object getChildren ( ProducerConfigurationImpl configuration , String namespaceUri , String localName ) { if ( "<STR_LIT>" . equals ( localName ) ) { ProducerRegistrationRequirements registrationRequirements = configuration . getRegistrationRequirements ( ) ; if ( registrationRequirements != null && registrationRequirements . isRegistrationRequired ( ) ) { return registrationRequirements ; } } else if ( "<STR_LIT>" . equals ( localName ) ) { return configuration ; } return null ; } public Object getChildren ( ProducerRegistrationRequirementsImpl regReq , String namespaceUri , String localName ) { if ( "<STR_LIT>" . equals ( localName ) ) { return regReq . getRegistrationProperties ( ) . values ( ) ; } return null ; } public Object getAttributeValue ( ProducerConfigurationImpl configuration , String namespaceUri , String localName ) { if ( "<STR_LIT>" . equals ( localName ) ) { return configuration . isUsingStrictMode ( ) ; } return null ; } public Object getAttributeValue ( ProducerRegistrationRequirementsImpl regReq , String namespaceUri , String localName ) { if ( "<STR_LIT>" . equals ( localName ) ) { return regReq . isRegistrationRequiredForFullDescription ( ) ; } return null ; } public Object getElementValue ( ProducerRegistrationRequirementsImpl regReq , String namespaceUri , String localName ) { Object value = null ; if ( "<STR_LIT>" . equals ( localName ) ) { RegistrationPolicy policy = regReq . getPolicy ( ) ; if ( policy != null ) { value = policy . getClassName ( ) ; } } else if ( "<STR_LIT>" . equals ( localName ) ) { RegistrationPolicy policy = RegistrationPolicyWrapper . unwrap ( regReq . getPolicy ( ) ) ; if ( policy instanceof DefaultRegistrationPolicy ) { DefaultRegistrationPolicy defaultRegistrationPolicy = ( DefaultRegistrationPolicy ) policy ; value = defaultRegistrationPolicy . getValidator ( ) . getClass ( ) . getName ( ) ; } } else { value = null ; } return value ; } public Object getElementValue ( RegistrationPropertyDescription propertyDescription , String namespaceUri , String localName ) { Object value = null ; if ( "<STR_LIT:name>" . equals ( localName ) ) { value = propertyDescription . getName ( ) ; } else if ( "<STR_LIT:type>" . equals ( localName ) ) { value = propertyDescription . getType ( ) ; } else if ( "<STR_LIT:label>" . equals ( localName ) ) { value = getLocalizedStringOrNull ( propertyDescription . getLabel ( ) ) ; } else if ( "<STR_LIT>" . equals ( localName ) ) { value = getLocalizedStringOrNull ( propertyDescription . getHint ( ) ) ; } else if ( "<STR_LIT:description>" . equals ( localName ) ) { value = getLocalizedStringOrNull ( propertyDescription . getDescription ( ) ) ; } return value ; } private LocalizedString getLocalizedStringOrNull ( LocalizedString string ) { if ( string != null ) { String value = string . getValue ( ) ; if ( value == null || value . length ( ) == <NUM_LIT:0> ) { return null ; } else { return string ; } } else { return null ; } } public Object getAttributeValue ( LocalizedString localizedString , String namespaceUri , String localName ) { Object value = null ; if ( "<STR_LIT>" . equals ( localName ) ) { value = WSRPUtils . toString ( localizedString . getLocale ( ) ) ; } else if ( "<STR_LIT>" . equals ( localName ) ) { value = localizedString . getResourceName ( ) ; } return value ; } public Object getElementValue ( LocalizedString localizedString , String namespaceUri , String localName ) { return localizedString . getValue ( ) ; } } </s>
<s> package org . gatein . wsrp . producer . config . impl . xml ; import org . gatein . common . net . URLTools ; import org . jboss . xb . binding . ObjectModelProvider ; import org . jboss . xb . binding . XercesXsMarshaller ; import org . jboss . xb . binding . sunday . unmarshalling . DefaultSchemaResolver ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import java . io . BufferedWriter ; import java . io . File ; import java . io . FileWriter ; import java . io . InputStream ; import java . io . InputStreamReader ; import java . io . Reader ; import java . io . StringWriter ; import java . io . Writer ; import java . net . URL ; import java . util . Enumeration ; public class FileSystemXMLProducerConfigurationService extends SimpleXMLProducerConfigurationService { private static final Logger log = LoggerFactory . getLogger ( FileSystemXMLProducerConfigurationService . class ) ; private String configLocation ; private File config ; private static DefaultSchemaResolver RESOLVER ; private static final String PRODUCER_NAMESPACE = "<STR_LIT>" ; private static final String PRODUCER_XSD = "<STR_LIT>" ; static { RESOLVER = new DefaultSchemaResolver ( ) ; RESOLVER . setCacheResolvedSchemas ( true ) ; RESOLVER . addSchemaLocation ( "<STR_LIT>" , "<STR_LIT>" ) ; RESOLVER . addSchemaLocation ( PRODUCER_NAMESPACE , "<STR_LIT>" + PRODUCER_XSD ) ; } public String getConfigLocation ( ) { return configLocation ; } public void setConfigLocation ( String configLocation ) { this . configLocation = configLocation ; } public void start ( ) throws Exception { File dataDir = new File ( System . getProperty ( "<STR_LIT>" ) ) ; File portalDir = new File ( dataDir , "<STR_LIT>" ) ; if ( ! portalDir . exists ( ) ) { if ( ! portalDir . mkdir ( ) ) { throw new RuntimeException ( "<STR_LIT>" + dataDir . getAbsolutePath ( ) ) ; } } else { if ( ! portalDir . isDirectory ( ) ) { throw new RuntimeException ( "<STR_LIT>" + dataDir . getAbsolutePath ( ) + "<STR_LIT>" ) ; } } config = new File ( portalDir , "<STR_LIT>" ) ; reloadConfiguration ( ) ; } public void loadConfiguration ( ) throws Exception { URL configURL = getConfigLocationURL ( ) ; try { loadConfigurationAt ( configURL ) ; } catch ( Exception e ) { if ( config . exists ( ) ) { log . debug ( "<STR_LIT>" + config . getCanonicalPath ( ) + "<STR_LIT>" ) ; config . delete ( ) ; loadConfigurationAt ( getConfigLocationURL ( ) ) ; } } } private void loadConfigurationAt ( URL configURL ) throws Exception { log . debug ( "<STR_LIT>" + configURL ) ; inputStream = configURL . openStream ( ) ; super . loadConfiguration ( ) ; } private URL getConfigLocationURL ( ) throws Exception { if ( ! config . exists ( ) ) { if ( configLocation == null ) { throw new Exception ( "<STR_LIT>" ) ; } Enumeration resources = Thread . currentThread ( ) . getContextClassLoader ( ) . getResources ( configLocation ) ; URL configURL = null ; while ( resources . hasMoreElements ( ) ) { configURL = ( URL ) resources . nextElement ( ) ; } if ( configURL == null ) { throw new Exception ( "<STR_LIT>" + configLocation + "<STR_LIT>" ) ; } if ( ! URLTools . exists ( configURL ) ) { throw new Exception ( "<STR_LIT>" + configURL + "<STR_LIT>" ) ; } return configURL ; } else { return config . toURI ( ) . toURL ( ) ; } } public void saveConfiguration ( ) throws Exception { StringWriter xmlOutput = new StringWriter ( ) ; InputStream is = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( "<STR_LIT>" + PRODUCER_XSD ) ; Reader xsReader = new InputStreamReader ( is ) ; XercesXsMarshaller marshaller = new XercesXsMarshaller ( ) ; marshaller . setSchemaResolver ( RESOLVER ) ; marshaller . addRootElement ( PRODUCER_NAMESPACE , "<STR_LIT>" , "<STR_LIT>" ) ; marshaller . declareNamespace ( "<STR_LIT>" , PRODUCER_NAMESPACE ) ; marshaller . declareNamespace ( "<STR_LIT>" , "<STR_LIT>" ) ; marshaller . addAttribute ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:string>" , PRODUCER_NAMESPACE + "<STR_LIT>" + PRODUCER_XSD ) ; ObjectModelProvider provider = new ProducerConfigurationProvider ( ) ; marshaller . setProperty ( "<STR_LIT>" , "<STR_LIT:true>" ) ; marshaller . marshal ( xsReader , provider , configuration , xmlOutput ) ; xsReader . close ( ) ; config . createNewFile ( ) ; Writer configFile = new BufferedWriter ( new FileWriter ( config ) ) ; configFile . write ( xmlOutput . toString ( ) ) ; configFile . flush ( ) ; configFile . close ( ) ; } } </s>
<s> package org . gatein . wsrp . producer . config . impl . xml ; import org . gatein . wsrp . producer . config . ProducerConfiguration ; import org . gatein . wsrp . producer . config . impl . AbstractProducerConfigurationService ; import org . jboss . xb . binding . ObjectModelFactory ; import org . jboss . xb . binding . Unmarshaller ; import org . jboss . xb . binding . UnmarshallerFactory ; import java . io . InputStream ; public class SimpleXMLProducerConfigurationService extends AbstractProducerConfigurationService { protected InputStream inputStream ; public SimpleXMLProducerConfigurationService ( ) { } public SimpleXMLProducerConfigurationService ( InputStream inputStream ) { this . inputStream = inputStream ; } public void loadConfiguration ( ) throws Exception { Unmarshaller unmarshaller = UnmarshallerFactory . newInstance ( ) . newUnmarshaller ( ) ; ObjectModelFactory factory = new ProducerConfigurationFactory ( ) ; configuration = ( ProducerConfiguration ) unmarshaller . unmarshal ( inputStream , factory , null ) ; } public void saveConfiguration ( ) throws Exception { throw new UnsupportedOperationException ( "<STR_LIT>" ) ; } } </s>
<s> package org . gatein . wsrp . producer . config . impl ; import org . gatein . common . util . ParameterValidation ; import org . gatein . wsrp . producer . config . ProducerConfiguration ; import org . gatein . wsrp . producer . config . ProducerConfigurationChangeListener ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import org . oasis . wsrp . v2 . CookieProtocol ; import java . util . ArrayList ; import java . util . List ; public class ProducerConfigurationImpl implements ProducerConfiguration { private ProducerRegistrationRequirements requirements ; private boolean strictMode = true ; private List < ProducerConfigurationChangeListener > listeners = new ArrayList < ProducerConfigurationChangeListener > ( <NUM_LIT:7> ) ; private int sessionExpirationTime = DEFAULT_SESSION_EXPIRATION_TIME ; private CookieProtocol requiresInitCookie = CookieProtocol . NONE ; public ProducerRegistrationRequirements getRegistrationRequirements ( ) { if ( requirements == null ) { requirements = new ProducerRegistrationRequirementsImpl ( false , false , false ) ; } return requirements ; } public boolean isUsingStrictMode ( ) { return strictMode ; } public void setUsingStrictMode ( boolean strict ) { if ( strictMode != strict ) { strictMode = strict ; for ( ProducerConfigurationChangeListener listener : listeners ) { listener . usingStrictModeChangedTo ( strict ) ; } } } public void addChangeListener ( ProducerConfigurationChangeListener listener ) { ParameterValidation . throwIllegalArgExceptionIfNull ( listener , "<STR_LIT>" ) ; listeners . add ( listener ) ; } public void removeChangeListener ( ProducerConfigurationChangeListener listener ) { ParameterValidation . throwIllegalArgExceptionIfNull ( listener , "<STR_LIT>" ) ; listeners . remove ( listener ) ; } public List < ProducerConfigurationChangeListener > getChangeListeners ( ) { return listeners ; } public void setRegistrationRequirements ( ProducerRegistrationRequirements requirements ) { this . requirements = requirements ; } public CookieProtocol getRequiresInitCookie ( ) { return requiresInitCookie ; } public void setRequiresInitCookie ( CookieProtocol requiresInitCookie ) { this . requiresInitCookie = requiresInitCookie ; } public int getSessionExpirationTime ( ) { return sessionExpirationTime ; } public void setSessionExpirationTime ( int sessionExpirationTime ) { this . sessionExpirationTime = sessionExpirationTime ; } } </s>
<s> package org . gatein . wsrp . producer . config . impl ; import com . google . common . base . Function ; import org . gatein . common . util . ParameterValidation ; import org . gatein . registration . RegistrationPolicy ; import org . gatein . registration . RegistrationPolicyChangeListener ; import org . gatein . registration . RegistrationPropertyChangeListener ; import org . gatein . registration . policies . DefaultRegistrationPolicy ; import org . gatein . registration . policies . DefaultRegistrationPropertyValidator ; import org . gatein . registration . policies . RegistrationPolicyWrapper ; import org . gatein . registration . policies . RegistrationPropertyValidator ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . api . plugins . PluginsAccess ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import javax . xml . namespace . QName ; import java . util . Collections ; import java . util . HashMap ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; public class ProducerRegistrationRequirementsImpl implements ProducerRegistrationRequirements { private static final Logger log = LoggerFactory . getLogger ( ProducerRegistrationRequirementsImpl . class ) ; public static final Function < Class < ? extends RegistrationPolicy > , String > CLASS_TO_NAME_FUNCTION = new Function < Class < ? extends RegistrationPolicy > , String > ( ) { @ Override public String apply ( Class < ? extends RegistrationPolicy > aClass ) { return aClass . getSimpleName ( ) ; } } ; private boolean requiresRegistration ; private boolean fullServiceDescriptionRequiresRegistration ; private RegistrationPolicy policy ; private String policyClassName ; private String validatorClassName ; private long lastModified ; private Map < QName , RegistrationPropertyDescription > registrationProperties ; private Set < RegistrationPropertyChangeListener > propertyChangeListeners = new HashSet < RegistrationPropertyChangeListener > ( <NUM_LIT:3> ) ; private Set < RegistrationPolicyChangeListener > policyChangeListeners = new HashSet < RegistrationPolicyChangeListener > ( <NUM_LIT:3> ) ; public ProducerRegistrationRequirementsImpl ( boolean requiresMarshalling , boolean requiresRegistration , boolean fullServiceDescriptionRequiresRegistration ) { this ( ) ; this . requiresRegistration = requiresRegistration ; this . fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration ; modifyNow ( ) ; } public ProducerRegistrationRequirementsImpl ( ) { registrationProperties = new HashMap < QName , RegistrationPropertyDescription > ( <NUM_LIT:7> ) ; setPolicy ( new DefaultRegistrationPolicy ( ) ) ; } public ProducerRegistrationRequirementsImpl ( ProducerRegistrationRequirements other ) { this ( false , other . isRegistrationRequired ( ) , other . isRegistrationRequiredForFullDescription ( ) ) ; setPolicy ( other . getPolicy ( ) ) ; Set < Map . Entry < QName , RegistrationPropertyDescription > > otherProps = other . getRegistrationProperties ( ) . entrySet ( ) ; registrationProperties = new HashMap < QName , RegistrationPropertyDescription > ( otherProps . size ( ) ) ; for ( Map . Entry < QName , RegistrationPropertyDescription > entry : otherProps ) { registrationProperties . put ( entry . getKey ( ) , new RegistrationPropertyDescription ( entry . getValue ( ) ) ) ; } modifyNow ( ) ; } private void modifyNow ( ) { lastModified = System . nanoTime ( ) ; } public long getLastModified ( ) { return lastModified ; } public void setRegistrationProperties ( Map < QName , RegistrationPropertyDescription > regProps ) { if ( ! registrationProperties . equals ( regProps ) ) { registrationProperties . clear ( ) ; for ( RegistrationPropertyDescription propertyDescription : regProps . values ( ) ) { addRegistrationProperty ( new RegistrationPropertyDescription ( propertyDescription ) ) ; } modifyNow ( ) ; notifyRegistrationPropertyChangeListeners ( ) ; } } public boolean isRegistrationRequired ( ) { return requiresRegistration ; } public void setRegistrationRequired ( boolean requiresRegistration ) { if ( this . requiresRegistration != requiresRegistration ) { if ( this . requiresRegistration && ! requiresRegistration ) { clearRegistrationProperties ( ) ; } this . requiresRegistration = requiresRegistration ; modifyNow ( ) ; } } public boolean isRegistrationRequiredForFullDescription ( ) { return fullServiceDescriptionRequiresRegistration ; } public void setRegistrationRequiredForFullDescription ( boolean fullServiceDescriptionRequiresRegistration ) { if ( this . fullServiceDescriptionRequiresRegistration != fullServiceDescriptionRequiresRegistration ) { this . fullServiceDescriptionRequiresRegistration = fullServiceDescriptionRequiresRegistration ; modifyNow ( ) ; } } public Map < QName , RegistrationPropertyDescription > getRegistrationProperties ( ) { return Collections . unmodifiableMap ( registrationProperties ) ; } public void addRegistrationProperty ( RegistrationPropertyDescription propertyDescription ) { ParameterValidation . throwIllegalArgExceptionIfNull ( propertyDescription , "<STR_LIT>" ) ; QName name = propertyDescription . getName ( ) ; ParameterValidation . throwIllegalArgExceptionIfNull ( name , "<STR_LIT>" ) ; registrationProperties . put ( name , propertyDescription ) ; modifyNow ( ) ; propertyDescription . setValueChangeListener ( this ) ; notifyRegistrationPropertyChangeListeners ( ) ; } public RegistrationPropertyDescription addEmptyRegistrationProperty ( String name ) { ParameterValidation . throwIllegalArgExceptionIfNull ( name , "<STR_LIT>" ) ; RegistrationPropertyDescription reg = new RegistrationPropertyDescription ( name , WSRPConstants . XSD_STRING ) ; addRegistrationProperty ( reg ) ; return reg ; } public boolean acceptValueFor ( QName propertyName , Object value ) { ParameterValidation . throwIllegalArgExceptionIfNull ( propertyName , "<STR_LIT>" ) ; QName type = getPropertyDescription ( propertyName ) . getType ( ) ; return true ; } public boolean acceptValueFor ( String propertyName , Object value ) { return acceptValueFor ( QName . valueOf ( propertyName ) , value ) ; } public RegistrationPropertyDescription getRegistrationPropertyWith ( String name ) { ParameterValidation . throwIllegalArgExceptionIfNullOrEmpty ( name , "<STR_LIT>" , null ) ; return getRegistrationPropertyWith ( QName . valueOf ( name ) ) ; } public RegistrationPropertyDescription getRegistrationPropertyWith ( QName name ) { ParameterValidation . throwIllegalArgExceptionIfNull ( name , "<STR_LIT>" ) ; return registrationProperties . get ( name ) ; } private RegistrationPropertyDescription getPropertyDescription ( QName propertyName ) { final RegistrationPropertyDescription description = registrationProperties . get ( propertyName ) ; if ( description != null ) { return new RegistrationPropertyDescription ( description ) ; } else { throw new IllegalArgumentException ( "<STR_LIT>" + propertyName + "<STR_LIT:'>" ) ; } } public RegistrationPropertyDescription removeRegistrationProperty ( QName propertyName ) { ParameterValidation . throwIllegalArgExceptionIfNull ( propertyName , "<STR_LIT>" ) ; RegistrationPropertyDescription prop = registrationProperties . remove ( propertyName ) ; if ( prop != null ) { modifyNow ( ) ; notifyRegistrationPropertyChangeListeners ( ) ; } return prop ; } public void clearRegistrationProperties ( ) { registrationProperties . clear ( ) ; modifyNow ( ) ; notifyRegistrationPropertyChangeListeners ( ) ; } public RegistrationPropertyDescription removeRegistrationProperty ( String propertyName ) { return removeRegistrationProperty ( QName . valueOf ( propertyName ) ) ; } public void valueHasChanged ( RegistrationPropertyDescription originatingProperty , Object oldValue , Object newValue , boolean isName ) { modifyNow ( ) ; notifyRegistrationPropertyChangeListeners ( ) ; if ( isName && oldValue instanceof QName ) { propertyHasBeenRenamed ( originatingProperty , ( QName ) oldValue ) ; } } public void notifyRegistrationPropertyChangeListeners ( ) { Map < QName , RegistrationPropertyDescription > newRegistrationProperties = Collections . unmodifiableMap ( registrationProperties ) ; for ( RegistrationPropertyChangeListener listener : propertyChangeListeners ) { listener . propertiesHaveChanged ( newRegistrationProperties ) ; } } public void clearRegistrationPropertyChangeListeners ( ) { propertyChangeListeners . clear ( ) ; } public void addRegistrationPropertyChangeListener ( RegistrationPropertyChangeListener listener ) { ParameterValidation . throwIllegalArgExceptionIfNull ( listener , "<STR_LIT>" ) ; propertyChangeListeners . add ( listener ) ; } public void removeRegistrationPropertyChangeListener ( RegistrationPropertyChangeListener listener ) { ParameterValidation . throwIllegalArgExceptionIfNull ( listener , "<STR_LIT>" ) ; propertyChangeListeners . remove ( listener ) ; } public Set < RegistrationPropertyChangeListener > getPropertyChangeListeners ( ) { return propertyChangeListeners ; } public void addRegistrationPolicyChangeListener ( RegistrationPolicyChangeListener listener ) { ParameterValidation . throwIllegalArgExceptionIfNull ( listener , "<STR_LIT>" ) ; policyChangeListeners . add ( listener ) ; } public void removeRegistrationPolicyChangeListener ( RegistrationPolicyChangeListener listener ) { ParameterValidation . throwIllegalArgExceptionIfNull ( listener , "<STR_LIT>" ) ; policyChangeListeners . remove ( listener ) ; } public void clearRegistrationPolicyChangeListeners ( ) { policyChangeListeners . clear ( ) ; } public void notifyRegistrationPolicyChangeListeners ( ) { for ( RegistrationPolicyChangeListener listener : policyChangeListeners ) { listener . policyUpdatedTo ( policy ) ; } } public Set < RegistrationPolicyChangeListener > getPolicyChangeListeners ( ) { return policyChangeListeners ; } public void setPolicy ( RegistrationPolicy policy ) { if ( ParameterValidation . isOldAndNewDifferent ( this . policy , policy ) ) { if ( policy == null ) { log . debug ( "<STR_LIT>" ) ; policy = new DefaultRegistrationPolicy ( ) ; } this . policy = RegistrationPolicyWrapper . wrap ( policy ) ; policyClassName = policy . getClassName ( ) ; if ( DEFAULT_POLICY_CLASS_NAME . equals ( policyClassName ) ) { DefaultRegistrationPolicy registrationPolicy = ( DefaultRegistrationPolicy ) RegistrationPolicyWrapper . unwrap ( policy ) ; validatorClassName = registrationPolicy . getValidator ( ) . getClass ( ) . getName ( ) ; } else { validatorClassName = null ; } modifyNow ( ) ; notifyRegistrationPolicyChangeListeners ( ) ; } } public RegistrationPolicy getPolicy ( ) { reloadPolicyFrom ( policyClassName , validatorClassName ) ; return policy ; } public void reloadPolicyFrom ( String policyClassName , String validatorClassName ) { if ( requiresRegistration && ( ! policy . getClassName ( ) . equals ( policyClassName ) || isCurrentValidatorClassDifferentFrom ( validatorClassName ) ) ) { if ( policyClassName != null && ! DEFAULT_POLICY_CLASS_NAME . equals ( policyClassName ) ) { log . debug ( "<STR_LIT>" + policyClassName ) ; setPolicy ( PluginsAccess . getPlugins ( ) . createPluginInstance ( policyClassName , RegistrationPolicy . class ) ) ; } else { log . debug ( "<STR_LIT>" + DEFAULT_POLICY_CLASS_NAME ) ; RegistrationPropertyValidator validator ; if ( validatorClassName != null && validatorClassName . length ( ) > <NUM_LIT:0> && ! DEFAULT_VALIDATOR_CLASS_NAME . equals ( validatorClassName ) ) { log . debug ( "<STR_LIT>" + validatorClassName ) ; validator = PluginsAccess . getPlugins ( ) . createPluginInstance ( validatorClassName , RegistrationPropertyValidator . class ) ; } else { log . debug ( "<STR_LIT>" + DEFAULT_VALIDATOR_CLASS_NAME ) ; validator = new DefaultRegistrationPropertyValidator ( ) ; } DefaultRegistrationPolicy delegate = new DefaultRegistrationPolicy ( ) ; delegate . setValidator ( validator ) ; setPolicy ( delegate ) ; } } } @ Override public List < String > getAvailableRegistrationPolicies ( ) { return PluginsAccess . getPlugins ( ) . getPluginImplementationNames ( RegistrationPolicy . class , DEFAULT_POLICY_CLASS_NAME ) ; } @ Override public List < String > getAvailableRegistrationPropertyValidators ( ) { return PluginsAccess . getPlugins ( ) . getPluginImplementationNames ( RegistrationPropertyValidator . class , DEFAULT_VALIDATOR_CLASS_NAME ) ; } private boolean isCurrentValidatorClassDifferentFrom ( String validatorClassName ) { return policy instanceof DefaultRegistrationPolicy && ! ( ( DefaultRegistrationPolicy ) policy ) . getValidator ( ) . getClass ( ) . getCanonicalName ( ) . equals ( validatorClassName ) ; } public void propertyHasBeenRenamed ( RegistrationPropertyDescription propertyDescription , QName oldName ) { ParameterValidation . throwIllegalArgExceptionIfNull ( propertyDescription , "<STR_LIT>" ) ; ParameterValidation . throwIllegalArgExceptionIfNull ( oldName , "<STR_LIT>" ) ; if ( registrationProperties . containsKey ( oldName ) ) { synchronized ( this ) { registrationProperties . remove ( oldName ) ; registrationProperties . put ( propertyDescription . getName ( ) , propertyDescription ) ; modifyNow ( ) ; } } } public void setPolicyClassName ( String policyClassName ) { this . policyClassName = policyClassName ; setValidatorClassName ( null ) ; } public String getPolicyClassName ( ) { if ( policyClassName == null ) { return DEFAULT_POLICY_CLASS_NAME ; } return policyClassName ; } public void setValidatorClassName ( String validatorClassName ) { this . validatorClassName = validatorClassName ; } public String getValidatorClassName ( ) { return validatorClassName ; } } </s>
<s> package org . gatein . wsrp . producer . config ; import org . oasis . wsrp . v2 . CookieProtocol ; import java . util . List ; public interface ProducerConfiguration { ProducerRegistrationRequirements getRegistrationRequirements ( ) ; boolean isUsingStrictMode ( ) ; void setUsingStrictMode ( boolean strict ) ; void addChangeListener ( ProducerConfigurationChangeListener listener ) ; void removeChangeListener ( ProducerConfigurationChangeListener listener ) ; List < ProducerConfigurationChangeListener > getChangeListeners ( ) ; int DEFAULT_SESSION_EXPIRATION_TIME = <NUM_LIT> ; int INFINITE_SESSION_EXPIRATION_TIME = - <NUM_LIT:1> ; CookieProtocol getRequiresInitCookie ( ) ; void setRequiresInitCookie ( CookieProtocol requiresInitCookie ) ; int getSessionExpirationTime ( ) ; void setSessionExpirationTime ( int sessionExpirationTime ) ; } </s>
<s> package org . gatein . wsrp . producer ; import org . gatein . exports . ExportManager ; import org . gatein . exports . impl . ExportManagerImpl ; import org . gatein . pc . api . NoSuchPortletException ; import org . gatein . pc . api . Portlet ; import org . gatein . pc . api . PortletInvoker ; import org . gatein . pc . api . PortletInvokerException ; import org . gatein . pc . api . info . RuntimeOptionInfo ; import org . gatein . pc . portlet . container . managed . ManagedObjectRegistryEvent ; import org . gatein . registration . Registration ; import org . gatein . registration . RegistrationLocal ; import org . gatein . registration . RegistrationManager ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . api . context . ProducerContext ; import org . gatein . wsrp . api . extensions . DefaultProducerExtensionAccessor ; import org . gatein . wsrp . producer . config . ProducerConfiguration ; import org . gatein . wsrp . producer . config . ProducerConfigurationService ; import org . gatein . wsrp . producer . config . ProducerRegistrationRequirements ; import org . gatein . wsrp . producer . handlers . MarkupHandler ; import org . gatein . wsrp . producer . handlers . PortletManagementHandler ; import org . gatein . wsrp . producer . handlers . RegistrationHandler ; import org . gatein . wsrp . producer . handlers . ServiceDescriptionHandler ; import org . gatein . wsrp . producer . handlers . processors . ProducerHelper ; import org . gatein . wsrp . producer . v2 . WSRP2Producer ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . BlockingInteractionResponse ; import org . oasis . wsrp . v2 . ClonePortlet ; import org . oasis . wsrp . v2 . CookieProtocol ; import org . oasis . wsrp . v2 . CopyPortlets ; import org . oasis . wsrp . v2 . CopyPortletsResponse ; import org . oasis . wsrp . v2 . DestroyPortlets ; import org . oasis . wsrp . v2 . DestroyPortletsResponse ; import org . oasis . wsrp . v2 . ExportByValueNotSupported ; import org . oasis . wsrp . v2 . ExportNoLongerValid ; import org . oasis . wsrp . v2 . ExportPortlets ; import org . oasis . wsrp . v2 . ExportPortletsResponse ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetMarkup ; import org . oasis . wsrp . v2 . GetPortletDescription ; import org . oasis . wsrp . v2 . GetPortletProperties ; import org . oasis . wsrp . v2 . GetPortletPropertyDescription ; import org . oasis . wsrp . v2 . GetPortletsLifetime ; import org . oasis . wsrp . v2 . GetPortletsLifetimeResponse ; import org . oasis . wsrp . v2 . GetRegistrationLifetime ; import org . oasis . wsrp . v2 . GetResource ; import org . oasis . wsrp . v2 . GetServiceDescription ; import org . oasis . wsrp . v2 . HandleEvents ; import org . oasis . wsrp . v2 . HandleEventsResponse ; import org . oasis . wsrp . v2 . ImportPortlets ; import org . oasis . wsrp . v2 . ImportPortletsResponse ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InitCookie ; import org . oasis . wsrp . v2 . InvalidCookie ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidSession ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MarkupResponse ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PerformBlockingInteraction ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescription ; import org . oasis . wsrp . v2 . PortletDescriptionResponse ; import org . oasis . wsrp . v2 . PortletPropertyDescriptionResponse ; import org . oasis . wsrp . v2 . PortletStateChangeRequired ; import org . oasis . wsrp . v2 . PropertyList ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationData ; import org . oasis . wsrp . v2 . RegistrationState ; import org . oasis . wsrp . v2 . ReleaseExport ; import org . oasis . wsrp . v2 . ReleaseSessions ; import org . oasis . wsrp . v2 . ResourceResponse ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . ServiceDescription ; import org . oasis . wsrp . v2 . SetExportLifetime ; import org . oasis . wsrp . v2 . SetPortletProperties ; import org . oasis . wsrp . v2 . SetPortletsLifetime ; import org . oasis . wsrp . v2 . SetPortletsLifetimeResponse ; import org . oasis . wsrp . v2 . SetRegistrationLifetime ; import org . oasis . wsrp . v2 . UnsupportedLocale ; import org . oasis . wsrp . v2 . UnsupportedMimeType ; import org . oasis . wsrp . v2 . UnsupportedMode ; import org . oasis . wsrp . v2 . UnsupportedWindowState ; import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; import java . util . Collections ; import java . util . HashSet ; import java . util . List ; import java . util . Map ; import java . util . Set ; public class WSRPProducerImpl implements WSRP2Producer , ProducerHelper { private static final Logger log = LoggerFactory . getLogger ( WSRPProducerImpl . class ) ; private PortletInvoker invoker ; private final MarkupHandler markupHandler ; private final ServiceDescriptionHandler serviceDescriptionHandler ; private final RegistrationHandler registrationHandler ; private final PortletManagementHandler portletManagementHandler ; private RegistrationManager registrationManager ; private ProducerConfigurationService configurationService ; private ExportManager exportManager ; private ProducerContext producerContext ; private boolean started = false ; private static final class InstanceHolder { public static final WSRPProducerImpl producer = new WSRPProducerImpl ( ) ; } static WSRPProducerImpl getInstance ( ) { return InstanceHolder . producer ; } static boolean isProducerStarted ( ) { return InstanceHolder . producer . started ; } private WSRPProducerImpl ( ) { markupHandler = new MarkupHandler ( this ) ; serviceDescriptionHandler = new ServiceDescriptionHandler ( this ) ; registrationHandler = new RegistrationHandler ( this ) ; portletManagementHandler = new PortletManagementHandler ( this ) ; DefaultProducerExtensionAccessor . registerWithAPI ( ) ; } public ProducerRegistrationRequirements getProducerRegistrationRequirements ( ) { return getProducerConfiguration ( ) . getRegistrationRequirements ( ) ; } public ServiceDescription getServiceDescription ( GetServiceDescription gs ) throws InvalidRegistration , OperationFailed , ResourceSuspended , ModifyRegistrationRequired { return serviceDescriptionHandler . getServiceDescription ( gs ) ; } public MarkupResponse getMarkup ( GetMarkup getMarkup ) throws UnsupportedWindowState , InvalidCookie , InvalidSession , AccessDenied , InconsistentParameters , InvalidHandle , UnsupportedLocale , UnsupportedMode , OperationFailed , MissingParameters , InvalidUserCategory , InvalidRegistration , UnsupportedMimeType , ResourceSuspended , ModifyRegistrationRequired { return markupHandler . getMarkup ( getMarkup ) ; } public BlockingInteractionResponse performBlockingInteraction ( PerformBlockingInteraction performBlockingInteraction ) throws InvalidSession , UnsupportedMode , UnsupportedMimeType , OperationFailed , UnsupportedWindowState , UnsupportedLocale , AccessDenied , PortletStateChangeRequired , InvalidRegistration , MissingParameters , InvalidUserCategory , InconsistentParameters , InvalidHandle , InvalidCookie , ResourceSuspended , ModifyRegistrationRequired { return markupHandler . performBlockingInteraction ( performBlockingInteraction ) ; } public List < Extension > releaseSessions ( ReleaseSessions releaseSessions ) throws InvalidRegistration , OperationFailed , MissingParameters , AccessDenied , ResourceSuspended , OperationNotSupported , ModifyRegistrationRequired { return markupHandler . releaseSessions ( releaseSessions ) ; } public List < Extension > initCookie ( InitCookie initCookie ) throws AccessDenied , OperationFailed , InvalidRegistration , ResourceSuspended , OperationNotSupported , ModifyRegistrationRequired { return markupHandler . initCookie ( initCookie ) ; } public HandleEventsResponse handleEvents ( HandleEvents handleEvents ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , PortletStateChangeRequired , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState { return markupHandler . handleEvents ( handleEvents ) ; } public ResourceResponse getResource ( GetResource getResource ) throws AccessDenied , InconsistentParameters , InvalidCookie , InvalidHandle , InvalidRegistration , InvalidSession , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , ResourceSuspended , UnsupportedLocale , UnsupportedMimeType , UnsupportedMode , UnsupportedWindowState , OperationNotSupported { return markupHandler . getResource ( getResource ) ; } public RegistrationContext register ( RegistrationData register ) throws MissingParameters , OperationFailed , OperationNotSupported { return registrationHandler . register ( register ) ; } public List < Extension > deregister ( RegistrationContext deregister ) throws OperationFailed , InvalidRegistration , ResourceSuspended , OperationNotSupported { return registrationHandler . deregister ( deregister ) ; } public RegistrationState modifyRegistration ( ModifyRegistration modifyRegistration ) throws MissingParameters , OperationFailed , InvalidRegistration , ResourceSuspended , OperationNotSupported { return registrationHandler . modifyRegistration ( modifyRegistration ) ; } public Lifetime getRegistrationLifetime ( GetRegistrationLifetime getRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return registrationHandler . getRegistrationLifetime ( getRegistrationLifetime ) ; } public Lifetime setRegistrationLifetime ( SetRegistrationLifetime setRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return registrationHandler . setRegistrationLifetime ( setRegistrationLifetime ) ; } public PortletDescriptionResponse getPortletDescription ( GetPortletDescription getPortletDescription ) throws AccessDenied , InvalidHandle , InvalidUserCategory , InconsistentParameters , MissingParameters , InvalidRegistration , OperationFailed , ResourceSuspended , OperationNotSupported , ModifyRegistrationRequired { return portletManagementHandler . getPortletDescription ( getPortletDescription ) ; } public PortletContext clonePortlet ( ClonePortlet clonePortlet ) throws InvalidUserCategory , AccessDenied , OperationFailed , InvalidHandle , InvalidRegistration , InconsistentParameters , MissingParameters , ResourceSuspended , OperationNotSupported , ModifyRegistrationRequired { return portletManagementHandler . clonePortlet ( clonePortlet ) ; } public DestroyPortletsResponse destroyPortlets ( DestroyPortlets destroyPortlets ) throws InconsistentParameters , MissingParameters , InvalidRegistration , OperationFailed , ResourceSuspended , OperationNotSupported , ModifyRegistrationRequired { return portletManagementHandler . destroyPortlets ( destroyPortlets ) ; } public PortletContext setPortletProperties ( SetPortletProperties setPortletProperties ) throws OperationFailed , InvalidHandle , MissingParameters , InconsistentParameters , InvalidUserCategory , AccessDenied , InvalidRegistration , ResourceSuspended , OperationNotSupported , ModifyRegistrationRequired { return portletManagementHandler . setPortletProperties ( setPortletProperties ) ; } public PropertyList getPortletProperties ( GetPortletProperties getPortletProperties ) throws InvalidHandle , MissingParameters , InvalidRegistration , AccessDenied , OperationFailed , InconsistentParameters , InvalidUserCategory , ResourceSuspended , OperationNotSupported , ModifyRegistrationRequired { return portletManagementHandler . getPortletProperties ( getPortletProperties ) ; } public PortletPropertyDescriptionResponse getPortletPropertyDescription ( GetPortletPropertyDescription getPortletPropertyDescription ) throws MissingParameters , InconsistentParameters , InvalidUserCategory , InvalidRegistration , AccessDenied , InvalidHandle , OperationFailed , ResourceSuspended , OperationNotSupported , ModifyRegistrationRequired { return portletManagementHandler . getPortletPropertyDescription ( getPortletPropertyDescription ) ; } public GetPortletsLifetimeResponse getPortletsLifetime ( GetPortletsLifetime getPortletsLifetime ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return portletManagementHandler . getPortletsLifetime ( getPortletsLifetime ) ; } public SetPortletsLifetimeResponse setPortletsLifetime ( SetPortletsLifetime setPortletsLifetime ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return portletManagementHandler . setPortletsLifetime ( setPortletsLifetime ) ; } public CopyPortletsResponse copyPortlets ( CopyPortlets copyPortlets ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return portletManagementHandler . copyPortlets ( copyPortlets ) ; } public ExportPortletsResponse exportPortlets ( ExportPortlets exportPortlets ) throws AccessDenied , ExportByValueNotSupported , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return portletManagementHandler . exportPortlets ( exportPortlets ) ; } public ImportPortletsResponse importPortlets ( ImportPortlets importPortlets ) throws AccessDenied , ExportNoLongerValid , InconsistentParameters , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return portletManagementHandler . importPortlets ( importPortlets ) ; } public List < Extension > releaseExport ( ReleaseExport releaseExport ) { return portletManagementHandler . releaseExport ( releaseExport ) ; } public Lifetime setExportLifetime ( SetExportLifetime setExportLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended { return portletManagementHandler . setExportLifetime ( setExportLifetime ) ; } private ProducerConfiguration getProducerConfiguration ( ) { return configurationService . getConfiguration ( ) ; } public RegistrationManager getRegistrationManager ( ) { return registrationManager ; } public void setRegistrationManager ( RegistrationManager registrationManager ) { this . registrationManager = registrationManager ; } public void setConfigurationService ( ProducerConfigurationService configurationService ) { this . configurationService = configurationService ; } public ProducerConfigurationService getConfigurationService ( ) { return configurationService ; } public void setExportManager ( ExportManager exportManger ) { this . exportManager = exportManger ; } public ProducerContext getProducerContext ( ) { return producerContext ; } public void setProducerContext ( ProducerContext producerContext ) { this . producerContext = producerContext ; } public ExportManager getExportManager ( ) { if ( exportManager == null ) { exportManager = new ExportManagerImpl ( ) ; } return exportManager ; } public synchronized void start ( ) { if ( ! started ) { ProducerConfiguration configuration = configurationService . getConfiguration ( ) ; configuration . addChangeListener ( this ) ; usingStrictModeChangedTo ( configuration . isUsingStrictMode ( ) ) ; ProducerRegistrationRequirements registrationRequirements = getProducerRegistrationRequirements ( ) ; registrationRequirements . addRegistrationPolicyChangeListener ( registrationManager ) ; registrationRequirements . addRegistrationPropertyChangeListener ( registrationManager ) ; registrationManager . setPolicy ( registrationRequirements . getPolicy ( ) ) ; started = true ; } } public synchronized void stop ( ) { if ( started ) { ProducerRegistrationRequirements registrationRequirements = getProducerRegistrationRequirements ( ) ; registrationRequirements . removeRegistrationPropertyChangeListener ( registrationManager ) ; registrationRequirements . removeRegistrationPolicyChangeListener ( registrationManager ) ; getProducerConfiguration ( ) . removeChangeListener ( this ) ; started = false ; } } int getExpirationTime ( ) { return getProducerConfiguration ( ) . getSessionExpirationTime ( ) ; } CookieProtocol getRequiresInitCookie ( ) { return getProducerConfiguration ( ) . getRequiresInitCookie ( ) ; } public PortletInvoker getPortletInvoker ( ) { return invoker ; } public void setPortletInvoker ( PortletInvoker invoker ) { this . invoker = invoker ; } public Portlet getPortletWith ( org . gatein . pc . api . PortletContext portletContext , Registration registration ) throws InvalidHandle , PortletInvokerException { Portlet portlet ; try { RegistrationLocal . setRegistration ( registration ) ; portlet = invoker . getPortlet ( portletContext ) ; } catch ( NoSuchPortletException e ) { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + portletContext . getId ( ) + "<STR_LIT:'>" , e ) ; } finally { RegistrationLocal . setRegistration ( null ) ; } if ( ! isRemotable ( portlet ) ) { throw WSRP2ExceptionFactory . throwWSException ( InvalidHandle . class , "<STR_LIT>" + portletContext . getId ( ) + "<STR_LIT>" , null ) ; } return portlet ; } public Set < Portlet > getRemotablePortlets ( ) throws PortletInvokerException { log . debug ( "<STR_LIT>" ) ; Set < Portlet > allPortlets = invoker . getPortlets ( ) ; int portletNumber = allPortlets . size ( ) ; Set < Portlet > remotablePortlets = Collections . emptySet ( ) ; if ( portletNumber > <NUM_LIT:0> ) { remotablePortlets = new HashSet < Portlet > ( portletNumber ) ; for ( Portlet portlet : allPortlets ) { log . debug ( "<STR_LIT>" + portlet . getContext ( ) ) ; if ( isRemotable ( portlet ) ) { remotablePortlets . add ( portlet ) ; log . debug ( "<STR_LIT>" + portlet . getContext ( ) ) ; } } } return remotablePortlets ; } public PortletDescription getPortletDescription ( PortletContext portletContext , List < String > locales , Registration registration ) throws InvalidHandle , OperationFailed { return serviceDescriptionHandler . getPortletDescription ( portletContext , locales , registration ) ; } public Registration getRegistrationOrFailIfInvalid ( RegistrationContext registrationContext ) throws InvalidRegistration , OperationFailed , ModifyRegistrationRequired { Registration registration = registrationHandler . getRegistrationFrom ( registrationContext ) ; registrationHandler . isRegistrationValid ( registration , true ) ; return registration ; } public void reset ( ) { serviceDescriptionHandler . reset ( ) ; } private Boolean remotableByDefault ; public Boolean isRemotableByDefault ( ) { return remotableByDefault ; } public void setRemotableByDefault ( Boolean remotableByDefault ) { this . remotableByDefault = remotableByDefault ; } private boolean isRemotable ( Portlet portlet ) { Map < String , RuntimeOptionInfo > runtimeOptions = portlet . getInfo ( ) . getRuntimeOptionsInfo ( ) ; return serviceDescriptionHandler . isRemotable ( runtimeOptions ) ; } public List < String > getSupportedLocales ( ) { if ( producerContext != null ) { return WSRPUtils . convertLocalesToRFC3066LanguageTags ( producerContext . getSupportedLocales ( ) ) ; } else { return WSRPConstants . getDefaultLocales ( ) ; } } public void usingStrictModeChangedTo ( boolean strictMode ) { WSRPValidator . setStrict ( strictMode ) ; } MarkupInterface getMarkupInterface ( ) { return markupHandler ; } ServiceDescriptionInterface getServiceDescriptionInterface ( ) { return serviceDescriptionHandler ; } RegistrationInterface getRegistrationInterface ( ) { return registrationHandler ; } PortletManagementInterface getPortletManagementInterface ( ) { return portletManagementHandler ; } public void onEvent ( ManagedObjectRegistryEvent event ) { serviceDescriptionHandler . onEvent ( event ) ; } } </s>
<s> package org . gatein . wsrp . producer ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetRegistrationLifetime ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistration ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . RegistrationContext ; import org . oasis . wsrp . v2 . RegistrationData ; import org . oasis . wsrp . v2 . RegistrationState ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . SetRegistrationLifetime ; import java . util . List ; public interface RegistrationInterface { RegistrationContext register ( RegistrationData register ) throws MissingParameters , OperationFailed , OperationNotSupported ; List < Extension > deregister ( RegistrationContext deregister ) throws InvalidRegistration , OperationFailed , OperationNotSupported , ResourceSuspended ; RegistrationState modifyRegistration ( ModifyRegistration modifyRegistration ) throws InvalidRegistration , MissingParameters , OperationFailed , OperationNotSupported , ResourceSuspended ; public Lifetime getRegistrationLifetime ( GetRegistrationLifetime getRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public Lifetime setRegistrationLifetime ( SetRegistrationLifetime setRegistrationLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; } </s>
<s> package org . gatein . wsrp . producer ; import org . gatein . registration . RegistrationUtils ; import org . gatein . wsrp . WSRPPortletURL ; import org . gatein . wsrp . WSRPUtils ; public class WSRPValidator { private static boolean strict = true ; public static void setStrict ( boolean strictMode ) { strict = strictMode ; RegistrationUtils . setStrict ( strict ) ; WSRPUtils . setStrict ( strict ) ; WSRPPortletURL . setStrict ( strict ) ; } public static boolean isStrict ( ) { return strict ; } } </s>
<s> package org . gatein . wsrp . producer ; import org . oasis . wsrp . v2 . AccessDenied ; import org . oasis . wsrp . v2 . ClonePortlet ; import org . oasis . wsrp . v2 . CopyPortlets ; import org . oasis . wsrp . v2 . CopyPortletsResponse ; import org . oasis . wsrp . v2 . DestroyPortlets ; import org . oasis . wsrp . v2 . DestroyPortletsResponse ; import org . oasis . wsrp . v2 . ExportByValueNotSupported ; import org . oasis . wsrp . v2 . ExportNoLongerValid ; import org . oasis . wsrp . v2 . ExportPortlets ; import org . oasis . wsrp . v2 . ExportPortletsResponse ; import org . oasis . wsrp . v2 . Extension ; import org . oasis . wsrp . v2 . GetPortletDescription ; import org . oasis . wsrp . v2 . GetPortletProperties ; import org . oasis . wsrp . v2 . GetPortletPropertyDescription ; import org . oasis . wsrp . v2 . GetPortletsLifetime ; import org . oasis . wsrp . v2 . GetPortletsLifetimeResponse ; import org . oasis . wsrp . v2 . ImportPortlets ; import org . oasis . wsrp . v2 . ImportPortletsResponse ; import org . oasis . wsrp . v2 . InconsistentParameters ; import org . oasis . wsrp . v2 . InvalidHandle ; import org . oasis . wsrp . v2 . InvalidRegistration ; import org . oasis . wsrp . v2 . InvalidUserCategory ; import org . oasis . wsrp . v2 . Lifetime ; import org . oasis . wsrp . v2 . MissingParameters ; import org . oasis . wsrp . v2 . ModifyRegistrationRequired ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . OperationNotSupported ; import org . oasis . wsrp . v2 . PortletContext ; import org . oasis . wsrp . v2 . PortletDescriptionResponse ; import org . oasis . wsrp . v2 . PortletPropertyDescriptionResponse ; import org . oasis . wsrp . v2 . PropertyList ; import org . oasis . wsrp . v2 . ReleaseExport ; import org . oasis . wsrp . v2 . ResourceSuspended ; import org . oasis . wsrp . v2 . ReturnAny ; import org . oasis . wsrp . v2 . SetExportLifetime ; import org . oasis . wsrp . v2 . SetPortletProperties ; import org . oasis . wsrp . v2 . SetPortletsLifetime ; import org . oasis . wsrp . v2 . SetPortletsLifetimeResponse ; import java . util . List ; public interface PortletManagementInterface { public PortletDescriptionResponse getPortletDescription ( GetPortletDescription getPortletDescription ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public PortletContext clonePortlet ( ClonePortlet clonePortlet ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public DestroyPortletsResponse destroyPortlets ( DestroyPortlets destroyPortlets ) throws InconsistentParameters , InvalidRegistration , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public GetPortletsLifetimeResponse getPortletsLifetime ( GetPortletsLifetime getPortletsLifetime ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public SetPortletsLifetimeResponse setPortletsLifetime ( SetPortletsLifetime setPortletsLifetime ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public CopyPortletsResponse copyPortlets ( CopyPortlets copyPortlets ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public ExportPortletsResponse exportPortlets ( ExportPortlets exportPortlets ) throws AccessDenied , ExportByValueNotSupported , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public ImportPortletsResponse importPortlets ( ImportPortlets importPortlets ) throws AccessDenied , ExportNoLongerValid , InconsistentParameters , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public List < Extension > releaseExport ( ReleaseExport releaseExport ) ; public Lifetime setExportLifetime ( SetExportLifetime setExportLifetime ) throws AccessDenied , InvalidHandle , InvalidRegistration , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public PortletContext setPortletProperties ( SetPortletProperties setPortletProperties ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public PropertyList getPortletProperties ( GetPortletProperties getPortletProperties ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; public PortletPropertyDescriptionResponse getPortletPropertyDescription ( GetPortletPropertyDescription getPortletPropertyDescription ) throws AccessDenied , InconsistentParameters , InvalidHandle , InvalidRegistration , InvalidUserCategory , MissingParameters , ModifyRegistrationRequired , OperationFailed , OperationNotSupported , ResourceSuspended ; } </s>
<s> package org . gatein . wsrp . producer ; import org . gatein . common . util . ParameterValidation ; import org . gatein . wsrp . WSRPConstants ; import org . gatein . wsrp . WSRPTypeFactory ; import org . gatein . wsrp . WSRPUtils ; import org . gatein . wsrp . registration . LocalizedString ; import org . gatein . wsrp . registration . RegistrationPropertyDescription ; import org . gatein . wsrp . spec . v2 . WSRP2ExceptionFactory ; import org . oasis . wsrp . v2 . ModelDescription ; import org . oasis . wsrp . v2 . OperationFailed ; import org . oasis . wsrp . v2 . PropertyDescription ; import javax . xml . namespace . QName ; import java . util . ArrayList ; import java . util . Collections ; import java . util . List ; import java . util . Locale ; import java . util . Map ; public class Utils { public static ModelDescription convertRegistrationPropertiesToModelDescription ( Map < QName , RegistrationPropertyDescription > registrationInfo ) { ParameterValidation . throwIllegalArgExceptionIfNull ( registrationInfo , "<STR_LIT>" ) ; if ( registrationInfo . isEmpty ( ) ) { return WSRPTypeFactory . createModelDescription ( null ) ; } List < PropertyDescription > propertyDescriptions = new ArrayList < PropertyDescription > ( registrationInfo . size ( ) ) ; for ( RegistrationPropertyDescription property : registrationInfo . values ( ) ) { propertyDescriptions . add ( convertToPropertyDescription ( property ) ) ; } return WSRPTypeFactory . createModelDescription ( propertyDescriptions ) ; } public static PropertyDescription convertToPropertyDescription ( RegistrationPropertyDescription propertyDescription ) { ParameterValidation . throwIllegalArgExceptionIfNull ( propertyDescription , "<STR_LIT>" ) ; PropertyDescription propDesc = WSRPTypeFactory . createPropertyDescription ( propertyDescription . getName ( ) . toString ( ) , propertyDescription . getType ( ) ) ; LocalizedString hint = propertyDescription . getHint ( ) ; if ( hint != null ) { propDesc . setHint ( convertToWSRPLocalizedString ( hint ) ) ; } LocalizedString label = propertyDescription . getLabel ( ) ; if ( label != null ) { propDesc . setLabel ( convertToWSRPLocalizedString ( label ) ) ; } return propDesc ; } public static RegistrationPropertyDescription convertToRegistrationPropertyDescription ( PropertyDescription propertyDescription ) { ParameterValidation . throwIllegalArgExceptionIfNull ( propertyDescription , "<STR_LIT>" ) ; RegistrationPropertyDescription desc = new RegistrationPropertyDescription ( propertyDescription . getName ( ) , propertyDescription . getType ( ) ) ; desc . setLabel ( getLocalizedStringOrNull ( propertyDescription . getLabel ( ) ) ) ; desc . setHint ( getLocalizedStringOrNull ( propertyDescription . getHint ( ) ) ) ; return desc ; } private static LocalizedString getLocalizedStringOrNull ( org . oasis . wsrp . v2 . LocalizedString wsrpLocalizedString ) { if ( wsrpLocalizedString == null ) { return null ; } else { return convertToLocalizedString ( wsrpLocalizedString ) ; } } public static LocalizedString convertToLocalizedString ( org . oasis . wsrp . v2 . LocalizedString wsrpLocalizedString ) { ParameterValidation . throwIllegalArgExceptionIfNull ( wsrpLocalizedString , "<STR_LIT>" ) ; String lang = wsrpLocalizedString . getLang ( ) ; Locale locale ; if ( lang == null ) { locale = Locale . getDefault ( ) ; } else { locale = WSRPUtils . getLocale ( lang ) ; } LocalizedString localizedString = new LocalizedString ( wsrpLocalizedString . getValue ( ) , locale ) ; localizedString . setResourceName ( wsrpLocalizedString . getResourceName ( ) ) ; return localizedString ; } public static org . oasis . wsrp . v2 . LocalizedString convertToWSRPLocalizedString ( LocalizedString regLocalizedString ) { ParameterValidation . throwIllegalArgExceptionIfNull ( regLocalizedString , "<STR_LIT>" ) ; return WSRPTypeFactory . createLocalizedString ( WSRPUtils . toString ( regLocalizedString . getLocale ( ) ) , regLocalizedString . getResourceName ( ) , regLocalizedString . getValue ( ) ) ; } public static org . oasis . wsrp . v2 . LocalizedString convertToWSRPLocalizedString ( org . gatein . common . i18n . LocalizedString localizedString , List < String > desiredLocales ) { org . gatein . common . i18n . LocalizedString . Value match = getPreferredOrBestMatchFor ( localizedString , desiredLocales ) ; if ( match != null ) { Locale locale = match . getLocale ( ) ; String value = match . getString ( ) ; String language = WSRPUtils . toString ( locale ) ; return WSRPTypeFactory . createLocalizedString ( language , null , value ) ; } else { return null ; } } public static org . oasis . wsrp . v2 . LocalizedString convertToWSRPLocalizedString ( org . gatein . common . i18n . LocalizedString localizedString , Locale locale ) { if ( localizedString == null ) { return null ; } if ( locale == null ) { locale = Locale . getDefault ( ) ; } String value = localizedString . getString ( locale , true ) ; if ( value != null ) { return WSRPTypeFactory . createLocalizedString ( WSRPUtils . toString ( locale ) , null , value ) ; } else { return null ; } } public static Locale getPreferredOrBestLocaleFor ( org . gatein . common . i18n . LocalizedString localizedString , List < String > desiredLocales ) { org . gatein . common . i18n . LocalizedString . Value match = getPreferredOrBestMatchFor ( localizedString , desiredLocales ) ; if ( match != null ) { return match . getLocale ( ) ; } else { return null ; } } private static org . gatein . common . i18n . LocalizedString . Value getPreferredOrBestMatchFor ( org . gatein . common . i18n . LocalizedString localizedString , List < String > desiredLocales ) { if ( localizedString == null ) { return null ; } if ( desiredLocales == null || desiredLocales . isEmpty ( ) ) { desiredLocales = Collections . singletonList ( WSRPConstants . DEFAULT_LOCALE ) ; } return localizedString . getPreferredOrBestLocalizedMappingFor ( desiredLocales . toArray ( new String [ desiredLocales . size ( ) ] ) ) ; } public static void throwOperationFaultOnSessionOperation ( ) throws OperationFailed { throw WSRP2ExceptionFactory . throwWSException ( OperationFailed . class , "<STR_LIT>" , null ) ; } } </s>
<s> package org . gatein . exports ; import java . io . IOException ; import java . io . UnsupportedEncodingException ; import org . gatein . exports . data . ExportContext ; import org . gatein . exports . data . ExportPortletData ; public interface ExportPersistenceManager { boolean supports ( String type , double version ) ; String getExportReferenceId ( String type , double version , byte [ ] bytes ) throws UnsupportedEncodingException ; String storeExportContext ( ExportContext exportContext ) ; ExportContext getExportContext ( String refId ) ; ExportContext updateExportContext ( String refId , ExportContext updatedExportContext ) ; boolean removeExportContext ( String refId ) ; byte [ ] encodeExportContext ( String refId ) throws IOException ; String storeExportPortletData ( ExportContext exportContext , ExportPortletData exportPortletData ) ; ExportPortletData getExportPortletData ( String exportContextId , String portletDataId ) ; ExportPortletData updateExportPortletData ( String exportContextId , String exportPortletId , ExportPortletData updatedPortletData ) ; boolean removeExportPortletData ( String exportContextId , String portletDataId ) ; byte [ ] encodeExportPortletData ( String exportDataRefId ) throws IOException ; } </s>
<s> package org . gatein . exports ; import org . gatein . exports . data . ExportContext ; import org . gatein . exports . data . ExportPortletData ; import java . io . IOException ; import java . io . UnsupportedEncodingException ; public interface ExportManager { void setPersistenceManager ( ExportPersistenceManager exportPersistenceManager ) ; ExportPersistenceManager getPersistenceManager ( ) ; boolean supportsExportByValue ( ) ; ExportContext createExportContext ( boolean exportByValueRequired , long currentTime , long terminationTime , long refreshDuration ) throws UnsupportedEncodingException ; ExportContext createExportContext ( byte [ ] bytes ) throws OperationFailedException ; ExportPortletData createExportPortletData ( ExportContext exportContextData , String portletHandle , byte [ ] portletState ) throws UnsupportedEncodingException ; ExportPortletData createExportPortletData ( ExportContext exportContext , long currentime , long terminationTime , long refreshDuration , byte [ ] bytes ) throws OperationFailedException ; byte [ ] encodeExportPortletData ( ExportContext exportContextData , ExportPortletData exportPortletData ) throws UnsupportedEncodingException , IOException ; byte [ ] encodeExportContextData ( ExportContext exportContextData ) throws UnsupportedEncodingException , IOException ; ExportContext setExportLifetime ( byte [ ] exportContextBytes , long currentTime , long terminationTime , long refreshDuration ) throws OperationFailedException , OperationNotSupportedException ; void releaseExport ( byte [ ] bytes ) throws IOException ; } </s>
<s> package org . gatein . exports ; public class ExportException extends Exception { public ExportException ( ) { } public ExportException ( String message ) { super ( message ) ; } public ExportException ( String message , Throwable cause ) { super ( message , cause ) ; } public ExportException ( Throwable cause ) { super ( cause ) ; } } </s>
<s> package org . gatein . exports . data ; import java . io . UnsupportedEncodingException ; import java . util . ArrayList ; import java . util . List ; public class ExportContext extends ExportData { protected static final String ENCODING = "<STR_LIT:UTF-8>" ; public static final String TYPE = "<STR_LIT>" ; public static final double VERSION = <NUM_LIT:1.0> ; protected long currentTime ; protected long terminationTime ; protected long refreshDuration ; protected final boolean exportByValue ; protected List < String > portlets ; public ExportContext ( ) { this . exportByValue = true ; } public ExportContext ( boolean exportByValue , long currentTime , long terminationTime , long refreshDuration ) { if ( exportByValue ) { this . currentTime = currentTime ; this . terminationTime = terminationTime ; this . refreshDuration = refreshDuration ; } else { } this . exportByValue = exportByValue ; } public ExportContext ( String refId , long currentTime , long terminationTime , long refreshDuration ) { this . currentTime = currentTime ; this . terminationTime = terminationTime ; this . refreshDuration = refreshDuration ; this . exportByValue = false ; } public boolean isExportByValue ( ) { return this . exportByValue ; } public long getCurrentTime ( ) { return currentTime ; } public void setCurrentTime ( long currentTime ) { this . currentTime = currentTime ; } public long getTermintationTime ( ) { return terminationTime ; } public void setTerminationTime ( long terminationTime ) { this . terminationTime = terminationTime ; } public long getRefreshDuration ( ) { return refreshDuration ; } public void setRefreshDuration ( long refreshDuration ) { this . refreshDuration = refreshDuration ; } public void addPortlet ( String portletName ) { if ( portlets == null ) { this . portlets = new ArrayList < String > ( ) ; } this . portlets . add ( portletName ) ; } public List < String > getPortlets ( ) { return portlets ; } public static ExportContext create ( byte [ ] bytes ) { ExportContext exportContext = new ExportContext ( ) ; return exportContext ; } public String getType ( ) { return TYPE ; } public double getVersion ( ) { return VERSION ; } protected byte [ ] internalEncodeAsBytes ( ) throws UnsupportedEncodingException { return "<STR_LIT>" . getBytes ( ENCODING ) ; } } </s>
<s> package org . gatein . exports . data ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . ObjectInputStream ; import java . io . ObjectOutputStream ; public class ExportPortletData extends ExportData { protected static final String ENCODING = "<STR_LIT:UTF-8>" ; public static final String TYPE = "<STR_LIT>" ; public static final double VERSION = <NUM_LIT:1.0> ; protected static final String PORTLETHANDLEKEY = "<STR_LIT>" ; protected static final String PORTLETSTATEKEY = "<STR_LIT>" ; protected String portletHandle ; protected byte [ ] portletState ; public ExportPortletData ( String portletHandle , byte [ ] portletState ) { this . portletHandle = portletHandle ; this . portletState = portletState ; } public String getPortletHandle ( ) { return this . portletHandle ; } public byte [ ] getPortletState ( ) { return this . portletState ; } public String getType ( ) { return TYPE ; } public double getVersion ( ) { return VERSION ; } public static ExportPortletData create ( byte [ ] bytes ) throws IOException { ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; ObjectInputStream ois = new ObjectInputStream ( bais ) ; String portletHandle ; byte [ ] portletState ; portletHandle = ois . readUTF ( ) ; if ( ois . available ( ) > <NUM_LIT:0> ) { portletState = new byte [ ois . available ( ) ] ; ois . readFully ( portletState ) ; } else { portletState = null ; } ois . close ( ) ; return new ExportPortletData ( portletHandle , portletState ) ; } protected byte [ ] internalEncodeAsBytes ( ) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( baos ) ; oos . writeUTF ( portletHandle ) ; if ( portletState != null ) { oos . write ( portletState ) ; } oos . close ( ) ; return baos . toByteArray ( ) ; } } </s>
<s> package org . gatein . exports . data ; import java . io . UnsupportedEncodingException ; import java . util . Map ; import org . gatein . pc . api . ParametersStateString ; import org . gatein . pc . api . StateString ; public class PersistedExportData extends ExportData { protected final String type ; protected final String refID ; protected static final String REFIDKEY = "<STR_LIT>" ; protected static final String TYPEKEY = "<STR_LIT:type>" ; protected double version = <NUM_LIT:1.0> ; public PersistedExportData ( String type , String refID ) { this . type = type ; this . refID = refID ; } public String getType ( ) { return type ; } public double getVersion ( ) { return version ; } public String getRefId ( ) { return refID ; } public void setVersion ( double version ) { this . version = version ; } protected byte [ ] internalEncodeAsBytes ( ) throws UnsupportedEncodingException { ParametersStateString parameterStateString = ParametersStateString . create ( ) ; parameterStateString . setValue ( REFIDKEY , refID ) ; parameterStateString . setValue ( TYPEKEY , type ) ; String stateString = parameterStateString . getStringValue ( ) ; return stateString . getBytes ( ENCODING ) ; } public static PersistedExportData create ( byte [ ] bytes ) throws UnsupportedEncodingException { Map < String , String [ ] > map = StateString . decodeOpaqueValue ( new String ( bytes , ENCODING ) ) ; String refId = null ; String type = null ; if ( map . containsKey ( REFIDKEY ) && map . get ( REFIDKEY ) . length > <NUM_LIT:0> ) { refId = map . get ( REFIDKEY ) [ <NUM_LIT:0> ] ; } if ( map . containsKey ( TYPEKEY ) && map . get ( TYPEKEY ) . length > <NUM_LIT:0> ) { type = map . get ( TYPEKEY ) [ <NUM_LIT:0> ] ; } return new PersistedExportData ( type , refId ) ; } } </s>
<s> package org . gatein . exports . data ; import java . io . ByteArrayInputStream ; import java . io . ByteArrayOutputStream ; import java . io . IOException ; import java . io . ObjectInputStream ; import java . io . ObjectOutputStream ; import java . io . UnsupportedEncodingException ; public abstract class ExportData { public abstract double getVersion ( ) ; public abstract String getType ( ) ; protected abstract byte [ ] internalEncodeAsBytes ( ) throws UnsupportedEncodingException , IOException ; protected static final String ENCODING = "<STR_LIT:UTF-8>" ; protected static final String SEPARATOR = "<STR_LIT>" ; public byte [ ] encodeAsBytes ( ) throws IOException { byte [ ] internalBytes = internalEncodeAsBytes ( ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ObjectOutputStream oos = new ObjectOutputStream ( baos ) ; oos . writeUTF ( this . getType ( ) ) ; oos . writeDouble ( this . getVersion ( ) ) ; if ( internalBytes != null ) { oos . write ( internalBytes ) ; } oos . close ( ) ; return baos . toByteArray ( ) ; } public static double getVersion ( byte [ ] bytes ) throws IOException { if ( bytes != null && bytes . length > <NUM_LIT:0> ) { ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; ObjectInputStream ois = new ObjectInputStream ( bais ) ; String type = ois . readUTF ( ) ; Double version = ois . readDouble ( ) ; return version . doubleValue ( ) ; } else { return - <NUM_LIT:1> ; } } public static String getType ( byte [ ] bytes ) throws IOException { if ( bytes != null && bytes . length > <NUM_LIT:0> ) { ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; ObjectInputStream ois = new ObjectInputStream ( bais ) ; return ois . readUTF ( ) ; } else { return null ; } } public static byte [ ] getInternalBytes ( byte [ ] bytes ) throws IOException { if ( bytes != null && bytes . length > <NUM_LIT:0> ) { ByteArrayInputStream bais = new ByteArrayInputStream ( bytes ) ; ObjectInputStream ois = new ObjectInputStream ( bais ) ; String type = ois . readUTF ( ) ; Double version = ois . readDouble ( ) ; byte [ ] internalBytes = null ; if ( ois . available ( ) > <NUM_LIT:0> ) { internalBytes = new byte [ ois . available ( ) ] ; ois . readFully ( internalBytes ) ; } return internalBytes ; } else { return null ; } } } </s>
<s> package org . gatein . exports . impl ; import org . gatein . exports . ExportManager ; import org . gatein . exports . ExportPersistenceManager ; import org . gatein . exports . OperationFailedException ; import org . gatein . exports . OperationNotSupportedException ; import org . gatein . exports . data . ExportContext ; import org . gatein . exports . data . ExportData ; import org . gatein . exports . data . ExportPortletData ; import org . gatein . wsrp . WSRPExceptionFactory ; import java . io . IOException ; import java . io . UnsupportedEncodingException ; public class ExportManagerImpl implements ExportManager { protected ExportPersistenceManager exportPersistenceManager ; protected boolean preferExportByValue = false ; protected boolean supportExportByValue = true ; public ExportPersistenceManager getPersistenceManager ( ) { return exportPersistenceManager ; } public void setPersistenceManager ( ExportPersistenceManager exportPersistenceManager ) { this . exportPersistenceManager = exportPersistenceManager ; } public ExportContext createExportContext ( boolean exportByValueRequired , long currentTime , long terminationTime , long refreshDuration ) throws UnsupportedEncodingException { boolean useExportByValue = false ; if ( exportByValueRequired || ( exportPersistenceManager == null && preferExportByValue ) ) { useExportByValue = true ; } return new ExportContext ( useExportByValue , currentTime , terminationTime , refreshDuration ) ; } public boolean supportsExportByValue ( ) { return supportExportByValue ; } public void setPreferExportByValue ( boolean preferExportByValue ) { this . preferExportByValue = preferExportByValue ; } public ExportContext createExportContext ( byte [ ] bytes ) throws OperationFailedException { try { String type = ExportData . getType ( bytes ) ; double version = ExportData . getVersion ( bytes ) ; if ( ExportContext . TYPE . equals ( type ) && ExportContext . VERSION == version ) { byte [ ] internalBytes = ExportData . getInternalBytes ( bytes ) ; return ExportContext . create ( internalBytes ) ; } else if ( exportPersistenceManager != null && exportPersistenceManager . supports ( type , version ) ) { String refId = exportPersistenceManager . getExportReferenceId ( type , version , ExportData . getInternalBytes ( bytes ) ) ; return exportPersistenceManager . getExportContext ( refId ) ; } else { throw new OperationFailedException ( "<STR_LIT>" ) ; } } catch ( UnsupportedEncodingException e ) { throw new OperationFailedException ( "<STR_LIT>" ) ; } catch ( IOException e ) { throw new OperationFailedException ( "<STR_LIT>" ) ; } } public ExportPortletData createExportPortletData ( ExportContext exportContextData , String portletHandle , byte [ ] portletState ) throws UnsupportedEncodingException { return new ExportPortletData ( portletHandle , portletState ) ; } public ExportPortletData createExportPortletData ( ExportContext exportContextData , long currentTime , long terminationTime , long refreshDuration , byte [ ] bytes ) throws OperationFailedException { try { String type = ExportData . getType ( bytes ) ; double version = ExportData . getVersion ( bytes ) ; if ( ExportPortletData . TYPE . equals ( type ) && ExportPortletData . VERSION == version ) { byte [ ] internalBytes = ExportData . getInternalBytes ( bytes ) ; return ExportPortletData . create ( internalBytes ) ; } else { throw new OperationFailedException ( "<STR_LIT>" ) ; } } catch ( UnsupportedEncodingException e ) { throw new OperationFailedException ( "<STR_LIT>" ) ; } catch ( IOException e ) { throw new OperationFailedException ( "<STR_LIT>" ) ; } } public byte [ ] encodeExportPortletData ( ExportContext exportContextData , ExportPortletData exportPortletData ) throws IOException { if ( exportContextData . isExportByValue ( ) ) { return exportPortletData . encodeAsBytes ( ) ; } else { String refId = exportPersistenceManager . storeExportPortletData ( exportContextData , exportPortletData ) ; return exportPersistenceManager . encodeExportPortletData ( refId ) ; } } public byte [ ] encodeExportContextData ( ExportContext exportContext ) throws IOException { if ( exportContext . isExportByValue ( ) ) { return exportContext . encodeAsBytes ( ) ; } else { String refId = exportPersistenceManager . storeExportContext ( exportContext ) ; return exportPersistenceManager . encodeExportContext ( refId ) ; } } public ExportContext setExportLifetime ( byte [ ] exportContextBytes , long currentTime , long terminationTime , long refreshDuration ) throws OperationNotSupportedException , OperationFailedException { if ( getPersistenceManager ( ) == null ) { throw new OperationNotSupportedException ( "<STR_LIT>" ) ; } try { String type = ExportData . getType ( exportContextBytes ) ; double version = ExportData . getVersion ( exportContextBytes ) ; if ( getPersistenceManager ( ) . supports ( type , version ) ) { String refId = getPersistenceManager ( ) . getExportReferenceId ( type , version , ExportData . getInternalBytes ( exportContextBytes ) ) ; ExportContext exportContext = getPersistenceManager ( ) . getExportContext ( refId ) ; if ( exportContext . isExportByValue ( ) ) { throw new OperationFailedException ( "<STR_LIT>" ) ; } exportContext . setCurrentTime ( currentTime ) ; exportContext . setTerminationTime ( terminationTime ) ; exportContext . setRefreshDuration ( refreshDuration ) ; ExportContext updatedExportContext = getPersistenceManager ( ) . updateExportContext ( refId , exportContext ) ; return updatedExportContext ; } else { throw new OperationFailedException ( "<STR_LIT>" ) ; } } catch ( IOException e ) { throw new OperationFailedException ( "<STR_LIT>" ) ; } } public void releaseExport ( byte [ ] bytes ) throws IOException { if ( bytes != null && bytes . length > <NUM_LIT:0> && exportPersistenceManager != null ) { String type = ExportData . getType ( bytes ) ; double version = ExportData . getVersion ( bytes ) ; if ( exportPersistenceManager . supports ( type , version ) ) { String refId = exportPersistenceManager . getExportReferenceId ( type , version , ExportData . getInternalBytes ( bytes ) ) ; exportPersistenceManager . removeExportContext ( refId ) ; } } } } </s>
<s> package org . gatein . exports ; public class OperationNotSupportedException extends ExportException { public OperationNotSupportedException ( String message ) { super ( message ) ; } } </s>
<s> package org . gatein . exports ; public class OperationFailedException extends ExportException { public OperationFailedException ( String message ) { super ( message ) ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1InvalidUserCategory extends Exception { private V1InvalidUserCategoryFault faultInfo ; public V1InvalidUserCategory ( String message , V1InvalidUserCategoryFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1InvalidUserCategory ( String message , V1InvalidUserCategoryFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1InvalidUserCategoryFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1ServiceDescription { protected boolean requiresRegistration ; protected List < V1PortletDescription > offeredPortlets ; protected List < V1ItemDescription > userCategoryDescriptions ; protected List < V1ItemDescription > customUserProfileItemDescriptions ; protected List < V1ItemDescription > customWindowStateDescriptions ; protected List < V1ItemDescription > customModeDescriptions ; @ XmlElement ( defaultValue = "<STR_LIT:none>" ) protected V1CookieProtocol requiresInitCookie ; protected V1ModelDescription registrationPropertyDescription ; protected List < String > locales ; protected V1ResourceList resourceList ; protected List < V1Extension > extensions ; public boolean isRequiresRegistration ( ) { return requiresRegistration ; } public void setRequiresRegistration ( boolean value ) { this . requiresRegistration = value ; } public List < V1PortletDescription > getOfferedPortlets ( ) { if ( offeredPortlets == null ) { offeredPortlets = new ArrayList < V1PortletDescription > ( ) ; } return this . offeredPortlets ; } public List < V1ItemDescription > getUserCategoryDescriptions ( ) { if ( userCategoryDescriptions == null ) { userCategoryDescriptions = new ArrayList < V1ItemDescription > ( ) ; } return this . userCategoryDescriptions ; } public List < V1ItemDescription > getCustomUserProfileItemDescriptions ( ) { if ( customUserProfileItemDescriptions == null ) { customUserProfileItemDescriptions = new ArrayList < V1ItemDescription > ( ) ; } return this . customUserProfileItemDescriptions ; } public List < V1ItemDescription > getCustomWindowStateDescriptions ( ) { if ( customWindowStateDescriptions == null ) { customWindowStateDescriptions = new ArrayList < V1ItemDescription > ( ) ; } return this . customWindowStateDescriptions ; } public List < V1ItemDescription > getCustomModeDescriptions ( ) { if ( customModeDescriptions == null ) { customModeDescriptions = new ArrayList < V1ItemDescription > ( ) ; } return this . customModeDescriptions ; } public V1CookieProtocol getRequiresInitCookie ( ) { return requiresInitCookie ; } public void setRequiresInitCookie ( V1CookieProtocol value ) { this . requiresInitCookie = value ; } public V1ModelDescription getRegistrationPropertyDescription ( ) { return registrationPropertyDescription ; } public void setRegistrationPropertyDescription ( V1ModelDescription value ) { this . registrationPropertyDescription = value ; } public List < String > getLocales ( ) { if ( locales == null ) { locales = new ArrayList < String > ( ) ; } return this . locales ; } public V1ResourceList getResourceList ( ) { return resourceList ; } public void setResourceList ( V1ResourceList value ) { this . resourceList = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1PortletStateChangeRequired extends Exception { private V1PortletStateChangeRequiredFault faultInfo ; public V1PortletStateChangeRequired ( String message , V1PortletStateChangeRequiredFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1PortletStateChangeRequired ( String message , V1PortletStateChangeRequiredFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1PortletStateChangeRequiredFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1PerformBlockingInteraction { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected V1PortletContext portletContext ; @ XmlElement ( required = true ) protected V1RuntimeContext runtimeContext ; @ XmlElement ( required = true , nillable = true ) protected V1UserContext userContext ; @ XmlElement ( required = true ) protected V1MarkupParams markupParams ; @ XmlElement ( required = true ) protected V1InteractionParams interactionParams ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public V1PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( V1PortletContext value ) { this . portletContext = value ; } public V1RuntimeContext getRuntimeContext ( ) { return runtimeContext ; } public void setRuntimeContext ( V1RuntimeContext value ) { this . runtimeContext = value ; } public V1UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( V1UserContext value ) { this . userContext = value ; } public V1MarkupParams getMarkupParams ( ) { return markupParams ; } public void setMarkupParams ( V1MarkupParams value ) { this . markupParams = value ; } public V1InteractionParams getInteractionParams ( ) { return interactionParams ; } public void setInteractionParams ( V1InteractionParams value ) { this . interactionParams = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1UnsupportedMimeTypeFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1InvalidUserCategoryFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1EmployerInfo { protected String employer ; protected String department ; protected String jobtitle ; protected List < V1Extension > extensions ; public String getEmployer ( ) { return employer ; } public void setEmployer ( String value ) { this . employer = value ; } public String getDepartment ( ) { return department ; } public void setDepartment ( String value ) { this . department = value ; } public String getJobtitle ( ) { return jobtitle ; } public void setJobtitle ( String value ) { this . jobtitle = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1UnsupportedLocale extends Exception { private V1UnsupportedLocaleFault faultInfo ; public V1UnsupportedLocale ( String message , V1UnsupportedLocaleFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1UnsupportedLocale ( String message , V1UnsupportedLocaleFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1UnsupportedLocaleFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) public class V1DestroyPortletsResponse { protected List < V1DestroyFailed > destroyFailed ; protected List < V1Extension > extensions ; public List < V1DestroyFailed > getDestroyFailed ( ) { if ( destroyFailed == null ) { destroyFailed = new ArrayList < V1DestroyFailed > ( ) ; } return this . destroyFailed ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1BlockingInteractionResponse { protected V1UpdateResponse updateResponse ; protected String redirectURL ; protected List < V1Extension > extensions ; public V1UpdateResponse getUpdateResponse ( ) { return updateResponse ; } public void setUpdateResponse ( V1UpdateResponse value ) { this . updateResponse = value ; } public String getRedirectURL ( ) { return redirectURL ; } public void setRedirectURL ( String value ) { this . redirectURL = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1PortletDescriptionResponse { @ XmlElement ( required = true ) protected V1PortletDescription portletDescription ; protected V1ResourceList resourceList ; protected List < V1Extension > extensions ; public V1PortletDescription getPortletDescription ( ) { return portletDescription ; } public void setPortletDescription ( V1PortletDescription value ) { this . portletDescription = value ; } public V1ResourceList getResourceList ( ) { return resourceList ; } public void setResourceList ( V1ResourceList value ) { this . resourceList = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1InvalidRegistrationFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAttribute ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) public class V1Resource { @ XmlElement ( required = true ) protected List < V1ResourceValue > values ; protected List < V1Extension > extensions ; @ XmlAttribute ( required = true ) protected String resourceName ; public List < V1ResourceValue > getValues ( ) { if ( values == null ) { values = new ArrayList < V1ResourceValue > ( ) ; } return this . values ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } public String getResourceName ( ) { return resourceName ; } public void setResourceName ( String value ) { this . resourceName = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1InitCookie { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) public class V1ResourceList { @ XmlElement ( required = true ) protected List < V1Resource > resources ; protected List < V1Extension > extensions ; public List < V1Resource > getResources ( ) { if ( resources == null ) { resources = new ArrayList < V1Resource > ( ) ; } return this . resources ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1Telecom { protected V1TelephoneNum telephone ; protected V1TelephoneNum fax ; protected V1TelephoneNum mobile ; protected V1TelephoneNum pager ; protected List < V1Extension > extensions ; public V1TelephoneNum getTelephone ( ) { return telephone ; } public void setTelephone ( V1TelephoneNum value ) { this . telephone = value ; } public V1TelephoneNum getFax ( ) { return fax ; } public void setFax ( V1TelephoneNum value ) { this . fax = value ; } public V1TelephoneNum getMobile ( ) { return mobile ; } public void setMobile ( V1TelephoneNum value ) { this . mobile = value ; } public V1TelephoneNum getPager ( ) { return pager ; } public void setPager ( V1TelephoneNum value ) { this . pager = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1AccessDeniedFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1Contact { protected V1Postal postal ; protected V1Telecom telecom ; protected V1Online online ; protected List < V1Extension > extensions ; public V1Postal getPostal ( ) { return postal ; } public void setPostal ( V1Postal value ) { this . postal = value ; } public V1Telecom getTelecom ( ) { return telecom ; } public void setTelecom ( V1Telecom value ) { this . telecom = value ; } public V1Online getOnline ( ) { return online ; } public void setOnline ( V1Online value ) { this . online = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1OperationFailedFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1UnsupportedMode extends Exception { private V1UnsupportedModeFault faultInfo ; public V1UnsupportedMode ( String message , V1UnsupportedModeFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1UnsupportedMode ( String message , V1UnsupportedModeFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1UnsupportedModeFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:string>" } ) public class V1StringArray { @ XmlElement ( name = "<STR_LIT:String>" ) protected List < String > string ; public List < String > getString ( ) { if ( string == null ) { string = new ArrayList < String > ( ) ; } return this . string ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1ClonePortlet { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected V1PortletContext portletContext ; @ XmlElement ( required = true , nillable = true ) protected V1UserContext userContext ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public V1PortletContext getPortletContext ( ) { return portletContext ; } public void setPortletContext ( V1PortletContext value ) { this . portletContext = value ; } public V1UserContext getUserContext ( ) { return userContext ; } public void setUserContext ( V1UserContext value ) { this . userContext = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlAttribute ; import javax . xml . bind . annotation . XmlType ; import javax . xml . namespace . QName ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:label>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1PropertyDescription { protected V1LocalizedString label ; protected V1LocalizedString hint ; protected List < V1Extension > extensions ; @ XmlAttribute ( required = true ) protected String name ; @ XmlAttribute ( required = true ) protected QName type ; public V1LocalizedString getLabel ( ) { return label ; } public void setLabel ( V1LocalizedString value ) { this . label = value ; } public V1LocalizedString getHint ( ) { return hint ; } public void setHint ( V1LocalizedString value ) { this . hint = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } public String getName ( ) { return name ; } public void setName ( String value ) { this . name = value ; } public QName getType ( ) { return type ; } public void setType ( QName value ) { this . type = value ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1UnsupportedModeFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1UnsupportedWindowState extends Exception { private V1UnsupportedWindowStateFault faultInfo ; public V1UnsupportedWindowState ( String message , V1UnsupportedWindowStateFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1UnsupportedWindowState ( String message , V1UnsupportedWindowStateFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1UnsupportedWindowStateFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT:description>" , "<STR_LIT>" , "<STR_LIT:title>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1PortletDescription { @ XmlElement ( required = true ) protected String portletHandle ; @ XmlElement ( required = true ) protected List < V1MarkupType > markupTypes ; protected String groupID ; protected V1LocalizedString description ; protected V1LocalizedString shortTitle ; protected V1LocalizedString title ; protected V1LocalizedString displayName ; protected List < V1LocalizedString > keywords ; protected List < String > userCategories ; protected List < String > userProfileItems ; @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean usesMethodGet ; @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean defaultMarkupSecure ; @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean onlySecure ; @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean userContextStoredInSession ; @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean templatesStoredInSession ; @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean hasUserSpecificState ; @ XmlElement ( defaultValue = "<STR_LIT:false>" ) protected Boolean doesUrlTemplateProcessing ; protected List < V1Extension > extensions ; public String getPortletHandle ( ) { return portletHandle ; } public void setPortletHandle ( String value ) { this . portletHandle = value ; } public List < V1MarkupType > getMarkupTypes ( ) { if ( markupTypes == null ) { markupTypes = new ArrayList < V1MarkupType > ( ) ; } return this . markupTypes ; } public String getGroupID ( ) { return groupID ; } public void setGroupID ( String value ) { this . groupID = value ; } public V1LocalizedString getDescription ( ) { return description ; } public void setDescription ( V1LocalizedString value ) { this . description = value ; } public V1LocalizedString getShortTitle ( ) { return shortTitle ; } public void setShortTitle ( V1LocalizedString value ) { this . shortTitle = value ; } public V1LocalizedString getTitle ( ) { return title ; } public void setTitle ( V1LocalizedString value ) { this . title = value ; } public V1LocalizedString getDisplayName ( ) { return displayName ; } public void setDisplayName ( V1LocalizedString value ) { this . displayName = value ; } public List < V1LocalizedString > getKeywords ( ) { if ( keywords == null ) { keywords = new ArrayList < V1LocalizedString > ( ) ; } return this . keywords ; } public List < String > getUserCategories ( ) { if ( userCategories == null ) { userCategories = new ArrayList < String > ( ) ; } return this . userCategories ; } public List < String > getUserProfileItems ( ) { if ( userProfileItems == null ) { userProfileItems = new ArrayList < String > ( ) ; } return this . userProfileItems ; } public Boolean isUsesMethodGet ( ) { return usesMethodGet ; } public void setUsesMethodGet ( Boolean value ) { this . usesMethodGet = value ; } public Boolean isDefaultMarkupSecure ( ) { return defaultMarkupSecure ; } public void setDefaultMarkupSecure ( Boolean value ) { this . defaultMarkupSecure = value ; } public Boolean isOnlySecure ( ) { return onlySecure ; } public void setOnlySecure ( Boolean value ) { this . onlySecure = value ; } public Boolean isUserContextStoredInSession ( ) { return userContextStoredInSession ; } public void setUserContextStoredInSession ( Boolean value ) { this . userContextStoredInSession = value ; } public Boolean isTemplatesStoredInSession ( ) { return templatesStoredInSession ; } public void setTemplatesStoredInSession ( Boolean value ) { this . templatesStoredInSession = value ; } public Boolean isHasUserSpecificState ( ) { return hasUserSpecificState ; } public void setHasUserSpecificState ( Boolean value ) { this . hasUserSpecificState = value ; } public Boolean isDoesUrlTemplateProcessing ( ) { return doesUrlTemplateProcessing ; } public void setDoesUrlTemplateProcessing ( Boolean value ) { this . doesUrlTemplateProcessing = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; import java . io . Serializable ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1Fault implements Serializable { } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1InconsistentParametersFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlRootElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" } ) @ XmlRootElement ( name = "<STR_LIT>" ) public class V1DestroyPortlets { @ XmlElement ( required = true , nillable = true ) protected V1RegistrationContext registrationContext ; @ XmlElement ( required = true ) protected List < String > portletHandles ; public V1RegistrationContext getRegistrationContext ( ) { return registrationContext ; } public void setRegistrationContext ( V1RegistrationContext value ) { this . registrationContext = value ; } public List < String > getPortletHandles ( ) { if ( portletHandles == null ) { portletHandles = new ArrayList < String > ( ) ; } return this . portletHandles ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1InvalidRegistration extends Exception { private V1InvalidRegistrationFault faultInfo ; public V1InvalidRegistration ( String message , V1InvalidRegistrationFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1InvalidRegistration ( String message , V1InvalidRegistrationFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1InvalidRegistrationFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1OperationFailed extends Exception { private V1OperationFailedFault faultInfo ; public V1OperationFailed ( String message , V1OperationFailedFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1OperationFailed ( String message , V1OperationFailedFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1OperationFailedFault getFaultInfo ( ) { return faultInfo ; } } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" ) public class V1InvalidSessionFault extends V1Fault { } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1UserContext { @ XmlElement ( required = true ) protected String userContextKey ; protected List < String > userCategories ; protected V1UserProfile profile ; protected List < V1Extension > extensions ; public String getUserContextKey ( ) { return userContextKey ; } public void setUserContextKey ( String value ) { this . userContextKey = value ; } public List < String > getUserCategories ( ) { if ( userCategories == null ) { userCategories = new ArrayList < String > ( ) ; } return this . userCategories ; } public V1UserProfile getProfile ( ) { return profile ; } public void setProfile ( V1UserProfile value ) { this . profile = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlSchemaType ; import javax . xml . bind . annotation . XmlType ; import javax . xml . datatype . XMLGregorianCalendar ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT:name>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1UserProfile { protected V1PersonName name ; @ XmlSchemaType ( name = "<STR_LIT>" ) protected XMLGregorianCalendar bdate ; protected String gender ; protected V1EmployerInfo employerInfo ; protected V1Contact homeInfo ; protected V1Contact businessInfo ; protected List < V1Extension > extensions ; public V1PersonName getName ( ) { return name ; } public void setName ( V1PersonName value ) { this . name = value ; } public XMLGregorianCalendar getBdate ( ) { return bdate ; } public void setBdate ( XMLGregorianCalendar value ) { this . bdate = value ; } public String getGender ( ) { return gender ; } public void setGender ( String value ) { this . gender = value ; } public V1EmployerInfo getEmployerInfo ( ) { return employerInfo ; } public void setEmployerInfo ( V1EmployerInfo value ) { this . employerInfo = value ; } public V1Contact getHomeInfo ( ) { return homeInfo ; } public void setHomeInfo ( V1Contact value ) { this . homeInfo = value ; } public V1Contact getBusinessInfo ( ) { return businessInfo ; } public void setBusinessInfo ( V1Contact value ) { this . businessInfo = value ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . ArrayList ; import java . util . List ; import javax . xml . bind . annotation . XmlAccessType ; import javax . xml . bind . annotation . XmlAccessorType ; import javax . xml . bind . annotation . XmlElement ; import javax . xml . bind . annotation . XmlType ; @ XmlAccessorType ( XmlAccessType . FIELD ) @ XmlType ( name = "<STR_LIT>" , propOrder = { "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" } ) public class V1UploadContext { @ XmlElement ( required = true ) protected String mimeType ; @ XmlElement ( required = true ) protected byte [ ] uploadData ; protected List < V1NamedString > mimeAttributes ; protected List < V1Extension > extensions ; public String getMimeType ( ) { return mimeType ; } public void setMimeType ( String value ) { this . mimeType = value ; } public byte [ ] getUploadData ( ) { return uploadData ; } public void setUploadData ( byte [ ] value ) { this . uploadData = ( ( byte [ ] ) value ) ; } public List < V1NamedString > getMimeAttributes ( ) { if ( mimeAttributes == null ) { mimeAttributes = new ArrayList < V1NamedString > ( ) ; } return this . mimeAttributes ; } public List < V1Extension > getExtensions ( ) { if ( extensions == null ) { extensions = new ArrayList < V1Extension > ( ) ; } return this . extensions ; } } </s>
<s> package org . oasis . wsrp . v1 ; import java . util . List ; import javax . jws . WebMethod ; import javax . jws . WebParam ; import javax . jws . WebService ; import javax . xml . ws . Holder ; import javax . xml . ws . RequestWrapper ; import javax . xml . ws . ResponseWrapper ; @ WebService ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public interface WSRPV1ServiceDescriptionPortType { @ WebMethod ( action = "<STR_LIT>" ) @ RequestWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) @ ResponseWrapper ( localName = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , className = "<STR_LIT>" ) public void getServiceDescription ( @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) V1RegistrationContext registrationContext , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) List < String > desiredLocales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < Boolean > requiresRegistration , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1PortletDescription > > offeredPortlets , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1ItemDescription > > userCategoryDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1ItemDescription > > customUserProfileItemDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1ItemDescription > > customWindowStateDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1ItemDescription > > customModeDescriptions , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1CookieProtocol > requiresInitCookie , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1ModelDescription > registrationPropertyDescription , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < String > > locales , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < V1ResourceList > resourceList , @ WebParam ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" , mode = WebParam . Mode . OUT ) Holder < List < V1Extension > > extensions ) throws V1InvalidRegistration , V1OperationFailed ; } </s>
<s> package org . oasis . wsrp . v1 ; import javax . xml . ws . WebFault ; @ WebFault ( name = "<STR_LIT>" , targetNamespace = "<STR_LIT>" ) public class V1InconsistentParameters extends Exception { private V1InconsistentParametersFault faultInfo ; public V1InconsistentParameters ( String message , V1InconsistentParametersFault faultInfo ) { super ( message ) ; this . faultInfo = faultInfo ; } public V1InconsistentParameters ( String message , V1InconsistentParametersFault faultInfo , Throwable cause ) { super ( message , cause ) ; this . faultInfo = faultInfo ; } public V1InconsistentParametersFault getFaultInfo ( ) { return faultInfo ; } } </s>