de.scheisseichfindemalkeinen.hoster
Class HostManager

java.lang.Object
  extended by de.scheisseichfindemalkeinen.hoster.HostManager

public class HostManager
extends java.lang.Object

Class which holds the host-classes and provides methods to check and parse the URLs There is also a method which removes duplicates from an URL-Array


Method Summary
 boolean checkForImplementedMethodsOfAnInterface(java.lang.Object obj, java.lang.String fullyQualifiedInterfaceName)
          Returns true if interface is implemented and all methods are implemented
 java.util.Vector<URL> checkURL(URL urlObject, BooleanWrapper bOK, ProgressObserver progress)
          Check if a hostclass accepts the url and return a nice filename for the url.
 boolean[] getHosterChecks()
          Returns an array of all checks for the hosters
 Hoster getHosterForURL(java.lang.String url)
          Returns the Hoster for the url or null if not found
 java.util.Vector<java.lang.String> getHosterInfo()
          Returns an array containing Strings with name and version of the classes
 Host[] getHosters()
          Returns an array of all hostclasses
 java.lang.String getHostVersion(java.lang.String name)
          Returns the version of a hostclass
 HostRules getHr()
          Return the HostRules-hostclass
 RedirectManager getRedirectManager()
          Returns the RedirectManager
 boolean hasInterface(java.lang.Object obj, java.lang.String fullyQualifiedInterfaceName)
          Returns true if the object has the interface Checks not if the methods really are implemented
static HostManager instance()
          Returns the singleton
 URLParseObject parseURL(URLParseObject upo)
          Parses the URL by a hostclass and return the parsed URL
 void reInitHosterList()
          Create a sorted hostclass-array
static java.util.ArrayList<URL> removeDuplicates(java.util.ArrayList<URL> vs, boolean ignoreFirstThreeURLs)
          Returns an array of URLs without duplicates
static java.util.Vector<URL> removeDuplicates(java.util.Vector<URL> vs, boolean ignoreFirstThreeURLs)
          Returns an array of URLs without duplicates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static HostManager instance()
Returns the singleton

Returns:
Singleton

reInitHosterList

public void reInitHosterList()
Create a sorted hostclass-array


parseURL

public URLParseObject parseURL(URLParseObject upo)
                        throws HostException
Parses the URL by a hostclass and return the parsed URL

Parameters:
upo - URLParseObject
Returns:
URLParseObject or null
Throws:
HostException

checkURL

public java.util.Vector<URL> checkURL(URL urlObject,
                                      BooleanWrapper bOK,
                                      ProgressObserver progress)
Check if a hostclass accepts the url and return a nice filename for the url. If there is no hostclass available which would accept the url then null is returned

Parameters:
urlObject - URL-Object
bOK - Flag if there is a Hoster for this url
progress - ProgessObserver
Returns:
Array of URL-Objects or null

getHostVersion

public java.lang.String getHostVersion(java.lang.String name)
Returns the version of a hostclass

Parameters:
name - Name
Returns:
Version

getHosters

public Host[] getHosters()
Returns an array of all hostclasses

Returns:
Hostclasses-array

getHosterChecks

public boolean[] getHosterChecks()
Returns an array of all checks for the hosters

Returns:
Hostclasses-Check-array

getHosterInfo

public java.util.Vector<java.lang.String> getHosterInfo()
Returns an array containing Strings with name and version of the classes

Returns:
Array containing Strings with name and version of the classes

getHosterForURL

public Hoster getHosterForURL(java.lang.String url)
Returns the Hoster for the url or null if not found

Parameters:
url - URL
Returns:
Hoster or null

removeDuplicates

public static java.util.ArrayList<URL> removeDuplicates(java.util.ArrayList<URL> vs,
                                                        boolean ignoreFirstThreeURLs)
Returns an array of URLs without duplicates

Parameters:
vs - Array of URLs
ignoreFirstThreeURLs - If True, the first three URLs are always added to the result-Array and are not used for comparison
Returns:
Array of URLs without duplicates

removeDuplicates

public static java.util.Vector<URL> removeDuplicates(java.util.Vector<URL> vs,
                                                     boolean ignoreFirstThreeURLs)
Returns an array of URLs without duplicates

Parameters:
vs - Array of URLs
ignoreFirstThreeURLs - Ignore the first three urls
Returns:
Array of URLs without duplicates

getHr

public HostRules getHr()
Return the HostRules-hostclass

Returns:
HostRules

hasInterface

public boolean hasInterface(java.lang.Object obj,
                            java.lang.String fullyQualifiedInterfaceName)
Returns true if the object has the interface Checks not if the methods really are implemented

Parameters:
obj - Object
fullyQualifiedInterfaceName - Fully qualified interface name
Returns:
true if the object has the interface

checkForImplementedMethodsOfAnInterface

public boolean checkForImplementedMethodsOfAnInterface(java.lang.Object obj,
                                                       java.lang.String fullyQualifiedInterfaceName)
Returns true if interface is implemented and all methods are implemented

Parameters:
obj - Object
fullyQualifiedInterfaceName - Fully qualified interface name
Returns:
true if interface is implemented and all methods are implemented

getRedirectManager

public RedirectManager getRedirectManager()
Returns the RedirectManager

Returns:
RedirectManager