ch.claudio.pediacache.data
Class Source

java.lang.Object
  extended by ch.claudio.pediacache.data.Source

public class Source
extends java.lang.Object

Each of the wilipedia sites is represented by a source. This object remebers the URL, if it is selected by the user and when it was last seen online.

Version:
$Id: Source.java 148 2006-09-14 20:52:32Z claudio $
Author:
Claudio Nieder

Copyright (C) 2006 Claudio Nieder <private@claudio.ch>, CH-8610 Uster

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Field Summary
static long onlineLimit
          Time limit in which a page is assumed online without rechecking.
 
Constructor Summary
Source(java.net.URL urlArg)
          Create a source item.
 
Method Summary
 void checkIfOnline()
          Request an active check to see if the source can be reached.
 java.lang.String getLanguage()
           
 java.lang.String getLocalLanguage()
           
 java.net.URL getUrl()
           
 boolean isSelected()
           
static void main(java.lang.String[] args)
          Print license.
 boolean maybeOnline()
          Return a good guess wether this source is reachable by comparing the current time with the last time the site was online.
 void notOnline()
          This methode can be called when the site is not seen online, so it will update the time when it was last tested.
 void seenOnline()
          This methode can be called when the site is seen online, so it will update the time when it was last detected online.
 void setLanguage(java.lang.String languageArg)
           
 void setLocalLanguage(java.lang.String localLanguageArg)
           
 void setSelected(boolean selectedArg)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

onlineLimit

public static final long onlineLimit
Time limit in which a page is assumed online without rechecking.

See Also:
Constant Field Values
Constructor Detail

Source

public Source(java.net.URL urlArg)
Create a source item. The url needs to be provided.

Parameters:
urlArg -
Method Detail

getUrl

public java.net.URL getUrl()
Returns:
the url

seenOnline

public void seenOnline()
This methode can be called when the site is seen online, so it will update the time when it was last detected online.


notOnline

public void notOnline()
This methode can be called when the site is not seen online, so it will update the time when it was last tested.


checkIfOnline

public void checkIfOnline()
Request an active check to see if the source can be reached. Perform it only if the source was not implicitly checked in the near past.


maybeOnline

public boolean maybeOnline()
Return a good guess wether this source is reachable by comparing the current time with the last time the site was online.

Returns:
true if site seen in the near past.

getLanguage

public java.lang.String getLanguage()
Returns:
the language

setLanguage

public void setLanguage(java.lang.String languageArg)
Parameters:
languageArg - the language to set

getLocalLanguage

public java.lang.String getLocalLanguage()
Returns:
the localLanguage

setLocalLanguage

public void setLocalLanguage(java.lang.String localLanguageArg)
Parameters:
localLanguageArg - the localLanguage to set

isSelected

public boolean isSelected()
Returns:
the selected

setSelected

public void setSelected(boolean selectedArg)
Parameters:
selectedArg - the selected to set

toString

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

main

public static void main(java.lang.String[] args)
Print license.

Parameters:
args - ignored