Package org.salamandra.web.core.transformer

Examples of org.salamandra.web.core.transformer.Transformer$Structure$Attribute


    if (log.isDebugEnabled()) {
      log.debug("processActionForward(" + forward.getPath() + ", " + forward.getContextRelative() + ")");
    }

    Transformer transformer = transformerFactory.getTransformer(forward.getPath());
    if (transformer != null) {
      try {

        transformer.execute(request, response);
      } catch (TransformerException e) {
        log.error("Errore nell'esecuzione del Transformer", e);
      }
    } else {
      super.processForwardConfig(request, response, forward);
View Full Code Here


 
  @Override
  protected View loadView(String viewName, Locale locale) throws BeansException {
    AbstractTransformerFactory factory = getTransformerFactory();
    try {
      Transformer transformer = (Transformer) factory.getActionFowardTransformer(viewName);
      // If this resolver is not supposed to handle the given view,
      // return null to pass on to the next resolver in the chain.
      if (transformer == null)
        return null;
View Full Code Here

                  return localeResolver.resolveLocale(request);
              }
          });
        }
    Transformer transformer = getTransformerFactory().getTransformer(BeanTransformer.TRANSFORMER_BEAN_ID);
    if (transformer == null)
      return null;

    View view = new SalamandraWebView(transformer, localeResolver.resolveLocale(request));
   
