001: // You can redistribute this software and/or modify it under the terms of
002: // the Ozone Core License version 1 published by ozone-db.org.
003: //
004: // The original code and portions created by SMB are
005: // Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
006: //
007: // $Id: ObjElement.java,v 1.1 2001/12/18 10:31:31 per_nyfelt Exp $
008:
009: package org.ozoneDB.core.xml;
010:
011: import org.xml.sax.*;
012:
013: /**
014: * This class saves all attributes of the objElement.
015: *
016: * @version $Revision: 1.1 $
017: * @author <a href="http://www.softwarebuero.de">SMB</a>
018: */
019: public class ObjElement implements Consts {
020:
021: //
022: // member
023: //
024:
025: /**
026: * The type of the obj.
027: */
028: private String className;
029:
030: /**
031: * The id of the obj.
032: */
033: private String id;
034:
035: /**
036: * The object!!
037: */
038: private Object obj;
039:
040: /**
041: * The name of the OzoneObject (if the object is an OzoneObject).
042: */
043: private String ozoneObjectName;
044:
045: /**
046: * The id of the OzoneObject (if the object is an OzoneObject).
047: */
048: private String ozoneObjectId;
049:
050: //
051: // construcor
052: //
053:
054: /**
055: */
056: public ObjElement() {
057: }
058:
059: /**
060: * The constructor creates a new instance of the obj with this className.
061: *
062: * @param atts (the attributes)
063: */
064: public ObjElement(Attributes atts) throws ClassNotFoundException,
065: InstantiationException, IllegalAccessException {
066:
067: className = atts.getValue(ATTR_TYPE);
068: id = atts.getValue(ATTR_ID);
069:
070: ozoneObjectName = atts
071: .getValue(OzoneObjAttsFactory.ATTR_OBJNAME);
072: ozoneObjectId = atts.getValue(OzoneObjAttsFactory.ATTR_OBJID);
073:
074: Class objClass = Thread.currentThread().getContextClassLoader()
075: .loadClass(className);
076: obj = objClass.newInstance();
077:
078: }
079:
080: //
081: // methods
082: //
083:
084: /**
085: */
086: public String getClassName() {
087: return className;
088: }
089:
090: /**
091: */
092: public String getId() {
093: return id;
094: }
095:
096: /**
097: */
098: public Object getObject() {
099: return obj;
100: }
101:
102: /**
103: */
104: public Object getOzoneObjectName() {
105: return ozoneObjectName;
106: }
107:
108: /**
109: */
110: public Object getOzoneObjectId() {
111: return ozoneObjectId;
112: }
113:
114: /**
115: */
116: public String toString() {
117: return ("ObjElement: " + className);
118: }
119: }
|