001: /*---------------------------------------------------------------------------*\
002: $Id: CurnFactory.java 7041 2007-09-09 01:04:47Z bmc $
003: ---------------------------------------------------------------------------
004: This software is released under a BSD-style license:
005:
006: Copyright (c) 2004-2007 Brian M. Clapper. All rights reserved.
007:
008: Redistribution and use in source and binary forms, with or without
009: modification, are permitted provided that the following conditions are
010: met:
011:
012: 1. Redistributions of source code must retain the above copyright notice,
013: this list of conditions and the following disclaimer.
014:
015: 2. The end-user documentation included with the redistribution, if any,
016: must include the following acknowlegement:
017:
018: "This product includes software developed by Brian M. Clapper
019: (bmc@clapper.org, http://www.clapper.org/bmc/). That software is
020: copyright (c) 2004-2007 Brian M. Clapper."
021:
022: Alternately, this acknowlegement may appear in the software itself,
023: if wherever such third-party acknowlegements normally appear.
024:
025: 3. Neither the names "clapper.org", "curn", nor any of the names of the
026: project contributors may be used to endorse or promote products
027: derived from this software without prior written permission. For
028: written permission, please contact bmc@clapper.org.
029:
030: 4. Products derived from this software may not be called "curn", nor may
031: "clapper.org" appear in their names without prior written permission
032: of Brian M. Clapper.
033:
034: THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
035: WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
036: MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
037: NO EVENT SHALL BRIAN M. CLAPPER BE LIABLE FOR ANY DIRECT, INDIRECT,
038: INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
039: NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
040: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
041: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
042: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
043: THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
044: \*---------------------------------------------------------------------------*/
045:
046: package org.clapper.curn;
047:
048: import org.clapper.util.io.WordWrapWriter;
049: import org.clapper.util.logging.Logger;
050:
051: /**
052: * <p>This static singleton class is used to allocate a new {@link Curn}
053: * object for RSS processing. Hiding the allocation behind a factory allows
054: * for various bootstrap activities, including the installation and use of
055: * a different class loader that adds the plug-in jars and directories
056: * to the load path at runtime.</p>
057: *
058: * @version <tt>$Revision: 7041 $</tt>
059: */
060: public class CurnFactory {
061: /*----------------------------------------------------------------------*\
062: Private Data Items
063: \*----------------------------------------------------------------------*/
064:
065: /**
066: * For log messages
067: */
068: private static Logger log = new Logger(CurnFactory.class); // NOPMD
069:
070: /*----------------------------------------------------------------------*\
071: Constructor
072: \*----------------------------------------------------------------------*/
073:
074: /**
075: * Cannot be instantiated.
076: */
077: private CurnFactory() {
078: }
079:
080: /*----------------------------------------------------------------------*\
081: Public Methods
082: \*----------------------------------------------------------------------*/
083:
084: /**
085: * Create a new {@link Curn} object. The resulting object will be
086: * loaded via a different class loader. This method also implicitly
087: * loads the plug-ins.
088: *
089: * @return the <tt>Curn</tt> object
090: *
091: * @throws CurnException on error
092: */
093: public static Curn newCurn() throws CurnException {
094: // Load the plug-ins.
095:
096: PlugInManager.loadPlugIns();
097:
098: return new Curn(new WordWrapWriter(System.err));
099: }
100: }
|