IP*Works! V8

ipworks
Class Nntp

java.lang.Object
  |
  +--ipworks.Nntp

public class Nntp
extends java.lang.Object

The NNTP bean is used to read and post articles on Usenet news servers.

The NNTP bean implements a standard Usenet news reader as specified in RFC 977. It can be used to browse Usenet news groups and read and post articles.

The CurrentGroup property sets the current newsgroup. From then on, news articles from that group can be read by setting the article number in CurrentArticle and then calling the appropriate method. Properties such as ArticleCount , FirstArticle , LastArticle provide information about the current state.

The headers and text of the articles are received respectively through the Header and Transfer events. Additionally, up to MaxLines from the article body are provided in the ArticleText property. The GroupOverview event returns information about a range of articles ( OverviewRange ) in CurrentGroup , and the GroupList event is used when listing newsgroup names. The PITrail event provides a trace of the interaction with the server.

The bean supports posting of articles through the ArticleText and AttachedFile properties. The article text is specified in one or both of the above, and then the PostArticle method is called. Article headers are given in a series of properties like ArticleFrom , ArticleSubject , Organization , etc. that map directly to the USENET article header with the same name.


Constructor Summary
Nntp()
           
 
Method Summary
 void addNntpEventListener(ipworks.NntpEventListener l)
           
 java.lang.String config(java.lang.String configurationString)
          Sets or retrieves a beanconfiguration setting.
 void connect()
          Connect to the news server.
 void disconnect()
          Disconnect from the news server.
 void doEvents()
          Processes events from the internal message queue.
 void fetchArticle()
          Get the headers and body of an article specified in CurrentArticle .
 void fetchArticleBody()
          Get only the body of an article specified in CurrentArticle .
 void fetchArticleHeaders()
          Get only the headers of an article specified in CurrentArticle .
 int getArticleCount()
          The estimated number of articles in CurrentGroup .
 java.lang.String getArticleDate()
          The date of the current article.
 java.lang.String getArticleFrom()
          The email address of the author (for posting articles).
 java.lang.String getArticleHeaders()
          The full headers of the article as retrieved from the server.
 java.lang.String getArticleId()
          The message-id of the current article.
 ArticleInfoList getArticleList()
          Collection of articles collected through GroupOverview or GroupSearch .
 java.lang.String getArticleReferences()
          Articles the posted article follows up to.
 java.lang.String getArticleReplyTo()
          The address to reply to (for posting articles).
 java.lang.String getArticleSubject()
          The article subject (for posted articles).
 java.lang.String getArticleText()
          The full text of the article (without the headers).
 java.lang.String getAttachedFile()
          A file name of which the contents will be appended to ArticleText when posting articles.
 java.lang.String getCheckDate()
          The date (format YYMMDD HHMMSS) to check for creation of new groups.
 java.lang.String getCurrentArticle()
          The number or message-id of the current article.
 java.lang.String getCurrentGroup()
          The name of the current group.
 ipworks.Firewall getFirewall()
          A set of properties related to firewall access.
 int getFirstArticle()
          The number of the first article in CurrentGroup.
 GroupInfoList getGroupList()
          Collection of newsgroups listed by ListGroups or ListNewGroups .
 int getLastArticle()
          The number of the last article in CurrentGroup .
 java.lang.String getLastReply()
          The last reply from the server.
 java.lang.String getLocalFile()
          The path to a local file for downloading the article body.
 java.lang.String getLocalHost()
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 int getMaxLines()
          The maximum number of message lines besides headers to retrieve.
 java.lang.String getNewsgroups()
          A comma separated list of newsgroups in which to post the article.
 int getNewsPort()
          The server port for NNTP (default 119).
 java.lang.String getNewsServer()
          The name or address of a news server.
 java.lang.String getOrganization()
          The organization of the author (for posting articles).
 java.lang.String getOtherHeaders()
          An RFC850 compliant string consisting of extra headers (for posting articles).
 java.lang.String getOverviewRange()
          A range for the GroupOverview method (first-last).
 HeaderList getParsedHeaders()
          A cllection of headers returned from the last article retrieval.
 java.lang.String getPassword()
          A login password to login with in the NewsServer .
 java.lang.String getSearchHeader()
          A header for the GroupSearch method.
 java.lang.String getSearchPattern()
          A search pattern for the GroupSearch method.
 java.lang.String getSearchRange()
          A range for the GroupSearch method (first-last).
 int getTimeout()
          A timeout for the bean.
 java.lang.String getUser()
          A user id to login as in the NewsServer .
 void groupOverview()
          Receive an overview for the articles in range OverviewRange in the CurrentGroup .
 void groupSearch()
          Receive an overview for the articles in range SearchRange in the CurrentGroup .
 void interrupt()
          Interrupt the current method.
 boolean isConnected()
          Shows whether the bean is connected.
 boolean isIdle()
          The current status of the component.
 void listGroups()
          List all groups on the server.
 void listNewGroups()
          List all new groups on the server.
 java.lang.String localizeDate(java.lang.String dateTime)
          Converts a valid RFC 822 message date to local date and time.
 void postArticle()
          Post the current article and attached file.
 void removeNntpEventListener(ipworks.NntpEventListener l)
           
 void resetHeaders()
          Reset all of the article headers.
 void setArticleFrom(java.lang.String articleFrom)
          The email address of the author (for posting articles).
 void setArticleReferences(java.lang.String articleReferences)
          Articles the posted article follows up to.
 void setArticleReplyTo(java.lang.String articleReplyTo)
          The address to reply to (for posting articles).
 void setArticleStream(java.io.OutputStream articleStream)
          Post the current article and attached file.
 void setArticleSubject(java.lang.String articleSubject)
          The article subject (for posted articles).
 void setArticleText(java.lang.String articleText)
          The full text of the article (without the headers).
 void setAttachedFile(java.lang.String attachedFile)
          A file name of which the contents will be appended to ArticleText when posting articles.
 void setCheckDate(java.lang.String checkDate)
          The date (format YYMMDD HHMMSS) to check for creation of new groups.
 void setCommand(java.lang.String command)
          Can be used to send additional commands directly to the server.
 void setConnected(boolean connected)
          Shows whether the bean is connected.
 void setCurrentArticle(java.lang.String currentArticle)
          The number or message-id of the current article.
 void setCurrentGroup(java.lang.String currentGroup)
          The name of the current group.
 void setFirewall(ipworks.Firewall firewall)
          A set of properties related to firewall access.
 void setLocalFile(java.lang.String localFile)
          The path to a local file for downloading the article body.
 void setLocalHost(java.lang.String localHost)
          The name of the local host or user-assigned IP interface through which connections are initiated or accepted.
 void setMaxLines(int maxLines)
          The maximum number of message lines besides headers to retrieve.
 void setNewsgroups(java.lang.String newsgroups)
          A comma separated list of newsgroups in which to post the article.
 void setNewsPort(int newsPort)
          The server port for NNTP (default 119).
 void setNewsServer(java.lang.String newsServer)
          The name or address of a news server.
 void setOrganization(java.lang.String organization)
          The organization of the author (for posting articles).
 void setOtherHeaders(java.lang.String otherHeaders)
          An RFC850 compliant string consisting of extra headers (for posting articles).
 void setOverviewRange(java.lang.String overviewRange)
          A range for the GroupOverview method (first-last).
 void setPassword(java.lang.String password)
          A login password to login with in the NewsServer .
 void setSearchHeader(java.lang.String searchHeader)
          A header for the GroupSearch method.
 void setSearchPattern(java.lang.String searchPattern)
          A search pattern for the GroupSearch method.
 void setSearchRange(java.lang.String searchRange)
          A range for the GroupSearch method (first-last).
 void setTimeout(int timeout)
          A timeout for the bean.
 void setUser(java.lang.String user)
          A user id to login as in the NewsServer .
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Nntp

