scone.netobjects
Class HtmlNode

java.lang.Object
  extended by scone.netobjects.TableRecord
      extended by scone.netobjects.HtmlNode
All Implemented Interfaces:
Cacheable

public class HtmlNode
extends TableRecord

a HtmlNode represents a Html document.
use the static methods provided by this HtmlNodeCache to obtain HtmlNode objects.

Author:
Harald Weinreich, Volkert Buchmann

Field Summary
static java.lang.String COPYRIGHT
           
protected static DBTableAdapter dbTable
           
protected  java.util.Vector inclusions
           
protected  LinkVector incomingLinks
           
protected  NetNode node
           
protected  LinkVector outgoingLinks
           
 
Fields inherited from class scone.netobjects.TableRecord
ctei, date, fieldValues, hasChanged, hasRecordInDB, persistent
 
Constructor Summary
protected HtmlNode(NetNode node)
          creates a new HtmlNode (a NetNode that represents a Html document)
 
Method Summary
 void access()
          sets lastAccess to now and increments accessCounter
if the node is visted for the first time, the method sets firstAccess
 java.lang.String getAbstract()
          returns the abstract of the document.
 int getAccessCounter()
          Returns the times the node has been accessed by any scone-user
 java.lang.String getAccessStatus()
          Returns the status of the node, for example 200 or 404
if -1 is returned, the node has not yet been visited
 java.lang.String getAuthor()
          returns the author of the document
 java.lang.String getBodyText()
          returns the bodyText of the document (any words which are not inside tags)
 java.lang.String getDescription()
          returns the description of the document
 java.lang.String getExtension()
           
 java.lang.String getFile()
           
 java.lang.String getFingerprint()
          returns the fingerprint of the document
 long getFirstAccess()
          Returns the date of the first access of this node.
 java.lang.String getHost()
           
 java.util.Vector getIncludedObjects()
          Returns the Inclusions defined in this document.
 LinkVector getIncomingLinks()
          Returns the Links from other documents to this one.
 java.lang.Object getKey(int KeyNo)
          returns the key of this object which can be used in Hashtable objects
 java.lang.String getLanguage()
          returns the language of the document
 long getLastAccess()
          Returns the date of the last access of this node.
 long getLastModified()
          Returns the date of the last modification of the node (at the server)
 java.lang.String getMimeType()
          Returns the mimeType of the node, for example text/html
 NetNode getNode()
          returns the NetNode where this document is stored
 java.lang.String getNodeId()
          returns the id of the NetNode where this document is stored
 java.lang.String getNumberOfExternalLinks()
          returns the number of links to documents stored on other servers
 java.lang.String getNumberOfImages()
          returns the number of images on the document
 java.lang.String getNumberOfLinks()
          returns the number of links defined in the document
 java.lang.String getNumberOfParagraphs()
          returns the number paragraphs "<P>" of the document
 java.lang.String getNumberOfWords()
          returns the number of words of the document
 LinkVector getOutgoingLinks()
          Returns the Links defined in this document.
 java.lang.String getPath()
           
 java.lang.String getPort()
           
 java.lang.String getProtocol()
           
 java.lang.String getQuery()
           
 java.lang.String getRef()
           
 java.lang.String getSize()
          Returns the size of the node in bytes
 java.lang.String getSourceCode()
          returns the source code of the document
 java.lang.String getSpaceOfImages()
          returns the space of the page occupied by images
 SimpleUri getSUri()
          Returns the parsed URI of the node
 java.lang.String getTitle()
          returns the title of the document
 java.lang.String getUri()
          Returns the URI of the node
protected  void incAccessCounter()
          Increases the accessCounter.
 boolean isAnimation()
          Returns if the page has animated graphics.
 boolean isCommercial()
          Returns if the document is commercial (with Ads etc).
 boolean isCompletelyDownloaded()
          Returns if the page was completely downloaded.
 boolean isForms()
          Returns if the page has form tags.
 boolean isFrames()
          Returns if the page has frames.
 boolean isJavaScript()
          Returns if the page uses JavaScript.
 boolean isPlugins()
          Returns if the page needs a plugin.
 boolean isSound()
          Returns if the page "has" sound.
 void setAbstract(java.lang.String abs)
          sets the abstract of the document: Fist lines...
