Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.solarmetric.kodo.enhance
Class ApplicationIdTool

    java.lang.Object
      |
      +--com.solarmetric.kodo.enhance.ApplicationIdTool

public class ApplicationIdTool
extends Object

Generates a class appropriate for use as an application identity class.

Constructor Summary
`ApplicationIdTool(Class type, Configuration conf)` Constructs a new ApplicationIdTool capable of generating an object id class for `type`.

Method Summary
`boolean` | `generateApplicationId()` Generates the sourcecode for the application id class; returns false if the class is invalid.
`String` | `getApplicationIdCode()` Return the code generated for the application id, or null if invalid class or the `generateApplicationId()` method has not been called.
`ClassMetaData` | `getClassMetaData()` Return the `ClassMetaData` object for the class, or null if not persistence capable.
`boolean` | `getDieOnInvalid()` Return true if this tool is configured to throw an exception on an attempt to generate an id class for a type that does not use application identity.
`File` | `getFile()` Return the file that this tool should output to.
`PrintStream` | `getLog()` Return the stream being used for logging, or null if none.
`Class` | `getSourceType()` Return the type we are generating an application id for.
`boolean` | `isApplicationIdentity()` Return true if the class uses application identity, false otherwise.
`static void` | `main(String[] args)` Usage: java com.solarmetric.kodo.enhance.JDOEnhancer [option]* <class name | .class file | .jdo file>+
`void` | `setDieOnInvalid(boolean die)` Set to true if this tool should throw an exception on an attempt to generate an id class for a type that does not use application identity.
`void` | `setLog(PrintStream log)` Set the stream to use for status messages, or null if none.
`void` | `writeApplicationId()` Writes the generated code to the proper file.
`static void` | `writeApplicationId(Class type, boolean die, PrintStream log, Configuration conf)` Generate an application id source file for the given type.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ApplicationIdTool

    public ApplicationIdTool(Class type,
                             Configuration conf)
                      throws IOException

  Constructs a new ApplicationIdTool capable of generating an object id class for `type`.

Method Detail

### main

    public static void main(String[] args)
                     throws IOException

  Usage: java com.solarmetric.kodo.enhance.JDOEnhancer [option]* <class name | .class file | .jdo file>+

  Where the following options are recognized.

  - -properties <properties file>: the path to a Kodo properties file containing information such as the license key, as outlined in `Configuration`; optional
  - -<bean property> <value>: all bean properties of the standard Kodo `Configuration` can be set by using their names and supplying a value; for example: `-licenseKey adslfja83r3lkadf`
  - -ignoreErrors <true|false>: if false, an exception will be thrown if the tool encounters any class that does not use application identity or uses the identity class of its superclass; defaults to true

  If the license key is not specified otherwise, Kodo will check for default preference files with license keys as outlined in `DefaultConfiguration`.

  Each additional argument can be either the full class name of the type to create an id class for, the path to the .class file for the type, or the path to a .jdo file listing one or more types. If a .java file already exists for an application id, it will be backed up to a file named <orig file name>~.

### writeApplicationId

    public static void writeApplicationId(Class type,
                                          boolean die,
                                          PrintStream log,
                                          Configuration conf)
                                   throws IOException

  Generate an application id source file for the given type.
  Parameters:
    `type` - the type to generate an id for
    `die` - if true, throw an exception if the given type does not need an application identity class
    `log` - the stream to log messages to, or null for no log
    `conf` - the system configuration
  Throws:
    `IOException` - if unable to save source

### getSourceType

    public Class getSourceType()

  Return the type we are generating an application id for.

### getLog

    public PrintStream getLog()

  Return the stream being used for logging, or null if none.

### setLog

    public void setLog(PrintStream log)

  Set the stream to use for status messages, or null if none.

### getDieOnInvalid

    public boolean getDieOnInvalid()

  Return true if this tool is configured to throw an exception on an attempt to generate an id class for a type that does not use application identity.

### setDieOnInvalid

    public void setDieOnInvalid(boolean die)

  Set to true if this tool should throw an exception on an attempt to generate an id class for a type that does not use application identity.

### isApplicationIdentity

    public boolean isApplicationIdentity()

  Return true if the class uses application identity, false otherwise.

### getClassMetaData

    public ClassMetaData getClassMetaData()

  Return the `ClassMetaData` object for the class, or null if not persistence capable.

### getApplicationIdCode

    public String getApplicationIdCode()

  Return the code generated for the application id, or null if invalid class or the `generateApplicationId()` method has not been called.

### getFile

    public File getFile()

  Return the file that this tool should output to.

### generateApplicationId

    public boolean generateApplicationId()
                                  throws IOException

  Generates the sourcecode for the application id class; returns false if the class is invalid.

### writeApplicationId

    public void writeApplicationId()
                            throws IOException

  Writes the generated code to the proper file.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
| SolarMetric Kodo JDO 2.4.3 generated on March 27 2003
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.