01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.object.appevent;
06:
07: import javax.swing.tree.DefaultTreeModel;
08:
09: /**
10: * Abstract event context, common stuff for subclasses
11: */
12: public abstract class AbstractApplicationEventContext implements
13: ApplicationEventContext {
14:
15: private static final long serialVersionUID = 4788562594133534828L;
16:
17: private final transient Object pojo;
18: private final String threadName;
19: private final String clientId;
20: private final String targetClassName;
21: private DefaultTreeModel treeModel;
22:
23: private String projectName; // optional: client Eclipse
24:
25: // project name
26:
27: /**
28: * Construct new context
29: * @param pojo Object of interest
30: * @param threadName Thread name
31: * @param clientId JVM client identifier
32: */
33: public AbstractApplicationEventContext(Object pojo,
34: String threadName, String clientId) {
35: this .pojo = pojo;
36: this .targetClassName = pojo.getClass().getName();
37: this .threadName = threadName;
38: this .clientId = clientId;
39: this .projectName = System.getProperty("project.name");
40: }
41:
42: public Object getPojo() {
43: return pojo;
44: }
45:
46: /**
47: * @return Class name of object
48: */
49: public String getTargetClassName() {
50: return targetClassName;
51: }
52:
53: /**
54: * @return Thread name
55: */
56: public String getThreadName() {
57: return threadName;
58: }
59:
60: /**
61: * @return JVM client ID
62: */
63: public String getClientId() {
64: return clientId;
65: }
66:
67: /**
68: * @param treeModel Set model representing object hierarchy
69: */
70: public void setTreeModel(DefaultTreeModel treeModel) {
71: this .treeModel = treeModel;
72: }
73:
74: /**
75: * @return Model representing object hierarchy
76: */
77: public DefaultTreeModel getTreeModel() {
78: return treeModel;
79: }
80:
81: /**
82: * Set Eclipse project name
83: * @param name
84: */
85: public void setProjectName(String name) {
86: projectName = name;
87: }
88:
89: /**
90: * @return Eclipse project name
91: */
92: public String getProjectName() {
93: return projectName;
94: }
95: }
|