Package org.chromattic.api

Examples of org.chromattic.api.ChromatticBuilder


      this.workspaceName = workspaceName;
   }

   public void initializeBuilderFor(List<Class> mappingClasses) throws Exception
   {
      ChromatticBuilder builder = ChromatticBuilder.create();
      builder.setOptionValue(ChromatticBuilder.INSTRUMENTOR_CLASSNAME, "org.chromattic.apt.InstrumentorImpl");
      if (PORTLET_STATES_WORKSPACE_NAME.equals(workspaceName))
      {
         builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, PortletStatesSessionLifeCycle.class.getName());
      }
      else if (WSRP_WORKSPACE_NAME.equals(workspaceName))
      {
         builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, WSRPSessionLifeCycle.class.getName());
      }
      else
      {
         throw new IllegalArgumentException("Unknown workspace name: '" + workspaceName + "'");
      }

      for (Class mappingClass : mappingClasses)
      {
         builder.add(mappingClass);
      }

      chrome = builder.build();
   }
View Full Code Here


   }

   public final void start() throws Exception
   {
      log.debug("About to setup Chromattic life cycle " + domainName);
      ChromatticBuilder builder = ChromatticBuilder.create();

      //
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      for (String className : entityClassNames)
      {
         String fqn = className.trim();
         log.debug("Adding class " + fqn + " to life cycle " + domainName);
         Class<?> entityClass = cl.loadClass(fqn);
         builder.add(entityClass);
      }

      // Set up boot context
      PortalSessionLifeCycle.bootContext.set(this);

      //
      try
      {
         for (Map.Entry<String, String> optionEntry : optionMap.entrySet())
         {
            ChromatticBuilder.Option<?> option = RECOGNIZED_OPTIONS.get(optionEntry.getKey());
            if (option != null)
            {
               log.debug("Setting Chromattic option " + optionEntry);
               builder.setOptionStringValue(option, optionEntry.getValue());
            }
         }

         // Set it now, so we are sure that it will be the correct life cycle
         builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, PortalSessionLifeCycle.class.getName());

         //
         log.debug("Building Chromattic " + domainName);
         realChromattic = builder.build();
         chromattic = new ChromatticImpl(this);
      }
      catch (Exception e)
      {
         log.error("Could not start Chromattic " + domainName, e);
View Full Code Here

    * @param mappingClasses the list of mapping classes this ChromatticPersister will be able to deal with.
    * @throws Exception
    */
   public void initializeBuilderFor(List<Class> mappingClasses) throws Exception
   {
      ChromatticBuilder builder = ChromatticBuilder.create();
      builder.setOptionValue(ChromatticBuilder.INSTRUMENTOR_CLASSNAME, "org.chromattic.apt.InstrumentorImpl");

      //let subclasses set their own options for the builder
      setBuilderOptions(builder);

      // initialize class to mapping map
      modelToMapping = new HashMap<Class, Class<? extends BaseMapping>>(mappingClasses.size());
      for (Class mappingClass : mappingClasses)
      {
         // if we're passing a BaseMapping, extract the first generic type which corresponds to the model class the BaseMapping deals with
         if (BaseMapping.class.isAssignableFrom(mappingClass))
         {
            Type[] interfaces = mappingClass.getGenericInterfaces();
            if (ParameterValidation.existsAndIsNotEmpty(interfaces))
            {
               Class type = (Class)((ParameterizedType)interfaces[0]).getActualTypeArguments()[0];
               modelToMapping.put(type, mappingClass);
            }
         }
         builder.add(mappingClass);
      }

      chrome = builder.build();
   }
View Full Code Here

   }

   public final void start() throws Exception
   {
      log.debug("About to setup Chromattic life cycle " + domainName);
      ChromatticBuilder builder = ChromatticBuilder.create();

      //
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      for (String className : entityClassNames)
      {
         String fqn = className.trim();
         log.debug("Adding class " + fqn + " to life cycle " + domainName);
         Class<?> entityClass = cl.loadClass(fqn);
         builder.add(entityClass);
      }

      // Set up boot context
      PortalSessionLifeCycle.bootContext.set(this);

      //
      try
      {
         for (Map.Entry<String, String> optionEntry : optionMap.entrySet())
         {
            ChromatticBuilder.Option<?> option = RECOGNIZED_OPTIONS.get(optionEntry.getKey());
            if (option != null)
            {
               log.debug("Setting Chromattic option " + optionEntry);
               builder.setOptionStringValue(option, optionEntry.getValue());
            }
         }

         // Set it now, so we are sure that it will be the correct life cycle
         builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, PortalSessionLifeCycle.class.getName());

         //
         log.debug("Building Chromattic " + domainName);
         realChromattic = builder.build();
         chromattic = new ChromatticImpl(this);
      }
      catch (Exception e)
      {
         log.error("Could not start Chromattic " + domainName, e);
View Full Code Here

        return loginContext.doLogin();
    }

    public final void start() throws Exception {
        log.debug("About to setup Chromattic life cycle " + domainName);
        ChromatticBuilder builder = ChromatticBuilder.create();

        //
        ClassLoader cl = Thread.currentThread().getContextClassLoader();
        for (String className : entityClassNames) {
            String fqn = className.trim();
            log.debug("Adding class " + fqn + " to life cycle " + domainName);
            Class<?> entityClass = cl.loadClass(fqn);
            builder.add(entityClass);
        }

        // Set up boot context
        PortalSessionLifeCycle.bootContext.set(this);

        //
        try {
            for (Map.Entry<String, String> optionEntry : optionMap.entrySet()) {
                ChromatticBuilder.Option<?> option = RECOGNIZED_OPTIONS.get(optionEntry.getKey());
                if (option != null) {
                    log.debug("Setting Chromattic option " + optionEntry);
                    setOption(builder, option, optionEntry.getValue());
                }
            }

            // Set it now, so we are sure that it will be the correct life cycle
            builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, PortalSessionLifeCycle.class.getName());

            //
            log.debug("Building Chromattic " + domainName);
            realChromattic = builder.build();
            chromattic = new ChromatticImpl(this);
        } catch (Exception e) {
            log.error("Could not start Chromattic " + domainName, e);
        } finally {
            PortalSessionLifeCycle.bootContext.set(null);
View Full Code Here

   }

   public final void start() throws Exception
   {
      log.debug("About to setup Chromattic life cycle " + domainName);
      ChromatticBuilder builder = ChromatticBuilder.create();

      //
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      for (String className : entityClassNames)
      {
         String fqn = className.trim();
         log.debug("Adding class " + fqn + " to life cycle " + domainName);
         Class<?> entityClass = cl.loadClass(fqn);
         builder.add(entityClass);
      }

      // Set up boot context
      PortalSessionLifeCycle.bootContext.set(this);

      //
      try
      {
         for (Map.Entry<String, String> optionEntry : optionMap.entrySet())
         {
            ChromatticBuilder.Option<?> option = RECOGNIZED_OPTIONS.get(optionEntry.getKey());
            if (option != null)
            {
               log.debug("Setting Chromattic option " + optionEntry);
               setOption(builder, option, optionEntry.getValue());
            }
         }

         // Set it now, so we are sure that it will be the correct life cycle
         builder.setOptionValue(ChromatticBuilder.SESSION_LIFECYCLE_CLASSNAME, PortalSessionLifeCycle.class.getName());

         //
         log.debug("Building Chromattic " + domainName);
         realChromattic = builder.build();
         chromattic = new ChromatticImpl(this);
      }
      catch (Exception e)
      {
         log.error("Could not start Chromattic " + domainName, e);
View Full Code Here

TOP

Related Classes of org.chromattic.api.ChromatticBuilder

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.