public Nntp()
Method Detail

getArticleCount

public int getArticleCount()
The estimated number of articles in CurrentGroup .

The value of this property is 0 if there is no current group ( CurrentGroup is ""). Otherwise, it is the number of articles in the group as shown by the news server when CurrentGroup is set. For most news servers, this is an estimated value of the number of the articles, rather than the exact value.


getArticleDate

public java.lang.String getArticleDate()
The date of the current article.

If the bean is not connected or CurrentArticle is empty, the value of this property is an empty string. Otherwise, it contains the date of the article as reported by the server. The NewsServer is asked about the headers of the article only if the CurrentArticle property has changed. If CurrentArticle has not changed, the bean returns a cached value.


getArticleFrom

public java.lang.String getArticleFrom()
The email address of the author (for posting articles).

The string in ArticleFrom is posted with a From article header to the news server.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.


setArticleFrom

public void setArticleFrom(java.lang.String articleFrom)
                    throws IPWorksException
The email address of the author (for posting articles).

The string in ArticleFrom is posted with a From article header to the news server.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.

IPWorksException

getArticleHeaders

public java.lang.String getArticleHeaders()
The full headers of the article as retrieved from the server.

If the bean is not connected or CurrentArticle is empty, the value of this property is an empty string. Otherwise, it contains the full headers of the article as reported by the server.

