KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > emb > MediaListener


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license. See terms of license at gnu.org.
5  */

6
7 package javax.emb;
8
9 import java.io.Serializable;
10
11 /**
12  * This interface defines the common behavior of media listener. Such observers
13  * are implemented by application programmers to be persisted with and extend
14  * the semantics of media entity EJBs in a way that does not depend on the
15  * implementation of the latter. Listeners are notified of specific events in
16  * media entity EJBs once they are registered with said. As they have to be
17  * persisted with media entity EJBs, all listeners must be serializable.
18  *
19  * <p>The persistent observer design differs from the standard Java listener
20  * practice by passing the name of properties affected instead of passing the
21  * property value to distinct callback methods. The reason for this is that the
22  * large size of media content makes it practically impossible to pass it to
23  * observers. Therefore, observers are forced to retrieve property values from
24  * entity beans when there is a need. Please note that Entity Beans must be
25  * deployed as reentrant in order for the latter to work.
26  *
27  * @version <tt>$Revision: 1.1 $</tt>
28  * @author <a HREF="mailto:ricardoarguello@users.sourceforge.net">Ricardo
29  * Argüello</a>
30  */

31 public interface MediaListener extends Serializable
32 {
33    /**
34     * This method handles the fact that the given media entity is about to
35     * change the value of its property named <code>propertyName</code>.
36     * Valid property names are "content", "location", "mimeType", "name" and
37     * "description".
38     *
39     * @param mediaEntity media entity.
40     * @param propertyName prppoerty name.
41     * @throws javax.emb.ListenerVetoException if the listener does not agree to
42     * the intended change.
43     * @throws javax.emb.MediaException if there's an application specific
44     * problem.
45     * @throws java.lang.NullPointerException is thrown if one of the values
46     * passed is <code>null</code>.
47     */

48    void handleAboutToChangeMediaEntity(
49       MediaEntityLocal mediaEntity,
50       String propertyName)
51       throws MediaException;
52
53    /**
54     * This method handles the fact that the given media entity is about to be
55     * removed.
56     *
57     * @param mediaEntity media entity.
58     * @throws javax.emb.ListenerVetoException if the listener does not agree to
59     * the intended removal.
60     * @throws javax.emb.MediaException if there's an application specific
61     * problem.
62     * @throws java.lang.NullPointerException if the value passed is <code>null</code>.
63     */

64    void handleAboutToRemoveMediaEntity(MediaEntityLocal mediaEntity)
65       throws MediaException;
66
67    /**
68     * This method handles the fact that the given media entity has changed the
69     * value of its property named propertyName. Valid property names are
70     * "content", "location", "mimeType", "name" and "description".
71     *
72     * @param mediaEntity media entity.
73     * @param propertyName property name.
74     * @throws javax.emb.ListenerVetoException if the listener does not agree to
75     * the change performed.
76     * @throws javax.emb.MediaException if there's an application specific
77     * problem.
78     * @throws java.lang.NullPointerException if one of the values passed is
79     * <code>null</code>.
80     */

81    void handleMediaEntityChanged(
82       MediaEntityLocal mediaEntity,
83       String propertyName)
84       throws MediaException;
85
86    /**
87     * This method overwrites the matching method in <code>java.lang.Object</code>.
88     * The result is <code>true</code> if the given object is a <code>MediaListener</code>
89     * and it is content equal to the receiver, otherwise <code>false</code>.
90     * Note that this behavior is required as listeners are stored and loaded as
91     * part of EJB operations and therefore frequently change their object
92     * identity.
93     *
94     * @param object object.
95     */

96    boolean equals(Object object);
97
98    /**
99     * This method overwrites the matching method in <code>java.lang.Object</code>.
100     * The resulting hash code is calculated based on the receiver's content.
101     * Note that this behavior is required as listeners are stored and loaded as
102     * part of EJB operations and therefore frequently change their object
103     * identity.
104     *
105     * @return hashcode.
106     */

107    int hashCode();
108 }
Popular Tags