added initial trackback code - the TrackbackManager which manages scanning
outside Web pages for trackback resources and sending trackback pings
This commit is contained in:
parent
17c12459a5
commit
7e72ec21d0
|
@ -40,6 +40,11 @@ codec.base=/usr/local/java/commons-codec-1.2
|
||||||
# codec.lib=${codec.base}
|
# codec.lib=${codec.base}
|
||||||
# codec.jarfile=commons-codec-1.2.jar
|
# codec.jarfile=commons-codec-1.2.jar
|
||||||
|
|
||||||
|
# [Location of Commons HTTP Client Library 2.0.2]
|
||||||
|
httpclient.base=/usr/local/java/commons-httpclient-2.0.2
|
||||||
|
# httpclient.lib=${httpclient.base}
|
||||||
|
# httpclient.jarfile=commons-httpclient-2.0.2.jar
|
||||||
|
|
||||||
# [Location of Jakarta Regexp Library 1.3]
|
# [Location of Jakarta Regexp Library 1.3]
|
||||||
regexp.base=/usr/local/java/jakarta-regexp-1.3
|
regexp.base=/usr/local/java/jakarta-regexp-1.3
|
||||||
# regexp.lib=${regexp.base}
|
# regexp.lib=${regexp.base}
|
||||||
|
|
|
@ -53,6 +53,11 @@
|
||||||
<property name="codec.lib" value="${codec.base}"/>
|
<property name="codec.lib" value="${codec.base}"/>
|
||||||
<property name="codec.jarfile" value="commons-codec-1.2.jar"/>
|
<property name="codec.jarfile" value="commons-codec-1.2.jar"/>
|
||||||
|
|
||||||
|
<!-- [Location of Commons HTTP Client Library 2.0.2] -->
|
||||||
|
<property name="httpclient.base" value="../commons-httpclient"/>
|
||||||
|
<property name="httpclient.lib" value="${httpclient.base}"/>
|
||||||
|
<property name="httpclient.jarfile" value="commons-httpclient-2.0.2.jar"/>
|
||||||
|
|
||||||
<!-- [Location of Jakarta Regexp Library 1.3] -->
|
<!-- [Location of Jakarta Regexp Library 1.3] -->
|
||||||
<property name="regexp.base" value="../jakarta-regexp"/>
|
<property name="regexp.base" value="../jakarta-regexp"/>
|
||||||
<property name="regexp.lib" value="${regexp.base}"/>
|
<property name="regexp.lib" value="${regexp.base}"/>
|
||||||
|
@ -92,6 +97,7 @@
|
||||||
<fileset dir="${servlet.lib}" includes="${servlet.jarfile}"/>
|
<fileset dir="${servlet.lib}" includes="${servlet.jarfile}"/>
|
||||||
<fileset dir="${collections.lib}" includes="${collections.jarfile}"/>
|
<fileset dir="${collections.lib}" includes="${collections.jarfile}"/>
|
||||||
<fileset dir="${codec.lib}" includes="${codec.jarfile}"/>
|
<fileset dir="${codec.lib}" includes="${codec.jarfile}"/>
|
||||||
|
<fileset dir="${httpclient.lib}" includes="${httpclient.jarfile}"/>
|
||||||
<fileset dir="${regexp.lib}" includes="${regexp.jarfile}"/>
|
<fileset dir="${regexp.lib}" includes="${regexp.jarfile}"/>
|
||||||
<fileset dir="${log4j.lib}" includes="${log4j.jarfile}"/>
|
<fileset dir="${log4j.lib}" includes="${log4j.jarfile}"/>
|
||||||
<fileset dir="${bsf.lib}" includes="${bsf.jarfile}"/>
|
<fileset dir="${bsf.lib}" includes="${bsf.jarfile}"/>
|
||||||
|
@ -183,6 +189,7 @@
|
||||||
<copy todir="${deploy.home}/WEB-INF/lib">
|
<copy todir="${deploy.home}/WEB-INF/lib">
|
||||||
<fileset dir="${collections.lib}" includes="${collections.jarfile}"/>
|
<fileset dir="${collections.lib}" includes="${collections.jarfile}"/>
|
||||||
<fileset dir="${codec.lib}" includes="${codec.jarfile}"/>
|
<fileset dir="${codec.lib}" includes="${codec.jarfile}"/>
|
||||||
|
<fileset dir="${httpclient.lib}" includes="${httpclient.jarfile}"/>
|
||||||
<fileset dir="${regexp.lib}" includes="${regexp.jarfile}"/>
|
<fileset dir="${regexp.lib}" includes="${regexp.jarfile}"/>
|
||||||
<fileset dir="${log4j.lib}" includes="${log4j.jarfile}"/>
|
<fileset dir="${log4j.lib}" includes="${log4j.jarfile}"/>
|
||||||
<fileset dir="${bsf.lib}" includes="${bsf.jarfile}"/>
|
<fileset dir="${bsf.lib}" includes="${bsf.jarfile}"/>
|
||||||
|
|
|
@ -20,11 +20,11 @@ package com.silverwrist.util;
|
||||||
import org.w3c.dom.*;
|
import org.w3c.dom.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class which wraps around the DOM <CODE>Element</CODE> class, providing some
|
* A class which wraps around the DOM {@link org.w3c.dom.Element Element} class, providing some
|
||||||
* additional functionality.
|
* additional functionality.
|
||||||
*
|
*
|
||||||
* @author Eric J. Bowersox <erbo@silcom.com>
|
* @author Eric J. Bowersox <erbo@ricochet.com>
|
||||||
* @version X
|
* @version $Id$
|
||||||
* @see org.w3c.dom.Element
|
* @see org.w3c.dom.Element
|
||||||
*/
|
*/
|
||||||
public final class DOMElementHelper
|
public final class DOMElementHelper
|
||||||
|
@ -34,7 +34,8 @@ public final class DOMElementHelper
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Element elt; // element housed by this helper class
|
/** The {@link org.w3c.dom.Element Element} housed by this helper class. */
|
||||||
|
private final Element elt;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -42,9 +43,9 @@ public final class DOMElementHelper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new <CODE>DOMElementHelper</CODE> to wrap a specific <CODE>Element</CODE>.
|
* Constructs a new <code>DOMElementHelper</code> to wrap a specific {@link org.w3c.dom.Element Element}.
|
||||||
*
|
*
|
||||||
* @param elt The <CODE>Element</CODE> to be wrapped.
|
* @param elt The <code>Element</code> to be wrapped.
|
||||||
*/
|
*/
|
||||||
public DOMElementHelper(Element elt)
|
public DOMElementHelper(Element elt)
|
||||||
{
|
{
|
||||||
|
@ -58,12 +59,12 @@ public final class DOMElementHelper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the content of all text nodes underneath a specified <CODE>Element</CODE>, concatenated
|
* Returns the content of all text nodes underneath a specified {@link org.w3c.dom.Element Element}, concatenated
|
||||||
* together into a single string.
|
* together into a single string.
|
||||||
*
|
*
|
||||||
* @param e The <CODE>Element</CODE> to extract text from.
|
* @param e The <code>Element</code> to extract text from.
|
||||||
* @return The text content under this <CODE>Element</CODE> node. If the specified <CODE>Element</CODE>
|
* @return The text content under this <code>Element</code> node. If the specified <code>Element</code>
|
||||||
* has no text nodes underneath it, returns <CODE>null.</CODE>
|
* has no text nodes underneath it, returns <code>null.</code>
|
||||||
*/
|
*/
|
||||||
private static final String getTextOfElement(Element e)
|
private static final String getTextOfElement(Element e)
|
||||||
{
|
{
|
||||||
|
@ -95,12 +96,12 @@ public final class DOMElementHelper
|
||||||
} // end getTextOfElement
|
} // end getTextOfElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of the text of the specified <CODE>Element</CODE>, expressed as an integer.
|
* Returns the value of the text of the specified {@link org.w3c.dom.Element Element}, expressed as an integer.
|
||||||
*
|
*
|
||||||
* @param e The <CODE>Element</CODE> to extract text from.
|
* @param e The <code>Element</code> to extract text from.
|
||||||
* @return An <CODE>Integer</CODE> object containing the value of the specified element. If
|
* @return An {@link java.lang.Integer Integer} object containing the value of the specified element. If
|
||||||
* the <CODE>Element</CODE> has no text, or if the text cannot be expressed as an integer,
|
* the <code>Element</code> has no text, or if the text cannot be expressed as an integer,
|
||||||
* returns <CODE>null</CODE>.
|
* returns <code>null</code>.
|
||||||
*/
|
*/
|
||||||
private static final Integer getIntegerFromElement(Element e)
|
private static final Integer getIntegerFromElement(Element e)
|
||||||
{
|
{
|
||||||
|
@ -124,7 +125,7 @@ public final class DOMElementHelper
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the <CODE>Element</CODE> wrapped by this object.
|
* Returns the {@link org.w3c.dom.Element Element} wrapped by this object.
|
||||||
*
|
*
|
||||||
* @return See above.
|
* @return See above.
|
||||||
*/
|
*/
|
||||||
|
@ -135,12 +136,12 @@ public final class DOMElementHelper
|
||||||
} // end getElement
|
} // end getElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches for the first sub-element of the wrapped <CODE>Element</CODE> with the given name.
|
* Searches for the first sub-element of the wrapped {@link org.w3c.dom.Element Element} with the given name.
|
||||||
*
|
*
|
||||||
* @param name Name of the sub-element to search for.
|
* @param name Name of the sub-element to search for.
|
||||||
* @return The first sub-element of the wrapped <CODE>Element</CODE> with the specified name.
|
* @return The first sub-element of the wrapped <code>Element</code> with the specified name.
|
||||||
* If the <CODE>Element</CODE> has no child <CODE>Elements</CODE> with the given name,
|
* If the <code>Element</code> has no child <code>Elements</code> with the given name,
|
||||||
* the method returns <CODE>null</CODE>.
|
* the method returns <code>null</code>.
|
||||||
*/
|
*/
|
||||||
public final Element getSubElement(String name)
|
public final Element getSubElement(String name)
|
||||||
{
|
{
|
||||||
|
@ -160,11 +161,11 @@ public final class DOMElementHelper
|
||||||
} // end getSubElement
|
} // end getSubElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the content of all text nodes underneath the wrapped <CODE>Element</CODE>, concatenated
|
* Returns the content of all text nodes underneath the wrapped {@link org.w3c.dom.Element Element}, concatenated
|
||||||
* together into a single string.
|
* together into a single string.
|
||||||
*
|
*
|
||||||
* @return The text content under the wrapped <CODE>Element</CODE> node. If the wrapped <CODE>Element</CODE>
|
* @return The text content under the wrapped <code>Element</code> node. If the wrapped <code>Element</code>
|
||||||
* has not text nodes underneath it, returns <CODE>null.</CODE>
|
* has not text nodes underneath it, returns <code>null.</code>
|
||||||
*/
|
*/
|
||||||
public final String getElementText()
|
public final String getElementText()
|
||||||
{
|
{
|
||||||
|
@ -173,11 +174,11 @@ public final class DOMElementHelper
|
||||||
} // end getElementText
|
} // end getElementText
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of the text of the wrapped <CODE>Element</CODE>, expressed as an integer.
|
* Returns the value of the text of the wrapped {@link org.w3c.dom.Element Element}, expressed as an integer.
|
||||||
*
|
*
|
||||||
* @return An <CODE>Integer</CODE> object containing the value of the wrapped element. If
|
* @return An {@link java.lang.Integer Integer} object containing the value of the wrapped element. If
|
||||||
* the <CODE>Element</CODE> has no text, or if the text cannot be expressed as an integer,
|
* the <code>Element</code> has no text, or if the text cannot be expressed as an integer,
|
||||||
* returns <CODE>null</CODE>.
|
* returns <code>null</code>.
|
||||||
*/
|
*/
|
||||||
public final Integer getElementInt()
|
public final Integer getElementInt()
|
||||||
{
|
{
|
||||||
|
@ -187,12 +188,12 @@ public final class DOMElementHelper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the content of all text nodes underneath the first sub-element of the wrapped
|
* Returns the content of all text nodes underneath the first sub-element of the wrapped
|
||||||
* <CODE>Element</CODE>, with the given name, concatenated together into a single string.
|
* {@link org.w3c.dom.Element Element}, with the given name, concatenated together into a single string.
|
||||||
*
|
*
|
||||||
* @param name The name of the sub-element to search for.
|
* @param name The name of the sub-element to search for.
|
||||||
* @return The text content under the specified sub-element of the wrapped <CODE>Element</CODE> node.
|
* @return The text content under the specified sub-element of the wrapped <code>Element</code> node.
|
||||||
* If the wrapped <CODE>Element</CODE> does not have a sub-element with the given name, or
|
* If the wrapped <code>Element</code> does not have a sub-element with the given name, or
|
||||||
* that sub-element has no text nodes underneath it, returns <CODE>null.</CODE>
|
* that sub-element has no text nodes underneath it, returns <code>null.</code>
|
||||||
*/
|
*/
|
||||||
public final String getSubElementText(String name)
|
public final String getSubElementText(String name)
|
||||||
{
|
{
|
||||||
|
@ -203,13 +204,13 @@ public final class DOMElementHelper
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of the text underneath the first sub-element of the wrapped
|
* Returns the value of the text underneath the first sub-element of the wrapped
|
||||||
* <CODE>Element</CODE>, with the given name, expressed as an integer.
|
* {@link org.w3c.dom.Element Element}, with the given name, expressed as an integer.
|
||||||
*
|
*
|
||||||
* @param name The name of the sub-element to search for.
|
* @param name The name of the sub-element to search for.
|
||||||
* @return An <CODE>Integer</CODE> object containing the value of the specified element. If
|
* @return An {@link java.lang.Integer Integer} object containing the value of the specified element. If
|
||||||
* the wrapped <CODE>Element</CODE> does not have a sub-element with the given name, or that
|
* the wrapped <code>Element</code> does not have a sub-element with the given name, or that
|
||||||
* sub-element has no text, or if the text cannot be expressed as an integer, returns
|
* sub-element has no text, or if the text cannot be expressed as an integer, returns
|
||||||
* <CODE>null</CODE>.
|
* <code>null</code>.
|
||||||
*/
|
*/
|
||||||
public final Integer getSubElementInt(String name)
|
public final Integer getSubElementInt(String name)
|
||||||
{
|
{
|
||||||
|
@ -219,11 +220,11 @@ public final class DOMElementHelper
|
||||||
} // end getSubElementInt
|
} // end getSubElementInt
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the wrapped <CODE>Element</CODE> has a sub-element with the given name.
|
* Determines whether the wrapped {@link org.w3c.dom.Element Element} has a sub-element with the given name.
|
||||||
*
|
*
|
||||||
* @param name Name of the sub-element to search for.
|
* @param name Name of the sub-element to search for.
|
||||||
* @return <CODE>true</CODE> if the wrapped <CODE>Element</CODE> has a sub-element with the
|
* @return <code>true</code> if the wrapped <code>Element</code> has a sub-element with the
|
||||||
* specified name, <CODE>false</CODE> if not.
|
* specified name, <code>false</code> if not.
|
||||||
*/
|
*/
|
||||||
public final boolean hasChildElement(String name)
|
public final boolean hasChildElement(String name)
|
||||||
{
|
{
|
||||||
|
@ -232,11 +233,11 @@ public final class DOMElementHelper
|
||||||
} // end hasChildElement
|
} // end hasChildElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the wrapped <CODE>Element</CODE> has an attribute with the given name.
|
* Determines whether the wrapped {@link org.w3c.dom.Element Element} has an attribute with the given name.
|
||||||
*
|
*
|
||||||
* @param name Name of the attribute to search for.
|
* @param name Name of the attribute to search for.
|
||||||
* @return <CODE>true</CODE> if the wrapped <CODE>Element</CODE> has an attribute with the
|
* @return <code>true</code> if the wrapped <code>Element</code> has an attribute with the
|
||||||
* specified name, <CODE>false</CODE> if not.
|
* specified name, <code>false</code> if not.
|
||||||
*/
|
*/
|
||||||
public final boolean hasAttribute(String name)
|
public final boolean hasAttribute(String name)
|
||||||
{
|
{
|
||||||
|
@ -245,13 +246,13 @@ public final class DOMElementHelper
|
||||||
} // end hasAttribute
|
} // end hasAttribute
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the value of a specified attribute of the wrapped <CODE>Element</CODE>, expressed as
|
* Returns the value of a specified attribute of the wrapped {@link org.w3c.dom.Element Element}, expressed as
|
||||||
* an integer.
|
* an integer.
|
||||||
*
|
*
|
||||||
* @param name Name of the attribute to search for.
|
* @param name Name of the attribute to search for.
|
||||||
* @return An <CODE>Integer</CODE> object containing the value of the specified attribute. If
|
* @return An {@link java.lang.Integer Integer} object containing the value of the specified attribute. If
|
||||||
* the wrapped <CODE>Element</CODE> has no such attribute, or if the attribute's value
|
* the wrapped <code>Element</code> has no such attribute, or if the attribute's value
|
||||||
* cannot be expressed as an integer, returns <CODE>null</CODE>.
|
* cannot be expressed as an integer, returns <code>null</code>.
|
||||||
*/
|
*/
|
||||||
public final Integer getAttributeInt(String name)
|
public final Integer getAttributeInt(String name)
|
||||||
{
|
{
|
||||||
|
@ -271,6 +272,15 @@ public final class DOMElementHelper
|
||||||
|
|
||||||
} // end getAttributeInt
|
} // end getAttributeInt
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of a specified attribute of the wrapped {@link org.w3c.dom.Element Element}, expressed as
|
||||||
|
* a {@link java.lang.Boolean Boolean}.
|
||||||
|
*
|
||||||
|
* @param name Name of the attribute to search for.
|
||||||
|
* @return A <code>Boolean</code> object containing the value of the specified attribute. If
|
||||||
|
* the wrapped <code>Element</code> has no such attribute, or if the attribute's value
|
||||||
|
* cannot be expressed as a Boolean, returns <code>null</code>.
|
||||||
|
*/
|
||||||
public final Boolean getAttributeBoolean(String name)
|
public final Boolean getAttributeBoolean(String name)
|
||||||
{
|
{
|
||||||
String tmp = elt.getAttribute(name);
|
String tmp = elt.getAttribute(name);
|
||||||
|
@ -283,6 +293,17 @@ public final class DOMElementHelper
|
||||||
|
|
||||||
} // end getAttributeBoolean
|
} // end getAttributeBoolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of a specified attribute of the wrapped {@link org.w3c.dom.Element Element}, expressed as
|
||||||
|
* a {@link java.lang.Boolean Boolean}.
|
||||||
|
*
|
||||||
|
* @param name Name of the attribute to search for.
|
||||||
|
* @param default_val Default value to return if the attribute does not exist.
|
||||||
|
* @return A <code>Boolean</code> object containing the value of the specified attribute. If
|
||||||
|
* the wrapped <code>Element</code> has no such attribute, returns the Boolean equivalent of
|
||||||
|
* <code><i>default_val</i></code>. If the attribute's value cannot be expressed as a Boolean,
|
||||||
|
* returns <code>null</code>.
|
||||||
|
*/
|
||||||
public final Boolean getAttributeBoolean(String name, boolean default_val)
|
public final Boolean getAttributeBoolean(String name, boolean default_val)
|
||||||
{
|
{
|
||||||
if (this.hasAttribute(name))
|
if (this.hasAttribute(name))
|
||||||
|
|
|
@ -9,16 +9,27 @@
|
||||||
*
|
*
|
||||||
* The Original Code is the Venice Web Communities System.
|
* The Original Code is the Venice Web Communities System.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
|
||||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||||
* Copyright (C) 2002 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
* Copyright (C) 2002-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
package com.silverwrist.venice.except;
|
package com.silverwrist.venice.except;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface allowing exceptions to be turned into XML-RPC "fault codes."
|
||||||
|
*
|
||||||
|
* @author Eric J. Bowersox <erbo@ricochet.com>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
public interface SupplyFaultCode
|
public interface SupplyFaultCode
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Returns the XML-RPC "fault code" associated with this exception.
|
||||||
|
*
|
||||||
|
* @return See above.
|
||||||
|
*/
|
||||||
public abstract int getFaultCode();
|
public abstract int getFaultCode();
|
||||||
|
|
||||||
} // end interface SupplyFaultCode
|
} // end interface SupplyFaultCode
|
||||||
|
|
76
src/com/silverwrist/venice/except/TrackbackException.java
Normal file
76
src/com/silverwrist/venice/except/TrackbackException.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
/*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||||
|
* (the "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||||
|
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||||
|
* language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* The Original Code is the Venice Web Communities System.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
|
||||||
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||||
|
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*/
|
||||||
|
package com.silverwrist.venice.except;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An exception thrown by trackback operations.
|
||||||
|
*
|
||||||
|
* @author Eric J. Bowersox <erbo@ricochet.com>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class TrackbackException extends VeniceException
|
||||||
|
{
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Constructors
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>TrackbackException</code>.
|
||||||
|
*/
|
||||||
|
public TrackbackException()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>TrackbackException</code> with a text message.
|
||||||
|
*
|
||||||
|
* @param msg The message to set in this exception.
|
||||||
|
*/
|
||||||
|
public TrackbackException(String msg)
|
||||||
|
{
|
||||||
|
super(msg);
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>TrackbackException</code> wrapping another exception.
|
||||||
|
*
|
||||||
|
* @param inner The exception wrapped by this one.
|
||||||
|
*/
|
||||||
|
public TrackbackException(Throwable inner)
|
||||||
|
{
|
||||||
|
super(inner);
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>TrackbackException</code> wrapping another exception.
|
||||||
|
*
|
||||||
|
* @param msg The message to set in this exception.
|
||||||
|
* @param inner The exception wrapped by this one.
|
||||||
|
*/
|
||||||
|
public TrackbackException(String msg, Throwable inner)
|
||||||
|
{
|
||||||
|
super(msg,inner);
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
} // end class TrackbackException
|
|
@ -9,9 +9,9 @@
|
||||||
*
|
*
|
||||||
* The Original Code is the Venice Web Communities System.
|
* The Original Code is the Venice Web Communities System.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
|
||||||
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||||
* Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
* Copyright (C) 2001-2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
@ -22,10 +22,10 @@ import java.io.PrintWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The root exception of all exceptions thrown by the Venice core code. It is capable of "wrapping"
|
* The root exception of all exceptions thrown by the Venice core code. It is capable of "wrapping"
|
||||||
* another exception within it.
|
* another exception within it. (Predating the support for this in JDK 1.4, of course.)
|
||||||
*
|
*
|
||||||
* @author Eric J. Bowersox <erbo@silcom.com>
|
* @author Eric J. Bowersox <erbo@ricochet.com>
|
||||||
* @version X
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class VeniceException extends Exception implements SupplyFaultCode
|
public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,8 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Throwable inner = null; // internal "root cause" exception
|
/** Internal "root cause" exception for this exception. */
|
||||||
|
private final Throwable inner;
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------------
|
/*--------------------------------------------------------------------------------
|
||||||
* Constructors
|
* Constructors
|
||||||
|
@ -42,27 +43,29 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new <CODE>VeniceException</CODE>.
|
* Constructs a new <code>VeniceException</code>.
|
||||||
*/
|
*/
|
||||||
public VeniceException()
|
public VeniceException()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
this.inner = null;
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new <CODE>VeniceException</CODE> with a text message.
|
* Constructs a new <code>VeniceException</code> with a text message.
|
||||||
*
|
*
|
||||||
* @param msg The message to set in this exception.
|
* @param msg The message to set in this exception.
|
||||||
*/
|
*/
|
||||||
public VeniceException(String msg)
|
public VeniceException(String msg)
|
||||||
{
|
{
|
||||||
super(msg);
|
super(msg);
|
||||||
|
this.inner = null;
|
||||||
|
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new <CODE>VeniceException</CODE> wrapping another exception.
|
* Constructs a new <code>VeniceException</code> wrapping another exception.
|
||||||
*
|
*
|
||||||
* @param inner The exception wrapped by this one.
|
* @param inner The exception wrapped by this one.
|
||||||
*/
|
*/
|
||||||
|
@ -74,7 +77,7 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
} // end constructor
|
} // end constructor
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new <CODE>VeniceException</CODE> wrapping another exception.
|
* Constructs a new <code>VeniceException</code> wrapping another exception.
|
||||||
*
|
*
|
||||||
* @param msg The message to set in this exception.
|
* @param msg The message to set in this exception.
|
||||||
* @param inner The exception wrapped by this one.
|
* @param inner The exception wrapped by this one.
|
||||||
|
@ -104,10 +107,10 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
} // end printStackTrace
|
} // end printStackTrace
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints this exception and its backtrace to the specified <CODE>PrintStream</CODE>. Also prints the
|
* Prints this exception and its backtrace to the specified {@link java.io.PrintStream PrintStream}.
|
||||||
* backtrace of any "wrapped" exception.
|
* Also prints the backtrace of any "wrapped" exception.
|
||||||
*
|
*
|
||||||
* @param s <CODE>PrintStream</CODE> to use for output.
|
* @param s <code>PrintStream</code> to use for output.
|
||||||
*/
|
*/
|
||||||
public void printStackTrace(PrintStream s)
|
public void printStackTrace(PrintStream s)
|
||||||
{
|
{
|
||||||
|
@ -117,10 +120,10 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
} // end printStackTrace
|
} // end printStackTrace
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints this exception and its backtrace to the specified <CODE>PrintWriter</CODE>. Also prints the
|
* Prints this exception and its backtrace to the specified {@link java.io.PrintWriter PrintWriter}.
|
||||||
* backtrace of any "wrapped" exception.
|
* Also prints the backtrace of any "wrapped" exception.
|
||||||
*
|
*
|
||||||
* @param s <CODE>PrintWriter</CODE> to use for output.
|
* @param s <code>PrintWriter</code> to use for output.
|
||||||
*/
|
*/
|
||||||
public void printStackTrace(PrintWriter s)
|
public void printStackTrace(PrintWriter s)
|
||||||
{
|
{
|
||||||
|
@ -134,9 +137,14 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the XML-RPC "fault code" associated with this exception.
|
||||||
|
*
|
||||||
|
* @return See above.
|
||||||
|
*/
|
||||||
public int getFaultCode()
|
public int getFaultCode()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0; // default return
|
||||||
|
|
||||||
} // end getFaultCode
|
} // end getFaultCode
|
||||||
|
|
||||||
|
@ -145,6 +153,13 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
*--------------------------------------------------------------------------------
|
*--------------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the supplied exception as a "root cause" to the given {@link java.io.PrintStream PrintStream}.
|
||||||
|
*
|
||||||
|
* @param s <code>PrintStream</code> to print the exception to.
|
||||||
|
* @param t The {@link java.lang.Throwable Throwable} to be printed. If this parameter is
|
||||||
|
* <code>null</code>, this function is a no-op.
|
||||||
|
*/
|
||||||
public static void printRootCause(PrintStream s, Throwable t)
|
public static void printRootCause(PrintStream s, Throwable t)
|
||||||
{
|
{
|
||||||
if (t!=null)
|
if (t!=null)
|
||||||
|
@ -156,6 +171,13 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
|
|
||||||
} // end printRootCause
|
} // end printRootCause
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the supplied exception as a "root cause" to the given {@link java.io.PrintWriter PrintWriter}.
|
||||||
|
*
|
||||||
|
* @param s <code>PrintWriter</code> to print the exception to.
|
||||||
|
* @param t The {@link java.lang.Throwable Throwable} to be printed. If this parameter is
|
||||||
|
* <code>null</code>, this function is a no-op.
|
||||||
|
*/
|
||||||
public static void printRootCause(PrintWriter s, Throwable t)
|
public static void printRootCause(PrintWriter s, Throwable t)
|
||||||
{
|
{
|
||||||
if (t!=null)
|
if (t!=null)
|
||||||
|
@ -173,7 +195,7 @@ public class VeniceException extends Exception implements SupplyFaultCode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the exception wrapped by this exception, or <CODE>null</CODE> if there is none.
|
* Returns the exception wrapped by this exception, or <code>null</code> if there is none.
|
||||||
*
|
*
|
||||||
* @return See above.
|
* @return See above.
|
||||||
*/
|
*/
|
||||||
|
|
179
src/com/silverwrist/venice/std/TrackbackItem.java
Normal file
179
src/com/silverwrist/venice/std/TrackbackItem.java
Normal file
|
@ -0,0 +1,179 @@
|
||||||
|
/*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
||||||
|
* (the "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
|
||||||
|
* WARRANTY OF ANY KIND, either express or implied. See the License for the specific
|
||||||
|
* language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* The Original Code is the Venice Web Communities System.
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is Eric J. Bowersox <erbo@ricochet.com>,
|
||||||
|
* for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
|
||||||
|
* Copyright (C) 2004 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
*/
|
||||||
|
package com.silverwrist.venice.std;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.*;
|
||||||
|
import org.apache.commons.httpclient.NameValuePair;
|
||||||
|
import com.silverwrist.venice.except.TrackbackException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class representing a trackback item found on an external Web page via RDF auto-discovery. This
|
||||||
|
* conforms to the Moveable Type Trackback Protocol, Version 1.1.
|
||||||
|
*
|
||||||
|
* @author Eric J. Bowersox <erbo@ricochet.com>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public abstract class TrackbackItem
|
||||||
|
{
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Attributes
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The URL of this particular trackback item.
|
||||||
|
*/
|
||||||
|
private final URL m_item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The trackback "ping URL" which is used to register trackbacks for this item.
|
||||||
|
*/
|
||||||
|
private final URL m_trackback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The title associated with this item.
|
||||||
|
*/
|
||||||
|
private final String m_title;
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Abstract operations
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a trackback ping to this trackback URL.
|
||||||
|
*
|
||||||
|
* @param url The URL of the trackback item to send to.
|
||||||
|
* @param parms The parameters to pass to the trackback operation.
|
||||||
|
* @exception com.silverwrist.venice.except.TrackbackException If the trackback could not be sent.
|
||||||
|
*/
|
||||||
|
protected abstract void sendPing(String url, NameValuePair[] parms) throws TrackbackException;
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Constructor
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new <code>TrackbackItem</code>.
|
||||||
|
*
|
||||||
|
* @param item The URL of the trackback item.
|
||||||
|
* @param trackback The "trackback ping URL" for this particular trackback item.
|
||||||
|
* @param title The title associated with this trackback item.
|
||||||
|
*/
|
||||||
|
protected TrackbackItem(URL item, URL trackback, String title)
|
||||||
|
{
|
||||||
|
m_item = item;
|
||||||
|
m_trackback = trackback;
|
||||||
|
m_title = title;
|
||||||
|
|
||||||
|
} // end constructor
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Overrides from class Object
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string representation of the object. In general, the <code>toString</code> method returns a
|
||||||
|
* string that "textually represents" this object.
|
||||||
|
*
|
||||||
|
* @return A string representation of the object.
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
StringBuffer buf = new StringBuffer("{TrackbackItem: item = ");
|
||||||
|
buf.append(m_item).append(", trackback ping = ").append(m_trackback).append(", title = \"");
|
||||||
|
buf.append(m_title).append("\"}");
|
||||||
|
return buf.toString();
|
||||||
|
|
||||||
|
} // end toString
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* Public getters
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link java.net.URL URL} of this trackback item.
|
||||||
|
*
|
||||||
|
* @return The URL of this trackback item.
|
||||||
|
*/
|
||||||
|
public URL getItem()
|
||||||
|
{
|
||||||
|
return m_item;
|
||||||
|
|
||||||
|
} // end getItem
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the {@link java.net.URL URL} of the "trackback ping" URL for this trackback.
|
||||||
|
*
|
||||||
|
* @return The URL of the "trackback ping" URL for this trackback.
|
||||||
|
*/
|
||||||
|
public URL getTrackbackURL()
|
||||||
|
{
|
||||||
|
return m_trackback;
|
||||||
|
|
||||||
|
} // end getTrackbackURL
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the title of this trackback item.
|
||||||
|
*
|
||||||
|
* @return The title of this trackback item.
|
||||||
|
*/
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return m_title;
|
||||||
|
|
||||||
|
} // end getTitle
|
||||||
|
|
||||||
|
/*--------------------------------------------------------------------------------
|
||||||
|
* External operations
|
||||||
|
*--------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a trackback ping to this trackback URL.
|
||||||
|
*
|
||||||
|
* @param permalink URL that is the "permalink" to the entity tracking back to this entry.
|
||||||
|
* @param blog_name Name of the blog that is linking to this entry.
|
||||||
|
* @param title Entry title of the entry that is linking to this entry.
|
||||||
|
* @param excerpt Excerpt of the entry that is linked to this entry. (Moveable Type limits this to 255 characters.)
|
||||||
|
* @exception com.silverwrist.venice.except.TrackbackException If the trackback could not be sent.
|
||||||
|
*/
|
||||||
|
public void sendPing(String permalink, String blog_name, String title, String excerpt) throws TrackbackException
|
||||||
|
{
|
||||||
|
// Construct the NameValuePairs that make up the fields.
|
||||||
|
ArrayList tmp = new ArrayList(4);
|
||||||
|
tmp.add(new NameValuePair("url",permalink));
|
||||||
|
if (blog_name!=null)
|
||||||
|
tmp.add(new NameValuePair("blog_name",blog_name));
|
||||||
|
if (title!=null)
|
||||||
|
tmp.add(new NameValuePair("title",title));
|
||||||
|
if (excerpt!=null)
|
||||||
|
tmp.add(new NameValuePair("excerpt",excerpt));
|
||||||
|
NameValuePair[] parms = new NameValuePair[tmp.size()];
|
||||||
|
tmp.toArray(parms);
|
||||||
|
|
||||||
|
// Pass to subfunction.
|
||||||
|
sendPing(m_trackback.toString(),parms);
|
||||||
|
|
||||||
|
} // end sendPing
|
||||||
|
|
||||||
|
} // end class TrackbackItem
|
1084
src/com/silverwrist/venice/std/TrackbackManager.java
Normal file
1084
src/com/silverwrist/venice/std/TrackbackManager.java
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user