Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 79060 invoked from network); 2 Jan 2011 00:49:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 Jan 2011 00:49:57 -0000 Received: (qmail 20640 invoked by uid 500); 2 Jan 2011 00:49:57 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 20596 invoked by uid 500); 2 Jan 2011 00:49:57 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 20589 invoked by uid 99); 2 Jan 2011 00:49:57 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jan 2011 00:49:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Jan 2011 00:49:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4FD902388994; Sun, 2 Jan 2011 00:49:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1054334 - /directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/ Date: Sun, 02 Jan 2011 00:49:31 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110102004931.4FD902388994@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Sun Jan 2 00:49:30 2011 New Revision: 1054334 URL: http://svn.apache.org/viewvc?rev=1054334&view=rev Log: o Used the AdministrativeRoleEnum instead of AdministrativeRole o Created the 4 Subentry sub classes, one for each role o Modified the SubentryCache to manage an UUID -> Subentry relation instead of a DN -> subentry Added: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AccessControlSubentry.java directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/CollectiveAttributeSubentry.java directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubSchemaSubentry.java directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubentryCache.java - copied, changed from r1051326, directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/TriggerExecutionSubentry.java Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java?rev=1054334&r1=1054333&r2=1054334&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java (original) +++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AbstractAdministrativePoint.java Sun Jan 2 00:49:30 2011 @@ -174,7 +174,7 @@ public abstract class AbstractAdministra /** * {@inheritDoc} */ - public Set getSubentries( AdministrativeRole role ) + public Set getSubentries( AdministrativeRoleEnum role ) { synchronized( subentries ) { @@ -182,7 +182,7 @@ public abstract class AbstractAdministra for ( Subentry subentry : this.subentries ) { - if ( subentry.getAdministrativeRoles().contains( role ) ) + if ( subentry.getAdministrativeRole() == role ) { subentries.add( subentry ); } Added: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AccessControlSubentry.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AccessControlSubentry.java?rev=1054334&view=auto ============================================================================== --- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AccessControlSubentry.java (added) +++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AccessControlSubentry.java Sun Jan 2 00:49:30 2011 @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.server.core.administrative; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.directory.shared.ldap.aci.ACIItem; +import org.apache.directory.shared.ldap.subtree.SubtreeSpecification; + + +/** + * A subentry class to manage the AccessControl aspect. + * + * @author Apache Directory Project + */ +public class AccessControlSubentry extends Subentry +{ + /** The list of ACIItems */ + private List aciItems; + + /** + * Create an instance of the AccessControlSubentry class + */ + public AccessControlSubentry( String cn, SubtreeSpecification ss, String uuid ) + { + super( cn, ss, uuid ); + aciItems = new ArrayList(); + } + + + /** + * {@inheritDoc} + */ + public boolean isAccessControlAdminRole() + { + return true; + } + + + /** + * {@inheritDoc} + */ + public AdministrativeRoleEnum getAdministrativeRole() + { + return AdministrativeRoleEnum.AccessControl; + } + + + /** + * @return the aciItems + */ + public List getAciItems() + { + return aciItems; + } + + + /** + * @param aciItem the aciItems to add + */ + public void addAciItem( ACIItem aciItem ) + { + aciItems.add( aciItem ); + } + + + /** + * {@inheritDoc} + */ + public String toString() + { + StringBuilder sb = new StringBuilder(); + + sb.append( "AccessControlSubentry\n" ); + + sb.append( super.toString() ); + + for ( ACIItem aciItem : aciItems ) + { + sb.append( aciItem ); + } + + return sb.toString(); + } +} Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java?rev=1054334&r1=1054333&r2=1054334&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java (original) +++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/AdministrativePoint.java Sun Jan 2 00:49:30 2011 @@ -118,7 +118,7 @@ public interface AdministrativePoint * @param role The role we are looking the subentries for * @return The Set of subentries found */ - Set getSubentries( AdministrativeRole role ); + Set getSubentries( AdministrativeRoleEnum role ); /** Added: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/CollectiveAttributeSubentry.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/CollectiveAttributeSubentry.java?rev=1054334&view=auto ============================================================================== --- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/CollectiveAttributeSubentry.java (added) +++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/CollectiveAttributeSubentry.java Sun Jan 2 00:49:30 2011 @@ -0,0 +1,101 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.server.core.administrative; + +import java.util.List; + +import org.apache.directory.shared.ldap.entry.EntryAttribute; +import org.apache.directory.shared.ldap.subtree.SubtreeSpecification; + +/** + * A subentry class to manage the CollectiveAttribute aspect. + * + * @author Apache Directory Project + */ +public class CollectiveAttributeSubentry extends Subentry +{ + private List collectiveAttributes; + + /** + * Create an instance of the CollectiveAttributeSubentry class + */ + public CollectiveAttributeSubentry( List collectiveAttributes ) + { + super(); + this.collectiveAttributes = collectiveAttributes; + } + + + /** + * Create an instance of the CollectiveAttributeSubentry class + */ + public CollectiveAttributeSubentry( String cn, SubtreeSpecification ss, String uuid, List collectiveAttributes ) + { + super( cn, ss, uuid ); + this.collectiveAttributes = collectiveAttributes; + } + + + /** + * @return the collective Attributes + */ + public List getCollectiveAttributes() + { + return collectiveAttributes; + } + + + /** + * {@inheritDoc} + */ + public boolean isCollectiveAdminRole() + { + return true; + } + + + /** + * {@inheritDoc} + */ + public AdministrativeRoleEnum getAdministrativeRole() + { + return AdministrativeRoleEnum.CollectiveAttribute; + } + + + /** + * {@inheritDoc} + */ + public String toString() + { + StringBuilder sb = new StringBuilder(); + + sb.append( "CollectiveAttributeSubentry\n" ); + + sb.append( super.toString() ); + + for ( EntryAttribute attribute : collectiveAttributes ) + { + sb.append( attribute ); + } + + return sb.toString(); + } +} Added: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubSchemaSubentry.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubSchemaSubentry.java?rev=1054334&view=auto ============================================================================== --- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubSchemaSubentry.java (added) +++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubSchemaSubentry.java Sun Jan 2 00:49:30 2011 @@ -0,0 +1,72 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.server.core.administrative; + +import org.apache.directory.shared.ldap.subtree.SubtreeSpecification; + + +/** + * A subentry class to manage the SubSchema aspect. + * + * @author Apache Directory Project + */ +public class SubSchemaSubentry extends Subentry +{ + /** + * Create an instance of the SubSchemaSubentry class + */ + public SubSchemaSubentry( String cn, SubtreeSpecification ss, String uuid ) + { + super( cn, ss, uuid ); + } + + + /** + * {@inheritDoc} + */ + public boolean isSubSchemaAdminRole() + { + return true; + } + + + /** + * {@inheritDoc} + */ + public AdministrativeRoleEnum getAdministrativeRole() + { + return AdministrativeRoleEnum.SubSchema; + } + + + /** + * {@inheritDoc} + */ + public String toString() + { + StringBuilder sb = new StringBuilder(); + + sb.append( "SubSchemaSubentry\n" ); + + sb.append( super.toString() ); + + return sb.toString(); + } +} Modified: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java?rev=1054334&r1=1054333&r2=1054334&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java (original) +++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/Subentry.java Sun Jan 2 00:49:30 2011 @@ -20,8 +20,6 @@ package org.apache.directory.server.core.administrative; -import java.util.Set; - import org.apache.directory.shared.ldap.subtree.SubtreeSpecification; @@ -33,14 +31,11 @@ import org.apache.directory.shared.ldap. * * @author Apache Directory Project */ -public class Subentry +public abstract class Subentry { /** The Subtree Specification associated with this subentry */ private SubtreeSpecification ss; - /** The administratives roles */ - private Set administrativeRoles; - /** The subentry UUID */ private String uuid; @@ -48,42 +43,41 @@ public class Subentry private String cn; /** - * Stores the subtreeSpecification - * - * @param ss The subtree specification + * Creates a new instance of a Subentry */ - public void setSubtreeSpecification( SubtreeSpecification ss ) + protected Subentry() { - this.ss = ss; } - - + + /** - * @return The subtree specification + * Creates a new instance of a Subentry */ - public SubtreeSpecification getSubtreeSpecification() + protected Subentry( String cn, SubtreeSpecification ss, String uuid ) { - return ss; + this.cn = cn; + this.ss = ss; + this.uuid = uuid; } - - + + /** - * Stores the set of roles for this subentry + * Stores the subtreeSpecification * - * @param administrativeRoles The roles to be added + * @param ss The subtree specification */ - public void setAdministrativeRoles( Set administrativeRoles ) + public void setSubtreeSpecification( SubtreeSpecification ss ) { - this.administrativeRoles = administrativeRoles; + this.ss = ss; } /** - * @return The list of roles for this subentry + * @return The subtree specification */ - public Set getAdministrativeRoles() + public SubtreeSpecification getSubtreeSpecification() { - return administrativeRoles; + return ss; } @@ -92,7 +86,7 @@ public class Subentry */ public boolean isCollectiveAdminRole() { - return administrativeRoles.contains( AdministrativeRoleEnum.CollectiveAttribute ); + return false; } @@ -101,7 +95,7 @@ public class Subentry */ public boolean isSchemaAdminRole() { - return administrativeRoles.contains( AdministrativeRoleEnum.SubSchema ); + return false; } @@ -110,7 +104,7 @@ public class Subentry */ public boolean isAccessControlAdminRole() { - return administrativeRoles.contains( AdministrativeRoleEnum.AccessControl ); + return false; } @@ -119,8 +113,14 @@ public class Subentry */ public boolean isTriggersAdminRole() { - return administrativeRoles.contains( AdministrativeRoleEnum.TriggerExecution ); + return false; } + + + /** + * @return the subentry administrativeRole + */ + public abstract AdministrativeRoleEnum getAdministrativeRole(); /** @@ -165,24 +165,8 @@ public class Subentry public String toString() { StringBuilder sb = new StringBuilder(); - sb.append( "Subentry: " ).append( cn).append( '-').append( uuid ).append( "[" ); - - boolean isFirst = true; - - for ( AdministrativeRoleEnum role : administrativeRoles ) - { - if ( isFirst ) - { - isFirst = false; - } - else - { - sb.append( ", " ); - } - - sb.append( role ); - } - sb.append( "]" ); + sb.append( "Subentry name : " ).append( cn ).append( '\n' ); + sb.append( "UUID : " ).append( uuid ).append( '\n' ); return sb.toString(); } Copied: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubentryCache.java (from r1051326, directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java) URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubentryCache.java?p2=directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubentryCache.java&p1=directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java&r1=1051326&r2=1054334&rev=1054334&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-AP/core/src/main/java/org/apache/directory/server/core/subtree/SubentryCache.java (original) +++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/SubentryCache.java Sun Jan 2 00:49:30 2011 @@ -17,47 +17,30 @@ * under the License. * */ -package org.apache.directory.server.core.subtree; +package org.apache.directory.server.core.administrative; import java.util.Iterator; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.directory.server.core.administrative.Subentry; -import org.apache.directory.shared.ldap.name.DN; /** - * A cache for subtree specifications. It associates a Subentry with a DN, - * representing its position in the DIT.
- * This cache has a size limit set to 1000 at the moment. We should add a configuration - * parameter to manage its size. + * A cache for subtree specifications. It associates a Subentry with its entryUUID
* * @author Apache Directory Project */ -public class SubentryCache implements Iterable +public class SubentryCache implements Iterable { - /** The default cache size limit */ - private static final int DEFAULT_CACHE_MAX_SIZE = 1000; - - /** The cache size limit */ - private int cacheMaxSize = DEFAULT_CACHE_MAX_SIZE; - - /** The current cache size */ - private AtomicInteger cacheSize; - /** The Subentry cache */ - private final Map cache; + private final Map cache; /** * Creates a new instance of SubentryCache with a default maximum size. */ public SubentryCache() { - cache = new ConcurrentHashMap(); - cacheSize = new AtomicInteger( 0 ); + cache = new ConcurrentHashMap(); } @@ -66,39 +49,32 @@ public class SubentryCache implements It */ public SubentryCache( int maxSize ) { - cache = new ConcurrentHashMap(); - cacheSize = new AtomicInteger( 0 ); - cacheMaxSize = maxSize; + cache = new ConcurrentHashMap(); } /** - * Retrieve a Subentry given a DN. If there is none, null will be returned. + * Retrieve a Subentry given an UUID. If there is none, null will be returned. * - * @param dn The DN we want to get the Subentry for + * @param uuid The UUID we want to get the Subentry for * @return The found Subentry, or null */ - final Subentry getSubentry( DN dn ) + public final Subentry getSubentry( String uuid ) { - return cache.get( dn ); + return cache.get( uuid ); } /** - * Remove a Subentry for a given DN + * Remove a Subentry for a given UUID * - * @param dn The DN for which we want to remove the + * @param uuid The UUID for which we want to remove the * associated Subentry * @return The removed Subentry, if any */ - final Subentry removeSubentry( DN dn ) + public final Subentry removeSubentry( String uuid ) { - Subentry oldSubentry = cache.remove( dn ); - - if ( oldSubentry != null ) - { - cacheSize.decrementAndGet(); - } + Subentry oldSubentry = cache.remove( uuid ); return oldSubentry; } @@ -107,54 +83,33 @@ public class SubentryCache implements It /** * Stores a new Subentry into the cache, associated with a DN * - * @param dn The Subentry DN - * @param ss The SubtreeSpecification - * @param adminRoles The administrative roles for this Subentry + * @param subentry The Subentry * @return The old Subentry, if any */ - /* No qualifier */ Subentry addSubentry( DN dn, Subentry subentry ) + public Subentry addSubentry( Subentry subentry ) { - if ( cacheSize.get() > cacheMaxSize ) - { - // TODO : Throw an exception here - } - - Subentry oldSubentry = cache.put( dn, subentry ); - - if ( oldSubentry == null ) - { - cacheSize.getAndIncrement(); - } + Subentry oldSubentry = cache.put( subentry.getUuid(), subentry ); return oldSubentry; } /** - * Tells if there is a Subentry associated with a DN - * @param dn The DN + * Tells if there is a Subentry associated with an UUID + * @param uuid The UUID * @return True if a Subentry is found */ - /* No qualifier */ boolean hasSubentry( DN dn ) + public boolean hasSubentry( String uuid ) { - return cache.containsKey( dn ); + return cache.containsKey( uuid ); } /** - * @return An Iterator over the Subentry's DNs + * @return An Iterator over the Subentry's UUIDs */ - public Iterator iterator() + public Iterator iterator() { return cache.keySet().iterator(); } - - - /** - * @return The number of elements in the cache - */ - public int getCacheSize() - { - return cacheSize.get(); - } } Added: directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/TriggerExecutionSubentry.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/TriggerExecutionSubentry.java?rev=1054334&view=auto ============================================================================== --- directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/TriggerExecutionSubentry.java (added) +++ directory/apacheds/branches/apacheds-AP/core-api/src/main/java/org/apache/directory/server/core/administrative/TriggerExecutionSubentry.java Sun Jan 2 00:49:30 2011 @@ -0,0 +1,103 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.directory.server.core.administrative; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.directory.shared.ldap.subtree.SubtreeSpecification; +import org.apache.directory.shared.ldap.trigger.TriggerSpecification; + + +/** + * A subentry class to manage the TriggerExecutionSubentry aspect. + * + * @author Apache Directory Project + */ +public class TriggerExecutionSubentry extends Subentry +{ + /** The list of TriggerSpecifications */ + private List triggerSpecifications; + + /** + * Create an instance of the TriggerExecutionSubentry class + */ + public TriggerExecutionSubentry( String cn, SubtreeSpecification ss, String uuid ) + { + super( cn, ss, uuid ); + triggerSpecifications = new ArrayList(); + } + + + /** + * {@inheritDoc} + */ + public boolean isTriggerExecutionAdminRole() + { + return true; + } + + + /** + * {@inheritDoc} + */ + public AdministrativeRoleEnum getAdministrativeRole() + { + return AdministrativeRoleEnum.TriggerExecution; + } + + + /** + * @return the triggerSpecifications + */ + public List getTriggerSpecification() + { + return triggerSpecifications; + } + + + /** + * @param triggerSpecification the TriggerSpecification to add + */ + public void addTriggerSpecification( TriggerSpecification triggerSpecification ) + { + triggerSpecifications.add( triggerSpecification ); + } + + + /** + * {@inheritDoc} + */ + public String toString() + { + StringBuilder sb = new StringBuilder(); + + sb.append( "AccessControlSubentry\n" ); + + sb.append( super.toString() ); + + for ( TriggerSpecification triggerSpecification : triggerSpecifications ) + { + sb.append( triggerSpecification ); + } + + return sb.toString(); + } +}