JXTA

net.jxta.share
Class ContentManager

java.lang.Object
  |
  +--net.jxta.share.ContentManager

public abstract class ContentManager
extends java.lang.Object

The ContentManager is used to manage local shared content for a peer.


Constructor Summary
ContentManager()
           
 
Method Summary
abstract  Content[] getContent()
          Returns an array of all the shared content.
abstract  Content[] getContent(ContentFilter filter)
          Returns an array of all the shared content accepted by the specified content filter.
abstract  Content[] getContent(ContentId id)
          Returns an array of all the shared content with the specified content id.
abstract  java.lang.String getMimeType(java.io.File file)
          Returns the mime type for the specified file, or null if unknown.
 FileContent share(java.io.File file)
          Shares the specified file using the file name as the share name and a default mime type based on the file name.
 FileContent share(java.io.File file, java.lang.String desc)
          Shares the specified file with a description.
abstract  FileContent share(java.io.File file, java.lang.String name, java.lang.String type, java.lang.String desc)
          Shares the specified file with the provided content name, type, and description.
abstract  void unshare(Content c)
          Removes the specified Content from the list of shared content.
abstract  void unshare(ContentAdvertisement cAdv)
          Removes the specified Content from the list of shared content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentManager

public ContentManager()
Method Detail

share

public FileContent share(java.io.File file)
                  throws java.io.IOException
Shares the specified file using the file name as the share name and a default mime type based on the file name. No description will be provided for the shared content.
Parameters:
file - the File to be shared
Throws:
FileNotFoundException - if the file could not be found
java.io.IOException - if there was an I/O error

share

public FileContent share(java.io.File file,
                         java.lang.String desc)
                  throws java.io.IOException
Shares the specified file with a description. The file name will be used as the share name and a default mime type provided based on the file name.
Parameters:
file - the File to be shared
desc - the description of the content
Throws:
FileNotFoundException - if the file could not be found
java.io.IOException - if there was an I/O error

share

public abstract FileContent share(java.io.File file,
                                  java.lang.String name,
                                  java.lang.String type,
                                  java.lang.String desc)
                           throws java.io.IOException
Shares the specified file with the provided content name, type, and description.
Parameters:
file - the File to be shared
name - the share name, or null if file name should be used
type - the content type, or null if none
desc - the content description, or null if none

unshare

public abstract void unshare(Content c)
                      throws java.io.IOException
Removes the specified Content from the list of shared content.
Parameters:
c - the Content to be unshared
Throws:
java.lang.IllegalArgumentException - if the Content was not shared
java.io.IOException - if there was an I/O error

unshare

public abstract void unshare(ContentAdvertisement cAdv)
                      throws java.io.IOException
Removes the specified Content from the list of shared content.
Parameters:
cAdv - Content Advertisement of the content to be unshared
Throws:
java.lang.IllegalArgumentException - if the Content was not shared
java.io.IOException - if there was an I/O error

getContent

public abstract Content[] getContent()
Returns an array of all the shared content.

getContent

public abstract Content[] getContent(ContentId id)
Returns an array of all the shared content with the specified content id.
Parameters:
id - the ContentId of the shared content

getContent

public abstract Content[] getContent(ContentFilter filter)
Returns an array of all the shared content accepted by the specified content filter.
Parameters:
filter - the ContentFilter to use for search shared content

getMimeType

public abstract java.lang.String getMimeType(java.io.File file)
Returns the mime type for the specified file, or null if unknown.

JXTA