01: /**
02: * Copyright (C) 2006 NetMind Consulting Bt.
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 3 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */package hu.netmind.persistence;
18:
19: import org.apache.log4j.Logger;
20: import java.util.List;
21: import java.util.Vector;
22: import java.util.Map;
23: import java.util.HashMap;
24:
25: /**
26: * Null handler is a class handler for interfaces and reserved classes.
27: * It contains no attributes, so all methods return default values
28: * statically.
29: * @author Brautigam Robert
30: * @version Revision: $Revision$
31: */
32: public class StrictNullHandler implements StrictClassHandler {
33: private static Logger logger = Logger
34: .getLogger(StrictNullHandler.class);
35:
36: private ClassEntry sourceEntry;
37:
38: StrictNullHandler(ClassEntry sourceEntry) {
39: // Init
40: this .sourceEntry = sourceEntry;
41: }
42:
43: public ClassEntry getSourceEntry() {
44: return sourceEntry;
45: }
46:
47: public boolean hasChanged() {
48: return false;
49: }
50:
51: public Map getAttributeTypes() {
52: return new HashMap();
53: }
54:
55: public List getAttributeNames() {
56: return new Vector();
57: }
58:
59: /**
60: * Always throws exception.
61: */
62: public Object getAttributeValue(Object obj, String attributeName) {
63: throw new StoreException("object value cannot be get, name: "
64: + attributeName + " in nullhandler for: " + sourceEntry);
65: }
66:
67: /**
68: * Always returns exception.
69: */
70: public void setAttributeValue(Object obj, String attributeName,
71: Object value) {
72: throw new StoreException(
73: "object value cannot be set, objectclass: "
74: + obj.getClass() + " name: " + attributeName
75: + " on nullhandler for type: " + sourceEntry);
76: }
77:
78: }
|