示例#1
1
 public static OMElement serializeHandlerConfiguration(HandlerConfigurationBean bean) {
   OMFactory factory = OMAbstractFactory.getOMFactory();
   OMElement handler = factory.createOMElement("handler", null);
   handler.addAttribute(factory.createOMAttribute("class", null, bean.getHandlerClass()));
   if (bean.getTenant() != null) {
     handler.addAttribute(factory.createOMAttribute("tenant", null, bean.getTenant()));
   }
   StringBuilder sb = new StringBuilder();
   for (String method : bean.getMethods()) {
     if (method != null && method.length() > 0) {
       sb.append(method).append(",");
     }
   }
   // Remove last ","
   if (sb.length() > 0) {
     sb.deleteCharAt(sb.length() - 1);
     handler.addAttribute(factory.createOMAttribute("methods", null, sb.toString()));
   }
   for (String property : bean.getPropertyList()) {
     OMElement temp = factory.createOMElement("property", null);
     temp.addAttribute(factory.createOMAttribute("name", null, property));
     OMElement xmlProperty = bean.getXmlProperties().get(property);
     if (xmlProperty != null) {
       //                The serialization happens by adding the whole XML property value to the
       // bean.
       //                Therefore if it is a XML property, we take that whole element.
       handler.addChild(xmlProperty);
     } else {
       String nonXMLProperty = bean.getNonXmlProperties().get(property);
       if (nonXMLProperty != null) {
         temp.setText(nonXMLProperty);
         handler.addChild(temp);
       }
     }
   }
   OMElement filter = factory.createOMElement("filter", null);
   filter.addAttribute(
       factory.createOMAttribute("class", null, bean.getFilter().getFilterClass()));
   for (String property : bean.getFilter().getPropertyList()) {
     OMElement temp = factory.createOMElement("property", null);
     temp.addAttribute(factory.createOMAttribute("name", null, property));
     OMElement xmlProperty = bean.getFilter().getXmlProperties().get(property);
     if (xmlProperty != null) {
       temp.addAttribute(factory.createOMAttribute("type", null, "xml"));
       temp.addChild(xmlProperty);
       filter.addChild(temp);
     } else {
       String nonXMLProperty = bean.getFilter().getNonXmlProperties().get(property);
       if (nonXMLProperty != null) {
         temp.setText(nonXMLProperty);
         filter.addChild(temp);
       }
     }
   }
   handler.addChild(filter);
   return handler;
 }
 private static void addPropertyElements(
     OMFactory factory,
     OMElement parent,
     String className,
     String description,
     Map<String, String> properties) {
   if (className != null) {
     parent.addAttribute(UserCoreConstants.RealmConfig.ATTR_NAME_CLASS, className, null);
   }
   if (description != null) {
     parent.addAttribute(UserCoreConstants.RealmConfig.CLASS_DESCRIPTION, description, null);
   }
   Iterator<Map.Entry<String, String>> ite = properties.entrySet().iterator();
   while (ite.hasNext()) {
     Map.Entry<String, String> entry = ite.next();
     String name = entry.getKey();
     String value = entry.getValue();
     OMElement propElem =
         factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_PROPERTY));
     OMAttribute propAttr =
         factory.createOMAttribute(UserCoreConstants.RealmConfig.ATTR_NAME_PROP_NAME, null, name);
     propElem.addAttribute(propAttr);
     propElem.setText(value);
     parent.addChild(propElem);
   }
 }
  private OMNode createStatementElement(Statement statement) {

    OMElement stmntElt =
        fac.createOMElement(AbstractDBMediatorFactory.STMNT_Q.getLocalPart(), synNS);

    OMElement sqlElt = fac.createOMElement(AbstractDBMediatorFactory.SQL_Q.getLocalPart(), synNS);
    OMText sqlText = fac.createOMText(statement.getRawStatement(), XMLStreamConstants.CDATA);
    sqlElt.addChild(sqlText);
    stmntElt.addChild(sqlElt);

    // serialize parameters of the statement
    for (Statement.Parameter param : statement.getParameters()) {
      OMElement paramElt = createStatementParamElement(param);
      stmntElt.addChild(paramElt);
    }

    // serialize any optional results of the statement
    for (String name : statement.getResultsMap().keySet()) {

      String columnStr = statement.getResultsMap().get(name);

      OMElement resultElt =
          fac.createOMElement(AbstractDBMediatorFactory.RESULT_Q.getLocalPart(), synNS);

      resultElt.addAttribute(fac.createOMAttribute("name", nullNS, name));
      resultElt.addAttribute(fac.createOMAttribute("column", nullNS, columnStr));

      stmntElt.addChild(resultElt);
    }

    return stmntElt;
  }
  public static OMElement outputMappingToOM(OutputMapping outputMapping, OMFactory factory) {

    MapOutputMapping mapOutputMapping = (MapOutputMapping) outputMapping;

    List<EventOutputProperty> outputPropertyConfiguration =
        mapOutputMapping.getOutputPropertyConfiguration();

    OMElement mappingOMElement =
        factory.createOMElement(new QName(EventFormatterConstants.EF_ELE_MAPPING_PROPERTY));
    mappingOMElement.declareDefaultNamespace(EventFormatterConstants.EF_CONF_NS);

    mappingOMElement.addAttribute(
        EventFormatterConstants.EF_ATTR_TYPE, EventFormatterConstants.EF_MAP_MAPPING_TYPE, null);

    if (mapOutputMapping.isCustomMappingEnabled()) {
      mappingOMElement.addAttribute(
          EventFormatterConstants.EF_ATTR_CUSTOM_MAPPING,
          EventFormatterConstants.TM_VALUE_ENABLE,
          null);

      if (outputPropertyConfiguration.size() > 0) {
        for (EventOutputProperty eventOutputProperty : outputPropertyConfiguration) {
          mappingOMElement.addChild(getPropertyOmElement(factory, eventOutputProperty));
        }
      }
    } else {
      mappingOMElement.addAttribute(
          EventFormatterConstants.EF_ATTR_CUSTOM_MAPPING,
          EventFormatterConstants.TM_VALUE_DISABLE,
          null);
    }
    return mappingOMElement;
  }
