Package org.salamandra.web.core.transformer

Examples of org.salamandra.web.core.transformer.Transformer


    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

TOP

Related Classes of org.salamandra.web.core.transformer.Transformer

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.