com.infoengine.administration.delegate
Class PackageDescriptor

java.lang.Object
  extended bycom.infoengine.administration.delegate.PackageDescriptor

public class PackageDescriptor
extends Object


Nested Class Summary
(package private)  class PackageDescriptor.RepositoryType
           
(package private)  class PackageDescriptor.TypeId
           
 
Field Summary
private static String APP_XML
           
private static String DEFAULT_ATT
           
private static String DEFAULT_PREFIX
           
private  PackageDescriptor.RepositoryType defaultRepositoryType
           
private  String description
           
private static String DESCRIPTION_ELEM
           
private static String META_INF
           
private  String name
           
private static String NAME_ELEM
           
private static String ONE_LEVEL
           
private static String PACKAGE_ELEM
           
private  Vector repositoryTypes
           
private static String REPOTYPE_ELEM
           
private static String SCHEMA_ELEM
           
private  int schemaIndex
           
private static String SUPER_ELEM
           
private static String THREE_LEVEL
           
private static String TWO_LEVEL
           
private static String TYPEID_ELEM
           
 
Constructor Summary
PackageDescriptor()
          Creates a new instance of PackageDescriptor
 
Method Summary
 void addTypeId(String repoType, String typeId)
           
 void addTypeIdSuperType(String repoType, String typeId, String superType)
           
private  void appendElement(Element parent, Document doc, Element child, String indent)
           
private  void appendElement(Element parent, Document doc, String name, String data, String indent)
           
private  void appendJarEntry(File jar, String entryName, byte[] data)
           
private  void appendRepositoryType(PackageDescriptor.RepositoryType rt, Document doc, Element pkg, File jar)
           
private  void appendTypeId(PackageDescriptor.TypeId id, Document doc, Element rt, File jar)
           
private  PackageDescriptor.RepositoryType findRepositoryType(String repoType)
           
private  PackageDescriptor.RepositoryType findRepositoryTypeCreate(String repoType)
           
private  PackageDescriptor.TypeId findTypeId(PackageDescriptor.RepositoryType rt, String typeId)
           
private  PackageDescriptor.TypeId findTypeIdCreate(PackageDescriptor.RepositoryType rt, String typeId)
           
 String getPackageDescription()
           
static String getPackageFileNamePrefix(String name)
           
 String getPackageName()
           
 String getRepositoryTypeDescription(String repoType)
           
 String getRepositoryTypeSuperType(String repoType)
           
private static Element getTagByName(Element parent, String name)
           
private static Element[] getTagsByName(Element parent, String name)
           
private static String getText(Element tag)
           
 String getTypeIdSchema(String repoType, String typeId)
           
 String getTypeIdSuperType(String repoType, String typeId)
           
 String[] getTypeIdSuperTypes(String repoType, String typeId)
           
private static boolean isAlpha(char c)
           
private static boolean isAlphaOrDigit(char c)
           
private static boolean isDigit(char c)
           
 String[] listRepositoryTypes()
           
 String[] listTypeIds(String repoType)
           
static void main(String[] args)
           
private static void processRepositoryType(PackageDescriptor desc, Element rType, File jar)
           
private static void processTypeId(PackageDescriptor desc, Element tid, String rTypeName, File jar)
           
static PackageDescriptor read(File f)
           
private static String readStringEntry(File f, String entryName)
           
 void removeTypeId(String repoType, String typeId)
           
 void setPackageDescription(String d)
           
 void setPackageName(String n)
           
 void setRepositoryTypeDescription(String repoType, String description)
           
 void setRepositoryTypeSuperType(String repoType, String superType)
           
 void setTypeIdSchema(String repoType, String typeId, String schema)
           
 void setTypeIdSuperType(String repoType, String typeId, String superType)
           
private static String toAlphaNum(String s)
           
 void write(File jar)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_INF

private static final String META_INF
See Also:
Constant Field Values

APP_XML

private static final String APP_XML
See Also:
Constant Field Values

PACKAGE_ELEM

private static final String PACKAGE_ELEM
See Also:
Constant Field Values

NAME_ELEM

private static final String NAME_ELEM
See Also:
Constant Field Values

DESCRIPTION_ELEM

private static final String DESCRIPTION_ELEM
See Also:
Constant Field Values

SUPER_ELEM

private static final String SUPER_ELEM
See Also:
Constant Field Values

REPOTYPE_ELEM

private static final String REPOTYPE_ELEM
See Also:
Constant Field Values

TYPEID_ELEM

private static final String TYPEID_ELEM
See Also:
Constant Field Values

SCHEMA_ELEM

private static final String SCHEMA_ELEM
See Also:
Constant Field Values

DEFAULT_ATT

private static final String DEFAULT_ATT
See Also:
Constant Field Values

ONE_LEVEL

private static final String ONE_LEVEL
See Also:
Constant Field Values