The NewsServer is asked about the headers of the article only if the CurrentArticle property has changed. If CurrentArticle has not changed, the bean returns a cached value.


getArticleId

public java.lang.String getArticleId()
The message-id of the current article.

If the bean is not connected or CurrentArticle is empty, the value of this property is an empty string. Otherwise, it contains the message-id of the article as reported by the server. The NewsServer is asked about the headers of the article only if the CurrentArticle property has changed. If CurrentArticle has not changed, the bean returns a cached value.


getArticleList

public ArticleInfoList getArticleList()
Collection of articles collected through GroupOverview or GroupSearch .

This collection consists of a list of ARTICLEINFO objects. The returned list contains information about each article in the OverviewRange or SearchRange when either GroupOverview or GroupSearch is called.

MaxArticleInfoscan be used to control the number of articles saved.

This collection is indexed from 0 to Count - 1.


getArticleReferences

public java.lang.String getArticleReferences()
Articles the posted article follows up to.

If the ArticleReferences property contains a non-empty string, a References article header is created for the article. This header shows the article-ids the posted article refers to.

The references must be separated by space scharacters.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.


setArticleReferences

public void setArticleReferences(java.lang.String articleReferences)
                          throws IPWorksException
Articles the posted article follows up to.

If the ArticleReferences property contains a non-empty string, a References article header is created for the article. This header shows the article-ids the posted article refers to.

The references must be separated by space scharacters.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.

IPWorksException

getArticleReplyTo

public java.lang.String getArticleReplyTo()
The address to reply to (for posting articles).

If the ArticleReplyTo property contains a non-empty string, a Reply-To article header is created for the article. This header shows the address to use for replies (useful if this address is different from the one in ArticleFrom ).

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.


setArticleReplyTo

public void setArticleReplyTo(java.lang.String articleReplyTo)
                       throws IPWorksException
The address to reply to (for posting articles).

If the ArticleReplyTo property contains a non-empty string, a Reply-To article header is created for the article. This header shows the address to use for replies (useful if this address is different from the one in ArticleFrom ).

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.

IPWorksException

getArticleSubject

public java.lang.String getArticleSubject()
The article subject (for posted articles).

The string in ArticleSubject is posted with a Subject article header to the news server.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.


setArticleSubject

public void setArticleSubject(java.lang.String articleSubject)
                       throws IPWorksException
The article subject (for posted articles).

The string in ArticleSubject is posted with a Subject article header to the news server.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.

IPWorksException

getArticleText

public java.lang.String getArticleText()
The full text of the article (without the headers).

If the bean is not connected or CurrentArticle is empty, the value of this property is an empty string. Otherwise, it contains the full text of the article as reported by the server.

The NewsServer is asked about the text of the article only if the CurrentArticle property has changed. If CurrentArticle has not changed, the bean returns a cached value.

When posting articles, the ArticleText property contains the full text of the article to post.

It is advisable that the text contained in this property be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\\r\\n") . The text in the article lines must contain 7-bit characters so that the article can be successfully transferred through the various Usenet news servers on the Internet.

The bean automatically escapes lines that start with a "." by adding another "." as specified in RFC 977. The article text is unescaped by the news server, so the process is fully transparent.


setArticleText

public void setArticleText(java.lang.String articleText)
                    throws IPWorksException
The full text of the article (without the headers).

If the bean is not connected or CurrentArticle is empty, the value of this property is an empty string. Otherwise, it contains the full text of the article as reported by the server.

The NewsServer is asked about the text of the article only if the CurrentArticle property has changed. If CurrentArticle has not changed, the bean returns a cached value.

When posting articles, the ArticleText property contains the full text of the article to post.