示例#5
0
 public OMElement buildXML() {
   OMFactory fac = OMAbstractFactory.getOMFactory();
   OMElement confEl = fac.createOMElement("config", null);
   if (this.getId() != null) {
     confEl.addAttribute("id", this.getId(), null);
   }
   /* build properties */
   Iterator<Property> iterator = this.getProperties().iterator();
   while (iterator.hasNext()) {
     Property property = iterator.next();
     if (this.isUseSecretAliasForPassword()
         && (property.getName().equals(RDBMS.PASSWORD)
             || property.getName().equals(RDBMS_OLD.PASSWORD)
             || property.getName().equals(GSpread.PASSWORD)
             || property.getName().equals(JNDI.PASSWORD))) {
       OMFactory factory = OMAbstractFactory.getOMFactory();
       OMElement propEl = factory.createOMElement("property", null);
       propEl.addAttribute("name", property.getName(), null);
       propEl.addAttribute("svns:secretAlias", (String) property.getValue(), null);
       confEl.addChild(propEl);
     } else {
       if (property.buildXML() != null) {
         confEl.addChild(property.buildXML());
       }
     }
   }
   return confEl;
 }
示例#6
0
  public OMElement toOM() {

    OMFactory omFactory = OMAbstractFactory.getOMFactory();

    OMElement targetElement =
        omFactory.createOMElement(
            Constants.RULE_CONF_ELE_TARGET,
            Constants.RULE_CONF_NAMESPACE,
            Constants.RULE_CONF_NAMESPACE_PREFIX);
    if (this.xpath != null) {
      targetElement.addAttribute(Constants.RULE_CONF_ATTR_XPATH, this.xpath, null);
    }

    if (this.resultXpath != null) {
      targetElement.addAttribute(Constants.RULE_CONF_ATTR_RESULT_XPATH, this.resultXpath, null);
    }

    if (this.action != null) {
      targetElement.addAttribute(Constants.RULE_CONF_ATTR_ACTION, this.action, null);
    }

    if (this.value != null) {
      targetElement.setText(this.value);
    }

    if (this.prefixToNamespaceMap != null) {

      for (String prefix : this.prefixToNamespaceMap.keySet()) {

        String nsURI = this.prefixToNamespaceMap.get(prefix);
        targetElement.declareNamespace(nsURI, prefix);
      }
    }
    return targetElement;
  }
  public OMElement serializeMediator(OMElement parent, Mediator m) {

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

    OMElement aggregator = fac.createOMElement("aggregate", synNS);
    saveTracingState(aggregator, mediator);

    assert mediator != null;
    if (mediator.getCorrelateExpression() != null) {
      OMElement corelateOn = fac.createOMElement("correlateOn", synNS);
      SynapseXPathSerializer.serializeXPath(
          mediator.getCorrelateExpression(), corelateOn, "expression");
      aggregator.addChild(corelateOn);
    }

    OMElement completeCond = fac.createOMElement("completeCondition", synNS);
    if (mediator.getCompletionTimeoutMillis() != 0) {
      completeCond.addAttribute(
          "timeout", Long.toString(mediator.getCompletionTimeoutMillis() / 1000), nullNS);
    }
    OMElement messageCount = fac.createOMElement("messageCount", synNS);
    if (mediator.getMinMessagesToComplete() != 0) {
      messageCount.addAttribute(
          "min", Integer.toString(mediator.getMinMessagesToComplete()), nullNS);
    }
    if (mediator.getMaxMessagesToComplete() != 0) {
      messageCount.addAttribute(
          "max", Integer.toString(mediator.getMaxMessagesToComplete()), nullNS);
    }
    completeCond.addChild(messageCount);
    aggregator.addChild(completeCond);

    OMElement onCompleteElem = fac.createOMElement("onComplete", synNS);
    if (mediator.getAggregationExpression() != null) {
      SynapseXPathSerializer.serializeXPath(
          mediator.getAggregationExpression(), onCompleteElem, "expression");
    }
    if (mediator.getOnCompleteSequenceRef() != null) {
      onCompleteElem.addAttribute("sequence", mediator.getOnCompleteSequenceRef(), nullNS);
    } else if (mediator.getOnCompleteSequence() != null) {
      new SequenceMediatorSerializer()
          .serializeChildren(onCompleteElem, mediator.getOnCompleteSequence().getList());
    }
    aggregator.addChild(onCompleteElem);

    if (parent != null) {
      parent.addChild(aggregator);
    }

    return aggregator;
  }
  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;
  }
  public final OMElement getParameters() {
    OMFactory omFactory = OMAbstractFactory.getOMFactory();

    OMElement parameters = omFactory.createOMElement("parameters", null);

    for (Map.Entry<Integer, Integer> e : this.users.entrySet()) {
      OMElement user = omFactory.createOMElement("user_item", null);
      user.addAttribute("id", e.getKey().toString(), null);
      user.addAttribute("version", e.getValue().toString(), null);

      parameters.addChild(user);
    }
    return parameters;
  }
  public OMElement serialize(OMFactory fac) {

    if (log.isDebugEnabled() || log.isTraceEnabled()) {
      log.debug("Serialize command");
    }

    /*
     * org.apache.axiom.om.OMNamespace nullNS = fac.createOMNamespace(
     * XMLConfigConstants.NULL_NAMESPACE, "");
     */
    ValueSerializer valueSerializer = new ValueSerializer();

    OMElement root = AuditMediatorUtils.createTag(fac, this.type);

    for (Iterator iterator = params.iterator(); iterator.hasNext(); ) {
      Param param = (Param) iterator.next();

      OMElement paramTag = AuditMediatorUtils.createTag(fac, AuditMediatorUtils.PARAM_TAG_NAME);

      root.addChild(paramTag);

      paramTag.addAttribute(
          fac.createOMAttribute(
              AuditMediatorUtils.NAME_ATT_NAME, AuditMediatorUtils.nullNS, param.getName()));

      valueSerializer.serializeValue(param.getValue(), AuditMediatorUtils.VALUE_ATT_NAME, paramTag);
    }

    return root;
  }
