@Override
public void register(String name, Map<String, Expression> annotations) throws Exception
{
String qName = mExecutionState.getNamespaceManager().resolve(name);
RegisteredObject reg = null;
try
{
// see if the object is a type
Type type = mExecutionState.getUsedProcessingElements().getType(qName);
reg = new RegisteredObject(qName, type);
}
catch (UnknownTypeException e)
{
// it's not a type so check if it's a function
if (mExecutionState.getFunctions().containsKey(qName))
{
Function function = mExecutionState.getFunctions().get(qName);
reg = new RegisteredObject(qName, function);
}
else
{
// see if it's a variable, so we're registering an object
Variable value = mExecutionState.getVariables().get(name);
if (value != null)
{
reg = new RegisteredObject(qName, value);
}
}
}
if (reg != null)
{
for (Entry<String, Expression> annotation : annotations.entrySet())
{
Object value =
annotation.getValue().evaluate(mExecutionState.getVariables());
reg.addAnnotation(annotation.getKey(), value);
}
mRegistered.put(qName, reg);
}
else
{