package com.ericsson.ims.mtas.xdms.aggregated.service.binder;

import javax.xml.bind.JAXBException;
import javax.xml.transform.Source;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ericsson.ims.mtas.xdms.common.binder.GenericBinder;
import com.ericsson.ims.mtas.xdms.schema.cai3g.Set;

public class AggregatedServiceBinder extends GenericBinder implements IAggregatedServiceBinder
{
	public static Logger logger = LoggerFactory.getLogger(AggregatedServiceBinder.class);

	protected static String[] preDefinedNameSpace =
	{
		"http://schemas.ericsson.com/cai3g1.2/"
	};

	public AggregatedServiceBinder()
	{
		super(preDefinedNameSpace);
	}

	@Override
	public void marshall(Object o) throws JAXBException
	{
		try
		{
			marshaller.marshal(o, System.out);
			checkValidation();
		}
		catch (JAXBException e)
		{
			checkValidation();
			e.printStackTrace();
			throw e;
		}
	}

	@Override
	public Object unmarshall(Source source)
	{
		Object o = null;

		try
		{
			o = unMarshaller.unmarshal(source);
			checkValidation();

			if (o instanceof Set)
			{
				logger.debug("");
			}
		}
		catch (JAXBException e)
		{
			checkValidation();
			e.printStackTrace();
		}
		return o;
	}
}
