Package org.picocontainer

Examples of org.picocontainer.ComponentAdapter


      }

      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


      return result;
   }

   public Object getComponentInstance(Object componentKey) throws PicoException
   {
      ComponentAdapter componentAdapter = getComponentAdapter(componentKey);
      if (componentAdapter != null)
      {
         return getInstance(componentAdapter);
      }
      else
View Full Code Here

     * be found we get the instance from the {@link ComponentAdapter}.
     * @see org.picocontainer.PicoContainer#getComponentInstanceOfType(java.lang.Class)
     */
   public Object getComponentInstanceOfType(Class componentType)
   {
      final ComponentAdapter componentAdapter = getComponentAdapterOfType(componentType);
      if (componentAdapter == null)
         return null;
      Map<Object, Object> map = depResolutionCtx.get();
      if (map != null)
      {
         Object result = map.get(componentAdapter.getComponentKey());
         if (result != null)
         {
            return result;
         }
      }
View Full Code Here

   public ComponentAdapter unregisterComponentByInstance(Object componentInstance)
   {
      for (Iterator<ComponentAdapter> iterator = componentAdapters.iterator(); iterator.hasNext();)
      {
         ComponentAdapter componentAdapter = iterator.next();
         Object o;
         try
         {
            o = getInstance(componentAdapter);
         }
         catch (Exception e)
         {
            // Ignore me,
            // may be caused by lazy initialization mechanism
            continue;
         }
         if (componentInstance.equals(o))
         {
            return unregisterComponent(componentAdapter.getComponentKey());
         }
      }
      return null;
   }
View Full Code Here

   public void accept(PicoVisitor visitor)
   {
      visitor.visitContainer(this);
      for (Iterator<ComponentAdapter> iterator = componentAdapters.iterator(); iterator.hasNext();)
      {
         ComponentAdapter componentAdapter = iterator.next();
         componentAdapter.accept(visitor);
      }
      for (Iterator<PicoContainer> iterator = children.iterator(); iterator.hasNext();)
      {
         PicoContainer child = iterator.next();
         child.accept(visitor);
View Full Code Here

   public ComponentAdapter registerComponent(ComponentAdapter componentAdapter)
      throws DuplicateComponentKeyRegistrationException
   {
      if (tenantsContainerContext != null && tenantsContainerContext.accept(componentAdapter))
      {
         ComponentAdapter contextAdapter = tenantsContainerContext.registerComponent(componentAdapter);
         // check if the same adapter returned, if not - register the new in the super also
         if (contextAdapter == componentAdapter)
         {
            return componentAdapter;
         }
View Full Code Here

    * {@inheritDoc}
    */
   @Override
   public ComponentAdapter unregisterComponent(Object componentKey)
   {
      ComponentAdapter adapter = getComponentAdapter(componentKey);
      if (tenantsContainerContext != null && tenantsContainerContext.accept(adapter))
      {
         adapter = tenantsContainerContext.unregisterComponent(componentKey);
         if (adapter != null)
         {
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

      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

      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

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.