org.gxos
Class Defaults

java.lang.Object
  |
  +--org.gxos.Defaults

public class Defaults
extends java.lang.Object

Provides utility methods.

$Id: Defaults.java,v 1.32 2001/10/19 03:22:49 balsoy Exp $


Field Summary
static java.lang.String CONTEXT_LOADINITIALLY
          TreeContext parameter to decide if the objects in a collection will be brought to the memory.
static java.lang.String CONTEXT_LOADINITIALLY_NO
           
static java.lang.String CONTEXT_LOADINITIALLY_YES
           
static java.lang.String GXOS_CONFIG
          GXOS configuration file variable.
static java.lang.String GXOS_CONFIG_FILE
          Default GXOS configuration file name, which is gxos.conf.
static java.lang.String GXOS_EXT
          Extension to names for Garnet objects.
static java.lang.String GXOS_NAMESPACE
          Top level GXOS namespace name.
static java.lang.String GXOS_ROOT_PREFIX
          Prefix for GXOS names, i.e.
static java.lang.String GXOS_SUBJNDI_CONTEXTFACTORY
          Default sub JNDI provider initial context factory.
static java.lang.String GXOS_SUBJNDI_PROVIDER_URL
          The provider URL for the sub JNDI.
static java.lang.String GXOS_SUBJNDI_PROVIDER_VAR
          Environment variable to look for the sub JNDI provider URL.
static java.lang.String GXOS_SUBJNDI_VAR
          Environment variable to look for the sub JNDI.
static java.lang.String NEW_GXOS_OBJECTS
          Header for new GXOS object section.
static java.lang.String NEW_GXOS_OBJECTS_NUMBER
           
static java.lang.String NODEVERSION
          Current version of the schema.
static java.lang.String PERSONAL_INFO_IMPL
          Personal Information implementer class.
 
Constructor Summary
Defaults()
           
 
Method Summary
static boolean addChild(TreeObject parent, TreeObject child)
          Adds a child object to another object's child list.
static boolean addLink(TreeObject parent, java.lang.String child)
          Adds a child object as a link to another object's child list.
static java.util.Properties getConfiguration(java.lang.String fileName)
          Returns a Properties object for the given configuration file.
static java.lang.String getFullNameString(Entity gx)
           
static java.lang.String getObjectName(java.lang.String name)
           
static Configuration getXMLConfiguration(java.lang.String fileName)
          Returns a Configuration object for the given configuration file.
static TreeObject initEntity(TreeObject gx, java.lang.String name, NodeTypeType type, NodeRootingType rooting)
          Initializes GXOS object with current version number and time.
static void marshal(TreeObject object, java.io.Writer writer)
          Outputs the XML content of a GXOS object into a writer.
static TreeObject nodeUpdated(TreeObject gx)
          Updates {@see NodeUpdateTime} property of this GXOS object.
static boolean removeChild(TreeObject parent, java.lang.String childName)
          Removes a child object's name from it's parent's child list.
static boolean removeChild(TreeObject parent, TreeObject child)
          Removes a child object from it's parent's child list, and sets the child's parent object to null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GXOS_NAMESPACE

public static java.lang.String GXOS_NAMESPACE
Top level GXOS namespace name.

GXOS_CONFIG

public static final java.lang.String GXOS_CONFIG
GXOS configuration file variable. This needs to be set before GNDI is run, i.e. java -Dgxos.config=

GXOS_CONFIG_FILE

public static final java.lang.String GXOS_CONFIG_FILE
Default GXOS configuration file name, which is gxos.conf.

NODEVERSION

public static final java.lang.String NODEVERSION
Current version of the schema. Used in TreeObject.NodeVersionNumber.
See Also:
TreeObject

GXOS_ROOT_PREFIX

public static final java.lang.String GXOS_ROOT_PREFIX
Prefix for GXOS names, i.e. gxos:// or //.

GXOS_SUBJNDI_CONTEXTFACTORY

public static final java.lang.String GXOS_SUBJNDI_CONTEXTFACTORY
Default sub JNDI provider initial context factory.

GXOS_SUBJNDI_VAR

public static final java.lang.String GXOS_SUBJNDI_VAR
Environment variable to look for the sub JNDI.

GXOS_SUBJNDI_PROVIDER_URL

public static final java.lang.String GXOS_SUBJNDI_PROVIDER_URL
The provider URL for the sub JNDI.

GXOS_SUBJNDI_PROVIDER_VAR

public static final java.lang.String GXOS_SUBJNDI_PROVIDER_VAR
Environment variable to look for the sub JNDI provider URL.

GXOS_EXT

public static final java.lang.String GXOS_EXT
Extension to names for Garnet objects.

CONTEXT_LOADINITIALLY

