Package org.gatein.pc.api

Examples of org.gatein.pc.api.PortletInvokerException


      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(changes, "Property changes");

      WSRPPortlet portlet = getWSRPPortlet(portletContext);
      if (portlet == null)
      {
         throw new PortletInvokerException("Cannot set properties on portlet '" + portletContext.getId()
            + "' because there is no such portlet.");
      }

      PropertyList propertyList = WSRPTypeFactory.createPropertyList();
      int changesNumber = changes.length;
      List<Property> updates = new ArrayList<Property>(changesNumber);
      List<ResetProperty> resets = new ArrayList<ResetProperty>(changesNumber);
      for (PropertyChange change : changes)
      {
         switch (change.getType())
         {
            case PropertyChange.PREF_RESET:
               resets.add(WSRPTypeFactory.createResetProperty(change.getKey()));
               break;

            case PropertyChange.PREF_UPDATE:
               // todo: deal with language more appropriately
               updates.add(WSRPTypeFactory.createProperty(change.getKey(),
                  WSRPConstants.DEFAULT_LOCALE, change.getValue().get(0)));
               break;

            default:
               throw new IllegalArgumentException("Unexpected property change type: " + change.getType());
         }
      }
      propertyList.getProperties().addAll(updates);
      propertyList.getResetProperties().addAll(resets);

      try
      {
         Holder<String> handle = new Holder<String>();
         Holder<byte[]> portletState = new Holder<byte[]>();
         getPortletManagementService().setPortletProperties(getRegistrationContext(),
            WSRPUtils.convertToWSRPPortletContext(portletContext),
            UserAccess.getUserContext(),
            propertyList,
            handle,
            portletState,
            new Holder<Lifetime>(),
            new Holder<List<Extension>>()
         );
         PortletContext newPortletContext = PortletContext.createPortletContext(handle.value, portletState.value, false);
         portlet.setPortletContext(newPortletContext);
         return newPortletContext;
      }
      catch (Exception e)
      {
         throw new PortletInvokerException("Unable to set properties for portlet '" + portletContext.getId() + "'", e);
      }
   }
View Full Code Here


      {
         internalStart();
      }
      catch (Exception e)
      {
         throw new PortletInvokerException(e);
      }

      return refreshProducerInfo(forceRefresh);
   }
View Full Code Here

               throw new IllegalArgumentException(inconsistentParameters);
            }
            catch (InvalidRegistration invalidRegistration)
            {
               handleInvalidRegistrationFault();
               throw new PortletInvokerException(invalidRegistration);
            }
            catch (ModifyRegistrationRequired modifyRegistrationRequired)
            {
               handleModifyRegistrationRequiredFault();
               throw new PortletInvokerException(modifyRegistrationRequired);
            }
            catch (Exception e)
            {
               throw new PortletInvokerException(e.getLocalizedMessage(), e);
            }
         }
         else
         {
            throw new IllegalArgumentException("Must provide a non-null, non-empty list of portlet handles.");
View Full Code Here

               throw new IllegalArgumentException(inconsistentParameters);
            }
            catch (InvalidRegistration invalidRegistration)
            {
               handleInvalidRegistrationFault();
               throw new PortletInvokerException(invalidRegistration);
            }
            catch (ModifyRegistrationRequired modifyRegistrationRequired)
            {
               handleModifyRegistrationRequiredFault();
               throw new PortletInvokerException(modifyRegistrationRequired);
            }
            catch (Exception e)
            {
               throw new PortletInvokerException(e.getLocalizedMessage(), e);
            }
         }
         else
         {
            throw new IllegalArgumentException("Must provide a non-null, non-empty list of portlet handles.");
View Full Code Here

               }
               catch (Exception e)
               {
                  persistentRegistrationInfo.resetRegistration();
                  setActive(false);
                  throw new PortletInvokerException("Couldn't register with producer '" + getId() + "'", e);
               }
            }
            else
            {
               log.debug(result.getStatus().toString());
               setActive(false);
               throw new PortletInvokerException("Consumer is not ready to be registered with producer because of missing or invalid registration information.");
            }
         }
      }

      return new RefreshResult(RefreshResult.Status.BYPASSED);
View Full Code Here

            persistentEndpointInfo.getRegistrationService().deregister(registrationContext, UserAccess.getUserContext());
            log.info("Consumer with id '" + getId() + "' deregistered.");
         }
         catch (Exception e)
         {
            throw new PortletInvokerException("Couldn't deregister with producer '" + getId() + "'", e);
         }
         finally
         {
            resetRegistration();
         }
View Full Code Here

               // reset cache to be able to see new offered portlets on the next refresh
               invalidateCache();
            }
            catch (Exception e)
            {
               throw new PortletInvokerException("Couldn't modify registration with producer '" + getId() + "'", e);
            }
         }
      }
      else
      {
View Full Code Here

                  registrationSPI.removePortletContext(context);
                  log.debug("Removed '" + context + "' from Registration '" + registration.getRegistrationHandle() + "' because it cannot be resolved anymore.");
               }
               catch (RegistrationException e1)
               {
                  throw new PortletInvokerException(e1);
               }
            }
         }
      }
View Full Code Here

      {
         return (RegistrationSPI)registration;
      }
      else
      {
         throw new PortletInvokerException("Cannot deal with non-RegistrationSPI Registrations.");
      }
   }
View Full Code Here

               {
                  registration.addPortletContext(responseContext);
               }
               catch (RegistrationException e)
               {
                  throw new PortletInvokerException("Couldn't add portlet context '" + responseContext + "' to registration '" + registration.getRegistrationHandle() + "'", e);
               }
            }
         }

         return response;
View Full Code Here

TOP

Related Classes of org.gatein.pc.api.PortletInvokerException

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.