Package org.oasis.wsrp.v2

Examples of org.oasis.wsrp.v2.Event


            }
         }

         List<FailedPortlets> failedPortlets = new ArrayList<FailedPortlets>(failedPortletsMap.values());
         //TODO: handle resources properly
         ResourceList resourceList = null;
         return WSRPTypeFactory.createCopyPortletsResponse(copiedPortlets, failedPortlets, resourceList);
      }
      catch (Exception e)
      {
         throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Operation Failed while trying to CopyPortlets.", e);
View Full Code Here


               }
            }
         }

         //TODO: handle resourceLists better (should be using for things like errors)
         ResourceList resourceList = null;

         byte[] exportContextBytes = exportManager.encodeExportContextData(exportContext);

         Lifetime lifetime = null;
View Full Code Here

                  failedPortlets.getImportID().add(importPortlet.getImportID());
               }
            }
         }

         ResourceList resourceList = null; //TODO: figure out what exactly should be stored in the resource list here

         return WSRPTypeFactory.createImportPortletsResponse(importedPortlets, new ArrayList<ImportPortletsFailed>(failedPortletsMap.values()), resourceList);
      }
      finally
      {
View Full Code Here

   protected PortletInvocation internalInitInvocation(WSRPPortletInvocationContext context)
   {
      ResourceInvocation resourceInvocation = new ResourceInvocation(context);

      ResourceParams resourceParams = this.request.getResourceParams();

      // only set the resource id if it's different from the place holder we use if the portlet doesn't set one
      String id = this.request.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());

      //TODO: property set validation token for caching (ie ETAG)
      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
      {
         // according to JSR 286, cache level must default to ResourceURL.PAGE
View Full Code Here

      GetResource getResource = ResourceServingUtil.decode(req);

      try
      {
         ResourceResponse resource = producer.getResource(getResource);
         ResourceContext resourceContext = resource.getResourceContext();
         byte[] itemBinary = resourceContext.getItemBinary();
         String itemString = resourceContext.getItemString();

         final String mimeType = resourceContext.getMimeType();
         if (!ParameterValidation.isNullOrEmpty(mimeType))
View Full Code Here

      // retrieve the registration associated with the request or fail
      Registration registration = producer.getRegistrationOrFailIfInvalid(getRegistrationContext());

      // get session information and deal with it
      final RuntimeContext runtimeContext = getRuntimeContext();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(runtimeContext, "RuntimeContext", contextName);
      checkForSessionIDs(runtimeContext);

      // get parameters
      final MimeRequest params = getParams();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(params, "MarkupParams", contextName);

      // get portlet handle
      PortletContext wsrpPC = getPortletContext();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(wsrpPC, "PortletContext", contextName);
      org.gatein.pc.api.PortletContext portletContext = WSRPUtils.convertToPortalPortletContext(wsrpPC);

      // check locales
      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);
         }
      }

      // retrieve the portlet
      try
      {
         // calls RegistrationLocal.setRegistration so no need to here
         portlet = producer.getPortletWith(portletContext, registration);
      }
      catch (PortletInvokerException e)
      {
         throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Could not retrieve portlet '" + portletContext + "'", e);
      }

      // get portlet description for the desired portlet...
      portletDescription = producer.getPortletDescription(wsrpPC, null, registration);
      if (Boolean.TRUE.equals(portletDescription.isUsesMethodGet()))
      {
         throw WSRP2ExceptionFactory.throwWSException(OperationFailed.class, "Portlets using GET method in forms are not currently supported.", null);
      }

      List<MarkupType> markupTypes = portletDescription.getMarkupTypes();

      // based on the markup parameters and portlet description generate the most appropriate markup request
      markupRequest = createMarkupRequestFrom(markupTypes, params, portlet);

      // prepare information for invocation
      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);

      // prepare the invocation context
      WSRPPortletInvocationContext context = new WSRPPortletInvocationContext(mediaType, securityContext, portalContext, userContext, instanceContext, windowContext);
View Full Code Here

         // only add registration properties if we asked for them
         ModelDescription registrationProperties = needsRegistrationProperties ? this.registrationProperties : null;

         // set the service description details
         ServiceDescription serviceDescription = WSRPTypeFactory.createServiceDescription(false);
         serviceDescription.setRequiresInitCookie(BEA_8_CONSUMER_FIX);
         serviceDescription.getSupportedOptions().addAll(OPTIONS);
         serviceDescription.setRegistrationPropertyDescription(registrationProperties);
         serviceDescription.setRequiresRegistration(requireRegistrations);

         // init supported locales. Note that this doesn't mean that all portlets support all these languages but rather that at least one portlet supports at least one of these languages.
         final Set<String> knownPortletHandles = portletDescriptions.keySet();
         Set<String> supportedLocales = new HashSet<String>(knownPortletHandles.size() * 2);

         // if we asked for portlet decriptions, add them to the service description we will return
         Collection<PortletDescription> portlets;
         if (needsPortletDescriptions)
         {
            // if we don't have a list of portlet handles, select all of them
            if (!ParameterValidation.existsAndIsNotEmpty(portletHandles))
            {
               portletHandles = new ArrayList<String>(knownPortletHandles);
            }

            // for each selected portlet
            portlets = new ArrayList<PortletDescription>(portletHandles.size());
            for (String handle : portletHandles)
            {
               // retrieve the associated description
               PortletDescriptionInfo descriptionInfo = portletDescriptions.get(handle);
               if (descriptionInfo != null)
               {
                  // add the languages that the portlet supports to the set of supported languages
                  supportedLocales.addAll(descriptionInfo.getSupportedLanguages());
                  // and add the best-effort localized description for this portlet based on the locales the consumer asked for
                  portlets.add(descriptionInfo.getBestDescriptionFor(desiredLocales));
               }
            }
            serviceDescription.getOfferedPortlets().addAll(portlets);
         }
         serviceDescription.getLocales().addAll(supportedLocales);

         // events
         Collection<EventDescription> events = eventDescriptions.values();
         serviceDescription.getEventDescriptions().addAll(events);

         return serviceDescription;
      }
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

   }

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

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

TOP

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

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.