public static final java.lang.String CONTEXT_LOADINITIALLY
TreeContext parameter to decide if the objects in a collection will be brought to the memory. By default, all the objects are brought, however, for some repositories, this may be omitted such as Archive, or Recycle. If "YES", objects are loaded, if "NO", no loading for this and any sub collection.

CONTEXT_LOADINITIALLY_YES

public static final java.lang.String CONTEXT_LOADINITIALLY_YES

CONTEXT_LOADINITIALLY_NO

public static final java.lang.String CONTEXT_LOADINITIALLY_NO

PERSONAL_INFO_IMPL

public static final java.lang.String PERSONAL_INFO_IMPL
Personal Information implementer class.

NEW_GXOS_OBJECTS

public static final java.lang.String NEW_GXOS_OBJECTS
Header for new GXOS object section.

NEW_GXOS_OBJECTS_NUMBER

public static final java.lang.String NEW_GXOS_OBJECTS_NUMBER
Constructor Detail

Defaults

public Defaults()
Method Detail

initEntity

public static TreeObject initEntity(TreeObject gx,
                                    java.lang.String name,
                                    NodeTypeType type,
                                    NodeRootingType rooting)
Initializes GXOS object with current version number and time. Name, type and rooting type are provided by the caller of the method.
Parameters:
gx - Garnet object that needs to be initialized. This object is not created in this method. It has to be created before the method is called.
name - NodeName of this Garnet object.
type - NodeType of this Garnet object. See NodeTypeType for options.
rooting - Type of this node. See NodeRootingType for options.
Returns:
GXOS object as initialized.
See Also:
NodeTypeType, NodeRootingType, TreeObject

nodeUpdated

public static TreeObject nodeUpdated(TreeObject gx)
Updates {@see NodeUpdateTime} property of this GXOS object.
Parameters:
gx - GXOS object whose NodeUpdateTime property will be set to the current time.
Returns:
newly updated GXOS object.

addChild

public static boolean addChild(TreeObject parent,
                               TreeObject child)
Adds a child object to another object's child list.
Parameters:
parent - Parent object of which a child to be added.
child - Child object to be added.
Returns:
true if succeeded; other false.
See Also:
TreeObject

removeChild

public static boolean removeChild(TreeObject parent,
                                  java.lang.String childName)
Removes a child object's name from it's parent's child list. This does not affect the child object.
Parameters:
parent - Parent object whose child link will be removed.
child - Name of the child object to be removed.
Returns:
true if succeeded; otherwise false.
See Also:
TreeObject

removeChild

public static boolean removeChild(TreeObject parent,
                                  TreeObject child)
Removes a child object from it's parent's child list, and sets the child's parent object to null.
Parameters:
parent - Parent object whose child link will be removed.
child - Child object to be removed.
Returns:
true if succeeded; otherwise false.
See Also:
TreeObject

marshal

public static void marshal(TreeObject object,
                           java.io.Writer writer)
                    throws GxException
Outputs the XML content of a GXOS object into a writer.
Parameters:
object - GXOS object to be marshaled.
writer - writer object to which object's content will be output.
Throws:
GxException - if a marshalling error is encountered.

addLink

public static boolean addLink(TreeObject parent,
                              java.lang.String child)
Adds a child object as a link to another object's child list.
Parameters:
parent - parent object of which a child link to be added.
child - name of the child object to be linked. This should be a valid GXOS name i.e. child, //obj1/obj2/child or namespace:child
Returns:
true if succeeded; other false.
See Also:
LinkNode

getConfiguration

public static java.util.Properties getConfiguration(java.lang.String fileName)
                                             throws GxException
Returns a Properties object for the given configuration file.
Parameters:
fileName - The file name can be either
  • a full path to the configuration file, i.e. /home/username/gxos/myconfig.txt,
  • relative path to the current working directory, i.e. myconfigs/gxos/gxos.conf, ./gxos.conf, or just gxos.conf.
  • or null. In this case, it will be assumed to be the value of GXOS_CONFIG_FILE, and searched for in the CLASSPATH.

getXMLConfiguration

public static Configuration getXMLConfiguration(java.lang.String fileName)
                                         throws GxException
Returns a Configuration object for the given configuration file.

Parameters:
fileName - The file name can be either
  • a full path to the configuration file, i.e. /home/username/gxos/gxosconfig.xml,
  • relative path to the current working directory, i.e. myconfigs/gxos/gxosconfig.xml, ./gxos.conf, or just gxosconfig.xml.
  • or null. In this case, it will be assumed to be the value of GXOS_CONFIG_FILE, and searched for in the CLASSPATH.
    Returns:
    a configuration object. See Configuration.

getFullNameString

public static java.lang.String getFullNameString(Entity gx)

getObjectName

public static java.lang.String getObjectName(java.lang.String name)