ContentHelper Class

DEPRECATED

com.bea.p13n.content
ContentHelper Class

public class ContentHelper

    extends Object

Helper class for dealing with Content, ContentManagers, and the possible subclasses.


Hierarchy
Object
  ContentHelper

Field Summary

public static final String
DEF_CONTENT_HOME
The default ContentHome name (always null).
public static final String
DEF_CONTENT_MANAGER_HOME
The default ContentManagerHome name.
public static final boolean
DEF_CONTENT_READONLY
The default readonly flag for getting Content.
public static final String
DEF_CONTENT_SCHEMA_HOME
The default Content SchemaHome name.
public static final String
DEF_DOCUMENT_HOME
The default DocumentHome name (always null).
public static final String
DEF_DOCUMENT_MANAGER_HOME
The default DocumentManagerHome name.
public static final String
DEF_DOCUMENT_SCHEMA_HOME
The default Document SchemaHome name.
public static boolean
USE_SOFT_HASH_MAP
Should caches use a SoftHashMap or not (always false).
 

Constructor Summary

ContentHelper()

 

Method Summary

public static Content[]
getContent(String homeName, Search s)
Return an array of Content from the ContentManager at the given name.
public static Content[]
getContent(String homeName, Search s)
Return an array of Content from the ContentManager at the given name.
public static Content[]
getContent(String homeName, Search s, boolean readOnly)
Return an array of Content from the ContentManager or ContentHome at the given name.
public static Content[]
getContent(String homeName, Search s, boolean readOnly)
Return an array of Content from the ContentManager or ContentHome at the given name.
public static Enumeration
getContentFromManager(String homeName, EJBHome home, Search s)
Search for content from a ContentManager.
public static Enumeration
getContentFromManager(String homeName, EJBHome home, Search s)
Search for content from a ContentManager.
public static Enumeration
getContentFromManager(String homeName, EJBHome home, Search s, boolean readOnly)
Search for content from a ContentManager.
public static Enumeration
getContentFromManager(String homeName, EJBHome home, Search s, boolean readOnly)
Search for content from a ContentManager.
public static Collection
getContentIds(String homeName, Search s)
Return an rray of Content from the ContentManager or ContentHome at the given name.
public static int
getContentLength(long docSize, int bytesLen)
Return the correct content length.
public static ContentManager
getContentManager(String homeName)
Get a ContentManager from a JNDI home name.
public static ContentManager
getContentManager(String homeName, EJBHome home)
Get a ContentManager from an EJBHome.
public static String
pathInfoEncode(String pathInfo)
Correctly URLEncode a path-info string.
public static Content[]
toArray(Enumeration e)
Turn an Enumeration of Content into an array.
public static String
toHTML(String in)
Convert an arbitrary string to HTML which will display as the original string intended.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
   

Field Detail

DEF_CONTENT_HOME

public static final String DEF_CONTENT_HOME
The default ContentHome name (always null).


DEF_CONTENT_MANAGER_HOME

public static final String DEF_CONTENT_MANAGER_HOME
The default ContentManagerHome name.

This points to "java:comp/env/ejb/ContentManager", which is the closest <ejb-ref>'ed ContentManager home. The <ejb-ref> should be configured either in your EJB ejb-jar.xml deployment descriptor or in your webapp's web.xml deployment descriptor.


DEF_CONTENT_READONLY

public static final boolean DEF_CONTENT_READONLY
The default readonly flag for getting Content.


DEF_CONTENT_SCHEMA_HOME

public static final String DEF_CONTENT_SCHEMA_HOME
The default Content SchemaHome name.


DEF_DOCUMENT_HOME

public static final String DEF_DOCUMENT_HOME
The default DocumentHome name (always null).


DEF_DOCUMENT_MANAGER_HOME

public static final String DEF_DOCUMENT_MANAGER_HOME
The default DocumentManagerHome name.

This points to "java:comp/env/ejb/DocumentManager", which is the closest <ejb-ref>'ed DocumentManager home. The <ejb-ref> should be configured either in your EJB ejb-jar.xml deployment descriptor or in your webapp's web.xml deployment descriptor.


DEF_DOCUMENT_SCHEMA_HOME

public static final String DEF_DOCUMENT_SCHEMA_HOME
The default Document SchemaHome name.


USE_SOFT_HASH_MAP

