com.meyling.principia.module
Class ModuleAddress

java.lang.Object
  |
  +--com.meyling.principia.module.ModuleAddress

public class ModuleAddress
extends Object

An object of this class represents an address for a module.

Version:
$Revision 0.00.50$
Author:
Michael Meyling

Field Summary
private  String address
          address
private  String fileName
          name of module including version information and postfix
private  String header
          header (including protocol, host, port, user) but without file path
private static String localBuffer
          location for locally buffered module files
private  Version moduleVersion
          moduleVersion
private  Name name
          name of module
private  String path
          path (without protocol, host, port and file name
private  boolean relativeAddress
          is module address relative
private  Version ruleVersion
          ruleVersion
private  URL url
          URL, maybe null if it is a local file
 
Constructor Summary
ModuleAddress(ModuleAddress oldAddress, Name name, Version moduleVersion, Version ruleVersion)
          Constructor.
ModuleAddress(String address)
          Constructor.
ModuleAddress(String address, ModuleAddress parent)
          Constructor.
 
Method Summary
 boolean equals(Object object)
           
 String getAddress()
           
 String getFileName()
           
 String getHeader()
           
 String getLocalName()
          Transform an URL address into a local file path where a module could be buffered
static String getLocalName(String address)
          Transform an URL address into a local file path where a module could be buffered
static String getModuleFileName(Specification spec)
          Get the file name of the specified module.
static String getModuleFileName(String address)
          Get the file name of an module without path and protokoll.
(package private) static ModuleAddress[] getModulePaths(Module module, Specification spec)
          Get all potential module addresses from a module specifiaction.
 Version getModuleVersion()
           
 Name getName()
           
 String getPath()
           
 Version getRuleVersion()
           
 URL getURL()
           
 int hashCode()
           
 boolean isRelativeAddress()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

localBuffer

private static final String localBuffer
location for locally buffered module files

address

private final String address
address

url

private final URL url
URL, maybe null if it is a local file

header

private final String header
header (including protocol, host, port, user) but without file path

path

private final String path
path (without protocol, host, port and file name

fileName

private final String fileName
name of module including version information and postfix

relativeAddress

private final boolean relativeAddress
is module address relative

name

private final Name name
name of module

moduleVersion

private final Version moduleVersion
moduleVersion

ruleVersion

private final Version ruleVersion
ruleVersion
Constructor Detail

ModuleAddress

public ModuleAddress(String address,
                     ModuleAddress parent)
              throws IOException
Constructor.
Parameters:
address - address of module
parent - address of parent module
Throws:
IOException - if address is formaly incorrect

ModuleAddress

public ModuleAddress(String address)
              throws IOException
Constructor.
Parameters:
address - address of module
Throws:
IOException - if address is formaly incorrect

ModuleAddress

public ModuleAddress(ModuleAddress oldAddress,
                     Name name,
                     Version moduleVersion,
                     Version ruleVersion)
              throws IOException
Constructor.
Parameters:
address - address of module
Throws:
IOException - if address is formaly incorrect
Method Detail

getAddress

public final String getAddress()

getHeader

public final String getHeader()

getPath

public final String getPath()

getFileName

public final String getFileName()

getName

public final Name getName()

getURL

public final URL getURL()

getRuleVersion

public final Version getRuleVersion()

getModuleVersion

public final Version getModuleVersion()

isRelativeAddress

public final boolean isRelativeAddress()

getLocalName

public final String getLocalName()
                          throws IOException
Transform an URL address into a local file path where a module could be buffered
Returns:
local file path for that address
Throws:
IOException - if address contains no "://"

toString

public final String toString()
Overrides:
toString in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

equals

public final boolean equals(Object object)
Overrides:
equals in class Object

getModuleFileName

public static final String getModuleFileName(Specification spec)
Get the file name of the specified module.
Parameters:
spec - here are the (perhaps relative) addresses to another module
Returns:
file name of specified module

getModulePaths

static final ModuleAddress[] getModulePaths(Module module,
                                            Specification spec)
                                     throws ArgumentException
Get all potential module addresses from a module specifiaction.
Parameters:
module - starting from that module (has an absolute address)
spec - here are the (perhaps relative) addresses to another module
Returns:
array of absolute address strings
Throws:
ArgumentException - if an URL is malformed

getLocalName

public static final String getLocalName(String address)
                                 throws IOException
Transform an URL address into a local file path where a module could be buffered
Parameters:
address - an URL
Returns:
local file path for that address
Throws:
IOException - if address contains no "://"

getModuleFileName

public static final String getModuleFileName(String address)
                                      throws IOException
Get the file name of an module without path and protokoll.
Parameters:
address - an URL
Returns:
file name of that address
Throws:
IOException - if that was no valid module address