1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.invocation;
18
19
20 import java.util.ArrayList;
21 import java.util.Collections;
22 import java.util.List;
23
24 import javax.naming.Context;
25
26 import org.apache.ldap.server.partition.ContextPartitionNexus;
27
28
29 /***
30 * Represents a call from JNDI {@link Context} to {@link ContextPartitionNexus}.
31 *
32 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
33 * @version $Rev: 264732 $, $Date: 2005-08-30 04:04:51 -0400 (Tue, 30 Aug 2005) $
34 */
35 public class Invocation
36 {
37 private final Context caller;
38 private final String name;
39 private final List parameters;
40
41 /***
42 * Creates a new instance that represents an invocation without parameters.
43 *
44 * @parem caller the JNDI {@link Context} that made this invocation
45 * @param name the name of the called method
46 */
47 public Invocation( Context caller, String name )
48 {
49 this( caller, name, null );
50 }
51
52 /***
53 * Creates a new instance.
54 *
55 * @parem caller the JNDI {@link Context} that made this invocation
56 * @param name the name of the called method
57 * @param parameters the array of parameters passed to the called method
58 */
59 public Invocation( Context caller, String name, Object[] parameters )
60 {
61 if( caller == null )
62 {
63 throw new NullPointerException( "caller" );
64 }
65 if( name == null )
66 {
67 throw new NullPointerException( "name" );
68 }
69
70 if( parameters == null )
71 {
72 parameters = new Object[ 0 ];
73 }
74
75 this.caller = caller;
76 this.name = name;
77
78 List paramList = new ArrayList();
79 for( int i = 0; i < parameters.length; i++ )
80 {
81 paramList.add( parameters[ i ] );
82 }
83
84 this.parameters = Collections.unmodifiableList( paramList );
85 }
86
87 /***
88 * Returns the JNDI {@link Context} which made this invocation.
89 */
90 public Context getCaller()
91 {
92 return caller;
93 }
94
95 /***
96 * Returns the name of the called method.
97 */
98 public String getName()
99 {
100 return name;
101 }
102
103 /***
104 * Returns the list of parameters parameters passed to the called method.
105 */
106 public List getParameters()
107 {
108 return parameters;
109 }
110 }