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<LdifEntry> instanceEntries = getCachedInstances( component );
+ List<Entry> instanceEntries = getCachedInstances( component );
if ( instanceEntries == null )
{
return;
}
List<CachedComponentInstance> cachedInstances = new ArrayList<CachedComponentInstance>();
- 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<LdifEntry> getCachedInstances( ADSComponent component )
+ private List<Entry> getCachedInstances( ADSComponent component )
{
String componentInstancesDn = ADSComponentHelper.getComponentInstancesDn( component
);
- List<LdifEntry> instances = new ArrayList<LdifEntry>();
+ List<Entry> instances = new ArrayList<Entry>();
SearchEngine<Entry, Long> 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<Attribute> attributes = entry.getAttributes();
+ Collection<Attribute> attributes = instanceEntry.getAttributes();
for ( Attribute attribute : attributes )
{
String attribName = attribute.getId();
|