示例#11
0
 private OMElement resolveImports(
     OMElement grammarsElement, String wadlBaseUri, String wadlVersion) throws RegistryException {
   String wadlNamespace = grammarsElement.getNamespace().getNamespaceURI();
   Iterator<OMElement> grammarElements =
       grammarsElement.getChildrenWithName(new QName(wadlNamespace, "include"));
   while (grammarElements.hasNext()) {
     OMElement childElement = grammarElements.next();
     OMAttribute refAttr = childElement.getAttribute(new QName("href"));
     String importUrl = refAttr.getAttributeValue();
     if (importUrl.endsWith(".xsd")) {
       if (!importUrl.startsWith("http")) {
         if (registry.resourceExists(importUrl)) {
           continue;
         } else {
           if (wadlBaseUri != null) {
             importUrl = wadlBaseUri + importUrl;
           }
         }
       }
       String schemaPath = saveSchema(importUrl, wadlVersion);
       importedSchemas.add(schemaPath);
       refAttr.setAttributeValue(schemaPath);
       childElement.addAttribute(refAttr);
     }
   }
   return grammarsElement;
 }
示例#12
0
  /**
   * Method processAttributes.
   *
   * @param node
   */
  protected void processAttributes(OMElement node) {
    int attribCount = parser.getAttributeCount();
    for (int i = 0; i < attribCount; i++) {
      String uri = parser.getAttributeNamespace(i);
      String prefix = parser.getAttributePrefix(i);

      OMNamespace namespace = null;
      if (uri != null && uri.length() > 0) {

        // prefix being null means this elements has a default namespace or it has inherited
        // a default namespace from its parent
        namespace = node.findNamespace(uri, prefix);
        if (namespace == null) {
          if (prefix == null || "".equals(prefix)) {
            prefix = OMSerializerUtil.getNextNSPrefix();
          }
          namespace = node.declareNamespace(uri, prefix);
        }
      }

      // todo if the attributes are supposed to namespace qualified all the time
      // todo then this should throw an exception here

      OMAttribute attr =
          node.addAttribute(
              parser.getAttributeLocalName(i), parser.getAttributeValue(i), namespace);
      attr.setAttributeType(parser.getAttributeType(i));
    }
  }
示例#13
0
 public static OMElement queryToOM(Query query) {
   OMFactory factory = OMAbstractFactory.getOMFactory();
   OMElement queryChild =
       factory.createOMElement(
           new QName(
               CEPConstants.CEP_CONF_NAMESPACE,
               CEPConstants.CEP_CONF_ELE_QUERY,
               CEPConstants.CEP_CONF_CEP_NAME_SPACE_PREFIX));
   Expression queryExpression = query.getExpression();
   String queryName = query.getName();
   OMElement queryIP = null;
   List<String> ipList = query.getIpList();
   for (String ip : ipList) {
     queryIP = factory.createOMElement(new QName(CEPConstants.CEP_CONF_QUERY_IP));
     queryIP.setText(ip);
     queryChild.addChild(queryIP);
   }
   queryChild.addAttribute(CEPConstants.CEP_CONF_ATTR_NAME, queryName, null);
   OMElement omQueryExpression = ExpressionHelper.expressionToOM(queryExpression);
   queryChild.addChild(omQueryExpression);
   if (query.getOutput() != null) {
     OMElement queryOutput = OutputHelper.outputToOM(query.getOutput());
     queryChild.addChild(queryOutput);
   }
   return queryChild;
 }
  public OMElement serialize(OMElement parent) {
    OMElement spring = fac.createOMElement("spring", sprNS);

    if (beanName != null) {
      spring.addAttribute(fac.createOMAttribute("bean", nullNS, beanName));
    } else {
      throw new MediatorException("Invalid mediator. Bean name required.");
    }
    saveTracingState(spring, this);

    if (configKey != null) {
      spring.addAttribute(fac.createOMAttribute("key", nullNS, configKey));
    }

    if (parent != null) {
      parent.addChild(spring);
    }

    return spring;
  }
  @Override
  public OMElement getMessageFromXML() {
    if (!validate()) {
      return null;
    }
    AxiomUtil axiom = AxiomUtil.getInstance();

    OMElement root = axiom.createOMElement(EbXML.Association, Namespace.RIM3);
    root.addAttribute("id", this.getId(), null);
    root.addAttribute("objectType", ProvideAndRegistryDocumentSet_B_UUIDs.ASSOCIATION, null);

    root.addAttribute("sourceObject", association.getSourceObject(), null);
    root.addAttribute("targetObject", association.getTargetObject(), null);
    root.addAttribute("associationType", association.getAssociation(), null);

    if (association.getNote() != null) {
      OMElement slot = generateSlot("SubmissionSetStatus", new String[] {association.getNote()});
      root.addChild(slot);
    }
    return root;
  }
  private OMNode createPoolElement(AbstractDBMediator mediator) {
    OMElement poolElt = fac.createOMElement("pool", synNS);
    for (Object o : mediator.getDataSourceProps().keySet()) {

      String value = mediator.getDataSourceProps().get(o);

      if (o instanceof QName) {
        QName name = (QName) o;
        OMElement elt = fac.createOMElement(name.getLocalPart(), synNS);
        elt.setText(value);
        poolElt.addChild(elt);

      } else if (o instanceof String) {
        OMElement elt = fac.createOMElement(AbstractDBMediatorFactory.PROP_Q.getLocalPart(), synNS);
        elt.addAttribute(fac.createOMAttribute("name", nullNS, (String) o));
        elt.addAttribute(fac.createOMAttribute("value", nullNS, value));
        poolElt.addChild(elt);
      }
    }
    return poolElt;
  }
