KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > invocation > Invocation


1 /*
2  * Copyright 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package org.apache.ldap.server.invocation;
18
19
20 import java.io.Serializable JavaDoc;
21 import java.util.Stack JavaDoc;
22
23 import javax.naming.NamingException JavaDoc;
24
25 import org.apache.ldap.server.BackingStore;
26
27
28 /**
29  * Represents a method invocation on {@link BackingStore}s. You can perform any
30  * {@link BackingStore} calls by invoking {@link
31  * org.apache.ldap.server.jndi.JndiProvider#invoke(Invocation)}.<p/>
32  * This class is abstract, and developers should extend this class to
33  * represent the actual method invocations.
34  *
35  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
36  * @version $Rev: 169198 $, $Date: 2005-05-08 20:05:59 -0400 (Sun, 08 May 2005) $
37  */

38 public abstract class Invocation implements Serializable JavaDoc
39 {
40
41     protected transient Object JavaDoc returnValue;
42
43     protected transient Stack JavaDoc contextStack;
44
45     
46     /**
47      * Creates a new instance. This constructor does nothing.
48      */

49     protected Invocation()
50     {
51     }
52
53
54     /**
55      * Returns the returnValue object for this invocation.
56      */

57     public Object JavaDoc getReturnValue()
58     {
59         return returnValue;
60     }
61
62
63     /**
64      * Sets the returnValue object for this invocation.
65      */

66     public void setReturnValue( Object JavaDoc returnValue )
67     {
68         this.returnValue = returnValue;
69     }
70
71
72     /**
73      * Gets the context stack in which this invocation occurs. The
74      * context stack is a stack of LdapContexts.
75      *
76      * @return a stack of LdapContexts in which the invocation occurs
77      */

78     public Stack JavaDoc getContextStack()
79     {
80         return contextStack;
81     }
82
83
84     /**
85      * Sets the context stack in which this invocation occurs. The context stack
86      * is a stack of LdapContexts.
87      *
88      * @param contextStack a stack of LdapContexts in which the invocation occurs
89      */

90     public void setContextStack( Stack JavaDoc contextStack )
91     {
92         this.contextStack = contextStack;
93     }
94
95
96     /**
97      * Executes this invocation on the specified <code>store</code>. The default
98      * implementation calls an abstract method {@link #doExecute(BackingStore)}
99      * and sets the <code>returnValue</code> property of this invocation to its return value.
100      *
101      * @throws NamingException if the operation failed
102      */

103     public void execute( BackingStore store ) throws NamingException JavaDoc
104     {
105         setReturnValue( doExecute( store ) );
106     }
107
108
109     /**
110      * Implement this method to invoke the appropriate operation on the specified
111      * <code>store</code>. Returned value will be set as the <code>returnValue</code> proeprty of this invocation.
112      *
113      * @throws NamingException if the operation failed
114      */

115     protected abstract Object JavaDoc doExecute( BackingStore store ) throws NamingException JavaDoc;
116 }
117
Popular Tags