@Override public boolean ownsPeerRootXDIArc(XDIArc peerRootXDIArc) { return GraphUtil.ownsPeerRootXDIArc(this.getGraph(), peerRootXDIArc); }
@Override protected XDILocalClientRoute routeInternal(XDIArc toPeerRootXDIArc) throws Xdi2AgentException { // check if we can provide the TO peer root if (toPeerRootXDIArc == null) { if (log.isDebugEnabled()) log.debug("Cannot route to unknown peer root. Skipping."); return null; } boolean ownsPeerRootXDIArc = false; if (ownsPeerRootXDIArc == false && this.getMessagingContainer() != null) ownsPeerRootXDIArc |= this.getMessagingContainer().ownsPeerRootXDIArc(toPeerRootXDIArc); if (ownsPeerRootXDIArc == false && this.getGraph() != null) ownsPeerRootXDIArc = GraphUtil.ownsPeerRootXDIArc(this.getGraph(), toPeerRootXDIArc); if (! ownsPeerRootXDIArc) { if (log.isDebugEnabled()) log.debug("Local messaging container " + (this.getMessagingContainer() == null ? null : this.getMessagingContainer().getClass().getSimpleName()) + " and graph " + (this.getGraph() == null ? null : this.getGraph().getClass().getSimpleName()) + " is no route to peer root " + toPeerRootXDIArc + " (" + ownsPeerRootXDIArc + "). Skipping."); return null; } // construct the route XDILocalClientRoute route = new XDILocalClientRoute(toPeerRootXDIArc, this.getMessagingContainer(), this.getGraph()); // add interceptors if supported if (this.getInterceptors() != null) { route.getInterceptors().addAll(this.getInterceptors()); } // done return route; }
public void testOwnsPeerRootXDIArc() throws Exception { Graph graph = MemoryGraphFactory.getInstance().parseGraph(TEST_GRAPH_DEREFERENCE); assertTrue(GraphUtil.ownsPeerRootXDIArc(graph, XDIArc.fromComponent(TEST_CONTEXTNODE_1111))); assertTrue(GraphUtil.ownsPeerRootXDIArc(graph, XDIArc.fromComponent(TEST_CONTEXTNODE_1a1a))); assertTrue(GraphUtil.ownsPeerRootXDIArc(graph, XDIArc.fromComponent(TEST_CONTEXTNODE_1b1b))); graph.close(); } }