}
try
{
if (localName.equals("jdo"))
{
FileMetaData filemd = (FileMetaData)getStack();
filemd.setType(MetadataFileType.JDO_FILE);
filemd.setCatalog(getAttr(attrs, "catalog"));
filemd.setSchema(getAttr(attrs, "schema"));
}
else if (localName.equals("orm"))
{
FileMetaData filemd = (FileMetaData)getStack();
filemd.setType(MetadataFileType.JDO_ORM_FILE);
filemd.setCatalog(getAttr(attrs, "catalog"));
filemd.setSchema(getAttr(attrs, "schema"));
}
else if (localName.equals("jdoquery"))
{
FileMetaData filemd = (FileMetaData)getStack();
filemd.setType(MetadataFileType.JDO_QUERY_FILE);
}
else if (localName.equals("fetch-plan"))
{
FileMetaData filemd = (FileMetaData)metadata;
FetchPlanMetaData fpmd = filemd.newFetchPlanMetadata(getAttr(attrs, "name"));
fpmd.setMaxFetchDepth(getAttr(attrs, "max-fetch-depth"));
fpmd.setFetchSize(getAttr(attrs, "fetch-size"));
pushStack(fpmd);
}
else if (localName.equals("package"))
{
FileMetaData filemd = (FileMetaData)getStack();
PackageMetaData pmd = filemd.newPackageMetadata(getAttr(attrs, "name"));
pmd.setCatalog(getAttr(attrs, "catalog"));
pmd.setSchema(getAttr(attrs, "schema"));
pushStack(pmd);
}
else if (localName.equals("class"))
{
PackageMetaData pmd = (PackageMetaData)getStack();
ClassMetaData cmd = newClassObject(pmd,attrs);
pmd.addClass(cmd);
pushStack(cmd);
}
else if (localName.equals("interface"))
{
PackageMetaData pmd = (PackageMetaData)getStack();
InterfaceMetaData imd = newInterfaceObject(pmd, attrs);
pmd.addInterface(imd);
pushStack(imd);
}
else if (localName.equals("primary-key"))
{
MetaData md = getStack();
PrimaryKeyMetaData pkmd = new PrimaryKeyMetaData();
pkmd.setName(getAttr(attrs,"name"));
pkmd.setColumnName(getAttr(attrs, "column"));
if (md instanceof AbstractClassMetaData)
{
((AbstractClassMetaData)md).setPrimaryKeyMetaData(pkmd);
}
else if (md instanceof JoinMetaData)
{
((JoinMetaData)md).setPrimaryKeyMetaData(pkmd);
}
pushStack(pkmd);
}
else if (localName.equals("implements"))
{
ClassMetaData cmd = (ClassMetaData)getStack();
ImplementsMetaData imd = new ImplementsMetaData(getAttr(attrs,"name"));
cmd.addImplements(imd);
pushStack(imd);
}
else if (localName.equals("property"))
{
MetaData parent = getStack();
if (parent instanceof AbstractClassMetaData)
{
AbstractClassMetaData acmd = (AbstractClassMetaData)parent;
PropertyMetaData propmd = newPropertyObject(acmd, attrs);
acmd.addMember(propmd);
pushStack(propmd);
}
else if (parent instanceof EmbeddedMetaData)
{
EmbeddedMetaData emd = (EmbeddedMetaData)parent;
PropertyMetaData propmd = newPropertyObject(emd, attrs);
emd.addMember(propmd);
pushStack(propmd);
}
else if (parent instanceof ImplementsMetaData)
{
ImplementsMetaData implmd = (ImplementsMetaData)parent;
PropertyMetaData propmd = newPropertyObject(implmd, attrs);
implmd.addProperty(propmd);
pushStack(propmd);
}
else if (parent instanceof FetchGroupMetaData)
{
FetchGroupMetaData fgmd = (FetchGroupMetaData)parent;
PropertyMetaData propmd = newPropertyObject(fgmd, attrs);
fgmd.addMember(propmd);
pushStack(propmd);
}
}
else if (localName.equals("datastore-identity"))
{
AbstractClassMetaData acmd = (AbstractClassMetaData)getStack();
IdentityMetaData idmd = new IdentityMetaData();
idmd.setColumnName(getAttr(attrs,"column"));
idmd.setValueStrategy(IdentityStrategy.getIdentityStrategy(getAttr(attrs,"strategy")));
idmd.setSequence(getAttr(attrs,"sequence"));
acmd.setIdentityMetaData(idmd);
pushStack(idmd);
}
else if (localName.equals("inheritance"))
{
MetaData parent = getStack();
AbstractClassMetaData acmd = (AbstractClassMetaData)parent;
InheritanceMetaData inhmd = new InheritanceMetaData();
inhmd.setStrategy(getAttr(attrs,"strategy"));
acmd.setInheritanceMetaData(inhmd);
pushStack(inhmd);
}
else if (localName.equals("discriminator"))
{
InheritanceMetaData inhmd = (InheritanceMetaData)getStack();
DiscriminatorMetaData dismd = inhmd.newDiscriminatorMetadata();
dismd.setColumnName(getAttr(attrs,"column"));
dismd.setValue(getAttr(attrs,"value"));
dismd.setStrategy(getAttr(attrs,"strategy"));
dismd.setIndexed(getAttr(attrs,"indexed"));
pushStack(dismd);
}
else if (localName.equals("query"))
{
MetaData emd = getStack();
if (emd instanceof ClassMetaData)
{
ClassMetaData cmd = (ClassMetaData)emd;
QueryMetaData qmd = new QueryMetaData(getAttr(attrs, "name"));
qmd.setScope(cmd.getFullClassName());
qmd.setLanguage(getAttr(attrs, "language"));
qmd.setUnmodifiable(getAttr(attrs, "unmodifiable"));
qmd.setResultClass(getAttr(attrs, "result-class"));
qmd.setUnique(getAttr(attrs, "unique"));
qmd.setFetchPlanName(getAttr(attrs, "fetch-plan"));
cmd.addQuery(qmd);
pushStack(qmd);
}
else if (emd instanceof InterfaceMetaData)
{
InterfaceMetaData imd = (InterfaceMetaData)emd;
QueryMetaData qmd = new QueryMetaData(getAttr(attrs, "name"));
qmd.setScope(imd.getFullClassName());
qmd.setLanguage(getAttr(attrs, "language"));
qmd.setUnmodifiable(getAttr(attrs, "unmodifiable"));
qmd.setResultClass(getAttr(attrs, "result-class"));
qmd.setUnique(getAttr(attrs, "unique"));
qmd.setFetchPlanName(getAttr(attrs, "fetch-plan"));
imd.addQuery(qmd);
pushStack(qmd);
}
else if (emd instanceof FileMetaData)
{
FileMetaData filemd = (FileMetaData)emd;
QueryMetaData qmd = filemd.newQueryMetadata(getAttr(attrs, "name"));
qmd.setLanguage(getAttr(attrs, "language"));
qmd.setUnmodifiable(getAttr(attrs, "unmodifiable"));
qmd.setResultClass(getAttr(attrs, "result-class"));
qmd.setUnique(getAttr(attrs, "unique"));
qmd.setFetchPlanName(getAttr(attrs, "fetch-plan"));