Package com.esri.gpt.framework.xml

Examples of com.esri.gpt.framework.xml.XsltTemplate


* @throws SAXException if a SAX parsing exception occurs
*/
private synchronized XsltTemplate getCompiledTemplate(String xsltPath)
  throws TransformerException {
  String sKey = xsltPath;
  XsltTemplate template = XSLTTEMPLATES.get(sKey);
  if (template == null) {
    template = XsltTemplate.makeTemplate(xsltPath);
    XSLTTEMPLATES.put(sKey,template);
  }
  return template;
View Full Code Here


* @return Guess
*/
private String guessFromXslt(String operation, String input) {

  try {
    XsltTemplate template = getCompiledTemplate(XSLT_HINT_RESOURCE_IDENTIFICATION);

    Document dom = makeDom();
    if (dom != null) {
      DOMSource source = new DOMSource();

      StringWriter writer = new StringWriter();
      StreamResult result = new StreamResult(writer);
      HashMap<String, String> params = new HashMap<String, String>();
      params.put("operation", operation);
      params.put("input", input);
      template.transform(source, result, params);

      Document outputDom = null;
      try {
        outputDom = DomUtil.makeDomFromString(Val.chkStr(writer.toString()),
            true);
View Full Code Here

      if (toEsriItemInfoXslt.isEmpty()) {
        throw new AgpPublishException("Schema: " + schema.getKey() + " has no transformation to ItemInformation.");
      }

      // run the validation xsl
      XsltTemplate template = this.getCompiledTemplate(toEsriItemInfoXslt);
      String result = template.transform(metadata);

      // load the result SVRL document
      Document dom = DomUtil.makeDomFromString(result, true);

      // find ESRI item information
View Full Code Here

   * @throws IOException if an IO exception occurs
   * @throws TransformerException if a transformation exception occurs
   */
  protected synchronized XsltTemplate getCompiledTemplate(String xsltPath) throws TransformerException {
    String sKey = xsltPath;
    XsltTemplate template = XSLTTEMPLATES.get(sKey);
    if (template == null) {
      template = XsltTemplate.makeTemplate(xsltPath);
      XSLTTEMPLATES.put(sKey, template);
    }
    return template;
View Full Code Here

    String[] keys = this.readKeys(request,context,true);
    String sXsltPath = Val.chkStr(request.getParameter("xslt"));
    String sMimeType = Val.chkStr(request.getParameter("mimeType"));
    String sContentDisposition = Val.chkStr(request.getParameter("contentDisposition"));
    if ((keys.length > 0) && (sXsltPath.length() > 0)) {
      XsltTemplate template = this.getCompiledTemplate(sXsltPath);
      ServletOutputStream out = response.getOutputStream();
           
      if (sMimeType.length() == 0) {
        sMimeType = "text/plain";
      }
      response.setContentType(sMimeType+";charset=UTF-8");
      if (sContentDisposition.length() > 0) {
        response.addHeader("Content-Disposition",sContentDisposition);
      }
     
      try {  
        for (String sKey: keys) {
          String sXml = this.readXml(request,context,sKey);
          String sResult = Val.chkStr(template.transform(sXml));
          if (sResult.length() > 0) {
            byte[] bytes = sResult.getBytes("UTF-8");
            out.write(bytes);
            out.flush();
          }
View Full Code Here

   * @throws SAXException if a SAX parsing exception occurs
   */
  protected synchronized XsltTemplate getCompiledTemplate(String xsltPath)
    throws TransformerException {
    String sKey = xsltPath;
    XsltTemplate template = XSLTTEMPLATES.get(sKey);
    if (template == null) {
      template = XsltTemplate.makeTemplate(xsltPath);
      XSLTTEMPLATES.put(sKey,template);
    }
    return template;
View Full Code Here

 
  DOMSource dSource = new DOMSource(criteria.toDom(operation.name(),
      DATE_FORMAT_OBJ));
  StringWriter writer = new StringWriter();

  XsltTemplate template = SearchConfig.getConfiguredInstance()
      .getGptToCswXsltTemplate();

  try {
    template.transform(dSource, new StreamResult(writer), null);
    if (LOG.isLoggable(Level.FINER)) {
      LOG.log(Level.FINER, "SearchCriteria DOM := \n{0}", XmlIoUtil.domToString(criteria.toDom(operation.name(), DATE_FORMAT_OBJ)));
      LOG.log(Level.FINER, "CSW Request formed := \n{0}", writer.toString());
    }
  } catch (Exception e) {
View Full Code Here

        cfgParams.getValue(sCfgPfx+".response.mimeType"));
    String sContentDisposition = Val.chkStr(
        cfgParams.getValue(sCfgPfx+".response.contentDisposition"));
   
    if ((keys.length > 0) && (sXsltPath.length() > 0)) {
      XsltTemplate template = this.getCompiledTemplate(sXsltPath);
      ServletOutputStream out = response.getOutputStream();
     
      if (sProperties.length() == 0) {
        sProperties = "catalog.cart.*";
      }
     
      if (sMimeType.length() == 0) {
        sMimeType = "text/plain";
      }
      response.setContentType(sMimeType+";charset=UTF-8");
      if (sContentDisposition.length() > 0) {
        response.addHeader("Content-Disposition",sContentDisposition);
      }
     
      String nl = "\r\n";
      try {  
        StringBuilder sbXmls = new StringBuilder();
        for (String sKey: keys) {
          String sXml = Val.chkStr(this.readXml(request,context,sKey));
          if (sXml.startsWith("<?xml ")) {
            sXml = Val.chkStr(sXml.substring(sXml.indexOf("?>") + 2));
          }
          if (sXml.length() > 0) {
            sbXmls.append(nl).append(sXml);
          }
        }
       
        if (sbXmls.length() > 0) {
          StringBuilder sb = new StringBuilder();
          sb.append("<collection>");
         
          // append client properties
          sb.append(nl).append("<client");
          appendXmlAttribute(sb,"session-id",request.getSession(true).getId());
          appendXmlAttribute(sb,"session-rid",request.getRequestedSessionId());
          appendXmlAttribute(sb,"remote-ip",request.getRemoteAddr());
          appendXmlAttribute(sb,"remote-host",request.getRemoteHost());
          appendXmlAttribute(sb,"remote-user",context.getUser().getName());
          appendXmlAttribute(sb,"user-agent",request.getHeader("User-Agent"));
          sb.append("/>");
                     
          // append configuration properties
          sb.append(nl).append("<properties>");
          this.appendPropertyElement(cfgParams,sb,nl,sProperties);
          sb.append(nl).append("</properties>");
         
          // append the XML records
          sb.append(nl).append("<records>");
          sb.append(sbXmls);
          sb.append(nl).append("</records>");
          sb.append(nl).append("</collection>");
         
          // transform then return the response
          boolean bTransform = true;
          if (bTransform) {
            String sResult = Val.chkStr(template.transform(sb.toString()));
            if (sResult.length() > 0) {
              byte[] bytes = sResult.getBytes("UTF-8");
              out.write(bytes);
              out.flush();
            }
View Full Code Here

            + "<repositoryName>" + Val.escapeXml(record.getName()) + "</repositoryName>"
            + "<reportLink>" + link + "</reportLink>"
            + "</notification>";

          // create notification subject and message using transformations
          XsltTemplate notifSubjectTemplate = XsltTemplate.makeFromResourcePath(NOTIF_SUBJECT_PATH);
          XsltTemplate notifMessageTemplate = XsltTemplate.makeFromResourcePath(NOTIF_MESSAGE_PATH);
          String notifSubject = notifSubjectTemplate.transform(notification);
          String notfiMessage = notifMessageTemplate.transform(notification);

          // send email to each recipient
          for (String emailAddress : emailAddresses) {

            // create and init mail request
View Full Code Here

   * @throws SAXException if a SAX parsing exception occurs
   */
  private synchronized XsltTemplate getCompiledTemplate(String xsltPath)
    throws TransformerException {
    String sKey = xsltPath;
    XsltTemplate template = XSLTTEMPLATES.get(sKey);
    if (template == null) {
      template = XsltTemplate.makeTemplate(xsltPath);
      XSLTTEMPLATES.put(sKey,template);
    }
    return template;
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.xml.XsltTemplate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.