View Javadoc
1   package org.codehaus.plexus.component.manager;
2   
3   
4   /*
5    * Copyright 2001-2006 Codehaus Foundation.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   *
11   *      http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  import org.codehaus.plexus.MutablePlexusContainer;
21  import org.codehaus.plexus.personality.plexus.lifecycle.phase.PhaseExecutionException;
22  import org.codehaus.plexus.classworlds.realm.ClassRealm;
23  import org.codehaus.plexus.component.factory.ComponentInstantiationException;
24  import org.codehaus.plexus.component.repository.ComponentDescriptor;
25  import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
26  import org.codehaus.plexus.lifecycle.LifecycleHandler;
27  
28  import java.util.concurrent.atomic.AtomicLong;
29  
30  /**
31   * Manages a component manager.
32   * Determines when a component is shutdown, and when it's started up. Each
33   * manager deals with only one component class, though may handle multiple
34   * instances of this class.
35   *
36   * @author Jason van Zyl
37   *
38   * @version $Id$
39   */
40  public interface ComponentManager<T>
41  {
42      String ROLE = ComponentManager.class.getName();
43  
44      /**
45       * @deprecated for internal use only.. will be removed
46       */
47      AtomicLong NEXT_START_ID = new AtomicLong( 1 );
48  
49      int getConnections();
50  
51      /**
52       * @deprecated use start instead
53       */
54      LifecycleHandler getLifecycleHandler();
55  
56      void dispose()
57          throws ComponentLifecycleException;
58  
59      void release( Object component )
60          throws ComponentLifecycleException;
61  
62      T getComponent() throws ComponentInstantiationException, ComponentLifecycleException;
63  
64      ComponentDescriptor<T> getComponentDescriptor();
65  
66      Class<? extends T> getType();
67  
68      String getRole();
69  
70      String getRoleHint();
71  
72      MutablePlexusContainer getContainer();
73  
74      void dissociateComponentRealm( ClassRealm realm )
75          throws ComponentLifecycleException;
76  
77      ClassRealm getRealm();
78  
79      void start(Object component) throws PhaseExecutionException;
80  
81      /**
82       * @deprecated for internal use only.. will be removed
83       */
84      long getStartId();
85  }