org.jmage.resource
Class FontFactory

java.lang.Object
  extended by org.jmage.resource.FontFactory
All Implemented Interfaces:
Configurable, ResourceFactory

public class FontFactory
extends java.lang.Object
implements ResourceFactory

FontFactory loads and creates fonts as resources from system environment.


Field Summary
protected  ApplicationContext applicationContext
           
protected static FontFactory fontFactory
           
protected  java.util.List fontTypes
           
protected static org.apache.log4j.Logger log
           
protected  java.util.List schemeTypes
           
protected  javax.servlet.ServletContext servletContext
           
 
Constructor Summary
FontFactory()
           
 
Method Summary
 boolean canHandle(java.net.URI resource)
          Determines whether a ResourceFactory can handle a resource for a given URI.
 void configure(ApplicationContext context)
           
 void configureRequestProperties(java.util.Properties properties)
          Initialize the ResourceFactory with extra Properties needed
 java.lang.Object createFrom(java.net.URI resource)
          Creates a resource object to use from a given URI.
protected  java.awt.Font getAbsoluteFile(java.io.File file)
           
protected  java.awt.Font getClassPathResource(java.io.File file)
           
protected  java.awt.Font getCurrentDirFile(java.io.File file)
           
protected  java.awt.Font getFile(java.io.File file)
           
protected  java.awt.Font getJMAGEResourceDirFile(java.io.File file)
           
protected  java.awt.Font getServletContainerResource(java.io.File file)
          Get the file from the ServletContainer as a system resource.
protected  java.awt.Font getURL(java.net.URL url)
           
protected  java.io.InputStream loadFile(java.io.File file)
           
protected  java.io.InputStream loadUrl(java.net.URL url)
           
 void removeRequestProperties(java.util.Properties properties)
          Lifecycle method for removing per request properties
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fontFactory

protected static FontFactory fontFactory

log

protected static org.apache.log4j.Logger log

fontTypes

protected java.util.List fontTypes

schemeTypes

protected java.util.List schemeTypes

applicationContext

protected ApplicationContext applicationContext

servletContext

protected javax.servlet.ServletContext servletContext
Constructor Detail

FontFactory

public FontFactory()
Method Detail

configureRequestProperties

public void configureRequestProperties(java.util.Properties properties)
Description copied from interface: ResourceFactory
Initialize the ResourceFactory with extra Properties needed

Specified by:
configureRequestProperties in interface ResourceFactory

removeRequestProperties

public void removeRequestProperties(java.util.Properties properties)
Description copied from interface: ResourceFactory
Lifecycle method for removing per request properties

Specified by:
removeRequestProperties in interface ResourceFactory

configure

public void configure(ApplicationContext context)
Specified by:
configure in interface Configurable

canHandle

public boolean canHandle(java.net.URI resource)
Description copied from interface: ResourceFactory
Determines whether a ResourceFactory can handle a resource for a given URI.

Specified by:
canHandle in interface ResourceFactory
Parameters:
resource - the URI of the resource.
Returns:
true | false

createFrom

public java.lang.Object createFrom(java.net.URI resource)
                            throws ResourceException
Description copied from interface: ResourceFactory
Creates a resource object to use from a given URI.

Specified by:
createFrom in interface ResourceFactory
Returns:
the resource object.
Throws:
ResourceException - if the object cannot be found or an error occurs during creation.

getFile

protected java.awt.Font getFile(java.io.File file)
                         throws ResourceException
Throws:
ResourceException

getClassPathResource

protected java.awt.Font getClassPathResource(java.io.File file)
                                      throws ResourceException
Throws:
ResourceException

getCurrentDirFile

protected java.awt.Font getCurrentDirFile(java.io.File file)

getJMAGEResourceDirFile

protected java.awt.Font getJMAGEResourceDirFile(java.io.File file)

getAbsoluteFile

protected java.awt.Font getAbsoluteFile(java.io.File file)

getURL

protected java.awt.Font getURL(java.net.URL url)
                        throws ResourceException
Throws:
ResourceException

getServletContainerResource

protected java.awt.Font getServletContainerResource(java.io.File file)
Get the file from the ServletContainer as a system resource.

Parameters:
file - the file
Returns:
the image

loadFile

protected java.io.InputStream loadFile(java.io.File file)
                                throws java.io.IOException
Throws:
java.io.IOException

loadUrl

protected java.io.InputStream loadUrl(java.net.URL url)
                               throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2004-2008 Sourceforge. All Rights Reserved.