-package mir.config.exceptions;\r
-\r
+package mir.config.exceptions;
+
import multex.Failure;
-import java.io.*;\r
-\r
-public class ConfigFailure extends Failure {\r
- private String locationDescription;\r
- private Throwable cause;\r
-\r
- public ConfigFailure (String aMessage, Throwable aCause, String aLocationDescription) {\r
- super ("Configuration error at "+aLocationDescription+": "+aMessage,aCause);\r
-\r
- locationDescription = aLocationDescription;\r
- cause = aCause;\r
- }\r
-\r
- public ConfigFailure (String aMessage, String aLocationDescription) {\r
- this (aMessage, (Throwable) null, aLocationDescription);\r
- }\r
-\r
- public ConfigFailure (String aMessage) {\r
- this (aMessage, (Throwable) null, "?");\r
- }\r
-}\r
+import java.io.*;
+
+public class ConfigFailure extends Failure {
+ private String locationDescription;
+ private Throwable cause;
+
+ public ConfigFailure (String aMessage, Throwable aCause, String aLocationDescription) {
+ super ("Configuration error at "+aLocationDescription+": "+aMessage, aCause);
+
+ locationDescription = aLocationDescription;
+ cause = aCause;
+ }
+
+ public ConfigFailure (String aMessage, String aLocationDescription) {
+ this (aMessage, (Throwable) null, aLocationDescription);
+ }
+
+ public ConfigFailure (String aMessage) {
+ this (aMessage, (Throwable) null, "?");
+ }
+}
import java.io.*;
import org.apache.struts.util.MessageResources;
import mir.util.*;
+import mir.misc.*;
public class ResourceBundleProducerNode extends ProducerNodeDecorator {
private String key;
private String bundleIdentifier;
+ private String languageIdentifier;
public ResourceBundleProducerNode(String aKey, String aBundleIdentifier, ProducerNode aSubNode) {
super(aSubNode);
key = aKey;
}
+ public ResourceBundleProducerNode(String aKey, String aBundleIdentifier, String aLanguageIdentifier, ProducerNode aSubNode) {
+ super(aSubNode);
+
+ bundleIdentifier = aBundleIdentifier;
+ languageIdentifier = aLanguageIdentifier;
+ key = aKey;
+ }
+
public void produce(Map aValueMap, String aVerb, PrintWriter aLogger) throws ProducerFailure {
+ Object messages;
+
try {
- aValueMap.put(
- key,
+ if (languageIdentifier!=null) {
+ messages =
+ new MessageMethodModel(
+ new Locale(ParameterExpander.expandExpression( aValueMap, languageIdentifier ), null ),
+ MessageResources.getMessageResources(ParameterExpander.expandExpression( aValueMap, bundleIdentifier ))
+ );
+ }
+ else {
+ messages =
MessageResources.getMessageResources(
- ParameterExpander.expandExpression( aValueMap, bundleIdentifier ))
+ ParameterExpander.expandExpression( aValueMap, bundleIdentifier ));
+ }
+ aValueMap.put(
+ key, messages
);
super.produce(aValueMap, aVerb, aLogger);
import java.util.*;
import java.text.*;
+import mir.misc.*;
+
public class DateToMapAdapter extends AbstractMap {
Date date;
public Object get(Object aKey) {
if (aKey instanceof String) {
try {
- return new SimpleDateFormat((String) aKey).format(date);
+ // ML: quick fix to allow for the dc encoding now...
+ if (((String) aKey).equals("dc")) {
+ return StringUtil.date2w3DateTime(new GregorianCalendar());
+ }
+ else
+ return new SimpleDateFormat((String) aKey).format(date);
}
catch (Throwable t) {
throw new RuntimeException( "Can't format date with format " + (String) aKey + ": " + t.getMessage());