From commits-return-33187-apmail-directory-commits-archive=directory.apache.org@directory.apache.org Thu Dec 29 13:47:24 2011 Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 19A757CCD for ; Thu, 29 Dec 2011 13:47:24 +0000 (UTC) Received: (qmail 9727 invoked by uid 500); 29 Dec 2011 13:47:24 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 9668 invoked by uid 500); 29 Dec 2011 13:47:23 -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 9661 invoked by uid 99); 29 Dec 2011 13:47:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 29 Dec 2011 13:47:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Thu, 29 Dec 2011 13:47:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id BE47A238899C for ; Thu, 29 Dec 2011 13:46:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1225527 - in /directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component: hub/ConfigurationManager.java utilities/LdifConfigHelper.java Date: Thu, 29 Dec 2011 13:46:58 -0000 To: commits@directory.apache.org From: gokturk@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111229134658.BE47A238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gokturk Date: Thu Dec 29 13:46:58 2011 New Revision: 1225527 URL: http://svn.apache.org/viewvc?rev=1225527&view=rev Log: * Unnecessary Entry to LdifEntry conversions are deleted for performance Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java?rev=1225527&r1=1225526&r2=1225527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java (original) +++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ConfigurationManager.java Thu Dec 29 13:46:58 2011 @@ -92,7 +92,7 @@ public class ConfigurationManager */ public void pairWithComponent( ADSComponent component ) { - LdifEntry componentEntry = getComponentEntry( component ); + Entry componentEntry = getComponentEntry( component ); if ( componentEntry == null ) { try @@ -127,17 +127,17 @@ public class ConfigurationManager return; } - List instanceEntries = getCachedInstances( component ); + List instanceEntries = getCachedInstances( component ); if ( instanceEntries == null ) { return; } List cachedInstances = new ArrayList(); - for ( LdifEntry le : instanceEntries ) + for ( Entry e : instanceEntries ) { - Properties conf = LdifConfigHelper.instanceEntryToConfiguration( le ); - cachedInstances.add( new CachedComponentInstance( le.getDn().getName(), conf ) ); + Properties conf = LdifConfigHelper.instanceEntryToConfiguration( e ); + cachedInstances.add( new CachedComponentInstance( e.getDn().getName(), conf ) ); } component.setCachedInstances( cachedInstances ); @@ -200,27 +200,26 @@ public class ConfigurationManager * Return null if none exists. * * @param component ADSComponent reference to get its entry - * @return LdifEntry of component on config partition. + * @return Entry of component on config partition. */ - private LdifEntry getComponentEntry( ADSComponent component ) + private Entry getComponentEntry( ADSComponent component ) { String componentDn = ADSComponentHelper.getComponentDn( component ); LookupOperationContext luc = new LookupOperationContext( null ); - LdifEntry le = null; try { luc.setDn( new Dn( componentDn ) ); Entry e = configPartition.lookup( luc ); - le = new LdifEntry( e ); + return e; } catch ( LdapException e ) { LOG.info( "Error while fetching component entry for component:" + component ); e.printStackTrace(); - } - return le; + return null; + } } @@ -275,12 +274,12 @@ public class ConfigurationManager * Gets the entries of component's instances on config partition. * * @param component ADSComponent reference to get its cached instance entries - * @return List of LdifEntry references representing cached instances. + * @return List of Entry references representing cached instances. */ - private List getCachedInstances( ADSComponent component ) + private List getCachedInstances( ADSComponent component ) { String componentInstancesDn = ADSComponentHelper.getComponentInstancesDn( component ); - List instances = new ArrayList(); + List instances = new ArrayList(); SearchEngine se = configPartition.getSearchEngine(); SchemaManager schemaManager = configPartition.getSchemaManager(); @@ -311,7 +310,7 @@ public class ConfigurationManager Entry entry = configPartition.lookup( forwardEntry.getId() ); - instances.add( new LdifEntry( entry ) ); + instances.add( entry ); } } catch ( Exception e ) Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java?rev=1225527&r1=1225526&r2=1225527&view=diff ============================================================================== --- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java (original) +++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/LdifConfigHelper.java Thu Dec 29 13:46:58 2011 @@ -107,14 +107,13 @@ public class LdifConfigHelper * @param entry LdifEntry reference to extract instance configuration * @return Extracted instance configuration */ - public static Properties instanceEntryToConfiguration( LdifEntry instanceEntry ) + public static Properties instanceEntryToConfiguration( Entry instanceEntry ) { - Entry entry = instanceEntry.getEntry(); Properties configuration = new Properties(); try { - String instanceName = entry.get( ADSSchemaConstants.ADS_COMPONENT_INSTANCE_ATTRIB_NAME ).getString(); + String instanceName = instanceEntry.get( ADSSchemaConstants.ADS_COMPONENT_INSTANCE_ATTRIB_NAME ).getString(); if ( instanceName == null ) { //Entry is not instance entry. @@ -123,7 +122,7 @@ public class LdifConfigHelper configuration.put( ADSConstants.ADS_COMPONENT_INSTANCE_PROP_NAME, instanceName ); - Collection attributes = entry.getAttributes(); + Collection attributes = instanceEntry.getAttributes(); for ( Attribute attribute : attributes ) { String attribName = attribute.getId();