01: package org.obe.client.api.repository;
02:
03: import org.xml.sax.EntityResolver;
04:
05: /**
06: * Describes an XML document, schema, DTD, template, XSL transform, etc.
07: *
08: * @author Adrian Price
09: */
10: public class ResourceMetaData extends AbstractMetaData {
11: private static final long serialVersionUID = 4546822991337176280L;
12: private static final String[] EMPTY_STRING = {};
13: private String _publicId;
14: private String _systemId;
15: private byte[] _content;
16:
17: public ResourceMetaData() {
18: }
19:
20: public ResourceMetaData(String publicId, String systemId) {
21: setPublicId(publicId);
22: setSystemId(systemId);
23: }
24:
25: public ResourceMetaData(String displayName, String description,
26: String docUrl, String author, String publicId,
27: String systemId, byte[] content) {
28:
29: super (null, displayName, description, docUrl, author, true);
30: setPublicId(publicId);
31: setSystemId(systemId);
32: _content = content;
33: }
34:
35: public Object createInstance(EntityResolver entityResolver)
36: throws RepositoryException {
37:
38: return _content;
39: }
40:
41: protected String getImplClass() {
42: return null;
43: }
44:
45: protected String[] getImplCtorSig() {
46: return EMPTY_STRING;
47: }
48:
49: public final String getPublicId() {
50: return _publicId != null ? _publicId : _type == null
51: || !allowInheritance ? null
52: : ((ResourceMetaData) _type).getPublicId();
53: }
54:
55: public final void setPublicId(String publicId) {
56: if (publicId != null) {
57: setId(publicId);
58: }
59: _publicId = publicId;
60: }
61:
62: public final String getSystemId() {
63: return _systemId != null ? _systemId : _type == null
64: || !allowInheritance ? null
65: : ((ResourceMetaData) _type).getSystemId();
66: }
67:
68: public final void setSystemId(String systemId) {
69: if (_publicId == null) {
70: setId(systemId != null ? systemId : null);
71: }
72: _systemId = systemId;
73: }
74:
75: public String getResourceType() {
76: return _type == null ? getId() : ((ResourceMetaData) _type)
77: .getResourceType();
78: }
79:
80: public byte[] getContent() {
81: return _content;
82: }
83:
84: public void setContent(byte[] content) {
85: _content = content;
86: }
87: }
|