Package org.chromattic.api

Examples of org.chromattic.api.ChromatticSession


   public Collection<String> getConfiguredConsumersIds()
   {
      try
      {
         ChromatticSession session = persister.getSession();

         // use JCR directly to only retrieve the ProducerInfo identifiers, this is a little bit convoluted, unfortunately, and we should probably check that we indeed perform better than via Chromattic
         final RowIterator rows = getProducerInfoIds(session);

         final long size = rows.getSize();
View Full Code Here


   @Override
   public int getConfiguredConsumerNumber()
   {
      try
      {
         ChromatticSession session = persister.getSession();

         final RowIterator ids = getProducerInfoIds(session);

         return (int)ids.getSize();
      }
View Full Code Here

      this.rootNodePath = rootNodePath.endsWith("/") ? rootNodePath : rootNodePath + "/";
      this.persister = persister;

      try
      {
         ChromatticSession session = persister.getSession();
         ConsumersAndGroupsMapping mappings = session.findByPath(ConsumersAndGroupsMapping.class, ConsumersAndGroupsMapping.NODE_NAME);
         if (mappings == null)
         {
            session.insert(ConsumersAndGroupsMapping.class, ConsumersAndGroupsMapping.NODE_NAME);
            persister.save();
         }
      }
      finally
      {
View Full Code Here

      final Registration reg = getRegistration(registrationId);
      if (reg != null)
      {
         try
         {
            final ChromatticSession session = persister.getSession();
            final RegistrationMapping mapping = session.findById(RegistrationMapping.class, registrationId);
            session.remove(mapping);
            persister.save();
         }
         finally
         {
            persister.closeSession(false);
View Full Code Here

   protected RegistrationSPI internalCreateRegistration(ConsumerSPI consumer, Map<QName, Object> registrationProperties) throws RegistrationException
   {
      RegistrationSPI registration = super.internalCreateRegistration(consumer, registrationProperties);
      try
      {
         ChromatticSession session = persister.getSession();

         ConsumerMapping cm = session.findById(ConsumerMapping.class, consumer.getPersistentKey());
         RegistrationMapping rm = cm.createAndAddRegistrationMappingFrom(null);
         rm.initFrom(registration);
         registration.setPersistentKey(rm.getPersistentKey());

         persister.save();
View Full Code Here

   private <T extends BaseMapping, U> U remove(String name, Class<T> mappingClass, Class<U> modelClass)
   {
      try
      {
         ChromatticSession session = persister.getSession();

         T toRemove = getMapping(session, mappingClass, name);
         if (toRemove == null)
         {
            return null;
         }

         final U result = getModelFrom(toRemove, mappingClass, modelClass);

         session.remove(toRemove);
         persister.save();

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

   {
      ConsumerSPI consumer = super.internalCreateConsumer(consumerId, consumerName);

      try
      {
         ChromatticSession session = persister.getSession();

         ConsumersAndGroupsMapping mappings = session.findByPath(ConsumersAndGroupsMapping.class, ConsumersAndGroupsMapping.NODE_NAME);
         ConsumerMapping cm = mappings.createConsumer(consumerId);
         mappings.getConsumers().add(cm);
         cm.initFrom(consumer);
         consumer.setPersistentKey(cm.getPersistentKey());
View Full Code Here

   {
      ConsumerSPI consumerSPI = (ConsumerSPI)consumer;

      try
      {
         ChromatticSession session = persister.getSession();

         ConsumerMapping cm = session.findById(ConsumerMapping.class, consumer.getPersistentKey());
         cm.initFrom(consumerSPI);

         persister.save();
      }
      catch (Exception e)
View Full Code Here

   {
      RegistrationSPI registrationSPI = (RegistrationSPI)registration;

      try
      {
         ChromatticSession session = persister.getSession();

         RegistrationMapping cm = session.findById(RegistrationMapping.class, registration.getPersistentKey());
         cm.initFrom(registrationSPI);

         persister.save();
      }
      catch (Exception e)
View Full Code Here

   {
      ConsumerGroupSPI group = super.internalCreateConsumerGroup(name);

      try
      {
         ChromatticSession session = persister.getSession();

         ConsumersAndGroupsMapping mappings = session.findByPath(ConsumersAndGroupsMapping.class, ConsumersAndGroupsMapping.NODE_NAME);
         ConsumerGroupMapping cgm = mappings.createConsumerGroup(name);
         mappings.getConsumerGroups().add(cgm);
         group.setPersistentKey(cgm.getPersistentKey());
         cgm.initFrom(group);
View Full Code Here

TOP

Related Classes of org.chromattic.api.ChromatticSession

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.