public void linkObject(Object object, Object parent, Object linkinfo, QName[] pathname, AReadContext context) throws Exception { // Exchange parent for OAV children of configuration object. Map user = (Map)context.getUserContext(); IOAVState state = (IOAVState)user.get(OAVObjectReaderHandler.CONTEXT_STATE); if(state.isIdentifier(object)) { parent = getOAVConfiguration(uri, parent, context, user, state); } context.getTopStackElement().getReaderHandler().linkObject(object, parent, linkinfo, pathname, context); } };
public void linkObject(Object object, Object parent, Object linkinfo, QName[] pathname, AReadContext context) throws Exception { // Exchange parent for OAV children of root object. Map user = (Map)context.getUserContext(); IOAVState state = (IOAVState)user.get(OAVObjectReaderHandler.CONTEXT_STATE); if(state.isIdentifier(object)) { parent = getOAVRoot(uri, context, user, state); } context.getTopStackElement().getReaderHandler().linkObject(object, parent, linkinfo, pathname, context); } };
public Object postProcess(IContext context, Object object) { try { BDIXModel model = (BDIXModel)context.getRootObject(); MCapability mcapa = model.getCapability(); AReadContext ar = (AReadContext)context; Map<String, String> rawattrs = ar.getTopStackElement().getRawAttributes(); String service = rawattrs.get("class"); String method = rawattrs.get("method"); MGoal mgoal = (MGoal)ar.getStackElement(ar.getStackSize()-2).getObject(); Class<?> iface = SReflect.findClass(service, model.getAllImports(), ar.getClassLoader()); ClassInfo ci = new ClassInfo(iface.getName()); // Just use first method if no name is given if(method==null) method = iface.getDeclaredMethods()[0].getName(); mcapa.addGoalPublication(ci, mgoal, method); } catch(Exception e) { throw new RuntimeException(e); } return null; }
String bels = ar.getTopStackElement().getRawAttributes()==null? null: ar.getTopStackElement().getRawAttributes().get("beliefs"); if(bels!=null) String params = ar.getTopStackElement().getRawAttributes()==null? null: ar.getTopStackElement().getRawAttributes().get("parameters"); if(params!=null) String goals = ar.getTopStackElement().getRawAttributes()==null? null: ar.getTopStackElement().getRawAttributes().get("goals"); if(goals!=null) String rawevs = ar.getTopStackElement().getRawAttributes()==null? null: ar.getTopStackElement().getRawAttributes().get("rawevents"); if(rawevs!=null)
public void linkObject(Object object, Object parent, Object linkinfo, QName[] pathname, AReadContext context) throws Exception { if(object instanceof MElementRef && pathname[0].getLocalPart().equals("goals")) { ((BDIXModel)parent).getCapability().addGoalReference(((MElementRef)object).getName(), ((MElementRef)object).getRef()); } else if(object instanceof MElementRef && pathname[0].getLocalPart().equals("events")) { ((BDIXModel)parent).getCapability().addEventReference(((MElementRef)object).getName(), ((MElementRef)object).getRef()); } else if(object instanceof MElementRef && pathname[0].getLocalPart().equals("expressions")) { ((BDIXModel)parent).getCapability().addExpressionReference(((MElementRef)object).getName(), ((MElementRef)object).getRef()); } else { if(object instanceof MBelief || object instanceof MGoal || object instanceof MPlan || object instanceof MMessageEvent || object instanceof MInternalEvent || object instanceof MCapabilityReference || object instanceof MElementRef || (object instanceof UnparsedExpression && pathname[pathname.length-1].getLocalPart().equals("expression")) // hack for bdi expressions || (object instanceof MCondition && pathname[pathname.length-1].getLocalPart().equals("condition"))) { parent = ((BDIXModel)parent).getCapability(); } context.getTopStackElement().getReaderHandler().linkObject(object, parent, linkinfo, pathname, context); } } };
public void linkObject(Object object, Object parent, Object linkinfo, QName[] pathname, AReadContext context) throws Exception { boolean done = false; if(pathname[pathname.length-1].getLocalPart().startsWith("initial") || pathname[pathname.length-1].getLocalPart().startsWith("end")) { String config = ((ConfigurationInfo)parent).getName(); BDIXModel model = (BDIXModel)context.getStackElement(pathname.length-2).getObject(); parent = model.getCapability().getConfiguration(config); if(parent==null) { MConfiguration mconf = new MConfiguration(config); model.getCapability().addConfiguration(mconf); parent = mconf; } // initial capabilities. if(object instanceof String) { ((MConfiguration)parent).addInitialCapability(context.getStackElement(context.getStackSize()-1).getRawAttributes().get("ref"), (String)object); done = true; } } if(!done) { context.getTopStackElement().getReaderHandler().linkObject(object, parent, linkinfo, pathname, context); } } };
StackElement se = context.getTopStackElement(); context.getReporter().report("Unknown attribute info: "+attrinfo, "attribute error", context, se.getLocation()); StackElement se = context.getTopStackElement(); context.getReporter().report(e.toString(), "attribute error", context, se.getLocation()); StackElement se = context.getTopStackElement(); context.getReporter().report("Unhandled attribute: "+object+", "+xmlattrname+", "+attrpath, "unhandled attribute", context, se.getLocation());
StackElement se = context.getTopStackElement(); context.getReporter().report("Unknown attribute info: "+attrinfo, "attribute error", context, se.getLocation()); StackElement se = context.getTopStackElement(); context.getReporter().report(e.toString(), "attribute error", context, se.getLocation()); StackElement se = context.getTopStackElement(); context.getReporter().report("Unhandled attribute: "+object+", "+xmlattrname+", "+attrpath, "unhandled attribute", context, se.getLocation());
else if(context.getTopStackElement().getTag().equals(new QName(uri, "factadded"))) else if(context.getTopStackElement().getTag().equals(new QName(uri, "factremoved"))) else if(context.getTopStackElement().getTag().equals(new QName(uri, "factchanged"))) context.getTopStackElement().getReaderHandler().linkObject(object, parent, linkinfo, pathname, context);