示例#17
0
 private void addClaimType(OMElement parent, String[] claimUris) {
   OMElement element = null;
   // For each and every claim uri, create an <ClaimType/> elem
   for (String attr : claimUris) {
     element =
         parent
             .getOMFactory()
             .createOMElement(
                 new QName("http://schemas.xmlsoap.org/ws/2005/05/identity", "ClaimType", "wsid"),
                 parent);
     element.addAttribute(parent.getOMFactory().createOMAttribute("Uri", null, attr));
   }
 }
  public static OMElement outputMappingToOM(OutputMapping outputMapping, OMFactory factory) {

    JSONOutputMapping jsonOutputMapping = (JSONOutputMapping) outputMapping;

    OMElement mappingOMElement =
        factory.createOMElement(new QName(EventPublisherConstants.EF_ELEMENT_MAPPING));
    mappingOMElement.declareDefaultNamespace(EventPublisherConstants.EF_CONF_NS);

    mappingOMElement.addAttribute(
        EventPublisherConstants.EF_ATTR_TYPE, EventPublisherConstants.EF_JSON_MAPPING_TYPE, null);

    if (jsonOutputMapping.isCustomMappingEnabled()) {
      mappingOMElement.addAttribute(
          EventPublisherConstants.EF_ATTR_CUSTOM_MAPPING,
          EventPublisherConstants.ENABLE_CONST,
          null);

      OMElement innerMappingElement;
      if (jsonOutputMapping.isRegistryResource()) {
        innerMappingElement =
            factory.createOMElement(new QName(EventPublisherConstants.EF_ELE_MAPPING_REGISTRY));
        innerMappingElement.declareDefaultNamespace(EventPublisherConstants.EF_CONF_NS);
      } else {
        innerMappingElement =
            factory.createOMElement(new QName(EventPublisherConstants.EF_ELE_MAPPING_INLINE));
        innerMappingElement.declareDefaultNamespace(EventPublisherConstants.EF_CONF_NS);
      }
      mappingOMElement.addChild(innerMappingElement);
      innerMappingElement.setText(jsonOutputMapping.getMappingText());
    } else {
      mappingOMElement.addAttribute(
          EventPublisherConstants.EF_ATTR_CUSTOM_MAPPING,
          EventPublisherConstants.TM_VALUE_DISABLE,
          null);
    }

    return mappingOMElement;
  }
  private static OMElement getPropertyOmElement(
      OMFactory factory, EventOutputProperty eventOutputProperty) {

    OMElement propertyOMElement =
        factory.createOMElement(new QName(EventFormatterConstants.EF_ELE_PROPERTY));
    propertyOMElement.declareDefaultNamespace(EventFormatterConstants.EF_CONF_NS);

    OMElement fromElement =
        factory.createOMElement(new QName(EventFormatterConstants.EF_ELE_FROM_PROPERTY));
    fromElement.declareDefaultNamespace(EventFormatterConstants.EF_CONF_NS);
    fromElement.addAttribute(
        EventFormatterConstants.EF_ATTR_NAME, eventOutputProperty.getValueOf(), null);

    OMElement toElement =
        factory.createOMElement(new QName(EventFormatterConstants.EF_ELE_TO_PROPERTY));
    toElement.declareDefaultNamespace(EventFormatterConstants.EF_CONF_NS);
    toElement.addAttribute(
        EventFormatterConstants.EF_ATTR_NAME, eventOutputProperty.getName(), null);

    propertyOMElement.addChild(fromElement);
    propertyOMElement.addChild(toElement);

    return propertyOMElement;
  }
示例#20
0
  private void createAndSendSOAPResponse(
      Map<String, Object> serviceResults, String serviceName, HttpServletResponse response)
      throws EventHandlerException {
    try {
      // setup the response
      Debug.logVerbose("[EventHandler] : Setting up response message", module);
      String xmlResults = SoapSerializer.serialize(serviceResults);
      // Debug.logInfo("xmlResults ==================" + xmlResults, module);
      XMLStreamReader reader =
          XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xmlResults));
      StAXOMBuilder resultsBuilder = new StAXOMBuilder(reader);
      OMElement resultSer = resultsBuilder.getDocumentElement();

      // create the response soap
      SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
      SOAPEnvelope resEnv = factory.createSOAPEnvelope();
      SOAPBody resBody = factory.createSOAPBody();
      OMElement resService = factory.createOMElement(new QName(serviceName + "Response"));
      resService.addChild(resultSer.getFirstElement());
      resBody.addChild(resService);
      resEnv.addChild(resBody);

      // The declareDefaultNamespace method doesn't work see
      // (https://issues.apache.org/jira/browse/AXIS2-3156)
      // so the following doesn't work:
      // resService.declareDefaultNamespace(ModelService.TNS);
      // instead, create the xmlns attribute directly:
      OMAttribute defaultNS = factory.createOMAttribute("xmlns", null, ModelService.TNS);
      resService.addAttribute(defaultNS);

      // log the response message
      if (Debug.verboseOn()) {
        try {
          Debug.logInfo("Response Message:\n" + resEnv + "\n", module);
        } catch (Throwable t) {
        }
      }

      resEnv.serialize(response.getOutputStream());
      response.getOutputStream().flush();
    } catch (Exception e) {
      Debug.logError(e, module);
      throw new EventHandlerException(e.getMessage(), e);
    }
  }
示例#21
0
 /**
  * Serialize the Value object to an OMElement representing the entry
  *
  * @param key Value to serialize
  * @param elem OMElement
  * @return OMElement
  */
 public OMElement serializeValue(Value key, String name, OMElement elem) {
   if (key != null) {
     if (key.getExpression() == null) {
       // static key
       elem.addAttribute(fac.createOMAttribute(name, nullNS, key.getKeyValue()));
     } else {
       String startChar = "{", endChar = "}";
       // if this is an expr type key we add an additional opening and closing brace
       if (key.hasExprTypeKey()) {
         startChar = startChar + "{";
         endChar = endChar + "}";
       }
       // dynamic key
       SynapsePathSerializer.serializePath(
           key.getExpression(), startChar + key.getExpression().toString() + endChar, elem, name);
     }
   }
   return elem;
 }