View Full Code Here

        // per ogni Transformer
        List<org.salamandra.web.core.config.digester.Transformer> lstTrans = definitions.getTransformers();
        for (Iterator<org.salamandra.web.core.config.digester.Transformer> iter = lstTrans.iterator(); iter.hasNext();) {
          org.salamandra.web.core.config.digester.Transformer trans = iter.next();
         
          Transformer transformer = createTransformerInstance(servletContext, trans, beanFactory);
         
          // Ottengo le proprety del Transformer
          List<ISetProperty> lstProp = trans.getSetProperties();
          for (Iterator<ISetProperty> iterator = lstProp.iterator(); iterator.hasNext();) {
            ISetProperty prop = (ISetProperty) iterator.next();
            transformer.addInitParameter( prop.getProperty(), prop.getValue() )
          }
         
          // ottengo la struttura del nodo
          Structure structure = trans.getStructure();
          XmlBindingFactory bindFactory = null;
          if (structure!=null) {
            // assegno il nome al nodo
            transformer.getStructure().setName(trans.getStructure().getName());
           
            //
            List<AddNode> listNode = structure.getAddNodes();
            for (Iterator<AddNode> iterator = listNode.iterator(); iterator.hasNext();) {
              AddNode node = iterator.next();
              String nameNode = node.getName();
              String typeNode = node.getType();
              if ((node.getBinder()!=null) &&
                 hshBinds.containsKey(node.getBinder())) {
               
                bindFactory = (XmlBindingFactory) hshBinds.get(node.getBinder());
              }
              transformer.getStructure().addNode(nameNode, typeNode, bindFactory);
            }
          } else {
            SingleNode singleNode = trans.getSingleNode();
            if (singleNode!=null) {
              String typeNode = singleNode.getType();
              if ((singleNode.getBinder()!=null) &&
                 hshBinds.containsKey(singleNode.getBinder())) {
               
                bindFactory = (XmlBindingFactory) hshBinds.get(singleNode.getBinder());
              }
              transformer.setSingleNode(typeNode, bindFactory);
            }
          }
          if ((bindFactory!=null) &&
            (transformer instanceof SAXTransformer)) {
           
View Full Code Here

  }
 
  protected Transformer createTransformerInstance(ServletContext servletContext,
                          org.salamandra.web.core.config.digester.Transformer trans,
                          DefaultListableBeanFactory beanFactory) {
    Transformer transformer = null;
    try {
      // carico la relativa instanza
      transformer = (Transformer) Class.forName( trans.getType() ).newInstance();
      transformer.init(servletContext);
      if (transformer instanceof IBeanDefinitionFactory){
        ((IBeanDefinitionFactory) transformer).setListableBeanFactory(beanFactory);
      }
      hshTrans.put(trans.getId(), transformer);
    } catch (Exception ex) {
View Full Code Here

  }

  public Transformer getTransformer(String name) {
    // ottengo il Transformer
    try {
      Transformer transformer = (Transformer) ((Transformer) hshTrans.get( name )).clone();
     
      return transformer;
    } catch (CloneNotSupportedException e) {
      return null;
    }
View Full Code Here

    while (iter.hasNext()) {
      ActionForward action_forward = (ActionForward) iter.next();
      // controllo se � quello che � stato richiesto
      Pattern pattern = Pattern.compile(action_forward.getPath());
      if (pattern.matcher(matcher).matches()) {
        Transformer transformer;
        try {
          // ottengo il Transformer
          transformer = (Transformer) ((Transformer) hshTrans.get( action_forward.getTransformer() )).clone();
          try {
            // � imposto le sue propriet�
            PropertyUtils.applyPropertyValues(action_forward.getSetProperties(), transformer);
          } catch (PropertiesContainerException ex) {
            for (Iterator<PropertiesException> iterator = ex.iterator(); iterator.hasNext();) {
              PropertiesException element = (PropertiesException) iterator.next();
              transformer.addParameter(element.getProperty(), String.valueOf(element.getValue()));

              LOG.info(element.getMessage());
            }
          }
          return transformer;
View Full Code Here

    this.handleQCInformation();

    this.ncFile.addAttribute( null, qcFlagsAtt );

    // Add some general metadata in global attributes.
    this.ncFile.addAttribute( null, new Attribute( "title",
                                                   new StringBuffer("NGDC archived ")
                                                   .append( datasetIdAtt.getStringValue())
                                                   .append( " data with start time ")
                                                   .append( startDateAtt.getStringValue())
                                                   .toString()));
    this.ncFile.addAttribute( null, new Attribute( "Convention", _Coordinate.Convention));

    // Add some THREDDS specific metadata in global attributes.
    this.ncFile.addAttribute( null, new Attribute( "thredds_creator", "DOD/USAF/SMC > Space and Missile Systems Center (SMC), U.S. Air Force, U.S. Department of Defense"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_contributor", "DOC/NOAA/NESDIS/NGDC > National Geophysical Data Center, NESDIS, NOAA, U.S. Department of Commerce"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_contributor_role", "archive"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher", "DOC/NOAA/NESDIS/NGDC > National Geophysical Data Center, NESDIS, NOAA, U.S. Department of Commerce"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher_url", "http://dmsp.ngdc.noaa.gov/"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_publisher_email", "ngdc.dmsp@noaa.gov"));
    this.ncFile.addAttribute( null, new Attribute( "thredds_summary",
                                                   new StringBuffer("This dataset contains data from the DMSP ").append( spacecraftIdAtt.getStringValue())
                                                   .append( " satellite OLS instrument and includes both visible smooth and thermal smooth imagery with 2.7km resolution.")
                                                   .append( " The start time for this data is ").append( startDateAtt.getStringValue())
                                                   .append( " and the northerly equatorial crossing longitude is ").append( startLongitudeAtt.getNumericValue())
                                                   .append( ".  The DMSP satellite is a polar-orbiting satellite crossing the equator, depending on the satellite, at either dawn/dusk or noon/midnight.")
                                                   .append( " This data is in the NOAA/NGDC DMSP archive format.")
                                                   .toString()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_history", ""));
    this.ncFile.addAttribute( null, new Attribute( "thredds_timeCoverage_start", startDateAtt.getStringValue()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_timeCoverage_end", endDateAtt.getStringValue()));
    this.ncFile.addAttribute( null, new Attribute( "thredds_geospatialCoverage",
                                                   new StringBuffer("Polar orbit with northerly equatorial crossing at longitude ")
                                                   .append( ascendingNodeAtt.getNumericValue()).append( ".")
                                                   .toString()));

View Full Code Here

   * @throws IOException if any problems reading the file (or validating the file).
   */
  private void handleFileInformation()
          throws IOException
  {
    fileIdAtt = new Attribute( this.fileIdAttName,
                               (String) headerInfo.get( HeaderInfoTitle.FILE_ID.toString() ) );
    datasetIdAtt = new Attribute( this.datasetIdAttName,
                                  (String) headerInfo.get( HeaderInfoTitle.DATA_SET_ID.toString() ) );
    recordSizeInBytes = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.RECORD_BYTES.toString() ) );
    numRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_RECORDS.toString() ) );
    numHeaderRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_HEADER_RECORDS.toString() ) );
    numDataRecords = Integer.parseInt( (String) headerInfo.get( HeaderInfoTitle.NUM_DATA_RECORDS.toString() ) );
View Full Code Here

   * @throws IOException if any problems reading the file (or validating the file).
   */
  private void handleProcessingInformation()
          throws IOException
  {
    suborbitHistoryAtt = new Attribute( this.suborbitHistoryAttName,
                                        (String) headerInfo.get( HeaderInfoTitle.SUBORBIT_HISTORY.toString() ) );
    processingSystemAtt = new Attribute( this.processingSystemAttName,
                                         (String) headerInfo.get( HeaderInfoTitle.PROCESSING_SYSTEM.toString() ) );
    String processingDateString = (String) headerInfo.get( HeaderInfoTitle.PROCESSING_DATE.toString() );
    try
    {
      processingDate = DateFormatHandler.ALT_DATE_TIME.getDateFromDateTimeString( processingDateString );
    }
    catch ( ParseException e )
    {
      throw new IOException( "Invalid DMSP file: processing date string <" + processingDateString + "> not parseable: " + e.getMessage() );
    }
    processingDateAtt = new Attribute(
            this.processingDateAttName,
            DateFormatHandler.ISO_DATE_TIME.getDateTimeStringFromDate( processingDate ) );
  }
View Full Code Here

TOP

Related Classes of org.salamandra.web.core.transformer.Transformer$Structure$Attribute

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.