001/*
002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Antoine Taillefer
018 */
019package org.nuxeo.ecm.diff.content.converters;
020
021import java.io.Serializable;
022import java.util.Map;
023
024import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
025import org.nuxeo.ecm.core.convert.api.ConversionException;
026import org.nuxeo.ecm.core.convert.api.ConversionService;
027import org.nuxeo.ecm.core.convert.extension.Converter;
028import org.nuxeo.ecm.core.convert.extension.ConverterDescriptor;
029import org.nuxeo.runtime.api.Framework;
030
031/**
032 * Abstract class for content diff converter implementations.
033 *
034 * @author Antoine Taillefer
035 */
036public abstract class AbstractContentDiffConverter implements Converter {
037
038    public void init(ConverterDescriptor descriptor) {
039        // Nothing to do here
040    }
041
042    protected final BlobHolder convert(String converterName, BlobHolder blobHolder, Map<String, Serializable> parameters)
043            throws ConversionException {
044
045        ConversionService cs = Framework.getLocalService(ConversionService.class);
046
047        return cs.convert(converterName, blobHolder, parameters);
048    }
049
050}