View Javadoc

1   /*
2    * $Id: ComponentType.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.registry;
12  
13  /**
14   * Represents a Component type in the registry
15   * 
16   * @author <a href="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
17   * @version $Revision: 7976 $
18   */
19  public class ComponentType
20  {
21  
22      public static final ComponentType MULE_COMPONENT = new ComponentType("mule.engine",
23          "A Mule component type");
24      public static final ComponentType MULE_CONNECTOR_COMPONENT = new ComponentType("mule.binding",
25          "A Mule connector type");
26      public static final ComponentType MULE_TRANSFORMER_COMPONENT = new ComponentType("mule.transformer",
27          "A Mule transformer type");
28      public static final ComponentType MULE_AGENT_COMPONENT = new ComponentType("mule.agent",
29          "A Mule Agent type");
30      public static final ComponentType JBI_ENGINE_COMPONENT = new ComponentType("jbi.engine",
31          "A JBI engine component type");
32      public static final ComponentType JBI_BINDING_COMPONENT = new ComponentType("jbi.binding",
33          "A JBI binding component type");
34  
35      public static final ComponentType[] COMPONENT_TYPES = new ComponentType[]{MULE_COMPONENT, MULE_COMPONENT,
36          MULE_TRANSFORMER_COMPONENT, MULE_AGENT_COMPONENT, JBI_ENGINE_COMPONENT, JBI_BINDING_COMPONENT};
37  
38      private String name;
39      private String description;
40  
41      public ComponentType(String name, String description)
42      {
43          this.name = name;
44          this.description = description;
45      }
46  
47      public String getName()
48      {
49          return name;
50      }
51  
52      public String getDescription()
53      {
54          return description;
55      }
56  
57      public boolean equals(Object o)
58      {
59          if (this == o)
60          {
61              return true;
62          }
63          if (!(o instanceof ComponentType))
64          {
65              return false;
66          }
67  
68          final ComponentType componentType = (ComponentType)o;
69  
70          if (name != null ? !name.equals(componentType.name) : componentType.name != null)
71          {
72              return false;
73          }
74  
75          return true;
76      }
77  
78      public int hashCode()
79      {
80          return (name != null ? name.hashCode() : 0);
81      }
82  
83      public String toString()
84      {
85          return name;
86      }
87  }