Package org.picocontainer

Examples of org.picocontainer.ComponentAdapter


      List adapters = repositoryContainer.getComponentAdaptersOfType(WorkspaceContainer.class);
      List<String> workspaceNames = new ArrayList<String>();
      for (int i = 0; i < adapters.size(); i++)
      {
         ComponentAdapter adapter = (ComponentAdapter)adapters.get(i);
         String workspaceName = new String((String)adapter.getComponentKey());

         try
         {
            if (repositoryContainer.getWorkspaceContainer(workspaceName).getWorkspaceInitializer()
               .isWorkspaceInitialized())
View Full Code Here


         {
            log.error("Cannot add configuration " + overrideConfig + ". ServletContext: " + context, ex);
         }

         cService.processRemoveConfiguration();
         ComponentAdapter adapter = pcontainer.registerComponentInstance(ConfigurationManager.class, cService);
         pcontainer.initContainer();
         registerComponentInstance(portalContainerName, pcontainer);
         pcontainer.start();

         // Register the portal as an mbean
View Full Code Here

   }

   public ComponentAdapter registerComponentInstance(Object componentKey, Object componentInstance)
      throws PicoRegistrationException
   {
      ComponentAdapter adapter = super.registerComponentInstance(componentKey, componentInstance);
      if (managementContext != null)
      {
         managementContext.register(componentInstance);

         // Register if it is a management provider
View Full Code Here

      return Collections.unmodifiableSet(componentAdapters);
   }

   public final ComponentAdapter getComponentAdapter(Object componentKey) throws AmbiguousComponentResolutionException
   {
      ComponentAdapter adapter = componentKeyToAdapterCache.get(componentKey);
      if (adapter == null && parent != null)
      {
         adapter = parent.getComponentAdapter(componentKey);
      }
      return adapter;
View Full Code Here

   }

   public ComponentAdapter getComponentAdapterOfType(Class componentType)
   {
      // See http://jira.codehaus.org/secure/ViewIssue.jspa?key=PICO-115
      ComponentAdapter adapterByKey = getComponentAdapter(componentType);
      if (adapterByKey != null)
      {
         return adapterByKey;
      }

      List found = getComponentAdaptersOfType(componentType);

      if (found.size() == 1)
      {
         return ((ComponentAdapter)found.get(0));
      }
      else if (found.size() == 0)
      {
         if (parent != null)
         {
            return parent.getComponentAdapterOfType(componentType);
         }
         else
         {
            return null;
         }
      }
      else
      {
         Class[] foundClasses = new Class[found.size()];
         for (int i = 0; i < foundClasses.length; i++)
         {
            ComponentAdapter componentAdapter = (ComponentAdapter)found.get(i);
            foundClasses[i] = componentAdapter.getComponentImplementation();
         }

         throw new AmbiguousComponentResolutionException(componentType, foundClasses);
      }
   }
View Full Code Here

         return Collections.EMPTY_LIST;
      }
      List<ComponentAdapter> found = new ArrayList<ComponentAdapter>();
      for (Iterator<ComponentAdapter> iterator = componentAdapters.iterator(); iterator.hasNext();)
      {
         ComponentAdapter componentAdapter = iterator.next();

         if (componentType.isAssignableFrom(componentAdapter.getComponentImplementation()))
         {
            found.add(componentAdapter);
         }
      }
      return found;
View Full Code Here

   {
      SecurityManager security = System.getSecurityManager();
      if (security != null)
         security.checkPermission(ContainerPermissions.MANAGE_COMPONENT_PERMISSION);    
     
      ComponentAdapter adapter = componentKeyToAdapterCache.remove(componentKey);
      componentAdapters.remove(adapter);
      orderedComponentAdapters.remove(adapter);
      return adapter;
   }
View Full Code Here

         {
            pc.unregisterComponent(contrivedKey);
         }

      }
      ComponentAdapter componentAdapter = new InstanceComponentAdapter(componentKey, componentInstance);
      registerComponent(componentAdapter);
      return componentAdapter;
   }
View Full Code Here

    * passed to the container's constructor.
    */
   public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation,
      Parameter[] parameters) throws PicoRegistrationException
   {
      ComponentAdapter componentAdapter =
         componentAdapterFactory.createComponentAdapter(componentKey, componentImplementation, parameters);
      registerComponent(componentAdapter);
      return componentAdapter;
   }
View Full Code Here

      }

      Map<ComponentAdapter, Object> adapterToInstanceMap = new HashMap<ComponentAdapter, Object>();
      for (Iterator<ComponentAdapter> iterator = componentAdapters.iterator(); iterator.hasNext();)
      {
         ComponentAdapter componentAdapter = iterator.next();
         if (componentType.isAssignableFrom(componentAdapter.getComponentImplementation()))
         {
            Object componentInstance = getInstance(componentAdapter);
            adapterToInstanceMap.put(componentAdapter, componentInstance);

            // This is to ensure all are added. (Indirect dependencies will be added
View Full Code Here

TOP

Related Classes of org.picocontainer.ComponentAdapter

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.