Package org.chromattic.api

Examples of org.chromattic.api.ChromatticSession


   }

   @Override
   public boolean isSessionClosed()
   {
      final ChromatticSession session = sessionHolder.get();
      return session == null || session.isClosed();
   }
View Full Code Here


      return session == null || session.isClosed();
   }

   private ChromatticSession getOpenedSessionOrFail()
   {
      ChromatticSession session = sessionHolder.get();
      if (session == null)
      {
         throw new IllegalStateException("Cannot close the session as it hasn't been opened first!");
      }
      return session;
View Full Code Here

      if (baseMappingClass == null)
      {
         throw new IllegalArgumentException("Cannot find a mapping class for " + modelClass.getName());
      }

      ChromatticSession session = getSession();

      Object old = session.findByPath(baseMappingClass, manager.getChildPath(toDelete));

      if (old != null)
      {
         session.remove(old);

         // update last modified of element linked to toDelete if needed
         final LastModified lastModified = manager.lastModifiedToUpdateOnDelete(session);
         if (lastModified != null)
         {
View Full Code Here

   protected void loadConfiguration() throws Exception
   {
      try
      {
         // Try loading configuration from JCR first
         ChromatticSession session = persister.getSession();
         ProducerConfigurationMapping pcm = session.findByPath(ProducerConfigurationMapping.class, PRODUCER_CONFIGURATION_PATH);

         // if we don't have a configuration persisted in JCR already, force a reload from XML and save the resulting configuration
         if (pcm == null)
         {
            pcm = session.insert(ProducerConfigurationMapping.class, PRODUCER_CONFIGURATION_PATH);

            ProducerConfigurationService service = new SimpleXMLProducerConfigurationService(defaultConfigurationIS);

            service.reloadConfiguration();
            configuration.set(service.getConfiguration());
View Full Code Here

   public void saveConfiguration() throws Exception
   {
      try
      {
         ChromatticSession session = persister.getSession();

         ProducerConfigurationMapping pcm = session.findByPath(ProducerConfigurationMapping.class, PRODUCER_CONFIGURATION_PATH);
         if (pcm == null)
         {
            pcm = session.insert(ProducerConfigurationMapping.class, PRODUCER_CONFIGURATION_PATH);
         }
         pcm.initFrom(configuration.get());
         persister.save();
      }
      finally
View Full Code Here

   @Override
   public long getPersistedLastModifiedForConfiguration()
   {
      try
      {
         ChromatticSession session = persister.getSession();
         ProducerConfigurationMapping pcm = session.findByPath(ProducerConfigurationMapping.class, PRODUCER_CONFIGURATION_PATH);

         return (pcm == null) ? 0 : pcm.getLastModified();
      }
      finally
      {
View Full Code Here

   public List<ExportInfo> getAvailableExportInfos()
   {
      try
      {
         ChromatticSession session = persister.getSession();

         ExportInfosMapping exportInfosMapping = getExportInfosMapping(session);

         List<ExportInfoMapping> exportInfoMappings = exportInfosMapping.getExportInfos();
         List<ExportInfo> exportInfos = new ArrayList<ExportInfo>(exportInfoMappings.size());
View Full Code Here

   public ExportInfo getExportInfo(long exportTime)
   {
      try
      {
         ChromatticSession session = persister.getSession();

         ExportInfoMapping eim = session.findByPath(ExportInfoMapping.class, getPathFor(exportTime));
         if (eim != null)
         {
            return eim.toModel(null, null);
         }
         else
View Full Code Here

   public void add(ExportInfo info)
   {
      try
      {
         ChromatticSession session = persister.getSession();

         ExportInfoMapping eim = session.findByPath(ExportInfoMapping.class, getChildPath(info));
         long exportTime = info.getExportTime();
         if (eim != null)
         {
            throw new IllegalArgumentException("An ExportInfo with export time "
               + exportTime + " already exists!");
         }
         else
         {
            ExportInfosMapping exportInfosMapping = getExportInfosMapping(session);
            String exportTimeAsString = "" + exportTime;
            ExportInfoMapping exportInfo = exportInfosMapping.createExportInfo(exportTimeAsString);
            session.persist(exportInfosMapping, exportInfo, exportTimeAsString);
            exportInfo.initFrom(info);

            persister.save();
            exportInfosCount++;
         }
View Full Code Here

   {
      if (exportInfosCount == -1)
      {
         try
         {
            ChromatticSession session = persister.getSession();
            ExportInfosMapping mappings = getExportInfosMapping(session);
            exportInfosCount = mappings.getExportInfos().size();
         }
         finally
         {
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.