コード例 #1
0
  public OMElement serializeSpecificMediator(Mediator m) {

    if (!(m instanceof RelayTransformerMediator)) {
      handleException("Unsupported mediator passed in for serialization : " + m.getType());
    }

    RelayTransformerMediator mediator = (RelayTransformerMediator) m;
    OMElement relayTransformer = fac.createOMElement("relayTransformer", synNS);

    if (mediator.getXsltKey() != null) {
      // Serialize Value using ValueSerializer
      ValueSerializer keySerializer = new ValueSerializer();
      keySerializer.serializeValue(mediator.getXsltKey(), XMLConfigConstants.KEY, relayTransformer);
    } else {
      handleException("Invalid relayTransformer mediator. XSLT registry key is required");
    }
    saveTracingState(relayTransformer, mediator);

    if (mediator.getSource() != null) {

      SynapseXPathSerializer.serializeXPath(mediator.getSource(), relayTransformer, "source");
    }
    if (mediator.getTargetPropertyName() != null) {
      relayTransformer.addAttribute(
          fac.createOMAttribute("target", nullNS, mediator.getTargetPropertyName()));
    }
    if (mediator.getInputType() != null) {
      relayTransformer.addAttribute(
          fac.createOMAttribute("input", nullNS, mediator.getInputType()));
    }
    serializeProperties(relayTransformer, mediator.getProperties());
    List<MediatorProperty> features = mediator.getFeatures();
    if (!features.isEmpty()) {
      for (MediatorProperty mp : features) {
        OMElement prop = fac.createOMElement("feature", synNS, relayTransformer);
        if (mp.getName() != null) {
          prop.addAttribute(fac.createOMAttribute("name", nullNS, mp.getName()));
        } else {
          handleException("The Feature name is missing");
        }
        if (mp.getValue() != null) {
          prop.addAttribute(fac.createOMAttribute("value", nullNS, mp.getValue()));
        } else {
          handleException("The Feature value is missing");
        }
      }
    }
    serializeMediatorProperties(relayTransformer, mediator.getAttributes(), ATTRIBUTE_Q);

    ResourceMapSerializer.serializeResourceMap(relayTransformer, mediator.getResourceMap());

    return relayTransformer;
  }
コード例 #2
0
 /**
  * Add all the properties to the endpoint
  *
  * @param mediatorProperties <code>Collection</code> of properties to be added
  */
 public void addProperties(Collection<MediatorProperty> mediatorProperties) {
   for (MediatorProperty property : mediatorProperties) {
     properties.put(property.getName(), property);
   }
 }
コード例 #3
0
 /**
  * Add a property to the endpoint.
  *
  * @param property property to be added
  */
 public void addProperty(MediatorProperty property) {
   properties.put(property.getName(), property);
 }