idl.tmt.documentsource.webcrawl
Class StringReplacementURLMapper
java.lang.Object
|
+--idl.tmt.documentsource.webcrawl.StringReplacementURLMapper
- All Implemented Interfaces:
- java.io.Serializable, URLMapper
- public class StringReplacementURLMapper
- extends java.lang.Object
- implements URLMapper
This class is a generic implementation of the URLMapper interface.
It simply does some string replacement on the URL to translate
from a local-to-remote URL, and vice versa.
Created on Feb 27, 2004
- Author:
- jelsas
- See Also:
- Serialized Form
|
Constructor Summary |
StringReplacementURLMapper(java.net.URL remoteRoot,
java.io.File localRoot)
Creates a new GenericURLMapper class. |
StringReplacementURLMapper(java.net.URL remoteRoot,
java.io.File localRoot,
java.lang.String defaultIndexStr)
Creates a new GenericURLMapper class. |
|
Method Summary |
boolean |
containsLocalFile(java.io.File f)
Indicates whether the mapping contains the local file |
boolean |
containsRemoteURL(java.net.URL u)
Indicates whether the mapping contains the remote URL |
java.lang.String |
getDefaultIndexName()
Returns the default index name -- used for cases where the remote
url ends in a slash |
java.net.URL |
localFileToRemoteURL(java.io.File f)
Converts a local File to a remote URL |
java.io.File |
remoteURLToLocalFile(java.net.URL u)
Converts a remote URL to a local File |
void |
setDefaultIndexName(java.lang.String name)
Sets the default index name |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
remoteRootStr
private java.lang.String remoteRootStr
localRootStr
private java.lang.String localRootStr
defaultIndexStr
private java.lang.String defaultIndexStr
DEFAULT_INDEX_NAME
public static final java.lang.String DEFAULT_INDEX_NAME
StringReplacementURLMapper
public StringReplacementURLMapper(java.net.URL remoteRoot,
java.io.File localRoot,
java.lang.String defaultIndexStr)
- Creates a new GenericURLMapper class.
StringReplacementURLMapper
public StringReplacementURLMapper(java.net.URL remoteRoot,
java.io.File localRoot)
- Creates a new GenericURLMapper class. Defaults the index name
to DEFAULT_INDEX_NAME
remoteURLToLocalFile
public java.io.File remoteURLToLocalFile(java.net.URL u)
- Converts a remote URL to a local File
- Specified by:
remoteURLToLocalFile in interface URLMapper
- See Also:
idl.tmt.documentsource.webcrawl.URLMapper#remoteToLocal(java.net.URL)
localFileToRemoteURL
public java.net.URL localFileToRemoteURL(java.io.File f)
- Converts a local File to a remote URL
- Specified by:
localFileToRemoteURL in interface URLMapper
- See Also:
idl.tmt.documentsource.webcrawl.URLMapper#localToRemote(java.net.URL)
getDefaultIndexName
public java.lang.String getDefaultIndexName()
- Returns the default index name -- used for cases where the remote
url ends in a slash
- Specified by:
getDefaultIndexName in interface URLMapper
- See Also:
URLMapper.getDefaultIndexName()
setDefaultIndexName
public void setDefaultIndexName(java.lang.String name)
- Sets the default index name
- Specified by:
setDefaultIndexName in interface URLMapper
- See Also:
URLMapper.setDefaultIndexName(java.lang.String)
containsLocalFile
public boolean containsLocalFile(java.io.File f)
- Description copied from interface:
URLMapper
- Indicates whether the mapping contains the local file
- Specified by:
containsLocalFile in interface URLMapper
- Following copied from interface:
idl.tmt.documentsource.webcrawl.URLMapper
- Parameters:
f - the file- Returns:
- true if the mapping contains this file
containsRemoteURL
public boolean containsRemoteURL(java.net.URL u)
- Description copied from interface:
URLMapper
- Indicates whether the mapping contains the remote URL
- Specified by:
containsRemoteURL in interface URLMapper
- Following copied from interface:
idl.tmt.documentsource.webcrawl.URLMapper
- Parameters:
u - the url- Returns:
- true if the mapping contains this URL