Skip to content

Commit

Permalink
MONDRIAN: Oops! (Forgot a couple of files.)
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//open/mondrian/": change = 159]
  • Loading branch information
julianhyde committed Sep 20, 2002
1 parent b28e6aa commit e005d75
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/main/mondrian/resource/ResourceDefinition.java
@@ -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
25 changes: 25 additions & 0 deletions src/main/mondrian/resource/ResourceInstance.java
@@ -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

0 comments on commit e005d75

Please sign in to comment.