01: /*
02: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
03: * Distributed under the terms of either:
04: * - the common development and distribution license (CDDL), v1.0; or
05: * - the GNU Lesser General Public License, v2.1 or later
06: * $Id: ContentTransformer.java 3634 2007-01-08 21:42:24Z gbevin $
07: */
08: package com.uwyn.rife.cmf.transform;
09:
10: import com.uwyn.rife.cmf.dam.exceptions.ContentManagerException;
11: import java.util.Map;
12:
13: /**
14: * This interface defines the API that has to be implemented by classes that
15: * are capable of transforming content data after it's initially loaded.
16: * <p>The content attributes are provided to the {@link
17: * #transform(Object data, Map attributes) transform} method and can be used
18: * to provide hints for the transformation.
19: * <p>Each transformer is supposed to transform content data of a certain data
20: * type and return the transformed content in the same data type. You should
21: * be careful that this data type corresponds to the data type that's returned
22: * by the {@link com.uwyn.rife.cmf.format.Formatter#format format} method of
23: * the {@link com.uwyn.rife.cmf.format.Formatter formatter} that handles the
24: * content's mime type.
25: *
26: * @author Geert Bevin (gbevin[remove] at uwyn dot com)
27: * @version $Revision: 3634 $
28: * @since 1.0
29: */
30: public interface ContentTransformer<InternalType> {
31: /**
32: * Transforms the content data and returns the transformed data in the
33: * same data type as the original.
34: *
35: * @param data the content data that has to be transformed
36: * @param attributes a map of content attributes that can be used to
37: * provide hints or parameters for the transformation
38: * @return the transformed data
39: * @since 1.0
40: */
41: public InternalType transform(InternalType data,
42: Map<String, String> attributes)
43: throws ContentManagerException;
44: }
|