Package org.gatein.registration.spi

Examples of org.gatein.registration.spi.RegistrationSPI


      if (rpm != null)
      {
         props = rpm.toPropMap();
      }

      RegistrationSPI reg = persistenceManager.newRegistrationSPI(consumer, props, getPersistentKey());
      reg.setStatus(getStatus());
      reg.setRegistrationHandle(getRegistrationHandle());

      return reg;
   }
View Full Code Here


   @Override
   protected RegistrationSPI internalCreateRegistration(ConsumerSPI consumer, Map registrationProperties)
   {
      ChromatticSession session = persister.getSession();
      RegistrationSPI registration = null;
      try
      {
         ConsumerMapping cm = session.findById(ConsumerMapping.class, consumer.getPersistentKey());
         RegistrationMapping rm = cm.createAndAddRegistrationMappingFrom(null);
         registration = newRegistrationSPI(consumer, registrationProperties, rm.getPersistentKey());
View Full Code Here

      }*/

      Consumer consumer = getOrCreateConsumer(identity, createConsumerIfNeeded, consumerName);

      // create the actual registration
      RegistrationSPI registration = persistenceManager.addRegistrationFor((ConsumerSPI)consumer, registrationProperties);

      // let the policy decide what the handle should be
      createAndSetRegistrationHandle(registration);

      return registration;
View Full Code Here

   public void removeRegistration(String registrationId) throws RegistrationException
   {
      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId, "Registration identity", null);

      RegistrationSPI registration = internalRemoveRegistration(registrationId);
      if (registration == null)
      {
         throw new NoSuchRegistrationException("There is no Registration with id '" + registrationId + "'");
      }

      ConsumerSPI consumer = registration.getConsumer();
      consumer.removeRegistration(registration);
   }
View Full Code Here

   public RegistrationSPI addRegistrationFor(ConsumerSPI consumer, Map<QName, Object> registrationProperties) throws RegistrationException
   {
      ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "Consumer");
      ParameterValidation.throwIllegalArgExceptionIfNull(registrationProperties, "Registration properties");

      RegistrationSPI registration = internalCreateRegistration(consumer, registrationProperties);
      consumer.addRegistration(registration);

      internalAddRegistration(registration);

      return registration;
View Full Code Here

   protected abstract RegistrationSPI internalRemoveRegistration(String registrationId) throws RegistrationException;

   protected RegistrationSPI internalCreateRegistration(ConsumerSPI consumer, Map<QName, Object> registrationProperties) throws RegistrationException
   {
      RegistrationSPI registrationSPI = newRegistrationSPI(consumer, registrationProperties);
      registrationSPI.setPersistentKey("" + lastRegistrationId++);
      return registrationSPI;
   }
View Full Code Here

            {
               portlets.add(super.getPortlet(context));
            }
            catch (NoSuchPortletException e)
            {
               final RegistrationSPI registrationSPI = getRegistrationAsSPI();
               try
               {
                  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

   public PortletInvocationResponse invoke(PortletInvocation invocation) throws IllegalArgumentException, PortletInvokerException
   {
      PortletContext portletContext = invocation.getTarget();

      RegistrationSPI registration = getRegistrationAsSPI();

      if (registration != null)
      {
         checkOperationIsAllowed(portletContext, registration, "invoke");

         PortletInvocationResponse response = super.invoke(invocation);

         // we need to check if the instance context was modified (for example, if an implicit cloned happened) to remember the new one and associate it with the current Registration
         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("Couldn't add portlet context '" + responseContext + "' to registration '" + registration.getRegistrationHandle() + "'", e);
               }
            }
         }

         return response;
View Full Code Here

   }

   public PortletContext createClone(PortletStateType stateType, PortletContext portletContext)
      throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
   {
      RegistrationSPI registration = getRegistrationAsSPI();

      if (registration != null)
      {
         checkOperationIsAllowed(portletContext, registration, "createClone");

         PortletContext clonedPortletContext = super.createClone(stateType, portletContext);
         try
         {
            registration.addPortletContext(clonedPortletContext);
         }
         catch (RegistrationException e)
         {
            throw new PortletInvokerException("Couldn't add portlet context '" + clonedPortletContext + "' to registration '" + registration.getRegistrationHandle() + "'", e);
         }

         return clonedPortletContext;
      }
      else
View Full Code Here

   }

   public List<DestroyCloneFailure> destroyClones(List<PortletContext> portletContexts)
      throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
   {
      RegistrationSPI registration = getRegistrationAsSPI();

      if (registration != null)
      {
         for (PortletContext portletContext : portletContexts)
         {
            checkOperationIsAllowed(portletContext, registration, "destroyClones");
         }
      }

      List<DestroyCloneFailure> cloneFailures = super.destroyClones(portletContexts);
      boolean noFailures = cloneFailures.isEmpty();

      if (registration != null)
      {
         for (PortletContext portletContext : portletContexts)
         {
            // only remove the portlet context if there are no failures or it's not part of the failed clones
            if (noFailures || !cloneFailures.contains(new DestroyCloneFailure(portletContext.getId())))
            {
               try
               {
                  registration.removePortletContext(portletContext);
               }
               catch (RegistrationException e)
               {
                  throw new PortletInvokerException("Couldn't remove portlet context '" + portletContext + "' to registration '" + registration.getRegistrationHandle() + "'", e);
               }
            }
         }
      }
View Full Code Here

TOP

Related Classes of org.gatein.registration.spi.RegistrationSPI

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.