public static boolean USE_SOFT_HASH_MAP
Should caches use a SoftHashMap or not (always false).

 

Constructor Detail

ContentHelper

public ContentHelper()
 

Method Detail

getContent(String, Search) Method

public static Content[] getContent(String homeName, 
                                 Search s)
throws NamingException, RemoteException, FinderException, IllegalArgumentException
Return an array of Content from the ContentManager at the given name.

If homeName points to a home for a ContentManager (or subclass), then the home's create() method will be invoked and the ContentManager's getContent() method will be used. The resulting enumeration will be put into an array.

Exceptions

NamingException
thrown if home cannot be found.
RemoteException
thrown on communications error.
FinderException
thrown on error in findBySearchParams (never thrown)
IllegalArgumentException
thrown on any other error.

Related Topics

ContentHelper.getContentManager(String)


getContent(String, Search) Method

DEPRECATED Use new Search instead

public static Content[] getContent(String homeName, 
                                 Search s)
throws NamingException, RemoteException, FinderException, IllegalArgumentException
Return an array of Content from the ContentManager at the given name.

If homeName points to a home for a ContentManager (or subclass), then the home's create() method will be invoked and the ContentManager's getContent() method will be used. The resulting enumeration will be put into an array.

Exceptions

NamingException
thrown if home cannot be found.
RemoteException
thrown on communications error.
FinderException
thrown on error in findBySearchParams (never thrown)
IllegalArgumentException
thrown on any other error.

Related Topics

ContentHelper.getContentManager(String)
Search


getContent(String, Search, boolean) Method

DEPRECATED Use getContent(String, Search) instead.

public static Content[] getContent(String homeName, 
                                 Search s, 
                                 boolean readOnly)
throws NamingException, RemoteException, FinderException, IllegalArgumentException
Return an array of Content from the ContentManager or ContentHome at the given name.

If homeName points to a home for a ContentManager (or subclass), then the home's create() method will be invoked and the ContentManager's getContent() method will be used. If homeName points to a home for Content (or subclasses), then it's findBySearchParams() method will used. The resulting enumeration will be put into an array.

Exceptions

NamingException
thrown if home cannot be found.
RemoteException
thrown on communications error.
FinderException
thrown on error in findBySearchParams
IllegalArgumentException
thrown on any other error.

Related Topics

ContentHelper.getContent(String, Search)


getContent(String, Search, boolean) Method

DEPRECATED Use new content expressions and getContent(String, Search) instead.

public static Content[] getContent(String homeName, 
                                 Search s, 
                                 boolean readOnly)
throws NamingException, RemoteException, FinderException, IllegalArgumentException
Return an array of Content from the ContentManager or ContentHome at the given name.

If homeName points to a home for a ContentManager (or subclass), then the home's create() method will be invoked and the ContentManager's getContent() method will be used. If homeName points to a home for Content (or subclasses), then it's findBySearchParams() method will used. The resulting enumeration will be put into an array.

Exceptions

NamingException
thrown if home cannot be found.
RemoteException
thrown on communications error.
FinderException
thrown on error in findBySearchParams
IllegalArgumentException
thrown on any other error.

Related Topics

ContentHelper.getContent(String, Search)


getContentFromManager(String, EJBHome, Search) Method

DEPRECATED use getContentManager(homeName, home).getContent(s) instead.

public static Enumeration getContentFromManager(String homeName, 
                                                EJBHome home, 
                                                Search s)
throws RemoteException, IllegalArgumentException
Search for content from a ContentManager.

Parameters

homeName
the JNDI home name (used for errors).
home
the EJBHome of the ContentManager.
s
the search parameters.

Returns

the Enumeration of Content which match the search.

Exceptions

RemoteException
IllegalArgumentException

Related Topics

ContentHelper.getContentManager(String, EJBHome)


getContentFromManager(String, EJBHome, Search) Method

DEPRECATED use new content search and getContentManager(homeName, home).getContent(s) instead.

public static Enumeration getContentFromManager(String homeName, 
                                                EJBHome home, 
                                                Search s)
throws RemoteException, IllegalArgumentException
Search for content from a ContentManager.

Parameters

homeName
the JNDI home name (used for errors).
home
the EJBHome of the ContentManager.
s
the search parameters.

Returns

the Enumeration of Content which match the search.

