com.pepper.platform.program
Interface PackageInstance

All Known Implementing Classes:
AbstractPepperProgram

public interface PackageInstance

Interface implemented by programs that share data with other programs and that want to register for downloaded content based on mime type.


Method Summary
 void createPage(Object data, List metadata, PageChangeListener listener)
          Create a page with the given data, typically called when downloaded web content matches a specified mimeType in a package's ppld file.
 List findPages(String type, String expression)
          Return the set of objects described by the type and expression.
 List getTypes()
          List the types of pages the program supports (eg artist/song/album for Music Library).
 

Method Detail

getTypes

List getTypes()
List the types of pages the program supports (eg artist/song/album for Music Library).

Returns:
list of page types as Strings

findPages

List findPages(String type,
               String expression)
Return the set of objects described by the type and expression. The specific meanings of type and expression, and the types of objects returned are all up to the program implementation; they may be standardized at a later date.

Implementations should always return copies of objects so that the caller can't accidentally corrupt the original data.

Example:
In Music Library, expression is an XPath fragment to select JDOM Elements on the page described by type, and the function returns a list of JDOM Elements.

Parameters:
type - Type of page to search for. Must be one of the values returned by PackageInstance.getTypes().
expression - Expression to narrow down searches; format is program-specific.
Returns:
List of objects; type of object in the list is program-specific.

createPage

void createPage(Object data,
                List metadata,
                PageChangeListener listener)
                throws Exception
Create a page with the given data, typically called when downloaded web content matches a specified mimeType in a package's ppld file. This is a standard way a package can accept external content and create page's in the package's internal format. While programs will support different types for data, File and InputStream will be most common. Additional information can be added to metadata, which is a list of NameValue objects.

Example:
In Music Library, data is a File to be added to the library.

Parameters:
data - Data to create the page with.
metadata - NameValue pairs providing additional information about data, such as referrer URL.
listener - The listener that should be notified when the pageCreation finishes or an error occurs
Throws:
Exception


Copyright © 2006-2007 Pepper Computer, Inc. All Rights Reserved.