1
/*___INFO__MARK_BEGIN__*/
2
/*************************************************************************
4
* The Contents of this file are made available subject to the terms of
5
* the Sun Industry Standards Source License Version 1.2
7
* Sun Microsystems Inc., March, 2001
10
* Sun Industry Standards Source License Version 1.2
11
* =================================================
12
* The contents of this file are subject to the Sun Industry Standards
13
* Source License Version 1.2 (the "License"); You may not use this file
14
* except in compliance with the License. You may obtain a copy of the
15
* License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
17
* Software provided under this License is provided on an "AS IS" basis,
18
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
19
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
20
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
21
* See the License for the specific provisions governing your rights and
22
* obligations concerning the Software.
24
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
26
* Copyright: 2001 by Sun Microsystems, Inc.
28
* All Rights Reserved.
30
************************************************************************/
31
/*___INFO__MARK_END__*/
32
package com.sun.grid.jgdi.event;
35
* Base class of all events which signalizes a changes of
36
* objects in the Sun [tm] Grid Engine.
39
public abstract class ChangedObjectEvent extends Event implements java.io.Serializable {
41
/** the new version of the changed objects */
42
private Object changedObject;
43
private Class objectType;
46
* Creates a new instance of ChangedObjectEvent
47
* @param eventType type of event
48
* @param timestamp timestamp when the event occured
49
* @param eventId id of the event
50
* @param objectType type of the changed objects
52
public ChangedObjectEvent(EventType eventType, long timestamp, int eventId, Class objectType) {
53
super(eventType, timestamp, eventId);
54
this.objectType = objectType;
58
* Get the type of the changed objects
59
* @return type of the changed objects
61
public Class getObjectType() {
66
* Set the new version of the changed object
67
* @param changedObj the changed object
68
* @throws IllegalArgumentException if <code>changedObj</code> is <code>null</code>
69
* @throws IllegalArgumentException if the class object type for the event is not
70
* assignable from the class of <code>changedObj</code>
73
public void setChangedObject(Object changedObj) {
74
if (changedObj == null) {
75
throw new IllegalArgumentException("changedObj must not be null");
77
if (!objectType.isAssignableFrom(changedObj.getClass())) {
78
throw new IllegalArgumentException("changedObj must instanceof " + objectType.getName());
80
this.changedObject = changedObj;
84
* Get the new version of the changed object which has been changed by this event
85
* @return list of changed objects
87
public Object getChangedObject() {
91
public String toString() {
92
StringBuilder ret = new StringBuilder();
94
ret.append(super.toString());
96
ret.append(changedObject);
98
return ret.toString();
102
* Set the primary key information of the changed object into the event.
104
* <p>This method is called from the the native part of jgdi to fill the
105
* primary key information into a del event</p>
107
* @param numKey1 first numerical primary key of the deleted object
108
* @param numKey2 second numerical primary key of the deleted object
109
* @param strKey1 first string primary key of the deleted object
110
* @param strKey2 second string primary key of the deleted object
112
public abstract void setPKInfo(int numKey1, int numKey2, String strKey1, String strKey2);