Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jasig.portal.tools.chanpub
Class ChannelPublisher

    java.lang.Object
      org.jasig.portal.tools.chanpub.ChannelPublisher

All Implemented Interfaces:
  org.xml.sax.ErrorHandler

    public class ChannelPublisher

extends java.lang.Object
implements org.xml.sax.ErrorHandler

This is a Channel Publisher tool to install uPortal channels from outside of the portal or from within a channel archive. Currently configured to be executed via Jakarta Ant or via a channel-definition block within a CAR deployment descriptor. Sample of command line arguments: ant publish -Dchannel=all (this will publish all channels that have a corresponding xml file) ant publish -Dchannel=webmail.xml (this will publish the specified channels)

Version:
  $Revision: 1.29 $
Author:
  Freddy Lopez, flopez@unicon.net, Ken Weiner, kweiner@unicon.net, Mark Boyd, mboyd@sct.com

Nested Class Summary
`private static class` | `ChannelPublisher.ChannelInfo`

Field Summary
`private static java.lang.String` | `chanDefsLocation`
`private java.util.Map` | `chanTypesNamesToIds`
`private IChannelRegistryStore` | `crs`
`private javax.xml.parsers.DocumentBuilder` | `domParser`
`private static java.lang.String` | `FRAMEWORK_OWNER`
`private static java.lang.String` | `GRANT_PERMISSION_TYPE`
`private static int` | `LOAD_ALL_FILES`
`private static int` | `LOAD_ONE_FILE`
`private static org.apache.commons.logging.Log` | `log`
`private boolean` | `mOnCommandLine`
`private boolean` | `mOverrideExisting`
`private static java.lang.String` | `SUBSCRIBER_ACTIVITY`
`private IPerson` | `systemUser`

Constructor Summary
`private` | `ChannelPublisher(boolean onCommandLine)`