It is advisable that the text contained in this property be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\\r\\n") . The text in the article lines must contain 7-bit characters so that the article can be successfully transferred through the various Usenet news servers on the Internet.

The bean automatically escapes lines that start with a "." by adding another "." as specified in RFC 977. The article text is unescaped by the news server, so the process is fully transparent.

IPWorksException

getAttachedFile

public java.lang.String getAttachedFile()
A file name of which the contents will be appended to ArticleText when posting articles.

The content of AttachedFile is appended to the text in ArticleText (if any) and sent to the news server. This property is useful for posting arbitrarily large articles and/or sending MIME attachments.

It is advisable that the text contained in the file be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\\r\\n") . The text in the message lines must contain only 7-bit characters so that the message may be successfully sent through the various Usenet news servers on the Internet.

The bean automatically escapes lines that start with a "." by adding another as specified in RFC 822. The article text is unescaped by the news server, so the process is fully transparent.


setAttachedFile

public void setAttachedFile(java.lang.String attachedFile)
                     throws IPWorksException
A file name of which the contents will be appended to ArticleText when posting articles.

The content of AttachedFile is appended to the text in ArticleText (if any) and sent to the news server. This property is useful for posting arbitrarily large articles and/or sending MIME attachments.

It is advisable that the text contained in the file be a collection of lines with lengths less than or equal to 80 bytes separated by CRLF ("\\r\\n") . The text in the message lines must contain only 7-bit characters so that the message may be successfully sent through the various Usenet news servers on the Internet.

The bean automatically escapes lines that start with a "." by adding another as specified in RFC 822. The article text is unescaped by the news server, so the process is fully transparent.

IPWorksException

getCheckDate

public java.lang.String getCheckDate()
The date (format YYMMDD HHMMSS) to check for creation of new groups. If the group was created after the date specified, it is considered new.

The value of this property is used as an argument for the ListNewGroups method.


setCheckDate

public void setCheckDate(java.lang.String checkDate)
                  throws IPWorksException
The date (format YYMMDD HHMMSS) to check for creation of new groups. If the group was created after the date specified, it is considered new.

The value of this property is used as an argument for the ListNewGroups method.

IPWorksException

setCommand

public void setCommand(java.lang.String command)
                throws IPWorksException
Can be used to send additional commands directly to the server.

Check the LastReply property and/or trap the PITrail events comming from the server to get the response.

IPWorksException

isConnected

public boolean isConnected()
Shows whether the bean is connected.

Use this property to determine whether the bean is connected to the remote host or not.


setConnected

public void setConnected(boolean connected)
                  throws IPWorksException
Shows whether the bean is connected.

Use this property to determine whether the bean is connected to the remote host or not.

IPWorksException

getCurrentArticle

public java.lang.String getCurrentArticle()
The number or message-id of the current article.

The CurrentArticle property specifies either a message id or an article number uniquely identifying a particular article. It is then used as an argument to methods such as FetchArticle .


setCurrentArticle

public void setCurrentArticle(java.lang.String currentArticle)
                       throws IPWorksException
The number or message-id of the current article.

The CurrentArticle property specifies either a message id or an article number uniquely identifying a particular article. It is then used as an argument to methods such as FetchArticle .

IPWorksException

getCurrentGroup

public java.lang.String getCurrentGroup()
The name of the current group.

When the CurrentGroup property is set to a valid group name, the bean sends an NNTP GROUP command to the NewsServer and enters the specified group. If the command is successful, FirstArticle , LastArticle , and ArticleCount are set to the reported values for the group. CurrentGroup is then used for all references to articles (until changed to another group).


setCurrentGroup

public void setCurrentGroup(java.lang.String currentGroup)
                     throws IPWorksException
The name of the current group.

When the CurrentGroup property is set to a valid group name, the bean sends an NNTP GROUP command to the NewsServer and enters the specified group. If the command is successful, FirstArticle , LastArticle , and ArticleCount are set to the reported values for the group. CurrentGroup is then used for all references to articles (until changed to another group).

IPWorksException

getFirewall

public ipworks.Firewall getFirewall()
A set of properties related to firewall access.

This is a FIREWALL type property which contains fields describing the firewall through which the bean will attempt to connect.


setFirewall

public void setFirewall(ipworks.Firewall firewall)
                 throws IPWorksException
A set of properties related to firewall access.