TWO_LEVEL

private static final String TWO_LEVEL
See Also:
Constant Field Values

THREE_LEVEL

private static final String THREE_LEVEL
See Also:
Constant Field Values

DEFAULT_PREFIX

private static final String DEFAULT_PREFIX
See Also:
Constant Field Values

description

private String description

name

private String name

defaultRepositoryType

private PackageDescriptor.RepositoryType defaultRepositoryType

repositoryTypes

private Vector repositoryTypes

schemaIndex

private int schemaIndex
Constructor Detail

PackageDescriptor

public PackageDescriptor()
Creates a new instance of PackageDescriptor

Method Detail

setPackageName

public void setPackageName(String n)

getPackageName

public String getPackageName()

setPackageDescription

public void setPackageDescription(String d)

getPackageDescription

public String getPackageDescription()

getPackageFileNamePrefix

public static String getPackageFileNamePrefix(String name)

toAlphaNum

private static String toAlphaNum(String s)

isAlphaOrDigit

private static boolean isAlphaOrDigit(char c)

isAlpha

private static boolean isAlpha(char c)

isDigit

private static boolean isDigit(char c)

listTypeIds

public String[] listTypeIds(String repoType)

listRepositoryTypes

public String[] listRepositoryTypes()

removeTypeId

public void removeTypeId(String repoType,
                         String typeId)

findRepositoryType

private PackageDescriptor.RepositoryType findRepositoryType(String repoType)

findRepositoryTypeCreate

private PackageDescriptor.RepositoryType findRepositoryTypeCreate(String repoType)

findTypeId

private PackageDescriptor.TypeId findTypeId(PackageDescriptor.RepositoryType rt,
                                            String typeId)

findTypeIdCreate

private PackageDescriptor.TypeId findTypeIdCreate(PackageDescriptor.RepositoryType rt,
                                                  String typeId)

setRepositoryTypeSuperType

public void setRepositoryTypeSuperType(String repoType,
                                       String superType)

getRepositoryTypeSuperType

public String getRepositoryTypeSuperType(String repoType)

setRepositoryTypeDescription

public void setRepositoryTypeDescription(String repoType,
                                         String description)

getRepositoryTypeDescription

public String getRepositoryTypeDescription(String repoType)

addTypeId

public void addTypeId(String repoType,
                      String typeId)

addTypeIdSuperType

public void addTypeIdSuperType(String repoType,
                               String typeId,
                               String superType)

setTypeIdSuperType

public void setTypeIdSuperType(String repoType,
                               String typeId,
                               String superType)

getTypeIdSuperType

public String getTypeIdSuperType(String repoType,
                                 String typeId)

getTypeIdSuperTypes

public String[] getTypeIdSuperTypes(String repoType,
                                    String typeId)

setTypeIdSchema

public void setTypeIdSchema(String repoType,
                            String typeId,
                            String schema)

getTypeIdSchema

public String getTypeIdSchema(String repoType,
                              String typeId)

write

public void write(File jar)
           throws IOException,
                  ParserConfigurationException,
                  TransformerException
Throws:
IOException
ParserConfigurationException
TransformerException

appendElement

private void appendElement(Element parent,
                           Document doc,
                           Element child,
                           String indent)

appendElement

private void appendElement(Element parent,
                           Document doc,
                           String name,
                           String data,
                           String indent)

appendRepositoryType

private void appendRepositoryType(PackageDescriptor.RepositoryType rt,
                                  Document doc,
                                  Element pkg,
                                  File jar)
                           throws IOException
Throws:
IOException

appendTypeId

private void appendTypeId(PackageDescriptor.TypeId id,
                          Document doc,
                          Element rt,
                          File jar)
                   throws IOException
Throws:
IOException

appendJarEntry

private void appendJarEntry(File jar,
                            String entryName,
                            byte[] data)
                     throws IOException
Throws:
IOException

read

public static PackageDescriptor read(File f)
                              throws IOException,
                                     ParserConfigurationException,
                                     SAXException
Parameters:
f - - jar file or directory, if directory may point to META-INF or parent of META-INF
Throws:
IOException
ParserConfigurationException
SAXException

processRepositoryType

private static void processRepositoryType(PackageDescriptor desc,
                                          Element rType,
                                          File jar)
                                   throws IOException
Throws:
IOException

processTypeId

private static void processTypeId(PackageDescriptor desc,
                                  Element tid,
                                  String rTypeName,
                                  File jar)
                           throws IOException
Throws:
IOException

getTagsByName

private static Element[] getTagsByName(Element parent,
                                       String name)

getTagByName

private static Element getTagByName(Element parent,
                                    String name)

getText

private static String getText(Element tag)

readStringEntry

private static String readStringEntry(File f,
                                      String entryName)
                               throws IOException
Throws:
IOException

main

public static void main(String[] args)