com.anwrt.anycontent.extensions.content
Class ContentImport

java.lang.Object
  extended bycom.anwrt.anycontent.extensions.content.ContentImport

public abstract class ContentImport
extends java.lang.Object

This class must be extends to define an new import in a content type.
An import class is defined by its label, the extensions it can handle and the import operation itself.
Cocoon can be used for the conversion by using the given objectModel and resolver.


Constructor Summary
ContentImport()
           
 
Method Summary
 void configure(Configuration configuration, java.lang.String errorMessage)
          Configure the import class by configuration its label, and its specificities
protected abstract  void configureImport(Configuration configuration)
          Implement this method to configure the specificity of your class implementation
 java.lang.String getCatalogue()
          Get the i18n catalogue directory
abstract  java.lang.String[] getExtensions()
          The class must return the extensions type it can handle
 java.lang.String getLabel()
          Get the label associated to the import
 java.lang.String getPluginId()
          Get the plugin id
 java.lang.String getPluginName()
          Get the plugin name
abstract  void importContent(java.io.File input, Content content, java.util.Map objectModel, SourceResolver resolver, ServiceManager manager)
          Realize the import by importing the file and writing the result in the output stream
 void setInformation(java.lang.String pluginName, java.lang.String pluginId)
          Set the name of the plugin (the directory name)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentImport

public ContentImport()
Method Detail

getLabel

public final java.lang.String getLabel()
Get the label associated to the import

Returns:
the i18n key for the label

getPluginName

public final java.lang.String getPluginName()
Get the plugin name

Returns:
the plugin group name

getPluginId

public final java.lang.String getPluginId()
Get the plugin id

Returns:
the plugin id

getCatalogue

public final java.lang.String getCatalogue()
Get the i18n catalogue directory

Returns:
the i18n catalogue

setInformation

public final void setInformation(java.lang.String pluginName,
                                 java.lang.String pluginId)
Set the name of the plugin (the directory name)

Parameters:
pluginName - name of the plugin
pluginId - id of the plugin

getExtensions

public abstract java.lang.String[] getExtensions()
The class must return the extensions type it can handle

Returns:
An array of file extensions (without initial dot, case is not important)

importContent

public abstract void importContent(java.io.File input,
                                   Content content,
                                   java.util.Map objectModel,
                                   SourceResolver resolver,
                                   ServiceManager manager)
                            throws java.lang.Exception
Realize the import by importing the file and writing the result in the output stream

Parameters:
input - The file to import
content - The content where to write the result of import
objectModel - The cocoon object model if needed by the import class
resolver - The cocoon resolver if needed by the import class
manager - The Avalon ServiceManager to interact with other components
Throws:
java.lang.Exception - If a error occurs while importing content in repository

configureImport

protected abstract void configureImport(Configuration configuration)
                                 throws ConfigurationException
Implement this method to configure the specificity of your class implementation

Parameters:
configuration - The xml import configuration from the import tag
Throws:
ConfigurationException - If the configuration is incorrect

configure

public void configure(Configuration configuration,
                      java.lang.String errorMessage)
               throws ConfigurationException
Configure the import class by configuration its label, and its specificities

Parameters:
configuration - The import tag in xml configuration
errorMessage - The begining of a full qualified error message
Throws:
ConfigurationException - If the configuration is incorrect


Copyright © 2006 Anyware Technologies. All Rights Reserved.