org.jdesktop.wonderland.client.jme.content
Class AbstractContentImporter

java.lang.Object
  extended by org.jdesktop.wonderland.client.jme.content.AbstractContentImporter
All Implemented Interfaces:
ContentImporterSPI

public abstract class AbstractContentImporter
extends java.lang.Object
implements ContentImporterSPI

An abstract base class that content importers may use to help implement the ContentImporterSPI. This class takes care of querying whether the asset already exists and utility methods to create the cell based upon the asset.

Author:
Jordan Slott

Constructor Summary
AbstractContentImporter()
           
 
Method Summary
static void createCell(java.lang.String uri)
          Create a cell based upon the uri of the content and the file extension of the uploaded file.
 java.lang.String importFile(java.io.File file, java.lang.String extension)
          Imports a given File into the system for the extension type and creates a corresponding cell.
 java.lang.String importFile(java.io.File file, java.lang.String extension, boolean createCell)
          Imports a given File into the system for the extension type.
abstract  java.lang.String isContentExists(java.io.File file)
          If the content already exists in the user's content repository, return it's URI.
abstract  java.lang.String uploadContent(java.io.File file)
          Uploads the content file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jdesktop.wonderland.client.content.spi.ContentImporterSPI
getExtensions
 

Constructor Detail

AbstractContentImporter

public AbstractContentImporter()
Method Detail

importFile

public java.lang.String importFile(java.io.File file,
                                   java.lang.String extension)
Description copied from interface: ContentImporterSPI
Imports a given File into the system for the extension type and creates a corresponding cell. Returns a uri that represents the imported file.

Calling this method is equivalent to calling importFile(file, extension, true)

Specified by:
importFile in interface ContentImporterSPI
Parameters:
file - The File to import
extension - The extension of the file
Returns:
A URI that represents the importer file

importFile

public java.lang.String importFile(java.io.File file,
                                   java.lang.String extension,
                                   boolean createCell)
Description copied from interface: ContentImporterSPI
Imports a given File into the system for the extension type. Returns a uri that represents the imported file.

Specified by:
importFile in interface ContentImporterSPI
Parameters:
file - The File to import
extension - The extension of the file
createCell - if true, create a cell to handle the file
Returns:
A URI that represents the importer file

isContentExists

public abstract java.lang.String isContentExists(java.io.File file)
If the content already exists in the user's content repository, return it's URI. If the content does not exist, return null.

Parameters:
file - The File of the imported content
Returns:
The URL of the existing content, null if it does not exist

uploadContent

public abstract java.lang.String uploadContent(java.io.File file)
                                        throws java.io.IOException
Uploads the content file. Throws IOException upon error. Returns a URI that describes the location of the content

Parameters:
file - The content file to upload
Returns:
A URI that represents the uploaded content
Throws:
java.io.IOException - Upon upload error

createCell

public static void createCell(java.lang.String uri)
Create a cell based upon the uri of the content and the file extension of the uploaded file.

Parameters:
uri - The URI of the uploaded content


Open Wonderland - http://openwonderland.org