1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 */
20 package org.apache.directory.server.core.interceptor.context;
21
22
23 import org.apache.directory.server.core.CoreSession;
24 import org.apache.directory.server.core.partition.Partition;
25
26
27 /**
28 * A AddContextPartition context used for Interceptors. It contains all the informations
29 * needed for the addContextPartition operation, and used by all the interceptors. If
30 * it does not have a partition set for it, then it will load and instantiate it
31 * automatically using the information in the partition configuration.
32 *
33 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
34 * @version $Rev$, $Date$
35 */
36 public class AddContextPartitionOperationContext extends EmptyOperationContext
37 {
38 /** the instantiated partition class */
39 private Partition partition;
40
41
42 /**
43 * Creates a new instance of AddContextPartitionOperationContext.
44 *
45 * @param partition The partition to add
46 */
47 public AddContextPartitionOperationContext( CoreSession session, Partition partition )
48 {
49 super( session );
50 this.partition = partition;
51 }
52
53
54 /**
55 * @see Object#toString()
56 */
57 public String toString()
58 {
59 return "AddContextPartitionOperationContext for partition context '" + partition.getId() + "'";
60 }
61
62
63 /**
64 * @return The partition
65 */
66 public Partition getPartition()
67 {
68 return partition;
69 }
70
71
72 /**
73 * Set the partition.
74 *
75 * @param partition the partition
76 */
77 public void setPartitionConfiguration( Partition partition )
78 {
79 this.partition = partition;
80 }
81
82
83 /**
84 * @return the operation name
85 */
86 public String getName()
87 {
88 return "AddContextPartition";
89 }
90 }