* @param machine The virtual machine.
*/
public void initDefinitions(Machine machine)
{
Compiler compiler = new Compiler();
Lookup posMap = new HashTab();
for (Iterator defItr = m_definitionMap.valueIterator(); defItr.hasNext(); )
{
Definition def = (Definition)defItr.next();
for (Iterator typeItr = def.getTypesIterator(); typeItr.hasNext(); )
{
ModelType type = (ModelType)typeItr.next();
Object code = type.getCode();
PCodeFunction fun;
posMap.clear();
posMap.put(code, new TextPosition(0, 0, "definition:" + type.getGlobalName()));
fun = compiler.compile(code, posMap, machine, false);
machine.invoke(fun, (Pair)null);
}
for (Iterator intItr = def.getInterfacesIterator(); intItr.hasNext(); )
{
Interface iface = (Interface)intItr.next();
Object code = iface.getCode();
PCodeFunction fun;
posMap.clear();
posMap.put(code, new TextPosition(0, 0, "definition:" + iface.getGlobalName()));
fun = compiler.compile(code, posMap, machine, false);
machine.invoke(fun, (Pair)null);
}
for (Iterator svcItr = def.getServicesIterator(); svcItr.hasNext(); )
{
Service service = (Service)svcItr.next();
Object code = service.getCode();
PCodeFunction fun;
posMap.clear();
posMap.put(code, new TextPosition(0, 0, "definition:" + service.getGlobalName()));
fun = compiler.compile(code, posMap, machine, false);
machine.invoke(fun, (Pair)null);
}
}
for (Iterator implItr = m_implementationMap.valueIterator(); implItr.hasNext(); )
{
Implementation impl = (Implementation)implItr.next();
Object code = impl.getCode();
PCodeFunction fun;
posMap.clear();
posMap.put(code, new TextPosition(0, 0, "implementation:" + impl.getNamePrefix()));
try
{
machine.getGlobalEnvironment().defineVariable(Symbol.SYS_CURRENT_LOGGER,
Logger.getLogger(SysUtil.NAMESPACE + ".soa." +