/*
 * $RCSfile: DefaultMarshaler.java,v $
 * $Date: 2006/01/26 14:48:59 $
 * $Revision: 1.1.2.2 $
 * $Author: andreys $
 */

/*
 * Copyright (c) 2002-2003 IST-2004-2006-511731 ModelWare - ModelBus.
 * All rights reserved.
 *
 * This software is published under the terms of the ModelBus Software License
 * 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.
 * A copy of ModelBus Software License is provided with this distribution in
 * doc/LICENSE.txt file.
 */

/*
 * ModelMarshaller.java Add description 
 * 
 * @author Prawee Sriplakich
 * @version $Revision: 1.1.2.2 $ $Date: 2006/01/26 14:48:59 $
 * @see Add references
 *
 * TODO Add description
 * TODO Add references
 */
package org.eclipse.mddi.modelbus.adapter.infrastructure.transport.marshal.ws;

import java.util.Properties;

import javax.xml.soap.SOAPElement;

import org.eclipse.mddi.modelbus.adapter.infrastructure.serialize.Serializer;
import org.eclipse.mddi.modelbus.adapter.infrastructure.serialize.emf_xmi.DefaultSerializer;
import org.eclipse.mddi.modelbus.description.abstract_.Parameter;

/**
 * @author P. Sriplakich, Andrey Sadovykh (LIP6)
 * 
 * 
 */
public class DefaultMarshaler extends AbstractMarshaler {

    Serializer serializer = new DefaultSerializer();

    public DefaultMarshaler(Properties p) {
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.mddi.modelbus.adapter.infrastructure.transport.marshal.ws.ModelMarshaler#marshallModel(org.eclipse.mddi.modelbus.description.abstract_.Parameter,
     *      java.lang.Object, javax.xml.soap.SOAPElement)
     */
    public void marshalModel(Parameter p, Object value, SOAPElement elem)
            throws Exception {
        elem.addTextNode(getSerializer().serialize(p, value));
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.mddi.modelbus.adapter.infrastructure.transport.marshal.ws.ModelMarshaler#unmarshallModel(org.eclipse.mddi.modelbus.description.abstract_.Parameter,
     *      javax.xml.soap.SOAPElement)
     */
    public Object unmarshalModel(Parameter p, SOAPElement elem)
            throws Exception {
        return elem.getValue();
    }

}
