org.mmbase.applications.media.urlcomposers
Class URLComposer

java.lang.Object
  extended by org.mmbase.applications.media.urlcomposers.URLComposer
Direct Known Subclasses:
FragmentURLComposer, SimpleWmURLComposer, WmSbURLComposer

public class URLComposer
extends Object

URLComposer is a wrapper/container class around an URL. It contains besides the URL some extra meta information about it, like the original source object of the resource it represents and if it is currently available or not. An URL can be unavailable because of two reasons: because the provider is offline, or because the fragment where it belongs to is not valid (e.g. because of publishtimes). It is used by the Media builders to pass around information (mainly as an entry in Lists).

Version:
$Id: URLComposer.java 42456 2010-06-08 11:53:19Z andre $
Author:
Michiel Meeuwissen, Rob Vermeulen (VPRO)

Field Summary
protected  Map<String,Object> info
           
protected  int preference
           
protected  MMObjectNode provider
           
protected  MMObjectNode source
           
 
Constructor Summary
URLComposer()
           
 
Method Summary
 boolean canCompose()
          Returns true.
 boolean equals(Object o)
           
 Codec getAcodec()
          Audio codec if its field is present, returns 'UNKNOWN' (-1) if no such field or codec is unknown.
 int getBitrate()
           
 Codec getCodec()
           
 String getDescription(Map<String,Locale> options)
           
 Dimension getDimension()
           
 String getFilename()
          Returns the 'short' url (typically the filename) for display purposes, just the source field value url.
 int getFilesize()
           
 Format getFormat()
          The format of the produced URL.
 String getGUIIndicator(Map<String,Locale> options)
           
 Map<String,Object> getInfo()
           
 MimeType getMimeType()
          The mime-type of the produced URL.
 MMObjectNode getProvider()
           
 MMObjectNode getSource()
           
 State getState()
           
 String getURL()
          Returns the URL as a String.
protected  StringBuilder getURLBuffer()
          Extension will normally create URL's differently.
 int hashCode()
           
 void init(MMObjectNode provider, MMObjectNode source, MMObjectNode fragment, Map<String,Object> info, Set<MMObjectNode> cacheExpireObjects)
           
 boolean isAvailable()
          Wether the URL which will be produced by this composer is actually already useable.
 boolean isMain()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

source

protected MMObjectNode source

provider

protected MMObjectNode provider

info

protected Map<String,Object> info

preference

protected int preference
Constructor Detail

URLComposer

public URLComposer()
Method Detail

init

public void init(MMObjectNode provider,
                 MMObjectNode source,
                 MMObjectNode fragment,
                 Map<String,Object> info,
                 Set<MMObjectNode> cacheExpireObjects)

getSource

public MMObjectNode getSource()

getProvider

public MMObjectNode getProvider()

getInfo

public Map<String,Object> getInfo()

getFormat

public Format getFormat()
The format of the produced URL. This is not necessarily the format of the source. (Though it normally would be)


getCodec

public Codec getCodec()

getAcodec

public Codec getAcodec()
Audio codec if its field is present, returns 'UNKNOWN' (-1) if no such field or codec is unknown. Videosources have both codec and acodec (audio codec) fields, audiosources have just one codec field.


getBitrate

public int getBitrate()

getMimeType

public MimeType getMimeType()
The mime-type of the produced URL. This is not necessarily the mimetype of the source. (Though it normally would be)


getGUIIndicator

public String getGUIIndicator(Map<String,Locale> options)

getDescription

public String getDescription(Map<String,Locale> options)

getDimension

public Dimension getDimension()

getFilesize

public int getFilesize()

canCompose

public boolean canCompose()
Returns true. This can be overridden if the URLComposer not always can do it's job. It then returns false if it is (can be?) taken from consideration.


getURLBuffer

protected StringBuilder getURLBuffer()
Extension will normally create URL's differently. They override this function.


getURL

public final String getURL()
Returns the URL as a String. To encourage efficient coding, this method is final. Override getURLBuffer instead.


getFilename

public final String getFilename()
Returns the 'short' url (typically the filename) for display purposes, just the source field value url.


isAvailable

public boolean isAvailable()
Wether the URL which will be produced by this composer is actually already useable. This means that the provider must be 'on', and the source must be either an original (State.SOURCE), or its a generated source and its generation is done.


isMain

public boolean isMain()

getState

public State getState()

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()


MMBase 2.0-SNAPSHOT - null