示例#22
0
  private static OMElement getEchoOMBlock(String text, String sequenceKey) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName, "ns1");
    OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
    OMElement textElem = fac.createOMElement(Text, applicationNamespace);
    OMElement sequenceElem = fac.createOMElement(Sequence, applicationNamespace);

    textElem.setText(text);
    sequenceElem.setText(sequenceKey);
    echoStringElement.addChild(textElem);
    echoStringElement.addChild(sequenceElem);

    OMNamespace namespace =
        fac.createOMNamespace(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI, "env");
    OMAttribute attr =
        fac.createOMAttribute(
            "encodingStyle", namespace, "http://schemas.xmlsoap.org/soap/encoding/");

    echoStringElement.addAttribute(attr);

    return echoStringElement;
  }
  public OMElement serialize(OMElement parent) {

    OMElement payloadFactoryElem = fac.createOMElement(PAYLOAD_FACTORY, synNS);
    if (type != null) {
      payloadFactoryElem.addAttribute(fac.createOMAttribute(TYPE, nullNS, type));
    }
    saveTracingState(payloadFactoryElem, this);

    if (!dynamic) {
      if (format != null) {
        try {
          OMElement formatElem = fac.createOMElement(FORMAT, synNS);
          if (type != null && (type.contains(JSON_TYPE) || type.contains(TEXT_TYPE))) {
            formatElem.setText(format);
          } else {
            formatElem.addChild(AXIOMUtil.stringToOM(format));
          }
          payloadFactoryElem.addChild(formatElem);
        } catch (XMLStreamException e) {
          handleException("Error while serializing payloadFactory mediator", e);
        }
      } else {
        handleException("Invalid payloadFactory mediator, format is required");
      }
    } else {
      if (formatKey != null) {
        OMElement formatElem = fac.createOMElement(FORMAT, synNS);
        formatElem.addAttribute(fac.createOMAttribute("key", nullNS, formatKey));
        payloadFactoryElem.addChild(formatElem);
      } else {
        handleException("Invalid payloadFactory mediator, format is required");
      }
    }

    if (argumentList != null && argumentList.size() > 0) {

      OMElement argumentsElem = fac.createOMElement(ARGS, synNS);

      for (Argument arg : argumentList) {

        OMElement argElem = fac.createOMElement(ARG, synNS);

        if (arg.isDeepCheck()) {
          argElem.addAttribute(fac.createOMAttribute(DEEP_CHECK, nullNS, "true"));
        } else {
          argElem.addAttribute(fac.createOMAttribute(DEEP_CHECK, nullNS, "false"));
        }

        if (arg.getValue() != null) {
          argElem.addAttribute(fac.createOMAttribute(VALUE, nullNS, arg.getValue()));
        } else if (arg.getExpression() != null) {
          SynapseXPathSerializer.serializeXPath(arg.getExpression(), argElem, EXPRESSION);
        } else if (arg.getJsonPath() != null) {
          argElem.addAttribute(
              fac.createOMAttribute(EXPRESSION, nullNS, arg.getJsonPath().getExpression()));
        }
        // error happens somewhere here
        if (arg.getEvaluator() != null) {
          argElem.addAttribute(fac.createOMAttribute(EVAL, nullNS, arg.getEvaluator()));
        }
        argumentsElem.addChild(argElem);
      }
      payloadFactoryElem.addChild(argumentsElem);
    }

    if (parent != null) {
      parent.addChild(payloadFactoryElem);
    }

    return payloadFactoryElem;
  }
  /** {@inheritDoc} */
  public OMElement serialize(OMElement parent) {
    OMElement entitlementService = fac.createOMElement("entitlementService", synNS);

    if (remoteServiceUrl != null) {
      entitlementService.addAttribute(
          fac.createOMAttribute("remoteServiceUrl", nullNS, remoteServiceUrl));
    } else {
      throw new MediatorException("Invalid Entitlement mediator.Entitlement service epr required");
    }

    if (remoteServiceUserName != null) {
      entitlementService.addAttribute(
          fac.createOMAttribute("remoteServiceUserName", nullNS, remoteServiceUserName));
    } else {
      throw new MediatorException(
          "Invalid Entitlement mediator. Remote service user name required");
    }

    if (remoteServicePassword != null) {
      entitlementService.addAttribute(
          fac.createOMAttribute("remoteServicePassword", nullNS, remoteServicePassword));
    } else {
      throw new MediatorException("Invalid Entitlement mediator. Remote service password required");
    }

    if (callbackClass != null && !"".equalsIgnoreCase(callbackClass)) {
      entitlementService.addAttribute(
          fac.createOMAttribute("callbackClass", nullNS, callbackClass));
    }

    if (client != null && !"".equalsIgnoreCase(client)) {
      entitlementService.addAttribute(fac.createOMAttribute("client", nullNS, client));
    }

    if (thriftHost != null && !"".equalsIgnoreCase(thriftHost)) {
      entitlementService.addAttribute(fac.createOMAttribute("thriftHost", nullNS, thriftHost));
    }

    if (thriftPort != null && !"".equalsIgnoreCase(thriftPort)) {
      entitlementService.addAttribute(fac.createOMAttribute("thriftPort", nullNS, thriftPort));
    }

    if (onRejectSeqKey != null) {
      entitlementService.addAttribute(
          fac.createOMAttribute(XMLConfigConstants.ONREJECT, nullNS, onRejectSeqKey));
    } else {
      for (Mediator m : getList()) {
        if (m instanceof OnRejectMediator) {
          m.serialize(entitlementService);
        }
      }
    }

    if (onAcceptSeqKey != null) {
      entitlementService.addAttribute(
          fac.createOMAttribute(XMLConfigConstants.ONACCEPT, nullNS, onAcceptSeqKey));
    } else {
      for (Mediator m : getList()) {
        if (m instanceof OnAcceptMediator) {
          m.serialize(entitlementService);
        }
      }
    }

    if (adviceSeqKey != null) {
      entitlementService.addAttribute(fac.createOMAttribute(ADVICE, nullNS, adviceSeqKey));
    } else {
      for (Mediator m : getList()) {
        if (m instanceof AdviceMediator) {
          m.serialize(entitlementService);
        }
      }
    }

    if (obligationsSeqKey != null) {
      entitlementService.addAttribute(
          fac.createOMAttribute(OBLIGATIONS, nullNS, obligationsSeqKey));
    } else {
      for (Mediator m : getList()) {
        if (m instanceof ObligationsMediator) {
          m.serialize(entitlementService);
        }
      }
    }

    saveTracingState(entitlementService, this);

    if (parent != null) {
      parent.addChild(entitlementService);
    }
    return entitlementService;
  }
  // TODO get a factory or a stream writer - add more props
  public static OMElement serialize(RealmConfiguration realmConfig) {
    OMFactory factory = OMAbstractFactory.getOMFactory();
    OMElement rootElement =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_USER_MANAGER));
    OMElement realmElement =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_REALM));
    String realmName = realmConfig.getRealmClassName();

    OMAttribute propAttr =
        factory.createOMAttribute(
            UserCoreConstants.RealmConfig.ATTR_NAME_PROP_NAME, null, realmName);
    realmElement.addAttribute(propAttr);

    rootElement.addChild(realmElement);

    OMElement mainConfig =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_CONFIGURATION));
    realmElement.addChild(mainConfig);

    OMElement addAdmin =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_ADD_ADMIN));
    OMElement adminUser =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_ADMIN_USER));
    OMElement adminUserNameElem =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_USER_NAME));
    adminUserNameElem.setText(realmConfig.getAdminUserName());
    OMElement adminPasswordElem =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_PASSWORD));
    addAdmin.setText(UserCoreUtil.removeDomainFromName(realmConfig.getAddAdmin()));
    adminPasswordElem.setText(realmConfig.getAdminPassword());
    adminUser.addChild(adminUserNameElem);
    adminUser.addChild(adminPasswordElem);
    mainConfig.addChild(addAdmin);
    mainConfig.addChild(adminUser);

    OMElement adminRoleNameElem =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_ADMIN_ROLE));
    adminRoleNameElem.setText(UserCoreUtil.removeDomainFromName(realmConfig.getAdminRoleName()));
    mainConfig.addChild(adminRoleNameElem);

    OMElement systemUserNameElem =
        factory.createOMElement(
            new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_SYSTEM_USER_NAME));
    mainConfig.addChild(systemUserNameElem);

    // adding the anonymous user
    OMElement anonymousUserEle =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_ANONYMOUS_USER));
    OMElement anonymousUserNameElem =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_USER_NAME));
    OMElement anonymousPasswordElem =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_PASSWORD));
    anonymousUserEle.addChild(anonymousUserNameElem);
    anonymousUserEle.addChild(anonymousPasswordElem);
    mainConfig.addChild(anonymousUserEle);

    // adding the everyone role
    OMElement everyoneRoleNameElem =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_EVERYONE_ROLE));
    everyoneRoleNameElem.setText(
        UserCoreUtil.removeDomainFromName(realmConfig.getEveryOneRoleName()));
    mainConfig.addChild(everyoneRoleNameElem);

    // add the main config properties
    addPropertyElements(
        factory, mainConfig, null, realmConfig.getDescription(), realmConfig.getRealmProperties());
    // add the user store manager properties

    OMElement userStoreManagerElement =
        factory.createOMElement(
            new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_USER_STORE_MANAGER));
    realmElement.addChild(userStoreManagerElement);
    addPropertyElements(
        factory,
        userStoreManagerElement,
        realmConfig.getUserStoreClass(),
        realmConfig.getDescription(),
        realmConfig.getUserStoreProperties());

    RealmConfiguration secondaryRealmConfiguration = null;
    secondaryRealmConfiguration = realmConfig.getSecondaryRealmConfig();
    while (secondaryRealmConfiguration != null) {
      OMElement secondaryElement =
          factory.createOMElement(
              new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_USER_STORE_MANAGER));
      realmElement.addChild(secondaryElement);
      addPropertyElements(
          factory,
          secondaryElement,
          secondaryRealmConfiguration.getUserStoreClass(),
          secondaryRealmConfiguration.getDescription(),
          secondaryRealmConfiguration.getUserStoreProperties());
      secondaryRealmConfiguration = secondaryRealmConfiguration.getSecondaryRealmConfig();
    }

    // add the user authorization properties
    OMElement authorizerManagerElement =
        factory.createOMElement(new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_ATHZ_MANAGER));
    realmElement.addChild(authorizerManagerElement);
    addPropertyElements(
        factory,
        authorizerManagerElement,
        realmConfig.getAuthorizationManagerClass(),
        realmConfig.getDescription(),
        realmConfig.getAuthzProperties());

    return rootElement;
  }
  public static OMElement serializeInboundEndpoint(InboundEndpoint inboundEndpoint) {

    OMElement inboundEndpointElt =
        fac.createOMElement(
            InboundEndpointConstants.INBOUND_ENDPOINT, SynapseConstants.SYNAPSE_OMNAMESPACE);
    inboundEndpointElt.addAttribute(
        InboundEndpointConstants.INBOUND_ENDPOINT_NAME, inboundEndpoint.getName(), null);
    if (inboundEndpoint.getInjectingSeq() != null) {
      inboundEndpointElt.addAttribute(
          InboundEndpointConstants.INBOUND_ENDPOINT_SEQUENCE,
          inboundEndpoint.getInjectingSeq(),
          null);
    }
    if (inboundEndpoint.getOnErrorSeq() != null) {
      inboundEndpointElt.addAttribute(
          InboundEndpointConstants.INBOUND_ENDPOINT_ERROR_SEQUENCE,
          inboundEndpoint.getOnErrorSeq(),
          null);
    }

    if (inboundEndpoint.getProtocol() != null) {
      inboundEndpointElt.addAttribute(
          InboundEndpointConstants.INBOUND_ENDPOINT_PROTOCOL, inboundEndpoint.getProtocol(), null);
    } else {
      inboundEndpointElt.addAttribute(
          InboundEndpointConstants.INBOUND_ENDPOINT_CLASS, inboundEndpoint.getClassImpl(), null);
    }

    StatisticsConfigurable statisticsConfigurable = inboundEndpoint.getAspectConfiguration();

    if (statisticsConfigurable != null && statisticsConfigurable.isStatisticsEnable()) {
      inboundEndpointElt.addAttribute(
          XMLConfigConstants.STATISTICS_ATTRIB_NAME, XMLConfigConstants.STATISTICS_ENABLE, null);
    }

    if (inboundEndpoint.getTraceState() != SynapseConstants.TRACING_UNSET) {
      if (inboundEndpoint.getTraceState() == SynapseConstants.TRACING_ON) {
        inboundEndpointElt.addAttribute(
            XMLConfigConstants.TRACE_ATTRIB_NAME, XMLConfigConstants.TRACE_ENABLE, null);
      } else if (inboundEndpoint.getTraceState() == SynapseConstants.TRACING_OFF) {
        inboundEndpointElt.addAttribute(
            XMLConfigConstants.TRACE_ATTRIB_NAME, XMLConfigConstants.TRACE_DISABLE, null);
      }
    }

    inboundEndpointElt.addAttribute(
        InboundEndpointConstants.INBOUND_ENDPOINT_SUSPEND,
        Boolean.toString(inboundEndpoint.isSuspend()),
        null);

    OMElement parametersElt =
        fac.createOMElement(
            InboundEndpointConstants.INBOUND_ENDPOINT_PARAMETERS,
            SynapseConstants.SYNAPSE_OMNAMESPACE);

    for (Map.Entry<String, String> paramEntry : inboundEndpoint.getParametersMap().entrySet()) {
      String strKey = paramEntry.getKey();
      OMElement parameter =
          fac.createOMElement(
              InboundEndpointConstants.INBOUND_ENDPOINT_PARAMETER,
              SynapseConstants.SYNAPSE_OMNAMESPACE);
      parameter.addAttribute(
          InboundEndpointConstants.INBOUND_ENDPOINT_PARAMETER_NAME, strKey, null);

      if (inboundEndpoint.getParameterKey(strKey) != null) {
        parameter.addAttribute(
            InboundEndpointConstants.INBOUND_ENDPOINT_PARAMETER_KEY,
            inboundEndpoint.getParameterKey(strKey),
            null);
      } else if (isWellFormedXML(paramEntry.getValue())) {
        try {
          OMElement omElement = AXIOMUtil.stringToOM(paramEntry.getValue());
          parameter.addChild(omElement);
        } catch (XMLStreamException e) {
          String msg = "Error Parsing OMElement for value of " + paramEntry.getKey();
          throw new SynapseException(msg, e);
        }
      } else {
        parameter.setText(paramEntry.getValue());
      }
      parametersElt.addChild(parameter);
    }

    inboundEndpointElt.addChild(parametersElt);

    return inboundEndpointElt;
  }