protected  void setAccessCounter(int v)
          Sets the accesCounter to the specified value.
 void setAccessStatus(java.lang.String v)
          Sets the status of the node, if the status has been -1 and is now changed, firstAccess is set
 void setAnimation(boolean b)
          Set to true, if the page has animated Graphics, movies, flash etc.
 void setAuthor(java.lang.String author)
          sets the author of the document
 void setBodyText(java.lang.String bodyText)
          sets the bodyText of the document (any words which are not inside tags)
 void setCommercial(boolean b)
          Set to true, if the page has ads.
 void setCompletelyDownloaded(boolean b)
          Set to true, if the page was completely downloaded.
 void setDescription(java.lang.String des)
          sets the dexcription of the document
 void setFingerprint(java.lang.String fingerprint)
          sets the fingerprint of the document
 void setForms(boolean b)
          Set to true, if the page has form tags, i.e. it includes forms.
 void setFrames(boolean b)
          Set to true, if the page has a frameset and frame tags.
 void setJavaScript(boolean b)
          Set to true, if the page uses JavaScript.
 void setLanguage(java.lang.String lang)
          sets the language of the document
protected  void setLastAccess(long v)
          Sets the date of the last access (the current access!)
 void setLastModified(long time)
          Sets the date of the last modification of the node (at the server)
 void setMimeType(java.lang.String v)
          Sets the mimeType of the node
 void setNumberOfExternalLinks(java.lang.String v)
          sets the number of links to documents stored on different servers
 void setNumberOfImages(java.lang.String v)
          sets the number of images on the document
 void setNumberOfLinks(java.lang.String links)
          sets the number of links defined in the document
 void setNumberOfParagraphs(java.lang.String p)
          sets the number paragraphs "<P>" of the document
 void setNumberOfWords(java.lang.String v)
          sets the number of words of the document
 void setPlugins(boolean b)
          Set to true, if the page needs a plugin.
 void setSize(java.lang.String size)
          Sets the size of this node in bytes.
 void setSound(boolean b)
          Set to true, if the page has background sound.
 void setSourceCode(java.lang.String sourceCode)
          sets the source code of the document
 void setSpaceOfImages(java.lang.String v)
          sets the space of the page occupied by images
 void setTitle(java.lang.String title)
          sets the title of the document
 void store()
          store this object in the database
 java.lang.String toDocString()
           
 java.lang.String toHostString()
           
 java.lang.String toString()
           
 
Methods inherited from class scone.netobjects.TableRecord
isPersistent, now, setCacheTableEntryInterface, setChanged, setPersistent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COPYRIGHT

public static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

dbTable

protected static DBTableAdapter dbTable

node

protected NetNode node

outgoingLinks

protected LinkVector outgoingLinks

incomingLinks

protected LinkVector incomingLinks

inclusions

protected java.util.Vector inclusions
Constructor Detail

HtmlNode

protected HtmlNode(NetNode node)
creates a new HtmlNode (a NetNode that represents a Html document)

Parameters:
node - the NetNode
Method Detail

getTitle

public java.lang.String getTitle()
returns the title of the document

Returns:
the title of the document

setTitle

public void setTitle(java.lang.String title)
sets the title of the document

Parameters:
title - the title of the document

getAuthor

public java.lang.String getAuthor()
returns the author of the document

Returns:
the author of the document

setAuthor

public void setAuthor(java.lang.String author)
sets the author of the document

Parameters:
author - the author of the document

getDescription

public java.lang.String getDescription()
returns the description of the document

Returns:
the description of the document

setDescription

public void setDescription(java.lang.String des)
sets the dexcription of the document

Parameters:
des - the description of the document

getAbstract

public java.lang.String getAbstract()
returns the abstract of the document. These are the first lines without navigation link text.

Returns:
the abstract of the document

setAbstract

public void setAbstract(java.lang.String abs)
sets the abstract of the document: Fist lines...

Parameters:
des - the abstract of the document

getLanguage

public java.lang.String getLanguage()
returns the language of the document

Returns:
the language of the document

