KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > db4o > events > impl > EventRegistryImpl


1 /* Copyright (C) 2004 - 2006 db4objects Inc. http://www.db4o.com
2
3 This file is part of the db4o open source object database.
4
5 db4o is free software; you can redistribute it and/or modify it under
6 the terms of version 2 of the GNU General Public License as published
7 by the Free Software Foundation and as clarified by db4objects' GPL
8 interpretation policy, available at
9 http://www.db4o.com/about/company/legalpolicies/gplinterpretation/
10 Alternatively you can write to db4objects, Inc., 1900 S Norfolk Street,
11 Suite 350, San Mateo, CA 94403, USA.
12
13 db4o is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */

21 package com.db4o.events.impl;
22
23 import com.db4o.events.Event4;
24 import com.db4o.events.EventRegistry;
25 import com.db4o.inside.callbacks.Callbacks;
26 import com.db4o.query.Query;
27
28 /**
29  * @exclude
30  */

31 public class EventRegistryImpl implements Callbacks, EventRegistry {
32     
33     protected final Event4Impl _queryStarted = new Event4Impl();
34     protected final Event4Impl _queryFinished = new Event4Impl();
35     protected final Event4Impl _creating = new Event4Impl();
36     protected final Event4Impl _activating = new Event4Impl();
37     protected final Event4Impl _updating = new Event4Impl();
38     protected final Event4Impl _deleting = new Event4Impl();
39     protected final Event4Impl _deactivating = new Event4Impl();
40     protected final Event4Impl _created = new Event4Impl();
41     protected final Event4Impl _activated = new Event4Impl();
42     protected final Event4Impl _updated = new Event4Impl();
43     protected final Event4Impl _deleted = new Event4Impl();
44     protected final Event4Impl _deactivated = new Event4Impl();
45
46     // Callbacks implementation
47
public void onQueryFinished(Query query) {
48         EventPlatform.triggerQueryEvent(_queryFinished, query);
49     }
50
51     public void onQueryStarted(Query query) {
52         EventPlatform.triggerQueryEvent(_queryStarted, query);
53     }
54     
55     public boolean objectCanNew(Object JavaDoc obj) {
56         return EventPlatform.triggerCancellableObjectEventArgs(_creating, obj);
57     }
58     
59     public boolean objectCanActivate(Object JavaDoc obj) {
60         return EventPlatform.triggerCancellableObjectEventArgs(_activating, obj);
61     }
62     
63     public boolean objectCanUpdate(Object JavaDoc obj) {
64         return EventPlatform.triggerCancellableObjectEventArgs(_updating, obj);
65     }
66     
67     public boolean objectCanDelete(Object JavaDoc obj) {
68         return EventPlatform.triggerCancellableObjectEventArgs(_deleting, obj);
69     }
70     
71     public boolean objectCanDeactivate(Object JavaDoc obj) {
72         return EventPlatform.triggerCancellableObjectEventArgs(_deactivating, obj);
73     }
74     
75     public void objectOnActivate(Object JavaDoc obj) {
76         EventPlatform.triggerObjectEvent(_activated, obj);
77     }
78     
79     public void objectOnNew(Object JavaDoc obj) {
80         EventPlatform.triggerObjectEvent(_created, obj);
81     }
82     
83     public void objectOnUpdate(Object JavaDoc obj) {
84         EventPlatform.triggerObjectEvent(_updated, obj);
85     }
86     
87     public void objectOnDelete(Object JavaDoc obj) {
88         EventPlatform.triggerObjectEvent(_deleted, obj);
89     }
90
91     public void objectOnDeactivate(Object JavaDoc obj) {
92         EventPlatform.triggerObjectEvent(_deactivated, obj);
93     }
94
95     public Event4 queryFinished() {
96         return _queryFinished;
97     }
98
99     public Event4 queryStarted() {
100         return _queryStarted;
101     }
102
103     public Event4 creating() {
104         return _creating;
105     }
106
107     public Event4 activating() {
108         return _activating;
109     }
110
111     public Event4 updating() {
112         return _updating;
113     }
114
115     public Event4 deleting() {
116         return _deleting;
117     }
118
119     public Event4 deactivating() {
120         return _deactivating;
121     }
122
123     public Event4 created() {
124         return _created;
125     }
126
127     public Event4 activated() {
128         return _activated;
129     }
130
131     public Event4 updated() {
132         return _updated;
133     }
134
135     public Event4 deleted() {
136         return _deleted;
137     }
138
139     public Event4 deactivated() {
140         return _deactivated;
141     }
142 }
143
Popular Tags