View Javadoc
1   package org.codehaus.plexus.component.discovery;
2   
3   /*
4    * Copyright 2001-2006 Codehaus Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  
19  import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
20  
21  /**
22   * Signals to a ComponentDiscoveryListener that an event has taken place
23   * involving a set of components. It is up to the Listener to decide what
24   * to do with that information.
25   */
26  public class ComponentDiscoveryEvent {
27      private ComponentSetDescriptor componentSetDescriptor;
28  
29      private Object data;
30  
31      /**
32       * Constructs a <code>ComponentDiscoveryEvent</code> with a set of
33       * ComponentDescriptors.
34       * @param componentSetDescriptor a set of ComponentDescriptors
35       */
36      public ComponentDiscoveryEvent(ComponentSetDescriptor componentSetDescriptor) {
37          this.componentSetDescriptor = componentSetDescriptor;
38      }
39  
40      public ComponentDiscoveryEvent(ComponentSetDescriptor componentSetDescriptor, Object data) {
41          this.componentSetDescriptor = componentSetDescriptor;
42          this.data = data;
43      }
44  
45      /**
46       * Returns this event's set of ComponentDescriptors.
47       * @return this event's set of ComponentDescriptors
48       */
49      public ComponentSetDescriptor getComponentSetDescriptor() {
50          return componentSetDescriptor;
51      }
52  
53      public Object getData() {
54          return data;
55      }
56  }