This is a FIREWALL type property which contains fields describing the firewall through which the bean will attempt to connect.

IPWorksException

getFirstArticle

public int getFirstArticle()
The number of the first article in CurrentGroup.

The value of this property is 0 if there is no current group ( CurrentGroup is "").


getGroupList

public GroupInfoList getGroupList()
Collection of newsgroups listed by ListGroups or ListNewGroups .

This collection consists of a list of GROUPINFO objects. These objects contain information about each group such as the name, first and last article, and whether or not you can post to the group.

MaxGroupInfoscan be used to control the number of groups saved.

This collection is indexed from 0 to Count - 1.


isIdle

public boolean isIdle()
The current status of the component.

Idle will be False if the component is currently busy (communicating and/or waiting for an answer), and True at all other times.


getLastArticle

public int getLastArticle()
The number of the last article in CurrentGroup .

The value of this property is 0 if there is no current group ( CurrentGroup is "").


getLastReply

public java.lang.String getLastReply()
The last reply from the server.

This is the last reply received from the server. It can be used for information purposes. The same information and more can also be retrieved through the PITrail event.


getLocalFile

public java.lang.String getLocalFile()
The path to a local file for downloading the article body. If the file exists, it is overwritten. (optional)

The LocalFile property is used when retrieving an article. If LocalFile is empty then the received data is provided through the parameters of the Transfer event


setLocalFile

public void setLocalFile(java.lang.String localFile)
                  throws IPWorksException
The path to a local file for downloading the article body. If the file exists, it is overwritten. (optional)

The LocalFile property is used when retrieving an article. If LocalFile is empty then the received data is provided through the parameters of the Transfer event

IPWorksException

getLocalHost

public java.lang.String getLocalHost()
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.


setLocalHost

public void setLocalHost(java.lang.String localHost)
                  throws IPWorksException
The name of the local host or user-assigned IP interface through which connections are initiated or accepted.

The LocalHost property contains the name of the local host as obtained by the gethostname() system call, or if the user has assigned an IP address, the value of that address.

In multihomed hosts (machines with more than one IP interface) setting LocalHost to the value of an interface will make the bean initiate connections (or accept in the case of server beans) only through that interface.

If the bean is connected, the LocalHost property shows the IP address of the interface through which the connection is made in internet dotted format (aaa.bbb.ccc.ddd). In most cases, this is the address of the local host, except for multihomed hosts (machines with more than one IP interface).

NOTE: LocalHost is not persistent. You must always set it in code, and never in the property window.

IPWorksException

getMaxLines

public int getMaxLines()
The maximum number of message lines besides headers to retrieve.

The MaxLines property is used to limit the number of text lines besides headers retrieved for messages. This property is used in conjunction with the ArticleText property. Please note that due to NNTP protocol limitations, the full text of the article is always retrieved from the server, but only MaxLines will be stored in ArticleText .

The default value of the property is 0. In this case the entire message will be retrieved, without interruptions.


setMaxLines

public void setMaxLines(int maxLines)
                 throws IPWorksException
The maximum number of message lines besides headers to retrieve.

The MaxLines property is used to limit the number of text lines besides headers retrieved for messages. This property is used in conjunction with the ArticleText property. Please note that due to NNTP protocol limitations, the full text of the article is always retrieved from the server, but only MaxLines will be stored in ArticleText .

The default value of the property is 0. In this case the entire message will be retrieved, without interruptions.

IPWorksException

getNewsgroups

public java.lang.String getNewsgroups()
A comma separated list of newsgroups in which to post the article.

The string in Newsgroups is posted with a Newsgroups article header to the news server. It specifies the list of groups where the article is posted (comma separated).

If the Newsgroups property contains "" (empty string), then the value of the CurrentGroup property is used to specify the target newsgroup for the posted article.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.


setNewsgroups

public void setNewsgroups(java.lang.String newsgroups)
                   throws IPWorksException
A comma separated list of newsgroups in which to post the article.

The string in Newsgroups is posted with a Newsgroups article header to the news server. It specifies the list of groups where the article is posted (comma separated).

If the Newsgroups property contains "" (empty string), then the value of the CurrentGroup property is used to specify the target newsgroup for the posted article.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.

IPWorksException

getNewsPort

public int getNewsPort()
The server port for NNTP (default 119).

A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.


setNewsPort