示例#27
0
 protected OMElement addAttribute(OMElement element, String attributeName, String attributeValue) {
   element.addAttribute(attributeName, attributeValue, null);
   return element;
 }
  /** {@inheritDoc} */
  public OMElement serializeSpecificMediator(Mediator mediator) {
    if (!(mediator instanceof EntitlementMediator)) {
      handleException("Unsupported mediator passed in for serialization : " + mediator.getType());
    }

    EntitlementMediator entitlement = null;
    OMElement entitlementElem = null;

    entitlement = (EntitlementMediator) mediator;
    entitlementElem = fac.createOMElement("entitlementService", synNS);
    saveTracingState(entitlementElem, entitlement);
    entitlementElem.addAttribute(
        fac.createOMAttribute("remoteServiceUrl", nullNS, entitlement.getRemoteServiceUrl()));
    entitlementElem.addAttribute(
        fac.createOMAttribute(
            "remoteServiceUserName", nullNS, entitlement.getRemoteServiceUserName()));
    entitlementElem.addAttribute(
        fac.createOMAttribute(
            "remoteServicePassword", nullNS, entitlement.getRemoteServicePassword()));

    if (entitlement.getCallbackClass() != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute("callbackClass", nullNS, entitlement.getCallbackClass()));
    }

    if (entitlement.getCacheType() != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute("cacheType", nullNS, entitlement.getCacheType()));
    }

    if (entitlement.getInvalidationInterval() != 0) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(
              "invalidationInterval",
              nullNS,
              Integer.toString(entitlement.getInvalidationInterval())));
    }

    if (entitlement.getMaxCacheEntries() != 0) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(
              "maxCacheEntries", nullNS, Integer.toString(entitlement.getMaxCacheEntries())));
    }

    if (entitlement.getClient() != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(EntitlementConstants.CLIENT, nullNS, entitlement.getClient()));
    }

    if (entitlement.getThriftHost() != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(
              EntitlementConstants.THRIFT_HOST, nullNS, entitlement.getThriftHost()));
    }

    if (entitlement.getThriftPort() != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(
              EntitlementConstants.THRIFT_PORT, nullNS, entitlement.getThriftPort()));
    }

    if (entitlement.getReuseSession() != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(
              EntitlementConstants.REUSE_SESSION, nullNS, entitlement.getReuseSession()));
    }

    String onReject = entitlement.getOnRejectSeqKey();
    if (onReject != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(XMLConfigConstants.ONREJECT, nullNS, onReject));
    } else {
      Mediator m = entitlement.getOnRejectMediator();
      SequenceMediatorSerializer serializer = new SequenceMediatorSerializer();
      if (m != null && m instanceof SequenceMediator) {
        OMElement element = serializer.serializeAnonymousSequence(null, (SequenceMediator) m);
        element.setLocalName(XMLConfigConstants.ONREJECT);
        entitlementElem.addChild(element);
      }
    }
    String onAccept = entitlement.getOnAcceptSeqKey();
    if (onAccept != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(XMLConfigConstants.ONACCEPT, nullNS, onAccept));
    } else {
      Mediator m = entitlement.getOnAcceptMediator();
      SequenceMediatorSerializer serializer = new SequenceMediatorSerializer();
      if (m != null && m instanceof SequenceMediator) {
        OMElement element = serializer.serializeAnonymousSequence(null, (SequenceMediator) m);
        element.setLocalName(XMLConfigConstants.ONACCEPT);
        entitlementElem.addChild(element);
      }
    }
    String obligation = entitlement.getObligationsSeqKey();
    if (obligation != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(EntitlementMediatorFactory.OBLIGATIONS, nullNS, obligation));
    } else {
      Mediator m = entitlement.getObligationsMediator();
      SequenceMediatorSerializer serializer = new SequenceMediatorSerializer();
      if (m != null && m instanceof SequenceMediator) {
        OMElement element = serializer.serializeAnonymousSequence(null, (SequenceMediator) m);
        element.setLocalName(EntitlementMediatorFactory.OBLIGATIONS);
        entitlementElem.addChild(element);
      }
    }
    String advice = entitlement.getAdviceSeqKey();
    if (advice != null) {
      entitlementElem.addAttribute(
          fac.createOMAttribute(EntitlementMediatorFactory.ADVICE, nullNS, advice));
    } else {
      Mediator m = entitlement.getAdviceMediator();
      SequenceMediatorSerializer serializer = new SequenceMediatorSerializer();
      if (m != null && m instanceof SequenceMediator) {
        OMElement element = serializer.serializeAnonymousSequence(null, (SequenceMediator) m);
        element.setLocalName(EntitlementMediatorFactory.ADVICE);
        entitlementElem.addChild(element);
      }
    }

    return entitlementElem;
  }
  /**
   * @param verifier
   * @return
   * @throws RelyingPartyException
   */
  protected String getIssuerInfoString(SAMLTokenVerifier verifier) throws RelyingPartyException {
    String issuerInfo = null;
    OMFactory factory = null;
    OMNamespace namespace = null;
    Element keyInfo = null;
    OMElement certificates = null;
    OMElement omKeyInfo = null;
    boolean siginingSet = false;
    OMElement certElem = null;
    Iterator<X509Certificate> certIterator = null;

    try {
      factory = OMAbstractFactory.getOMFactory();
      namespace =
          factory.createOMNamespace(TokenVerifierConstants.NS, TokenVerifierConstants.PREFIX);
      keyInfo = verifier.getKeyInfoElement();
      certIterator = verifier.getCertificates().iterator();

      while (certIterator.hasNext()) {
        X509Certificate cert = certIterator.next();
        byte[] encodedCert = cert.getEncoded();
        String base64Encoded = Base64.encode(encodedCert);

        if (certificates == null) {
          certificates = factory.createOMElement(TokenVerifierConstants.LN_CERTIFICATES, namespace);
        }

        certElem = factory.createOMElement(TokenVerifierConstants.LN_CERTIFICATE, namespace);

        if (siginingSet == false) {
          certElem.addAttribute(TokenVerifierConstants.LN_SIGNING_CERT, "true", null);
          siginingSet = true;
        }
        certElem.setText(base64Encoded);
        certificates.addChild(certElem);
      }

      if (keyInfo != null) {
        String value = IdentityUtil.nodeToString(keyInfo);
        XMLStreamReader parser =
            XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(value));
        StAXOMBuilder builder = new StAXOMBuilder(parser);
        omKeyInfo = builder.getDocumentElement();
      }
    } catch (Exception e) {
      log.error("Error while building issuer info", e);
      throw new RelyingPartyException("errorBuildingIssuerInfo");
    }

    if (certificates != null) {
      issuerInfo = certificates.toString();
    }

    if (omKeyInfo != null) {
      if (issuerInfo != null) {
        issuerInfo = issuerInfo + omKeyInfo.toString();
      } else {
        issuerInfo = omKeyInfo.toString();
      }
    }
    return issuerInfo;
  }
  private OMElement createStatementParamElement(Statement.Parameter param) {
    OMElement paramElt =
        fac.createOMElement(AbstractDBMediatorFactory.PARAM_Q.getLocalPart(), synNS);

    if (param.getPropertyName() != null) {
      paramElt.addAttribute(fac.createOMAttribute("value", nullNS, param.getPropertyName()));
    }
    if (param.getXpath() != null) {
      SynapseXPathSerializer.serializeXPath(param.getXpath(), paramElt, "expression");
    }

    switch (param.getType()) {
      case Types.CHAR:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "CHAR"));
          break;
        }
      case Types.VARCHAR:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "VARCHAR"));
          break;
        }
      case Types.LONGVARCHAR:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "LONGVARCHAR"));
          break;
        }
      case Types.NUMERIC:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "NUMERIC"));
          break;
        }
      case Types.DECIMAL:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "DECIMAL"));
          break;
        }
      case Types.BIT:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "BIT"));
          break;
        }
      case Types.TINYINT:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "TINYINT"));
          break;
        }
      case Types.SMALLINT:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "SMALLINT"));
          break;
        }
      case Types.INTEGER:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "INTEGER"));
          break;
        }
      case Types.BIGINT:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "BIGINT"));
          break;
        }
      case Types.REAL:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "REAL"));
          break;
        }
      case Types.FLOAT:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "FLOAT"));
          break;
        }
      case Types.DOUBLE:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "DOUBLE"));
          break;
        }
      case Types.DATE:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "DATE"));
          break;
        }
      case Types.TIME:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "TIME"));
          break;
        }
      case Types.TIMESTAMP:
        {
          paramElt.addAttribute(fac.createOMAttribute("type", nullNS, "TIMESTAMP"));
          break;
        }
      default:
        {
          throw new SynapseException("Unknown or unsupported JDBC type : " + param.getType());
        }
    }
    return paramElt;
  }