Package org.gatein.registration.spi

Examples of org.gatein.registration.spi.ConsumerSPI


         internalAddConsumerGroup(cgm.toConsumerGroup(this));
      }

      for (ConsumerMapping cm : mappings.getConsumers())
      {
         ConsumerSPI consumer = cm.toConsumer(this);
         internalAddConsumer(consumer);

         // get the registrations and add them to local map.
         for (Registration registration : consumer.getRegistrations())
         {
            internalAddRegistration((RegistrationSPI)registration);
         }
      }
View Full Code Here


   }

   @Override
   protected ConsumerSPI internalCreateConsumer(String consumerId, String consumerName)
   {
      ConsumerSPI consumer = super.internalCreateConsumer(consumerId, consumerName);

      ChromatticSession session = persister.getSession();
      mappings = session.findByPath(ConsumersAndGroupsMapping.class, ConsumersAndGroupsMapping.NODE_NAME); // todo: needed?
      try
      {
         ConsumerMapping cm = mappings.createConsumer(consumerId);
         mappings.getConsumers().add(cm);
         cm.initFrom(consumer);
         consumer.setPersistentKey(cm.getPersistentKey());
         persister.closeSession(session, true);
      }
      catch (Exception e)
      {
         e.printStackTrace(); // todo: fix me
View Full Code Here

   }

   @Override
   protected ConsumerSPI internalSaveChangesTo(Consumer consumer)
   {
      ConsumerSPI consumerSPI = super.internalSaveChangesTo(consumer);

      ChromatticSession session = persister.getSession();
      try
      {
         ConsumerMapping cm = session.findById(ConsumerMapping.class, consumer.getPersistentKey());
View Full Code Here

      }
   }

   public ConsumerSPI toConsumer(JCRRegistrationPersistenceManager persistenceManager) throws RegistrationException
   {
      ConsumerSPI consumer = persistenceManager.newConsumerSPI(getId(), getName());
      consumer.setConsumerAgent(getConsumerAgent());
      consumer.setPersistentKey(getPersistentKey());

      consumer.setCapabilities(getCapabilities().toConsumerCapabilities());

      ConsumerGroupMapping cgm = getGroup();
      if (cgm != null)
      {
         consumer.setGroup(persistenceManager.getConsumerGroup(cgm.getName()));
      }

      for (RegistrationMapping rm : getRegistrations())
      {
         consumer.addRegistration(rm.toRegistration(persistenceManager, consumer));
      }

      return consumer;
   }
View Full Code Here

      {
         throw new DuplicateRegistrationException("A Consumer with identifier '" + consumerId + "' has already been registered.");
      }
      else
      {
         ConsumerSPI consumer = internalCreateConsumer(consumerId, consumerName);
         internalAddConsumer(consumer);

         return consumer;
      }
   }
View Full Code Here

      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(String consumerId, Map<QName, Object> registrationProperties) throws RegistrationException
   {
      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerId, "Consumer identity", null);
      ParameterValidation.throwIllegalArgExceptionIfNull(registrationProperties, "Registration properties");

      ConsumerSPI consumer = getConsumerSPIById(consumerId);
      if (consumer == null)
      {
         throw new NoSuchRegistrationException("There is no Consumer with identity '" + consumerId
            + "' to add a Registration to...");
      }
View Full Code Here

      {
         throw new NoSuchRegistrationException("There is no ConsumerGroup named '" + groupName
            + "' to add a Consumer to...");
      }

      ConsumerSPI consumer = getConsumerSPIById(consumerId);
      if (consumer == null)
      {
         throw new NoSuchRegistrationException("There is no Consumer with identity '" + consumerId
            + "' to add to ConsumerGroup named '" + groupName + "'. Did you create it?");
      }
View Full Code Here

   protected abstract ConsumerSPI internalRemoveConsumer(String consumerId) throws RegistrationException;

   protected ConsumerSPI internalCreateConsumer(String consumerId, String consumerName) throws RegistrationException
   {
      ConsumerSPI consumerSPI = newConsumerSPI(consumerId, consumerName);
      consumerSPI.setPersistentKey(consumerId);
      return consumerSPI;
   }
View Full Code Here

      }
   }

   public ConsumerSPI toModel(ConsumerSPI initial, JCRRegistrationPersistenceManager persistenceManager)
   {
      ConsumerSPI consumer = (initial != null ? initial : persistenceManager.newConsumerSPI(getId(), getName()));
      consumer.setConsumerAgent(getConsumerAgent());
      consumer.setPersistentKey(getPersistentKey());

      consumer.setCapabilities(getCapabilities().toConsumerCapabilities());

      try
      {
         ConsumerGroupMapping cgm = getGroup();
         if (cgm != null)
         {
            consumer.setGroup(persistenceManager.getConsumerGroup(cgm.getName()));
         }

         for (RegistrationMapping rm : getRegistrations())
         {
            consumer.addRegistration(rm.toRegistration(consumer, persistenceManager));
         }
      }
      catch (RegistrationException e)
      {
         throw new RuntimeException(e);
View Full Code Here

TOP

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

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.