public void setNewsPort(int newsPort)
                 throws IPWorksException
The server port for NNTP (default 119).

A valid port number (a value between 1 and 65535) is required for the connection to take place. The property must be set before a connection is attempted and cannot be changed once a connection is established. Any attempt to change this property while connected will fail with an error.

IPWorksException

getNewsServer

public java.lang.String getNewsServer()
The name or address of a news server.

The NewsServer property specifies the IP address (IP number in dotted internet format) or Domain Name for the news server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the NewsServer property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the NewsServer property is set to the corresponding address. If the search is not successful, an error is returned.

If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceeded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.


setNewsServer

public void setNewsServer(java.lang.String newsServer)
                   throws IPWorksException
The name or address of a news server.

The NewsServer property specifies the IP address (IP number in dotted internet format) or Domain Name for the news server. It is set before a connection is attempted and cannot be changed once a connection is in progress.

If the NewsServer property is set to a Domain Name, a DNS request is initiated and upon successful termination of the request, the NewsServer property is set to the corresponding address. If the search is not successful, an error is returned.

If the bean is configured to use a SOCKS firewall, the value assigned to this property may be preceeded with a "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution.

IPWorksException

getOrganization

public java.lang.String getOrganization()
The organization of the author (for posting articles).

If the Organization property contains a non-empty string, an Organization article header is created for the article. This header shows the organization of the author and is used for information purposes only.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.


setOrganization

public void setOrganization(java.lang.String organization)
                     throws IPWorksException
The organization of the author (for posting articles).

If the Organization property contains a non-empty string, an Organization article header is created for the article. This header shows the organization of the author and is used for information purposes only.

If the resulting header is longer thanMaxHeaderLength, then it is folded according to RFC 850 specifications.

IPWorksException

getOtherHeaders

public java.lang.String getOtherHeaders()
An RFC850 compliant string consisting of extra headers (for posting articles).

The OtherHeaders property contains a string of headers to be appended to the message headers created from other properties like From , Subject , etc.