setLanguage

public void setLanguage(java.lang.String lang)
sets the language of the document

Parameters:
lang - the language of the document

getBodyText

public java.lang.String getBodyText()
returns the bodyText of the document (any words which are not inside tags)

Returns:
the bodyText of the document

setBodyText

public void setBodyText(java.lang.String bodyText)
sets the bodyText of the document (any words which are not inside tags)

Parameters:
body - the body of the document

getSourceCode

public java.lang.String getSourceCode()
returns the source code of the document

Returns:
the sourceCode of the document

setSourceCode

public void setSourceCode(java.lang.String sourceCode)
sets the source code of the document

Parameters:
body - the sourceCode of the document

getFingerprint

public java.lang.String getFingerprint()
returns the fingerprint of the document

Returns:
a (quite) unique 16 digit hex number string

setFingerprint

public void setFingerprint(java.lang.String fingerprint)
sets the fingerprint of the document

Parameters:
fingerprint - Fhe fingerprint of the document

getNumberOfLinks

public java.lang.String getNumberOfLinks()
returns the number of links defined in the document

Returns:
the number of links in the document

setNumberOfLinks

public void setNumberOfLinks(java.lang.String links)
sets the number of links defined in the document

Parameters:
links - the number of links in the document

getNumberOfExternalLinks

public java.lang.String getNumberOfExternalLinks()
returns the number of links to documents stored on other servers

Returns:
the number of links to external documents

setNumberOfExternalLinks

public void setNumberOfExternalLinks(java.lang.String v)
sets the number of links to documents stored on different servers

Parameters:
v - the number of links to external documents

getNumberOfImages

public java.lang.String getNumberOfImages()
returns the number of images on the document

Returns:
the number of images

setNumberOfImages

public void setNumberOfImages(java.lang.String v)
sets the number of images on the document

Parameters:
v - the number of images on the document

getSpaceOfImages

public java.lang.String getSpaceOfImages()
returns the space of the page occupied by images

Returns:
the space in sqare pixels, -1 if unknown.

setSpaceOfImages

public void setSpaceOfImages(java.lang.String v)
sets the space of the page occupied by images

Parameters:
v - the sapce used by the images of the document

getNumberOfWords

public java.lang.String getNumberOfWords()
returns the number of words of the document

Returns:
the number of words of the document

setNumberOfWords

public void setNumberOfWords(java.lang.String v)
sets the number of words of the document

Parameters:
v - the number of words of the document

getNumberOfParagraphs

public java.lang.String getNumberOfParagraphs()
returns the number paragraphs "<P>" of the document

Returns:
the number of paragraphs

setNumberOfParagraphs

public void setNumberOfParagraphs(java.lang.String p)
sets the number paragraphs "<P>" of the document

Parameters:
p - the number of paragraphs

getNode

public NetNode getNode()
returns the NetNode where this document is stored

Returns:
the NetNode

getNodeId

public java.lang.String getNodeId()
returns the id of the NetNode where this document is stored

Returns:
the netNodeId

store

public void store()
store this object in the database


getKey

public java.lang.Object getKey(int KeyNo)
returns the key of this object which can be used in Hashtable objects

Specified by:
getKey in interface Cacheable
Specified by:
getKey in class TableRecord
Parameters:
KeyNo - the number of the key to be generated
Returns:
the key

toString

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

getOutgoingLinks

public LinkVector getOutgoingLinks()
Returns the Links defined in this document. CONSIDERLINKS has to be set, for this method to work!

Returns:
a Vector of the outgoing links

getIncomingLinks

public LinkVector getIncomingLinks()
Returns the Links from other documents to this one. CONSIDERLINKS has to be set, for this method to work!

Returns:
a Vector of incoming links

getIncludedObjects

public java.util.Vector getIncludedObjects()
Returns the Inclusions defined in this document. Please node: CONSIDERINCLUSIONS has to be set, for this method to work!

Returns:
a Vector of Inclusions of this Node

access

public void access()
sets lastAccess to now and increments accessCounter
if the node is visted for the first time, the method sets firstAccess


getUri

public java.lang.String getUri()
Returns the URI of the node

Returns:
the URI

