View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  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,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.server.schema.bootstrap;
21  
22  import java.util.ArrayList;
23  import java.util.List;
24  
25  
26  /**
27   * Type safe enum for an BootstrapProducer tyoes.  This can be take one of the
28   * following values:
29   * <ul>
30   * <li>NormalizerProducer</li>
31   * <li>ComparatorProducer</li>
32   * <li>SyntaxCheckerProducer</li>
33   * <li>SyntaxProducer</li>
34   * <li>MatchingRuleProducer</li>
35   * <li>AttributeTypeProducer</li>
36   * <li>ObjectClassProducer</li>
37   * <li>MatchingRuleUseProducer</li>
38   * <li>DitContentRuleProducer</li>
39   * <li>NameFormProducer</li>
40   * <li>DitStructureRuleProducer</li>
41   * </ul>
42   *
43   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
44   * @version $Rev: 491471 $
45   */
46  public enum ProducerTypeEnum
47  {
48      /** value for Normalizer BootstrapProducers */
49      NORMALIZER_PRODUCER( 0 ),
50  
51      /** value for Comparator BootstrapProducers */
52      COMPARATOR_PRODUCER( 1 ),
53      
54      /** value for SyntaxChecker BootstrapProducers */
55      SYNTAX_CHECKER_PRODUCER( 2 ),
56      
57      /** value for Syntax BootstrapProducers */
58      SYNTAX_PRODUCER( 3 ),
59      
60      /** value for MatchingRule BootstrapProducers */
61      MATCHING_RULE_PRODUCER( 4 ),
62      
63      /** value for AttributeType BootstrapProducers */
64      ATTRIBUTE_TYPE_PRODUCER( 5 ),
65      
66      /** value for ObjectClass BootstrapProducers */
67      OBJECT_CLASS_PRODUCER( 6 ),
68      
69      /** value for MatchingRuleUse BootstrapProducers */
70      MATCHING_RULE_USE_PRODUCER( 7 ),
71      
72      /** value for DitContentRule BootstrapProducers */
73      DIT_CONTENT_RULE_PRODUCER( 8 ),
74      
75      /** value for NameForm BootstrapProducers */
76      NAME_FORM_PRODUCER( 9 ),
77      
78      /** value for DitStructureRule BootstrapProducers */
79      DIT_STRUCTURE_RULE_PRODUCER( 10 );
80      
81      private int value;
82  
83      /**
84       * Private construct so no other instances can be created other than the
85       * public static constants in this class.
86       *
87       * @param value the integer value of the enumeration.
88       */
89      private ProducerTypeEnum( int value )
90      {
91          this.value = value;
92      }
93  
94      /**
95       * @return return the value for this producer type
96       */
97      public int getValue()
98      {
99          return value;
100     }
101 
102     /**
103      * Gets the enumeration type for the attributeType producerType string regardless
104      * of case.
105      * 
106      * @param producerType the producerType string
107      * @return the producerType enumeration type
108      */
109     public static ProducerTypeEnum getProducerType( String producerType )
110     {
111         return valueOf( producerType );
112     }
113     
114     /**
115      * 
116      * @return A list of Producer Type
117      */
118     public static List<ProducerTypeEnum> getList()
119     {
120         List<ProducerTypeEnum> list = new ArrayList<ProducerTypeEnum>();
121         
122         list.add(NORMALIZER_PRODUCER );
123         list.add(COMPARATOR_PRODUCER );
124         list.add(SYNTAX_CHECKER_PRODUCER );
125         list.add(SYNTAX_PRODUCER );
126         list.add(MATCHING_RULE_PRODUCER );
127         list.add(ATTRIBUTE_TYPE_PRODUCER );
128         list.add(OBJECT_CLASS_PRODUCER );
129         list.add(MATCHING_RULE_USE_PRODUCER );
130         list.add(DIT_CONTENT_RULE_PRODUCER );
131         list.add(NAME_FORM_PRODUCER );
132         list.add(DIT_STRUCTURE_RULE_PRODUCER );
133         
134         return list;
135     }
136     
137     public String getName()
138     {
139         switch ( this )
140         {
141             case NORMALIZER_PRODUCER :
142                 return "NormalizerProducer";
143 
144             case COMPARATOR_PRODUCER :
145                 return "ComparatorProducer";
146             
147             case SYNTAX_CHECKER_PRODUCER :
148                 return "SyntaxCheckerProducer";
149             
150             case SYNTAX_PRODUCER :
151                 return "SyntaxProducer";
152             
153             case MATCHING_RULE_PRODUCER :
154                 return "MatchingRuleProducer";
155             
156             case ATTRIBUTE_TYPE_PRODUCER :
157                 return "AttributeTypeProducer";
158             
159             case OBJECT_CLASS_PRODUCER :
160                 return "ObjectClassProducer";
161             
162             case MATCHING_RULE_USE_PRODUCER:
163                 return "MatchingRuleUseProducer";
164             
165             case DIT_CONTENT_RULE_PRODUCER:
166                 return "DitContentRuleProducer";
167             
168             case NAME_FORM_PRODUCER :
169                 return "NameFormProducer";
170             
171             case DIT_STRUCTURE_RULE_PRODUCER :
172                 return "DitStructureRuleProducer";
173                 
174             default :
175                 return "";
176         }
177     }
178 }