Package org.jboss.seam.core

Examples of org.jboss.seam.core.Init


public class PhaseListenerTest
{
   private void installComponents(Context appContext)
   {
      appContext.set( Seam.getComponentName(Init.class), new Init() );
      installComponent(appContext, Manager.class);
      installComponent(appContext, ConversationEntries.class);
      installComponent(appContext, FacesPage.class);
      installComponent(appContext, Conversation.class);
      installComponent(appContext, FacesMessages.class);
View Full Code Here


      Contexts.pageContext.set( new PageContext() );
   }

   public static void resumeConversation(ExternalContext externalContext)
   {
      Init init = Init.instance();
      Context conversationContext = init.isClientSideConversations() ?
            (Context) new ClientConversationContext() :
            (Context) new ServerConversationContext( ContextAdaptor.getSession(externalContext) );
      Contexts.conversationContext.set( conversationContext );
      Contexts.businessProcessContext.set( new BusinessProcessContext() );
   }
View Full Code Here

   protected void loadResourceProviders()
   {
      Context tempApplicationContext = new WebApplicationContext(context);

      Init init = (Init) tempApplicationContext.get(Init.class);
      for (String name : init.getResourceProviders())
      {
         AbstractResource provider = (AbstractResource) tempApplicationContext.get(name);
         if (provider != null)
         {
            provider.setServletContext(context);
View Full Code Here

      initHotDeployClassLoader();
      scanForHotDeployableComponents();
      scanForComponents();
     
      addComponent( new ComponentDescriptor(Init.class), Contexts.getApplicationContext() );
      Init init = (Init) Component.getInstance(Init.class, ScopeType.APPLICATION);   
      ComponentDescriptor desc = findDescriptor(Jbpm.class);
      if (desc != null && desc.isInstalled())
      {
         init.setJbpmInstalled(true);
      }
      init.setTimestamp( System.currentTimeMillis() );
      init.setHotDeployPaths(hotDeployPaths);
     
      addSpecialComponents(init);
      installComponents(init);
      Lifecycle.endInitialization();
      log.info("done initializing Seam");
View Full Code Here

   public Initialization redeploy(HttpSession session)
   {
      log.info("redeploying");
      Lifecycle.beginReinitialization(servletContext, session);
      Init init = Init.instance();
      for ( String name: init.getHotDeployableComponents() )
      {
         Component component = Component.forName(name);
         ScopeType scope = component.getScope();
         if ( scope!=ScopeType.STATELESS && scope.isContextActive() )
         {
            scope.getContext().remove(name);
         }
         Contexts.getApplicationContext().remove(name + ".component");
      }
      initHotDeployClassLoader();
      scanForHotDeployableComponents();
      init.setTimestamp( System.currentTimeMillis() );
      init.setHotDeployPaths(hotDeployPaths);
      installComponents(init);
      Lifecycle.endInitialization();
      log.info("done redeploying");
      return this;
   }
View Full Code Here

      return processInstance==null ? null : processInstance.getContextInstance();
   }

   private org.jbpm.graph.exe.ProcessInstance getProcessInstance()
   {
      Init init = Init.instance(); //may be null in some tests
      if ( init==null || !init.isJbpmInstalled() )
      {
         return null;
      }
      else
      {
View Full Code Here

      }
   }
  
   private org.jbpm.taskmgmt.exe.TaskInstance getTaskInstance()
   {
      Init init = Init.instance(); //may be null in some tests
      if ( init==null || !init.isJbpmInstalled() )
      {
         return null;
      }
      else
      {
View Full Code Here

  
   private void registerConverterOrValidator(Context applicationContext)
   {
      if (applicationContext!=null) //for unit tests!
      {
         Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) );
         if (init!=null)
         {
            if ( getBeanClass().isAnnotationPresent(Converter.class) )
            {
               Converter converter = getBeanClass().getAnnotation(Converter.class);
               if ( converter.forClass()!=void.class )
               {
                  init.getConvertersByClass().put( converter.forClass(), getName() );
               }
               String id = converter.id().equals("") ? getName() : converter.id();
               init.getConverters().put( id, getName() );
            }
            if ( getBeanClass().isAnnotationPresent(Validator.class) )
            {
               Validator validator = getBeanClass().getAnnotation(Validator.class);
               String id = validator.id().equals("") ? getName() : validator.id();
               init.getValidators().put( id, getName() );
            }
         }
      }
   }
View Full Code Here

   private void initNamespaces(String componentName, Context applicationContext)
   {
      if (applicationContext!=null) //for unit tests!
      {
         Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) );
         if (init!=null)
         {
            Namespace namespace = init.getRootNamespace();
            StringTokenizer tokens = new StringTokenizer(componentName, ".");
            StringBuffer path = new StringBuffer();
            while ( tokens.hasMoreTokens() )
            {
               String token = tokens.nextToken();
View Full Code Here

            {
               checkDataModelScope( method.getAnnotation(DataModel.class) );
            }
            if ( method.isAnnotationPresent(org.jboss.seam.annotations.Factory.class) )
            {
               Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
               String contextVariable = toName( method.getAnnotation(org.jboss.seam.annotations.Factory.class).value(), method );
               init.addFactoryMethod(contextVariable, method, this);
               if ( method.getAnnotation(org.jboss.seam.annotations.Factory.class).autoCreate() )
               {
                  init.addAutocreateVariable(contextVariable);
               }
            }
            if ( method.isAnnotationPresent(Observer.class) )
            {
               Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
               Observer observer = method.getAnnotation(Observer.class);
               for ( String eventType : observer.value() )
               {
                  if ( eventType.length()==0 ) eventType = method.getName(); //TODO: new defaulting rule to map @Observer onFooEvent() -> event type "fooEvent"
                  init.addObserverMethod( eventType, method, this, observer.create() );
               }
            }
            if ( method.isAnnotationPresent(RequestParameter.class) )
            {
               RequestParameter rp = method.getAnnotation(RequestParameter.class);
View Full Code Here

TOP

Related Classes of org.jboss.seam.core.Init

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.