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/05/15 13:03:50 UTC
svn commit: r1338641 -
/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java
Author: gokturk
Date: Tue May 15 11:03:50 2012
New Revision: 1338641
URL: http://svn.apache.org/viewvc?rev=1338641&view=rev
Log:
* Implemented immutable property change detection in ComponentHubImpl, to re-instantiate a component, when onw of its immutable property is changed while it is active.
Modified:
directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java
Modified: directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java?rev=1338641&r1=1338640&r2=1338641&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java (original)
+++ directory/apacheds/branches/apacheds-osgi/hub/core/src/main/java/org/apache/directory/server/hub/core/ComponentHubImpl.java Tue May 15 11:03:50 2012
@@ -240,8 +240,9 @@ public class ComponentHubImpl implements
public void updateComponent( DirectoryComponent component, DCConfiguration newConfiguration )
throws HubAbortException
{
- setInjectionProperties( metadatasReg.getMetadataDescriptor( component.getComponentManagerPID() ),
- newConfiguration );
+ DCMetadataDescriptor metadata = metadatasReg.getMetadataDescriptor( component.getComponentManagerPID() );
+
+ setInjectionProperties( metadata, newConfiguration );
if ( component.getRuntimeInfo() != null )
{
@@ -256,6 +257,38 @@ public class ComponentHubImpl implements
}
}
+ // Immutable property change handling
+ if ( component.getRuntimeInfo() != null )
+ {
+ for ( DCProperty prop : newConfiguration )
+ {
+ DCPropertyDescription pd = metadata.getPropertyDescription( prop.getName() );
+ if ( pd != null && pd.isImmutable() )
+ {
+ DCProperty oldProp = component.getConfiguration().getProperty( prop.getName() );
+ if ( oldProp != null && !( oldProp.getValue().equals( prop.getValue() ) ) )
+ {
+ // We're changing immutable property of live component
+ boolean wasDirty = component.isDirty();
+ component.setDirty( false );
+
+ try
+ {
+ removeComponent( component );
+ component.setDirty( wasDirty );
+ break;
+ }
+ catch ( HubAbortException e )
+ {
+ throw new HubAbortException(
+ "Reconfiguration of immutable property led to re-instantiation, which has been rejected by hub",
+ e );
+ }
+ }
+ }
+ }
+ }
+
if ( component.isDirty() )
{
try