Exceptions

RemoteException
IllegalArgumentException

Related Topics

ContentHelper.getContentManager(String, EJBHome)


getContentFromManager(String, EJBHome, Search, boolean) Method

DEPRECATED Use getContentManager(homeName, home).getContent(s);

public static Enumeration getContentFromManager(String homeName, 
                                                EJBHome home, 
                                                Search s, 
                                                boolean readOnly)
throws RemoteException, IllegalArgumentException
Search for content from a ContentManager.

Parameters

homeName
the JNDI home name (used for errors).
home
the EJBHome of the ContentManager.
s
the search parameters.
readOnly
the read-only flag (ignored).

Returns

the Enumeration of Content which match the search.

Exceptions

RemoteException
IllegalArgumentException

Related Topics

ContentHelper.getContentManager(String, EJBHome)


getContentFromManager(String, EJBHome, Search, boolean) Method

DEPRECATED Use new content expressions and getContentManager(homeName, home).getContent(s);

public static Enumeration getContentFromManager(String homeName, 
                                                EJBHome home, 
                                                Search s, 
                                                boolean readOnly)
throws RemoteException, IllegalArgumentException
Search for content from a ContentManager.

Parameters

homeName
the JNDI home name (used for errors).
home
the EJBHome of the ContentManager.
s
the search parameters.
readOnly
the read-only flag (ignored).

Returns

the Enumeration of Content which match the search.

Exceptions

RemoteException
IllegalArgumentException

Related Topics

ContentHelper.getContentManager(String, EJBHome)


getContentIds(String, Search) Method

public static Collection getContentIds(String homeName, 
                                       Search s)
throws NamingException, RemoteException, FinderException, IllegalArgumentException
Return an rray of Content from the ContentManager or ContentHome at the given name.

If homeName points to a home for a ContentManager (or subclass), then the home's create() method will be invoked and the ContentManager's getContentIds() method will be used.

Exceptions

NamingException
thrown if home cannot be found.
RemoteException
thrown on communications error.
FinderException
thrown on error in findBySearchParams (never thrown)
IllegalArgumentException
thrown on any other error.

Related Topics

ContentHelper.getContentManager(String)


getContentLength(long, int) Method

public static int getContentLength(long docSize, 
                                   int bytesLen)
Return the correct content length. Since the getContent() method of Document does not guarentee that the resulting array will be the correct size (it might be larger), this method will tell what the actual number of bytes to use from that array is.

Parameters

docSize
the value doc.getSize().
bytesLen
the length of the doc.getContent() array.

Returns

the number of bytes in the content array which are valid.

Related Topics

Document.getContent()


getContentManager(String) Method

public static ContentManager getContentManager(String homeName)
throws NamingException, CreateException, RemoteException, IllegalArgumentException
Get a ContentManager from a JNDI home name.

Parameters

homeName
the original home name.

Returns

a ContentManager instance.

Exceptions

NamingException
thrown on a lookup error.
CreateException
thrown on a creation error.
RemoteException
thrown on an error.
IllegalArgumentException
thrown on an invalid ejb home.

Related Topics

ContentHelper.getContentManager(String, EJBHome)


getContentManager(String, EJBHome) Method

public static ContentManager getContentManager(String homeName, 
                                               EJBHome home)
throws CreateException, RemoteException, IllegalArgumentException
Get a ContentManager from an EJBHome.

Parameters

homeName
the original home name.
home
the EJBHome.

Returns

a ContentManager instance.

Exceptions

CreateException
thrown on a creation error.
RemoteException
thrown on an error.
IllegalArgumentException
thrown on an invalid ejb home.

pathInfoEncode(String) Method

public static String pathInfoEncode(String pathInfo)
Correctly URLEncode a path-info string.

This can be used to pass a contentId as Path-Info to the ShowDocServlet.

This will url encode the pathInfo, but will leave "/"'s alone.


toArray(Enumeration) Method

public static Content[] toArray(Enumeration e)
Turn an Enumeration of Content into an array.

Parameters

e
the Enumeration.

Returns

an array of the Content objects.

toHTML(String) Method

public static String toHTML(String in)
Convert an arbitrary string to HTML which will display as the original string intended.

This will replace the characters '&', '"', '<', and '>' with '&amp;', &quot;', '&lt;', and '&gt;', respectively.