getSize

public java.lang.String getSize()
Returns the size of the node in bytes

Returns:
the size in bytes

setSize

public void setSize(java.lang.String size)
Sets the size of this node in bytes.

Parameters:
size - the size in bytes

getLastModified

public long getLastModified()
Returns the date of the last modification of the node (at the server)

Returns:
the lastModified-date

setLastModified

public void setLastModified(long time)
Sets the date of the last modification of the node (at the server)

Parameters:
date - the lastModified-date

getMimeType

public java.lang.String getMimeType()
Returns the mimeType of the node, for example text/html

Returns:
the mimeType

setMimeType

public void setMimeType(java.lang.String v)
Sets the mimeType of the node

Parameters:
v - the mimeType

getAccessStatus

public java.lang.String getAccessStatus()
Returns the status of the node, for example 200 or 404
if -1 is returned, the node has not yet been visited

Returns:
the status, or -1 if no status is available

setAccessStatus

public void setAccessStatus(java.lang.String v)
Sets the status of the node, if the status has been -1 and is now changed, firstAccess is set

Parameters:
v - the status

getFirstAccess

public long getFirstAccess()
Returns the date of the first access of this node.
Be sure that this node has been accessed before this date is used!

Returns:
the date of the first access

getLastAccess

public long getLastAccess()
Returns the date of the last access of this node.
Be sure that this node has been accessed before this date is used!

Returns:
the date of the last access

setLastAccess

protected void setLastAccess(long v)
Sets the date of the last access (the current access!) of the node.
Use access() instead for consistency!

Parameters:
v - the date

getAccessCounter

public int getAccessCounter()
Returns the times the node has been accessed by any scone-user

Returns:
the times the node has been accessed

setAccessCounter

protected void setAccessCounter(int v)
Sets the accesCounter to the specified value.
Use incAccessCounter() instead for consistency!

Parameters:
v - the date

incAccessCounter

protected void incAccessCounter()
Increases the accessCounter.
Use access() instead for consistency!


getSUri

public SimpleUri getSUri()
Returns the parsed URI of the node

Returns:
the parsed URI of the node

isFrames

public boolean isFrames()
Returns if the page has frames.
Bit 0 of type.


setFrames

public void setFrames(boolean b)
Set to true, if the page has a frameset and frame tags.


isForms

public boolean isForms()
Returns if the page has form tags.

Bit 1 of type


setForms

public void setForms(boolean b)
Set to true, if the page has form tags, i.e. it includes forms.


isCommercial

public boolean isCommercial()
Returns if the document is commercial (with Ads etc).
Bit 2 of type.


setCommercial

public void setCommercial(boolean b)
Set to true, if the page has ads.


isJavaScript

public boolean isJavaScript()
Returns if the page uses JavaScript.
Bit 3 of type.


setJavaScript

public void setJavaScript(boolean b)
Set to true, if the page uses JavaScript.


isPlugins

public boolean isPlugins()
Returns if the page needs a plugin.
Bit 4 of type


setPlugins

public void setPlugins(boolean b)
Set to true, if the page needs a plugin.


isAnimation

public boolean isAnimation()
Returns if the page has animated graphics.
Bit 5 of type.


setAnimation

public void setAnimation(boolean b)
Set to true, if the page has animated Graphics, movies, flash etc.


isSound

public boolean isSound()
Returns if the page "has" sound.
Bit 6 of type.


setSound

public void setSound(boolean b)
Set to true, if the page has background sound.


isCompletelyDownloaded

public boolean isCompletelyDownloaded()
Returns if the page was completely downloaded.


setCompletelyDownloaded

public void setCompletelyDownloaded(boolean b)
Set to true, if the page was completely downloaded. Bit 10 of type.


toDocString

public java.lang.String toDocString()

toHostString

public java.lang.String toHostString()

getProtocol

public java.lang.String getProtocol()

getHost

public java.lang.String getHost()

getPort

public java.lang.String getPort()

getPath

public java.lang.String getPath()

getFile

public java.lang.String getFile()

getExtension

public java.lang.String getExtension()

getQuery

public java.lang.String getQuery()

getRef

public java.lang.String getRef()