Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2359 - in development/main/metro/composition: control/src/main/net/dpml/composition/control control/src/main/net/dpml/composition/models testing/unit/src/test/net/dpml/test/state

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2359 - in development/main/metro/composition: control/src/main/net/dpml/composition/control control/src/main/net/dpml/composition/models testing/unit/src/test/net/dpml/test/state
  • Date: Sat, 23 Apr 2005 00:30:50 -0400

Author: mcconnell AT dpml.net
Date: Sat Apr 23 00:30:46 2005
New Revision: 2359

Added:

development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java
- copied, changed from r2358,
development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/InstanceTable.java
- copied, changed from r2352,
development/main/metro/composition/control/src/main/net/dpml/composition/models/InstanceTable.java
Removed:

development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java

development/main/metro/composition/control/src/main/net/dpml/composition/models/InstanceTable.java
Modified:

development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextManagerInvocationHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/ManagerInvocationHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java

development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java

development/main/metro/composition/testing/unit/src/test/net/dpml/test/state/ManagementTestCase.java
Log:
Moved instance handling into the controller and out of the model.

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ApplianceInvocationHandler.java
Sat Apr 23 00:30:46 2005
@@ -25,7 +25,6 @@
import java.net.URI;

import net.dpml.parts.control.Disposable;
-import net.dpml.composition.models.Holder;

/**
* The ApplianceInvocationHandler class represents an instance of a
component.

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/CompositionController.java
Sat Apr 23 00:30:46 2005
@@ -47,8 +47,8 @@
import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.ValueDirective;
+
import net.dpml.composition.models.CompositionModel;
-import net.dpml.composition.models.Holder;
import net.dpml.composition.models.ValueModel;

import net.dpml.composition.management.ValueManager;
@@ -79,6 +79,8 @@
private final LifestyleHandler m_lifestyleHandler;
private final URI m_partition;

+ private final InstanceTable m_instances;
+
//--------------------------------------------------------------------
// constructor
//--------------------------------------------------------------------
@@ -92,6 +94,14 @@

m_lifestyleHandler = new LifestyleHandler( monitor );
m_lifecycleHandler = new LifecycleHandler( monitor, system );
+
+ m_instances = new InstanceTable( this );
+
+ }
+
+ public InstanceTable getInstanceTable()
+ {
+ return m_instances;
}

//--------------------------------------------------------------------

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextInvocationHandler.java
Sat Apr 23 00:30:46 2005
@@ -23,8 +23,9 @@

import net.dpml.parts.control.LifecycleException;
import net.dpml.parts.model.ModelException;
+
import net.dpml.composition.models.CompositionModel;
-import net.dpml.composition.models.Holder;
+
import net.dpml.system.SystemContext;

/**

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextManagerInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextManagerInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ContextManagerInvocationHandler.java
Sat Apr 23 00:30:46 2005
@@ -23,7 +23,7 @@

import net.dpml.parts.control.LifecycleException;
import net.dpml.parts.model.ModelException;
-import net.dpml.composition.models.Holder;
+
import net.dpml.system.SystemContext;

/**

Copied:
development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java
(from r2358,
development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java)
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/Holder.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/Holder.java
Sat Apr 23 00:30:46 2005
@@ -16,7 +16,7 @@
* limitations under the License.
*/

-package net.dpml.composition.models;
+package net.dpml.composition.control;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@@ -31,11 +31,13 @@
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

+import net.dpml.composition.models.CompositionModel;
+import net.dpml.composition.models.ContextTable;
+
import net.dpml.parts.control.Identifiable;
import net.dpml.parts.control.LifecycleException;
import net.dpml.parts.control.Monitor;

-import net.dpml.composition.control.CompositionController;
import net.dpml.parts.state.Manager;

/**
@@ -204,7 +206,7 @@
controller.etherialize( proxy );
}
m_proxies.clear();
- model.getInstanceTable().remove( this );
+ controller.getInstanceTable().remove( this );
controller.etherialize( m_instance );
}
}

Copied:
development/main/metro/composition/control/src/main/net/dpml/composition/control/InstanceTable.java
(from r2352,
development/main/metro/composition/control/src/main/net/dpml/composition/models/InstanceTable.java)
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/InstanceTable.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/InstanceTable.java
Sat Apr 23 00:30:46 2005
@@ -16,12 +16,14 @@
* limitations under the License.
*/

-package net.dpml.composition.models;
+package net.dpml.composition.control;

import java.io.Serializable;
import java.util.Map;
import java.util.WeakHashMap;

+import net.dpml.composition.models.CompositionModel;
+
/**
* The parts model is a model of the set of parts maintained by a parent
model.
*
@@ -30,21 +32,18 @@
*/
public class InstanceTable implements Serializable
{
+ private final CompositionController m_controller;
+
private final Map m_holders = new WeakHashMap();
- private final CompositionModel m_model;

/**
- * Creation of a new entry table.
+ * Creation of a new instance table.
*
- * @param model the model
- * @param parent the enclosing parent model
- * @param partition the enclosing component uri
- * @param classloader the classloader established as the parent for the
parts
- * @param profile the component profile from which initial default values
are established
+ * @param controller the controller
*/
- public InstanceTable( CompositionModel model )
+ public InstanceTable( CompositionController controller )
{
- m_model = model;
+ m_controller = controller;
}

public void add( Holder holder )
@@ -53,10 +52,10 @@
{
throw new NullPointerException( "holder" );
}
- m_holders.put( holder, m_model );
+ m_holders.put( holder, holder.getModel() );
}

