org.freehep.application.studio
Class LibInfo

java.lang.Object
  extended by org.freehep.application.studio.LibInfo

public class LibInfo
extends Object

Descriptor of a library file.

Typically, instances of this class describe either libraries referenced in a plugin descriptor, or library files installed in one of the extension directories.

In a library descriptor that is a part of a plugin descriptor (obtained from a list returned by PluginInfo.getLibraries(), href property is copied from the plugin manifest. If LOCATION string found in the plugin manifest is in valid ID-VERSION.ext format, both id and location properties are set to ID, and version property is set to VERSION. If LOCATION string in the plugin manifest is not in valid ID-VERSION.ext format, both id and location are initially set to LOCATION with stripped extension, and version remains undefined. When a library descriptor with undefined version is added to PluginMap, it's id property may be modified if the location-to-id map found in the application extension directory where the plugin is installed maps its location to some id. dir property corresponds to the plugin installation directory, if known. All other properties are undefined.

In a library descriptor that corresponds to a file on disk, if the file name is in valid ID-VERSION.ext format, both id and location properties are set to ID, and version property is set to VERSION. Otherwise, location is set to the file name (without extension), id and version are set based on maven manifest embedded in the file. If the manifest is not found, id is set to location (file name without extension), and version remains undefined. dir corresponds to the installation directory, and file is an absolute abstract path of the file.

Getters for all undefined properties return null.

Author:
onoprien

Constructor Summary
LibInfo(File file, PluginDir dir)
          Constructs library descriptor given a file and an installation directory.
LibInfo(LibInfo other)
          Copy constructor.
LibInfo(String location, String href)
          Constructs library descriptor from information found in a plugin manifest.
 
Method Summary
 boolean checkMavenID()
          Attempts to read maven manifest and set this library id and version to maven artifact and version.
 PluginDir getDir()
           
 File getFile()
           
 String getHref()
           
 String getId()
           
 String getLocation()
           
 String getVersion()
           
 void setDir(PluginDir dir)
           
 void setFile(File file)
           
 void setHref(String href)
           
 void setId(String id)
           
 void setLocation(String location)
           
 void setVersion(String version)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LibInfo

public LibInfo(String location,
               String href)
Constructs library descriptor from information found in a plugin manifest.

Parameters:
location - Location as read from plugin manifest, expected to end with a file extension.
href - HREF as read from plugin manifest.

LibInfo

public LibInfo(File file,
               PluginDir dir)
Constructs library descriptor given a file and an installation directory.


LibInfo

public LibInfo(LibInfo other)
Copy constructor. All fields are copied.

Method Detail

getId

public String getId()

setId

public void setId(String id)

getVersion

public String getVersion()

setVersion

public void setVersion(String version)

getLocation

public String getLocation()

setLocation

public void setLocation(String location)

getHref

public String getHref()

setHref

public void setHref(String href)

getDir

public PluginDir getDir()

setDir

public void setDir(PluginDir dir)

getFile

public File getFile()

setFile

public void setFile(File file)

checkMavenID

public final boolean checkMavenID()
Attempts to read maven manifest and set this library id and version to maven artifact and version.

Returns:
True if artifact and version were successfully extracted.


Copyright © 2000-2014 FreeHEP. All Rights Reserved.