KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > core > CollaborationParticipant


1 /*
2   Copyright (C) 2001-2002 Renaud Pawlak <renaud@aopsys.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public
15   License along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17   USA */

18
19 package org.objectweb.jac.core;
20
21 import org.objectweb.jac.core.rtti.AbstractMethodItem;
22
23 /**
24  * The classes that implement this interface are objects that can
25  * participate to a collaboration.
26  *
27  * <p>This includes the ability to get the current wrappee, method and
28  * arguments of the call that is currently proceeded, and the ability
29  * to define and retrieve attributes from the current collaboration
30  * flow.
31  *
32  * <p>The classes that implement this interface use the
33  * <code>Collaboration</code> class.
34  *
35  * @see Collaboration
36  *
37  * @author Renaud Pawlak
38  */

39
40 public interface CollaborationParticipant {
41
42    /**
43     * Add an attribute to the current collaboration.
44     *
45     * <p>A attribute is an attribute that is visible from all the
46     * objects of the local JAC container. I can propagate to remote
47     * containers when remote objects are called on this container if
48     * it is defined global.
49     *
50     * @param name the name of the attribute.
51     * @param value its value (must be serializable if the attribute is
52     * global), null undefines the attribute
53     * @see Collaboration#addAttribute(String,Object) */

54
55    void attrdef( String JavaDoc name, Object JavaDoc value );
56
57    /**
58     * Get an attribute value for the current collaboration. This
59     * attribute can be global or local.
60     *
61     * @param name the name of the collaboration attribute.
62     * @return the value of the attribute
63     * @see Collaboration#getAttribute(String) */

64     
65    Object JavaDoc attr( String JavaDoc name );
66
67    /**
68     * Returns the wrappee of the current call, that is to say the base
69     * program object that have been called during the current
70     * collaboration point (method call).
71     *
72     * @return the currently called wrappee
73     */

74
75    Wrappee wrappee();
76    
77    /**
78     * Returns the method name that have been called on the wrappee
79     * during the current collaboration point (method call).
80     *
81     * @return the currently called method
82     */

83
84    AbstractMethodItem method();
85    
86    /**
87     * Returns the args that have been passed to the method (see
88     * <code>method()</code>).
89     *
90     * @return the array arguments of the currently called method
91     */

92
93    Object JavaDoc[] args();
94
95    /**
96     * Returns the nth argument of the current collaboration point
97     * method (see <code>args()</code>).
98     *
99     * @param nth the zero-indexed argument index
100     * @return the nth argument of the currently called method
101     */

102
103    Object JavaDoc arg( int nth );
104
105    /**
106     * Sets the nth argument value.
107     *
108     * @param nth the zero-indexed argument index
109     * @param value the new value
110     */

111
112    void setarg( int nth, Object JavaDoc value );
113
114    /**
115     * Sets the argument values.
116     *
117     * @param values the new values
118     */

119
120    void setargs( Object JavaDoc[] values );
121
122 }
123
124
125
126
127
128
129
130
131
132
Popular Tags