KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > hivemind > definition > DefinitionMessages


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.hivemind.definition;
16
17 import org.apache.hivemind.impl.MessageFormatter;
18
19 /**
20  * Used to format messages used in errors and log output for classes within the definition package.
21  *
22  * @author Achim Huegen
23  */

24 public class DefinitionMessages
25 {
26     private static final MessageFormatter _formatter = new MessageFormatter(DefinitionMessages.class,
27             "DefinitionStrings");
28     
29     public static String JavaDoc duplicateModuleId(String JavaDoc moduleId)
30     {
31         return _formatter.format(
32                 "duplicate-module-id",
33                 moduleId);
34     }
35
36     public static String JavaDoc wrongNumberOfContributions(ModuleDefinition definingModule, ConfigurationPointDefinition point, int actualCount,
37             Occurances expectation)
38     {
39         return _formatter.format(
40                 "wrong-number-of-contributions",
41                 point.getQualifiedId(),
42                 contributionCount(actualCount),
43                 occurances(expectation));
44     }
45
46     public static String JavaDoc duplicateServicePointId(String JavaDoc pointId, ModuleDefinition module)
47     {
48         return _formatter.format("duplicate-service-point", pointId, module.getId());
49     }
50
51     public static String JavaDoc duplicateConfigurationPointId(String JavaDoc pointId, ModuleDefinition module)
52     {
53         return _formatter.format("duplicate-configuration-point", pointId, module.getId());
54     }
55
56     public static String JavaDoc contributionCount(int count)
57     {
58         return _formatter.format("contribution-count", new Integer JavaDoc(count));
59     }
60
61     public static String JavaDoc occurances(Occurances occurances)
62     {
63         return _formatter.getMessage("occurances." + occurances.getName());
64     }
65
66     public static String JavaDoc dependencyOnUnknownModule(String JavaDoc toModuleId)
67     {
68         return _formatter.format("dependency-on-unknown-module", toModuleId);
69     }
70     
71     public static String JavaDoc unknownConfigurationPoint(String JavaDoc moduleId,
72             String JavaDoc configurationId)
73     {
74         return _formatter.format("unknown-configuration-extension-point", moduleId, configurationId);
75     }
76
77     public static String JavaDoc unknownServicePoint(String JavaDoc moduleId, String JavaDoc pointId)
78     {
79         return _formatter.format(
80                 "unknown-service-extension-point",
81                 moduleId,
82                 pointId);
83     }
84
85     public static String JavaDoc configurationPointNotVisible(ConfigurationPointDefinition point,
86             ModuleDefinition contributingModule)
87     {
88         return _formatter.format(
89                 "configuration-point-not-visible",
90                 point.getQualifiedId(),
91                 contributingModule.getId());
92     }
93
94     public static String JavaDoc duplicateParserInputFormat(String JavaDoc inputFormat, ConfigurationPointDefinition cp)
95     {
96         return _formatter.format("duplicate-parser-inputformat", inputFormat, cp.getQualifiedId());
97     }
98
99
100     public static String JavaDoc servicePointNotVisible(ServicePointDefinition point, ModuleDefinition contributingModule)
101     {
102         return _formatter.format(
103                 "service-point-not-visible",
104                 point.getQualifiedId(),
105                 contributingModule.getId());
106     }
107     
108 }
Popular Tags