public Object getPathElementObject(Object element) { return ((StackElement)element).getObject(); }
public Object getPathElementObject(Object element) { return ((StackElement)element).getObject(); }
public Object getPathElementObject(Object element) { return ((StackElement)element).getObject(); }
public Object getPathElementObject(Object element) { return ((StackElement)element).getObject(); }
public Object getPathElementObject(Object element) { return ((StackElement)element).getObject(); }
/** * Get the root object. * @return The root object. */ public Object getRootObject() { return rootobject!=null ? rootobject : stack!=null && !stack.isEmpty()? ((StackElement) stack.get(0)).getObject() : null; }
/** * */ public void removeStackElement() { StackElement elem = (StackElement)stack.remove(stack.size()-1); if(stack.size()==0) rootobject = elem.getObject(); }
public Object postProcess(IContext context, Object object) { MParameter mparam = (MParameter)object; mparam.setMulti(multi); // Init events. AReadContext ar = (AReadContext)context; MParameterElement pe = null; for(StackElement se: ar.getStack()) { if(se.getObject() instanceof MParameterElement) { pe = (MParameterElement)se.getObject(); } } mparam.initEvents(pe); return mparam; }
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; }
public void linkObject(Object object, Object parent, Object linkinfo, QName[] pathname, AReadContext context) throws Exception { if(object instanceof MCondition) { MGoal mgoal = (MGoal)parent; String condtype = pathname[pathname.length-1].getLocalPart(); condtype = condtype.substring(0, condtype.length()-9); mgoal.addCondition(condtype, (MCondition)object); } else if(object instanceof String && parent instanceof MGoal && context.getStackElement(context.getStackSize()-4).getObject() instanceof BDIXModel) { BDIXModel model = (BDIXModel)context.getStackElement(context.getStackSize()-4).getObject(); model.getCapability().addGoalReference(MElement.internalName((String)object), ((MElement)parent).getName()); } else { context.getDefaultHandler().linkObject(object, parent, linkinfo, pathname, context); } } };
for(int i=0; i<stack.size() && !rec; i++) if(object.equals(((StackElement)stack.get(i)).getObject())) throw new RuntimeException("Object structure contains cycles: Enable 'genids' mode for serialization.");
public void linkObject(Object object, Object parent, Object linkinfo, QName[] pathname, AReadContext context) throws Exception { if(object instanceof String && parent instanceof MBelief)// && context.getStackElement(context.getStackSize()-4).getObject() instanceof BDIXModel) { BDIXModel model = (BDIXModel)context.getStackElement(context.getStackSize()-4).getObject(); model.getCapability().addBeliefReference(MElement.internalName((String)object), ((MElement)parent).getName()); } // goals in condlinker else if(object instanceof String && parent instanceof MMessageEvent)// && context.getStackElement(context.getStackSize()-4).getObject() instanceof BDIXModel) { BDIXModel model = (BDIXModel)context.getStackElement(context.getStackSize()-4).getObject(); model.getCapability().addEventReference(MElement.internalName((String)object), ((MElement)parent).getName()); } else if(object instanceof String && parent instanceof MInternalEvent)// && context.getStackElement(context.getStackSize()-4).getObject() instanceof BDIXModel) { BDIXModel model = (BDIXModel)context.getStackElement(context.getStackSize()-4).getObject(); model.getCapability().addEventReference(MElement.internalName((String)object), ((MElement)parent).getName()); } else { super.linkObject(object, parent, linkinfo, pathname, context); } } };
if((topse.getObject()==null && topse.getContent()!=null && topse.getContent().trim().length()>0) || topse.getObject()==STRING_MARKER) Object val = topse.getContent()!=null? topse.getContent(): topse.getObject(); if(val instanceof String) if(topse.getObject()!=null && topse.getContent()!=null && topse.getContent().trim().length()>0) topse.getReaderHandler().handleAttributeValue(topse.getObject(), null, null, topse.getContent(), typeinfo.getContentInfo(), readcontext); final IPostProcessor[] postprocs = topse.getReaderHandler().getPostProcessors(topse.getObject(), typeinfo); if(postprocs!=null && postprocs.length>0) Object changed = postprocs[i].postProcess(readcontext, topse.getObject()); if(id!=null && topse.getObject()!=null) readcontext.getReadObjects().put(id, topse.getObject()); if(topse.getObject()!=null) List childs = readcontext.removeChildren(topse.getObject()); if(childs!=null) linker.bulkLinkObjects(topse.getObject(), childs, readcontext); ArrayList<jadex.xml.stax.QName> pathname = new ArrayList<jadex.xml.stax.QName>(); pathname.add(localname); for(int i=readcontext.getStackSize()-3; i>=0 && pse.getObject()==null; i--)
public void callPostProcessor() throws Exception { try { Object check = postprocs[fi].postProcess(readcontext, ftopse.getObject()); if(check!=null) { readcontext.getReporter().report("Object replacement only possible in first pass.", "postprocessor error", ftopse, ftopse.getLocation()); } } catch(Exception e) { // e.printStackTrace(); readcontext.getReporter().report("Error during postprocessing: "+e, "postprocessor error", stack, ftopse!=null ? ftopse.getLocation() : readcontext.getLocation()); } } });
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); } } };
MTrigger mtrig = (MTrigger)context.getStackElement(context.getStackSize()-3).getObject(); String ref = (String)context.getStackElement(context.getStackSize()-2).getRawAttributes().get("ref"); if(ref==null) MTrigger mtrig = (MTrigger)context.getStackElement(context.getStackSize()-2).getObject(); mtrig.addFactAdded(MElement.internalName((String)object)); MTrigger mtrig = (MTrigger)context.getStackElement(context.getStackSize()-2).getObject(); mtrig.addFactRemoved(MElement.internalName((String)object)); MTrigger mtrig = (MTrigger)context.getStackElement(context.getStackSize()-2).getObject(); mtrig.addFactChanged(MElement.internalName((String)object));