- public Holder get( Object key )
+ public Holder get( CompositionModel model, Object key )
{
if( null == key )
{
@@ -68,7 +67,8 @@
for( int i=0; i<holders.length; i++ )
{
Holder holder = holders[i];
- if( key.equals( holder.getKey() ) )
+ CompositionModel m = holder.getModel();
+ if( key.equals( holder.getKey() ) && m.equals( model ) )
{
return holder;
}
@@ -82,14 +82,19 @@
return (Holder[]) m_holders.keySet().toArray( new Holder[0] );
}

- public void remove( Object key )
+ public void remove( Holder holder )
+ {
+ m_holders.remove( holder );
+ }
+
+ public void remove( CompositionModel model, Object key )
{
synchronized( m_holders )
{
- Holder holder = get( key );
+ Holder holder = get( model, key );
if( null != holder )
{
- m_holders.remove( holder );
+ remove( holder );
}
}
}
@@ -107,7 +112,7 @@
else
{
InstanceTable table = (InstanceTable) other;
- if( false == m_model.equals( table.m_model ) )
+ if( false == m_controller.equals( table.m_controller ) )
{
return false;
}
@@ -131,7 +136,7 @@

public int hashCode()
{
- int hash = m_model.hashCode();
+ int hash = m_controller.hashCode();
Holder[] holders = list();
for( int i=0; i<holders.length; i++ )
{

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifecycleHandler.java
Sat Apr 23 00:30:46 2005
@@ -37,7 +37,6 @@
import net.dpml.parts.state.Manager;

import net.dpml.composition.models.CompositionModel;
-import net.dpml.composition.models.Holder;

import net.dpml.composition.management.NullManager;
import net.dpml.composition.management.ValueManager;

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/LifestyleHandler.java
Sat Apr 23 00:30:46 2005
@@ -24,7 +24,6 @@
import net.dpml.parts.control.Monitor;

import net.dpml.composition.models.CompositionModel;
-import net.dpml.composition.models.Holder;

/**
* A lifestyle handler provides support for the aquisition and release
@@ -77,7 +76,7 @@
+ "].";
getMonitor().debug( message );
}
- model.getInstanceTable().add( holder );
+ model.getCompositionController().getInstanceTable().add(
holder );
return holder;
}
}
@@ -122,7 +121,7 @@
{
throw new NullPointerException( "key" );
}
- Holder holder = model.getInstanceTable().get( key );
+ Holder holder =
model.getCompositionController().getInstanceTable().get( model, key );
if( null == holder )
{
if( getMonitor().isDebugEnabled() )
@@ -142,7 +141,7 @@
+ "].";
getMonitor().debug( message );
}
- model.getInstanceTable().add( holder );
+ model.getCompositionController().getInstanceTable().add( holder
);
}
else
{
@@ -171,7 +170,7 @@
+ "].";
getMonitor().debug( message );
}
- model.getInstanceTable().remove( key );
+ model.getCompositionController().getInstanceTable().remove( model,
key );
}

private Monitor getMonitor()

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/ManagerInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/ManagerInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/ManagerInvocationHandler.java
Sat Apr 23 00:30:46 2005
@@ -29,8 +29,6 @@
import net.dpml.activity.Startable;
import net.dpml.activity.Disposable;

-import net.dpml.composition.models.Holder;
-
import net.dpml.composition.data.ValueDirective;

import net.dpml.composition.management.NullManager;

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/control/PartsInvocationHandler.java
Sat Apr 23 00:30:46 2005
@@ -28,8 +28,9 @@
import net.dpml.parts.control.Controller;
import net.dpml.parts.control.DelegationException;
import net.dpml.parts.model.Model;
+
import net.dpml.composition.models.CompositionModel;
-import net.dpml.composition.models.Holder;
+
import net.dpml.meta.info.PartDescriptor;

import net.dpml.parts.state.Manager;

Modified:
development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
==============================================================================
---
development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
(original)
+++
development/main/metro/composition/control/src/main/net/dpml/composition/models/CompositionModel.java
Sat Apr 23 00:30:46 2005
@@ -62,7 +62,6 @@
private final URI m_partition;
private final PartsTable m_parts;
private final ContextTable m_context;
- private final InstanceTable m_instances;
private final Class m_class;
private final Type m_type;
private final Class[] m_interfaces;
@@ -130,7 +129,6 @@

m_parts = new PartsTable( this );
m_context = new ContextTable( this, parent );
- m_instances = new InstanceTable( this );
m_type = controller.loadType( m_class );

//
@@ -358,11 +356,6 @@
return m_parts;
}

- public InstanceTable getInstanceTable()
- {
- return m_instances;
- }
-
private Class loadComponentClass( ClassLoader classloader,
ComponentProfile profile )
{
final String classname = profile.getClassname();

Modified:
development/main/metro/composition/testing/unit/src/test/net/dpml/test/state/ManagementTestCase.java
==============================================================================
---
development/main/metro/composition/testing/unit/src/test/net/dpml/test/state/ManagementTestCase.java
(original)
+++
development/main/metro/composition/testing/unit/src/test/net/dpml/test/state/ManagementTestCase.java
Sat Apr 23 00:30:46 2005
@@ -28,8 +28,6 @@

import net.dpml.parts.model.Model;

-import net.dpml.composition.models.Holder;
-
import net.dpml.composition.unit.CompositionHelper;

import net.dpml.parts.state.State;



  • svn commit: r2359 - in development/main/metro/composition: control/src/main/net/dpml/composition/control control/src/main/net/dpml/composition/models testing/unit/src/test/net/dpml/test/state, mcconnell, 04/22/2005

Archive powered by MHonArc 2.6.24.

Top of Page