* @throws UnsupportedOperationException if the operation is not specified
*/
public SQLExpression invokeOperation(String name, SQLExpression expr, SQLExpression expr2)
{
// Try to find an instance of the SQLOperation
SQLOperation operation = operationByOperationName.get(name);
if (operation != null)
{
return operation.getExpression(expr, expr2);
}
// Try a datastore-specific key
String datastoreId = storeMgr.getDatastoreAdapter().getVendorID();
String key = getSQLOperationKey(datastoreId, name);
String sqlOperationClassName = operationClassByDatastoreOperationName.get(key);
if (sqlOperationClassName == null)
{
// Try a datastore-independent key
key = getSQLOperationKey(null, name);
sqlOperationClassName = operationClassByDatastoreOperationName.get(key);
if (sqlOperationClassName == null)
{
throw new UnsupportedOperationException();
}
}
// Use SQLOperation().getExpression(SQLExpression, SQLExpression)
SQLStatement stmt = expr.getSQLStatement();
try
{
operation = (SQLOperation)stmt.getClassLoaderResolver().classForName(sqlOperationClassName).newInstance();
operation.setExpressionFactory(this);
operationByOperationName.put(name, operation);
return operation.getExpression(expr, expr2);
}
catch (ClassNotResolvedException cnre)
{
throw new NucleusException(LOCALISER.msg("060013", sqlOperationClassName));
}