Method Summary
`void` | `error(org.xml.sax.SAXParseException arg0)`
`void` | `fatalError(org.xml.sax.SAXParseException arg0)`
`private IEntityGroup[]` | `getAdminGroup()` Gets the portal administrators group.
`private void` | `getCategories(ChannelPublisher.ChannelInfo ci, org.w3c.dom.Element pele)` Translate channel category names into category ids.
`static ChannelPublisher` | `getChannelArchiveInstance()`
`private ChannelPublisher.ChannelInfo` | `getChannelInfo(java.io.InputStream is)` Populates and returns a ChannelInfo object based on the input stream containing XML data structured according to the channel-definition dtd.
`private ChannelPublisher.ChannelInfo` | `getChannelInfo(java.lang.String chanDefFile)` Populates and returns a ChannelInfo object based on the passed in file name containing XML data structured according to the channel-definition dtd.
`static ChannelPublisher` | `getCommandLineInstance()`
`private ChannelCategory[]` | `getDefaultCategory(boolean fNameAccessibleOnly)` Obtains an auto-publish category located in the root category or creates if not found.
`private java.lang.String` | `getFname(org.w3c.dom.Element chanDefE)` Determines the functional name of the channel.
`private static IEntityGroup` | `getGroup(java.lang.String groupName, java.lang.Class entityType)` Attempts to determine group key based on a group name or fully qualifed group key.
`private void` | `getGroups(ChannelPublisher.ChannelInfo ci, org.w3c.dom.Element pele)` Translate access group names into group ids.
`private void` | `getParameters(ChannelPublisher.ChannelInfo ci, org.w3c.dom.Element pele)` Load the declared parameters.
`private void` | `getType(ChannelPublisher.ChannelInfo ci, java.lang.String value)` Translate the declared channel type name into a channel type id.
`private void` | `getUsers(ChannelPublisher.ChannelInfo ci, org.w3c.dom.Element pele)` Translate access user ids into the user entity objects.
`private void` | `initChanTypeMap()` Load the lookup table to translate channel type names into ids.
`static void` | `main(java.lang.String[] args)`
`private ChannelDefinition` | `publishChannel(ChannelPublisher.ChannelInfo ci)` Publishes the channel represented by the passed in ChannelDefinition object and returns the resultant ChannelDefinition object.
`ChannelDefinition` | `publishChannel(java.io.InputStream is)` Publishes the channel represented by the XML accessed via the passed in InputStream object and returns the resultant ChannelDefinition object.
`ChannelDefinition` | `publishChannel(java.lang.String filename)` Publishes the channel represented by the XML located in the file represented by the passed in filename and returns the resultant ChannelDefinition object.
`void` | `setOverride(boolean b)`
`private void` | `setupDomParser()` Set up a DOM parser for handling the XML channel-definition data.
`private void` | `setupSystemUser()` Sets up the system user for use during publishing.
`void` | `warning(org.xml.sax.SAXParseException arg0)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    private static final org.apache.commons.logging.Log log

### FRAMEWORK_OWNER

    private static final java.lang.String FRAMEWORK_OWNER

See Also:
  Constant Field Values

### SUBSCRIBER_ACTIVITY

    private static final java.lang.String SUBSCRIBER_ACTIVITY

See Also:
  Constant Field Values

### GRANT_PERMISSION_TYPE

    private static final java.lang.String GRANT_PERMISSION_TYPE

See Also:
  Constant Field Values

### LOAD_ALL_FILES

    private static final int LOAD_ALL_FILES

See Also:
  Constant Field Values

### LOAD_ONE_FILE

    private static final int LOAD_ONE_FILE

See Also:
  Constant Field Values

### systemUser

    private IPerson systemUser

### domParser

    private javax.xml.parsers.DocumentBuilder domParser

### crs

    private IChannelRegistryStore crs

### chanTypesNamesToIds

    private java.util.Map chanTypesNamesToIds

### mOnCommandLine

    private boolean mOnCommandLine

### mOverrideExisting

    private boolean mOverrideExisting

### chanDefsLocation

    private static final java.lang.String chanDefsLocation

See Also:
  Constant Field Values

Constructor Detail

### ChannelPublisher

    private ChannelPublisher(boolean onCommandLine)
                      throws java.lang.Exception

Throws:
  `java.lang.Exception`

Method Detail

### main

    public static void main(java.lang.String[] args)
                     throws java.lang.Exception

  Parameters:
    `args` -
  Throws:
    `java.lang.Exception` - We let Exceptions bubble up so that ant will know that the publishing failed and can report the error message and stack trace to the user.

### setupSystemUser

    private void setupSystemUser()

  Sets up the system user for use during publishing.

### publishChannel

    public ChannelDefinition publishChannel(java.lang.String filename)
                                     throws java.lang.Exception

  Publishes the channel represented by the XML located in the file represented by the passed in filename and returns the resultant ChannelDefinition object.

  Parameters:
    `filename` - the name of a file containing the channel XML definition
  Returns:
    org.jasig.portal.ChannelDefinition the published channel definition
  Throws:
    `java.lang.Exception`

### publishChannel

    public ChannelDefinition publishChannel(java.io.InputStream is)
                                     throws java.lang.Exception

  Publishes the channel represented by the XML accessed via the passed in InputStream object and returns the resultant ChannelDefinition object.

  Parameters:
    `is` - and InputStream containing the channel XML definition
  Returns:
    org.jasig.portal.ChannelDefinition the published channel definition
  Throws:
    `java.lang.Exception`

### publishChannel

    private ChannelDefinition publishChannel(ChannelPublisher.ChannelInfo ci)
                                      throws java.lang.Exception

  Publishes the channel represented by the passed in ChannelDefinition object and returns the resultant ChannelDefinition object.

  Parameters:
    `ci` -
  Returns:
  Throws:
    `java.lang.Exception`

### setupDomParser

    private void setupDomParser()
                         throws java.lang.Exception

  Set up a DOM parser for handling the XML channel-definition data.

  Throws:
    `java.lang.Exception`

### getChannelInfo

    private ChannelPublisher.ChannelInfo getChannelInfo(java.lang.String chanDefFile)
                                                 throws java.lang.Exception

  Populates and returns a ChannelInfo object based on the passed in file name containing XML data structured according to the channel-definition dtd.

  Parameters:
    `chanDefFile` -
  Returns:
  Throws:
    `java.lang.Exception`

### getChannelInfo

    private ChannelPublisher.ChannelInfo getChannelInfo(java.io.InputStream is)
                                                 throws java.lang.Exception

  Populates and returns a ChannelInfo object based on the input stream containing XML data structured according to the channel-definition dtd.

  Parameters:
    `is` -
  Returns:
  Throws:
    `java.lang.Exception`

### getFname

    private java.lang.String getFname(org.w3c.dom.Element chanDefE)
                               throws java.lang.Exception

  Determines the functional name of the channel.

  Parameters:
    `chanDefE` -
  Returns:
  Throws:
    `java.lang.Exception`

### getType

    private void getType(ChannelPublisher.ChannelInfo ci,
                         java.lang.String value)
                  throws java.lang.Exception

  Translate the declared channel type name into a channel type id.

  Parameters:
    `ci` -
    `value` -
  Throws:
    `java.lang.Exception`

### getCategories

    private void getCategories(ChannelPublisher.ChannelInfo ci,
                               org.w3c.dom.Element pele)
                        throws java.lang.Exception

  Translate channel category names into category ids.

  Parameters:
    `ci` - The ChannelInfo object being populated.
    `pele` - The Element containing the category elements.
  Throws:
    `java.lang.Exception`

### getParameters

    private void getParameters(ChannelPublisher.ChannelInfo ci,
                               org.w3c.dom.Element pele)

  Load the declared parameters.

  Parameters:
    `ci` - The ChannelInfo object being populated.
    `pele` - The Element containing the parameter elements.

### getGroups

    private void getGroups(ChannelPublisher.ChannelInfo ci,
                           org.w3c.dom.Element pele)
                    throws java.lang.Exception

  Translate access group names into group ids.

  Parameters:
    `ci` - The ChannelInfo object being populated.
    `pele` - The Element containing the group elements.
  Throws:
    `java.lang.Exception`

### getUsers

    private void getUsers(ChannelPublisher.ChannelInfo ci,
                          org.w3c.dom.Element pele)
                   throws java.lang.Exception

  Translate access user ids into the user entity objects.

  Parameters:
    `ci` - The ChannelInfo object being populated.
    `pele` - The Element containing the user elements.
  Throws:
    `java.lang.Exception`

### getAdminGroup

    private IEntityGroup[] getAdminGroup()
                                  throws java.lang.Exception

  Gets the portal administrators group.

  Throws:
    `java.lang.Exception`

### getDefaultCategory

    private ChannelCategory[] getDefaultCategory(boolean fNameAccessibleOnly)
                                          throws java.lang.Exception

  Obtains an auto-publish category located in the root category or creates if not found.

  Throws:
    `java.lang.Exception`

### getGroup

    private static IEntityGroup getGroup(java.lang.String groupName,
                                         java.lang.Class entityType)
                                  throws java.lang.Exception

  Attempts to determine group key based on a group name or fully qualifed group key.

  Parameters:
    `groupName` - a `String` value
    `entityType` - the kind of entity the group contains
  Returns:
    a group key
  Throws:
    `java.lang.Exception`

### initChanTypeMap

    private void initChanTypeMap()
                          throws java.lang.Exception

  Load the lookup table to translate channel type names into ids.

  Throws:
    `java.lang.Exception`

### setOverride

    public void setOverride(boolean b)

### getCommandLineInstance

    public static ChannelPublisher getCommandLineInstance()
                                                   throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### getChannelArchiveInstance

    public static ChannelPublisher getChannelArchiveInstance()
                                                      throws java.lang.Exception

  Throws:
    `java.lang.Exception`

### warning

    public void warning(org.xml.sax.SAXParseException arg0)
                 throws org.xml.sax.SAXException

  Specified by:
    `warning` in interface `org.xml.sax.ErrorHandler`
  Throws:
    `org.xml.sax.SAXException`

### error

    public void error(org.xml.sax.SAXParseException arg0)
               throws org.xml.sax.SAXException

  Specified by:
    `error` in interface `org.xml.sax.ErrorHandler`
  Throws:
    `org.xml.sax.SAXException`

### fatalError

    public void fatalError(org.xml.sax.SAXParseException arg0)
                    throws org.xml.sax.SAXException

  Specified by:
    `fatalError` in interface `org.xml.sax.ErrorHandler`
  Throws:
    `org.xml.sax.SAXException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD