Update of /cvsroot/commonjava/other-projects/marmalade/src/main/java/org/marmalade
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30096/src/main/java/org/marmalade
Added Files:
ConfigurationException.java MarmaladeFactory.java
Log Message:
initial checkin.
--- NEW FILE: MarmaladeFactory.java ---
/* Created on Mar 24, 2004 */
package org.marmalade;
import java.util.Map;
import org.codehaus.tagalog.Attributes;
import org.commonjava.reflection.FinderException;
import org.commonjava.reflection.ImplFinder;
import org.marmalade.el.ExpressionEvaluator;
/** Provide factory methods to retrieve specific implementations for various dynamic elements of
* the marmalade system.
*
* @author John Casey
*/
public final class MarmaladeFactory {
private static final String DEFAULT_EL_TYPE = "ognl";
private static final String EL_LOCK = "EL-LOCK".intern();
private static ExpressionEvaluator el;
/** Factory; deny construction.
*/
private MarmaladeFactory() {
}
public static ExpressionEvaluator getDefaultExpressionEvaluator()
throws ConfigurationException
{
return getExpressionEvaluator(DEFAULT_EL_TYPE);
}
public static ExpressionEvaluator getExpressionEvaluator(String type)
throws ConfigurationException
{
synchronized(EL_LOCK){
if(el == null){
try {
el = (ExpressionEvaluator)ImplFinder.findImplementation(
ExpressionEvaluator.class, new Object[]{}
);
}
catch (FinderException e) {
throw new ConfigurationException(
"Error retrieving ExpressionEvaluator implementation.", e
);
}
}
return el;
}
}
}
--- NEW FILE: ConfigurationException.java ---
/* Created on Mar 24, 2004 */
package org.marmalade;
import org.codehaus.tagalog.TagException;
/** Represents an error while executing a marmalade process, which is related to a
* misconfiguration of the marmalade environment.
*
* @author John Casey
*/
public class ConfigurationException extends TagException {
/** Create a new exception instance
* @param message The error message
*/
public ConfigurationException(String message) {
super(message);
}
/** Create a new exception instance
* @param message The error message
* @param cause The root cause which interrupted marmalade processing
*/
public ConfigurationException(String message, Throwable cause) {
super(message, cause);
}
}
|