Metadata (Griffon 0.9.5-rc2)
Date: 2012-03-09

Overview | Package | Class | Deprecated | Index | Help
| Griffon 0.9.5-rc2
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## griffon.util
[Java] Class Metadata

    java.lang.Object
      java.util.Dictionary
          java.util.Hashtable
              java.util.Properties
                  griffon.util.Metadata

    public class Metadata
    extends Properties

Represents the application Metadata and loading mechanics

Authors:
  Graeme Rocher (Grails 1.1)

Nested Class Summary
`static class` | `Metadata.FinalReference`

Field Summary
`static String` | `APPLICATION_GRIFFON_VERSION`
`static String` | `APPLICATION_NAME`
`static String` | `APPLICATION_TOOLKIT`
`static String` | `APPLICATION_VERSION`
`static String` | `FILE`
`static String` | `GRIFFON_START_DIR`
`static String` | `GRIFFON_WORKING_DIR`
`private static Pattern` | `SKIP_PATTERN`
`private boolean` | `initialized`
`private static Reference` | `metadata`
`private File` | `metadataFile`

Constructor Summary
`private Metadata()`
`private Metadata(File f)`

Method Summary
`private static void` | `closeQuietly(Closeable c)`
`private static InputStream` | `fetchApplicationProperties(ClassLoader classLoader)`
`String` | `getApplicationName()` @return The application name
`String` | `getApplicationToolkit()` @return Supported toolkit by this application
`String` | `getApplicationVersion()` @return The application version
`Map` | `getArchetype()`
`static Metadata` | `getCurrent()` @return Returns the metadata for the current application
`String` | `getEnvironment()` @return The environment the application expects to run in
`String` | `getGriffonStartDir()` Returns the application's starting directory.
`String` | `getGriffonStartDirSafe()` Returns ia non-null value for the application's starting directory.
`String` | `getGriffonVersion()` @return The Griffon version used to build the application
`File` | `getGriffonWorkingDir()` @return The application working directory
`Map` | `getInstalledPlugins()` Obtains a map (name->version) of installed plugins specified in the project metadata
`static Metadata` | `getInstance(InputStream inputStream)` Loads a Metadata instance from a Reader
`static Metadata` | `getInstance(File file)` Loads and returns a new Metadata object for the given File
`Enumeration` | `keys()` Overrides, called by the store method.
`void` | `persist()` Saves the current state of the Metadata object
`boolean` | `propertiesHaveNotChanged()` @return Returns true if these properties have not changed since they were loaded
`static Metadata` | `reload()` Reloads the application metadata
`static void` | `reset()` Resets the current state of the Metadata so it is re-read

Methods inherited from class Properties
setProperty, getProperty, getProperty, load, load, list, list, save, store, store, loadFromXML, storeToXML, storeToXML, propertyNames, stringPropertyNames, get, put, equals, toString, values, hashCode, clone, clear, isEmpty, contains, size, entrySet, putAll, remove, elements, keys, keySet, containsValue, containsKey, wait, wait, wait, getClass, notify, notifyAll

Methods inherited from class Hashtable
get, put, equals, toString, values, hashCode, clone, clear, isEmpty, contains, size, entrySet, putAll, remove, elements, keys, keySet, containsValue, containsKey, wait, wait, wait, getClass, notify, notifyAll

Field Detail

### APPLICATION_GRIFFON_VERSION

    public static final String APPLICATION_GRIFFON_VERSION

### APPLICATION_NAME

    public static final String APPLICATION_NAME

### APPLICATION_TOOLKIT

    public static final String APPLICATION_TOOLKIT

### APPLICATION_VERSION

    public static final String APPLICATION_VERSION

### FILE

    public static final String FILE

### GRIFFON_START_DIR

    public static final String GRIFFON_START_DIR

### GRIFFON_WORKING_DIR

    public static final String GRIFFON_WORKING_DIR

### SKIP_PATTERN

    private static final Pattern SKIP_PATTERN

### initialized

    private boolean initialized

### metadata

    private static Reference metadata

### metadataFile

    private File metadataFile

Constructor Detail

### Metadata

    private Metadata()

### Metadata

    private Metadata(File f)

Method Detail

### closeQuietly

    private static void closeQuietly(Closeable c)

### fetchApplicationProperties

    private static InputStream fetchApplicationProperties(ClassLoader classLoader)

### getApplicationName

    public String getApplicationName()

  Returns:
    The application name

### getApplicationToolkit

    public String getApplicationToolkit()

  Returns:
    Supported toolkit by this application

### getApplicationVersion

    public String getApplicationVersion()

  Returns:
    The application version

### getArchetype

    public Map getArchetype()

### getCurrent

    public static Metadata getCurrent()

  Returns:
    Returns the metadata for the current application

### getEnvironment

    public String getEnvironment()

  Returns:
    The environment the application expects to run in

### getGriffonStartDir

    public String getGriffonStartDir()

  Returns the application's starting directory.

  The value comes from the System property 'griffon.start.dir' if set. Result may be null.

  Returns:
    The application start directory path

### getGriffonStartDirSafe

    public String getGriffonStartDirSafe()

  Returns ia non-null value for the application's starting directory.

  the path to new File(".") if that path is writable, returns the value of 'user.dir' otherwise.

  Returns:
    The application start directory path

### getGriffonVersion

    public String getGriffonVersion()

  Returns:
    The Griffon version used to build the application

### getGriffonWorkingDir

    public File getGriffonWorkingDir()

  Returns:
    The application working directory

### getInstalledPlugins

    public Map getInstalledPlugins()

  Obtains a map (name->version) of installed plugins specified in the project metadata
  Returns:
    A map of installed plugins

### getInstance

    public static Metadata getInstance(InputStream inputStream)

  Loads a Metadata instance from a Reader
  Parameters:
    `inputStream` - The InputStream
  Returns:
    a Metadata instance

### getInstance

    public static Metadata getInstance(File file)

  Loads and returns a new Metadata object for the given File
  Parameters:
    `file` - The File
  Returns:
    A Metadata object

### keys

    @SuppressWarnings("unchecked")
    public Enumeration keys()

  Overrides, called by the store method.

### persist

    public void persist()

  Saves the current state of the Metadata object

### propertiesHaveNotChanged

    public boolean propertiesHaveNotChanged()

  Returns:
    Returns true if these properties have not changed since they were loaded

### reload

    public static Metadata reload()

  Reloads the application metadata
  Returns:
    The metadata object

### reset

    public static void reset()

  Resets the current state of the Metadata so it is re-read

Groovy Documentation