net.rim.plazmic.mediaengine
Class MediaManager

java.lang.Object
  |
  +--net.rim.plazmic.mediaengine.MediaManager
All Implemented Interfaces:
MediaLoader

public class MediaManager
extends Object
implements MediaLoader

Abstract class for downloading media content from the Internet or local storage and provides the implementation for MediaLoader methods.

Since:
JDE 3.7.0
See Also:
MediaPlayer

Field Summary
 
Constructor Summary
MediaManager()
          The default constructor.
MediaManager(Connector c)
          Creates a MediaManager instance given a connector.
MediaManager(Connector c, boolean enableRelative)
          Creates a MediaManager instance given a connector and a boolean that indicates whether or not relative URLs are enabled.
 
Method Summary
 void addMediaListener(MediaListener listener)
          Adds a listener to the media.
 void cancel()
          Cancels the current download if one exists.
 Object createMedia(String url)
          Loads media content from a given URL.
 void createMediaLater(String uri)
          Loads media content for later given a Uniform Resource Indicator (URI).
 void dispose()
          Disposes the download if one exists.
 Connector getConnector()
          Returns the connector for this MediaManager.
 Connector getDefaultConnector()
          Returns the default connector associated with this MediaManager.
 void removeMediaListener(MediaListener listener)
          Removes a listener from the media.
protected  String resolveURL(String url)
          Resolves the specified URL.
 void setConnector(Connector connector)
          Sets the connector for this MediaManager.
 void setProperty(String name, String value)
          Set connection properties.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail
Constructor Detail

MediaManager

public MediaManager()
The default constructor.
Since:
JDE 3.7.0

MediaManager

public MediaManager(Connector c)
Creates a MediaManager instance given a connector.

Parameters:
c - The connector used to create the MediaManager.
Since:
JDE 3.7.0

MediaManager

public MediaManager(Connector c,
                    boolean enableRelative)
Creates a MediaManager instance given a connector and a boolean that indicates whether or not relative URLs are enabled.

Parameters:
c - The connector used to create the MediaManager.
enableRelative - A boolean indicating whether or not relative URLs are allowed.
Since:
JDE 3.7.0
Method Detail

setConnector

public void setConnector(Connector connector)
Sets the connector for this MediaManager.

Parameters:
connector - The connector to set.
Since:
JDE 3.7.0

getConnector

public Connector getConnector()
Returns the connector for this MediaManager.

Returns:
The connector instance.
Since:
JDE 3.7.0

getDefaultConnector

public Connector getDefaultConnector()
Returns the default connector associated with this MediaManager.

Returns:
The default connector.
Since:
JDE 3.7.0

setProperty

public void setProperty(String name,
                        String value)
                 throws IllegalArgumentException
Set connection properties.
Parameters:
name - property name
value - property value
Throws:
IllegalArgumentException - exception if the property is not supported
Since:
JDE 3.7.0

resolveURL

protected String resolveURL(String url)
Resolves the specified URL.

Parameters:
url - The URL to be resolved.
Returns:
A string representing the URL.
Since:
JDE 3.7.0

addMediaListener

public void addMediaListener(MediaListener listener)
Adds a listener to the media.

Parameters:
listener - The listener to add.
Since:
JDE 3.7.0

removeMediaListener

public void removeMediaListener(MediaListener listener)
Removes a listener from the media.

Parameters:
listener - The listener to remove.
Since:
JDE 3.7.0

createMedia

public Object createMedia(String url)
                   throws IOException,
                          MediaException
Loads media content from a given URL.

Parameters:
url - A string representing the URL.
Returns:
An object representing the media content.
Throws:
IOException - Thrown if the i/o error occured during the download or parsing of the data.
MediaException - Thrown if the media is not supported or the download has been cancelled.
Since:
JDE 3.7.0

createMediaLater

public void createMediaLater(String uri)
Loads media content for later given a Uniform Resource Indicator (URI).

Parameters:
uri - A string representing the URI.
Since:
JDE 3.7.0

cancel

public void cancel()
Cancels the current download if one exists.
Since:
JDE 3.7.0

dispose

public void dispose()
Disposes the download if one exists.
Since:
JDE 3.7.0


Copyright 1999-2002 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.