Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * $Id: AbstractIkasanConverter.java 130 2009-06-05 17:01:24Z karianna $
   * $URL: https://ikasaneip.svn.sourceforge.net/svnroot/ikasaneip/tags/ikasan-0.7.3/common/src/main/java/org/ikasan/common/configuration/AbstractIkasanConverter.java $
   * 
   * ====================================================================
   * Ikasan Enterprise Integration Platform
   * Copyright (c) 2003-2008 Mizuho International plc. and individual contributors as indicated
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the 
  * Free Software Foundation Europe e.V. Talstrasse 110, 40217 Dusseldorf, Germany 
  * or see the FSF site: http://www.fsfeurope.org/.
  * ====================================================================
  */
 package org.ikasan.common.configuration;
 
 // Imported xstream classes
 
 // Imported log4j classes
This class provides XStream converter for an Ikasan class.

Author(s):
Ikasan Development Team
 
 public abstract class AbstractIkasanConverter
     implements Converter
 {
    
logger
 
     private static Logger logger = Logger.getLogger(AbstractIkasanConverter.class);
     // XML structure constants 
     
version
 
     protected final static String VERSION = "version";
    
entry
 
     protected final static String ENTRY = "Entry";
    
xmlns:xsi
 
     protected final static String NS_URI = "xmlns:xsi";
    
NO_NS_SCHEMA_LOCATION
 
     protected final static String NO_NS_SCHEMA_LOCATION = "xsi:noNamespaceSchemaLocation";
    
    
Converts an object to XML.

Parameters:
object
writer
context
 
     protected void commonMarshal(Object object
                         HierarchicalStreamWriter writer,
                         MarshallingContext context)
     {
         .debug("Marshalling the input XML");
         
         AbstractIkasan abstractIkasan = (AbstractIkasan)object;
 
         // version
         if (abstractIkasan.getVersion() != null)
         {
             writer.addAttribute(abstractIkasan.getVersion());
         }
         
         // XMLSchema Instance NS URI
         if (abstractIkasan.getSchemaInstanceNSURI() != null)
         {
             writer.addAttribute(abstractIkasan.getSchemaInstanceNSURI());
         }
 
         // No Namespace Schema Location
         if (abstractIkasan.getNoNamespaceSchemaLocation() != null)
         {
             writer.addAttribute(,
                     abstractIkasan.getNoNamespaceSchemaLocation());
         }
         
         // entries
         if (abstractIkasan.getEntries() != null)
         {
             context.convertAnother(abstractIkasan.getEntries());
         }
         
     }

    
Converts textual data back into an object.

Parameters:
abstractIkasan
reader
context
Returns:
AbstractIkasan
    protected AbstractIkasan commonUnmarshal(AbstractIkasan abstractIkasan,
                            HierarchicalStreamReader reader,
                            UnmarshallingContext context)
    {
        String attrValue = null;
        // policies version
        attrValue = reader.getAttribute();
        abstractIkasan.setVersion(attrValue);
        // XMLSchema Instance NS URI
        attrValue = reader.getAttribute();
        abstractIkasan.setSchemaInstanceNSURI(attrValue);
        // No Name space Schema Location
        attrValue = reader.getAttribute();
        abstractIkasan.setNoNamespaceSchemaLocation(attrValue);
        String nodeName = null;
        while (reader.hasMoreChildren())
        {
            reader.moveDown();
            nodeName = reader.getNodeName();
            // Entry
            if (nodeName.equals())
            {
                Entry entry = (Entry)context.convertAnother(abstractIkasanEntry.class);
                abstractIkasan.addEntry(entry);
            }
            reader.moveUp();
        }
        return abstractIkasan;
    }
    
New to GrepCode? Check out our FAQ X