public void transform(TransformationInfo information, EsbNode subject) throws Exception { org.apache.synapse.mediators.builtin.CallMediator callMediator = createCallMediator(subject); if (callMediator != null) { information.getParentSequence().addChild(callMediator); } TransformationInfo tmpInformation = new TransformationInfo(); tmpInformation.setParentSequence(information.getParentSequence()); tmpInformation.setTraversalDirection(information.getTraversalDirection()); tmpInformation.setOriginInSequence(information.getOriginInSequence()); tmpInformation.setOriginOutSequence(information.getOriginOutSequence()); tmpInformation.setPreviousNode(information.getPreviouNode()); tmpInformation.setSynapseConfiguration(information.getSynapseConfiguration()); tmpInformation.setCurrentAPI(information.getCurrentAPI()); tmpInformation.setCurrentProxy(information.getCurrentProxy()); tmpInformation.setCurrentReferredSequence(information.getCurrentReferredSequence()); tmpInformation.setMainSequence(information.getMainSequence()); if (((CallMediator) subject).getEndpointType() == CallMediatorEndpointType.INLINE) { doTransform( tmpInformation, ((CallMediator) subject) .getEndpointOutputConnector()); // to transform the mediators inside the mediator } doTransform( information, ((CallMediator) subject).getOutputConnector()); // continue in normal flow }
/** {@inheritDoc} */ public void transform(TransformationInfo info, EsbNode subject) throws TransformerException { // Check subject. Assert.isTrue(subject instanceof EndPoint, "Invalid subject"); DefaultEndPoint visualEP = (DefaultEndPoint) subject; DefaultEndpoint synapseEP = create(visualEP, visualEP.getEndPointName()); setEndpointToSendCallOrProxy(info, visualEP, synapseEP); if (!info.isEndPointFound) { info.isEndPointFound = true; info.firstEndPoint = visualEP; } if (visualEP.getOutputConnector() != null) { if (visualEP.getOutputConnector().getOutgoingLink() != null) { InputConnector nextInputConnector = visualEP.getOutputConnector().getOutgoingLink().getTarget(); if ((!(nextInputConnector instanceof SequenceInputConnector)) || ((((Sequence) nextInputConnector.eContainer()) .getOutputConnector() .get(0) .getOutgoingLink() != null) && (!(((Sequence) nextInputConnector.eContainer()) .getOutputConnector() .get(0) .getOutgoingLink() .getTarget() .eContainer() instanceof EndPoint)))) { info.setParentSequence(info.getOriginOutSequence()); info.setTraversalDirection(TransformationInfo.TRAVERSAL_DIRECTION_OUT); } else if (visualEP.getInputConnector().getIncomingLinks().get(0).getSource().eContainer() instanceof Sequence) { info.setParentSequence(info.getCurrentReferredSequence()); } } } List<EsbNode> transformedMediators = info.getTransformedMediators(); if (visualEP.getOutputConnector() != null && visualEP.getOutputConnector().getOutgoingLink() != null) { EsbNode nextElement = (EsbNode) visualEP.getOutputConnector().getOutgoingLink().getTarget().eContainer(); if (transformedMediators.contains(nextElement)) { return; } transformedMediators.add(nextElement); } // Transform endpoint output data flow. // TODO: find out why this was commented out. // might want to check if the flow is connected back to initial proxy // service doTransform(info, visualEP.getOutputConnector()); }