You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by go...@apache.org on 2012/01/09 03:32:41 UTC

svn commit: r1229007 - in /directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component: hub/ utilities/

Author: gokturk
Date: Mon Jan  9 02:32:41 2012
New Revision: 1229007

URL: http://svn.apache.org/viewvc?rev=1229007&view=rev
Log:
* Entry creation is fixed to reflect the changes in ConfigurationManager and ComponentSchemaManager

Modified:
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSComponentHelper.java
    directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSSchemaConstants.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/ComponentManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java?rev=1229007&r1=1229006&r2=1229007&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java (original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/hub/ComponentManager.java Mon Jan  9 02:32:41 2012
@@ -223,7 +223,7 @@ public class ComponentManager
                     maxNumber = instanceNumber;
                 }
             }
-            catch ( NumberFormatException e )
+            catch ( Exception e )
             {
                 continue;
             }
@@ -243,7 +243,7 @@ public class ComponentManager
                     maxNumber = instanceNumber;
                 }
             }
-            catch ( NumberFormatException e )
+            catch ( Exception e )
             {
                 continue;
             }

Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSComponentHelper.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSComponentHelper.java?rev=1229007&r1=1229006&r2=1229007&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSComponentHelper.java (original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSComponentHelper.java Mon Jan  9 02:32:41 2012
@@ -52,13 +52,12 @@ public class ADSComponentHelper
      * Gets the version of the component. This version is the bundle version of the bundle that
      * contains specified component. 
      *
-     * @param componentFactory An IPojo Component Factory reference
+     * @param component An ADSComponent reference with its factory reference set.
      * @return version of an IPojo Component
      */
-    public static String getComponentVersion( Factory componentFactory )
+    public static String getComponentVersion( ADSComponent component )
     {
-        return ( String ) componentFactory.getBundleContext().getBundle().getHeaders().get( "Bundle-Version" );
-
+        return ( String ) component.getFactory().getBundleContext().getBundle().getHeaders().get( "Bundle-Version" );
     }
 
 

Modified: directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSSchemaConstants.java?rev=1229007&r1=1229006&r2=1229007&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSSchemaConstants.java (original)
+++ directory/apacheds/branches/apacheds-osgi/component-hub/src/main/java/org/apache/directory/server/component/utilities/ADSSchemaConstants.java Mon Jan  9 02:32:41 2012
@@ -60,8 +60,15 @@ public class ADSSchemaConstants
     public static final String ADS_COMPONENT_ATTRIB_PURGE_OID = "1.3.6.1.4.1.18060.0.4.4.0.1.4";
 
     /*
+     * Attribute name of component version
+     */
+    public static final String ADS_COMPONENT_ATTRIB_VERSION = "ads-instance";
+    public static final String ADS_COMPONENT_ATTRIB_VERSION_OID = "1.3.6.1.4.1.18060.0.4.4.0.1.5";
+
+    /*
      * Attribute name of component instance name
      */
     public static final String ADS_COMPONENT_INSTANCE_ATTRIB_NAME = "ads-instance";
-    public static final String ADS_COMPONENT_INSTANCE_ATTRIB_NAME_OID = "1.3.6.1.4.1.18060.0.4.4.0.1.5";
+    public static final String ADS_COMPONENT_INSTANCE_ATTRIB_NAME_OID = "1.3.6.1.4.1.18060.0.4.4.0.1.0";
+    
 }

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=1229007&r1=1229006&r2=1229007&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 Mon Jan  9 02:32:41 2012
@@ -27,6 +27,7 @@ import java.util.Properties;
 
 import org.apache.directory.server.component.ADSComponent;
 import org.apache.directory.server.component.instance.ADSComponentInstance;
+import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.model.entry.Attribute;
 import org.apache.directory.shared.ldap.model.entry.Entry;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValueException;
@@ -50,7 +51,7 @@ public class LdifConfigHelper
         ADSComponent parentComponent = instance.getParentComponent();
         Properties instanceConfiguration = instance.getInstanceConfiguration();
 
-        String instanceName = ( String ) instanceConfiguration.get(
+        String instanceName = ( String ) instanceConfiguration.remove(
             ADSConstants.ADS_COMPONENT_INSTANCE_PROP_NAME );
 
         if ( instanceName == null )
@@ -64,14 +65,12 @@ public class LdifConfigHelper
 
         List<String> attributes = new ArrayList<String>();
 
+        attributes.add( ADSSchemaConstants.ADS_COMPONENT_INSTANCE_ATTRIB_NAME + ":" + instanceName );
+        attributes.add( SchemaConstants.OBJECT_CLASS_AT + ":"
+            + ADSComponentHelper.getComponentObjectClass( parentComponent ) );
+
         for ( Object key : instanceConfiguration.keySet() )
         {
-            if ( key.equals( ADSConstants.ADS_COMPONENT_INSTANCE_PROP_NAME ) )
-            {
-                String dnAttrib = ADSSchemaConstants.ADS_COMPONENT_INSTANCE_ATTRIB_NAME + ":" + instanceName;
-                attributes.add( dnAttrib );
-            }
-
             String attribute = ( String ) key + ":" + ( String ) instanceConfiguration.get( key );
             attributes.add( attribute );
         }
@@ -115,6 +114,7 @@ public class LdifConfigHelper
         {
             String instanceName = instanceEntry.get( ADSSchemaConstants.ADS_COMPONENT_INSTANCE_ATTRIB_NAME )
                 .getString();
+
             if ( instanceName == null )
             {
                 //Entry is not instance entry.
@@ -127,13 +127,20 @@ public class LdifConfigHelper
             for ( Attribute attribute : attributes )
             {
                 String attribName = attribute.getId();
-                String attribVal = attribute.getString();
 
-                if ( attribName.equals( ADSSchemaConstants.ADS_COMPONENT_INSTANCE_ATTRIB_NAME ) )
+                if ( attribName.equals( ADSSchemaConstants.ADS_COMPONENT_INSTANCE_ATTRIB_NAME_OID ) ||
+                    attribName.equals( SchemaConstants.OBJECT_CLASS_AT_OID ) ||
+                    attribName.equals( SchemaConstants.ENTRY_PARENT_ID_OID ) ||
+                    attribName.equals( SchemaConstants.ENTRY_UUID_AT_OID ) ||
+                    attribName.equals( SchemaConstants.CREATE_TIMESTAMP_AT_OID ) ||
+                    attribName.equals( SchemaConstants.CREATORS_NAME_AT_OID ) ||
+                    attribName.equals( SchemaConstants.ENTRY_CSN_AT_OID ) )
                 {
                     continue;
                 }
 
+                String attribVal = attribute.getString();
+
                 configuration.put( attribName, attribVal );
             }