View Javadoc

1   /*
2    * Copyright 2001-2005 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either. Easily absorbing new information and disseminating it where needed. express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.nxqd.event;
17  
18  import java.util.StringTokenizer;
19  /**
20   *
21   * @author <a href="mailto:webhiker@sourceforge.net">webhiker</a>
22   * @version 1.0
23   */
24  public abstract class NxqdEvent extends Object {
25  
26      private long id;
27      private int type;
28      private String name;
29      private String source;
30  
31      public NxqdEvent() {
32      }
33  
34      public void setDetail(final String s) {
35  	StringTokenizer tok = new StringTokenizer(s,";");
36  	id = Long.parseLong(tok.nextToken());
37  	type = Integer.parseInt(tok.nextToken());
38  	name = tok.nextToken();
39  	if (tok.hasMoreTokens()) {
40  	    source = tok.nextToken();
41  	}
42  	else {
43  	    source = "";
44  	}
45      }
46  
47      public long getId() {
48  	return id;
49      }
50  
51      /**
52       * The <code>getType</code> method returns the event type of this event.
53       * The value returned depends on what type of underlying event object it is.
54       *
55       * @return an <code>int</code> value
56       */
57      public int getType() {
58  	return type;
59      }
60  
61      /**
62       * The <code>getName</code> method returns the name of the
63       * resource which generated the event.
64       *
65       * @return a <code>String</code> value
66       */
67      public String getName() {
68  	return name;
69      }
70  
71      /**
72       * The <code>getSource</code> method is used to hold additional data use by the
73       * <code>NxqdContainerEvent</code> and <code>NxqdManagerEvent</code> objects.
74       *
75       * @return a <code>String</code> value
76       */
77      public String getSource() {
78  	return source;
79      }
80  
81  }
82