Package org.oasis.wsrp.v2

Examples of org.oasis.wsrp.v2.SessionContext


   }

   private ServiceDescription getUnmanagedServiceDescription(boolean asUnregistered) throws PortletInvokerException, OperationFailed, InvalidRegistration, ModifyRegistrationRequired
   {
      //todo: might need to implement customization of default service description
      ServiceDescription serviceDescription;
      try
      {
         Holder<Boolean> requiresRegistration = new Holder<Boolean>();
         Holder<List<PortletDescription>> offeredPortlets = new Holder<List<PortletDescription>>();
         Holder<List<ItemDescription>> userCategoryDescriptions = new Holder<List<ItemDescription>>();
         Holder<List<ItemDescription>> windowStateDescriptions = new Holder<List<ItemDescription>>();
         Holder<List<ItemDescription>> modeDescriptions = new Holder<List<ItemDescription>>();
         Holder<CookieProtocol> requiresInitCookie = new Holder<CookieProtocol>();
         Holder<ModelDescription> registrationPropertyDescription = new Holder<ModelDescription>();
         Holder<List<String>> locales = new Holder<List<String>>();
         Holder<ResourceList> resourceList = new Holder<ResourceList>();
         Holder<List<EventDescription>> eventDescriptions = new Holder<List<EventDescription>>();
         Holder<ModelTypes> schemaTypes = new Holder<ModelTypes>();
         Holder<List<String>> supportedOptions = new Holder<List<String>>();
         Holder<ExportDescription> exportDescription = new Holder<ExportDescription>();
         Holder<Boolean> mayReturnRegistrationState = new Holder<Boolean>();
         final Holder<List<ExtensionDescription>> extensionDescriptions = new Holder<List<ExtensionDescription>>();
         final Holder<List<Extension>> extensions = new Holder<List<Extension>>();

         // invocation
         persistentEndpointInfo.getServiceDescriptionService().getServiceDescription(
            asUnregistered ? null : getRegistrationContext(),
            WSRPConstants.getDefaultLocales(), // todo: deal with locales better
            null, // todo: provide a way to only request info on some portlets?
            UserAccess.getUserContext(),
            requiresRegistration,
            offeredPortlets,
            userCategoryDescriptions,
            extensionDescriptions,
            windowStateDescriptions,
            modeDescriptions,
            requiresInitCookie,
            registrationPropertyDescription,
            locales,
            resourceList,
            eventDescriptions,
            schemaTypes,
            supportedOptions,
            exportDescription,
            mayReturnRegistrationState,
            extensions);

         // TODO: fix-me
         serviceDescription = WSRPTypeFactory.createServiceDescription(requiresRegistration.value);
         serviceDescription.setRegistrationPropertyDescription(registrationPropertyDescription.value);
         serviceDescription.setRequiresInitCookie(requiresInitCookie.value);
         serviceDescription.setResourceList(resourceList.value);
         serviceDescription.setSchemaType(schemaTypes.value);
         serviceDescription.setExportDescription(exportDescription.value);
         serviceDescription.setMayReturnRegistrationState(mayReturnRegistrationState.value);

         if (ParameterValidation.existsAndIsNotEmpty(modeDescriptions.value))
         {
            serviceDescription.getCustomModeDescriptions().addAll(modeDescriptions.value);
         }
         if (ParameterValidation.existsAndIsNotEmpty(windowStateDescriptions.value))
         {
            serviceDescription.getCustomWindowStateDescriptions().addAll(windowStateDescriptions.value);
         }
         if (ParameterValidation.existsAndIsNotEmpty(locales.value))
         {
            serviceDescription.getLocales().addAll(locales.value);
         }
         if (ParameterValidation.existsAndIsNotEmpty(offeredPortlets.value))
         {
            serviceDescription.getOfferedPortlets().addAll(offeredPortlets.value);
         }
         if (ParameterValidation.existsAndIsNotEmpty(userCategoryDescriptions.value))
         {
            serviceDescription.getUserCategoryDescriptions().addAll(userCategoryDescriptions.value);
         }
         if (ParameterValidation.existsAndIsNotEmpty(eventDescriptions.value))
         {
            serviceDescription.getEventDescriptions().addAll(eventDescriptions.value);
         }
         if (ParameterValidation.existsAndIsNotEmpty(extensionDescriptions.value))
         {
            serviceDescription.getExtensionDescriptions().addAll(extensionDescriptions.value);
         }
         if (ParameterValidation.existsAndIsNotEmpty(extensions.value))
         {
            serviceDescription.getExtensions().addAll(extensions.value);
         }
         if (ParameterValidation.existsAndIsNotEmpty(supportedOptions.value))
         {
            serviceDescription.getSupportedOptions().addAll(supportedOptions.value);
         }

         return serviceDescription;
      }
      catch (Exception e)
View Full Code Here


   public static SessionContext toV2SessionContext(V1SessionContext sessionContext)
   {
      if (sessionContext != null)
      {
         SessionContext result = WSRPTypeFactory.createSessionContext(sessionContext.getSessionID(), sessionContext.getExpires());
         result.getExtensions().addAll(Lists.transform(sessionContext.getExtensions(), EXTENSION));

         return result;
      }
      else
      {
View Full Code Here

   {
      if (expires < 0)
      {
         throw new IllegalArgumentException("SessionContext requires a positive expiration time.");
      }
      SessionContext sessionContext = new SessionContext();
      sessionContext.setSessionID(sessionID);
      sessionContext.setExpires(expires);
      return sessionContext;
   }
View Full Code Here

   {
      if (expires < 0)
      {
         throw new IllegalArgumentException("SessionContext requires a positive expiration time.");
      }
      SessionContext sessionContext = new SessionContext();
      sessionContext.setSessionID(sessionID);
      sessionContext.setExpires(expires);
      return sessionContext;
   }
View Full Code Here

   {
      if (expires < 0)
      {
         throw new IllegalArgumentException("SessionContext requires a positive expiration time.");
      }
      SessionContext sessionContext = new SessionContext();
      sessionContext.setSessionID(sessionID);
      sessionContext.setExpires(expires);
      return sessionContext;
   }
View Full Code Here

   }


   private void checkForSessionIDs(RuntimeContext runtimeContext) throws OperationFailed
   {
      SessionParams sessionParams = runtimeContext.getSessionParams();
      if (sessionParams != null && sessionParams.getSessionID() != null)
      {
         Utils.throwOperationFaultOnSessionOperation();
      }
   }
View Full Code Here

   // fix-me!

   public org.oasis.wsrp.v2.UserContext getUserContextFrom(WSRPPortletInfo info, PortletInvocation invocation, RuntimeContext runtimeContext) throws PortletInvokerException
   {
      // first decide if we need to pass the user context...
      SessionParams sessionParams = runtimeContext.getSessionParams();
      if (info != null && info.isUserContextStoredInSession() && sessionParams != null && sessionParams.getSessionID() != null)
      {
         return null; // the user context is most likely in the session already
      }

      // todo: deal with user categories and user context key properly
View Full Code Here

   }

   public void setTemplatesIfNeeded(WSRPPortletInfo info, PortletInvocation invocation, RuntimeContext runtimeContext) throws PortletInvokerException
   {
      // todo: could store templates in producer session info to avoid to re-generate them all the time?
      SessionParams sessionParams = runtimeContext.getSessionParams();
      if (info != null && info.isDoesUrlTemplateProcessing()
         && (!info.isTemplatesStoredInSession() || sessionParams == null || sessionParams.getSessionID() == null))
      {
         // we need to supply the templates since the portlet does URL processing and either doesn't store
         // templates in the session or no session has been established yet
         runtimeContext.setTemplates(WSRPTypeFactory.createTemplates(invocation.getContext()));
      }
View Full Code Here

   }

   @Override
   AccessMode getAccessMode() throws MissingParameters
   {
      StateChange stateChange = request.getEventParams().getPortletStateChange();

      return WSRPUtils.getAccessModeFromStateChange(stateChange);
   }
View Full Code Here

      return request.getUserContext();
   }

   AccessMode getAccessMode() throws MissingParameters
   {
      StateChange stateChange = request.getInteractionParams().getPortletStateChange();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(stateChange, "portletStateChange", "InteractionParams");
      return WSRPUtils.getAccessModeFromStateChange(stateChange);
   }
View Full Code Here

TOP

Related Classes of org.oasis.wsrp.v2.SessionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.