rootNode = new Node();\r
}\r
\r
- public void check(ConfigNode aNode) throws ConfigException {\r
+ public void check(ConfigNode aNode) throws ConfigFailure {\r
getRootNode().check(aNode);\r
}\r
\r
addTypeConstraint(aPropertyName, aType);\r
}\r
\r
- public void check(ConfigNode aNode) throws ConfigException {\r
+ public void check(ConfigNode aNode) throws ConfigFailure {\r
Iterator iterator;\r
\r
iterator=constraints.iterator();\r
propertyName=aPropertyName;\r
}\r
\r
- public void check(ConfigNode aNode) throws ConfigException {\r
+ public void check(ConfigNode aNode) throws ConfigFailure {\r
};\r
}\r
\r
super(aPropertyName);\r
}\r
\r
- public void check(ConfigNode aNode) throws ConfigException {\r
+ public void check(ConfigNode aNode) throws ConfigFailure {\r
aNode.getRequiredStringProperty(propertyName);\r
};\r
}\r
type=aType;\r
}\r
\r
- public void check(ConfigNode aNode) throws ConfigException {\r
+ public void check(ConfigNode aNode) throws ConfigFailure {\r
switch(type) {\r
case INTEGER:\r
aNode.getOptionalIntegerProperty(propertyName, new Integer(0));\r
aNode.getOptionalBooleanProperty(propertyName, Boolean.FALSE);\r
break;\r
default:\r
- throw new ConfigException("Invalid value for type in type constraint: "+new Integer(type).toString());\r
+ throw new ConfigFailure("Invalid value for type in type constraint: "+new Integer(type).toString());\r
}\r
}\r
}\r
public String getLocationDescription();\r
\r
public ConfigNode getSubNode(String aSubNodeName);\r
- public Boolean getRequiredBooleanProperty(String aPropertyName) throws ConfigException;\r
- public Integer getRequiredIntegerProperty(String aPropertyName) throws ConfigException;\r
- public String getRequiredStringProperty(String aPropertyName) throws ConfigException;\r
- public Double getRequiredDoubleProperty(String aPropertyName) throws ConfigException;\r
- public Boolean getOptionalBooleanProperty(String aPropertyName, Boolean aDefaultValue) throws ConfigException;\r
- public Integer getOptionalIntegerProperty(String aPropertyName, Integer aDefaultValue) throws ConfigException;\r
- public String getOptionalStringProperty(String aPropertyName, String aDefaultValue) throws ConfigException;\r
- public Double getOptionalDoubleProperty(String aPropertyName, Double aDefaultValue) throws ConfigException;\r
+ public Boolean getRequiredBooleanProperty(String aPropertyName) throws ConfigFailure;\r
+ public Integer getRequiredIntegerProperty(String aPropertyName) throws ConfigFailure;\r
+ public String getRequiredStringProperty(String aPropertyName) throws ConfigFailure;\r
+ public Double getRequiredDoubleProperty(String aPropertyName) throws ConfigFailure;\r
+ public Boolean getOptionalBooleanProperty(String aPropertyName, Boolean aDefaultValue) throws ConfigFailure;\r
+ public Integer getOptionalIntegerProperty(String aPropertyName, Integer aDefaultValue) throws ConfigFailure;\r
+ public String getOptionalStringProperty(String aPropertyName, String aDefaultValue) throws ConfigFailure;\r
+ public Double getOptionalDoubleProperty(String aPropertyName, Double aDefaultValue) throws ConfigFailure;\r
}\r
super();\r
};\r
\r
- public void parseFile(String aFileName, ConfigNodeBuilder aRootNode) throws ConfigException {\r
+ public void parseFile(String aFileName, ConfigNodeBuilder aRootNode) throws ConfigFailure {\r
\r
try {\r
SAXParserFactory parserFactory = SAXParserFactory.newInstance();\r
handler.includeFile(aFileName);\r
}\r
catch (Throwable e) {\r
- if (e instanceof SAXParseException && ((SAXParseException) e).getException() instanceof ConfigException) {\r
- throw (ConfigException) ((SAXParseException) e).getException();\r
+ if (e instanceof SAXParseException && ((SAXParseException) e).getException() instanceof ConfigFailure) {\r
+ throw (ConfigFailure) ((SAXParseException) e).getException();\r
}\r
else {\r
e.printStackTrace();\r
- throw new ConfigException( e.getMessage() );\r
+ throw new ConfigFailure( e.getMessage() );\r
}\r
}\r
}\r
locator=aLocator;\r
}\r
\r
- private void includeFile(String aFileName) throws ConfigException, SAXParseException, SAXException {\r
+ private void includeFile(String aFileName) throws ConfigFailure, SAXParseException, SAXException {\r
File file;\r
SAXParser parser;\r
InputSource inputSource;\r
System.err.println("about to include "+file.getCanonicalPath());\r
\r
if (includeFileStack.contains(file.getCanonicalPath())) {\r
- throw new ConfigException("recursive inclusion of file "+file.getCanonicalPath(), getLocatorDescription(locator));\r
+ throw new ConfigFailure("recursive inclusion of file "+file.getCanonicalPath(), getLocatorDescription(locator));\r
}\r
\r
parser=parserFactory.newSAXParser();\r
}\r
}\r
catch (ParserConfigurationException e) {\r
- throw new ConfigException("Internal exception while including \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator));\r
+ throw new ConfigFailure("Internal exception while including \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator));\r
}\r
catch (SAXParseException e) {\r
throw e;\r
}\r
- catch (ConfigException e) {\r
+ catch (ConfigFailure e) {\r
throw e;\r
}\r
catch (FileNotFoundException e) {\r
- throw new ConfigException("Include file \""+aFileName+"\" not found: "+e.getMessage(), e, getLocatorDescription(locator));\r
+ throw new ConfigFailure("Include file \""+aFileName+"\" not found: "+e.getMessage(), e, getLocatorDescription(locator));\r
}\r
catch (IOException e) {\r
- throw new ConfigException("unable to open include file \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator));\r
+ throw new ConfigFailure("unable to open include file \""+aFileName+"\": "+e.getMessage(), e, getLocatorDescription(locator));\r
}\r
\r
}\r
level++;\r
try {\r
if (builder==null) {\r
- throw new ConfigException("define, include and property tags cannot have content", getLocatorDescription(locator));\r
+ throw new ConfigFailure("define, include and property tags cannot have content", getLocatorDescription(locator));\r
}\r
if (aQualifiedName.equals(propertyTagName)) {\r
String name=anAttributes.getValue(propertyNameAttribute);\r
String value=anAttributes.getValue(propertyValueAttribute);\r
\r
if (name==null) {\r
- throw new ConfigException("property has no name attribute", getLocatorDescription(locator));\r
+ throw new ConfigFailure("property has no name attribute", getLocatorDescription(locator));\r
}\r
else\r
if (value==null) {\r
- throw new ConfigException("property \""+name+"\" has no value attribute", getLocatorDescription(locator));\r
+ throw new ConfigFailure("property \""+name+"\" has no value attribute", getLocatorDescription(locator));\r
}\r
\r
builder.addProperty(name, definesManager.resolve(value, getLocatorDescription(locator)), value, getLocatorDescription(locator));\r
String value=anAttributes.getValue(defineValueAttribute);\r
\r
if (name==null) {\r
- throw new ConfigException("define has no name attribute", getLocatorDescription(locator));\r
+ throw new ConfigFailure("define has no name attribute", getLocatorDescription(locator));\r
}\r
else\r
if (value==null) {\r
- throw new ConfigException("define \""+name+"\" has no value attribute", getLocatorDescription(locator));\r
+ throw new ConfigFailure("define \""+name+"\" has no value attribute", getLocatorDescription(locator));\r
}\r
\r
definesManager.addDefine(name, definesManager.resolve(value, getLocatorDescription(locator)));\r
String fileName=anAttributes.getValue(includeFileAttribute);\r
\r
if (fileName==null) {\r
- throw new ConfigException("include has no file attribute", getLocatorDescription(locator));\r
+ throw new ConfigFailure("include has no file attribute", getLocatorDescription(locator));\r
}\r
\r
includeFile(definesManager.resolve(fileName, getLocatorDescription(locator)));\r
builder=builder.makeSubNode(aQualifiedName, getLocatorDescription(locator));\r
}\r
}\r
- catch (ConfigException e) {\r
+ catch (ConfigFailure e) {\r
throw new SAXParseException(e.getMessage(), locator, e);\r
}\r
}\r
public void characters(char[] aBuffer, int aStart, int anEnd) throws SAXParseException {\r
String text = new String(aBuffer, aStart, anEnd).trim();\r
if ( text.length() > 0) {\r
- throw new SAXParseException("Text not allowed", locator, new ConfigException("text not allowed", getLocatorDescription(locator)));\r
+ throw new SAXParseException("Text not allowed", locator, new ConfigFailure("text not allowed", getLocatorDescription(locator)));\r
}\r
}\r
}\r
defines.put(aName, anExpression);\r
}\r
\r
- public String resolve(String anExpression, String aLocation) throws ConfigException {\r
+ public String resolve(String anExpression, String aLocation) throws ConfigFailure {\r
int previousPosition = 0;\r
int position;\r
int endOfNamePosition;\r
}\r
}\r
else {\r
- throw new ConfigException("Missing }", aLocation);\r
+ throw new ConfigFailure("Missing }", aLocation);\r
}\r
\r
}\r
rootNode = aRootNode;\r
}\r
\r
- public MirConfiguration(String aFileName) throws ConfigException {\r
+ public MirConfiguration(String aFileName) throws ConfigFailure {\r
super();\r
rootNode = new ConfigSimpleNode();\r
\r
package mir.config.exceptions;\r
\r
-public class ConfigDefineNotKnownException extends ConfigException {\r
+public class ConfigDefineNotKnownException extends ConfigFailure {\r
public ConfigDefineNotKnownException(String aMessage, String aLocation) {\r
super (aMessage, aLocation);\r
}\r
+++ /dev/null
-package mir.config.exceptions;\r
-\r
-import java.io.*;\r
-\r
-public class ConfigException extends Exception {\r
- private String locationDescription;\r
- private Throwable cause;\r
-\r
- public ConfigException (String aMessage, Throwable aCause, String aLocationDescription) {\r
- super ("Configuration error at "+aLocationDescription+": "+aMessage);\r
-\r
- locationDescription = aLocationDescription;\r
- cause = aCause;\r
- }\r
-\r
- public ConfigException (String aMessage, String aLocationDescription) {\r
- this (aMessage, (Throwable) null, aLocationDescription);\r
- }\r
-\r
- public ConfigException (String aMessage) {\r
- this (aMessage, (Throwable) null, "?");\r
- }\r
-}\r
--- /dev/null
+package mir.config.exceptions;\r
+\r
+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
package mir.config.exceptions;\r
\r
-public class ConfigInvalidPropertyTypeException extends ConfigException {\r
+public class ConfigInvalidPropertyTypeException extends ConfigFailure {\r
public ConfigInvalidPropertyTypeException(String aMessage, String aLocation) {\r
super (aMessage, aLocation);\r
}\r
package mir.config.exceptions;\r
\r
-public class ConfigMissingPropertyException extends ConfigException {\r
+public class ConfigMissingPropertyException extends ConfigFailure {\r
public ConfigMissingPropertyException(String aMessage, String aLocation) {\r
super (aMessage, aLocation);\r
}\r
import java.io.*;
public interface Producer {
- public void produce( PrintWriter aLogger ) throws ProducerException;
+ public void produce( PrintWriter aLogger ) throws ProducerFailure;
}
+++ /dev/null
-package mir.producer;
-
-public class ProducerException extends Exception {
-
- public ProducerException(Throwable cause) {
- super(cause.getMessage());
- }
-}
\ No newline at end of file
import java.util.*;
public interface ProducerFactory {
- public Producer makeProducer(String aVerb) throws ProducerException;
+ public Producer makeProducer(String aVerb) throws ProducerFailure;
public Iterator verbs();
}
--- /dev/null
+package mir.producer;
+
+import multex.Failure;
+
+public class ProducerFailure extends Failure {
+
+ public ProducerFailure(String msg,Throwable cause) {
+ super(msg,cause);
+ }
+}
\ No newline at end of file
import java.io.*;
import mir.producer.*;
import mir.util.*;
+import multex.Exc;
+import multex.Failure;
public class ProducerEngine {
private Map producers;
log = new PrintWriter(new FileWriter(new File("/tmp/producer.log")));
}
catch (Exception e) {
- throw new RuntimeException(e.getMessage());
+ throw new ProducerEngineRuntimeExc("Creating PrintWriter log failed",e);
}
-
queueThread = new Thread(new ProducerJobQueueThread());
queueThread.start();
}
}
}
+
+ public static class ProducerEngineRuntimeExc extends Failure {
+ public ProducerEngineRuntimeExc(String msg, Exception cause){
+ super(msg,cause);
+ }
+ }
+
}
\ No newline at end of file
package mircoders.localizer;
-public class MirLocalizerException extends Exception {
+import multex.Exc;
+
+public class MirLocalizerException extends Exc {
public MirLocalizerException(String aMessage) {
super(aMessage);
}
- public MirLocalizerException(Throwable aCause) {
- super(aCause.getMessage());
- }
}
\ No newline at end of file
--- /dev/null
+package mircoders.localizer;
+
+import multex.Failure;
+
+public class MirLocalizerFailure extends Failure {
+ public MirLocalizerFailure(String msg, Throwable throwable) {
+ super(msg, throwable);
+ }
+}
public interface MirProducerToolLocalizer {
public void initializeGenerationValueSet(Map aValueSet);
- public PrintWriter openWriter(String anIdentifier) throws MirLocalizerException;
+ public PrintWriter openWriter(String anIdentifier) throws MirLocalizerFailure;
public void closeWriter(PrintWriter aWriter);
}
aValueSet.put("parentlist", parentList);
};
- public PrintWriter openWriter(String anIdentifier) throws MirLocalizerException {
+ public PrintWriter openWriter(String anIdentifier) throws MirLocalizerFailure {
File file;
File dir;
);
}
catch (Throwable t) {
- throw new MirLocalizerException(t);
+ throw new MirLocalizerFailure("Failure while opening a PrintWriter",t);
}
};
producers.add(aProducer);
}
- public void produce( PrintWriter aLogger ) throws ProducerException {
+ public void produce( PrintWriter aLogger ) throws ProducerFailure {
Iterator i;
i=producers.iterator();
}
}
- public mir.producer.Producer makeProducer(String aVerb) throws ProducerException {
+ public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure {
CompositeProducer result = new CompositeProducer();
Iterator i=factoriesForVerb(aVerb).iterator();
outputFileExpression = anOutputFileExpression;
}
- public void produce( PrintWriter aLogger ) throws ProducerException {
+ public void produce( PrintWriter aLogger ) throws ProducerFailure {
EntityContent content;
Map generationValues = new HashMap();
batchSize=aBatchSize;
}
- public mir.producer.Producer makeProducer(String aVerb) throws ProducerException {
+ public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure {
try {
QueryBuilder queryBuilder = new QueryBuilder();
outputFileNameExpression
);
} catch (Exception e) {
- throw new ProducerException(e);
+ throw new ProducerFailure("Creating Producer failed",e);
}
};
public NullProducer() {
}
- public void produce( PrintWriter aLogger ) throws ProducerException {
+ public void produce( PrintWriter aLogger ) throws ProducerFailure {
}
}
forced = aForced;
}
- public void produce( PrintWriter aLogger ) throws ProducerException {
+ public void produce( PrintWriter aLogger ) throws ProducerFailure {
try {
oldProducer.handle( aLogger, null, forced.booleanValue(), false );
}
catch (Throwable e) {
- throw new ProducerException(e);
+ throw new ProducerFailure("Failure at handling old Producers",e);
}
}
}
\ No newline at end of file
script = aScript;
}
- public void produce( PrintWriter aLogger ) throws ProducerException {
+ public void produce( PrintWriter aLogger ) throws ProducerFailure {
Process process;
int returnValue;
catch (Throwable e) {
aLogger.println("Exception has occurred: " + e.getMessage() + ":");
e.printStackTrace(aLogger);
- throw new ProducerException(e);
+ throw new ProducerFailure("Executing script failed",e);
}
}
}
script=aScript;
}
- public mir.producer.Producer makeProducer(String aVerb) throws ProducerException {
+ public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure {
return new ScriptCallProducer(script);
breakingNews = aBreakingNews;
}
- public void produce( PrintWriter aLogger ) throws ProducerException {
+ public void produce( PrintWriter aLogger ) throws ProducerFailure {
Map generationValues = new HashMap();
Map dataMap = new HashMap();
}
- public mir.producer.Producer makeProducer(String aVerb) throws ProducerException {
+ public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure {
try {
ModuleContent contentModule = new ModuleContent(DatabaseContent.getInstance());
breakingModule.getBreakingNews());
}
catch (Throwable e) {
- throw new ProducerException(e);
+ throw new ProducerFailure("Creating StartPageProducer failed",e);
}
};
outputFile=anOutputFile;
}
- public void produce( PrintWriter aLogger ) throws ProducerException {
+ public void produce( PrintWriter aLogger ) throws ProducerFailure {
Map generationValues = new HashMap();
Map dataMap = new HashMap();
}
- public mir.producer.Producer makeProducer(String aVerb) throws ProducerException {
+ public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure {
try {
return new StaticProducer( generatorIdentifier, resourceBundle, outputFile );
}
catch (Throwable e) {
- throw new ProducerException(e);
+ throw new ProducerFailure("Creating StaticProducer failed",e);
}
};
}
- public mir.producer.Producer makeProducer(String aVerb) throws ProducerException {
+ public mir.producer.Producer makeProducer(String aVerb) throws ProducerFailure {
CompositeProducer result = new CompositeProducer();
Map values = new HashMap();
}
catch (Throwable e) {
- throw new ProducerException(e);
+ throw new ProducerFailure("Creating TopicStartPageProducer failed",e);
}
};