The headers must be of the format "header: value" as specified in RFC 850. [Header lines should be separated by CRLF ("\\r\\n") .

Use this property with caution. If OtherHeaders contains invalid headers, article posting might not be successful.

The OtherHeaders property is useful for extending the functionality of the bean. A good example is posting of MIME attachments.

SPECIAL CASE: if OtherHeaders starts with an empty line (CRLF), then the value of OtherHeaders is used instead of the normally computed article headers.


setOtherHeaders

public void setOtherHeaders(java.lang.String otherHeaders)
                     throws IPWorksException
An RFC850 compliant string consisting of extra headers (for posting articles).

The OtherHeaders property contains a string of headers to be appended to the message headers created from other properties like From , Subject , etc.

The headers must be of the format "header: value" as specified in RFC 850. [Header lines should be separated by CRLF ("\\r\\n") .

Use this property with caution. If OtherHeaders contains invalid headers, article posting might not be successful.

The OtherHeaders property is useful for extending the functionality of the bean. A good example is posting of MIME attachments.

SPECIAL CASE: if OtherHeaders starts with an empty line (CRLF), then the value of OtherHeaders is used instead of the normally computed article headers.

IPWorksException

getOverviewRange

public java.lang.String getOverviewRange()
A range for the GroupOverview method (first-last).

The OverviewRange specifies a range of articles for which to retrieve article overviews from the server. The format is 'first-last' where first is "" (empty string) or a positive number, and last is "" (empty string), a positive number, or the token end .

The default value of the property is '-', meaning 'all articles in the group' .


setOverviewRange

public void setOverviewRange(java.lang.String overviewRange)
                      throws IPWorksException
A range for the GroupOverview method (first-last).

The OverviewRange specifies a range of articles for which to retrieve article overviews from the server. The format is 'first-last' where first is "" (empty string) or a positive number, and last is "" (empty string), a positive number, or the token end .

The default value of the property is '-', meaning 'all articles in the group' .

IPWorksException

getParsedHeaders

public HeaderList getParsedHeaders()
A cllection of headers returned from the last article retrieval.

This property is populated when either FetchArticle or FetchArticleHeaders is called, and contains a list of all of the headers from the article fetched.

If the header line being retrieved is a continuation header line, then the Field parameter contains "" (empty string).

MaxHeaderscan be used to control the number of headers saved.

This collection is indexed from 0 to Count - 1.


getPassword

public java.lang.String getPassword()
A login password to login with in the NewsServer .

If the Password property is set to a non-empty string, then when connecting to the NewsServer an AUTHINFO PASS command is sent in order to provide authentication information for the user. This command is not part of the NNTP protocol, but it is widely used by popular news servers.


setPassword

public void setPassword(java.lang.String password)
                 throws IPWorksException
A login password to login with in the NewsServer .

If the Password property is set to a non-empty string, then when connecting to the NewsServer an AUTHINFO PASS command is sent in order to provide authentication information for the user. This command is not part of the NNTP protocol, but it is widely used by popular news servers.

IPWorksException

getSearchHeader

public java.lang.String getSearchHeader()
A header for the GroupSearch method.

The SearchHeader property specifies the header to search for SearchPattern (e.g. "Subject").


setSearchHeader

public void setSearchHeader(java.lang.String searchHeader)
                     throws IPWorksException
A header for the GroupSearch method.

The SearchHeader property specifies the header to search for SearchPattern (e.g. "Subject").

IPWorksException

getSearchPattern

public java.lang.String getSearchPattern()
A search pattern for the GroupSearch method.

The format of the pattern is the same as the patterns used by the UNIX 'find' command.

As an example, "* new *" will match all headers that contain the word "new".


setSearchPattern

public void setSearchPattern(java.lang.String searchPattern)
                      throws IPWorksException
A search pattern for the GroupSearch method.

The format of the pattern is the same as the patterns used by the UNIX 'find' command.

As an example, "* new *" will match all headers that contain the word "new".

IPWorksException

getSearchRange

public java.lang.String getSearchRange()
A range for the GroupSearch method (first-last).

The SearchRange specifies a range of articles for which to to do a search on the server. The format is 'first-last' where first is "" (empty string) or a positive number, and last is "" (empty string), a positive number, or the token end .

The default value of the property is '-', meaning 'search all articles in the group' .


setSearchRange

public void setSearchRange(java.lang.String searchRange)
                    throws IPWorksException
A range for the GroupSearch method (first-last).

The SearchRange specifies a range of articles for which to to do a search on the server. The format is 'first-last' where first is "" (empty string) or a positive number, and last is "" (empty string), a positive number, or the token end .

The default value of the property is '-', meaning 'search all articles in the group' .

IPWorksException

getTimeout

public int getTimeout()
A timeout for the bean.

If the Timeout property is set to 0, all operations will run uninterrupted until successful completion, or an error condition is encountered.

If Timeout is set to a positive value, the bean will wait for the operation to complete before returning control.

The bean will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the bean throws an IPWorksException raises an IPWorksException exception .

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when data is successfully sent or received.

Optionally, the behaviour of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.

This behavior is controlled by theAbsoluteTimeoutconfiguration setting.

The default value for the Timeout property is 60 (seconds).


setTimeout

public void setTimeout(int timeout)
                throws IPWorksException
A timeout for the bean.

If the Timeout property is set to 0, all operations will run uninterrupted until successful completion, or an error condition is encountered.

If Timeout is set to a positive value, the bean will wait for the operation to complete before returning control.

The bean will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive.

If Timeout expires, and the operation is not yet complete, the bean throws an IPWorksException raises an IPWorksException exception .

Please note that by default, all timeouts are inactivity timeouts , i.e. the timeout period is extended by Timeout seconds when data is successfully sent or received.

Optionally, the behaviour of the bean may be changed to absolute timeouts , i.e. the bean will wait for a maximum of Timeout seconds since the beginning of the operation, without extending the timeout period during communications.

This behavior is controlled by theAbsoluteTimeoutconfiguration setting.

The default value for the Timeout property is 60 (seconds).

IPWorksException

getUser

public java.lang.String getUser()
A user id to login as in the NewsServer .

If the User property is set to a non-empty string, then when connecting to the NewsServer an AUTHINFO USER command is sent in order to provide authentication information for the user. Although this command is not part of the NNTP protocol, it is widely used by news servers for authentication purposes.


setUser

public void setUser(java.lang.String user)
             throws IPWorksException
A user id to login as in the NewsServer .

If the User property is set to a non-empty string, then when connecting to the NewsServer an AUTHINFO USER command is sent in order to provide authentication information for the user. Although this command is not part of the NNTP protocol, it is widely used by news servers for authentication purposes.

IPWorksException

config

public java.lang.String config(java.lang.String configurationString)
                        throws IPWorksException
Sets or retrieves a beanconfiguration setting.

Config is a generic method available in every bean. It is used to set and retrieveconfiguration settingsfor the bean.

Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the bean, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY , you must call Config("PROPERTY=VALUE") , where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY") . The value will be returned as a string.

IPWorksException

connect

public void connect()
             throws IPWorksException
Connect to the news server.

Connect to the news server. If the User and/or Password are set, then corresponding AUTHINFO commands are sent to the NewsServer as well.

IPWorksException

disconnect

public void disconnect()
                throws IPWorksException
Disconnect from the news server.

Disconnect from the NewsServer . First the bean attempts to send a QUIT command, and if that fails, the connection is broken.

IPWorksException

doEvents

public void doEvents()
              throws IPWorksException
Processes events from the internal message queue.

When DoEvents is called, the bean processes any available events. If no events are available, it waits for a preset period of time, and then returns.

IPWorksException

fetchArticle

public void fetchArticle()
                  throws IPWorksException
Get the headers and body of an article specified in CurrentArticle .

Get the headers and body of the article specified in CurrentArticle . The headers are delivered via the Header event, and the article body via the Transfer event.

If a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

fetchArticleBody

public void fetchArticleBody()
                      throws IPWorksException
Get only the body of an article specified in CurrentArticle .

Get only the body of the article specified in CurrentArticle . The body via the Transfer event.

If a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

fetchArticleHeaders

public void fetchArticleHeaders()
                         throws IPWorksException
Get only the headers of an article specified in CurrentArticle .

Get only the headers of the article specified in CurrentArticle . The headers are delivered via the Header event.

If a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

groupOverview

public void groupOverview()
                   throws IPWorksException
Receive an overview for the articles in range OverviewRange in the CurrentGroup .

Receive an overview for the articles in range OverviewRange in the CurrentGroup . The overview data is delivered via the GroupOverview event.

If a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

groupSearch

public void groupSearch()
                 throws IPWorksException
Receive an overview for the articles in range SearchRange in the CurrentGroup .

Searches the current newsgroup for articles in range SearchRange in the CurrentGroup , where SearchHeader matches SearchPattern . The results are delivered via the GroupSearch event.

If a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

interrupt

public void interrupt()
               throws IPWorksException
Interrupt the current method.

If there is no method in progress, Interrupt simply returns doing nothing.

IPWorksException

listGroups

public void listGroups()
                throws IPWorksException
List all groups on the server.

Asks the server to list all its newsgroups. Use this method with caution as listing groups may take quite a long over slow links. The group names and other information are returned via the GroupList event.

If a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

listNewGroups

public void listNewGroups()
                   throws IPWorksException
List all new groups on the server.

Asks the server to list all the newsgroups created since CheckDate . The group names (if any) and other information are returned via the GroupList event.

If a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

localizeDate

public java.lang.String localizeDate(java.lang.String dateTime)
                              throws IPWorksException
Converts a valid RFC 822 message date to local date and time.

This method can be used to convert an RFC 822 date/time string to the corresponding local date and time.

Dates will be returned in the format: "MM/dd/yyyy hh:mm:ss".

IPWorksException

postArticle

public void postArticle()
                 throws IPWorksException
Post the current article and attached file.

Post the current article and attached file (if any). If a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

resetHeaders

public void resetHeaders()
                  throws IPWorksException
Reset all of the article headers.

Resets all the article headers to "" (empty string). Use this property before posting a new article, so that headers from the previous article are not carried over to the next one.

IPWorksException

setArticleStream

public void setArticleStream(java.io.OutputStream articleStream)
                      throws IPWorksException
Post the current article and attached file.

Post the current article and attached file (if any). If a connection exists, and the ConnectionId is specified, that connection is used. However, if a connection to the NewsServer doesn't already exist, a new one is created.

IPWorksException

addNntpEventListener

public void addNntpEventListener(ipworks.NntpEventListener l)
                          throws java.util.TooManyListenersException
java.util.TooManyListenersException

removeNntpEventListener

public void removeNntpEventListener(ipworks.NntpEventListener l)

IP*Works! V8

Copyright (c) 2007 /n software inc. - All rights reserved.