PageRenderTime 36ms CodeModel.GetById 26ms app.highlight 6ms RepoModel.GetById 2ms app.codeStats 0ms

/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/pkg/PkgEventItem.java

http://mobicents.googlecode.com/
Java | 126 lines | 25 code | 12 blank | 89 comment | 0 complexity | fea76445ea964c4363a5569340652673 MD5 | raw file
  1package javax.megaco.pkg;
  2
  3/**
  4 * The MEGACO event item class is an abstract class defined as the base class
  5 * for all the event items in the MEGACO Package. This class shall be used for
  6 * setting the events, list of parameters names and their values. This extends
  7 * the PkgItem class. This is an abstract class and hence cannot be created as a
  8 * separate object.
  9 * 
 10 * 
 11 */
 12public abstract class PkgEventItem extends PkgItem {
 13
 14	protected int eventId = -1;
 15
 16	protected PkgItemParam[] paramInfo;
 17
 18	/**
 19	 * Constructs a Jain MEGACO Package Event Item Object. This is an abstract
 20	 * class and can be called only by the derived classes.
 21	 */
 22	public PkgEventItem() {
 23
 24	}
 25
 26	/**
 27	 * The method can be used to get the event identifier. This method gives the
 28	 * event id of the event item. This is an abstract method and is defined by
 29	 * the methods of the derived class which shall return an hard coded value
 30	 * for the event id.
 31	 * 
 32	 * @return eventId - The integer corresponding to the event id.
 33	 */
 34	public abstract int getEventId();
 35
 36	/**
 37	 * The method can be used to get the event identifier. This method gives the
 38	 * item id of the event item. This is an abstract method and is defined by
 39	 * the methods of the derived class which shall return an hard coded value
 40	 * for the event id.
 41	 * 
 42	 * eventId - The integer corresponding to the event id.
 43	 */
 44	public abstract int getItemId();
 45
 46	/**
 47	 * This method overrides the corresponding method in PkgItem. This shall
 48	 * return an hard coded value to indicate the item type is event.
 49	 * 
 50	 * itemType - An integer value for the item type corresponding to the event.
 51	 * This shall return {@link javax.megaco.pkg.PkgItemType.M_EVENT}
 52	 */
 53	public final int getItemType() {
 54		return PkgItemType.M_EVENT;
 55	}
 56
 57	/**
 58	 * This method overrides the corresponding method in PkgItem. This method
 59	 * would set a flag to indicate that the dynamic package has been associated
 60	 * and would not allow the application to overwrite the package association
 61	 * once the parameter has been set for the item. If the package name can be
 62	 * linked, then this method inturn calls the corresponding method of the
 63	 * PkgItem class.
 64	 * 
 65	 * packageId - The object reference of the package object to which the item
 66	 * is dynamically associated.
 67	 * 
 68	 * IllegalArgumentException This exception will be raised in the following
 69	 * cases 1. If the method is called to modify the associated package after
 70	 * the parameter has been set. 2. If the package that is dynamically being
 71	 * linked cannot be set due to the fact that the item does not belong to the
 72	 * package or the package is not one of the ancestor package of the package,
 73	 * to which the item belongs. 3. If the reference of package Id passed to
 74	 * this method is NULL.
 75	 */
 76	public void setAssociatedPkgId(MegacoPkg packageId)
 77			throws IllegalArgumentException {
 78		// TODO
 79	}
 80
 81	/**
 82	 * The method can be used to get the vector object identifier that specifies
 83	 * the attached Parameter name and the corresponding values for the event.
 84	 * 
 85	 * @return paramInfo - The vector of objectIdentifier corresponding to the
 86	 *         param information set for the package. If the parameter is not
 87	 *         set then this shall return a NULL value.
 88	 */
 89	public final PkgItemParam[] getMegacoPkgItemParam() {
 90		return this.paramInfo;
 91	}
 92
 93	/**
 94	 * The method can be used to set the Parameter information. This method sets
 95	 * the attached parameters for the event. This method should be called only
 96	 * after a package has been associated with the item. Once the parameter has
 97	 * been set, it shall not allow the associated item to be overwritten. This
 98	 * method shall verify the following:
 99	 * 
100	 * <br>
101	 * 1. The parameter can be set for the relevant item. <br>
102	 * 2. The parameter too belongs to the same package for which the item
103	 * belongs. <br>
104	 * 3. If the parameter does not belong to the same package, then does it
105	 * belong to a package that extends the package to which the item belongs. <br>
106	 * 4. If the parameter and the item belong to different packages, but if the
107	 * package to which the parameter belongs extends the package to which the
108	 * item belongs, then it should validate that the current association of the
109	 * item is to the package to which the parameter belongs or should be such
110	 * that it extends the package to which the parameter belongs.
111	 * 
112	 * @param paramInfo - The vector of objectIdentifier corresponding to the parameter information.
113	 * @throws IllegalArgumentException If the parameter cannot be linked to the current event.
114	 * @throws IllegalStateException If the item has not been associated with a package.
115	 */
116	public final void setMegacoPkgItemParam(PkgItemParam[] paramInfo) throws IllegalArgumentException, IllegalStateException {
117		// FIXME: add checks for exceptions
118		this.paramInfo = paramInfo;
119	}
120
121	@Override
122	public java.lang.String toString() {
123		// TODO
124		return super.toString() +" : EventId = "+eventId;
125	}
126}