001 /* 002 Copyright (C) 2001-2002 Renaud Pawlak <renaud@aopsys.com> 003 004 This program is free software; you can redistribute it and/or modify 005 it under the terms of the GNU Lesser General Public License as 006 published by the Free Software Foundation; either version 2 of the 007 License, or (at your option) any later version. 008 009 This program is distributed in the hope that it will be useful, 010 but WITHOUT ANY WARRANTY; without even the implied warranty of 011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 012 GNU Lesser General Public License for more details. 013 014 You should have received a copy of the GNU Lesser General Public 015 License along with this program; if not, write to the Free Software 016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 017 USA */ 018 019 package org.objectweb.jac.core; 020 021 import org.objectweb.jac.core.rtti.AbstractMethodItem; 022 023 /** 024 * The classes that implement this interface are objects that can 025 * participate to a collaboration. 026 * 027 * <p>This includes the ability to get the current wrappee, method and 028 * arguments of the call that is currently proceeded, and the ability 029 * to define and retrieve attributes from the current collaboration 030 * flow. 031 * 032 * <p>The classes that implement this interface use the 033 * <code>Collaboration</code> class. 034 * 035 * @see Collaboration 036 * 037 * @author Renaud Pawlak 038 */ 039 040 public interface CollaborationParticipant { 041 042 /** 043 * Add an attribute to the current collaboration. 044 * 045 * <p>A attribute is an attribute that is visible from all the 046 * objects of the local JAC container. I can propagate to remote 047 * containers when remote objects are called on this container if 048 * it is defined global. 049 * 050 * @param name the name of the attribute. 051 * @param value its value (must be serializable if the attribute is 052 * global), null undefines the attribute 053 * @see Collaboration#addAttribute(String,Object) */ 054 055 void attrdef( String name, Object value ); 056 057 /** 058 * Get an attribute value for the current collaboration. This 059 * attribute can be global or local. 060 * 061 * @param name the name of the collaboration attribute. 062 * @return the value of the attribute 063 * @see Collaboration#getAttribute(String) */ 064 065 Object attr( String name ); 066 067 /** 068 * Returns the wrappee of the current call, that is to say the base 069 * program object that have been called during the current 070 * collaboration point (method call). 071 * 072 * @return the currently called wrappee 073 */ 074 075 Wrappee wrappee(); 076 077 /** 078 * Returns the method name that have been called on the wrappee 079 * during the current collaboration point (method call). 080 * 081 * @return the currently called method 082 */ 083 084 AbstractMethodItem method(); 085 086 /** 087 * Returns the args that have been passed to the method (see 088 * <code>method()</code>). 089 * 090 * @return the array arguments of the currently called method 091 */ 092 093 Object[] args(); 094 095 /** 096 * Returns the nth argument of the current collaboration point 097 * method (see <code>args()</code>). 098 * 099 * @param nth the zero-indexed argument index 100 * @return the nth argument of the currently called method 101 */ 102 103 Object 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 value ); 113 114 /** 115 * Sets the argument values. 116 * 117 * @param values the new values 118 */ 119 120 void setargs( Object[] values ); 121 122 } 123 124 125 126 127 128 129 130 131