Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MONDRIAN: Oops! (Forgot a couple of files.)
[git-p4: depot-paths = "//open/mondrian/": change = 159]
- Loading branch information
1 parent
b28e6aa
commit e005d75
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
// $Id$ | ||
// This software is subject to the terms of the Common Public License | ||
// Agreement, available at the following URL: | ||
// http://www.opensource.org/licenses/cpl.html. | ||
// (C) Copyright 2002 Kana Software, Inc. and others. | ||
// All Rights Reserved. | ||
// You must accept the terms of that agreement to use this software. | ||
// | ||
// jhyde, 19 September, 2002 | ||
*/ | ||
package mondrian.resource; | ||
|
||
import java.util.ResourceBundle; | ||
|
||
public class ResourceDefinition { | ||
//int code; | ||
public String key; | ||
public String baseMessage; | ||
//int severity; | ||
|
||
public ResourceDefinition(String key, String baseMessage) { | ||
this.key = key; | ||
this.baseMessage = baseMessage; | ||
} | ||
/** Creates an instance of this definition with a set of parameters. | ||
* Derived classes can override this factory method. **/ | ||
public ResourceInstance instantiate(ResourceBundle bundle, Object[] args) { | ||
return new Instance(bundle, this, args); | ||
} | ||
|
||
/** Default implementation of {@link ResourceInstance}. **/ | ||
private static class Instance implements ResourceInstance { | ||
ResourceDefinition definition; | ||
ResourceBundle bundle; | ||
Object[] args; | ||
public Instance(ResourceBundle bundle, ResourceDefinition definition, Object[] args) { | ||
this.definition = definition; | ||
this.bundle = bundle; | ||
this.args = args; | ||
} | ||
public String toString() { | ||
String message = bundle.getString(definition.key); | ||
return Util.formatError(message, args); | ||
} | ||
} | ||
} | ||
|
||
// End ResourceDefinition.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
// $Id$ | ||
// This software is subject to the terms of the Common Public License | ||
// Agreement, available at the following URL: | ||
// http://www.opensource.org/licenses/cpl.html. | ||
// (C) Copyright 2002 Kana Software, Inc. and others. | ||
// All Rights Reserved. | ||
// You must accept the terms of that agreement to use this software. | ||
// | ||
// jhyde, 19 September, 2002 | ||
*/ | ||
package mondrian.resource; | ||
|
||
import java.util.ResourceBundle; | ||
|
||
/** | ||
* A <code>ResourceInstance</code> is an occurrence of a {@link | ||
* ResourceDefinition} with a set of arguments. It can later be formatted to a | ||
* specific locale. | ||
*/ | ||
public interface ResourceInstance { | ||
public String toString(); | ||
} | ||
|
||
// End ResourceInstance.java |