Package org.chromattic.api

Examples of org.chromattic.api.ChromatticSession


   {
      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "identifier", null);

      try
      {
         final ChromatticSession session = persister.getSession();

         return getModel(id, modelClass, mappingClass, session);
      }
      catch (Exception e)
      {
View Full Code Here


   public Collection<? extends ConsumerGroup> getConsumerGroups() throws RegistrationException
   {
      try
      {
         final ChromatticSession session = persister.getSession();

         ConsumersAndGroupsMapping mappings = session.findByPath(ConsumersAndGroupsMapping.class, ConsumersAndGroupsMapping.NODE_NAME);
         final List<ConsumerGroupMapping> groupMappings = mappings.getConsumerGroups();
         List<ConsumerGroup> groups = new ArrayList<ConsumerGroup>(groupMappings.size());
         for (ConsumerGroupMapping cgm : groupMappings)
         {
            groups.add(cgm.toModel(newConsumerGroupSPI(cgm.getName()), this));
View Full Code Here

   {
      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(registrationId, "identifier", null);

      try
      {
         final ChromatticSession session = persister.getSession();

         final RegistrationMapping mapping = session.findById(RegistrationMapping.class, registrationId);
         if (mapping == null)
         {
            return null;
         }
         else
View Full Code Here

   public Collection<? extends Consumer> getConsumers() throws RegistrationException
   {
      try
      {
         final ChromatticSession session = persister.getSession();

         ConsumersAndGroupsMapping mappings = session.findByPath(ConsumersAndGroupsMapping.class, ConsumersAndGroupsMapping.NODE_NAME);
         final List<ConsumerMapping> consumerMappings = mappings.getConsumers();
         List<Consumer> consumers = new ArrayList<Consumer>(consumerMappings.size());
         for (ConsumerMapping consumerMapping : consumerMappings)
         {
            consumers.add(consumerMapping.toModel(newConsumerSPI(consumerMapping.getId(), consumerMapping.getName()), this));
View Full Code Here

   private boolean exists(String name)
   {
      try
      {
         ChromatticSession session = persister.getSession();

         return session.getJCRSession().itemExists(rootNodePath + ConsumersAndGroupsMapping.NODE_NAME + "/" + name);
      }
      catch (RepositoryException e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

        this.lifeCycle = lifeCycle;
        this.mopManager = mopManager;
    }

    public ContentRegistry getContentRegistry() {
        ChromatticSession session = lifeCycle.getChromattic().openSession();
        ContentRegistry registry = session.findByPath(ContentRegistry.class, "app:applications");
        if (registry == null) {
            registry = session.insert(ContentRegistry.class, "app:applications");
        }
        return registry;
    }
View Full Code Here

    }

    public <A> A adapt(ModelData modelData, Class<A> type, boolean create) {
        try {
            POMSession pomSession = pomMgr.getSession();
            ChromatticSession chromSession = pomSession.getSession();

            // TODO: Deal with the case where modelData is not persisted before invocation to adapt
            // Get the workspace object
            Object o = pomSession.findObjectById(modelData.getStorageId());

            A a = chromSession.getEmbedded(o, type);
            if (a == null && create) {
                a = chromSession.create(type);
                chromSession.setEmbedded(o, type, a);
            }

            return a;
        } catch (Exception e) {
            log.error(e.getMessage(), e);
View Full Code Here

      /** . */
      private SessionContext context;

      protected final GadgetTokenContainer getGadgetTokenContainer()
      {
         ChromatticSession session = context.getSession();
         GadgetTokenContainer container = session.findByPath(GadgetTokenContainer.class, "gadgettokens");
         if (container == null)
         {
            container = session.insert(GadgetTokenContainer.class, "gadgettokens");
         }
         return container;
      }
View Full Code Here

    @Override
    public void start() {
        try {
            chromatticLifeCycle.getManager().beginRequest();
            ChromatticSession session = chromatticLifeCycle.openContext().getSession();
            GadgetTokenContainer tkContainer = session.findByPath(GadgetTokenContainer.class, "gadgettokens");
            if (tkContainer == null) {
                session.insert(GadgetTokenContainer.class, "gadgettokens");
            }

        } finally {
            chromatticLifeCycle.getManager().endRequest(true);
        }
View Full Code Here

        /** . */
        private SessionContext context;

        protected final GadgetTokenContainer getGadgetTokenContainer() {

            ChromatticSession session = context.getSession();
            return session.findByPath(GadgetTokenContainer.class, "gadgettokens");
        }
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.