Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2931 - in development/laboratory/users/niclas/osgi/metro: . activation/api/src/main/net/dpml/activation activation/impl activation/impl/src/main/net/dpml/activation/impl composition/api/src/main/net/dpml/composition/data composition/api/src/main/net/dpml/composition/event composition/api/src/main/net/dpml/composition/model composition/impl/src/main/net/dpml/composition/data/writer composition/impl/src/main/net/dpml/composition/model/impl composition/impl/src/test/net/dpml/composition/model/impl/fileset composition/spi/src/main/net/dpml/composition/data/writer composition/spi/src/main/net/dpml/composition/provider main osgi

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: niclas AT hedhman.org
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2931 - in development/laboratory/users/niclas/osgi/metro: . activation/api/src/main/net/dpml/activation activation/impl activation/impl/src/main/net/dpml/activation/impl composition/api/src/main/net/dpml/composition/data composition/api/src/main/net/dpml/composition/event composition/api/src/main/net/dpml/composition/model composition/impl/src/main/net/dpml/composition/data/writer composition/impl/src/main/net/dpml/composition/model/impl composition/impl/src/test/net/dpml/composition/model/impl/fileset composition/spi/src/main/net/dpml/composition/data/writer composition/spi/src/main/net/dpml/composition/provider main osgi
  • Date: Tue, 28 Jun 2005 08:36:25 -0400

Author: niclas AT hedhman.org
Date: Tue Jun 28 08:36:24 2005
New Revision: 2931

Removed:
development/laboratory/users/niclas/osgi/metro/osgi/
Modified:

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/ApplianceException.java

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/ApplianceRuntimeException.java

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifecycleException.java

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifecycleRuntimeException.java

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifestyleException.java

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifestyleRuntimeException.java

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/RuntimeFactory.java

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/RuntimeFactoryException.java

development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/TransientApplianceException.java
development/laboratory/users/niclas/osgi/metro/activation/impl/build.xml

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractAppliance.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractLifestyleManager.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ApplianceInvocationHandler.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/BlockInvocationHandler.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ContainerUtil.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultApplianceMetro.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultBlock.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultComponentFactory.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultLifestyleFactory.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntime.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntimeFactory.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultServiceManager.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultState.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/SingletonLifestyleManager.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ThreadLifestyleManager.java

development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/TransientLifestyleManager.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/BlockCompositionDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/BlockIncludeDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ClassLoaderDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ConstructorDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ContextDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/DependencyDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/EntryDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ExcludeDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/FilesetDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ImportDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/IncludeDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/LibraryDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/MetaDataException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/MetaDataRuntimeException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Mode.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/NamedComponentProfile.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Parameter.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ProfilePackage.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/SelectionDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ServiceDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/TargetDirective.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Targets.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/event/CompositionEvent.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/AssemblyException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ClassLoaderModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Commissionable.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CommissioningException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ComponentModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CompositionException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ContainmentModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ContextModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CyclicDependencyException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DependencyGraph.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DependencyModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DeploymentModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DuplicateNameException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/EntryModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FatalCommissioningException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FileSelector.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FilesetModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelRepository.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelRuntimeException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelSelector.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileDuplicateException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileSelector.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileUnknownException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProviderNotFoundException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Reclaimer.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Resolver.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceDuplicateException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceModel.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceRepository.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TransientRuntimeException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeDuplicateException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeRepository.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeRuntimeException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeUnknownException.java

development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/UnknownServiceException.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/SerializedContainmentProfileWriter.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLComponentProfileWriter.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLContainmentProfileWriter.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/CommissionRequest.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/Commissioner.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentContext.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionContext.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionController.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionCriteria.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultConstructorModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelExportHelper.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelNavigationHelper.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextMap.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependencyModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentContext.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultFileSelector.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultFilesetModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultImportModel.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelRepository.java

development/laboratory/users/niclas/osgi/metro/composition/impl/src/test/net/dpml/composition/model/impl/fileset/FilesetModelTestCase.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/data/writer/ContainmentProfileWriter.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ComponentContext.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionContext.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionCriteria.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionException.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionFactory.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionHelper.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionRuntimeException.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ContainmentContext.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/DeploymentContext.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/LifestyleFactory.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/LifestyleManager.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ModelFactory.java

development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/Runtime.java
development/laboratory/users/niclas/osgi/metro/index.xml
development/laboratory/users/niclas/osgi/metro/main/build.xml
Log:
Various formatting, removal of unused methods and variables, et cetera.

Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/ApplianceException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/ApplianceException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/ApplianceException.java
Tue Jun 28 08:36:24 2005
@@ -24,17 +24,14 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class ApplianceException
- extends Exception
+public class ApplianceException extends Exception
{
- private final Throwable m_cause;
-
/**
* Construct a new <code>ApplianceException</code> instance.
*
* @param message The detail message for this exception.
*/
- public ApplianceException( final String message )
+ public ApplianceException( String message )
{
this( message, null );
}
@@ -43,21 +40,11 @@
* Construct a new <code>ApplianceException</code> instance.
*
* @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public ApplianceException( final String message, final Throwable
throwable )
+ public ApplianceException( String message, Throwable cause )
{
super( message );
- m_cause = throwable;
- }
-
- /**
- * Return the exception that was the cause of this exception.
- * @return the causal exception
- */
- public Throwable getCause()
- {
- return m_cause;
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/ApplianceRuntimeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/ApplianceRuntimeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/ApplianceRuntimeException.java
Tue Jun 28 08:36:24 2005
@@ -24,40 +24,28 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class ApplianceRuntimeException
- extends RuntimeException
+public class ApplianceRuntimeException extends RuntimeException
{
- private final Throwable m_cause;
-
/**
* Construct a new <code>ApplianceRuntimeException</code> instance.
*
* @param message The detail message for this exception.
*/
- public ApplianceRuntimeException( final String message )
+ public ApplianceRuntimeException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ApplianceRuntimeException</code> instance.
*
* @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public ApplianceRuntimeException( final String message, final Throwable
throwable )
+ public ApplianceRuntimeException( String message, Throwable cause )
{
- super( message );
- m_cause = throwable;
+ super( message, cause );
}

- /**
- * Return the exception that was the cause of this exception.
- * @return the causal exception
- */
- public Throwable getCause()
- {
- return m_cause;
- }
}


Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifecycleException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifecycleException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifecycleException.java
Tue Jun 28 08:36:24 2005
@@ -24,16 +24,14 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class LifecycleException
- extends ApplianceException
+public class LifecycleException extends ApplianceException
{
-
/**
* Construct a new <code>LifecycleException</code> instance.
*
* @param message The detail message for this exception.
*/
- public LifecycleException( final String message )
+ public LifecycleException( String message )
{
this( message, null );
}
@@ -42,11 +40,11 @@
* Construct a new <code>LifecycleException</code> instance.
*
* @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public LifecycleException( final String message, final Throwable
throwable )
+ public LifecycleException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifecycleRuntimeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifecycleRuntimeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifecycleRuntimeException.java
Tue Jun 28 08:36:24 2005
@@ -24,16 +24,14 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class LifecycleRuntimeException
- extends ApplianceRuntimeException
+public class LifecycleRuntimeException extends ApplianceRuntimeException
{
-
/**
* Construct a new <code>LifecycleRuntimeException</code> instance.
*
* @param message The detail message for this exception.
*/
- public LifecycleRuntimeException( final String message )
+ public LifecycleRuntimeException( String message )
{
this( message, null );
}
@@ -42,11 +40,11 @@
* Construct a new <code>LifecycleRuntimeException</code> instance.
*
* @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public LifecycleRuntimeException( final String message, final Throwable
throwable )
+ public LifecycleRuntimeException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifestyleException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifestyleException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifestyleException.java
Tue Jun 28 08:36:24 2005
@@ -24,16 +24,14 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class LifestyleException
- extends ApplianceException
+public final class LifestyleException extends ApplianceException
{
-
/**
* Construct a new <code>LifestyleException</code> instance.
*
* @param message The detail message for this exception.
*/
- public LifestyleException( final String message )
+ public LifestyleException( String message )
{
this( message, null );
}
@@ -42,11 +40,11 @@
* Construct a new <code>LifestyleException</code> instance.
*
* @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public LifestyleException( final String message, final Throwable
throwable )
+ public LifestyleException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifestyleRuntimeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifestyleRuntimeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/LifestyleRuntimeException.java
Tue Jun 28 08:36:24 2005
@@ -24,16 +24,14 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class LifestyleRuntimeException
- extends ApplianceRuntimeException
+public final class LifestyleRuntimeException extends
ApplianceRuntimeException
{
-
/**
* Construct a new <code>LifestyleRuntimeException</code> instance.
*
* @param message The detail message for this exception.
*/
- public LifestyleRuntimeException( final String message )
+ public LifestyleRuntimeException( String message )
{
this( message, null );
}
@@ -42,11 +40,11 @@
* Construct a new <code>LifestyleRuntimeException</code> instance.
*
* @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public LifestyleRuntimeException( final String message, final Throwable
throwable )
+ public LifestyleRuntimeException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/RuntimeFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/RuntimeFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/RuntimeFactory.java
Tue Jun 28 08:36:24 2005
@@ -28,10 +28,10 @@
*/
public interface RuntimeFactory
{
- /**
- * Resolve a runtime handler for a model.
- * @param model the deployment model
- * @return the runtime appliance
- */
+ /**
+ * Resolve a runtime handler for a model.
+ * @param model the deployment model
+ * @return the runtime appliance
+ */
Appliance getRuntime( DeploymentModel model );
}

Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/RuntimeFactoryException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/RuntimeFactoryException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/RuntimeFactoryException.java
Tue Jun 28 08:36:24 2005
@@ -25,11 +25,8 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class RuntimeFactoryException
- extends Exception
+public class RuntimeFactoryException extends Exception
{
- private final Throwable m_cause;
-
/**
* Construct a new <code>RuntimeFactoryException</code> instance.
*
@@ -44,21 +41,11 @@
* Construct a new <code>RuntimeFactoryException</code> instance.
*
* @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public RuntimeFactoryException( final String message, final Throwable
throwable )
- {
- super( message );
- m_cause = throwable;
- }
-
- /**
- * Return the exception that was the cause of this exception.
- * @return the causal exception
- */
- public Throwable getCause()
+ public RuntimeFactoryException( final String message, final Throwable
cause )
{
- return m_cause;
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/TransientApplianceException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/TransientApplianceException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/api/src/main/net/dpml/activation/TransientApplianceException.java
Tue Jun 28 08:36:24 2005
@@ -33,7 +33,7 @@
*
* @param delay the expected dalay
*/
- public TransientApplianceException( final long delay )
+ public TransientApplianceException( long delay )
{
this( null, delay );
}

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/build.xml
==============================================================================
--- development/laboratory/users/niclas/osgi/metro/activation/impl/build.xml
(original)
+++ development/laboratory/users/niclas/osgi/metro/activation/impl/build.xml
Tue Jun 28 08:36:24 2005
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<project name="dpml-activation-impl" default="install" basedir="."
- xmlns:transit="antlib:net.dpml.transit"
xmlns:x="plugin:dpml/magic/dpml-magic-core" >
+<project
+ name="dpml-activation-impl"
+ default="install"
+ basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:x="plugin:dpml/magic/dpml-magic-core"
+>

<transit:import uri="artifact:template:dpml/magic/standard"/>

- <target name="init" depends="standard.init">
- <x:filter key="dpml-activation-impl" feature="plugin"
- token="METRO-RUNTIME-PROVIDER-SPEC"/>
- </target>
-
<target name="package" depends="standard.package">
<x:export class="net.dpml.activation.impl.DefaultRuntime"/>
</target>

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractAppliance.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractAppliance.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractAppliance.java
Tue Jun 28 08:36:24 2005
@@ -62,17 +62,18 @@
// Commissionable
//-------------------------------------------------------------------

- /**
- * Commission the appliance.
- *
- * @exception Exception if a commissioning error occurs
- */
- public abstract void commission() throws Exception;
-
- /**
- * Decommission the appliance. Once an appliance is
- * decommissioned it may be re-commissioned.
- */
+ /**
+ * Commission the appliance.
+ *
+ * @exception Exception if a commissioning error occurs
+ */
+ public abstract void commission()
+ throws Exception;
+
+ /**
+ * Decommission the appliance. Once an appliance is
+ * decommissioned it may be re-commissioned.
+ */
public abstract void decommission();

//-------------------------------------------------------------------
@@ -87,13 +88,14 @@
*/
public abstract Object resolve() throws Exception;

- /**
- * Request resolution of an object from the runtime.
- * @param proxy if TRUE the return value will be proxied if the
- * underlying component typoe suppports proxy representation
- * @exception Exception if a deployment error occurs
- */
- public abstract Object resolve( boolean proxy ) throws Exception;
+ /**
+ * Request resolution of an object from the runtime.
+ * @param proxy if TRUE the return value will be proxied if the
+ * underlying component typoe suppports proxy representation
+ * @exception Exception if a deployment error occurs
+ */
+ public abstract Object resolve( boolean proxy )
+ throws Exception;

/**
* Release an object

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractLifestyleManager.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractLifestyleManager.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/AbstractLifestyleManager.java
Tue Jun 28 08:36:24 2005
@@ -37,27 +37,17 @@
*/
public abstract class AbstractLifestyleManager implements LifestyleManager
{
- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------

private final ComponentModel m_model;
-
private final ComponentFactory m_factory;
-
private final Logger m_logger;
-
private final ReferenceQueue m_liberals = new ReferenceQueue();

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------
-
- /**
- * Creation of a new instance.
- * @param model the component model
- * @param factory the component factory
- */
+ /**
+ * Creation of a new instance.
+ * @param model the component model
+ * @param factory the component factory
+ */
public AbstractLifestyleManager( ComponentModel model, ComponentFactory
factory )
{
m_factory = factory;
@@ -65,34 +55,28 @@
m_logger = model.getLogger();
}

- //-------------------------------------------------------------------
- // Commissionable
- //-------------------------------------------------------------------
-
- /**
- * Commission the runtime handler.
- *
- * @exception Exception if a hanfdler commissioning error occurs
- */
- public abstract void commission() throws Exception;
+ /**
+ * Commission the runtime handler.
+ *
+ * @exception Exception if a hanfdler commissioning error occurs
+ */
+ public abstract void commission()
+ throws Exception;

- /**
- * Invokes the decommissioning phase. Once a handler is
- * decommissioned it may be re-commissioned.
- */
+ /**
+ * Invokes the decommissioning phase. Once a handler is
+ * decommissioned it may be re-commissioned.
+ */
public abstract void decommission();

- //-------------------------------------------------------------------
- // Resolver
- //-------------------------------------------------------------------
-
/**
* Resolve a object to a value.
*
* @return the resolved object
* @throws Exception if an error occurs
*/
- public Object resolve() throws Exception
+ public Object resolve()
+ throws Exception
{
return handleResolve();
}
@@ -103,7 +87,8 @@
* @return the resolved object
* @throws Exception if an error occurs
*/
- public Object resolve( boolean proxy ) throws Exception
+ public Object resolve( boolean proxy )
+ throws Exception
{
return resolve();
}
@@ -118,10 +103,6 @@
handleRelease( instance );
}

- //-------------------------------------------------------------------
- // LifecycleManager
- //-------------------------------------------------------------------
-
public void finalize( Object instance )
{
synchronized( m_factory )
@@ -133,10 +114,6 @@
}
}

- //-------------------------------------------------------------------
- // implementation
- //-------------------------------------------------------------------
-
protected abstract Object handleResolve() throws Exception;

protected abstract void handleRelease( Object instance );
@@ -198,11 +175,6 @@
}
}

-
- //-------------------------------------------------------------------
- // Object
- //-------------------------------------------------------------------
-
protected void finalize()
throws Throwable
{

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ApplianceInvocationHandler.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ApplianceInvocationHandler.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ApplianceInvocationHandler.java
Tue Jun 28 08:36:24 2005
@@ -39,7 +39,7 @@
* @version $Id: ApplianceInvocationHandler.java 2853 2005-06-14 05:43:13Z
niclas AT hedhman.org $
*/
public final class ApplianceInvocationHandler
- implements InvocationHandler, Reclaimer
+ implements InvocationHandler, Reclaimer
{
//-------------------------------------------------------------------
// immutable state
@@ -60,12 +60,12 @@
// constructor
//-------------------------------------------------------------------

- /**
- * Create a proxy invocation handler.
- *
- * @param appliance the runtime appliance
- * @param logger the assigned logging channel
- */
+ /**
+ * Create a proxy invocation handler.
+ *
+ * @param appliance the runtime appliance
+ * @param logger the assigned logging channel
+ */
ApplianceInvocationHandler( DefaultApplianceMetro appliance, Logger
logger )
throws NullArgumentException
{
@@ -81,18 +81,18 @@
// implementation
//-------------------------------------------------------------------

- /**
- * Invoke the specified method on underlying object.
- * This is called by the proxy object.
- *
- * @param proxy the proxy object
- * @param method the method invoked on proxy object
- * @param args the arguments supplied to method
- * @return the return value of method
- * @throws Throwable if an error occurs
- * @exception NullArgumentException if any one of the proxy or method
arguments
- * is null, or if the object instance has been destroyed
earlier.
- */
+ /**
+ * Invoke the specified method on underlying object.
+ * This is called by the proxy object.
+ *
+ * @param proxy the proxy object
+ * @param method the method invoked on proxy object
+ * @param args the arguments supplied to method
+ * @return the return value of method
+ * @throws Throwable if an error occurs
+ * @exception NullArgumentException if any one of the proxy or method
arguments
+ * is null, or if the object instance has been destroyed
earlier.
+ */
public Object invoke( final Object proxy, final Method method, final
Object[] args )
throws Throwable, NullArgumentException
{
@@ -158,7 +158,8 @@
return m_logger;
}

- private Object getInstance() throws Exception
+ private Object getInstance()
+ throws Exception
{
if( m_instance == null )
m_instance = m_appliance.resolve( false );

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/BlockInvocationHandler.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/BlockInvocationHandler.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/BlockInvocationHandler.java
Tue Jun 28 08:36:24 2005
@@ -43,13 +43,13 @@
private final DefaultBlock m_block;
private final Map m_providers = new Hashtable();

- /**
- * Create a proxy invocation handler.
- *
- * @param block the underlying block implementation
- */
- protected BlockInvocationHandler( final DefaultBlock block )
- throws Exception, NullArgumentException
+ /**
+ * Create a proxy invocation handler.
+ *
+ * @param block the underlying block implementation
+ */
+ protected BlockInvocationHandler( DefaultBlock block )
+ throws Exception, NullArgumentException
{
if( block == null )
{
@@ -59,16 +59,16 @@
m_block = block;
}

- /**
- * Invoke the specified method on underlying object.
- * This is called by the proxy object.
- *
- * @param proxy the proxy object
- * @param method the method invoked on proxy object
- * @param args the arguments supplied to method
- * @return the return value of method
- */
- public Object invoke( final Object proxy, final Method method, Object[]
args )
+ /**
+ * Invoke the specified method on underlying object.
+ * This is called by the proxy object.
+ *
+ * @param proxy the proxy object
+ * @param method the method invoked on proxy object
+ * @param args the arguments supplied to method
+ * @return the return value of method
+ */
+ public Object invoke( Object proxy, Method method, Object[] args )
throws Throwable, NullArgumentException
{
if( proxy == null )
@@ -81,16 +81,13 @@
throw new NullArgumentException( "method" );
}

- final ContainmentModel model = m_block.getContainmentModel();
+ ContainmentModel model = m_block.getContainmentModel();
Class source = method.getDeclaringClass();

ServiceModel service = model.getServiceModel( source );
if( null == service )
{
- final String error =
- "Unable to resolve an provider for the class ["
- + source.getName()
- + "].";
+ String error = "Unable to resolve an provider for the class [" +
source.getName() + "].";
throw new IllegalStateException( error );
}

@@ -114,8 +111,7 @@
{
throw cause;
}
- final String error =
- "Delegation error raised by: " + m_block;
+ String error = "Delegation error raised by: " + m_block;
throw new ApplianceException( error, e );
}
catch( InvocationTargetException e )
@@ -125,54 +121,55 @@
{
throw cause;
}
- final String error =
- "Delegation error raised by: " + m_block;
+ String error = "Delegation error raised by: " + m_block;
throw new ApplianceException( error, e );
}
catch( Throwable e )
{
- final String error =
- "Composite service resolution failure for the class: '"
- + method.getDeclaringClass()
- + "' for operation: '" + method.getName()
- + "' in appliance: " + m_block;
+ String error = "Composite service resolution failure for the
class: '" + method.getDeclaringClass()
+ + "' for operation: '" + method.getName() + "' in appliance:
" + m_block;
throw new ApplianceException( error, e );
}
}

- /**
- * Locate a service reference and cache it locally for the
- * lifetime of the invocation handler.
- *
- * @param provider the deployment model
- * @return a cached service reference
- * @exception Exception if something unexpected happens
- */
- private Object locateServiceInstance( DeploymentModel provider ) throws
Exception
+ /**
+ * Locate a service reference and cache it locally for the
+ * lifetime of the invocation handler.
+ *
+ * @param provider the deployment model
+ * @return a cached service reference
+ * @exception Exception if something unexpected happens
+ */
+ private Object locateServiceInstance( DeploymentModel provider )
+ throws Exception
{
Object source = m_providers.get( provider );
- if( null != source ) return source;
+ if( null != source )
+ {
+ return source;
+ }
Object object = provider.resolve();
m_providers.put( provider, object );
return object;
}

- /**
- * Finalization of the invocation handler during which
- * we release any cached service references.
- *
- * @exception Throwable if an error occurs
- */
- protected void finalize() throws Throwable
+ /**
+ * Finalization of the invocation handler during which
+ * we release any cached service references.
+ *
+ * @exception Throwable if an error occurs
+ */
+ protected void finalize()
+ throws Throwable
{
Object[] objects = m_providers.values().toArray();
for( int i=0; i<objects.length; i++ )
{
Object instance = objects[i];
- if( Proxy.isProxyClass( instance.getClass() ) )
+ boolean isProxy = Proxy.isProxyClass( instance.getClass() );
+ if( isProxy )
{
- InvocationHandler handler =
- Proxy.getInvocationHandler( instance );
+ InvocationHandler handler = Proxy.getInvocationHandler(
instance );
if( handler instanceof Reclaimer )
{
Reclaimer source = (Reclaimer) handler;

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ContainerUtil.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ContainerUtil.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ContainerUtil.java
Tue Jun 28 08:36:24 2005
@@ -58,7 +58,7 @@
* @param object the object to shutdown
* @throws Exception if there is a problem stoppping object
*/
- public static void shutdown( final Object object )
+ public static void shutdown( Object object )
throws Exception
{
stop( object );
@@ -74,7 +74,7 @@
* in which case the specified object must not implement
LogEnabled.
* @throws IllegalArgumentException if the object is LogEnabled but
Logger is null
*/
- public static void enableLogging( final Object object, final Logger
logger )
+ public static void enableLogging( Object object, Logger logger )
{
if( object instanceof LogEnabled )
{
@@ -99,8 +99,7 @@
* @throws IllegalArgumentException if the object is Contextualizable but
* context is null
*/
- public static void contextualize( final Object object,
- final Context context )
+ public static void contextualize( Object object, Context context )
throws ContextException
{
if( object instanceof Contextualizable )
@@ -110,7 +109,8 @@
final String message = "context is null";
throw new IllegalArgumentException( message );
}
- ( (Contextualizable)object ).contextualize( context );
+ Contextualizable contextualizable = (Contextualizable) object;
+ contextualizable.contextualize( context );
}
}

@@ -126,18 +126,18 @@
* @throws IllegalArgumentException if the object is Servicable but
* ServiceManager is null
*/
- public static void service( final Object object,
- final ServiceManager serviceManager )
+ public static void service( Object object, ServiceManager serviceManager
)
throws ServiceException
{
if( object instanceof Serviceable )
{
if( null == serviceManager )
{
- final String message = "ServiceManager is null";
+ String message = "ServiceManager is null";
throw new IllegalArgumentException( message );
}
- ( (Serviceable)object ).service( serviceManager );
+ Serviceable serviceable = (Serviceable) object;
+ serviceable.service( serviceManager );
}
}

@@ -154,8 +154,7 @@
* @throws IllegalArgumentException if the object is Configurable but
* Configuration is null
*/
- public static void configure( final Object object,
- final Configuration configuration )
+ public static void configure( Object object, Configuration configuration
)
throws ConfigurationException
{
if( object instanceof Configurable )
@@ -165,7 +164,8 @@
final String message = "configuration is null";
throw new IllegalArgumentException( message );
}
- ( (Configurable)object ).configure( configuration );
+ Configurable configurable = (Configurable)object;
+ configurable.configure( configuration );
}
}

@@ -181,8 +181,7 @@
* @throws IllegalArgumentException if the object is Parameterizable but
* parameters is null
*/
- public static void parameterize( final Object object,
- final Parameters parameters )
+ public static void parameterize( Object object, Parameters parameters )
throws ParameterException
{
if( object instanceof Parameterizable )
@@ -192,7 +191,8 @@
final String message = "parameters is null";
throw new IllegalArgumentException( message );
}
- ( (Parameterizable)object ).parameterize( parameters );
+ Parameterizable parameterizable = (Parameterizable)object;
+ parameterizable.parameterize( parameters );
}
}

@@ -203,12 +203,13 @@
* @param object the object to Initialize
* @throws Exception if there is a problem Initializing object
*/
- public static void initialize( final Object object )
+ public static void initialize( Object object )
throws Exception
{
if( object instanceof Initializable )
{
- ( (Initializable) object ).initialize();
+ Initializable initializable = (Initializable) object;
+ initializable.initialize();
}
}

@@ -224,7 +225,8 @@
{
if( object instanceof Startable )
{
- ( (Startable)object ).start();
+ Startable startable = (Startable) object;
+ startable.start();
}
}

@@ -240,7 +242,8 @@
{
if( object instanceof Startable )
{
- ( (Startable)object ).stop();
+ Startable startable = (Startable) object;
+ startable.stop();
}
}

@@ -254,7 +257,8 @@
{
if( object instanceof Disposable )
{
- ( (Disposable)object ).dispose();
+ Disposable disposable = (Disposable) object;
+ disposable.dispose();
}
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultApplianceMetro.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultApplianceMetro.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultApplianceMetro.java
Tue Jun 28 08:36:24 2005
@@ -28,6 +28,7 @@
import net.dpml.logging.Logger;

import java.lang.reflect.Proxy;
+import java.lang.reflect.InvocationHandler;

/**
* Abstract appliance.
@@ -40,9 +41,7 @@
// static
//-------------------------------------------------------------------

- private static final Resources REZ =
- ResourceManager.getPackageResources(
- DefaultApplianceMetro.class );
+ private static final Resources REZ =
ResourceManager.getPackageResources( DefaultApplianceMetro.class );

//-------------------------------------------------------------------
// immutable state
@@ -71,12 +70,13 @@
// Commissionable
//-------------------------------------------------------------------

- /**
- * Commission the appliance.
- *
- * @exception Exception if a commissioning error occurs
- */
- public void commission() throws Exception
+ /**
+ * Commission the appliance.
+ *
+ * @exception Exception if a commissioning error occurs
+ */
+ public void commission()
+ throws Exception
{
synchronized( m_commissioned )
{
@@ -121,30 +121,25 @@
* @return the resolved object
* @throws Exception if an error occurs
*/
- public Object resolve() throws Exception
+ public Object resolve()
+ throws Exception
{
return resolve( getComponentModel().getProxyPolicy() );
}

- public Object resolve( boolean proxy ) throws Exception
+ public Object resolve( boolean proxy )
+ throws Exception
{
if( !proxy )
{
if( m_delay > 0 )
{
- final String error =
- REZ.getString(
- "appliance.error.resolve.transient",
- this.toString(),
- "" + m_delay );
+ String error = REZ.getString(
"appliance.error.resolve.transient", this.toString(), String.valueOf( m_delay
) );
throw new TransientRuntimeException( error, m_delay );
}
else if( !m_commissioned.isEnabled() )
{
- final String error =
- REZ.getString(
- "appliance.error.resolve.non-commission-state",
- this.toString() );
+ String error = REZ.getString(
"appliance.error.resolve.non-commission-state", this.toString() );
throw new IllegalStateException( error );
}
else
@@ -160,15 +155,14 @@

try
{
- return Proxy.newProxyInstance(
- model.getDeploymentClass().getClassLoader(),
- model.getInterfaces(),
- handler );
+ Class[] interfaces = model.getInterfaces();
+ Class deploymentClass = model.getDeploymentClass();
+ ClassLoader classLoader = deploymentClass.getClassLoader();
+ return Proxy.newProxyInstance( classLoader, interfaces,
handler );
}
catch( Throwable e )
{
- final String error =
- "Proxy establishment failure in appliance: " + this;
+ String error = "Proxy establishment failure in appliance: "
+ this;
throw new ApplianceException( error, e );
}
}
@@ -181,12 +175,19 @@
*/
public void release( Object instance )
{
- if( null == instance ) return;
- if( !m_commissioned.isEnabled() ) return;
- if( Proxy.isProxyClass( instance.getClass() ) )
+ if( null == instance )
+ {
+ return;
+ }
+ if( m_commissioned.isEnabled() == false )
+ {
+ return;
+ }
+ boolean isProxy = Proxy.isProxyClass( instance.getClass() );
+ if( isProxy )
{
- ApplianceInvocationHandler handler =
- (ApplianceInvocationHandler) Proxy.getInvocationHandler(
instance );
+ InvocationHandler proxy = Proxy.getInvocationHandler( instance );
+ ApplianceInvocationHandler handler =
(ApplianceInvocationHandler) proxy;
handler.release();
}
else

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultBlock.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultBlock.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultBlock.java
Tue Jun 28 08:36:24 2005
@@ -21,6 +21,7 @@
import net.dpml.activation.ApplianceRuntimeException;
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.ServiceModel;
+import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

@@ -38,9 +39,7 @@
// static
//-------------------------------------------------------------------

- private static final Resources REZ =
- ResourceManager.getPackageResources(
- DefaultBlock.class );
+ private static final Resources REZ =
ResourceManager.getPackageResources( DefaultBlock.class );

//-------------------------------------------------------------------
// immutable state
@@ -61,10 +60,9 @@
//-------------------------------------------------------------------

public DefaultBlock( ContainmentModel model )
- throws ApplianceRuntimeException
+ throws ApplianceRuntimeException
{
super( model );
-
m_model = model;
}

@@ -72,47 +70,47 @@
// Commissionable
//-------------------------------------------------------------------

- /**
- * Commission the appliance.
- *
- * @exception Exception if a commissioning error occurs
- */
- public void commission() throws Exception
+ /**
+ * Commission the appliance.
+ *
+ * @exception Exception if a commissioning error occurs
+ */
+ public void commission()
+ throws Exception
{
synchronized( m_commissioned )
{
if( m_commissioned.isEnabled() ) return;
try
{
- final BlockInvocationHandler handler =
- new BlockInvocationHandler( this );
- final Class[] classes = getInterfaceClasses();
-
- m_proxy = Proxy.newProxyInstance(
- m_model.getClassLoaderModel().getClassLoader(),
- classes,
- handler );
+ BlockInvocationHandler handler = new BlockInvocationHandler(
this );

+ Class[] interfaces = getInterfaceClasses();
+ ClassLoaderModel classLoaderModel =
m_model.getClassLoaderModel();
+ ClassLoader classLoader = classLoaderModel.getClassLoader();
+ m_proxy = Proxy.newProxyInstance( classLoader, interfaces,
handler );
m_commissioned.setEnabled( true );
}
catch( Throwable e )
{
- final String error =
- "Composite service establishment failure in block: " +
this;
+ String error = "Composite service establishment failure in
block: " + this;
throw new ApplianceRuntimeException( error, e );
}
}
}

- /**
- * Decommission the appliance. Once an appliance is
- * decommissioned it may be re-commissioned.
- */
+ /**
+ * Decommission the appliance. Once an appliance is
+ * decommissioned it may be re-commissioned.
+ */
public void decommission()
{
synchronized( m_commissioned )
{
- if( !m_commissioned.isEnabled() ) return;
+ if( m_commissioned.isEnabled() == false )
+ {
+ return;
+ }
if( null != m_proxy )
{
m_proxy = null;
@@ -133,12 +131,9 @@
*/
public Object resolve() throws Exception
{
- if( !m_commissioned.isEnabled() )
+ if( m_commissioned.isEnabled() == false )
{
- final String error =
- REZ.getString(
- "block.error.resolve.non-commission-state",
- this.toString() );
+ String error = REZ.getString(
"block.error.resolve.non-commission-state", this.toString() );
throw new IllegalStateException( error );
}
return m_proxy;
@@ -178,17 +173,21 @@
return m_model;
}

- private Class[] getInterfaceClasses() throws Exception
+ private Class[] getInterfaceClasses()
+ throws Exception
{
ContainmentModel model = getContainmentModel();
ArrayList list = new ArrayList();
ServiceModel[] services = model.getServiceModels();
- for( int i=0; i<services.length; i++ )
+ for( int i = 0; i < services.length; i++ )
{
- final ServiceModel service = services[i];
- list.add( service.getServiceClass() );
+ ServiceModel service = services[i];
+ Class serviceClass = service.getServiceClass();
+ list.add( serviceClass );
}
- return (Class[]) list.toArray( new Class[0] );
+ Class[] result = new Class[ list.size() ];
+ list.toArray( result );
+ return result;
}

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

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultComponentFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultComponentFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultComponentFactory.java
Tue Jun 28 08:36:24 2005
@@ -27,8 +27,10 @@
import net.dpml.composition.model.ContextModel;
import net.dpml.configuration.Configurable;
import net.dpml.configuration.Configuration;
+import net.dpml.configuration.ConfigurationException;
import net.dpml.context.Context;
import net.dpml.context.Contextualizable;
+import net.dpml.context.ContextException;
import net.dpml.context.impl.DefaultContext;
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
@@ -37,11 +39,14 @@
import net.dpml.logging.Logger;
import net.dpml.parameters.Parameterizable;
import net.dpml.parameters.Parameters;
+import net.dpml.parameters.ParameterException;
import net.dpml.service.ServiceManager;
import net.dpml.service.Serviceable;
+import net.dpml.service.ServiceException;
import org.osgi.framework.BundleContext;

import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.util.Map;


@@ -74,10 +79,10 @@
// constructor
//-------------------------------------------------------------------

- /**
- * Creation of a new component factory.
- * @param model the component model
- */
+ /**
+ * Creation of a new component factory.
+ * @param model the component model
+ */
public DefaultComponentFactory( ComponentModel model, BundleContext osgi
)
{
m_model = model;
@@ -89,16 +94,16 @@
// ComponentFactory
//-------------------------------------------------------------------

- /**
- * Creation of a new instance including all deployment stage handling.
- * @return the new incarnated instance
- */
- public Object incarnate() throws LifecycleException
+ /**
+ * Creation of a new instance including all deployment stage handling.
+ * @return the new incarnated instance
+ */
+ public Object incarnate()
+ throws LifecycleException
{
if( getLogger().isDebugEnabled() )
{
- final String message =
- "incarnation";
+ final String message = "incarnation";
getLogger().debug( message );
}

@@ -122,10 +127,10 @@
}
}

- /**
- * Termination of the instance including all end-of-life processing.
- * @param instance the component instance to etherialize
- */
+ /**
+ * Termination of the instance including all end-of-life processing.
+ * @param instance the component instance to etherialize
+ */
public void etherialize( final Object instance )
{
getLogger().debug( "etherialization" );
@@ -137,7 +142,12 @@
{
ContainerUtil.stop( instance );
}
- catch( Throwable e )
+ catch( RuntimeException e )
+ {
+ final String warning = "Ignoring component source shutdown
error.";
+ getLogger().warn( warning, e );
+ }
+ catch( Exception e )
{
final String warning = "Ignoring component source shutdown
error.";
getLogger().warn( warning, e );
@@ -172,10 +182,10 @@
// private implementation
//-------------------------------------------------------------------

- /**
- * Creation of a new instance including all deployment stage handling.
- * @return the new instance
- */
+ /**
+ * Creation of a new instance including all deployment stage handling.
+ * @return the new instance
+ */
private Object incarnation() throws LifecycleException
{
Class clazz = m_model.getDeploymentClass();
@@ -186,9 +196,7 @@
final Object context = getTargetContext();
final Class contextClass = getContextCastingClass();

- final Object instance =
- instantiate(
- clazz, logger, config, params, context, contextClass, manager );
+ final Object instance = instantiate( clazz, logger, config, params,
context, contextClass, manager );

try
{
@@ -239,22 +247,45 @@
getLogger().debug( "component startup completed" );
}
}
- catch( Throwable e )
+ catch( ConfigurationException e )
+ {
+ String error = REZ.getString( "lifestyle.error.new",
m_model.getQualifiedName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( ServiceException e )
+ {
+ String error = REZ.getString( "lifestyle.error.new",
m_model.getQualifiedName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( ParameterException e )
+ {
+ String error = REZ.getString( "lifestyle.error.new",
m_model.getQualifiedName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( ContextException e )
+ {
+ String error = REZ.getString( "lifestyle.error.new",
m_model.getQualifiedName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( RuntimeException e )
{
- final String error =
- REZ.getString(
- "lifestyle.error.new",
- m_model.getQualifiedName() );
- throw new LifecycleException( error, e );
+ String error = REZ.getString( "lifestyle.error.new",
m_model.getQualifiedName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( Exception e )
+ {
+ String error = REZ.getString( "lifestyle.error.new",
m_model.getQualifiedName() );
+ throw new LifecycleException( error, e );
}

return instance;
}

private Class getContextCastingClass()
- throws LifecycleException
+ throws LifecycleException
{
- String casting = m_model.getContextModel().getCastingClassname();
+ ContextModel contextModel = m_model.getContextModel();
+ String casting = contextModel.getCastingClassname();

if( null == casting )
{
@@ -264,28 +295,33 @@
{
try
{
- return
m_model.getDeploymentClass().getClassLoader().loadClass( casting );
+ Class deploymentClass = m_model.getDeploymentClass();
+ ClassLoader classLoader = deploymentClass.getClassLoader();
+ return classLoader.loadClass( casting );
}
- catch( Throwable e )
+ catch( ClassNotFoundException e )
+ {
+ String error = "Could not load the custom context casting
class [" + casting + "].";
+ throw new LifecycleException( error, e );
+ }
+ catch( RuntimeException e )
{
- final String error =
- "Could not load the custom context casting class ["
- + casting
- + "].";
+ String error = "Could not load the custom context casting
class [" + casting + "].";
throw new LifecycleException( error, e );
}
}
}

private Object getTargetContext()
- throws LifecycleException
+ throws LifecycleException
{
ContextModel model = m_model.getContextModel();
Class impl = getContextImplementationClass( model );
return createComponentContext( impl, model.getContextMap() );
}

- private Class getContextImplementationClass( ContextModel model ) throws
LifecycleException
+ private Class getContextImplementationClass( ContextModel model )
+ throws LifecycleException
{
String classname = model.getImplementationClassname();

@@ -297,29 +333,33 @@
{
try
{
- return
m_model.getDeploymentClass().getClassLoader().loadClass( classname );
+ Class deploymentClass = m_model.getDeploymentClass();
+ ClassLoader classLoader = deploymentClass.getClassLoader();
+ return classLoader.loadClass( classname );
}
- catch( Throwable e )
+ catch( ClassNotFoundException e )
{
- final String error =
- "Could not load the custom context implementation class ["
- + classname
- + "].";
+ String error = "Could not load the custom context
implementation class [" + classname + "].";
+ throw new LifecycleException( error, e );
+ }
+ catch( RuntimeException e )
+ {
+ String error = "Could not load the custom context
implementation class [" + classname + "].";
throw new LifecycleException( error, e );
}
}
}

- /**
- * Creates a component context instance.
- *
- * @return the context object compliant with the context casting
- * constraints declared by the component type
- * @exception LifecycleException if an error occurs while attempting to
- * construct the context instance
- */
+ /**
+ * Creates a component context instance.
+ *
+ * @return the context object compliant with the context casting
+ * constraints declared by the component type
+ * @exception LifecycleException if an error occurs while attempting to
+ * construct the context instance
+ */
private Object createComponentContext( Class clazz, Map map )
- throws LifecycleException
+ throws LifecycleException
{
//
// its a custom context object so we need to create it
@@ -329,28 +369,50 @@

try
{
- Constructor constructor = clazz.getConstructor(
- new Class[]{ Map.class } );
+ Class[] parameterTypes = new Class[]{ Map.class };
+ Constructor constructor = clazz.getConstructor( parameterTypes );
return constructor.newInstance( new Object[]{ map } );
}
catch( NoSuchMethodException e )
{
- final String error =
- REZ.getString( "context.non-compliance-constructor.error",
clazz.getName() );
+ String error = REZ.getString(
"context.non-compliance-constructor.error", clazz.getName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( InstantiationException e )
+ {
+ String error = REZ.getString( "context.custom-unexpected.error",
clazz.getName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( IllegalAccessException e )
+ {
+ String error = REZ.getString( "context.custom-unexpected.error",
clazz.getName() );
throw new LifecycleException( error, e );
}
- catch( Throwable e )
+ catch( InvocationTargetException e )
{
- final String error =
- REZ.getString( "context.custom-unexpected.error",
clazz.getName() );
+ String error = REZ.getString( "context.custom-unexpected.error",
clazz.getName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( IllegalArgumentException e )
+ {
+ String error = REZ.getString( "context.custom-unexpected.error",
clazz.getName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( SecurityException e )
+ {
+ String error = REZ.getString( "context.custom-unexpected.error",
clazz.getName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( RuntimeException e )
+ {
+ String error = REZ.getString( "context.custom-unexpected.error",
clazz.getName() );
throw new LifecycleException( error, e );
}
}


- private Object instantiate(
- Class clazz, Logger logger, Configuration config, Parameters
params,
- Object context, Class contextClass, ServiceManager manager )
+ private Object instantiate( Class clazz, Logger logger, Configuration
config, Parameters params,
+ Object context, Class contextClass,
ServiceManager manager )
throws LifecycleException, NullArgumentException
{
Constructor constructor = getConstructor( clazz );
@@ -402,11 +464,7 @@
}
else
{
- final String error =
- REZ.getString(
- "lifecycle.error.unrecognized-parameter",
- c.getName(),
- clazz.getName() );
+ String error = REZ.getString(
"lifecycle.error.unrecognized-parameter", c.getName(), clazz.getName() );
throw new LifecycleException( error );
}
}
@@ -418,27 +476,23 @@
return instantiateComponent( constructor, args );
}

- private Constructor getConstructor( Class clazz ) throws
LifecycleException
+ private Constructor getConstructor( Class clazz )
+ throws LifecycleException
{
Constructor[] constructors = clazz.getConstructors();
if( constructors.length < 1 )
{
- final String error =
- REZ.getString(
- "lifecycle.error.no-constructor",
- clazz.getName() );
+ String error = REZ.getString( "lifecycle.error.no-constructor",
clazz.getName() );
throw new LifecycleException( error );
}

if( constructors.length > 1 )
{
- final String error =
- "Multiple constructor ambiguity in the component model "
- + m_model
- + ". The component class [" + clazz.getName()
- + "] declares "
- + constructors.length
- + " public constructors.";
+ String error = "Multiple constructor ambiguity in the component
model " + m_model
+ + ". The component class [" + clazz.getName()
+ + "] declares "
+ + constructors.length
+ + " public constructors.";
throw new LifecycleException( error );
}
else
@@ -447,73 +501,61 @@
}
}

- /**
- * Instantiation of a component instance using a supplied constructor
- * and arguments.
- *
- * @param constructor the component constructor
- * @param args the constructor arguments
- * @return the component instance
- * @exception LifecycleException if an instantiation error occurs
- */
- private Object instantiateComponent(
- final Constructor constructor, final Object[] args )
- throws LifecycleException
+ /**
+ * Instantiation of a component instance using a supplied constructor
+ * and arguments.
+ *
+ * @param constructor the component constructor
+ * @param args the constructor arguments
+ * @return the component instance
+ * @exception LifecycleException if an instantiation error occurs
+ */
+ private Object instantiateComponent( Constructor constructor, Object[]
args )
+ throws LifecycleException
{
try
{
if( args.length == 0 )
{
- getLogger().debug(
- "instantiating component with a null constructor" );
+ getLogger().debug( "instantiating component with a null
constructor" );
}
else
{
int n = args.length;
- getLogger().debug(
- "instantiating component with "
- + n + " arguments." );
+ getLogger().debug( "instantiating component with " + n + "
arguments." );
}

return constructor.newInstance( args );
}
- catch( Throwable e )
+ catch( InstantiationException e )
{
Class clazz = constructor.getDeclaringClass();
- final String error =
- REZ.getString(
- "lifecycle.error.instantiation",
- clazz.getName() );
+ String error = REZ.getString( "lifecycle.error.instantiation",
clazz.getName() );
throw new LifecycleException( error, e );
}
- }
-
- private void applyContext( final Object instance, final Object context )
- throws LifecycleException
- {
- if( null == context ) return;
-
- final ContextModel model = m_model.getContextModel();
- getLogger().debug( "applying context" );
- if( context instanceof Context )
+ catch( IllegalAccessException e )
{
- try
- {
- ContainerUtil.contextualize( instance, (Context) context );
- }
- catch( Throwable e )
- {
- final String error = REZ.getString(
"lifecycle.error.metro-contextualization", m_model.getQualifiedName() );
- throw new LifecycleException( error, e );
- }
+ Class clazz = constructor.getDeclaringClass();
+ String error = REZ.getString( "lifecycle.error.instantiation",
clazz.getName() );
+ throw new LifecycleException( error, e );
}
- else
+ catch( InvocationTargetException e )
{
- final String error =
- "Supplied context class ["
- + context.getClass().getName()
- + "] does not implement the Context interface.";
- throw new LifecycleException( error );
+ Class clazz = constructor.getDeclaringClass();
+ String error = REZ.getString( "lifecycle.error.instantiation",
clazz.getName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( IllegalArgumentException e )
+ {
+ Class clazz = constructor.getDeclaringClass();
+ String error = REZ.getString( "lifecycle.error.instantiation",
clazz.getName() );
+ throw new LifecycleException( error, e );
+ }
+ catch( RuntimeException e )
+ {
+ Class clazz = constructor.getDeclaringClass();
+ String error = REZ.getString( "lifecycle.error.instantiation",
clazz.getName() );
+ throw new LifecycleException( error, e );
}
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultLifestyleFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultLifestyleFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultLifestyleFactory.java
Tue Jun 28 08:36:24 2005
@@ -36,30 +36,21 @@
*/
public class DefaultLifestyleFactory implements LifestyleFactory
{
-
private BundleContext m_OsgiContext;
- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------

- /**
- * Creation of a new default lifestyle factory.
- */
+ /**
+ * Creation of a new default lifestyle factory.
+ */
public DefaultLifestyleFactory( BundleContext osgi )
{
m_OsgiContext = osgi;
}

- //-------------------------------------------------------------------
- // LifestyleFactory
- //-------------------------------------------------------------------
-
-
- /**
- * Create a new lifestyle manager.
- * @param model the component model
- * @return the lifestyle manager
- */
+ /**
+ * Create a new lifestyle manager.
+ * @param model the component model
+ * @return the lifestyle manager
+ */
public LifestyleManager createLifestyleManager( ComponentModel model )
{
ComponentFactory factory = createComponentFactory( model );
@@ -81,8 +72,7 @@
}
else
{
- final String error =
- "Unsupported lifestyle [" + lifestyle + "].";
+ String error = "Unsupported lifestyle [" + lifestyle + "].";
throw new IllegalArgumentException( error );
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntime.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntime.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntime.java
Tue Jun 28 08:36:24 2005
@@ -19,18 +19,13 @@
package net.dpml.activation.impl;

import net.dpml.activation.Appliance;
-import net.dpml.activation.LifestyleRuntimeException;
import net.dpml.activation.RuntimeFactory;
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.DeploymentModel;
import net.dpml.composition.provider.Runtime;
import net.dpml.lang.NullArgumentException;
-import net.dpml.transit.artifact.Artifact;
-import net.dpml.transit.repository.Repository;
-import net.dpml.transit.repository.StandardLoader;
+import org.osgi.framework.BundleContext;

-import java.net.URI;
-import java.net.URISyntaxException;
import java.util.Hashtable;
import java.util.Map;

@@ -42,108 +37,90 @@
*/
public class DefaultRuntime implements Runtime
{
- //--------------------------------------------------------------
- // static
- //--------------------------------------------------------------
-
- private static final String METRO_RUNTIME =
"@METRO-RUNTIME-PROVIDER-SPEC@";
-
- //--------------------------------------------------------------
- // immutable state
- //--------------------------------------------------------------
-
private final BlockFactory m_factory;
+ private final RuntimeFactory m_metro;

- //--------------------------------------------------------------
- // mutable state
- //--------------------------------------------------------------
-
- private RuntimeFactory m_metro;
-
- //--------------------------------------------------------------
- // constructor
- //--------------------------------------------------------------
-
- /**
- * Creation of a new system context.
- *
- * @exception NullArgumentException if the system argument is null.
- */
- public DefaultRuntime()
+ /**
+ * Creation of a new system context.
+ *
+ * @exception NullArgumentException if the system argument is null.
+ */
+ public DefaultRuntime( BundleContext context )
throws NullArgumentException
{
m_factory = new BlockFactory();
+ m_metro = new DefaultRuntimeFactory( context );
}

- //--------------------------------------------------------------
- // Runtime
- //--------------------------------------------------------------
-
- /**
- * Request the commissioning of a runtime for a supplied deployment
- * model.
- * @param model the deployment model
- * @exception Exception of a commissioning error occurs
- */
+ /**
+ * Request the commissioning of a runtime for a supplied deployment
+ * model.
+ * @param model the deployment model
+ * @exception Exception of a commissioning error occurs
+ */
public void commission( DeploymentModel model )
throws Exception
{
getRuntimeFactory( model ).getRuntime( model ).commission();
}

- /**
- * Request the decommissioning of a runtime for a supplied deployment
- * model.
- * @param model the deployment model
- */
+ /**
+ * Request the decommissioning of a runtime for a supplied deployment
+ * model.
+ * @param model the deployment model
+ */
public void decommission( DeploymentModel model )
{
- getRuntimeFactory( model ).getRuntime( model ).decommission();
+ RuntimeFactory runtimeFactory = getRuntimeFactory( model );
+ Appliance runtime = runtimeFactory.getRuntime( model );
+ runtime.decommission();
}

- /**
- * Request resolution of an object from the runtime.
- * @param model the deployment model
- * @exception Exception if a deployment error occurs
- */
+ /**
+ * Request resolution of an object from the runtime.
+ * @param model the deployment model
+ * @exception Exception if a deployment error occurs
+ */
public Object resolve( DeploymentModel model )
throws Exception
{
- return getRuntimeFactory( model ).getRuntime( model ).resolve();
+ RuntimeFactory runtimeFactory = getRuntimeFactory( model );
+ Appliance runtime = runtimeFactory.getRuntime( model );
+ return runtime.resolve();
}

- /**
- * Request resolution of an object from the runtime.
- * @param model the deployment model
- * @param proxy if TRUE the return value will be proxied if the
- * underlying component typoe suppports proxy representation
- * @exception Exception if a deployment error occurs
- */
+ /**
+ * Request resolution of an object from the runtime.
+ * @param model the deployment model
+ * @param proxy if TRUE the return value will be proxied if the
+ * underlying component typoe suppports proxy representation
+ * @exception Exception if a deployment error occurs
+ */
public Object resolve( DeploymentModel model, boolean proxy )
throws Exception
{
- return getRuntimeFactory( model ).getRuntime( model ).resolve( proxy
);
+ RuntimeFactory runtimeFactory = getRuntimeFactory( model );
+ Appliance runtime = runtimeFactory.getRuntime( model );
+ return runtime.resolve( proxy );
}

- /**
- * Request the release of an object from the runtime.
- * @param model the deployment model
- * @param instance the object to release
- */
+ /**
+ * Request the release of an object from the runtime.
+ * @param model the deployment model
+ * @param instance the object to release
+ */
public void release( DeploymentModel model, Object instance )
{
- getRuntimeFactory( model ).getRuntime( model ).release( instance );
+ RuntimeFactory runtimeFactory = getRuntimeFactory( model );
+ Appliance runtime = runtimeFactory.getRuntime( model );
+ runtime.release( instance );
}

- //------------------------------------------------------------------
- // runtime operations
- //------------------------------------------------------------------
-
- /**
- * Return the runtime factory.
- *
- * @return the factory
- */
+ /**
+ * Return the runtime factory.
+ *
+ * @return the factory
+ */
private RuntimeFactory getRuntimeFactory( DeploymentModel model )
{
if( model instanceof ContainmentModel )
@@ -152,55 +129,15 @@
}
else
{
- return getMetroRuntimeFactory();
- }
- }
-
- private RuntimeFactory getMetroRuntimeFactory()
- {
- if( null != m_metro )
- {
return m_metro;
}
- else
- {
- // THIS CODE NEVER WORKED!!!!!
- // The Plugin exported is of type Runtime, but is here casted to
RuntimeFactory.
- // Don't ask me how this was supposed to work.
- try
- {
- ClassLoader classloader = Appliance.class.getClassLoader();
- URI uri = getMetroRuntimeArtifact();
- Object[] params = new Object[]{};
-
- Repository repository = new StandardLoader();
- System.out.println( "NICLAS: Plugin URI = " + uri );
- for( int i=0 ; i < params.length; i++ )
- System.out.println( " params[ " + i + " ] = " +
params[i] );
- Object plugin = repository.getPlugin( classloader, uri,
params );
- System.out.println( "NICLAS: Plugin = " + plugin );
- System.out.println( "NICLAS: Plugin " + plugin.getClass() );
- m_metro = (RuntimeFactory) plugin;
- return m_metro;
- }
- catch( Throwable e )
- {
- final String error = "Bugger, bugger, bugger";
- throw new LifestyleRuntimeException( error, e );
- }
- }
- }
-
- private URI getMetroRuntimeArtifact() throws URISyntaxException
- {
- return Artifact.createArtifact( METRO_RUNTIME ).toURI();
}

private class BlockFactory implements RuntimeFactory
{
private final Map m_map = new Hashtable();

- public BlockFactory()
+ private BlockFactory()
{
}


Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntimeFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntimeFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultRuntimeFactory.java
Tue Jun 28 08:36:24 2005
@@ -41,23 +41,10 @@
public class DefaultRuntimeFactory
implements RuntimeFactory
{
- //-------------------------------------------------------------------
- // static
- //-------------------------------------------------------------------
-
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultRuntimeFactory.class );

- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
- private final Map m_map = new Hashtable();
-
- //-------------------------------------------------------------------
- // mutable state
- //-------------------------------------------------------------------
-
- private LifestyleFactory m_factory;
+ private final Map m_map;
+ private final LifestyleFactory m_lifestyleFactory;

//-------------------------------------------------------------------
// constructor
@@ -65,7 +52,8 @@

public DefaultRuntimeFactory( BundleContext osgi )
{
- m_factory = new DefaultLifestyleFactory( osgi );
+ m_map = new Hashtable();
+ m_lifestyleFactory = new DefaultLifestyleFactory( osgi );
}

//-------------------------------------------------------------------
@@ -73,10 +61,10 @@
//-------------------------------------------------------------------

/**
- * Resolve a runtime handler for a model.
- * @param model the deployment model
- * @return the runtime appliance
- */
+ * Resolve a runtime handler for a model.
+ * @param model the deployment model
+ * @return the runtime appliance
+ */
public Appliance getRuntime( DeploymentModel model )
{
synchronized( m_map )
@@ -94,7 +82,7 @@
if( model instanceof ComponentModel )
{
ComponentModel component = (ComponentModel) model;
- LifestyleManager manager = m_factory.createLifestyleManager(
component );
+ LifestyleManager manager =
m_lifestyleFactory.createLifestyleManager( component );
runtime = newComponentRuntime( component, manager );
}
else
@@ -113,20 +101,20 @@
//-------------------------------------------------------------------

/**
- * Resolve a runtime handler for a component model.
- * @param model the containment model
- * @return the runtime handler
- */
+ * Resolve a runtime handler for a component model.
+ * @param model the containment model
+ * @return the runtime handler
+ */
protected Appliance newComponentRuntime( ComponentModel model,
LifestyleManager manager )
{
return new DefaultApplianceMetro( model, manager );
}

- /**
- * Lookup a runtime relative to the model name.
- * @param model the deployment model
- * @return the matching runtime (possibly null)
- */
+ /**
+ * Lookup a runtime relative to the model name.
+ * @param model the deployment model
+ * @return the matching runtime (possibly null)
+ */
private Appliance getRegisteredRuntime( DeploymentModel model )
{
String name = model.getQualifiedName();

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultServiceManager.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultServiceManager.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultServiceManager.java
Tue Jun 28 08:36:24 2005
@@ -45,16 +45,8 @@
class DefaultServiceManager
implements ServiceManager
{
- //-------------------------------------------------------------------
- // static
- //-------------------------------------------------------------------
-
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultServiceManager.class );

- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
private final Logger m_logger;

/**
@@ -68,12 +60,10 @@
/**
* A table of dependency models keyed by lookup key.
*/
- private final Map m_map;
+ private final Map m_dependencyModels;
+
private BundleContext m_OsgiContext;

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------

/**
* Construct a new ServiceManager.
@@ -94,7 +84,7 @@
}
m_OsgiContext = osgi;
m_logger = model.getLogger();
- m_map = new Hashtable();
+ m_dependencyModels = new Hashtable();
DependencyModel[] dependencies = model.getDependencyModels();
for( int i=0; i < dependencies.length; i++ )
{
@@ -104,15 +94,11 @@
if( provider != null )
{
final String key = dependency.getDependency().getKey();
- m_map.put( key, dependency );
+ m_dependencyModels.put( key, dependency );
}
}
}

- //-------------------------------------------------------------------
- // ServiceManager
- //-------------------------------------------------------------------
-
/**
* Returns true if a provider exists for the supplied role.
* @param key the service identifier key
@@ -124,7 +110,7 @@
{
return false;
}
- Object provider = m_map.get( key );
+ Object provider = m_dependencyModels.get( key );
boolean exists = provider != null;
return exists;
}
@@ -155,7 +141,7 @@
// for this dependency
//

- DependencyModel dependency = (DependencyModel) m_map.get( key );
+ DependencyModel dependency = (DependencyModel)
m_dependencyModels.get( key );
Object instance = establishMetroProvider( key, dependency );
if( instance != null )
{
@@ -220,7 +206,20 @@
}
return instance;
}
- catch( Throwable e )
+ catch( RuntimeException e )
+ {
+ //
+ // TODO: framework states that ServiceException is thrown
+ // if the service is not found - and in this case that isn't
+ // the issue - in effect we have a good key, but we simply
+ // have not been able to go from key to instance -
+ // should look into some more concrete subtypes of
+ // ServiceException
+
+ final String error = "Unexpected runtime error while attempting
to resolve service for key: " + key;
+ throw new FatalServiceException( key, error, e );
+ }
+ catch( Exception e )
{
//
// TODO: framework states that ServiceException is thrown
@@ -242,9 +241,12 @@
public void release( Object instance )
{
if( instance == null )
+ {
return;
+ }

- if( Proxy.isProxyClass( instance.getClass() ) )
+ boolean isProxy = Proxy.isProxyClass( instance.getClass() );
+ if( isProxy )
{
InvocationHandler handler = Proxy.getInvocationHandler( instance
);
if( handler instanceof ApplianceInvocationHandler )
@@ -260,6 +262,8 @@
// otherwise we need to locate the source ourselves
//

+ // TODO: OSGi services MUST be handled.
+
String id = "" + System.identityHashCode( instance );
final String key = (String) m_table.get( id );
if( key == null )
@@ -272,7 +276,7 @@
return;
}

- DependencyModel dependency = (DependencyModel) m_map.get( key );
+ DependencyModel dependency = (DependencyModel)
m_dependencyModels.get( key );
final DeploymentModel provider = dependency.getProvider();
if( provider == null )
{

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultState.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultState.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/DefaultState.java
Tue Jun 28 08:36:24 2005
@@ -27,17 +27,8 @@

class DefaultState
{
-
-
//---------------------------------------------------------------------------
- // state
-
//---------------------------------------------------------------------------
-
private boolean m_enabled = false;

-
//---------------------------------------------------------------------------
- // State
-
//---------------------------------------------------------------------------
-
/**
* Return the enabled state of the state.
* @return TRUE if the state has been enabled else FALSE
@@ -47,15 +38,11 @@
return m_enabled;
}

-
//---------------------------------------------------------------------------
- // implementation
-
//---------------------------------------------------------------------------
-
- /**
- * Set the enabled state of the state.
- * @param enabled the enabled state to assign
- */
- public void setEnabled( boolean enabled ) throws IllegalStateException
+ /**
+ * Set the enabled state of the state.
+ * @param enabled the enabled state to assign
+ */
+ public void setEnabled( boolean enabled )
{
m_enabled = enabled;
}

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/SingletonLifestyleManager.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/SingletonLifestyleManager.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/SingletonLifestyleManager.java
Tue Jun 28 08:36:24 2005
@@ -29,39 +29,33 @@
*/
public class SingletonLifestyleManager extends AbstractLifestyleManager
{
- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
private Reference m_reference;

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------
-
+ /** Constructor for the Singleton lifestyle handler.
+ *
+ * @param model The model for which the LifestyleManager is created for.
+ * @param factory the ComponentFactory to use to incarnate the instance.
+ */
public SingletonLifestyleManager( ComponentModel model, ComponentFactory
factory )
{
super( model, factory );
}

- //-------------------------------------------------------------------
- // Commissionable
- //-------------------------------------------------------------------
-
- /**
- * Commission the runtime handler.
- *
- * @exception Exception if a handler commissioning error occurs
- */
- public void commission() throws Exception
+ /**
+ * Commission the runtime handler.
+ *
+ * @exception Exception if a handler commissioning error occurs
+ */
+ public void commission()
+ throws Exception
{
handleResolve();
}

- /**
- * Invokes the decommissioning phase. Once a handler is
- * decommissioned it may be re-commissioned.
- */
+ /**
+ * Invokes the decommissioning phase. Once a handler is
+ * decommissioned it may be re-commissioned.
+ */
public void decommission()
{
if( m_reference != null )
@@ -71,10 +65,6 @@
}
}

- //-------------------------------------------------------------------
- // Resolver
- //-------------------------------------------------------------------
-
/**
* Resolve a object to a value relative to a supplied set of
* interface classes.
@@ -82,7 +72,8 @@
* @return the resolved object
* @throws Exception if an error occurs
*/
- protected synchronized Object handleResolve() throws Exception
+ protected synchronized Object handleResolve()
+ throws Exception
{
Object instance = null;

@@ -114,10 +105,6 @@
// continue with the current singleton reference
}

- //-------------------------------------------------------------------
- // LifecycleManager
- //-------------------------------------------------------------------
-
/**
* Release an object
*
@@ -129,11 +116,8 @@
m_reference = null;
}

- //-------------------------------------------------------------------
- // implementation
- //-------------------------------------------------------------------
-
- private Object refreshReference() throws Exception
+ private Object refreshReference()
+ throws Exception
{
ComponentFactory factory = getComponentFactory();
synchronized( factory )

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ThreadLifestyleManager.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ThreadLifestyleManager.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/ThreadLifestyleManager.java
Tue Jun 28 08:36:24 2005
@@ -28,94 +28,55 @@
*/
public class ThreadLifestyleManager extends AbstractLifestyleManager
{
- //-------------------------------------------------------------------
- // static
- //-------------------------------------------------------------------
-
- /**
- * Internal utility class to hold the thread local instance.
- */
- private static final class ThreadLocalHolder extends ThreadLocal
- {
- private final ComponentFactory m_factory;
-
- protected ThreadLocalHolder( ComponentFactory factory )
- {
- m_factory = factory;
- }
-
- //
- // TODO: the current implementation is hard coded to HARD
- // collection policy - we need to update the ThreadLocalHolder so
- // it regenerates the value relative to SOFT or WEAK policies
- // (but I just need to check docs on thread local state access
- // semantics)
- //
-
- protected Object initialValue()
- {
- try
- {
- return m_factory.incarnate();
- }
- catch( Exception e )
- {
- final String error =
- "Unable to establish thread local variable.";
- throw new LifestyleRuntimeException( error, e );
- }
- }
- }
-
- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
private ThreadLocalHolder m_local;

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------
-
+ /** Constructor for the Thread lifestyle handler.
+ *
+ * @param model The component model for which this LifeStyleManager is
created for.
+ * @param factory the ComponentFactory to use to incarnate instances.
+ */
public ThreadLifestyleManager( ComponentModel model, ComponentFactory
factory )
{
super( model, factory );
}

- //-------------------------------------------------------------------
- // Commissionable
- //-------------------------------------------------------------------
-
- /**
- * Commission the runtime handler.
- *
- * @exception Exception if a hanfdler commissioning error occurs
- */
- public void commission() throws Exception
+ /**
+ * Commission the runtime handler.
+ *
+ * @exception Exception if a hanfdler commissioning error occurs
+ */
+ public void commission()
+ throws Exception
{
+ if( m_local != null )
+ {
+ throw new LifestyleRuntimeException( "The component has already
been commissioned." );
+ }
+ m_local = new ThreadLocalHolder( getComponentFactory() );
if( getComponentModel().getActivationPolicy() )
{
resolve();
}
}

- /**
- * Invokes the decommissioning phase. Once a handler is
- * decommissioned it may be re-commissioned.
- */
+ /**
+ * Invokes the decommissioning phase. Once a handler is
+ * decommissioned it may be re-commissioned.
+ */
public synchronized void decommission()
{
if( m_local != null )
{
- finalize( m_local.get() );
+ // TODO: This does not work, since all instances that has been
incarnated must be released, not just the ones for the current thread.
+ Object instance = m_local.get();
+ finalize( instance );
m_local = null;
+ } else
+ {
+ throw new LifestyleRuntimeException( "The component has not been
commissioned." );
}
}

- //-------------------------------------------------------------------
- // Resolver
- //-------------------------------------------------------------------
-
/**
* Resolve a object to a value relative to a supplied set of
* interface classes.
@@ -123,13 +84,9 @@
* @return the resolved object
* @throws Exception if an error occurs
*/
- protected Object handleResolve() throws Exception
+ protected Object handleResolve()
+ throws Exception
{
- if( m_local == null )
- {
- ComponentFactory factory = getComponentFactory();
- m_local = new ThreadLocalHolder( factory );
- }
return m_local.get();
}

@@ -143,4 +100,38 @@
// don't release because this is a shared reference
}

+
+ /**
+ * Internal utility class to hold the thread local instance.
+ */
+ private static final class ThreadLocalHolder extends ThreadLocal
+ {
+ private final ComponentFactory m_factory;
+
+ protected ThreadLocalHolder( ComponentFactory factory )
+ {
+ m_factory = factory;
+ }
+
+ //
+ // TODO: the current implementation is hard coded to HARD
+ // collection policy - we need to update the ThreadLocalHolder so
+ // it regenerates the value relative to SOFT or WEAK policies
+ // (but I just need to check docs on thread local state access
+ // semantics)
+ //
+
+ protected Object initialValue()
+ {
+ try
+ {
+ return m_factory.incarnate();
+ }
+ catch( Exception e )
+ {
+ String error = "Unable to establish thread local variable.";
+ throw new LifestyleRuntimeException( error, e );
+ }
+ }
+ }
}

Modified:
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/TransientLifestyleManager.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/TransientLifestyleManager.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/activation/impl/src/main/net/dpml/activation/impl/TransientLifestyleManager.java
Tue Jun 28 08:36:24 2005
@@ -25,6 +25,7 @@
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
+import java.lang.ref.ReferenceQueue;
import java.util.ArrayList;

/**
@@ -33,31 +34,20 @@
*/
public class TransientLifestyleManager extends AbstractLifestyleManager
{
- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
private ArrayList m_list = new ArrayList();

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------
-
public TransientLifestyleManager( ComponentModel model, ComponentFactory
factory )
{
super( model, factory );
}

- //-------------------------------------------------------------------
- // Commissionable
- //-------------------------------------------------------------------
-
/**
- * Commission the appliance.
- *
- * @exception Exception if a commissioning error occurs
- */
- public void commission() throws Exception
+ * Commission the appliance.
+ *
+ * @exception Exception if a commissioning error occurs
+ */
+ public void commission()
+ throws Exception
{
// TODO: setup a background thread to check queues for
// released references and remove them from our list, otherwise we
@@ -70,9 +60,9 @@
}

/**
- * Decommission the appliance. Once an appliance is
- * decommissioned it may be re-commissioned.
- */
+ * Decommission the appliance. Once an appliance is
+ * decommissioned it may be re-commissioned.
+ */
public void decommission()
{
Reference[] refs = (Reference[]) m_list.toArray( new Reference[0] );
@@ -84,18 +74,15 @@
m_list.clear();
}

- //-------------------------------------------------------------------
- // Resolver
- //-------------------------------------------------------------------
-
/**
- * Resolve a object to a value relative to a supplied set of
- * interface classes.
- *
- * @return the resolved object
- * @throws Exception if an error occurs
- */
- protected Object handleResolve() throws Exception
+ * Resolve a object to a value relative to a supplied set of
+ * interface classes.
+ *
+ * @return the resolved object
+ * @throws Exception if an error occurs
+ */
+ protected Object handleResolve()
+ throws Exception
{
Object instance = getComponentFactory().incarnate();
Reference reference = getReference( instance );
@@ -104,35 +91,32 @@
}

/**
- * Release an object
- *
- * @param instance the object to be released
- */
+ * Release an object
+ *
+ * @param instance the object to be released
+ */
protected void handleRelease( Object instance )
{
finalize( instance );
}

- //-------------------------------------------------------------------
- // LifestyleManager
- //-------------------------------------------------------------------
-
/**
- * Overriding getReference to ensure that we never return a hard
- * reference for a transient.
- */
+ * Overriding getReference to ensure that we never return a hard
+ * reference for a transient.
+ */
protected Reference getReference( Object instance )
{
- final int policy = getComponentModel().getCollectionPolicy();
+ ComponentModel componentModel = getComponentModel();
+ int policy = componentModel.getCollectionPolicy();
+
if( policy == InfoDescriptor.SOFT )
{
return new SoftReference( instance );
}
else
{
- return new WeakReference(
- instance,
- getLiberalQueue() );
+ ReferenceQueue liberalQueue = getLiberalQueue();
+ return new WeakReference( instance, liberalQueue );
}
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/BlockCompositionDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/BlockCompositionDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/BlockCompositionDirective.java
Tue Jun 28 08:36:24 2005
@@ -32,6 +32,8 @@
*/
public class BlockCompositionDirective extends DeploymentProfile
{
+ static final long serialVersionUID = 1L;
+
/**
* The version identifier.
*/
@@ -49,8 +51,7 @@
* @param artifact an artifact from which a block
* description can be resolved
*/
- public BlockCompositionDirective(
- final String name, Artifact artifact )
+ public BlockCompositionDirective( String name, Artifact artifact )
{
this( name, artifact, new TargetDirective[0] );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/BlockIncludeDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/BlockIncludeDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/BlockIncludeDirective.java
Tue Jun 28 08:36:24 2005
@@ -28,6 +28,8 @@
*/
public class BlockIncludeDirective extends DeploymentProfile
{
+ static final long serialVersionUID = 1L;
+
/**
* The include path.
*/
@@ -38,7 +40,7 @@
* @param name the name to assign to the included container
* @param path a relative path to the block descriptor
*/
- public BlockIncludeDirective( final String name, final String path )
+ public BlockIncludeDirective( String name, String path )
throws NullArgumentException
{
super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT );

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ClassLoaderDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ClassLoaderDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ClassLoaderDirective.java
Tue Jun 28 08:36:24 2005
@@ -26,8 +26,11 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class ClassLoaderDirective implements Serializable
+public final class ClassLoaderDirective
+ implements Serializable
{
+ static final long serialVersionUID = 1L;
+
private static final LibraryDirective EMPTY_LIBRARY = new
LibraryDirective();
private static final ClasspathDirective EMPTY_CLASSPATH = new
ClasspathDirective();

@@ -55,9 +58,7 @@
* @param library the library descriptor
* @param classpath the classpath descriptor
*/
- public ClassLoaderDirective(
- final LibraryDirective library,
- final ClasspathDirective classpath )
+ public ClassLoaderDirective( LibraryDirective library,
ClasspathDirective classpath )
{
if( library == null )
{
@@ -87,7 +88,9 @@
*/
public boolean isEmpty()
{
- return ( m_library.isEmpty() && m_classpath.isEmpty() );
+ boolean emptyClasspath = m_classpath.isEmpty();
+ boolean emptyLibrary = m_library.isEmpty();
+ return emptyLibrary && emptyClasspath;
}

/**

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ClasspathDirective.java
Tue Jun 28 08:36:24 2005
@@ -28,12 +28,12 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class ClasspathDirective implements Serializable
+public final class ClasspathDirective
+ implements Serializable
{
- private static final FilesetDirective[] EMPTY_FILESETS =
- new FilesetDirective[0];
- private static final Artifact[] EMPTY_ARTIFACTS =
- new Artifact[0];
+ static final long serialVersionUID = 1L;
+ private static final FilesetDirective[] EMPTY_FILESETS = new
FilesetDirective[0];
+ private static final Artifact[] EMPTY_ARTIFACTS = new Artifact[0];

/**
* The fileset directives
@@ -59,9 +59,7 @@
* @param filesets the filesets to be included in a classloader
* @param artifacts the set of artifact directives
*/
- public ClasspathDirective(
- final FilesetDirective[] filesets,
- final Artifact[] artifacts )
+ public ClasspathDirective( FilesetDirective[] filesets, Artifact[]
artifacts )
{
if( filesets == null )
{
@@ -88,8 +86,8 @@
*/
public boolean isEmpty()
{
- final int n = m_artifacts.length + m_filesets.length;
- return n == 0;
+ int numberOfPathEntries = m_artifacts.length + m_filesets.length;
+ return numberOfPathEntries == 0;
}

/**

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ComponentProfile.java
Tue Jun 28 08:36:24 2005
@@ -101,6 +101,8 @@
*/
public class ComponentProfile extends DeploymentProfile
{
+ static final long serialVersionUID = 1L;
+
/**
* The collection policy override.
*/
@@ -142,7 +144,7 @@
* @param name the name to assign to the component deployment scenario
* @param classname the classname of the component type
*/
- public ComponentProfile( final String name, final String classname )
+ public ComponentProfile( String name, String classname )
throws NullArgumentException
{
this(
@@ -177,16 +179,8 @@
Mode.EXPLICIT );
}

- public ComponentProfile(
- final String name,
- final int activation,
- final int collection,
- final String classname,
- final ContextDirective context,
- final DependencyDirective[] dependencies,
- final Parameters parameters,
- final Configuration config,
- final Mode mode )
+ public ComponentProfile( String name, int activation, int collection,
String classname, ContextDirective context,
+ DependencyDirective[] dependencies, Parameters parameters,
Configuration config, Mode mode )
throws NullArgumentException
{
super( name, activation, mode );
@@ -263,7 +257,7 @@
* @return the matching DependencyDirective (possibly null if
* no directive is declared for the given key)
*/
- public DependencyDirective getDependencyDirective( final String key )
+ public DependencyDirective getDependencyDirective( String key )
{
DependencyDirective[] directives = getDependencyDirectives();
for( int i=0; i<directives.length; i++ )

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ConstructorDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ConstructorDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ConstructorDirective.java
Tue Jun 28 08:36:24 2005
@@ -54,6 +54,8 @@
*/
public class ConstructorDirective extends EntryDirective
{
+ static final long serialVersionUID = 1L;
+
/**
* The constructor classname.
*/
@@ -75,8 +77,7 @@
* @param key the entry key
* @param value the single argument value
*/
- public ConstructorDirective(
- final String key, final String value )
+ public ConstructorDirective( String key, String value )
{
this( key, "java.lang.String", value );
}
@@ -90,8 +91,7 @@
* @exception NullArgumentException if either the classname argument or
the key
* argument is null.
*/
- public ConstructorDirective(
- final String key, final String classname, final String value )
+ public ConstructorDirective( String key, String classname, String value )
throws NullArgumentException
{
super( key );
@@ -114,7 +114,7 @@
* argument is null, or any of the elements in the parameters
array
* is null.
*/
- public ConstructorDirective( final String key, final Parameter[]
parameters )
+ public ConstructorDirective( String key, Parameter[] parameters )
throws NullArgumentException
{
this( key, "java.lang.String", parameters );
@@ -129,8 +129,7 @@
* argument is null, or if any of the elements in the
parameters
* array is null.
*/
- public ConstructorDirective(
- final String key, final String classname, final Parameter[]
parameters )
+ public ConstructorDirective( String key, String classname, Parameter[]
parameters )
throws NullArgumentException
{
super( key );

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
Tue Jun 28 08:36:24 2005
@@ -32,10 +32,8 @@
*/
public class ContainmentProfile extends DeploymentProfile
{
-
//========================================================================
- // static
-
//========================================================================
-
+ static final long serialVersionUID = 1L;
+
/**
* Container path delimiter.
*/
@@ -56,18 +54,14 @@
EMPTY_SERVICES = new ServiceDirective[0];
}

-
//========================================================================
- // state
-
//========================================================================
-
/**
* The classloader directive.
*/
private ClassLoaderDirective m_classloader;

- /**
- * The published service directives.
- */
+ /**
+ * The published service directives.
+ */
private final ServiceDirective[] m_export;

/**
@@ -79,27 +73,27 @@
// constructor

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

- /**
- * Creation of a new empty containment profile.
- */
+ /**
+ * Creation of a new empty containment profile.
+ */
public ContainmentProfile()
{
this( "container", null, null, null );
}

- /**
- * Creation of a new containment profile.
- *
- * @param name the profile name
- * @param classloader the description of the classloader to be
- * created for this containment profile
- * @param exports the set of servides that this component is
- * dependent on for normal execution
- * @param profiles the set of profiles contained within this
- * containment profile
- */
- public ContainmentProfile( final String name, final ClassLoaderDirective
classloader,
- final ServiceDirective[] exports, DeploymentProfile[] profiles )
+ /**
+ * Creation of a new containment profile.
+ *
+ * @param name the profile name
+ * @param classloader the description of the classloader to be
+ * created for this containment profile
+ * @param exports the set of servides that this component is
+ * dependent on for normal execution
+ * @param profiles the set of profiles contained within this
+ * containment profile
+ */
+ public ContainmentProfile( String name, ClassLoaderDirective classloader,
+ ServiceDirective[] exports, DeploymentProfile[] profiles )
{
super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT );
m_classloader = classloader;
@@ -167,7 +161,10 @@
*/
public DeploymentProfile[] getProfiles()
{
- if( m_profiles == null ) return EMPTY_PROFILES;
+ if( m_profiles == null )
+ {
+ return EMPTY_PROFILES;
+ }
return m_profiles;
}

@@ -203,6 +200,8 @@
list.add( profile );
}
}
- return (DeploymentProfile[])list.toArray( new DeploymentProfile[0] );
+ DeploymentProfile[] result = new DeploymentProfile[ list.size() ];
+ list.toArray( result );
+ return result;
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ContextDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ContextDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ContextDirective.java
Tue Jun 28 08:36:24 2005
@@ -45,8 +45,11 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class ContextDirective implements Serializable
+public class ContextDirective
+ implements Serializable
{
+ static final long serialVersionUID = 1L;
+
/**
* The set of entry directives.
*/
@@ -61,7 +64,7 @@
* Creation of a new file target.
* @param entries the set of entry descriptors
*/
- public ContextDirective( final EntryDirective[] entries )
+ public ContextDirective( EntryDirective[] entries )
{
this( null, entries );
}
@@ -71,7 +74,7 @@
* @param classname the context implementation class
* @param entries the set of entry descriptors
*/
- public ContextDirective( final String classname, final EntryDirective[]
entries )
+ public ContextDirective( String classname, EntryDirective[] entries )
{
m_classname = classname;
if( entries != null )

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/DependencyDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/DependencyDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/DependencyDirective.java
Tue Jun 28 08:36:24 2005
@@ -27,8 +27,10 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class DependencyDirective implements Serializable
+public final class DependencyDirective
+ implements Serializable
{
+ static final long serialVersionUID = 1L;

/**
* The dependency key that the directive refers to.

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/DeploymentProfile.java
Tue Jun 28 08:36:24 2005
@@ -27,12 +27,11 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public abstract class DeploymentProfile implements Serializable, Comparable
+public abstract class DeploymentProfile
+ implements Serializable, Comparable
{
-
//--------------------------------------------------------------------------
- // static
-
//--------------------------------------------------------------------------
-
+ static final long serialVersionUID = 1L;
+
/**
* System default activation policy.
*/
@@ -48,10 +47,6 @@
*/
public static final int DISABLED = 0;

-
//--------------------------------------------------------------------------
- // state
-
//--------------------------------------------------------------------------
-
/**
* The name of the component profile. This is an
* abstract name used during assembly.
@@ -72,8 +67,7 @@
// constructor

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

- public DeploymentProfile(
- final String name, int activation, Mode mode )
+ public DeploymentProfile( String name, int activation, Mode mode )
{
m_activation = activation;


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/EntryDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/EntryDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/EntryDirective.java
Tue Jun 28 08:36:24 2005
@@ -53,8 +53,11 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public abstract class EntryDirective implements Serializable
+public abstract class EntryDirective
+ implements Serializable
{
+ static final long serialVersionUID = 1L;
+
/**
* The entry key.
*/
@@ -65,7 +68,7 @@
* @param key the entry key
* @exception NullArgumentException if the key argument is null.
*/
- public EntryDirective( final String key )
+ public EntryDirective( String key )
throws NullArgumentException
{
if( null == key )

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ExcludeDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ExcludeDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ExcludeDirective.java
Tue Jun 28 08:36:24 2005
@@ -37,8 +37,10 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class ExcludeDirective implements Serializable
+public class ExcludeDirective
+ implements Serializable
{
+ static final long serialVersionUID = 1L;

/**
* The base directory

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/FilesetDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/FilesetDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/FilesetDirective.java
Tue Jun 28 08:36:24 2005
@@ -39,8 +39,11 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class FilesetDirective implements Serializable
+public class FilesetDirective
+ implements Serializable
{
+ static final long serialVersionUID = 1L;
+
/**
* The base directory from which include directives will be resolved.
*/
@@ -62,9 +65,9 @@
* @param base the base directory path against which includes are
evaluated
* @param includes the set of includes to include in the fileset
*/
- public FilesetDirective( final String base, final IncludeDirective[]
includes )
+ public FilesetDirective( String base, IncludeDirective[] includes )
{
- this(base, includes, null);
+ this( base, includes, null );
}

/**
@@ -73,8 +76,7 @@
* @param base the base directory path against which includes are
evaluated
* @param includes the set of includes to include in the fileset
*/
- public FilesetDirective( final String base, final IncludeDirective[]
includes,
- final ExcludeDirective[] excludes)
+ public FilesetDirective( String base, IncludeDirective[] includes,
ExcludeDirective[] excludes)
{
m_base = base;
m_includes = includes;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ImportDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ImportDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ImportDirective.java
Tue Jun 28 08:36:24 2005
@@ -50,6 +50,8 @@
*/
public class ImportDirective extends EntryDirective
{
+ static final long serialVersionUID = 1L;
+
/**
* The container scoped key.
*/
@@ -61,7 +63,7 @@
* @param containerKey the container scoped key value to import
* @exception NullArgumentException if the containerKey argument is null.
*/
- public ImportDirective( final String key, final String containerKey )
+ public ImportDirective( String key, String containerKey )
throws NullArgumentException
{
super( key );

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/IncludeDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/IncludeDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/IncludeDirective.java
Tue Jun 28 08:36:24 2005
@@ -37,8 +37,10 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class IncludeDirective implements Serializable
+public class IncludeDirective
+ implements Serializable
{
+ static final long serialVersionUID = 1L;

/**
* The base directory
@@ -50,7 +52,7 @@
*
* @param path the path to include
*/
- public IncludeDirective( final String path )
+ public IncludeDirective( String path )
{
m_path = path;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/LibraryDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/LibraryDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/LibraryDirective.java
Tue Jun 28 08:36:24 2005
@@ -39,7 +39,9 @@
public class LibraryDirective
implements Serializable
{
- private static final String[] EMPTY_SET = new String[0];
+ static final long serialVersionUID = 1L;
+
+ private static final String[] EMPTY_SET = new String[0];

/**
* The include paths
@@ -65,7 +67,7 @@
* @param includes the set of include paths
* @param groups the set of group identifiers
*/
- public LibraryDirective( final String[] includes, final String[] groups )
+ public LibraryDirective( String[] includes, String[] groups )
{
if( includes == null )
{

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/MetaDataException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/MetaDataException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/MetaDataException.java
Tue Jun 28 08:36:24 2005
@@ -24,8 +24,7 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class MetaDataException
- extends Exception
+public final class MetaDataException extends Exception
{
private final Throwable m_cause;

@@ -34,7 +33,7 @@
*
* @param message The detail message for this exception.
*/
- public MetaDataException( final String message )
+ public MetaDataException( String message )
{
this( message, null );
}
@@ -45,7 +44,7 @@
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public MetaDataException( final String message, final Throwable
throwable )
+ public MetaDataException( String message, Throwable throwable )
{
super( message );
m_cause = throwable;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/MetaDataRuntimeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/MetaDataRuntimeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/MetaDataRuntimeException.java
Tue Jun 28 08:36:24 2005
@@ -34,7 +34,7 @@
*
* @param message The detail message for this exception.
*/
- public MetaDataRuntimeException( final String message )
+ public MetaDataRuntimeException( String message )
{
this( message, null );
}
@@ -45,7 +45,7 @@
* @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public MetaDataRuntimeException( final String message, final Throwable
throwable )
+ public MetaDataRuntimeException( String message, Throwable throwable )
{
super( message );
m_cause = throwable;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Mode.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Mode.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Mode.java
Tue Jun 28 08:36:24 2005
@@ -27,8 +27,11 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class Mode implements Serializable
+public class Mode
+ implements Serializable
{
+ static final long serialVersionUID = 1L;
+
/**
* Constant indicating that the profile was implicitly created.
*/
@@ -59,6 +62,12 @@
*/
public static final Mode EXPLICIT = new Mode( EXPLICIT_VALUE );

+
+ /**
+ * The creation mode.
+ */
+ private final int m_mode;
+
/**
* Returns a string representation of a mode value.
* @param mode the mode value
@@ -84,11 +93,6 @@
}
}

- /**
- * The creation mode.
- */
- private final int m_mode;
-
/**
* Creation of a new mode value.
* @param mode the int value of the mode.

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/NamedComponentProfile.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/NamedComponentProfile.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/NamedComponentProfile.java
Tue Jun 28 08:36:24 2005
@@ -26,6 +26,7 @@
*/
public class NamedComponentProfile extends DeploymentProfile
{
+ static final long serialVersionUID = 1L;

/**
* The component classname.
@@ -41,7 +42,7 @@
// constructor

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

- public NamedComponentProfile( final String name, final String classname,
final String key, final int activation )
+ public NamedComponentProfile( String name, String classname, String key,
int activation )
{
super( name, activation, Mode.EXPLICIT );
m_classname = classname;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Parameter.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Parameter.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Parameter.java
Tue Jun 28 08:36:24 2005
@@ -60,8 +60,10 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class Parameter implements Serializable
+public class Parameter
+ implements Serializable
{
+ static final long serialVersionUID = 1L;

/**
* The classname to use as the parameter implementation class (defaults
to java.lang.String)
@@ -79,11 +81,6 @@
private final Parameter[] m_parameters;

/**
- * The derived value.
- */
- private transient Object m_value;
-
- /**
* Creation of a new parameter using the default
<code>java.lang.String</code>
* type and a supplied value.
*

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ProfilePackage.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ProfilePackage.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ProfilePackage.java
Tue Jun 28 08:36:24 2005
@@ -26,8 +26,10 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class ProfilePackage implements Serializable
+public class ProfilePackage
+ implements Serializable
{
+ static final long serialVersionUID = 1L;

//--------------------------------------------------------------------------
// static

//--------------------------------------------------------------------------
@@ -57,7 +59,7 @@
*
* @param profiles the set of contained profiles
*/
- public ProfilePackage( final ComponentProfile[] profiles )
+ public ProfilePackage( ComponentProfile[] profiles )
{
m_profiles = profiles;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/SelectionDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/SelectionDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/SelectionDirective.java
Tue Jun 28 08:36:24 2005
@@ -27,8 +27,11 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class SelectionDirective implements Serializable
+public final class SelectionDirective
+ implements Serializable
{
+ static final long serialVersionUID = 1L;
+
public static final String EXISTS = "exists";
public static final String EQUALS = "equals";
public static final String INCLUDES = "includes";
@@ -102,7 +105,7 @@
*/
public boolean isRequired()
{
- return !m_optional;
+ return m_optional == false;
}

/**

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ServiceDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ServiceDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/ServiceDirective.java
Tue Jun 28 08:36:24 2005
@@ -29,6 +29,7 @@
*/
public final class ServiceDirective extends ServiceDescriptor
{
+ static final long serialVersionUID = 1L;

/**
* The relative path to the component implementing the service.

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/TargetDirective.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/TargetDirective.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/TargetDirective.java
Tue Jun 28 08:36:24 2005
@@ -33,9 +33,7 @@
*/
public class TargetDirective implements Serializable
{
-
//========================================================================
- // immutable state
-
//========================================================================
+ static final long serialVersionUID = 1L;

/**
* The path.
@@ -52,17 +50,13 @@
*/
private final Parameters m_params;

-
//========================================================================
- // constructors
-
//========================================================================
-
/**
* Create a new Target instance.
*
* @param path target path
* @param configuration the configuration
*/
- public TargetDirective( final String path, final Configuration
configuration )
+ public TargetDirective( String path, Configuration configuration )
{
this( path, configuration, null );
}
@@ -74,7 +68,7 @@
* @param configuration the configuration
* @param parameters the parameters
*/
- public TargetDirective( final String path, final Configuration
configuration, final Parameters parameters )
+ public TargetDirective( String path, Configuration configuration,
Parameters parameters )
{
m_path = path;
m_config = configuration;
@@ -122,9 +116,10 @@
*/
public String toString()
{
- return "[target: " + getPath() + ", "
- + (getConfiguration() != null ) + ", "
- + (getParameters() != null )
- + " ]";
+ String path = getPath();
+ boolean hasConfig = getConfiguration() != null;
+ boolean hasParameters = getParameters() != null;
+ String result = "[target: " + path + ", " + hasConfig + ", " +
hasParameters + "]";
+ return result;
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Targets.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Targets.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/data/Targets.java
Tue Jun 28 08:36:24 2005
@@ -21,6 +21,7 @@
import net.dpml.configuration.Configuration;

import java.util.ArrayList;
+import java.io.Serializable;


/**
@@ -32,20 +33,15 @@
* @version $Id$
*/
public class Targets
+ implements Serializable
{
-
//========================================================================
- // state
-
//========================================================================
+ static final long serialVersionUID = 1L;

/**
* The set of targets.
*/
private final TargetDirective[] m_targets;

-
//========================================================================
- // constructors
-
//========================================================================
-
/**
* Create an empty Targets instance.
*/
@@ -64,10 +60,6 @@
m_targets = targets;
}

-
//========================================================================
- // implementation
-
//========================================================================
-
/**
* Return all targets.
*
@@ -99,12 +91,12 @@
return null;
}

- /**
- * Return a set of targets relative to the supplied path.
- *
- * @param path the base path to match against
- * @return the set of relative targets
- */
+ /**
+ * Return a set of targets relative to the supplied path.
+ *
+ * @param path the base path to match against
+ * @return the set of relative targets
+ */
public Targets getTargets( String path )
{
final String key = getKey( path );
@@ -124,9 +116,10 @@
}
}
}
+ TargetDirective[] result = new TargetDirective[ list.size() ];
+ list.toArray( result );

- return new Targets(
- (TargetDirective[]) list.toArray( new TargetDirective[0] ) );
+ return new Targets( result );
}

/**
@@ -134,7 +127,8 @@
* @param path the path to convert
* @return a good path value
*/
- private String getKey( final String path ) throws
IllegalArgumentException
+ private String getKey( String path )
+ throws IllegalArgumentException
{
if( !path.startsWith("/") )
{
@@ -150,7 +144,7 @@
public String toString()
{
StringBuffer buffer = new StringBuffer( "[targets: " );
- for( int i=0; i<m_targets.length; i++ )
+ for( int i = 0; i < m_targets.length; i++ )
{
buffer.append( m_targets[i] );
if( i < ( m_targets.length -1 ) )

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/event/CompositionEvent.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/event/CompositionEvent.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/event/CompositionEvent.java
Tue Jun 28 08:36:24 2005
@@ -42,7 +42,7 @@
* @param source the comtainment model raising the event
* @param child the model that is the subject of composition
*/
- public CompositionEvent( final ContainmentModel source, DeploymentModel
child )
+ public CompositionEvent( ContainmentModel source, DeploymentModel child )
{
super( source );
m_child = child;
@@ -71,10 +71,6 @@

public String toString()
{
- return "composition-event: [source: "
- + getContainmentModel()
- + ", child: "
- + getChild()
- + "]";
+ return "composition-event: [source: " + getContainmentModel() + ",
child: " + getChild() + "]";
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/AssemblyException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/AssemblyException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/AssemblyException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -25,7 +24,7 @@
* @version $Id$
*/
public class AssemblyException
- extends ModelException
+ extends ModelException
{

/**
@@ -33,7 +32,7 @@
*
* @param message The detail message for this exception.
*/
- public AssemblyException( final String message )
+ public AssemblyException( String message )
{
this( message, null );
}
@@ -41,10 +40,10 @@
/**
* Construct a new <code>AssemblyException</code> instance.
*
- * @param message The detail message for this exception.
+ * @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public AssemblyException( final String message, final Throwable
throwable )
+ public AssemblyException( String message, Throwable throwable )
{
super( message, throwable );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ClassLoaderModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ClassLoaderModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ClassLoaderModel.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.composition.data.ContainmentProfile;
@@ -25,56 +24,52 @@
import java.security.CodeSource;

/**
- * <p>Specification of a classloader model from which a
- * a fully qualifed classpath can be established.</p>
+ * <p>Specification of a classloader model from which a a fully qualifed
classpath can be established.</p>
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface ClassLoaderModel
{
+
/**
- * Return the classloader model type repository.
- *
- * @return the repository
- */
+ * Return the classloader model type repository.
+ *
+ * @return the repository
+ */
TypeRepository getTypeRepository();

/**
- * Return the classloader model service repository.
- *
- * @return the repository
- */
+ * Return the classloader model service repository.
+ *
+ * @return the repository
+ */
ServiceRepository getServiceRepository();

/**
- * Return the fully qualified classpath
- * resolved relative to a classpath directives.
- *
- * @return an array of CodeSource instances representing the qualified
- * classpath
- */
+ * Return the fully qualified classpath resolved relative to a classpath
directives.
+ *
+ * @return an array of CodeSource instances representing the qualified
classpath
+ */
CodeSource[] getQualifiedClassPath();

/**
- * Return the classloader for a containment context.
- * An implementation is required to fulfill the the
- * criteria expressed by the associated classloader
- * directive.
- *
- * @return the classloader
- */
+ * Return the classloader for a containment context. An implementation
is required to fulfill the the criteria
+ * expressed by the associated classloader directive.
+ *
+ * @return the classloader
+ */
ClassLoader getClassLoader();

/**
- * Creation of a classloader model using this model as the
- * relative parent.
- *
- * @param logger the logging channel
- * @param profile the containment profile
- * @param implied any implied urls
- * @return a new classloader context
- */
+ * Creation of a classloader model using this model as the relative
parent.
+ *
+ * @param logger the logging channel
+ * @param profile the containment profile
+ * @param implied any implied urls
+ *
+ * @return a new classloader context
+ */
ClassLoaderModel createClassLoaderModel( Logger logger,
ContainmentProfile profile, URL[] implied )
throws ModelException;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Commissionable.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Commissionable.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Commissionable.java
Tue Jun 28 08:36:24 2005
@@ -15,29 +15,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * The Comissionable interface defines the contract for an manager
- * of deployable components.
+ * The Comissionable interface defines the contract for an manager of
deployable components.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface Commissionable
{
- /**
- * Commission the runtime handler.
- *
- * @exception Exception if a hanfdler commissioning error occurs
- */
- void commission() throws Exception;

- /**
- * Invokes the decommissioning phase. Once a handler is
- * decommissioned it may be re-commissioned.
- */
- void decommission();
+ /**
+ * Commission the runtime handler.
+ *
+ * @throws Exception if a hanfdler commissioning error occurs
+ */
+ void commission()
+ throws Exception;

+ /**
+ * Invokes the decommissioning phase. Once a handler is decommissioned
it may be re-commissioned.
+ */
+ void decommission();
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CommissioningException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CommissioningException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CommissioningException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -32,7 +31,7 @@
*
* @param message The detail message for this exception.
*/
- public CommissioningException( final String message )
+ public CommissioningException( String message )
{
this( message, null );
}
@@ -40,13 +39,12 @@
/**
* Construct a new <code>CommissioningException</code> instance.
*
- * @param message The detail message for this exception.
+ * @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public CommissioningException( final String message, final Throwable
throwable )
+ public CommissioningException( String message, Throwable throwable )
{
super( message, throwable );
}
-
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ComponentModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ComponentModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ComponentModel.java
Tue Jun 28 08:36:24 2005
@@ -15,13 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.configuration.Configuration;
-import net.dpml.parameters.Parameters;
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.Type;
+import net.dpml.parameters.Parameters;

/**
* Deployment model defintion.
@@ -31,6 +30,7 @@
*/
public interface ComponentModel extends DeploymentModel
{
+
static final String PROXY_KEY = "urn:composition:proxy";

/**
@@ -41,10 +41,8 @@
Type getType();

/**
- * Return the proxy enabled policy for the model. If the system wide
- * proxy enabled is disabled the operation will return false otherwise
the
- * value returned is true unless overriden by the "urn:composition:proxy"
- * attribute.
+ * Return the proxy enabled policy for the model. If the system wide
proxy enabled is disabled the operation will
+ * return false otherwise the value returned is true unless overriden by
the "urn:composition:proxy" attribute.
*
* @return the proxy policy
*/
@@ -52,16 +50,17 @@

/**
* Return the activation policy for the model.
+ *
* @return the activaltion policy
*/
boolean getActivationPolicy();

/**
- * Return the collection policy for the model. If a profile
- * does not declare a collection policy, the collection policy
- * declared by the type will be used.
+ * Return the collection policy for the model. If a profile does not
declare a collection policy, the collection
+ * policy declared by the type will be used.
*
* @return the collection policy
+ *
* @see net.dpml.meta.info.InfoDescriptor#WEAK
* @see net.dpml.meta.info.InfoDescriptor#SOFT
* @see net.dpml.meta.info.InfoDescriptor#HARD
@@ -72,6 +71,7 @@
* Set the collection policy to a supplied value.
*
* @param policy the collection policy
+ *
* @see net.dpml.meta.info.InfoDescriptor#WEAK
* @see net.dpml.meta.info.InfoDescriptor#SOFT
* @see net.dpml.meta.info.InfoDescriptor#HARD
@@ -81,84 +81,78 @@

/**
* Set the activation policy for the model.
+ *
* @param policy the activaltion policy
*/
void setActivationPolicy( boolean policy );

/**
* Return the class for the deployable target.
+ *
* @return the class
*/
Class getDeploymentClass();

/**
- * Set the configuration to the supplied value. The supplied
- * configuration will replace the existing configuration.
+ * Set the configuration to the supplied value. The supplied
configuration will replace the existing
+ * configuration.
*
* @param config the supplied configuration
- * @throws ModelException
- * @throws IllegalStateException
*/
void setConfiguration( Configuration config )
- throws IllegalStateException, ModelException;
+ throws IllegalStateException, ModelException;

/**
- * Set the configuration to the supplied value. The supplied
- * configuration may suppliment or replace the existing configuration.
+ * Set the configuration to the supplied value. The supplied
configuration may suppliment or replace the existing
+ * configuration.
*
* @param config the supplied configuration
- * @param policy if TRUE the supplied configuration replaces the current
- * configuration otherwise the resoved configuration shall be layed
above
- * the configuration supplied with the profile which in turn is layer
above
- * the type default configuration (if any)
- * @throws ModelException if the supplied configuraiton was null, or if
the Configuration
- * should been but could not be validated
- * @throws IllegalStateException
- */
- void setConfiguration( Configuration config, boolean policy ) throws
IllegalStateException, ModelException;
+ * @param policy if TRUE the supplied configuration replaces the current
configuration otherwise the resoved
+ * configuration shall be layed above the configuration
supplied with the profile which in turn is
+ * layer above the type default configuration (if any)
+ *
+ * @throws ModelException if the supplied configuraiton was null, or if
the Configuration should been but could not
+ * be validated
+ */
+ void setConfiguration( Configuration config, boolean policy )
+ throws IllegalStateException, ModelException;

/**
- * Return the configuration to be applied to the component.
- * The implementation returns the current configuration state.
- * If the the component type does not implementation the
- * Configurable interface, the implementation returns null.
+ * Return the configuration to be applied to the component. The
implementation returns the current configuration
+ * state. If the the component type does not implementation the
Configurable interface, the implementation returns
+ * null.
*
* @return the qualified configuration
*/
Configuration getConfiguration();

/**
- * Test if the component type backing the model is
- * parameterizable.
+ * Test if the component type backing the model is parameterizable.
*
- * @return TRUE if the component type is parameterizable
- * otherwise FALSE
+ * @return TRUE if the component type is parameterizable otherwise FALSE
*/
boolean isParameterizable();

/**
- * Set the parameters to the supplied value. The supplied
- * parameters value will replace the existing parameters value.
+ * Set the parameters to the supplied value. The supplied parameters
value will replace the existing parameters
+ * value.
*
* @param parameters the supplied parameters value
*/
void setParameters( Parameters parameters );

/**
- * Set the parameters to the supplied value. The supplied
- * parameters value may suppliment or replace the existing
+ * Set the parameters to the supplied value. The supplied parameters
value may suppliment or replace the existing
* parameters value.
*
* @param parameters the supplied parameters
- * @param policy if TRUE the supplied parameters replaces the current
- * parameters value otherwise the existing and supplied values
- * are aggregrated
+ * @param policy if TRUE the supplied parameters replaces the
current parameters value otherwise the existing
+ * and supplied values are aggregrated
*/
void setParameters( Parameters parameters, boolean policy );

/**
- * Return the parameters to be applied to the component.
- * If the the component type does not implementation the
+ * Return the parameters to be applied to the component. If the the
component type does not implementation the
* Parameterizable interface, the implementation returns null.
*
* @return the assigned parameters
@@ -180,8 +174,7 @@
DependencyModel[] getDependencyModels();

/**
- * Return a dependency model for a supplied descriptor or null
- * if no match found.
+ * Return a dependency model for a supplied descriptor or null if no
match found.
*
* @return the dependency model
*/

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CompositionException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CompositionException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CompositionException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -24,8 +23,7 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class CompositionException
- extends ModelException
+public class CompositionException extends ModelException
{

/**
@@ -33,7 +31,7 @@
*
* @param message The detail message for this exception.
*/
- public CompositionException( final String message )
+ public CompositionException( String message )
{
this( message, null );
}
@@ -41,10 +39,10 @@
/**
* Construct a new <code>CompositionException</code> instance.
*
- * @param message The detail message for this exception.
+ * @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public CompositionException( final String message, final Throwable
throwable )
+ public CompositionException( String message, Throwable throwable )
{
super( message, throwable );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ContainmentModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ContainmentModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ContainmentModel.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.composition.data.DeploymentProfile;
@@ -28,193 +27,213 @@
import java.util.List;

/**
-* Containment model is an extended deployment model that aggregates
-* a set of models. A containment model describes a logical containment
-* context.
-*
-* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
-* @version $Id$
-*/
+ * Containment model is an extended deployment model that aggregates a set
of models. A containment model describes a
+ * logical containment context.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id$
+ */
public interface ContainmentModel extends DeploymentModel
{
String KEY = "urn:composition:containment.model";
-
+
/**
- * Get the startup sequence for the model.
- */
+ * Get the startup sequence for the model.
+ */
DeploymentModel[] getStartupGraph();

/**
- * Get the shutdown sequence for the model.
- */
+ * Get the shutdown sequence for the model.
+ */
DeploymentModel[] getShutdownGraph();

/**
- * Return the partition established by the containment model.
- *
- * @return the partition name
- */
+ * Return the partition established by the containment model.
+ *
+ * @return the partition name
+ */
String getPartition();

/**
- * Return the classloader model.
- *
- * @return the classloader model
- */
+ * Return the classloader model.
+ *
+ * @return the classloader model
+ */
ClassLoaderModel getClassLoaderModel();
-
+
/**
- * Return the default deployment timeout value declared in the
- * kernel configuration. The implementation looks for a value
- * assigned under the property key "urn:composition:deployment.timeout"
- * and defaults to 1000 msec if undefined.
- *
- * @return the default deployment timeout value
- */
+ * Return the default deployment timeout value declared in the kernel
configuration. The implementation looks for a
+ * value assigned under the property key
"urn:composition:deployment.timeout" and defaults to 1000 msec if
+ * undefined.
+ *
+ * @return the default deployment timeout value
+ */
long getDeploymentTimeout();

/**
- * Assemble the containment model.
- * @exception AssemblyException if an error occurs during model assembly
- */
+ * Assemble the containment model.
+ *
+ * @throws AssemblyException if an error occurs during model assembly
+ */
void assemble()
throws AssemblyException;

/**
- * Assemble the model.
- * @param subjects a list of deployment models that make up the assembly
chain
- * @exception AssemblyException if an error occurs during model assembly
- */
+ * Assemble the model.
+ *
+ * @param subjects a list of deployment models that make up the assembly
chain
+ *
+ * @throws AssemblyException if an error occurs during model assembly
+ */
void assemble( List subjects )
throws AssemblyException;

/**
- * Disassemble the model.
- */
+ * Disassemble the model.
+ */
void disassemble();

/**
- * Return the set of models nested within this model.
- * @return the classloader model
- */
+ * Return the set of models nested within this model.
+ *
+ * @return the classloader model
+ */
DeploymentModel[] getModels();

/**
- * Return a model relative to a supplied path.
- *
- * @param path a relative or absolute path
- * @return the model or null if the path is unresolvable
- * @exception IllegalArgumentException if the path if badly formed
- */
+ * Return a model relative to a supplied path.
+ *
+ * @param path a relative or absolute path
+ *
+ * @return the model or null if the path is unresolvable
+ *
+ * @throws IllegalArgumentException if the path if badly formed
+ */
DeploymentModel getModel( String path );

/**
- * Resolve a model capable of supporting the supplied service reference.
- *
- * @param descriptor a service reference descriptor
- * @return the model or null if unresolvable
- * @exception AssemblyException if an assembly error occurs
- */
+ * Resolve a model capable of supporting the supplied service reference.
+ *
+ * @param descriptor a service reference descriptor
+ *
+ * @return the model or null if unresolvable
+ *
+ * @throws AssemblyException if an assembly error occurs
+ */
DeploymentModel getModel( ReferenceDescriptor descriptor )
throws AssemblyException;

/**
- * Resolve a model capable of supporting the supplied service reference.
- *
- * @param dependency a service dependency descriptor
- * @return the model or null if unresolvable
- * @exception AssemblyException if an assembly error occurs
- */
+ * Resolve a model capable of supporting the supplied service reference.
+ *
+ * @param dependency a service dependency descriptor
+ *
+ * @return the model or null if unresolvable
+ *
+ * @throws AssemblyException if an assembly error occurs
+ */
DeploymentModel getModel( DependencyDescriptor dependency )
throws AssemblyException;

/**
- * Addition of a new subsidiary containment model
- * using a supplied profile url.
- *
- * @param url a containment profile url
- * @return the model based on the derived profile
- * @exception ModelException if an error occurs during model establishment
- */
+ * Addition of a new subsidiary containment model using a supplied
profile url.
+ *
+ * @param url a containment profile url
+ *
+ * @return the model based on the derived profile
+ *
+ * @throws ModelException if an error occurs during model establishment
+ */
ContainmentModel addContainmentModel( URL url )
throws ModelException;

/**
- * Addition of a new subsidiary containment model within
- * the containment context using a supplied url.
- *
- * @param block a url referencing a containment profile
- * @param config containment configuration targets
- * @return the model created using the derived profile and configuration
- * @exception ModelException if an error occurs during model establishment
- */
- ContainmentModel addContainmentModel( URL block, URL config )
+ * Addition of a new subsidiary containment model within the containment
context using a supplied url.
+ *
+ * @param block a url referencing a containment profile
+ * @param config containment configuration targets
+ *
+ * @return the model created using the derived profile and configuration
+ *
+ * @throws ModelException if an error occurs during model establishment
+ */
+ ContainmentModel addContainmentModel( URL block, URL config )
throws ModelException;

/**
- * Addition of a new subsidiary model within
- * the containment context using a supplied profile.
- *
- * @param profile a containment or deployment profile
- * @return the model based on the supplied profile
- * @exception ModelException if an error occurs during model establishment
- */
+ * Addition of a new subsidiary model within the containment context
using a supplied profile.
+ *
+ * @param profile a containment or deployment profile
+ *
+ * @return the model based on the supplied profile
+ *
+ * @throws ModelException if an error occurs during model establishment
+ */
DeploymentModel addModel( DeploymentProfile profile )
throws ModelException;

/**
- * Addition of a new subsidiary model within
- * the containment context.
- *
- * @param model the model to add
- * @return the model
- */
+ * Addition of a new subsidiary model within the containment context.
+ *
+ * @param model the model to add
+ *
+ * @return the model
+ */
DeploymentModel addModel( DeploymentModel model )
throws ModelException;

/**
- * Remove a named model from this model.
- * @param name the name of an immediate child model
- */
+ * Remove a named model from this model.
+ *
+ * @param name the name of an immediate child model
+ */
void removeModel( String name );

/**
- * Return the set of service export models.
- * @return t he export directives
- */
+ * Return the set of service export models.
+ *
+ * @return t he export directives
+ */
ServiceModel[] getServiceModels();

/**
- * Return a service exoport model matching a supplied class.
- * @return the service model
- */
+ * Return a service exoport model matching a supplied class.
+ *
+ * @return the service model
+ */
ServiceModel getServiceModel( Class clazz );

/**
- * Apply a set of override targets resolvable from a supplied url.
- * @param url a url resolvable to a TargetDirective[]
- * @exception ModelException if an error occurs
- */
+ * Apply a set of override targets resolvable from a supplied url.
+ *
+ * @param url a url resolvable to a TargetDirective[]
+ *
+ * @throws ModelException if an error occurs
+ */
void applyTargets( URL url )
throws ModelException;

/**
- * Apply a set of override targets.
- * @param targets a set of target directives
- * @throws ModelException if an error occures
- */
- void applyTargets( TargetDirective[]targets )
+ * Apply a set of override targets.
+ *
+ * @param targets a set of target directives
+ *
+ * @throws ModelException if an error occures
+ */
+ void applyTargets( TargetDirective[] targets )
throws ModelException;

/**
- * Add a composition listener to the model.
- * @param listener the composition listener
- */
+ * Add a composition listener to the model.
+ *
+ * @param listener the composition listener
+ */
void addCompositionListener( CompositionListener listener );

/**
- * Remove a composition listener from the model.
- * @param listener the composition listener
- */
+ * Remove a composition listener from the model.
+ *
+ * @param listener the composition listener
+ */
void removeCompositionListener( CompositionListener listener );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ContextModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ContextModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ContextModel.java
Tue Jun 28 08:36:24 2005
@@ -15,73 +15,70 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import java.util.Map;

/**
- * <p>Specification of a context model from which a
- * a fully qualifed context can be established.</p>
+ * <p>Specification of a context model from which a a fully qualifed context
can be established.</p>
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface ContextModel
{
- /**
- * Return the classname of a custom casting class.
- *
- * @return the custom context casting class (possibly null)
- */
+
+ /**
+ * Return the classname of a custom casting class.
+ *
+ * @return the custom context casting class (possibly null)
+ */
String getCastingClassname();

- /**
- * Return the classname of a custom implementation class.
- *
- * @return the context implementation class (possibly null)
- */
+ /**
+ * Return the classname of a custom implementation class.
+ *
+ * @return the context implementation class (possibly null)
+ */
String getImplementationClassname();

-
- /**
- * Return the set of entry models associated with this context model.
- *
- * @return the entry models
- */
+ /**
+ * Return the set of entry models associated with this context model.
+ *
+ * @return the entry models
+ */
EntryModel[] getEntryModels();

- /**
- * Return an entry model matching the supplied key.
- *
- * @return the entry model or null if tyhe key is unknown
- */
+ /**
+ * Return an entry model matching the supplied key.
+ *
+ * @return the entry model or null if tyhe key is unknown
+ */
EntryModel getEntryModel( String key );

- /**
- * Set the entry model relative to a supplied key.
- *
- * @param key the entry key
- * @param model the entry model
- */
+ /**
+ * Set the entry model relative to a supplied key.
+ *
+ * @param key the entry key
+ * @param model the entry model
+ */
void setEntryModel( String key, EntryModel model );

- /**
- * Set the entry to a suplied value.
- *
- * @param key the entry key
- * @param value the entry value
- */
+ /**
+ * Set the entry to a suplied value.
+ *
+ * @param key the entry key
+ * @param value the entry value
+ */
void setEntry( String key, Object value );

- /**
- * Return the context map established for the component.
- *
- * @return the context map
- */
+ /**
+ * Return the context map established for the component.
+ *
+ * @return the context map
+ */
Map getContextMap();

-
DeploymentModel getProvider();

void setProvider( DeploymentModel provider );

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CyclicDependencyException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CyclicDependencyException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/CyclicDependencyException.java
Tue Jun 28 08:36:24 2005
@@ -46,5 +46,4 @@
{
super( arg0 );
}
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DependencyGraph.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DependencyGraph.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DependencyGraph.java
Tue Jun 28 08:36:24 2005
@@ -16,43 +16,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import java.util.ArrayList;

/**
- * <p>Utility class to aquire an ordered graph of
- * consumers and providers models.</p>
+ * <p>Utility class to aquire an ordered graph of consumers and providers
models.</p>
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public class DependencyGraph
{
+
/**
- * Parent Map. Components in the parent Map are potential Providers for
- * services if no model in the current graph satisfies a dependency.
+ * Parent Map. Components in the parent Map are potential Providers for
services if no model in the current graph
+ * satisfies a dependency.
*/
private final DependencyGraph m_parent;
-
/**
- * The set of models declared by the container as available. Used when
- * searching for providers/consumers.
+ * The set of models declared by the container as available. Used when
searching for providers/consumers.
*/
- private final ArrayList m_models = new ArrayList();
-
+ private final ArrayList m_models;
+ /**
+ * The child {@link DependencyGraph}objects. Possible consumers of
services in this assembly.
+ */
+ private final ArrayList m_children;
/**
- * The child {@link DependencyGraph}objects. Possible consumers of
services
- * in this assembly.
+ * holds the models assembled in order to track circular deps etc.
*/
- private final ArrayList m_children = new ArrayList();
+ private ArrayList m_modelsInProgress;

- /**
- * holds the models assembled in order to track circular deps etc.
- */
- private ArrayList m_modelsInProgress = new ArrayList();
-
/**
* Creation of a new empty dependency graph.
*/
@@ -62,49 +56,47 @@
}

/**
- * Creation of a new dependecy graph holding a reference to a parent
graph.
- * DeploymentModel instances in the parent graph are potential providers
for
- * services if no model in current assembly satisfies a dependency.
- *
- * @param parent
- * the parent graph
+ * Creation of a new dependecy graph holding a reference to a parent
graph. DeploymentModel instances in the parent
+ * graph are potential providers for services if no model in current
assembly satisfies a dependency.
+ *
+ * @param parent the parent graph
*/
- public DependencyGraph( final DependencyGraph parent )
+ public DependencyGraph( DependencyGraph parent )
{
m_parent = parent;
+ m_models = new ArrayList();
+ m_children = new ArrayList();
+ m_modelsInProgress = new ArrayList();
}

/**
* Addition of a consumer dependency graph.
- *
- * @param child
- * the child map
+ *
+ * @param child the child map
*/
- public void addChild( final DependencyGraph child )
+ public void addChild( DependencyGraph child )
{
m_children.add( child );
}

/**
* Removal of a consumer dependency graph.
- *
- * @param child
- * the child map
+ *
+ * @param child the child map
*/
- public void removeChild( final DependencyGraph child )
+ public void removeChild( DependencyGraph child )
{
m_children.remove( child );
}

/**
* Add a model to current dependency graph.
- *
- * @param model
- * the model to add to the graph
+ *
+ * @param model the model to add to the graph
*/
- public void add( final DeploymentModel model )
+ public void add( DeploymentModel model )
{
- if( !m_models.contains( model ) )
+ if( m_models.contains( model ) == false )
{
m_models.add( model );
}
@@ -112,20 +104,18 @@

/**
* Remove a model from the dependency graph.
- *
- * @param model
- * the model to remove
+ *
+ * @param model the model to remove
*/
- public void remove( final DeploymentModel model )
+ public void remove( DeploymentModel model )
{
m_models.remove( model );
}

/**
- * Get the serilized graph of {@link DeploymentModel}objects required
when
- * starting up the target. This makes sure that all providers are
- * established before their coresponding consumers in the graph.
- *
+ * Get the serilized graph of {@link DeploymentModel}objects required
when starting up the target. This makes sure
+ * that all providers are established before their coresponding
consumers in the graph.
+ *
* @return the ordered list of models
*/
public DeploymentModel[] getStartupGraph()
@@ -134,18 +124,22 @@
{
return walkGraph( true );
}
- catch ( Throwable e )
+ catch( AssemblyException e )
{
- final String error = "Unexpect error while resolving startup
graph.";
+ String error = "Unexpect error while resolving startup graph.";
+ throw new ModelRuntimeException( error, e );
+ }
+ catch( RuntimeException e )
+ {
+ String error = "Unexpect error while resolving startup graph.";
throw new ModelRuntimeException( error, e );
}
}

/**
- * Get the serilized graph of {@link DeploymentModel}instances required
- * when shutting down all the components. This makes sure that all
consumer
- * shutdown actions occur before their coresponding providers in graph.
- *
+ * Get the serilized graph of {@link DeploymentModel}instances required
when shutting down all the components. This
+ * makes sure that all consumer shutdown actions occur before their
coresponding providers in graph.
+ *
* @return the ordered list of model instances
*/
public DeploymentModel[] getShutdownGraph()
@@ -154,22 +148,26 @@
{
return walkGraph( false );
}
- catch ( Throwable e )
+ catch( AssemblyException e )
{
- final String error = "Unexpect error while resolving shutdown
graph.";
+ String error = "Unexpect error while resolving shutdown graph.";
+ throw new ModelRuntimeException( error, e );
+ }
+ catch( RuntimeException e )
+ {
+ String error = "Unexpect error while resolving shutdown graph.";
throw new ModelRuntimeException( error, e );
}
}

/**
- * Get the serilized graph of {@link DeploymentModel}instances that use
- * services of the specified model.
- *
- * @param model
- * the model
+ * Get the serilized graph of {@link DeploymentModel}instances that use
services of the specified model.
+ *
+ * @param model the model
+ *
* @return the ordered list of consumer model instances
*/
- public DeploymentModel[] getConsumerGraph( final DeploymentModel model )
+ public DeploymentModel[] getConsumerGraph( DeploymentModel model )
{
if( m_parent != null )
{
@@ -180,32 +178,29 @@
DeploymentModel[] graph = getComponentGraph( model, false );
return referencedModels( model, graph );
}
- catch ( Throwable e )
+ catch( Throwable e )
{
- final String error = "Unexpect error while resolving consumer
graph for model: "
- + model;
+ String error = "Unexpect error while resolving consumer graph
for model: " + model;
throw new ModelRuntimeException( error, e );
}
}

/**
- * Get the serilized graph of {@link DeploymentModel}istances that
provide
- * specified model with services.
- *
- * @param model
- * the model
+ * Get the serilized graph of {@link DeploymentModel}istances that
provide specified model with services.
+ *
+ * @param model the model
+ *
* @return the ordered list of providers
*/
- public DeploymentModel[] getProviderGraph( final DeploymentModel model )
+ public DeploymentModel[] getProviderGraph( DeploymentModel model )
{
try
{
return referencedModels( model, getComponentGraph( model, true )
);
}
- catch ( Throwable e )
+ catch( Throwable e )
{
- final String error = "Unexpect error while resolving provider
graph for: "
- + model;
+ String error = "Unexpect error while resolving provider graph
for: " + model;
throw new ModelRuntimeException( error, e );
}
}
@@ -213,96 +208,85 @@
/**
* Return an model array that does not include the provided model.
*/
- private DeploymentModel[] referencedModels( final DeploymentModel model,
- DeploymentModel[] models )
+ private DeploymentModel[] referencedModels( DeploymentModel model,
DeploymentModel[] models )
{
ArrayList list = new ArrayList();
- for ( int i = 0; i < models.length; i++ )
+ for( int i = 0; i < models.length; i++ )
{
- if( !models[i].equals( model ) )
+ if( !models[ i ].equals( model ) )
{
- list.add( models[i] );
+ list.add( models[ i ] );
}
}
- return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
+ DeploymentModel[] array = new DeploymentModel[ list.size() ];
+ list.toArray( array );
+ return array;
}

/**
* Get the graph of a single model.
- *
- * @param model
- * the target model
- * @param providers
- * true if traversing providers, false if consumers
+ *
+ * @param model the target model
+ * @param providers true if traversing providers, false if consumers
+ *
* @return the list of models
*/
- private DeploymentModel[] getComponentGraph( final DeploymentModel model,
- final boolean providers )
+ private DeploymentModel[] getComponentGraph( DeploymentModel model,
boolean providers )
{
- final ArrayList result = new ArrayList();
+ ArrayList result = new ArrayList();
visitcomponent( model, providers, new ArrayList(), result );
-
- final DeploymentModel[] returnValue = new
DeploymentModel[result.size()];
- return (DeploymentModel[]) result.toArray( returnValue );
+ DeploymentModel[] returnValue = new DeploymentModel[ result.size() ];
+ result.toArray( returnValue );
+ return returnValue;
}

/**
- * Method to generate an ordering of nodes to traverse. It is expected
that
- * the specified components have passed verification tests and are well
- * formed.
- *
- * @param direction
- * true if forward dependencys traced, false if dependencies
- * reversed
+ * Method to generate an ordering of nodes to traverse. It is expected
that the specified components have passed
+ * verification tests and are well formed.
+ *
+ * @param direction true if forward dependencys traced, false if
dependencies reversed
+ *
* @return the ordered model list
*/
- private DeploymentModel[] walkGraph( final boolean direction )
+ private DeploymentModel[] walkGraph( boolean direction )
throws AssemblyException
{
- final ArrayList result = new ArrayList();
- final ArrayList done = new ArrayList();
-
- final int size = m_models.size();
- for ( int i = 0; i < size; i++ )
+ ArrayList result = new ArrayList();
+ ArrayList done = new ArrayList();
+ int size = m_models.size();
+ for( int i = 0; i < size; i++ )
{
- final DeploymentModel model = (DeploymentModel) m_models.get( i
);
-
+ DeploymentModel model = (DeploymentModel) m_models.get( i );
visitcomponent( model, direction, done, result );
}
-
- final DeploymentModel[] returnValue = new
DeploymentModel[result.size()];
if( m_modelsInProgress.size() != 0 )
{
- throw new AssemblyException( "there where non-assembled models: "
- + m_modelsInProgress );
+ throw new AssemblyException( "there where non-assembled models:
" + m_modelsInProgress );
}
- return (DeploymentModel[]) result.toArray( returnValue );
+ DeploymentModel[] returnValue = new DeploymentModel[ result.size() ];
+ result.toArray( returnValue );
+ return returnValue;
}

/**
* Visit a model when traversing dependencies.
- *
- * @param model
- * the model
- * @param direction
- * true if walking tree looking for providers, else false
- * @param done
- * those nodes already traversed
- * @param order
- * the order in which nodes have already been traversed
+ *
+ * @param model the model
+ * @param direction true if walking tree looking for providers, else
false
+ * @param done those nodes already traversed
+ * @param order the order in which nodes have already been traversed
*/
- private void visitcomponent( final DeploymentModel model,
- final boolean direction, final ArrayList done, final ArrayList
order )
+ private void visitcomponent( DeploymentModel model, boolean direction,
ArrayList done, ArrayList order )
{
//if circular dependency
- if( ( model instanceof ComponentModel )
- && m_modelsInProgress.contains( model ) )
+ boolean isComponentModel = model instanceof ComponentModel;
+ boolean isInProgress = m_modelsInProgress.contains( model );
+ if( isComponentModel && isInProgress )
{
- throw new CyclicDependencyException(
- "Cyclic dependency encoutered in assembly:" + model
- + "is already in progress stack: "
- + m_modelsInProgress );
+ String message = "Cyclic dependency encoutered in assembly:" +
model + "is already in progress stack: " + m_modelsInProgress;
+ throw new CyclicDependencyException( message );
}
+
//If already visited this model return

if( done.contains( model ) )
@@ -314,70 +298,58 @@
if( direction )
{
visitProviders( model, done, order );
-
}
else
{
visitConsumers( model, done, order );
}
-
m_modelsInProgress.remove( model );
order.add( model );
}

/**
- * Traverse graph of components that provide services to the specified
- * model.
- *
- * @param model
- * the model to be checked
- * @param done
- * the list of already checked models
- * @param order
- * the order
+ * Traverse graph of components that provide services to the specified
model.
+ *
+ * @param model the model to be checked
+ * @param done the list of already checked models
+ * @param order the order
*/
- private void visitProviders( final DeploymentModel model,
- final ArrayList done, final ArrayList order )
+ private void visitProviders( DeploymentModel model, ArrayList done,
ArrayList order )
{
DeploymentModel[] providers = model.getProviders();
- for ( int i = ( providers.length - 1 ); i > -1; i-- )
+ for( int i = ( providers.length - 1 ); i > -1; i-- )
{
- visitcomponent( providers[i], true, done, order );
+ visitcomponent( providers[ i ], true, done, order );
}
}

/**
- * Traverse all consumers of a model. I.e. all models that use service
- * provided by the supplied model.
- *
- * @param model
- * the model to be checked
- * @param done
- * the list of already checked models
- * @param order
- * the order
+ * Traverse all consumers of a model. I.e. all models that use service
provided by the supplied model.
+ *
+ * @param model the model to be checked
+ * @param done the list of already checked models
+ * @param order the order
*/
- private void visitConsumers( final DeploymentModel model,
- final ArrayList done, final ArrayList order )
+ private void visitConsumers( DeploymentModel model, ArrayList done,
ArrayList order )
{
- final int size = m_models.size();
- for ( int i = 0; i < size; i++ )
+ int size = m_models.size();
+ for( int i = 0; i < size; i++ )
{
- final DeploymentModel other = (DeploymentModel) m_models.get( i
);
- final DeploymentModel[] providers = other.getProviders();
- for ( int j = 0; j < providers.length; j++ )
+ DeploymentModel other = (DeploymentModel) m_models.get( i );
+ DeploymentModel[] providers = other.getProviders();
+ for( int j = 0; j < providers.length; j++ )
{
- DeploymentModel provider = providers[j];
+ DeploymentModel provider = providers[ j ];
if( provider.equals( model ) )
{
visitcomponent( other, false, done, order );
}
}
}
- final int childCount = m_children.size();
- for ( int i = 0; i < childCount; i++ )
+ int childCount = m_children.size();
+ for( int i = 0; i < childCount; i++ )
{
- final DependencyGraph map = (DependencyGraph) m_children.get( i
);
+ DependencyGraph map = (DependencyGraph) m_children.get( i );
map.visitConsumers( model, done, order );
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DependencyModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DependencyModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DependencyModel.java
Tue Jun 28 08:36:24 2005
@@ -15,50 +15,47 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ServiceDescriptor;

/**
- * Dependency model handles the establishment of an explicit source
- * provider defintion or service provider selection rules.
+ * Dependency model handles the establishment of an explicit source provider
defintion or service provider selection
+ * rules.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface DependencyModel
{
- /**
- * Return the dependency descriptor for the model.
- *
- * @return the descriptors declaring the component
- * dependency
- */
+
+ /**
+ * Return the dependency descriptor for the model.
+ *
+ * @return the descriptors declaring the component dependency
+ */
DependencyDescriptor getDependency();

- /**
- * Return an explicit path to a component.
- * If a dependency directive has been declared
- * and the directive contains a source declaration, the value
- * returned is the result of parsing the source value relative
- * to the absolute address of the dependent component.
- *
- * @return the explicit path
- */
+ /**
+ * Return an explicit path to a component. If a dependency directive has
been declared and the directive contains a
+ * source declaration, the value returned is the result of parsing the
source value relative to the absolute address
+ * of the dependent component.
+ *
+ * @return the explicit path
+ */
String getPath();

- /**
- * Filter a set of candidate service descriptors and return the
- * set of acceptable service as a ordered sequence.
- *
- * @param candidates the set of candidate services for the dependency
- * @return the accepted candidates in ranked order
- */
+ /**
+ * Filter a set of candidate service descriptors and return the set of
acceptable service as a ordered sequence.
+ *
+ * @param candidates the set of candidate services for the dependency
+ *
+ * @return the accepted candidates in ranked order
+ */
ServiceDescriptor[] filter( ServiceDescriptor[] candidates );
-
+
DeploymentModel getProvider();
-
+
void setProvider( DeploymentModel provider );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DeploymentModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DeploymentModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DeploymentModel.java
Tue Jun 28 08:36:24 2005
@@ -15,16 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.composition.data.Mode;
-
+import net.dpml.logging.Logger;
import net.dpml.meta.info.DependencyDescriptor;
-import net.dpml.meta.info.ServiceDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
-import net.dpml.logging.Logger;
-
+import net.dpml.meta.info.ServiceDescriptor;

/**
* Model desribing a deployment scenario.
@@ -32,106 +29,106 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public interface DeploymentModel extends Commissionable, Resolver
+public interface DeploymentModel
+ extends Commissionable, Resolver
{
String SEPARATOR = "/";
-
String DEPLOYMENT_TIMEOUT_KEY = "urn:composition:deployment.timeout";

- /**
- * Return the name of the model.
- * @return the name
- */
+ /**
+ * Return the name of the model.
+ *
+ * @return the name
+ */
String getName();

- /**
- * Return the model partition path.
- * @return the path
- */
+ /**
+ * Return the model partition path.
+ *
+ * @return the path
+ */
String getPath();

- /**
- * Return the model fully qualified name.
- * @return the fully qualified name
- */
+ /**
+ * Return the model fully qualified name.
+ *
+ * @return the fully qualified name
+ */
String getQualifiedName();

- /**
- * Return the mode of model establishment.
- * @return the mode
- */
+ /**
+ * Return the mode of model establishment.
+ *
+ * @return the mode
+ */
Mode getMode();

- /**
- * Return the assigned logging channel.
- * @return the logging channel
- */
+ /**
+ * Return the assigned logging channel.
+ *
+ * @return the logging channel
+ */
Logger getLogger();

- /**
- * Return the default deployment timeout value declared in the
- * kernel configuration. The implementation looks for a value
- * assigned under the property key "urn:composition:deployment.timeout"
- * and defaults to 1000 msec if undefined.
- *
- * @return the default deployment timeout value
- */
- long getDeploymentTimeout();
-
- //-----------------------------------------------------------
- // service production
- //-----------------------------------------------------------
-
- /**
- * Return the set of services produced by the model.
- * @return the services
- */
+ /**
+ * Return the default deployment timeout value declared in the kernel
configuration. The implementation looks for a
+ * value assigned under the property key
"urn:composition:deployment.timeout" and defaults to 1000 msec if
+ * undefined.
+ *
+ * @return the default deployment timeout value
+ */
+ long getDeploymentTimeout();
+
+ /**
+ * Return the set of services produced by the model.
+ *
+ * @return the services
+ */
ServiceDescriptor[] getServices();

- /**
- * Return TRUE is this model is capable of supporting a supplied
- * depedendency.
- * @return true if this model can fulfill the dependency
- */
+ /**
+ * Return TRUE is this model is capable of supporting a supplied
depedendency.
+ *
+ * @return true if this model can fulfill the dependency
+ */
boolean isaCandidate( DependencyDescriptor dependency );

- /**
- * Return TRUE is this model is capable of supporting a supplied
- * service.
- *
- * @param reference the service reference descriptor
- * @return true if this model can fulfill the service
- */
+ /**
+ * Return TRUE is this model is capable of supporting a supplied service.
+ *
+ * @param reference the service reference descriptor
+ *
+ * @return true if this model can fulfill the service
+ */
boolean isaCandidate( ReferenceDescriptor reference );

- //-----------------------------------------------------------
- // composite assembly
- //-----------------------------------------------------------
-
/**
* Returns the assembled state of the model.
+ *
* @return true if this model is assembled
*/
boolean isAssembled();

- /**
- * Return the set of models consuming this model.
- * @return the consumers
- */
+ /**
+ * Return the set of models consuming this model.
+ *
+ * @return the consumers
+ */
DeploymentModel[] getConsumerGraph();

- /**
- * Return the set of models supplying this model.
- * @return the providers
- */
+ /**
+ * Return the set of models supplying this model.
+ *
+ * @return the providers
+ */
DeploymentModel[] getProviderGraph();

/**
* Return the set of models assigned as providers.
+ *
* @return the providers consumed by the model
- * @exception IllegalStateException if invoked prior to
- * the completion of the assembly phase
+ *
+ * @throws IllegalStateException if invoked prior to the completion of
the assembly phase
*/
DeploymentModel[] getProviders();
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DuplicateNameException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DuplicateNameException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/DuplicateNameException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -24,17 +23,16 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class DuplicateNameException
- extends ModelException
+public class DuplicateNameException extends ModelException
{
/**
* Construct a new <code>DuplicateNameException</code> instance.
*
* @param name The conflicting name.
*/
- public DuplicateNameException( final String name )
+ public DuplicateNameException( String name )
{
- super( name, null );
+ super( name );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/EntryModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/EntryModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/EntryModel.java
Tue Jun 28 08:36:24 2005
@@ -15,30 +15,29 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * <p>Specification of a context enty model from which a
- * a context value can be established.</p>
+ * <p>Specification of a context enty model from which a a context value can
be established.</p>
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface EntryModel
{
- /**
- * Return the context entry key.
- *
- * @return the key
- */
- String getKey();

- /**
- * Return the context entry value.
- *
- * @return the context entry value
- */
- Object getValue() throws ModelException;
+ /**
+ * Return the context entry key.
+ *
+ * @return the key
+ */
+ String getKey();

+ /**
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
+ Object getValue()
+ throws ModelException;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FatalCommissioningException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FatalCommissioningException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FatalCommissioningException.java
Tue Jun 28 08:36:24 2005
@@ -15,14 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * Exception raised in response to a fatal assembly failure.
- * If this exception is thrown, it is probable that the entire
- * JVM is not stable, and the container should terminate execution
- * completely.
+ * Exception raised in response to a fatal assembly failure. If this
exception is thrown, it is probable that the entire
+ * JVM is not stable, and the container should terminate execution
completely.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
@@ -35,7 +32,7 @@
*
* @param message The detail message for this exception.
*/
- public FatalCommissioningException( final String message )
+ public FatalCommissioningException( String message )
{
this( message, null );
}
@@ -43,12 +40,12 @@
/**
* Construct a new <code>FatalCommissioningException</code> instance.
*
- * @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
*/
- public FatalCommissioningException( final String message, final
Throwable throwable )
+ public FatalCommissioningException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FileSelector.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FileSelector.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FileSelector.java
Tue Jun 28 08:36:24 2005
@@ -15,15 +15,13 @@
* limitations under the License.
*
*/
-
package net.dpml.composition.model;

import java.io.File;

-
/**
* Interface used by implementations to filter files from candidate lists.
- *
+ *
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
@@ -31,14 +29,13 @@
{

/**
- * Method that each selector will implement to create their
- * selection behaviour.
+ * Method that each selector will implement to create their selection
behaviour.
*
- * @param basedir A java.io.File object for the base directory
+ * @param basedir A java.io.File object for the base directory
* @param filename The name of the file to check
- * @param file A File object for this filename
+ * @param file A File object for this filename
+ *
* @return whether the file should be selected or not
*/
- boolean isSelected(File basedir, String filename, File file);
-
+ boolean isSelected( File basedir, String filename, File file );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FilesetModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FilesetModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/FilesetModel.java
Tue Jun 28 08:36:24 2005
@@ -15,26 +15,24 @@
* limitations under the License.
*
*/
-
package net.dpml.composition.model;

import java.io.IOException;

/**
- * <p>Specification of a fileset model from which a
- * a set of included and excluded file directives can be resolved
- * into set of fully qualifed filenames for purposes of establishing
- * a classpath.</p>
+ * <p>Specification of a fileset model from which a a set of included and
excluded file directives can be resolved into
+ * set of fully qualifed filenames for purposes of establishing a
classpath.</p>
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface FilesetModel
{
+
/**
- * Resolves the specified include and exclude directives from
- * the base directory anchor and produces an array of files
- * to include in the classpath.
+ * Resolves the specified include and exclude directives from the base
directory anchor and produces an array of
+ * files to include in the classpath.
*/
- void resolveFileset() throws IOException, IllegalStateException;
+ void resolveFileset()
+ throws IOException, IllegalStateException;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -24,36 +23,27 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class ModelException
- extends Exception
+public class ModelException extends Exception
{
- private final Throwable m_cause;
-
/**
* Construct a new <code>ModelException</code> instance.
*
* @param message The detail message for this exception.
*/
- public ModelException( final String message )
+ public ModelException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ModelException</code> instance.
*
- * @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
*/
- public ModelException( final String message, final Throwable throwable )
- {
- super( message );
- m_cause = throwable;
- }
-
- public Throwable getCause()
+ public ModelException( String message, Throwable cause )
{
- return m_cause;
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelRepository.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelRepository.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelRepository.java
Tue Jun 28 08:36:24 2005
@@ -15,26 +15,26 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;

/**
- * The model repository interface declares operations through which
- * clients may resolve new or existing model instances relative to
- * a service dependency.
+ * The model repository interface declares operations through which clients
may resolve new or existing model instances
+ * relative to a service dependency.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface ModelRepository
{
+
/**
* Locate an model matching the supplied name.
*
* @param name the model name
+ *
* @return the model or null if the model name is unknown
*/
DeploymentModel getModel( String name );
@@ -43,6 +43,7 @@
* Locate a model meeting the supplied criteria.
*
* @param dependency a component service dependency
+ *
* @return the model
*/
DeploymentModel getModel( DependencyDescriptor dependency );
@@ -51,6 +52,7 @@
* Locate a model meeting the supplied service criteria.
*
* @param reference a version interface descriptor
+ *
* @return the model
*/
DeploymentModel getModel( ReferenceDescriptor reference );
@@ -59,6 +61,7 @@
* Locate all models meeting the supplied dependency criteria.
*
* @param dependency a component service dependency
+ *
* @return the candidate models
*/
DeploymentModel[] getCandidateProviders( DependencyDescriptor dependency
);
@@ -67,6 +70,7 @@
* Locate all models meeting the supplied service reference criteria.
*
* @param reference a service reference
+ *
* @return the candidate models
*/
DeploymentModel[] getCandidateProviders( ReferenceDescriptor reference );
@@ -75,17 +79,20 @@
* Add an model to the repository.
*
* @param model the model to add
- * @exception DuplicateNameException if the name is already bound
+ *
+ * @throws DuplicateNameException if the name is already bound
*/
- void addModel( DeploymentModel model ) throws DuplicateNameException;
+ void addModel( DeploymentModel model )
+ throws DuplicateNameException;

/**
* Add an model to the repository.
*
- * @param name the name to register the model under
+ * @param name the name to register the model under
* @param model the model to add
*/
- void addModel( String name, DeploymentModel model ) throws
DuplicateNameException;
+ void addModel( String name, DeploymentModel model )
+ throws DuplicateNameException;

/**
* Remove a named model from the repository.
@@ -106,6 +113,5 @@
*
* @return the model
*/
- public DeploymentModel[] getModels();
-
+ DeploymentModel[] getModels();
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelRuntimeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelRuntimeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelRuntimeException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -24,36 +23,27 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class ModelRuntimeException
- extends RuntimeException
+public class ModelRuntimeException extends RuntimeException
{
- private final Throwable m_cause;
-
/**
* Construct a new <code>ModelRuntimeException</code> instance.
*
* @param message The detail message for this exception.
*/
- public ModelRuntimeException( final String message )
+ public ModelRuntimeException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ModelRuntimeException</code> instance.
*
- * @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
*/
- public ModelRuntimeException( final String message, final Throwable
throwable )
+ public ModelRuntimeException( String message, Throwable cause )
{
super( message );
- m_cause = throwable;
- }
-
- public Throwable getCause()
- {
- return m_cause;
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelSelector.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelSelector.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ModelSelector.java
Tue Jun 28 08:36:24 2005
@@ -15,43 +15,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;

/**
- * Interface implemented by a service selection implementation mechanism.
Classes
- * implementing the selector interface may be activated during the selection
of
- * candidate service providers in an automated assembly process.
- * A component author may declare a selection class explicitly via a
- * service dependency attribute with the attribute name of
- * <code>urn:metro:profile.selector</code> (but this will change to a model
- * driven approach).
+ * Interface implemented by a service selection implementation mechanism.
Classes implementing the selector interface
+ * may be activated during the selection of candidate service providers in
an automated assembly process. A component
+ * author may declare a selection class explicitly via a service dependency
attribute with the attribute name of
+ * <code>urn:metro:profile.selector</code> (but this will change to a model
driven approach).
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface ModelSelector
{
+
/**
- * Returns the preferred model from an available selection of
- * candidates capable of fulfilling a supplied service dependency.
+ * Returns the preferred model from an available selection of candidates
capable of fulfilling a supplied service
+ * dependency.
*
- * @param models the set of candidate models
+ * @param models the set of candidate models
* @param dependency a service dependency
- * @return the preferred model or null if no satisfactory provider
- * can be established
+ *
+ * @return the preferred model or null if no satisfactory provider can
be established
*/
DeploymentModel select( DeploymentModel[] models, DependencyDescriptor
dependency );

/**
* Returns the preferred model from an available selection of candidates
- * @param models the set of candidate models
+ *
+ * @param models the set of candidate models
* @param reference the versioned service reference
- * @return the preferred provider or null if no satisfactory provider
- * can be established
+ *
+ * @return the preferred provider or null if no satisfactory provider
can be established
*/
DeploymentModel select( DeploymentModel[] models, ReferenceDescriptor
reference );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileDuplicateException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileDuplicateException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileDuplicateException.java
Tue Jun 28 08:36:24 2005
@@ -15,18 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * Exception raised in response to an attempt to override the defintion
- * of an existing profile.
+ * Exception raised in response to an attempt to override the defintion of
an existing profile.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class ProfileDuplicateException
- extends ProfileException
+public final class ProfileDuplicateException extends ProfileException
{

/**
@@ -34,20 +31,20 @@
*
* @param message The detail message for this exception.
*/
- public ProfileDuplicateException( final String message )
+ public ProfileDuplicateException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ProfileDuplicateException</code> instance.
*
- * @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
*/
- public ProfileDuplicateException( final String message, final Throwable
throwable )
+ public ProfileDuplicateException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -32,20 +31,20 @@
*
* @param message The detail message for this exception.
*/
- public ProfileException( final String message )
+ public ProfileException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ProfileException</code> instance.
*
- * @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
*/
- public ProfileException( final String message, final Throwable throwable
)
+ public ProfileException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileSelector.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileSelector.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileSelector.java
Tue Jun 28 08:36:24 2005
@@ -15,13 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.composition.data.DeploymentProfile;
-
-import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
+import net.dpml.meta.info.ReferenceDescriptor;

/**
* Interface defining the contract for profile selection.
@@ -31,26 +29,24 @@
*/
public interface ProfileSelector
{
+
/**
- * Returns the preferred profile from an available selection of
- * candidates profiles.
+ * Returns the preferred profile from an available selection of
candidates profiles.
*
- * @param profiles the set of candidate profiles
+ * @param profiles the set of candidate profiles
* @param dependency a service dependency
- * @return the preferred profile or null if no satisfactory profile
- * can be established
+ *
+ * @return the preferred profile or null if no satisfactory profile can
be established
*/
DeploymentProfile select( DeploymentProfile[] profiles,
DependencyDescriptor dependency );

/**
- * Returns the preferred profile from an available selection of
- * candidates profiles.
+ * Returns the preferred profile from an available selection of
candidates profiles.
*
- * @param profiles the set of candidate profiles
+ * @param profiles the set of candidate profiles
* @param reference a service reference
- * @return the preferred profile or null if
- * no satisfactory profile can be established
+ *
+ * @return the preferred profile or null if no satisfactory profile can
be established
*/
DeploymentProfile select( DeploymentProfile[] profiles,
ReferenceDescriptor reference );
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileUnknownException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileUnknownException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProfileUnknownException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -24,7 +23,7 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public final class ProfileUnknownException extends ProfileException
+public class ProfileUnknownException extends ProfileException
{

/**
@@ -32,20 +31,20 @@
*
* @param message The detail message for this exception.
*/
- public ProfileUnknownException( final String message )
+ public ProfileUnknownException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ProfileUnknownException</code> instance.
*
- * @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
*/
- public ProfileUnknownException( final String message, final Throwable
throwable )
+ public ProfileUnknownException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProviderNotFoundException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProviderNotFoundException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ProviderNotFoundException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -32,18 +31,18 @@
*
* @param message The detail message for this exception.
*/
- public ProviderNotFoundException( final String message )
+ public ProviderNotFoundException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ProviderNotFoundException</code> instance.
*
- * @param message The detail message for this exception.
+ * @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public ProviderNotFoundException( final String message, final Throwable
throwable )
+ public ProviderNotFoundException( String message, Throwable throwable )
{
super( message, throwable );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Reclaimer.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Reclaimer.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Reclaimer.java
Tue Jun 28 08:36:24 2005
@@ -15,20 +15,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * Interface implementated by an handler that supports
- * instance release.
+ * Interface implementated by an handler that supports instance release.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface Reclaimer
{
- /**
- * Release the reclaimable object.
- */
+
+ /**
+ * Release the reclaimable object.
+ */
void release();
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Resolver.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Resolver.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/Resolver.java
Tue Jun 28 08:36:24 2005
@@ -15,41 +15,44 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * The Resolver interface defines the contract for instance access and
- * release.
+ * The Resolver interface defines the contract for instance access and
release.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface Resolver
{
+
/**
* Resolve a object to a value.
*
* @return the resolved object
+ *
* @throws Exception if an error occurs
*/
- Object resolve() throws Exception;
+ Object resolve()
+ throws Exception;

/**
* Resolve a object to a value.
*
- * @param proxy if TRUE ruturn a proxied reference if the underlying
component
- * suppports proxied representation otherwise return the raw component
instance
+ * @param proxy if TRUE ruturn a proxied reference if the underlying
component suppports proxied representation
+ * otherwise return the raw component instance
+ *
* @return the resolved object
+ *
* @throws Exception if an error occurs
*/
- Object resolve( boolean proxy ) throws Exception;
+ Object resolve( boolean proxy )
+ throws Exception;

- /**
- * Release an object.
- *
- * @param instance the object to release
- */
+ /**
+ * Release an object.
+ *
+ * @param instance the object to release
+ */
void release( Object instance );
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceDuplicateException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceDuplicateException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceDuplicateException.java
Tue Jun 28 08:36:24 2005
@@ -15,12 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * Exception raised in response to an attempt to override
- * an existing service defintion.
+ * Exception raised in response to an attempt to override an existing
service defintion.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
@@ -33,18 +31,18 @@
*
* @param message The detail message for this exception.
*/
- public ServiceDuplicateException( final String message )
+ public ServiceDuplicateException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ServiceDuplicateException</code> instance.
*
- * @param message The detail message for this exception.
+ * @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public ServiceDuplicateException( final String message, final Throwable
throwable )
+ public ServiceDuplicateException( String message, Throwable throwable )
{
super( message, throwable );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -32,18 +31,18 @@
*
* @param message The detail message for this exception.
*/
- public ServiceException( final String message )
+ public ServiceException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>ServiceException</code> instance.
*
- * @param message The detail message for this exception.
+ * @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public ServiceException( final String message, final Throwable throwable
)
+ public ServiceException( String message, Throwable throwable )
{
super( message, throwable );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceModel.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.composition.data.ServiceDirective;
@@ -28,22 +27,25 @@
*/
public interface ServiceModel
{
- /**
- * Return the service directive for the model.
- *
- * @return the directive declaring the service export
- */
+
+ /**
+ * Return the service directive for the model.
+ *
+ * @return the directive declaring the service export
+ */
ServiceDirective getServiceDirective();

- /**
- * Return the service class.
- * @return the service class
- */
+ /**
+ * Return the service class.
+ *
+ * @return the service class
+ */
Class getServiceClass();

- /**
- * Return the service provider.
- * @return the model identifying the provider implementation
- */
- public DeploymentModel getServiceProvider();
+ /**
+ * Return the service provider.
+ *
+ * @return the model identifying the provider implementation
+ */
+ DeploymentModel getServiceProvider();
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceRepository.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceRepository.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/ServiceRepository.java
Tue Jun 28 08:36:24 2005
@@ -15,45 +15,45 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

-import net.dpml.meta.info.Version;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.Service;
+import net.dpml.meta.info.Version;

/**
- * A service repository provides support for the storage and retrival
- * of service defintions.
+ * A service repository provides support for the storage and retrival of
service defintions.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface ServiceRepository
{
+
/**
- * Locate a {@link Service} instances associated with the
- * supplied classname and version. If a service defintion is not
- * found locally, the implementation redirects the request to
- * the parent service manager.
+ * Locate a {@link Service} instances associated with the supplied
classname and version. If a service defintion is
+ * not found locally, the implementation redirects the request to the
parent service manager.
*
* @param classname the service class name
- * @param version the service version
+ * @param version the service version
+ *
* @return the service matching the supplied classname and version.
- * @exception UnknownServiceException if a matching service cannot be
found
+ *
+ * @throws UnknownServiceException if a matching service cannot be found
*/
- Service getService( String classname, Version version ) throws
UnknownServiceException ;
+ Service getService( String classname, Version version )
+ throws UnknownServiceException;

/**
- * Locate a {@link Service} instances associated with the
- * supplied referecne descriptor. If a service defintion is not
- * found locally, the implementation redirects the request to
- * the parent service manager.
+ * Locate a {@link Service} instances associated with the supplied
referecne descriptor. If a service defintion is
+ * not found locally, the implementation redirects the request to the
parent service manager.
*
* @param reference the reference descriptor
+ *
* @return the service matching the supplied descriptor.
- * @exception UnknownServiceException if a matching service cannot be
found
+ *
+ * @throws UnknownServiceException if a matching service cannot be found
*/
Service getService( ReferenceDescriptor reference )
- throws UnknownServiceException ;
+ throws UnknownServiceException;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TransientRuntimeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TransientRuntimeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TransientRuntimeException.java
Tue Jun 28 08:36:24 2005
@@ -15,37 +15,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * Exception to indicate that there was a transient service error. The
- * exception exposes a delay value which is the anticipated delay in
- * service availability. A delay value of 0 indicates an unknown delay.
+ * Exception to indicate that there was a transient service error. The
exception exposes a delay value which is the
+ * anticipated delay in service availability. A delay value of 0 indicates
an unknown delay.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class TransientRuntimeException extends RuntimeException
+public class TransientRuntimeException extends RuntimeException
{
- private final long m_delay;
+
+ private final long m_delay;

/**
* Construct a new <code>TransientRuntimeException</code> instance.
*
* @param message The detail message for this exception.
- * @param delay expected service availability delay in milliseconds
+ * @param delay expected service availability delay in milliseconds
*/
- public TransientRuntimeException( final String message, long delay )
+ public TransientRuntimeException( String message, long delay )
{
super( message );
m_delay = delay;
}

- /**
- * Returns the expected duration of service non-availability.
- * @return the non-availability duration
- */
+ /**
+ * Returns the expected duration of service non-availability.
+ *
+ * @return the non-availability duration
+ */
public long getDelay()
{
return m_delay;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeDuplicateException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeDuplicateException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeDuplicateException.java
Tue Jun 28 08:36:24 2005
@@ -15,12 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * Exception raised in response to an attempt to override the defintion
- * of an existing type.
+ * Exception raised in response to an attempt to override the defintion of
an existing type.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
@@ -33,20 +31,20 @@
*
* @param message The detail message for this exception.
*/
- public TypeDuplicateException( final String message )
+ public TypeDuplicateException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>TypeDuplicateException</code> instance.
*
- * @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
*/
- public TypeDuplicateException( final String message, final Throwable
throwable )
+ public TypeDuplicateException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -32,20 +31,20 @@
*
* @param message The detail message for this exception.
*/
- public TypeException( final String message )
+ public TypeException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>TypeException</code> instance.
*
- * @param message The detail message for this exception.
- * @param throwable the root cause of the exception
+ * @param message The detail message for this exception.
+ * @param cause the root cause of the exception
*/
- public TypeException( final String message, final Throwable throwable )
+ public TypeException( String message, Throwable cause )
{
- super( message, throwable );
+ super( message, cause );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeRepository.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeRepository.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeRepository.java
Tue Jun 28 08:36:24 2005
@@ -15,129 +15,144 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.DeploymentProfile;
-
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.ReferenceDescriptor;
import net.dpml.meta.info.Type;

/**
- * A type manager implementation provides support for the creation,
- * storage and retrival of component types.
+ * A type manager implementation provides support for the creation, storage
and retrival of component types.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
public interface TypeRepository
{
+
/**
* Return all availble types.
+ *
* @return the array of types
*/
Type[] getTypes();

/**
* Return all the types available within the repository.
- * @param policy if TRUE, return all available types, if FALSE
- * return only the locally established types.
+ *
+ * @param policy if TRUE, return all available types, if FALSE return
only the locally established types.
+ *
* @return the array of types
*/
Type[] getTypes( boolean policy );

/**
- * Locate a {@link Type} instances associated with the
- * supplied implementation classname.
+ * Locate a {@link Type} instances associated with the supplied
implementation classname.
+ *
* @param clazz the component type implementation class.
+ *
* @return the type matching the supplied implementation classname.
- * @exception TypeUnknownException if a matching type cannot be found
+ *
+ * @throws TypeUnknownException if a matching type cannot be found
*/
- Type getType( Class clazz ) throws TypeUnknownException;
+ Type getType( Class clazz )
+ throws TypeUnknownException;

/**
- * Locate a {@link Type} instances associated with the
- * supplied implementation classname.
+ * Locate a {@link Type} instances associated with the supplied
implementation classname.
+ *
* @param classname the component type implementation class name.
+ *
* @return the type matching the supplied implementation classname.
- * @exception TypeUnknownException if a matching type cannot be found
+ *
+ * @throws TypeUnknownException if a matching type cannot be found
*/
- Type getType( String classname ) throws TypeUnknownException;
+ Type getType( String classname )
+ throws TypeUnknownException;

/**
- * Locate the set of component types capable of services the supplied
- * dependency.
+ * Locate the set of component types capable of services the supplied
dependency.
+ *
* @param dependency a service dependency descriptor
+ *
* @return a set of types capable of servicing the supplied dependency
*/
Type[] getTypes( DependencyDescriptor dependency );

- /**
- * Locate the set of component types capable of services the supplied
- * dependency.
- * @param dependency a service dependency descriptor
- * @param search if TRUE then search for solution using the parent
repository
- * @return a set of types capable of servicing the supplied dependency
- */
+ /**
+ * Locate the set of component types capable of services the supplied
dependency.
+ *
+ * @param dependency a service dependency descriptor
+ * @param search if TRUE then search for solution using the parent
repository
+ *
+ * @return a set of types capable of servicing the supplied dependency
+ */
Type[] getTypes( DependencyDescriptor dependency, boolean search );

- /**
- * Locate the set of component types capable of services the supplied
- * reference.
- * @param reference a service reference descriptor
- * @return a set of types capable of servicing the supplied service
reference
- */
+ /**
+ * Locate the set of component types capable of services the supplied
reference.
+ *
+ * @param reference a service reference descriptor
+ *
+ * @return a set of types capable of servicing the supplied service
reference
+ */
Type[] getTypes( ReferenceDescriptor reference );

/**
- * Locate the set of component types capable of services the supplied
- * reference.
+ * Locate the set of component types capable of services the supplied
reference.
+ *
* @param reference a service reference descriptor
+ *
* @return a set of types capable of servicing the supplied service
reference
*/
Type[] getTypes( ReferenceDescriptor reference, boolean search );

- /**
- * Return the set of deployment profiles for the supplied type. An
- * implementation is required to return a array of types > 0 in length
- * or throw a TypeUnknownException.
- * @param type the type
- * @return a profile array containing at least one deployment profile
- * @exception TypeUnknownException if the supplied type is unknown
- */
- ComponentProfile[] getProfiles( Type type ) throws TypeUnknownException;
-
- /**
- * Return a deployment profile for the supplied type and key.
- * @param type the type
- * @param key the profile name
- * @return a profile matching the supplied key
- * @exception TypeUnknownException if the supplied type is unknown
- * @exception ProfileUnknownException if the supplied key is unknown
- */
+ /**
+ * Return the set of deployment profiles for the supplied type. An
implementation is required to return a array of
+ * types > 0 in length or throw a TypeUnknownException.
+ *
+ * @param type the type
+ *
+ * @return a profile array containing at least one deployment profile
+ *
+ * @throws TypeUnknownException if the supplied type is unknown
+ */
+ ComponentProfile[] getProfiles( Type type )
+ throws TypeUnknownException;
+
+ /**
+ * Return a deployment profile for the supplied type and key.
+ *
+ * @param type the type
+ * @param key the profile name
+ *
+ * @return a profile matching the supplied key
+ *
+ * @throws TypeUnknownException if the supplied type is unknown
+ * @throws ProfileUnknownException if the supplied key is unknown
+ */
ComponentProfile getProfile( Type type, String key )
- throws TypeUnknownException, ProfileUnknownException;
-
- /**
- * Attempt to locate a packaged deployment profile meeting the
- * supplied dependency description.
- *
- * @param dependency the dependency description
- * @param search include profiles from parent repository in selection
- * @return the deployment profile (possibly null)
- */
- DeploymentProfile getProfile(
- DependencyDescriptor dependency, boolean search );
-
- /**
- * Return a set of local deployment profile for the supplied dependency.
- * @param dependency the dependency descriptor
- * @param search include profiles from parent repository in selection
- * @return a set of profiles matching the supplied dependency
- */
- DeploymentProfile[] getProfiles( DependencyDescriptor dependency,
boolean search );
+ throws TypeUnknownException, ProfileUnknownException;

+ /**
+ * Attempt to locate a packaged deployment profile meeting the supplied
dependency description.
+ *
+ * @param dependency the dependency description
+ * @param search include profiles from parent repository in selection
+ *
+ * @return the deployment profile (possibly null)
+ */
+ DeploymentProfile getProfile( DependencyDescriptor dependency, boolean
search );

+ /**
+ * Return a set of local deployment profile for the supplied dependency.
+ *
+ * @param dependency the dependency descriptor
+ * @param search include profiles from parent repository in selection
+ *
+ * @return a set of profiles matching the supplied dependency
+ */
+ DeploymentProfile[] getProfiles( DependencyDescriptor dependency,
boolean search );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeRuntimeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeRuntimeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeRuntimeException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -32,18 +31,18 @@
*
* @param message The detail message for this exception.
*/
- public TypeRuntimeException( final String message )
+ public TypeRuntimeException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>TypeRuntimeException</code> instance.
*
- * @param message The detail message for this exception.
+ * @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public TypeRuntimeException( final String message, final Throwable
throwable )
+ public TypeRuntimeException( String message, Throwable throwable )
{
super( message, throwable );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeUnknownException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeUnknownException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/TypeUnknownException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
@@ -32,21 +31,20 @@
*
* @param message The detail message for this exception.
*/
- public TypeUnknownException( final String message )
+ public TypeUnknownException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>TypeUnknownException</code> instance.
*
- * @param message The detail message for this exception.
+ * @param message The detail message for this exception.
* @param throwable the root cause of the exception
*/
- public TypeUnknownException( final String message, final Throwable
throwable )
+ public TypeUnknownException( String message, Throwable throwable )
{
super( message, throwable );
}
-
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/UnknownServiceException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/UnknownServiceException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/api/src/main/net/dpml/composition/model/UnknownServiceException.java
Tue Jun 28 08:36:24 2005
@@ -15,12 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model;

/**
- * Exception to indicate that a service defintioon is unknown within
- * the scope of a service manager.
+ * Exception to indicate that a service defintioon is unknown within the
scope of a service manager.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
@@ -32,9 +30,9 @@
*
* @param message The detail message for this exception.
*/
- public UnknownServiceException( final String message )
+ public UnknownServiceException( String message )
{
- super( message, null );
+ super( message );
}
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/SerializedContainmentProfileWriter.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/SerializedContainmentProfileWriter.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/SerializedContainmentProfileWriter.java
Tue Jun 28 08:36:24 2005
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.data.writer;

import net.dpml.composition.data.ContainmentProfile;
@@ -22,23 +21,24 @@
import java.io.ObjectOutputStream;
import java.io.OutputStream;

-
/**
-* Write {@link ContainmentProfile} objects to a stream as serialized objects.
-*
-* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
-* @version $Id$
-*/
+ * Write {@link ContainmentProfile} objects to a stream as serialized
objects.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id$
+ */
public class SerializedContainmentProfileWriter
implements ContainmentProfileWriter
{
+
/**
- * Write a {@link ContainmentProfile} to a stream
- *
- * @param profile the profile instance
- * @param stream the destination stream
- * @throws Exception if an error occurs while writting to the stream
- */
+ * Write a {@link ContainmentProfile} to a stream
+ *
+ * @param profile the profile instance
+ * @param stream the destination stream
+ *
+ * @throws Exception if an error occurs while writting to the stream
+ */
public void writeContainmentProfile( ContainmentProfile profile,
OutputStream stream )
throws Exception
{

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLComponentProfileWriter.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLComponentProfileWriter.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLComponentProfileWriter.java
Tue Jun 28 08:36:24 2005
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.data.writer;

import net.dpml.composition.data.ComponentProfile;
@@ -35,82 +34,106 @@
import java.io.IOException;
import java.io.Writer;

-
/**
-* Write a {@link ComponentProfile} to a stream as xml documents.
-*
-* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
-* @version $Id$
-*/
+ * Write a {@link ComponentProfile} to a stream as xml documents.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id$
+ */
public class XMLComponentProfileWriter
{

public static final String INDENT = " ";

/**
- * Write out a containment deployment profile to XML.
- * @param writer the writer
- * @throws IOException if unable to write xml
- */
+ * Write out a containment deployment profile to XML.
+ *
+ * @param writer the writer
+ *
+ * @throws IOException if unable to write xml
+ */
protected void writeComponentProfile( Writer writer, ComponentProfile
profile, String pad )
- throws Exception
+ throws Exception
{
//
// write the component declaration
//

- writer.write( pad + "<component name=\"" + profile.getName() + "\"");
- writer.write( "\n" + pad + " class=\"" + profile.getClassname() +
"\"");
-
+ writer.write( pad );
+ writer.write( "<component name=\"" );
+ writer.write( profile.getName() );
+ writer.write( "\"" );
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( "\" class=\"" );
+ writer.write( profile.getClassname() );
+ writer.write( "\"" );
int activation = profile.getActivationDirective();
if( activation != DeploymentProfile.DEFAULT )
{
if( activation == DeploymentProfile.ENABLED )
{
- writer.write( "\n" + pad + " activation=\"false\"" );
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( " activation=\"false\"" );
}
else
{
- writer.write( "\n" + pad + " activation=\"true\"" );
- }
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( " activation=\"true\"" );
+ }
}
-
int collection = profile.getCollectionPolicy();
if( collection > InfoDescriptor.UNDEFINED )
{
- writer.write(
- "\n" + pad
- + " collection=\""
- + InfoDescriptor.getCollectionPolicyKey( collection )
- + "\"" );
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( " collection=\"" );
+ writer.write( InfoDescriptor.getCollectionPolicyKey( collection
) );
+ writer.write( "\"" );
}
-
- if( ( profile.getContext() == null )
- && ( isEmptyConfiguration( profile.getConfiguration() ) ) && (
profile.getParameters() == null ))
+ ContextDirective context = profile.getContext();
+ Configuration configuration = profile.getConfiguration();
+ Parameters parameters = profile.getParameters();
+ boolean noParameters = parameters == null;
+ boolean noConfiguration = isEmptyConfiguration( configuration );
+ boolean noContext = context == null;
+ if( noContext && noConfiguration && noParameters )
{
- writer.write( "/>");
+ writer.write( "/>" );
}
else
{
writer.write( ">" );
String padding = pad + INDENT;
writeDeploymentBody( writer, profile, padding );
- writer.write( "\n" + pad + "</component>" );
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( "</component>" );
}
}

private boolean isEmptyConfiguration( Configuration config )
{
- if( config == null ) return true;
- if( config.getChildren().length > 0 ) return false;
+ if( config == null )
+ {
+ return true;
+ }
+ if( config.getChildren().length > 0 )
+ {
+ return false;
+ }
return config.getAttributeNames().length == 0;
}

/**
- * Write out a containment deployment content.
- * @param writer the writer
- * @throws IOException if unable to write xml
- */
+ * Write out a containment deployment content.
+ *
+ * @param writer the writer
+ *
+ * @throws IOException if unable to write xml
+ */
protected void writeDeploymentBody( Writer writer, ComponentProfile
profile, String pad )
throws Exception
{
@@ -125,60 +148,78 @@
}

/**
- * Write out xml representation of the dependency directives.
- *
- * @param writer the writer
- * @param dependencies the dependency directives
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of the dependency directives.
+ *
+ * @param writer the writer
+ * @param dependencies the dependency directives
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeDependencies( Writer writer, DependencyDirective[]
dependencies, String pad )
throws IOException
{
- if( dependencies.length == 0 ) return;
- writer.write( "\n" + pad + "<dependencies>" );
+ if( dependencies.length == 0 )
+ {
+ return;
+ }
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( "<dependencies>" );
String padding = pad + INDENT;
- for( int i=0; i<dependencies.length; i++ )
+ for( int i = 0; i < dependencies.length; i++ )
{
- writeDependency( writer, dependencies[i], padding );
+ writeDependency( writer, dependencies[ i ], padding );
}
- writer.write( "\n" + pad + "</dependencies>" );
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( "</dependencies>" );
}

/**
- * Write out xml representation of a dependency directive.
- *
- * @param writer the writer
- * @param dependency the dependency directive
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a dependency directive.
+ *
+ * @param writer the writer
+ * @param dependency the dependency directive
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeDependency( Writer writer, DependencyDirective
dependency, String pad )
throws IOException
{
- writer.write( "\n" + pad + "<dependency key=\"" +
dependency.getKey() + "\"" );
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( "<dependency key=\"" );
+ writer.write( dependency.getKey() );
+ writer.write( "\"" );
if( dependency.getSource() != null )
{
- writer.write( " source=\"" + dependency.getSource() + "\"/>" );
+ writer.write( " source=\"" );
+ writer.write( dependency.getSource() );
+ writer.write( "\"/>" );
}
else
{
writer.write( ">" );
SelectionDirective[] features =
dependency.getSelectionDirectives();
String padding = pad + INDENT;
- for( int i=0; i<features.length; i++ )
+ for( int i = 0; i < features.length; i++ )
{
- writeSelectionDirective( writer, features[i], padding );
+ writeSelectionDirective( writer, features[ i ], padding );
}
- writer.write( "\n" + pad + "</dependency>" );
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( "</dependency>" );
}
}

/**
- * Write out xml representation of a selection directive.
- *
- * @param writer the writer
- * @param feature the dependency selection directive
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a selection directive.
+ *
+ * @param writer the writer
+ * @param feature the dependency selection directive
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeSelectionDirective( Writer writer, SelectionDirective
feature, String pad )
throws IOException
{
@@ -202,12 +243,13 @@
}

/**
- * Write out xml representation of the configuration
- *
- * @param writer the writer
- * @param config the type info descriptor
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of the configuration
+ *
+ * @param writer the writer
+ * @param config the type info descriptor
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeConfiguration( Writer writer, Configuration config,
String pad )
throws IOException
{
@@ -220,13 +262,14 @@
}

/**
- * Write out xml representation of a context directive
- *
- * @param writer the writer
- * @param context the context directive
- * @param pad the whitespace padding string
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a context directive
+ *
+ * @param writer the writer
+ * @param context the context directive
+ * @param pad the whitespace padding string
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeContext( Writer writer, ContextDirective context,
String pad )
throws IOException
{
@@ -234,7 +277,6 @@
{
return;
}
-
writer.write( "\n" );
writer.write( pad );
writer.write( "<context" );
@@ -244,9 +286,7 @@
writer.write( context.getClassname() );
writer.write( "\"" );
}
-
EntryDirective[] entries = context.getEntryDirectives();
-
if( entries.length == 0 )
{
writer.write( "/>" );
@@ -254,37 +294,39 @@
}
else
{
- writer.write( ">");
+ writer.write( ">" );
String padding = pad + INDENT;

//
// write out the entry directives
//

- for( int i=0; i<entries.length; i++ )
+ for( int i = 0; i < entries.length; i++ )
{
- EntryDirective entry = entries[i];
+ EntryDirective entry = entries[ i ];
writeEntryDirective( writer, entry, padding );
}
- writer.write( "\n" + pad + "</context>" );
+ writer.write( "\n" );
+ writer.write( pad );
+ writer.write( "</context>" );
}
}

/**
- * Write out xml representation of a entry directive
- *
- * @param writer the writer
- * @param entry the entry directive
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a entry directive
+ *
+ * @param writer the writer
+ * @param entry the entry directive
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeEntryDirective( Writer writer, EntryDirective entry,
String pad )
throws IOException
{
String padding = pad + INDENT;
writer.write( "\n" );
writer.write( pad );
- writer.write( "<entry" );
- writer.write( " key=\"" );
+ writer.write( "<entry key=\"" );
writer.write( entry.getKey() );
writer.write( "\">" );
if( entry instanceof ImportDirective )
@@ -296,7 +338,7 @@
writer.write( imp.getImportKey() );
writer.write( "\"/>" );
}
- else if( entry instanceof ConstructorDirective )
+ else if( entry instanceof ConstructorDirective )
{
String fill = padding + INDENT;
ConstructorDirective cd = (ConstructorDirective) entry;
@@ -329,28 +371,30 @@
}

/**
- * Write out xml representation of a set of parameters.
- *
- * @param writer the writer
- * @param params the set of parameters
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a set of parameters.
+ *
+ * @param writer the writer
+ * @param params the set of parameters
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeParams( Writer writer, Parameter[] params, String pad )
throws IOException
{
- for( int i=0; i<params.length; i++ )
+ for( int i = 0; i < params.length; i++ )
{
- writeParam( writer, params[i], pad );
+ writeParam( writer, params[ i ], pad );
}
}

/**
- * Write out xml representation of a set of a single parameter.
- *
- * @param writer the writer
- * @param param the parameter
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a set of a single parameter.
+ *
+ * @param writer the writer
+ * @param param the parameter
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeParam( Writer writer, Parameter param, String pad )
throws IOException
{
@@ -384,12 +428,13 @@
}

/**
- * Write out xml representation of a set of parameters
- *
- * @param writer the writer
- * @param params the parameters
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a set of parameters
+ *
+ * @param writer the writer
+ * @param params the parameters
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeParameters( Writer writer, Parameters params, String
pad )
throws IOException, ParameterException
{
@@ -402,9 +447,9 @@
writer.write( "\n" );
writer.write( pad );
writer.write( "<parameters>" );
- for( int i=0; i<names.length; i++ )
+ for( int i = 0; i < names.length; i++ )
{
- String name = names[i];
+ String name = names[ i ];
String value = params.getParameter( name );
writer.write( "\n" );
writer.write( padding );

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLContainmentProfileWriter.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLContainmentProfileWriter.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLContainmentProfileWriter.java
Tue Jun 28 08:36:24 2005
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.data.writer;

import net.dpml.composition.data.BlockCompositionDirective;
@@ -29,9 +28,9 @@
import net.dpml.composition.data.IncludeDirective;
import net.dpml.composition.data.LibraryDirective;
import net.dpml.composition.data.ServiceDirective;
-import net.dpml.transit.artifact.Artifact;
-import net.dpml.meta.info.Version;
import net.dpml.meta.info.ReferenceDescriptor;
+import net.dpml.meta.info.Version;
+import net.dpml.transit.artifact.Artifact;

import java.io.BufferedWriter;
import java.io.IOException;
@@ -40,24 +39,26 @@
import java.io.Writer;

/**
-* Write {@link ContainmentProfile} objects to a stream as xml documents.
-*
-* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
-* @version $Id$
-*/
+ * Write {@link ContainmentProfile} objects to a stream as xml documents.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id$
+ */
public class XMLContainmentProfileWriter extends XMLComponentProfileWriter
{
+
/**
- * Write out a containment profile to xml.
- *
- * @param profile the type object
- * @param output the stream to write to
- * @throws Exception if unable to write xml
- */
+ * Write out a containment profile to xml.
+ *
+ * @param profile the type object
+ * @param output the stream to write to
+ *
+ * @throws Exception if unable to write xml
+ */
public void writeContainmentProfile( ContainmentProfile profile,
OutputStream output )
throws Exception
{
- OutputStreamWriter osr = new OutputStreamWriter( output );
+ OutputStreamWriter osr = new OutputStreamWriter( output,
"ISO-8859-1" );
BufferedWriter writer = new BufferedWriter( osr );
writeHeader( writer );
writeContainmentProfile( writer, profile, true, "" );
@@ -65,13 +66,14 @@
}

/**
- * Write out a containment profile to xml.
- *
- * @param writer the stream to write to
- * @param profile the containment profile to write
- * @param pad character offset
- * @throws Exception if unable to write xml
- */
+ * Write out a containment profile to xml.
+ *
+ * @param writer the stream to write to
+ * @param profile the containment profile to write
+ * @param pad character offset
+ *
+ * @throws Exception if unable to write xml
+ */
protected void writeContainmentProfile( Writer writer,
ContainmentProfile profile, String pad )
throws Exception
{
@@ -79,14 +81,15 @@
}

/**
- * Write out a containment profile to xml.
- *
- * @param writer the stream to write to
- * @param profile the containment profile to write
- * @param flag not used !
- * @param pad character offset
- * @throws Exception if unable to write xml
- */
+ * Write out a containment profile to xml.
+ *
+ * @param writer the stream to write to
+ * @param profile the containment profile to write
+ * @param flag not used !
+ * @param pad character offset
+ *
+ * @throws Exception if unable to write xml
+ */
protected void writeContainmentProfile( Writer writer,
ContainmentProfile profile, boolean flag, String pad )
throws Exception
{
@@ -94,7 +97,7 @@
writer.write( pad );
writer.write( "<container name=\"" );
writer.write( profile.getName() );
- writer.write( "\">");
+ writer.write( "\">" );
String padding = pad + INDENT;
writeServiceDirectives( writer, profile.getExportDirectives(),
padding );
writeClassLoader( writer, profile.getClassLoaderDirective(), padding
);
@@ -106,10 +109,12 @@
}

/**
- * Write the XML header.
- * @param writer the writer
- * @throws IOException if unable to write xml
- */
+ * Write the XML header.
+ *
+ * @param writer the writer
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeHeader( Writer writer )
throws IOException
{
@@ -117,13 +122,14 @@
}

/**
- * Write out xml representation of the info descriptor from a Type.
- *
- * @param writer the writer
- * @param services the service directives
- * @param pad character offset
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of the info descriptor from a Type.
+ *
+ * @param writer the writer
+ * @param services the service directives
+ * @param pad character offset
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeServiceDirectives( Writer writer, ServiceDirective[]
services, String pad )
throws IOException
{
@@ -131,7 +137,6 @@
{
return;
}
-
writer.write( "\n" );
writer.write( pad );
writer.write( "<services>" );
@@ -167,13 +172,14 @@
}

/**
- * Write out xml representation of the classloader
- *
- * @param writer the writer
- * @param classloader the classloader directive
- * @param pad character offset
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of the classloader
+ *
+ * @param writer the writer
+ * @param classloader the classloader directive
+ * @param pad character offset
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeClassLoader( Writer writer, ClassLoaderDirective
classloader, String pad )
throws IOException
{
@@ -181,31 +187,28 @@
{
return;
}
-
writer.write( "\n" );
writer.write( pad );
writer.write( "<classloader>" );
String padding = pad + INDENT;
-
LibraryDirective library = classloader.getLibrary();
writeLibrary( writer, library, padding );
-
ClasspathDirective classpath = classloader.getClasspathDirective();
writeClasspathDirective( writer, classpath, padding );
-
writer.write( "\n" );
writer.write( pad );
writer.write( "</classloader>" );
}

/**
- * Write out xml representation of a set of includes.
- *
- * @param writer the writer
- * @param library the library directives
- * @param pad character offset
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a set of includes.
+ *
+ * @param writer the writer
+ * @param library the library directives
+ * @param pad character offset
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeLibrary( Writer writer, LibraryDirective library,
String pad )
throws IOException
{
@@ -213,44 +216,42 @@
{
return;
}
-
String padding = pad + INDENT;
writer.write( "\n" );
writer.write( pad );
writer.write( "<library>" );
String[] includes = library.getIncludes();
- for( int i=0; i<includes.length; i++ )
+ for( int i = 0; i < includes.length; i++ )
{
writer.write( "\n" );
writer.write( padding );
writer.write( "<include>" );
- writer.write( includes[i] );
+ writer.write( includes[ i ] );
writer.write( "</include>" );
}
-
String[] groups = library.getGroups();
- for( int i=0; i<groups.length; i++ )
+ for( int i = 0; i < groups.length; i++ )
{
writer.write( "\n" );
writer.write( padding );
writer.write( "<group>" );
- writer.write( groups[i] );
+ writer.write( groups[ i ] );
writer.write( "</group>" );
}
-
writer.write( "\n" );
writer.write( pad );
writer.write( "</library>" );
}

/**
- * Write out xml representation of a classpath.
- *
- * @param writer the writer
- * @param classpath the classpath directives
- * @param pad character offset
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a classpath.
+ *
+ * @param writer the writer
+ * @param classpath the classpath directives
+ * @param pad character offset
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeClasspathDirective( Writer writer, ClasspathDirective
classpath, String pad )
throws IOException
{
@@ -258,25 +259,22 @@
{
return;
}
-
String padding = pad + INDENT;
writer.write( "\n" );
writer.write( pad );
writer.write( "<classpath>" );
-
FilesetDirective[] filesets = classpath.getFilesets();
if( filesets.length > 0 )
{
- for( int i=0; i<filesets.length; i++ )
+ for( int i = 0; i < filesets.length; i++ )
{
- writeFilesetDirective( writer, filesets[i], padding );
+ writeFilesetDirective( writer, filesets[ i ], padding );
}
}
-
Artifact[] artifacts = classpath.getArtifacts();
- for( int i=0; i<artifacts.length; i++ )
+ for( int i = 0; i < artifacts.length; i++ )
{
- writeArtifactDirective( writer, artifacts[i], padding );
+ writeArtifactDirective( writer, artifacts[ i ], padding );
}
writer.write( "\n" );
writer.write( pad );
@@ -284,13 +282,14 @@
}

/**
- * Write out xml representation of a fileset.
- *
- * @param writer the writer
- * @param fileset the fileset directives
- * @param pad character offset
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of a fileset.
+ *
+ * @param writer the writer
+ * @param fileset the fileset directives
+ * @param pad character offset
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeFilesetDirective( Writer writer, FilesetDirective
fileset, String pad )
throws IOException
{
@@ -299,43 +298,40 @@
writer.write( "<fileset dir=\"" );
writer.write( fileset.getBaseDirectory() );
writer.write( "\">" );
-
IncludeDirective[] includes = fileset.getIncludes();
- for( int i=0; i<includes.length; i++ )
+ for( int i = 0; i < includes.length; i++ )
{
writer.write( "\n" );
writer.write( pad );
writer.write( INDENT );
writer.write( "<include>" );
- writer.write( includes[i].getPath() );
+ writer.write( includes[ i ].getPath() );
writer.write( "</include>" );
}
-
ExcludeDirective[] excludes = fileset.getExcludes();
- for( int i=0; i<excludes.length; i++ )
+ for( int i = 0; i < excludes.length; i++ )
{
writer.write( "\n" );
writer.write( pad );
writer.write( INDENT );
writer.write( "<exclude>" );
- writer.write( excludes[i].getPath() );
+ writer.write( excludes[ i ].getPath() );
writer.write( "</exclude>" );
}
-
writer.write( "\n" );
writer.write( pad );
writer.write( "</fileset>" );
}

-
/**
- * Write out xml representation of the classloader
- *
- * @param writer the writer
- * @param artifact an artifact directive
- * @param pad character offset
- * @throws IOException if unable to write xml
- */
+ * Write out xml representation of the classloader
+ *
+ * @param writer the writer
+ * @param artifact an artifact directive
+ * @param pad character offset
+ *
+ * @throws IOException if unable to write xml
+ */
private void writeArtifactDirective( Writer writer, Artifact artifact,
String pad )
throws IOException
{
@@ -349,17 +345,18 @@
/**
* Write out xml representation of the embedded profiles
*
- * @param writer the writer
+ * @param writer the writer
* @param profiles the nested profiles
- * @param pad character offset
+ * @param pad character offset
+ *
* @throws IOException if unable to write xml
*/
private void writeProfiles( Writer writer, DeploymentProfile[] profiles,
String pad )
throws Exception
{
- for( int i=0; i<profiles.length; i++ )
+ for( int i = 0; i < profiles.length; i++ )
{
- DeploymentProfile profile = profiles[i];
+ DeploymentProfile profile = profiles[ i ];
if( profile instanceof ContainmentProfile )
{
ContainmentProfile container = (ContainmentProfile) profile;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/CommissionRequest.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/CommissionRequest.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/CommissionRequest.java
Tue Jun 28 08:36:24 2005
@@ -31,25 +31,13 @@
*/
class CommissionRequest
{
- //------------------------------------------------------------
- // immutable state
- //------------------------------------------------------------
-
private final DeploymentModel m_model;
private final Thread m_thread;

- //------------------------------------------------------------
- // mutable state
- //------------------------------------------------------------
-
private boolean m_completed;
private boolean m_interrupted;
private Throwable m_exception;

- //------------------------------------------------------------
- // constructor
- //------------------------------------------------------------
-
/**
* Creation of a new commission request.
* @param model the model to commission
@@ -64,10 +52,6 @@
m_thread = thread;
}

- //------------------------------------------------------------
- // implementation
- //------------------------------------------------------------
-
/**
* Return the deployment model that it the subject of the
* commission request.
@@ -87,29 +71,11 @@
try
{
long timeout = getDeploymentModel().getDeploymentTimeout();
- waitForCompletion( timeout );
+ waitForAWhile( timeout );
processException();
- if( m_completed )
- {
- long t2 = System.currentTimeMillis();
- return t2-t1;
- }
- else
- {
- m_thread.interrupt();
- waitForCompletion( timeout ); // wait for shutdown
- processException();
- if( m_interrupted )
- {
- String error = "target: [" + m_model + "] did
not respond within the timeout period: [" + timeout + "] and was successfully
interrupted.";
- throw new CommissioningException( error );
- }
- else
- {
- String error = "target: [" + m_model + "] did
not respond within the timeout period: [" + timeout + "] and failed to
respond to an interrupt.";
- throw new FatalCommissioningException( error );
- }
- }
+ checkForCompletion( t1, timeout );
+ long t2 = System.currentTimeMillis();
+ return t2-t1;
} catch( InterruptedException e )
{
String error = "Internal Error. Activation thread was
interrupted by unknown external thread.";
@@ -118,18 +84,42 @@
}
}

- private void waitForCompletion( long timeout ) throws
InterruptedException
+ private void checkForCompletion( long t1, long timeout )
+ throws InterruptedException, InvocationTargetException,
CommissioningException
+ {
+ if( m_completed )
+ {
+ return;
+ }
+
+ m_thread.interrupt();
+ waitForAWhile( timeout ); // wait for shutdown
+ processException();
+ if( m_interrupted )
+ {
+ String error = "target: [" + m_model + "] did not respond within
the timeout period: [" + timeout + "] and was successfully interrupted.";
+ throw new CommissioningException( error );
+ }
+ else
+ {
+ String error = "target: [" + m_model + "] did not respond within
the timeout period: [" + timeout + "] and failed to respond to an interrupt.";
+ throw new FatalCommissioningException( error );
+ }
+ }
+
+ private void waitForAWhile( long timeout )
+ throws InterruptedException
{
if( timeout > 0 )
{
- if( !m_completed )
+ if( m_completed == false )
{
wait( timeout );
}
}
else
{
- while( !m_completed )
+ while( m_completed == false )
{
wait( 60 );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/Commissioner.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/Commissioner.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/Commissioner.java
Tue Jun 28 08:36:24 2005
@@ -41,16 +41,8 @@
public class Commissioner
implements Runnable
{
- //------------------------------------------------------------
- // static
- //------------------------------------------------------------
-
static private int m_ThreadCounter = 0;

- //------------------------------------------------------------
- // immutable state
- //------------------------------------------------------------
-
private final Logger m_logger;

private final SimpleFIFO m_queue = new SimpleFIFO();
@@ -59,16 +51,8 @@

private final boolean m_flag;

- //------------------------------------------------------------
- // mutable static
- //------------------------------------------------------------
-
private Thread m_thread;

- //------------------------------------------------------------
- // constructor
- //------------------------------------------------------------
-
public Commissioner( Logger logger, boolean flag )
{
this( logger, flag, "unnamed" );

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
Tue Jun 28 08:36:24 2005
@@ -15,14 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

+import net.dpml.composition.StuffNeeded;
import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.model.ServiceRepository;
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.provider.ClassLoaderContext;
-import net.dpml.composition.StuffNeeded;
import net.dpml.context.impl.DefaultContext;
import net.dpml.lang.NullArgumentException;
import net.dpml.logging.Logger;
@@ -30,7 +29,6 @@
import java.io.File;
import java.net.URL;

-
/**
* Implementation of a system context that exposes a system wide set of
parameters.
*
@@ -40,76 +38,61 @@
public class DefaultClassLoaderContext extends DefaultContext
implements ClassLoaderContext
{
- //==============================================================
- // immutable state
- //==============================================================
-
- /**
- * The logging channel to apply to the classloader model.
- */
+ /**
+ * The logging channel to apply to the classloader model.
+ */
private final Logger m_logger;
-
- /**
- * The parent classloader.
- */
+ /**
+ * The parent classloader.
+ */
private final ClassLoader m_parent;
-
- /**
- * The base directory for resolution of
- * fileset directories.
- */
+ /**
+ * The base directory for resolution of fileset directories.
+ */
private final File m_base;
-
- /**
- * The parent type manager.
- */
+ /**
+ * The parent type manager.
+ */
private final TypeRepository m_types;
-
- /**
- * The parent service manager.
- */
+ /**
+ * The parent service manager.
+ */
private final ServiceRepository m_services;
-
- /**
- * The classloader directive.
- */
+ /**
+ * The classloader directive.
+ */
private final ClassLoaderDirective m_directive;
-
- /**
- * Implied url to include in the classpath.
- */
+ /**
+ * Implied url to include in the classpath.
+ */
private final URL[] m_implied;

- //==============================================================
- // constructor
- //==============================================================
-
/**
- * Creation of a root classloader context.
- *
- * @param logger the logging channel to assign to the classloader model
- * @param parent the parent classloader
- * @param directive the classloader directive
- */
+ * Creation of a root classloader context.
+ *
+ * @param logger the logging channel to assign to the classloader
model
+ * @param parent the parent classloader
+ * @param directive the classloader directive
+ */
public DefaultClassLoaderContext( Logger logger, ClassLoader parent,
ClassLoaderDirective directive )
{
this( logger, parent, null, null, directive, null );
}

/**
- * Creation of a new classloader context.
- *
- * @param logger the logging channel to assign to the classloader model
- * @param parent the parent classloader
- * @param types the parent type manager
- * @param services the parent service manager
- * @param directive the classloader directive
- * @param implied url array added though implication
- * @exception NullArgumentException if any one of the logger, parent,
packages,
- * directive or system arguments is null.
- */
+ * Creation of a new classloader context.
+ *
+ * @param logger the logging channel to assign to the classloader
model
+ * @param parent the parent classloader
+ * @param types the parent type manager
+ * @param services the parent service manager
+ * @param directive the classloader directive
+ * @param implied url array added though implication
+ *
+ * @throws NullArgumentException if any one of the logger, parent,
packages, directive or system arguments is null.
+ */
public DefaultClassLoaderContext( Logger logger, ClassLoader parent,
TypeRepository types, ServiceRepository services,
- ClassLoaderDirective directive, URL[]
implied )
+ ClassLoaderDirective directive, URL[]
implied )
throws NullArgumentException
{
super();
@@ -125,100 +108,86 @@
{
throw new NullArgumentException( "directive" );
}
-
m_logger = logger;
m_base = StuffNeeded.getLibDirectory();
- m_parent = parent;
+ m_parent = parent;
m_types = types;
m_services = services;
m_directive = directive;
-
if( implied == null )
{
- m_implied = new URL[0];
- }
- else
+ m_implied = new URL[ 0 ];
+ } else
{
m_implied = implied;
}
}

- //==============================================================
- // Context
- //==============================================================
-
-
- //==============================================================
- // ClassLoaderContext
- //==============================================================
-
/**
- * Return the system logging channel.
- *
- * @return the system logging channel
- */
+ * Return the system logging channel.
+ *
+ * @return the system logging channel
+ */
public Logger getLogger()
{
return m_logger;
}

/**
- * Return the base directory from which relative library directives
- * and fileset directory paths may be resolved.
- *
- * @return the base directory
- */
+ * Return the base directory from which relative library directives and
fileset directory paths may be resolved.
+ *
+ * @return the base directory
+ */
public File getBaseDirectory()
{
return m_base;
}

/**
- * Return the classloader to be assigned as the parernt classloader.
- *
- * @return the classloader
- */
+ * Return the classloader to be assigned as the parernt classloader.
+ *
+ * @return the classloader
+ */
public ClassLoader getClassLoader()
{
return m_parent;
}

/**
- * Return the type repository established by the parent classloader.
- *
- * @return the type repository
- */
+ * Return the type repository established by the parent classloader.
+ *
+ * @return the type repository
+ */
public TypeRepository getTypeRepository()
{
return m_types;
}

/**
- * Return the service repository established by the parent classloader.
- *
- * @return the service repository
- */
+ * Return the service repository established by the parent classloader.
+ *
+ * @return the service repository
+ */
public ServiceRepository getServiceRepository()
{
return m_services;
}

/**
- * Return the classloader directive to be applied to the
- * classloader model.
- *
- * @return the classloader directive
- */
+ * Return the classloader directive to be applied to the classloader
model.
+ *
+ * @return the classloader directive
+ */
public ClassLoaderDirective getClassLoaderDirective()
{
return m_directive;
}

/**
- * Return any implied urls to include in the classloader.
- *
- * @return the implied urls
- */
+ * Return any implied urls to include in the classloader.
+ *
+ * @return the implied urls
+ */
public URL[] getImplicitURLs()
{
return m_implied;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
Tue Jun 28 08:36:24 2005
@@ -15,15 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.data.ClassLoaderDirective;
+import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.ExcludeDirective;
import net.dpml.composition.data.FilesetDirective;
import net.dpml.composition.data.IncludeDirective;
-import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ServiceRepository;
@@ -31,35 +30,24 @@
import net.dpml.composition.provider.ClassLoaderContext;
import net.dpml.lang.NullArgumentException;
import net.dpml.logging.Logger;
-import net.dpml.transit.TransitException;
import net.dpml.transit.artifact.Artifact;
-import net.dpml.transit.artifact.Handler;

import java.io.File;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-import java.net.URISyntaxException;
-import java.net.MalformedURLException;
import java.security.CodeSource;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.List;

/**
- * <p>Implementation of a classloader model within which a
- * repository, a base directory and a classloader directive
- * are associated together enabling the creation of a fully
- * qualified classpath.</p>
+ * <p>Implementation of a classloader model within which a repository, a
base directory and a classloader directive are
+ * associated together enabling the creation of a fully qualified
classpath.</p>
*
- * <p>The classpath established by this model implementation
- * applies the following logic:</p>
- * <ul>
- * <li>build an uqualifed classpath relative to the
- * &lt;classpath/&gt> directives</li>
- * </ul>
+ * <p>The classpath established by this model implementation applies the
following logic:</p> <ul> <li>build an
+ * uqualifed classpath relative to the &lt;classpath/&gt> directives</li>
</ul>
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
@@ -67,38 +55,24 @@
public class DefaultClassLoaderModel
implements ClassLoaderModel
{
- //==============================================================
- // state
- //==============================================================

private final ClassLoaderContext m_context;
-
private final String[] m_classpath;
-
private final URL[] m_urls;
-
private final URLClassLoader m_classLoader;
-
private final DefaultTypeRepository m_types;
-
private final DefaultServiceRepository m_services;
-
private final Logger m_local;
-
private final Logger m_logger;

- //==============================================================
- // constructor
- //==============================================================
-
/**
- * Creation of a new classloader model. The model associated a
- * repository, a base directory and a classloader directive
- * enabling the creation of a fully populated classpath.
- *
- * @param context the classloader context
- * @exception NullArgumentException if the context argument is null.
- */
+ * Creation of a new classloader model. The model associated a
repository, a base directory and a classloader
+ * directive enabling the creation of a fully populated classpath.
+ *
+ * @param context the classloader context
+ *
+ * @throws NullArgumentException if the context argument is null.
+ */
public DefaultClassLoaderModel( ClassLoaderContext context )
throws ModelException, NullArgumentException
{
@@ -106,35 +80,27 @@
{
throw new NullArgumentException( "context" );
}
-
m_context = context;
m_logger = context.getLogger();
m_local = getLogger().getChildLogger( "classloader" );
-
File base = context.getBaseDirectory();
if( getLogger().isDebugEnabled() )
{
getLocalLogger().debug( "base: " + base );
}
-
ClassLoaderDirective directive = context.getClassLoaderDirective();
-
URL[] implicit = context.getImplicitURLs();
-
try
{
m_classpath = createClassPath( base, directive, implicit );
-
if( getLocalLogger().isDebugEnabled() )
{
String str = "classpath: " + m_classpath;
getLocalLogger().debug( str );
}
-
m_urls = buildQualifiedClassPath();
ClassLoader parent = context.getClassLoader();
- ArtifactURLStreamHandlerFactory factory = new
ArtifactURLStreamHandlerFactory();
- m_classLoader = new URLClassLoader( m_urls, parent, factory );
+ m_classLoader = new URLClassLoader( m_urls, parent );

//
// scan the classpath for component type and service
@@ -157,19 +123,15 @@
Logger serviceLogger = getLocalLogger().getChildLogger(
"services" );
ServiceRepository serviceRepository =
context.getServiceRepository();
m_services = new DefaultServiceRepository( serviceLogger,
serviceRepository, services );
-
- }
- catch( NullArgumentException e )
+ } catch( NullArgumentException e )
{
final String error = "Could not create classloader.";
throw new ModelException( error, e );
- }
- catch( ModelException e )
+ } catch( ModelException e )
{
final String error = "Could not create classloader.";
throw new ModelException( error, e );
- }
- catch( RuntimeException e )
+ } catch( RuntimeException e )
{
final String error = "Could not create classloader.";
throw new ModelException( error, e );
@@ -185,14 +147,14 @@
//==============================================================

/**
- * Creation of a classloader model using this model as the
- * relative parent.
- *
- * @param logger the loggiong channel
- * @param profile the profile directive
- * @param implied a sequence of implied urls
- * @return a new classloader context
- */
+ * Creation of a classloader model using this model as the relative
parent.
+ *
+ * @param logger the loggiong channel
+ * @param profile the profile directive
+ * @param implied a sequence of implied urls
+ *
+ * @return a new classloader context
+ */
public ClassLoaderModel createClassLoaderModel( Logger logger,
ContainmentProfile profile, URL[] implied )
throws ModelException
{
@@ -202,54 +164,51 @@
}

/**
- * Return the type repository managed by this containment
- * context.
- *
- * @return the repository
- */
+ * Return the type repository managed by this containment context.
+ *
+ * @return the repository
+ */
public TypeRepository getTypeRepository()
{
return m_types;
}

/**
- * Return the classloader model service repository.
- *
- * @return the repository
- */
+ * Return the classloader model service repository.
+ *
+ * @return the repository
+ */
public ServiceRepository getServiceRepository()
{
return m_services;
}

/**
- * Return the fully qualified classpath
- * resolved relative to the classpath directives in the meta-data
- * and any parent classloader models.
- *
- * WARNING: lots of updates needed to properly populate the returned
- * code source with certificates used to verify repository content which
- * means updating the repository package.
- * Currently the code sources returned contain an empty certificates
- * array.
- *
- * @return an array of URL representing the complete classpath
- */
+ * Return the fully qualified classpath resolved relative to the
classpath directives in the meta-data and any
+ * parent classloader models.
+ *
+ * WARNING: lots of updates needed to properly populate the returned
code source with certificates used to verify
+ * repository content which means updating the repository package.
Currently the code sources returned contain an
+ * empty certificates array.
+ *
+ * @return an array of URL representing the complete classpath
+ */
public CodeSource[] getQualifiedClassPath()
{
CodeSource[] sources = new CodeSource[ m_urls.length ];
- for( int i=0; i<m_urls.length; i++ )
+ for( int i = 0; i < m_urls.length; i++ )
{
- URL url = m_urls[i];
- sources[i] = new CodeSource( url, new Certificate[0] );
+ URL url = m_urls[ i ];
+ sources[ i ] = new CodeSource( url, new Certificate[ 0 ] );
}
return sources;
}

/**
- * Return the classloader established by this classloader model.
- * @return the classloader
- */
+ * Return the classloader established by this classloader model.
+ *
+ * @return the classloader
+ */
public ClassLoader getClassLoader()
{
return m_classLoader;
@@ -260,18 +219,17 @@
//==============================================================

/**
- * Creation of a classloader context using this model as the
- * relative parent.
- *
- * @param logger the loggiong channel
- * @param profile the profile directive
- * @param implied a sequence of implied urls
- * @return a new classloader context
- */
+ * Creation of a classloader context using this model as the relative
parent.
+ *
+ * @param logger the loggiong channel
+ * @param profile the profile directive
+ * @param implied a sequence of implied urls
+ *
+ * @return a new classloader context
+ */
private ClassLoaderContext createChildContext( Logger logger,
ContainmentProfile profile, URL[] implied )
{
ClassLoaderDirective directive = profile.getClassLoaderDirective();
-
return new DefaultClassLoaderContext( logger, m_classLoader,
m_types, m_services, directive, implied );
}

@@ -281,26 +239,27 @@
}

/**
- * Build the fully qulalified classpath
- * resolved relative to the classpath directives in the meta-data.
- *
- * @return an array of URL representing the complete classpath
- */
+ * Build the fully qulalified classpath resolved relative to the
classpath directives in the meta-data.
+ *
+ * @return an array of URL representing the complete classpath
+ */
private URL[] buildQualifiedClassPath()
throws ModelException
{
final ArrayList list = new ArrayList();
final String[] classpath = getClassPath();
- for( int i=0; i<classpath.length; i++ )
+ for( int i = 0; i < classpath.length; i++ )
{
- String entry = classpath[i];
+ String entry = classpath[ i ];
URL url = createURL( entry );
if( isaCandidate( url ) )
{
list.add( url );
}
}
- return (URL[]) list.toArray( new URL[0] );
+ URL[] result = new URL[ list.size() ];
+ list.toArray( result );
+ return result;
}

private URL createURL( String path )
@@ -308,18 +267,7 @@
{
try
{
- if( path.startsWith( "artifact:" ) )
- {
- Artifact artifact = Artifact.createArtifact( path );
- return artifact.toURL();
- }
- else
- {
- return new URL( path );
- }
- } catch( URISyntaxException e )
- {
- throw new ModelException( "Invalid Artifact syntax: " + path, e
);
+ return new URL( path );
} catch( MalformedURLException e )
{
throw new ModelException( "Invalid URL: " + path, e );
@@ -335,29 +283,30 @@
{
if( classloader instanceof URLClassLoader )
{
- URL[] urls = ((URLClassLoader)classloader).getURLs();
- for( int i=0; i<urls.length; i++ )
+ URL[] urls = ( (URLClassLoader) classloader ).getURLs();
+ for( int i = 0; i < urls.length; i++ )
{
- if( urls[i].equals( url ) ) return false;
+ if( urls[ i ].equals( url ) )
+ {
+ return false;
+ }
}
ClassLoader parent = classloader.getParent();
if( parent == null )
{
return true;
- }
- else
+ } else
{
return isaCandidate( parent, url );
}
- }
- else
+ } else
{
return true;
}
}

private String[] createClassPath( File base, ClassLoaderDirective
directive, URL[] implicit )
- throws ModelException
+ throws ModelException
{
ArrayList classpath = new ArrayList();
if( implicit.length > 0 )
@@ -366,17 +315,17 @@
{
getLocalLogger().debug( "implicit entries: " +
implicit.length );
}
-
- for( int i=0; i<implicit.length; i++ )
+ for( int i = 0; i < implicit.length; i++ )
{
- classpath.add( implicit[i].toString() );
+ classpath.add( implicit[ i ].toString() );
}
}
try
{
- File[] files = expandFileSetDirectives( base,
directive.getClasspathDirective().getFilesets() );
+ ClasspathDirective classpathDirective =
directive.getClasspathDirective();
+ FilesetDirective[] filesets = classpathDirective.getFilesets();
+ File[] files = expandFileSetDirectives( base, filesets );
addToClassPath( classpath, files );
-
if( files.length > 0 )
{
if( getLocalLogger().isDebugEnabled() )
@@ -388,25 +337,22 @@
{
throw new ModelException( "Unable to add the fileset to the
classpath: " + directive, e );
}
-
ClasspathDirective classpathDirective =
directive.getClasspathDirective();
Artifact[] artifacts = classpathDirective.getArtifacts();
-
for( int i = 0; i < artifacts.length; i++ )
{
- Artifact artifact = artifacts[i];
+ Artifact artifact = artifacts[ i ];
classpath.add( artifact.toString() ); // <-- TODO: remove this
string based classpath handling
}
-
- return (String[]) classpath.toArray( new String[0] );
+ return (String[]) classpath.toArray( new String[ 0 ] );
}

private void addToClassPath( List list, File[] files )
throws IOException
{
- for( int i=0; i<files.length; i++ )
+ for( int i = 0; i < files.length; i++ )
{
- addToClassPath( list, files[i] );
+ addToClassPath( list, files[ i ] );
}
}

@@ -419,37 +365,41 @@
}

/**
- * Return an array of files corresponding to the expansion
- * of the filesets declared within the directive.
- *
- * @param base the base directory against which relative
- * file references will be resolved
- * @return the classpath
- */
- public File[] expandFileSetDirectives ( File base, FilesetDirective[]
filesets )
+ * Return an array of files corresponding to the expansion of the
filesets declared within the directive.
+ *
+ * @param base the base directory against which relative file references
will be resolved
+ *
+ * @return the classpath
+ */
+ public File[] expandFileSetDirectives( File base, FilesetDirective[]
filesets )
throws IOException
{
//getLocalLogger().debug("base=[" + base + "]");

ArrayList list = new ArrayList();
-
- for( int i=0; i<filesets.length; i++ )
+ for( int i = 0; i < filesets.length; i++ )
{
- FilesetDirective fileset = filesets[i];
- getLocalLogger().debug("fileset.base=[" +
fileset.getBaseDirectory() + "]");
- File anchor = getDirectory( base, fileset.getBaseDirectory() );
- getLocalLogger().debug("anchor=[" + anchor + "]");
-
- IncludeDirective[] includes = fileset.getIncludes();
- ExcludeDirective[] excludes = fileset.getExcludes();
-
- DefaultFilesetModel fsm = new DefaultFilesetModel(
- anchor, includes, excludes, null, null, getLocalLogger());
- fsm.resolveFileset();
- list.addAll(fsm.getIncludes());
+ FilesetDirective fileset = filesets[ i ];
+ ArrayList set = getIncludesSet( fileset, base );
+ list.addAll( set );
}
+ File[] result = new File[ list.size() ];
+ list.toArray( result );
+ return result;
+ }

- return (File[]) list.toArray( new File[0] );
+ private ArrayList getIncludesSet( FilesetDirective fileset, File base )
+ throws IOException
+ {
+ getLocalLogger().debug( "fileset.base=[" +
fileset.getBaseDirectory() + "]" );
+ File anchor = getDirectory( base, fileset.getBaseDirectory() );
+ getLocalLogger().debug( "anchor=[" + anchor + "]" );
+ IncludeDirective[] includes = fileset.getIncludes();
+ ExcludeDirective[] excludes = fileset.getExcludes();
+ DefaultFilesetModel fsm = new DefaultFilesetModel( anchor, includes,
excludes, null, null, getLocalLogger() );
+ fsm.resolveFileset();
+ ArrayList set = fsm.getIncludes();
+ return set;
}

private File getDirectory( File base, String path )
@@ -470,7 +420,6 @@
{
return dir.getCanonicalFile();
}
-
final String error = "Path does not correspond to a directory: " +
dir;
throw new IOException( error );
}
@@ -484,28 +433,4 @@
{
return m_logger;
}
-
- /**
- * Stream handler factory assigned to a classloader.
- *
- * @version $Id$
- */
- public static class ArtifactURLStreamHandlerFactory
- implements URLStreamHandlerFactory
- {
- public URLStreamHandler createURLStreamHandler( final String
protocol )
- {
- if( "artifact".equals( protocol ) )
- {
- try
- {
- return new Handler();
- } catch( TransitException e )
- {
- return null;
- } // ignore and return null
- }
- return null;
- }
- }
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentContext.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.data.ComponentProfile;
@@ -31,74 +30,54 @@

import java.io.File;

-
/**
- * Default implementation of a deployment context that is used
- * as the primary constructor argument when creating a new component
- * model.
+ * Default implementation of a deployment context that is used as the
primary constructor argument when creating a new
+ * component model.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class DefaultComponentContext extends DefaultDeploymentContext
- implements ComponentContext
+public class DefaultComponentContext
+ extends DefaultDeploymentContext
+ implements ComponentContext
{
- //==============================================================
- // static
- //==============================================================

private static final Resources REZ =
ResourceManager.getPackageResources( DefaultComponentContext.class );
-
- //==============================================================
- // immutable state
- //==============================================================
-
private final ClassLoader m_classloader;
-
private final ComponentProfile m_profile;
-
private final Type m_type;
-
private final Class m_class;
-
private final File m_dir;
-
private final File m_temp;
-
private final ContainmentModel m_model;

- //==============================================================
- // constructor
- //==============================================================
-
- /**
- * Creation of a new deployment context.
- *
- * @param logger the logging channel to assign
- * @param name the deployment context name
- * @param classloader the containers classloader
- * @param graph the containers dependency graph
- * @param model the parent containment model
- * @param profile the component deployment profile
- * @param type the underlying component type
- * @param clazz the component deployment class
- * @param dir the home working directory
- * @param temp a temporary directory
- * @param partition the partition name
- * @param runtime the runtime provider
- * @param timeout the default deployment timeout
- * @exception NullArgumentException if any one of the partition,
classloader,
- * clazz, profile or model argument is null.
- */
+ /**
+ * Creation of a new deployment context.
+ *
+ * @param logger the logging channel to assign
+ * @param name the deployment context name
+ * @param classloader the containers classloader
+ * @param graph the containers dependency graph
+ * @param model the parent containment model
+ * @param profile the component deployment profile
+ * @param type the underlying component type
+ * @param clazz the component deployment class
+ * @param dir the home working directory
+ * @param temp a temporary directory
+ * @param partition the partition name
+ * @param runtime the runtime provider
+ * @param timeout the default deployment timeout
+ *
+ * @throws NullArgumentException if any one of the partition,
classloader, clazz, profile or model argument is
+ * null.
+ */
public DefaultComponentContext(
- Logger logger, String name, ClassLoader classloader,
- DependencyGraph graph, ContainmentModel model, ComponentProfile
profile,
- Type type, Class clazz, File dir, File temp,
- String partition, Runtime runtime, long timeout )
+ Logger logger, String name, ClassLoader classloader, DependencyGraph
graph,
+ ContainmentModel model, ComponentProfile profile, Type type, Class
clazz, File dir,
+ File temp, String partition, Runtime runtime, long timeout )
throws NullArgumentException
{
super( logger, partition, name, profile.getMode(), profile, graph,
runtime, timeout );
-
if( partition == null )
{
throw new NullArgumentException( "partition" );
@@ -123,20 +102,16 @@
{
throw new NullArgumentException( "model" );
}
-
- if( dir.exists() && !dir.isDirectory() )
+ if( dir.exists() && dir.isDirectory() == false )
{
- final String error =
- REZ.getString(
"deployment.context.home.not-a-directory.error", dir );
+ String error = REZ.getString(
"deployment.context.home.not-a-directory.error", dir );
throw new IllegalArgumentException( error );
}
- if( temp.exists() && !temp.isDirectory() )
+ if( temp.exists() && temp.isDirectory() == false )
{
- final String error =
- REZ.getString(
"deployment.context.temp.not-a-directory.error", temp );
+ String error = REZ.getString(
"deployment.context.temp.not-a-directory.error", temp );
throw new IllegalArgumentException( error );
}
-
m_dir = dir;
m_temp = temp;
m_classloader = classloader;
@@ -150,73 +125,73 @@
// ComponentContext
//--------------------------------------------------------------

- /**
- * Return the enclosing containment model.
- * @return the containment model that component is within
- */
+ /**
+ * Return the enclosing containment model.
+ *
+ * @return the containment model that component is within
+ */
public ContainmentModel getContainmentModel()
{
return m_model;
}

- /**
- * Return the working directory.
- *
- * @return the working directory
- */
+ /**
+ * Return the working directory.
+ *
+ * @return the working directory
+ */
public File getWorkingDirectory()
{
return m_dir;
}

- /**
- * Return the temporary directory.
- *
- * @return the temporary directory
- */
+ /**
+ * Return the temporary directory.
+ *
+ * @return the temporary directory
+ */
public File getTempDirectory()
{
return m_temp;
}

- /**
- * Return the deployment profile.
- *
- * @return the profile
- */
+ /**
+ * Return the deployment profile.
+ *
+ * @return the profile
+ */
public ComponentProfile getComponentProfile()
{
return m_profile;
}

- /**
- * Return the component type.
- *
- * @return the type defintion
- */
+ /**
+ * Return the component type.
+ *
+ * @return the type defintion
+ */
public Type getType()
{
return m_type;
}

- /**
- * Return the component class.
- *
- * @return the class
- */
+ /**
+ * Return the component class.
+ *
+ * @return the class
+ */
public Class getDeploymentClass()
{
return m_class;
}

- /**
- * Return the classloader for the component.
- *
- * @return the classloader
- */
+ /**
+ * Return the classloader for the component.
+ *
+ * @return the classloader
+ */
public ClassLoader getClassLoader()
{
return m_classloader;
}
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultComponentModel.java
Tue Jun 28 08:36:24 2005
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

+import net.dpml.composition.data.ComponentProfile;
import net.dpml.composition.data.ContextDirective;
import net.dpml.composition.data.DependencyDirective;
import net.dpml.composition.data.DeploymentProfile;
@@ -37,6 +37,7 @@
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
import net.dpml.lang.NullArgumentException;
+import net.dpml.logging.Logger;
import net.dpml.meta.info.ContextDescriptor;
import net.dpml.meta.info.DependencyDescriptor;
import net.dpml.meta.info.InfoDescriptor;
@@ -56,119 +57,94 @@
import java.util.Properties;

/**
-* Deployment model defintion.
-*
-* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
-* Library </a>
-* @version $Id$
-*/
+ * Deployment model defintion.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta
Library</a> Library </a>
+ * @version $Id$
+ */
public class DefaultComponentModel extends DefaultDeploymentModel
implements ComponentModel
{
- // --------------------------------------------------------------
- // static
- // --------------------------------------------------------------
-
- private static final Resources REZ;

+ private static final Resources REZ;
+ private static final String SCHEMA_TAG_W3CSCHEMA;
private static final Configuration EMPTY_CONFIGURATION;

static
{
REZ = ResourceManager.getPackageResources(
DefaultComponentModel.class );
EMPTY_CONFIGURATION = new DefaultConfiguration( "" );
+ SCHEMA_TAG_W3CSCHEMA = "xmlschema";
}
-
- // --------------------------------------------------------------
- // immutable state
- // --------------------------------------------------------------

- private final ComponentContext m_context;
+ private final ComponentContext m_context;
+ private final ContextModel m_contextModel;
+ private final DependencyModel[] m_dependencies;
+ private Configuration m_config;
+ private Parameters m_parameters;
+ private boolean m_activation;
+ private int m_collection;

- private final ContextModel m_contextModel;
-
- private final DependencyModel[] m_dependencies;
-
- // --------------------------------------------------------------
- // mutable state
- // --------------------------------------------------------------
-
- private Configuration m_config;
-
- private Parameters m_parameters;
-
- private boolean m_activation;
-
- private int m_collection;
-
- private static final String SCHEMA_TAG_W3CSCHEMA =
"xmlschema";

// --------------------------------------------------------------
// constructor
// --------------------------------------------------------------

/**
- * Creation of a new deployment model.
- *
- * @param context
- * the deployment context
- */
- public DefaultComponentModel( ComponentContext context )
+ * Creation of a new deployment model.
+ *
+ * @param context the deployment context
+ */
+ public DefaultComponentModel( ComponentContext context )
throws ModelException
{
super( context );
m_context = context;
m_activation = getDefaultActivationPolicy();
-
setCollectionPolicy(
m_context.getComponentProfile().getCollectionPolicy() );
-
- if ( isConfigurable() )
+ if( isConfigurable() )
{
- final Configuration defaults =
m_context.getType().getConfiguration();
- final Configuration explicit =
m_context.getComponentProfile().getConfiguration();
- final Configuration consolidated = consolidateConfigurations(
explicit, defaults );
- if ( consolidated != null )
+ Configuration defaults = m_context.getType().getConfiguration();
+ Configuration explicit =
m_context.getComponentProfile().getConfiguration();
+ Configuration consolidated = consolidateConfigurations(
explicit, defaults );
+ if( consolidated != null )
{
setConfiguration( consolidated );
- }
- else
+ } else
{
setConfiguration( EMPTY_CONFIGURATION );
}
}
-
- if ( isParameterizable() )
+ if( isParameterizable() )
{
Parameters staticDefaults = m_context.getType().getParameters();
- final Parameters parameters =
m_context.getComponentProfile().getParameters();
- if ( parameters != null )
+ Parameters parameters =
m_context.getComponentProfile().getParameters();
+ if( parameters != null )
{
- if ( null == staticDefaults )
+ if( null == staticDefaults )
{
m_parameters = parameters;
- }
- else
+ } else
{
m_parameters = new DefaultParameters();
m_parameters.merge( staticDefaults );
m_parameters.merge( parameters );
}
- }
- else
+ } else
{
- if ( null == staticDefaults )
+ if( null == staticDefaults )
{
m_parameters = DefaultParameters.EMPTY_PARAMETERS;
- }
- else
+ } else
{
m_parameters = staticDefaults;
}
}
}
-
- final ContextDescriptor contextDescriptor =
m_context.getType().getContext();
- final ContextDirective contextDirective =
m_context.getComponentProfile().getContext();
+ Type type = m_context.getType();
+ ContextDescriptor contextDescriptor = type.getContext();
+ ComponentProfile profile = m_context.getComponentProfile();
+ ContextDirective contextDirective = profile.getContext();
m_contextModel = new DefaultContextModel( contextDescriptor,
contextDirective, context );

//
@@ -176,43 +152,45 @@
// management
//

- DependencyDescriptor[] dependencies =
m_context.getType().getDependencies();
- m_dependencies = new DefaultDependencyModel[dependencies.length];
-
- for ( int i = 0; i < dependencies.length; i++ )
+ DependencyDescriptor[] dependencies = type.getDependencies();
+ m_dependencies = new DefaultDependencyModel[ dependencies.length ];
+ for( int i = 0; i < dependencies.length; i++ )
{
- DependencyDescriptor descriptor = dependencies[i];
- DependencyDirective directive =
context.getComponentProfile().getDependencyDirective( descriptor.getKey() );
- m_dependencies[i] = new DefaultDependencyModel(
context.getLogger().getChildLogger( "deps" ), context.getProfile().getName(),
descriptor, directive );
+ DependencyDescriptor descriptor = dependencies[ i ];
+ String key = descriptor.getKey();
+ DependencyDirective directive = profile.getDependencyDirective(
key );
+ Logger logger = context.getLogger();
+ Logger childLogger = logger.getChildLogger( "deps" );
+ String profileName = profile.getName();
+ m_dependencies[ i ] = new DefaultDependencyModel( childLogger,
profileName, descriptor, directive );
}
}

/**
- * Get the default activation policy for the model.
- */
+ * Get the default activation policy for the model.
+ */
public boolean getDefaultActivationPolicy()
{
- final int activation =
m_context.getComponentProfile().getActivationDirective();
-
- if ( activation != DeploymentProfile.DEFAULT )
+ ComponentProfile profile = m_context.getComponentProfile();
+ int activation = profile.getActivationDirective();
+ if( activation != DeploymentProfile.DEFAULT )
{
return ( activation == DeploymentProfile.ENABLED );
- }
- else
+ } else
{
- if ( m_context.getProfile().getMode() == Mode.EXPLICIT )
+ if( m_context.getProfile().getMode() == Mode.EXPLICIT )
{
Type type = m_context.getType();
- if ( type.getInfo().getLifestyle().equals(
InfoDescriptor.TRANSIENT ) )
+ InfoDescriptor info = type.getInfo();
+ String lifestyle = info.getLifestyle();
+ if( lifestyle.equals( InfoDescriptor.TRANSIENT ) )
{
return false;
- }
- else
+ } else
{
return true;
}
- }
- else
+ } else
{
return false;
}
@@ -224,20 +202,19 @@
// --------------------------------------------------------------

/**
- * Commission the model.
- *
- * @exception Exception
- * if a commissioning error occurs
- */
- public void commission() throws Exception
+ * Commission the model.
+ *
+ * @throws Exception if a commissioning error occurs
+ */
+ public void commission()
+ throws Exception
{
- if ( isAssembled() )
+ if( isAssembled() )
{
super.commission();
- }
- else
+ } else
{
- final String error = "Illegal attempt to commission a
non-assembled component model: " + this;
+ String error = "Illegal attempt to commission a non-assembled
component model: " + this;
throw new ModelException( error );
}
}
@@ -247,17 +224,17 @@
// --------------------------------------------------------------

/**
- * Returns the assembled state of the model.
- *
- * @return true if this model is assembled
- */
+ * Returns the assembled state of the model.
+ *
+ * @return true if this model is assembled
+ */
public boolean isAssembled()
{
DependencyModel[] dependencies = getDependencyModels();
- for ( int i = 0; i < dependencies.length; i++ )
+ for( int i = 0; i < dependencies.length; i++ )
{
- DependencyModel dep = dependencies[i];
- if ( null == dep.getProvider() &&
dep.getDependency().isRequired() )
+ DependencyModel dep = dependencies[ i ];
+ if( null == dep.getProvider() &&
dep.getDependency().isRequired() )
{
return false;
}
@@ -266,33 +243,33 @@
}

/**
- * Return the set of models assigned as providers.
- *
- * @return the providers consumed by the model
- * @exception IllegalStateException
- * if the model is not in an assembled state
- */
+ * Return the set of models assigned as providers.
+ *
+ * @return the providers consumed by the model
+ *
+ * @throws IllegalStateException if the model is not in an assembled
state
+ */
public DeploymentModel[] getProviders()
{
- if ( !isAssembled() )
+ if( isAssembled() == false )
{
- final String error = "Model is not assembled " + this;
+ String error = "Model is not assembled " + this;
throw new IllegalStateException( error );
}
-
- final ArrayList list = new ArrayList();
+ ArrayList list = new ArrayList();
DependencyModel[] dependencies = getDependencyModels();
- for ( int i = 0; i < dependencies.length; i++ )
+ for( int i = 0; i < dependencies.length; i++ )
{
- DependencyModel dependency = dependencies[i];
+ DependencyModel dependency = dependencies[ i ];
DeploymentModel provider = dependency.getProvider();
- if ( provider != null )
+ if( provider != null )
{
list.add( provider );
}
}
-
- return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
+ DeploymentModel[] result = new DeploymentModel[ list.size() ];
+ list.toArray( result );
+ return result;
}

// --------------------------------------------------------------
@@ -300,38 +277,41 @@
// --------------------------------------------------------------

/**
- * Return the set of services produced by the model.
- *
- * @return the service descriptors
- */
+ * Return the set of services produced by the model.
+ *
+ * @return the service descriptors
+ */
public ServiceDescriptor[] getServices()
{
- return m_context.getType().getServices();
+ Type type = m_context.getType();
+ return type.getServices();
}

/**
- * Return TRUE is this model is capable of supporting a supplied
- * depedendency.
- *
- * @param dependency
- * the dependency descriptor
- * @return true if this model can fulfill the dependency
- */
+ * Return TRUE is this model is capable of supporting a supplied
depedendency.
+ *
+ * @param dependency the dependency descriptor
+ *
+ * @return true if this model can fulfill the dependency
+ */
public boolean isaCandidate( DependencyDescriptor dependency )
{
- return isaCandidate( dependency.getReference() );
+ ReferenceDescriptor reference = dependency.getReference();
+ return isaCandidate( reference );
}

/**
- * Return TRUE is this model is capable of supporting a supplied service.
- *
- * @param reference
- * the service reference descriptor
- * @return true if this model can fulfill the service
- */
+ * Return TRUE is this model is capable of supporting a supplied service.
+ *
+ * @param reference the service reference descriptor
+ *
+ * @return true if this model can fulfill the service
+ */
public boolean isaCandidate( ReferenceDescriptor reference )
{
- return m_context.getType().getService( reference ) != null;
+ Type type = m_context.getType();
+ ServiceDescriptor service = type.getService( reference );
+ return service != null;
}

// --------------------------------------------------------------
@@ -339,53 +319,53 @@
// --------------------------------------------------------------

/**
- * Return the collection policy for the model. If a profile does not
declare
- * a collection policy, then the collection policy declared by the
- * underlying component type will be used.
- *
- * @return the collection policy
- * @see InfoDescriptor#WEAK
- * @see InfoDescriptor#SOFT
- * @see InfoDescriptor#HARD
- * @see InfoDescriptor#UNDEFINED
- */
+ * Return the collection policy for the model. If a profile does not
declare a collection policy, then the
+ * collection policy declared by the underlying component type will be
used.
+ *
+ * @return the collection policy
+ *
+ * @see InfoDescriptor#WEAK
+ * @see InfoDescriptor#SOFT
+ * @see InfoDescriptor#HARD
+ * @see InfoDescriptor#UNDEFINED
+ */
public int getCollectionPolicy()
{
- if ( m_collection == InfoDescriptor.UNDEFINED )
+ if( m_collection == InfoDescriptor.UNDEFINED )
{
return getTypeCollectionPolicy();
- }
- else
+ } else
{
return m_collection;
}
}

/**
- * Set the collection policy for the model.
- *
- * @param policy
- * the collection policy
- * @see InfoDescriptor#WEAK
- * @see InfoDescriptor#SOFT
- * @see InfoDescriptor#HARD
- */
+ * Set the collection policy for the model.
+ *
+ * @param policy the collection policy
+ *
+ * @see InfoDescriptor#WEAK
+ * @see InfoDescriptor#SOFT
+ * @see InfoDescriptor#HARD
+ */
public void setCollectionPolicy( int policy )
{
- if ( policy == InfoDescriptor.UNDEFINED )
+ if( policy == InfoDescriptor.UNDEFINED )
{
m_collection = InfoDescriptor.UNDEFINED;
- }
- else
+ } else
{
int minimum = getTypeCollectionPolicy();
- if ( policy >= minimum )
+ if( policy >= minimum )
{
m_collection = policy;
- }
- else
+ } else
{
- String warning = "Ignoring collection policy override [" +
policy + "] because the value is higher that type threshhold [" + minimum +
"].";
+ String warning = "Ignoring collection policy override [" +
policy
+ + "] because the value is higher that type threshhold ["
+ + minimum
+ + "].";
getLogger().warn( warning );
}
}
@@ -393,134 +373,126 @@

private int getTypeCollectionPolicy()
{
- return m_context.getType().getInfo().getCollectionPolicy();
+ Type type = m_context.getType();
+ InfoDescriptor info = type.getInfo();
+ int policy = info.getCollectionPolicy();
+ return policy;
}

/**
- * Return the proxy enabled policy for the model. If the system wide proxy
- * enabled is disabled the operation will return false otherwise the value
- * returned is true unless overriden by the "urn:composition:proxy"
- * attribute.
- *
- * @return the proxy policy
- */
+ * Return the proxy enabled policy for the model. If the system wide
proxy enabled is disabled the operation will
+ * return false otherwise the value returned is true unless overriden by
the "urn:composition:proxy" attribute.
+ *
+ * @return the proxy policy
+ */
public boolean getProxyPolicy()
{
Type type = getType();
InfoDescriptor info = type.getInfo();
String attribute = info.getAttribute( PROXY_KEY, "true" );
- if ( "false".equals( attribute ) )
+ if( "false".equals( attribute ) )
{
return false;
- }
- else
+ } else
{
return true;
}
}

/**
- * Return the activation policy for the model.
- *
- * @return the activaltion policy
- */
+ * Return the activation policy for the model.
+ *
+ * @return the activaltion policy
+ */
public boolean getActivationPolicy()
{
return m_activation;
}

/**
- * Set the activation policy for the model.
- *
- * @param policy
- * the activaltion policy
- */
+ * Set the activation policy for the model.
+ *
+ * @param policy the activaltion policy
+ */
public void setActivationPolicy( boolean policy )
{
m_activation = policy;
}

/**
- * Return the component type descriptor.
- *
- * @return the type descriptor
- */
+ * Return the component type descriptor.
+ *
+ * @return the type descriptor
+ */
public Type getType()
{
return m_context.getType();
}

/**
- * Return the class for the deployable target.
- *
- * @return the class
- */
+ * Return the class for the deployable target.
+ *
+ * @return the class
+ */
public Class getDeploymentClass()
{
return m_context.getDeploymentClass();
}

/**
- * Rest if the component type backing the model is parameterizable.
- *
- * @return TRUE if the compoent type is parameterizable otherwise FALSE
- */
+ * Rest if the component type backing the model is parameterizable.
+ *
+ * @return TRUE if the compoent type is parameterizable otherwise FALSE
+ */
public boolean isParameterizable()
{
boolean isAssignable = Parameterizable.class.isAssignableFrom(
getDeploymentClass() );
boolean hasConstructorParameters = isaConstructorArg(
Parameters.class );
- return ( isAssignable || hasConstructorParameters );
+ return ( isAssignable || hasConstructorParameters );
}

/**
- * Set the parameters to the supplied value. The supplied parameters value
- * will replace the existing parameters value.
- *
- * @param parameters
- * the supplied parameters value
- */
+ * Set the parameters to the supplied value. The supplied parameters
value will replace the existing parameters
+ * value.
+ *
+ * @param parameters the supplied parameters value
+ */
public void setParameters( Parameters parameters )
{
setParameters( parameters, true );
}

/**
- * Set the parameters to the supplied value. The supplied parameters value
- * may suppliment or replace the existing parameters value.
- *
- * @param parameters
- * the supplied parameters
- * @param merge
- * if TRUE the supplied parameters are merged with existing
- * parameters otherwise the supplied parameters replace any
- * existing parameters
- * @exception IllegalStateException
- * if the component type backing the model does not
implement
- * the parameteriazable interface
- * @exception NullArgumentException if the parameters argument is null.
- */
+ * Set the parameters to the supplied value. The supplied parameters
value may suppliment or replace the existing
+ * parameters value.
+ *
+ * @param parameters the supplied parameters
+ * @param merge if TRUE the supplied parameters are merged with
existing parameters otherwise the supplied
+ * parameters replace any existing parameters
+ *
+ * @throws IllegalStateException if the component type backing the model
does not implement the parameteriazable
+ * interface
+ * @throws NullArgumentException if the parameters argument is null.
+ */
public void setParameters( Parameters parameters, boolean merge )
throws IllegalStateException, NullArgumentException
{
- if ( !isParameterizable() )
+ if( isParameterizable() == false )
{
String name = getDeploymentClass().getName();
String error = REZ.getString(
"deployment.parameters.irrational", name, this.toString() );
throw new IllegalStateException( error );
}
-
- if ( parameters == null )
+ if( parameters == null )
{
throw new NullArgumentException( "parameters" );
}
-
- if ( merge )
+ if( merge )
{
Properties props = DefaultParameters.toProperties( m_parameters
);
Properties suppliment = DefaultParameters.toProperties(
parameters );
mergeParametersFromTwoProperties( suppliment, props );
- }
- else
+ } else
{
m_parameters = parameters;
}
@@ -529,15 +501,14 @@
private void mergeParametersFromTwoProperties( Properties suppliment,
Properties props )
{
Enumeration list = suppliment.propertyNames();
- while ( list.hasMoreElements() )
+ while( list.hasMoreElements() )
{
String name = (String) list.nextElement();
String value = suppliment.getProperty( name );
- if ( value == null )
+ if( value == null )
{
props.remove( name );
- }
- else
+ } else
{
props.setProperty( name, value );
}
@@ -546,14 +517,14 @@
}

/**
- * Return the parameters to be applied to the component.
- *
- * @return the assigned parameters
- */
+ * Return the parameters to be applied to the component.
+ *
+ * @return the assigned parameters
+ */
public Parameters getParameters()
{
DefaultParameters params = new DefaultParameters();
- if ( null != m_parameters )
+ if( null != m_parameters )
{
params.merge( m_parameters );
}
@@ -562,10 +533,10 @@
}

/**
- * Test if the component type backing the model is configurable.
- *
- * @return TRUE if the component type is configurable otherwise FALSE
- */
+ * Test if the component type backing the model is configurable.
+ *
+ * @return TRUE if the component type is configurable otherwise FALSE
+ */
public boolean isConfigurable()
{
boolean isAssignable = Configurable.class.isAssignableFrom(
getDeploymentClass() );
@@ -574,66 +545,57 @@
}

/**
- * Set the configuration to the supplied value. The supplied configuration
- * will replace the existing configuration.
- *
- * @param config
- * the supplied configuration
- * @exception IllegalStateException
- * if the component type backing the model does not
implement
- * the configurable interface
- * @exception ModelException
- * if the supplied configuration is null or not
successfully
- * validated (if requested)
- */
+ * Set the configuration to the supplied value. The supplied
configuration will replace the existing configuration.
+ *
+ * @param config the supplied configuration
+ *
+ * @throws IllegalStateException if the component type backing the model
does not implement the configurable
+ * interface
+ * @throws ModelException if the supplied configuration is null
or not successfully validated (if requested)
+ */
public void setConfiguration( Configuration config )
- throws IllegalStateException, ModelException
+ throws IllegalStateException, ModelException
{
setConfiguration( config, true );
}

/**
- * Set the configuration to the supplied value. The supplied configuration
- * may suppliment or replace the existing configuration.
- *
- * @param iConfig
- * the supplied configuration
- * @param policy
- * if FALSE the supplied configuration replaces the current
- * configuration otherwise the resoved configuration shall be
- * layed above the configuration supplied with the profile
which
- * in turn is layer above the type default configuration (if
any)
- * @exception IllegalStateException
- * if the component type backing the model does not
implement
- * the configurable interface
- * @exception ModelException
- * if the supplied configuration is null or if validation
had
- * errors
- */
+ * Set the configuration to the supplied value. The supplied
configuration may suppliment or replace the existing
+ * configuration.
+ *
+ * @param iConfig the supplied configuration
+ * @param policy if FALSE the supplied configuration replaces the
current configuration otherwise the resoved
+ * configuration shall be layed above the configuration
supplied with the profile which in turn is
+ * layer above the type default configuration (if any)
+ *
+ * @throws IllegalStateException if the component type backing the model
does not implement the configurable
+ * interface
+ * @throws ModelException if the supplied configuration is null
or if validation had errors
+ */
public void setConfiguration( Configuration iConfig, boolean policy )
- throws IllegalStateException, ModelException
+ throws IllegalStateException, ModelException
{
- if ( !isConfigurable() )
+ if( !isConfigurable() )
{
- final String error = REZ.getString(
- "deployment.configuration.irrational",
getDeploymentClass()
- .getName(), this.toString() );
+ Class deploymentClass = getDeploymentClass();
+ String classname = deploymentClass.getName();
+ String error = REZ.getString(
"deployment.configuration.irrational", classname, this.toString() );
throw new IllegalStateException( error );
}
-
- if ( iConfig == null )
+ if( iConfig == null )
{
throw new NullPointerException( "config" );
}
-
- if ( policy )
+ if( policy )
{
iConfig = consolidateConfigurations( iConfig, m_config );
}
- String schema = this.getType().getInfo().getConfigurationSchema();
- if ( schema != null )
+ Type type = getType();
+ InfoDescriptor info = type.getInfo();
+ String schema = info.getConfigurationSchema();
+ if( schema != null )
{
- if ( schema.equals( SCHEMA_TAG_W3CSCHEMA ) )
+ if( schema.equals( SCHEMA_TAG_W3CSCHEMA ) )
{
// TODO: this is the only validator we have, this should be
some
// factory later on
@@ -642,91 +604,85 @@
XercesSchemaValidator validator = new
XercesSchemaValidator();
// TODO: we have just one policy to locate schemas yet :
// Colocation to the component class
- Type type = getType();
- InfoDescriptor info = type.getInfo();
String classname = info.getClassname();
String iSchemaLocation = classname.replace( '.', '/' ) +
".xschema";
ClassLoader classLoader =
this.getClass().getClassLoader();
InputStream schemaStream =
classLoader.getResourceAsStream( iSchemaLocation );
validator.validate( iConfig, schemaStream );
- }
- catch( SAXException e )
+ } catch( SAXException e )
{
- final String error = "Configuration validation error.";
+ String error = "Configuration validation error.";
throw new ModelException( error, e );
- }
- catch( ParserConfigurationException e )
+ } catch( ParserConfigurationException e )
{
- final String error = "Configuration validation error.";
+ String error = "Configuration validation error.";
throw new ModelException( error, e );
- }
- catch( ModelException e )
+ } catch( ModelException e )
{
- final String error = "Configuration validation error.";
+ String error = "Configuration validation error.";
throw new ModelException( error, e );
- }
- catch( RuntimeException e )
+ } catch( RuntimeException e )
{
- final String error = "Configuration validation error.";
+ String error = "Configuration validation error.";
throw new ModelException( error, e );
}
}
else
{
- throw new ModelException( "validation method '" + schema +
"' is not supported. " + "If you want validation, try '" +
SCHEMA_TAG_W3CSCHEMA + "'." );
+ String message = "validation method '" + schema + "' is not
supported. If you want validation, try '" + SCHEMA_TAG_W3CSCHEMA + "'.";
+ throw new ModelException( message );
}
}
m_config = iConfig;
}

/**
- * Return the configuration to be applied to the component. The
- * implementation returns the current configuration state. If the the
- * component type does not implementation the Configurable interface, the
- * implementation returns null.
- *
- * @return the qualified configuration
- */
+ * Return the configuration to be applied to the component. The
implementation returns the current configuration
+ * state. If the the component type does not implementation the
Configurable interface, the implementation returns
+ * null.
+ *
+ * @return the qualified configuration
+ */
public Configuration getConfiguration()
{
return m_config;
}

/**
- * Return the context model for this deployment model.
- *
- * @return the context model if this model is context dependent, else the
- * return value is null
- */
+ * Return the context model for this deployment model.
+ *
+ * @return the context model if this model is context dependent, else
the return value is null
+ */
public ContextModel getContextModel()
{
return m_contextModel;
}

/**
- * Return the dependency models for this component type.
- *
- * @return the dependency models
- */
+ * Return the dependency models for this component type.
+ *
+ * @return the dependency models
+ */
public DependencyModel[] getDependencyModels()
{
return m_dependencies;
}

/**
- * Return a dependency model matching the supplied descriptor. If no model
- * matches the supplied descriptor the implementation will return null.
- *
- * @param dependency the dependency descriptor
- * @return the matching dependency model
- */
+ * Return a dependency model matching the supplied descriptor. If no
model matches the supplied descriptor the
+ * implementation will return null.
+ *
+ * @param dependency the dependency descriptor
+ *
+ * @return the matching dependency model
+ */
public DependencyModel getDependencyModel( DependencyDescriptor
dependency )
{
DependencyModel[] models = getDependencyModels();
- for ( int i = 0; i < models.length; i++ )
+ for( int i = 0; i < models.length; i++ )
{
- DependencyModel model = models[i];
- if ( dependency.equals( model.getDependency() ) )
+ DependencyModel model = models[ i ];
+ if( dependency.equals( model.getDependency() ) )
{
return model;
}
@@ -735,10 +691,10 @@
}

/**
- * Return the set of services produced by the model as a array of classes.
- *
- * @return the service classes
- */
+ * Return the set of services produced by the model as a array of
classes.
+ *
+ * @return the service classes
+ */
public Class[] getInterfaces()
{
//
@@ -749,39 +705,36 @@
ClassLoader classLoader = m_context.getClassLoader();
ArrayList list = new ArrayList();
ServiceDescriptor[] services = getServices();
- for ( int i = 0; i < services.length; i++ )
+ for( int i = 0; i < services.length; i++ )
{
- final ServiceDescriptor service = services[i];
- final String classname = service.getReference().getClassname();
+ ServiceDescriptor service = services[ i ];
+ String classname = service.getReference().getClassname();
list.add( getComponentClass( classLoader, classname ) );
}
-
- return (Class[]) list.toArray( new Class[0] );
+ return (Class[]) list.toArray( new Class[ 0 ] );
}

/**
- * Return the deployment timeout value for the component.
- *
- * @return the default deployment timeout value
- */
+ * Return the deployment timeout value for the component.
+ *
+ * @return the default deployment timeout value
+ */
public long getDeploymentTimeout()
{
Type type = m_context.getType();
InfoDescriptor info = type.getInfo();
String attribute = info.getAttribute( DEPLOYMENT_TIMEOUT_KEY, null );
- if ( null != attribute )
+ if( null != attribute )
{
try
{
return Long.parseLong( attribute );
- }
- catch ( NumberFormatException nfe )
+ } catch( NumberFormatException nfe )
{
- final String error = "Invalid timout parameter [" +
attribute + "] in component type [" + type + "].";
+ String error = "Invalid timout parameter [" + attribute + "]
in component type [" + type + "].";
throw new ModelRuntimeException( error, nfe );
}
- }
- else
+ } else
{
return super.getDeploymentTimeout();
}
@@ -792,28 +745,27 @@
// ==============================================================

/**
- * Test to determin if the first constructor supports the context base
class
- * as a parameter type.
- *
- * @return TRUE or FALSE
- */
+ * Test to determin if the first constructor supports the context base
class as a parameter type.
+ *
+ * @return TRUE or FALSE
+ */
private boolean isaConstructorArg( Class base )
{
- if ( null == base )
+ if( null == base )
{
return false;
}
Class clazz = getDeploymentClass();
Constructor[] constructors = clazz.getConstructors();
- if ( constructors.length == 0 )
+ if( constructors.length == 0 )
{
return false;
}
- Constructor constructor = constructors[0];
+ Constructor constructor = constructors[ 0 ];
Class[] types = constructor.getParameterTypes();
- for ( int i = 0; i < types.length; i++ )
+ for( int i = 0; i < types.length; i++ )
{
- if ( base.isAssignableFrom( types[i] ) )
+ if( base.isAssignableFrom( types[ i ] ) )
{
return true;
}
@@ -823,20 +775,18 @@

private Class getComponentClass( ClassLoader classLoader, String
classname )
{
- if ( classLoader == null )
+ if( classLoader == null )
{
throw new NullPointerException( "classLoader" );
}
- if ( classname == null )
+ if( classname == null )
{
throw new NullPointerException( "classname" );
}
-
try
{
return classLoader.loadClass( classname );
- }
- catch ( ClassNotFoundException e )
+ } catch( ClassNotFoundException e )
{
return null;
}
@@ -844,17 +794,15 @@

private Configuration consolidateConfigurations( Configuration primary,
Configuration defaults )
{
- if ( primary == null )
+ if( primary == null )
{
return defaults;
- }
- else
+ } else
{
- if ( defaults == null )
+ if( defaults == null )
{
return primary;
- }
- else
+ } else
{
return new CascadingConfiguration( primary, defaults );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionContext.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.provider.CompositionContext;
@@ -31,35 +30,31 @@
public class DefaultCompositionContext extends DefaultContext
implements CompositionContext
{
+
//--------------------------------------------------------------
// immutable state
//--------------------------------------------------------------

private final ClassLoader m_spi;
-
private final ClassLoader m_api;
-
private final long m_timeout;
-
private final boolean m_audit;

//--------------------------------------------------------------
// constructor
//--------------------------------------------------------------

- /**
- * Creation of a new top-level system context.
- *
- * @param timeout a system wide default deployment timeout
- */
+ /**
+ * Creation of a new top-level system context.
+ *
+ * @param timeout a system wide default deployment timeout
+ */
DefaultCompositionContext( ClassLoader api, ClassLoader spi, long
timeout, boolean audit )
throws NullArgumentException
{
super();
-
m_timeout = timeout;
m_audit = audit;
-
m_api = api;
m_spi = spi;
}
@@ -68,39 +63,41 @@
// CompositionContext
//--------------------------------------------------------------

- /**
- * Return true if the audit policy is enabled.
- * @return the audit enablement status flag
- */
+ /**
+ * Return true if the audit policy is enabled.
+ *
+ * @return the audit enablement status flag
+ */
public boolean isAuditEnabled()
{
return m_audit;
}

- /**
- * Return the API classloader.
- *
- * @return the system classloader
- */
+ /**
+ * Return the API classloader.
+ *
+ * @return the system classloader
+ */
public ClassLoader getAPIClassLoader()
{
return m_api;
}

- /**
- * Return the SPI classloader.
- *
- * @return the system classloader
- */
+ /**
+ * Return the SPI classloader.
+ *
+ * @return the system classloader
+ */
public ClassLoader getSPIClassLoader()
{
return m_spi;
}

- /**
- * Return the default deployment phase timeout value.
- * @return the timeout value
- */
+ /**
+ * Return the default deployment phase timeout value.
+ *
+ * @return the timeout value
+ */
public long getDefaultDeploymentTimeout()
{
return m_timeout;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionController.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionController.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionController.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.activity.Startable;
@@ -30,31 +29,30 @@
import java.io.Serializable;

/**
- * Containment model implmentation within which composite models are
aggregated
- * as a part of a containment deployment model.
+ * Containment model implmentation within which composite models are
aggregated as a part of a containment deployment
+ * model.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class DefaultCompositionController extends DefaultContainmentModel
+public class DefaultCompositionController extends DefaultContainmentModel
implements Startable, Serializable
{
- static final long serialVersionUID = 1L;

+ static final long serialVersionUID = 1L;
static private final String[] STATE_NAMES =
- {
- "state: initializing",
- "state: initialized",
- "state: starting",
- "state: assembly",
- "state: deployment",
- "state: started",
- "state: stopping",
- "state: decommissioning",
- "state: dissassembly",
- "state: stopped"
- };
-
+ {
+ "state: initializing",
+ "state: initialized",
+ "state: starting",
+ "state: assembly",
+ "state: deployment",
+ "state: started",
+ "state: stopping",
+ "state: decommissioning",
+ "state: dissassembly",
+ "state: stopped"
+ };
static final int INITIALIZING = 0;
static final int INITIALIZED = 1;
static final int STARTING = 2;
@@ -71,7 +69,6 @@
//--------------------------------------------------------------

private int m_state;
-
private CompositionContext m_composition;

//--------------------------------------------------------------
@@ -82,15 +79,12 @@
throws ModelException
{
super( context );
-
m_composition = composition;
setState( INITIALIZING );
-
if( getLogger().isDebugEnabled() )
{
getLogger().debug( "controller established" );
}
-
setState( INITIALIZED );
}

@@ -99,9 +93,10 @@
//--------------------------------------------------------------

/**
- * Start the model.
- * @exception Exception if a startup failure occurs
- */
+ * Start the model.
+ *
+ * @throws Exception if a startup failure occurs
+ */
public void start()
throws Exception
{
@@ -111,12 +106,14 @@

synchronized( this )
{
- if( !isStartable() ) return;
+ if( isStartable() == false )
+ {
+ return;
+ }
if( getLogger().isDebugEnabled() )
{
getLogger().debug( "initiating assembly" );
}
-
try
{
setState( ASSEMBLY );
@@ -126,79 +123,67 @@
String listing = CompositionHelper.toString( this );
getLogger().info( listing );
}
- }
- catch( AssemblyException e )
+ } catch( AssemblyException e )
{
setState( INITIALIZED );
- final String error =
- "Cannot assemble application due to exception.";
+ String error = "Cannot assemble application due to
exception.";
throw new CompositionException( error, e );
- }
- catch( RuntimeException e )
+ } catch( RuntimeException e )
{
setState( INITIALIZED );
- final String error =
- "Cannot assemble application due to throwable.";
+ String error = "Cannot assemble application due to
throwable.";
throw new CompositionRuntimeException( error, e );
}
-
if( getLogger().isDebugEnabled() )
{
getLogger().debug( "application deployment" );
}
-
try
{
setState( DEPLOYMENT );
super.commission();
- }
- catch( Exception e )
+ } catch( Exception e )
{
setState( INITIALIZED );
- final String error =
- "Cannot deploy application.";
+ String error = "Cannot deploy application.";
throw new CompositionException( error, e );
- }
- catch( Throwable e )
+ } catch( Throwable e )
{
setState( INITIALIZED );
- final String error =
- "Cannot deploy application.";
+ String error = "Cannot deploy application.";
throw new CompositionRuntimeException( error, e );
}
-
setState( STARTED );
}
}

/**
- * Stop the model.
- * @exception Exception if a shutdown failure occurs
- */
+ * Stop the model.
+ *
+ * @throws Exception if a shutdown failure occurs
+ */
public void stop()
throws Exception
{
synchronized( this )
{
- if( !isStoppable() ) return;
-
+ if( !isStoppable() )
+ {
+ return;
+ }
setState( STOPPING );
-
try
{
setState( DECOMMISSIONING );
super.decommission();
- }
- catch( Throwable e )
+ } catch( Throwable e )
{
if( getLogger().isWarnEnabled() )
{
- final String error =
- "Ignoring block decommissioning error.";
+ String error = "Ignoring block decommissioning error.";
getLogger().warn( error, e );
}
}
-
setState( STOPPED );
}
}
@@ -238,12 +223,11 @@
}

/**
- * Set the state of the controller. The method also triggers the
- * emmission of a attribute change notification containing the
- * old and new state value.
- *
- * @param state a string representing the new controller state
- */
+ * Set the state of the controller. The method also triggers the
emmission of a attribute change notification
+ * containing the old and new state value.
+ *
+ * @param state a string representing the new controller state
+ */
private void setState( int state )
{
m_state = state;
@@ -253,28 +237,4 @@
{
return m_state;
}
-
-/* Probably not used.
- public void dispose()
- {
- if( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "disposal" );
- }
-
- try
- {
- stop();
- }
- catch( Throwable e )
- {
- if( getLogger().isWarnEnabled() )
- {
- final String error =
- "Ignoring controller shutdown error.";
- getLogger().warn( error, e );
- }
- }
- }
-*/
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionCriteria.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionCriteria.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionCriteria.java
Tue Jun 28 08:36:24 2005
@@ -53,14 +53,16 @@
{
// TODO: What do we put in here???
Properties properties = System.getProperties();
- return new Parameter[] {
+ Parameter[] parameters = new Parameter[]
+ {
new Parameter( AUDIT_ENABLED_KEY, Boolean.class,
getBooleanDefault( properties, AUDIT_ENABLED_KEY, false ) ),
new Parameter( RUNTIME_ARTIFACT_KEY, String.class,
properties.getProperty( RUNTIME_ARTIFACT_KEY ) ),
new Parameter( DEPLOYMENT_TIMEOUT_KEY, Long.class,
properties.getProperty( DEPLOYMENT_TIMEOUT_KEY) ),
new Parameter( KERNEL_KEY, String.class, properties.getProperty(
KERNEL_KEY ) ),
new Parameter( OVERRIDE_KEY, String.class,
properties.getProperty( OVERRIDE_KEY ) ),
new PackedParameter( DEPLOYMENT_KEY, ",", getDefaultDeployment(
properties.getProperty( OVERRIDE_KEY ) ) )
- };
+ };
+ return parameters;
}

private static Boolean getBooleanDefault( Properties properties, String
key, boolean fallback )
@@ -291,7 +293,7 @@
else
{
FileNotFoundException fnfe = new FileNotFoundException(
value );
- final String error = "Unable to resolve the block path
[" + value + "].";
+ String error = "Unable to resolve the block path [" +
value + "].";
throw new CompositionRuntimeException( error, fnfe );
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultCompositionFactory.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.StuffNeeded;
@@ -59,33 +58,19 @@
public class DefaultCompositionFactory
implements Factory, CompositionFactory
{
- private static final String LINE =
"-------------------------------------------\n";
-
- //--------------------------------------------------------------
- // static
- //--------------------------------------------------------------

+ private static final String LINE =
"-------------------------------------------\n";
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultCompositionFactory.class );
-
private static final String ACTIVATION_IMPL_SPEC =
"@ACTIVATION-IMPL-SPEC@";
-
- //--------------------------------------------------------------
- // immutable state
- //--------------------------------------------------------------
-
private final CommandLine m_line;
private Logger m_logger;
private BundleContext m_OsgiContext;

- //--------------------------------------------------------------
- // constructor
- //--------------------------------------------------------------
-
/**
- * Creation of a new system context.
- *
- * @param args the command line arguments
- */
+ * Creation of a new system context.
+ *
+ * @param args the command line arguments
+ */
public DefaultCompositionFactory( Logger logger, BundleContext osgi,
String[] args )
throws ParseException
{
@@ -96,15 +81,11 @@
m_line = parser.parse( options, args, false );
}

- //--------------------------------------------------------------
- // CompositionFactory
- //--------------------------------------------------------------
-
/**
- * Return the default criteria map.
- *
- * @return a new instance of the default factory criteria
- */
+ * Return the default criteria map.
+ *
+ * @return a new instance of the default factory criteria
+ */
public CompositionCriteria createCompositionCriteria()
{
CompositionCriteria criteria = new DefaultCompositionCriteria();
@@ -130,7 +111,7 @@
if( m_line.hasOption( "runtime" ) )
{
String runtime = m_line.getOptionValue( "runtime" );
- criteria.put( CompositionCriteria.RUNTIME_ARTIFACT_KEY , runtime
);
+ criteria.put( CompositionCriteria.RUNTIME_ARTIFACT_KEY, runtime
);
}
if( m_line.hasOption( "config" ) )
{
@@ -142,6 +123,7 @@

/**
* Creation of a new root containment model.
+ *
* @return the root container
*/
public ContainmentModel createContainmentModel()
@@ -153,20 +135,19 @@

/**
* Creation of a new root containment model.
+ *
* @param map the composition criteria
+ *
* @return the root container
*/
public ContainmentModel createContainmentModel( Map map )
throws CompositionException
{
CompositionCriteria criteria = buildCompositionCriteria( map );
-
boolean audit = getAuditMode( criteria );
long timeout = getDefaultDeploymentTimeout( criteria );
-
File dir = StuffNeeded.getWorkingDirectory();
URL kernel = resolveURL( dir, criteria.getKernelPath(), false );
-
try
{
URI uri = getRuntimeURI( criteria );
@@ -188,15 +169,13 @@
pack( buffer, CompositionCriteria.DEPLOYMENT_TIMEOUT_KEY,
timeout );
if( deployment.length == 1 )
{
- pack( buffer, CompositionCriteria.DEPLOYMENT_KEY,
deployment[0] );
- }
- else
+ pack( buffer, CompositionCriteria.DEPLOYMENT_KEY,
deployment[ 0 ] );
+ } else
{
pack( buffer, CompositionCriteria.DEPLOYMENT_KEY, "" +
deployment.length + " entries:" );
-
- for( int i=0; i<deployment.length; i++ )
+ for( int i = 0; i < deployment.length; i++ )
{
- buffer.append( "\n Block (" + (i+1) + "): " +
deployment[i] );
+ buffer.append( "\n Block (" + ( i + 1 ) + "): " +
deployment[ i ] );
}
}
pack( buffer, CompositionCriteria.OVERRIDE_KEY, overrides );
@@ -204,8 +183,7 @@
if( StuffNeeded.getInfoMode() )
{
getLogger().info( buffer.toString() );
- }
- else
+ } else
{
getLogger().debug( buffer.toString() );
}
@@ -217,7 +195,6 @@

ClassLoader api = DeploymentModel.class.getClassLoader();
ClassLoader spi = CompositionContext.class.getClassLoader();
-
CompositionContext context = new DefaultCompositionContext( api,
spi, timeout, audit );
if( getLogger().isDebugEnabled() )
{
@@ -228,47 +205,38 @@
// create the model factory and return the root model
//

- ModelFactory modelFactory = new DefaultModelFactory( context,
uri, kernel, deployment, overrides );
+ ModelFactory modelFactory = new DefaultModelFactory( context,
uri, kernel, deployment, overrides,
+ m_OsgiContext
+ );
return modelFactory.getRootModel();
- }
- catch( CompositionException ce )
+ } catch( CompositionException ce )
{
throw ce;
- }
- catch( ModelException me )
+ } catch( ModelException me )
{
throw new CompositionException( me.getMessage(), me.getCause() );
- }
- catch( NullArgumentException e )
+ } catch( NullArgumentException e )
{
final String error = "Root model creation error.";
throw new CompositionException( error, e );
- }
- catch( IOException e )
+ } catch( IOException e )
{
final String error = "Root model creation error.";
throw new CompositionException( error, e );
- }
- catch( URISyntaxException e )
+ } catch( URISyntaxException e )
{
final String error = "Root model creation error.";
throw new CompositionException( error, e );
- }
- catch( RuntimeException e )
+ } catch( RuntimeException e )
{
final String error = "Root model creation error.";
throw new CompositionException( error, e );
}
}

- //--------------------------------------------------------------
- // Factory
- //--------------------------------------------------------------
-
/**
- * Return the default criteria map. The implementation returns a map
- * preloaded with defaults based on declared properties and command line
- * arguments declared to the factory.
+ * Return the default criteria map. The implementation returns a map
preloaded with defaults based on declared
+ * properties and command line arguments declared to the factory.
*
* @return a new instance of the default factory criteria
*/
@@ -279,45 +247,42 @@

/**
* Creation of a new composition context.
+ *
* @return the composition context instance
*/
- public Object create() throws Exception
+ public Object create()
+ throws Exception
{
return createContainmentModel();
}

/**
* Creation of a new composition context.
+ *
* @return the composition context instance
*/
- public Object create( Map map ) throws Exception
+ public Object create( Map map )
+ throws Exception
{
return createContainmentModel( map );
}

- //--------------------------------------------------------------
- // internals
- //--------------------------------------------------------------
-
private CompositionCriteria buildCompositionCriteria( Map map )
{
if( map instanceof CompositionCriteria )
{
return (CompositionCriteria) map;
- }
- else
+ } else
{
CompositionCriteria criteria = (CompositionCriteria)
createDefaultCriteria();
String[] keys = CompositionCriteria.KEYS;
-
if( getLogger().isDebugEnabled() )
{
getLogger().debug( "building composition criteria using
external map" );
}
-
- for( int i=0; i<keys.length; i++ )
+ for( int i = 0; i < keys.length; i++ )
{
- String key = keys[i];
+ String key = keys[ i ];
Object value = map.get( key );
if( null != value )
{
@@ -338,8 +303,7 @@
if( null != value )
{
return value.booleanValue();
- }
- else
+ } else
{
return false;
}
@@ -351,33 +315,32 @@
if( null == value )
{
return 6000; // SJM changed from 1000 to 6000
- }
- else
+ } else
{
return value.longValue();
}
}

- private URI getRuntimeURI( CompositionCriteria criteria ) throws
URISyntaxException
+ private URI getRuntimeURI( CompositionCriteria criteria )
+ throws URISyntaxException
{
String value = criteria.getRuntimeSpecification();
if( null == value )
{
return Artifact.createArtifact( ACTIVATION_IMPL_SPEC ).toURI();
- }
- else
+ } else
{
return Artifact.createArtifact( value ).toURI();
}
}

- private URL convertToURL( File file ) throws CompositionException
+ private URL convertToURL( File file )
+ throws CompositionException
{
try
{
return file.toURL();
- }
- catch( MalformedURLException e )
+ } catch( MalformedURLException e )
{
final String error = "Error while attempting to convert the file
[" + file + "] to a url.";
throw new CompositionException( error, e );
@@ -392,39 +355,34 @@
private Options buildCommandLineOptions()
{
Options options = new Options();
-
Option option = new Option( "audit", REZ.getString(
"cli-audit-description" ) );
options.addOption( option );
-
- option = createOption("cli-runtime-description", "runtime",
"artifact");
+ option = createOption( "cli-runtime-description", "runtime",
"artifact" );
options.addOption( option );
-
- option = createOption( "cli-timeout-description", "timeout",
"millis");
+ option = createOption( "cli-timeout-description", "timeout",
"millis" );
options.addOption( option );
-
- option = createOption("cli-kernel-description", "kernel", "path");
+ option = createOption( "cli-kernel-description", "kernel", "path" );
options.addOption( option );
-
- option = createOption("cli-override-description", "config", "path");
+ option = createOption( "cli-override-description", "config", "path"
);
options.addOption( option );
-
return options;
}

private Option createOption( String i18n, String optionName, String
argName )
{
- String text = REZ.getString( i18n );
+ String text = REZ.getString( i18n );
Option option = new Option( optionName, true, text );
option.setArgName( argName );
return option;
}

private URL getTargetOverrideURL( File dir, String path )
- throws CompositionException, IOException
+ throws CompositionException, IOException
{
if( null == path )
+ {
return null;
-
+ }
if( !isaURL( path ) )
{
File file = resolveFile( dir, path );
@@ -432,27 +390,23 @@
{
File defaultFile = new File( file, "config.xml" );
return getTargetOverrideURL( dir, defaultFile.toString() );
- }
- else if( !file.exists() )
+ } else if( !file.exists() )
{
final String error =
- "Target override path ["
- + path
- + "] does not exist.";
+ "Target override path ["
+ + path
+ + "] does not exist.";
throw new CompositionException( error );
- }
- else
+ } else
{
return convertToURL( file );
}
- }
- else
+ } else
{
return resolveURL( dir, path );
}
}

-
private URL resolveURL( File base, String path )
{
return resolveURL( base, path, true );
@@ -463,46 +417,39 @@
{
if( null == path )
{
- if( fail )
- {
- throw new NullArgumentException( "path" );
- }
- else
- {
- return null;
- }
+ if( fail )
+ {
+ throw new NullArgumentException( "path" );
+ } else
+ {
+ return null;
+ }
}
-
try
{
if( isaURL( path ) )
{
return new URL( path );
- }
- else
+ } else
{
File absolute = new File( path );
if( absolute.isAbsolute() )
{
return convertToURL( absolute );
- }
- else
+ } else
{
return convertToURL( new File( base, path ) );
}
}
- }
- catch( MalformedURLException e )
+ } catch( MalformedURLException e )
{
String error = "Unable to convert the supplied path [" + path +
"] to a url.";
throw new CompositionRuntimeException( error, e );
- }
- catch( CompositionException e )
+ } catch( CompositionException e )
{
String error = "Unable to convert the supplied path [" + path +
"] to a url.";
throw new CompositionRuntimeException( error, e );
- }
- catch( RuntimeException e )
+ } catch( RuntimeException e )
{
String error = "Unable to convert the supplied path [" + path +
"] to a url.";
throw new CompositionRuntimeException( error, e );
@@ -519,9 +466,8 @@
File absolute = new File( path );
if( absolute.isAbsolute() )
{
- return absolute;
- }
- else
+ return absolute;
+ } else
{
File f = new File( base, path );
return f.getCanonicalFile();
@@ -530,7 +476,7 @@

private boolean isaURL( String path )
{
- return path.indexOf( ":" ) > 2 ;
+ return path.indexOf( ":" ) > 2;
}

private void pack( StringBuffer buffer, String key, boolean value )

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultConstructorModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultConstructorModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultConstructorModel.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.data.ConstructorDirective;
@@ -32,7 +31,6 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Map;

-
/**
* Default implementation of a the context entry constructor model.
*
@@ -41,52 +39,30 @@
*/
public class DefaultConstructorModel extends DefaultEntryModel
{
- //==============================================================
- // static
- //==============================================================
-
- private static final Resources REZ =
- ResourceManager.getPackageResources( DefaultConstructorModel.class );
-
- //==============================================================
- // immutable state
- //==============================================================

- private final ConstructorDirective m_directive;
+ private static final Resources REZ =
ResourceManager.getPackageResources( DefaultConstructorModel.class );

+ private final ConstructorDirective m_directive;
private final EntryDescriptor m_descriptor;
-
private final ComponentContext m_context;
-
private final Map m_map;

- //==============================================================
- // mutable state
- //==============================================================
-
private Object m_value;

- //==============================================================
- // constructor
- //==============================================================
-
/**
- * Creation of a new context entry import model.
- *
- * @param descriptor the context entry descriptor
- * @param directive the context entry directive
- * @param context the containment context
- * @param map a map of available context entries
- * @exception NullArgumentException if either the directive argument or
the
- * context argument is null.
- */
- public DefaultConstructorModel(
- EntryDescriptor descriptor, ConstructorDirective directive,
- ComponentContext context, Map map )
+ * Creation of a new context entry import model.
+ *
+ * @param descriptor the context entry descriptor
+ * @param directive the context entry directive
+ * @param context the containment context
+ * @param map a map of available context entries
+ *
+ * @throws NullArgumentException if either the directive argument or the
context argument is null.
+ */
+ public DefaultConstructorModel( EntryDescriptor descriptor,
ConstructorDirective directive, ComponentContext context, Map map )
throws ModelException, NullArgumentException
{
super( descriptor );
-
if( directive == null )
{
throw new NullArgumentException( "directive" );
@@ -99,15 +75,14 @@
m_directive = directive;
m_context = context;
m_map = map;
-
validate();
}

private void validate()
throws ModelException
{
- final String descriptorClassName = m_descriptor.getClassname();
- final String directiveClassName = m_directive.getClassname();
+ String descriptorClassName = m_descriptor.getClassname();
+ String directiveClassName = m_directive.getClassname();
validatePair( descriptorClassName, directiveClassName );

//
@@ -121,65 +96,46 @@
private void validatePair( String descriptorClass, String directiveClass
)
throws ModelException
{
- final String key = m_descriptor.getKey();
+ String key = m_descriptor.getKey();
ClassLoader loader = m_context.getClassLoader();
-
Class target = null;
try
{
target = loader.loadClass( descriptorClass );
- }
- catch( ClassNotFoundException e )
+ } catch( ClassNotFoundException e )
{
- final String error =
- REZ.getString( "constructor.descriptor.unknown.error", key,
descriptorClass );
+ String error = REZ.getString(
"constructor.descriptor.unknown.error", key, descriptorClass );
throw new ModelException( error );
- }
- catch( Throwable e )
+ } catch( Throwable e )
{
- final String error =
- REZ.getString( "constructor.descriptor.load.error", key,
descriptorClass );
+ String error = REZ.getString(
"constructor.descriptor.load.error", key, descriptorClass );
throw new ModelException( error, e );
}
-
Class source = null;
try
{
source = loader.loadClass( directiveClass );
- }
- catch( ClassNotFoundException e )
+ } catch( ClassNotFoundException e )
{
- final String error =
- REZ.getString( "constructor.directive.unknown.error", key,
directiveClass );
+ String error = REZ.getString(
"constructor.directive.unknown.error", key, directiveClass );
throw new ModelException( error );
- }
- catch( Throwable e )
+ } catch( Throwable e )
{
- final String error =
- REZ.getString( "constructor.directive.load.error", key,
directiveClass );
+ String error = REZ.getString(
"constructor.directive.load.error", key, directiveClass );
throw new ModelException( error, e );
}
-
- if( !target.isAssignableFrom( source ) )
+ if( target.isAssignableFrom( source ) == false )
{
- final String error =
- REZ.getString(
- "constructor.invalid-model.error",
- key, descriptorClass, directiveClass );
+ String error = REZ.getString( "constructor.invalid-model.error",
key, descriptorClass, directiveClass );
throw new ModelException( error );
}
}

-
- //==============================================================
- // EntryModel
- //==============================================================
-
/**
- * Return the context entry value.
- *
- * @return the context entry value
- */
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
public Object getValue()
throws ModelException
{
@@ -187,7 +143,6 @@
{
return m_value;
}
-
String target = m_descriptor.getKey();
Object object = null;
try
@@ -198,31 +153,27 @@
Parameter[] params = m_directive.getParameters();
Class clazz = getParameterClass( classname, loader );
object = getValue( loader, clazz, argument, params );
- }
- catch( ModelException e )
+ } catch( ModelException e )
{
String error = "Cannot establish a constructed context entry for
the key " + target + " due to a runtime failure.";
throw new ModelException( error, e );
- }
- catch( RuntimeException e )
+ } catch( RuntimeException e )
{
String error = "Cannot establish a constructed context entry for
the key " + target + " due to a runtime failure.";
throw new ModelException( error, e );
}
-
- if( !m_descriptor.isVolatile() )
+ if( m_descriptor.isVolatile() == false )
{
m_value = object;
}
-
return object;
}

/**
- * Return the context entry value.
- *
- * @return the context entry value
- */
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
public Object getValue( Parameter p )
throws ModelException
{
@@ -235,14 +186,17 @@
}

/**
- * Return the derived parameter value.
- * @param loader the classloader to use
- * @param clazz the constructor class
- * @param argument a single string constructor argument
- * @param parameters an alternative sequence of arguments
- * @return the value
- * @exception ModelException if the parameter value cannot be resolved
- */
+ * Return the derived parameter value.
+ *
+ * @param loader the classloader to use
+ * @param clazz the constructor class
+ * @param argument a single string constructor argument
+ * @param parameters an alternative sequence of arguments
+ *
+ * @return the value
+ *
+ * @throws ModelException if the parameter value cannot be resolved
+ */
public Object getValue( ClassLoader loader, Class clazz, String
argument, Parameter[] parameters )
throws ModelException
{
@@ -257,15 +211,13 @@
if( argument == null )
{
return getNullArgumentConstructorValue( clazz );
- }
- else
+ } else
{
return getSingleArgumentConstructorValue( clazz, argument );
}
- }
- else
+ } else
{
- return getMultiArgumentConstructorValue( loader, clazz,
parameters );
+ return getMultiArgumentConstructorValue( loader, clazz,
parameters );
}
}

@@ -277,60 +229,52 @@
// parameters are defined by the nested parameter definitions
//

- if ( parameters.length == 0 )
+ if( parameters.length == 0 )
{
try
{
return clazz.newInstance();
- }
- catch ( InstantiationException e )
+ } catch( InstantiationException e )
{
String error = "Unable to instantiate instance of class: " +
clazz.getName();
throw new ModelException( error, e );
- }
- catch ( IllegalAccessException e )
+ } catch( IllegalAccessException e )
{
String error = "Cannot access null constructor for the
class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
}
- }
- else
+ } else
{
Class[] params = new Class[ parameters.length ];
- for ( int i = 0; i < parameters.length; i++ )
+ for( int i = 0; i < parameters.length; i++ )
{
- String classname = parameters[i].getClassname();
+ String classname = parameters[ i ].getClassname();
try
{
- params[i] = classLoader.loadClass( classname );
- }
- catch ( ClassNotFoundException e )
+ params[ i ] = classLoader.loadClass( classname );
+ } catch( ClassNotFoundException e )
{
String error = "Unable to resolve sub-parameter class: "
+ classname + " for the parameter " + clazz.getName();
throw new ModelException( error, e );
- }
- catch ( RuntimeException e )
+ } catch( RuntimeException e )
{
String error = "Unable to resolve sub-parameter class: "
+ classname + " for the parameter " + clazz.getName();
throw new ModelException( error, e );
}
}
-
Object[] values = new Object[ parameters.length ];
- for ( int i = 0; i < parameters.length; i++ )
+ for( int i = 0; i < parameters.length; i++ )
{
- Parameter p = parameters[i];
+ Parameter p = parameters[ i ];
String classname = p.getClassname();
try
{
- values[i] = getValue( p );
- }
- catch ( ModelException e )
+ values[ i ] = getValue( p );
+ } catch( ModelException e )
{
String error = "Unable to instantiate sub-parameter for
value: " + classname + " inside the parameter " + clazz.getName();
throw new ModelException( error, e );
- }
- catch ( RuntimeException e )
+ } catch( RuntimeException e )
{
String error = "Unable to instantiate sub-parameter for
value: " + classname + " inside the parameter " + clazz.getName();
throw new ModelException( error, e );
@@ -341,38 +285,31 @@
{
constructor = clazz.getConstructor( params );
return constructor.newInstance( values );
- }
- catch ( NoSuchMethodException e )
+ } catch( NoSuchMethodException e )
{
String error = "Supplied parameters for " + clazz.getName()
+ " do not match the available class constructors.";
throw new ModelException( error, e );
- }
- catch ( InstantiationException e )
+ } catch( InstantiationException e )
{
String error = "Unable to instantiate an instance of a
multi-parameter constructor for class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
- }
- catch ( IllegalAccessException e )
+ } catch( IllegalAccessException e )
{
String error = "Cannot access multi-parameter constructor
for the class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
- }
- catch ( IllegalArgumentException e )
+ } catch( IllegalArgumentException e )
{
String error = "Unexpected error while attmpting to
instantiate a multi-parameter constructor " + "for the class: '" +
clazz.getName() + "'.";
throw new ModelException( error, e );
- }
- catch( InvocationTargetException e )
+ } catch( InvocationTargetException e )
{
String error = "Exception occurred in constructor for the
class: '" + clazz.getName() + "'.";
throw new ModelException( error, e.getTargetException() );
- }
- catch( SecurityException e )
+ } catch( SecurityException e )
{
String error = "Construction of instance is not allowed for
the class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
- }
- catch ( RuntimeException e )
+ } catch( RuntimeException e )
{
String error = "Unexpected error while attmpting to
instantiate a multi-parameter constructor " + "for the class: '" +
clazz.getName() + "'.";
throw new ModelException( error, e );
@@ -386,22 +323,17 @@
try
{
return clazz.newInstance();
- }
- catch( InstantiationException e )
+ } catch( InstantiationException e )
{
- final String error = "Unable to instantiate instance of class: "
+ clazz.getName();
+ String error = "Unable to instantiate instance of class: " +
clazz.getName();
throw new ModelException( error, e );
- }
- catch( IllegalAccessException e )
+ } catch( IllegalAccessException e )
{
- final String error = "Cannot access null parameter constructor
for the class: '" + clazz.getName() + "'.";
+ String error = "Cannot access null parameter constructor for the
class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
- }
- catch( RuntimeException e )
+ } catch( RuntimeException e )
{
- final String error =
- "Unexpected exception while creating the class: '"
- + clazz.getName() + "'.";
+ String error = "Unexpected exception while creating the class:
'" + clazz.getName() + "'.";
throw new ModelException( error, e );
}
}
@@ -409,36 +341,32 @@
private Object getSingleArgumentConstructorValue( Class clazz, String
argument )
throws ModelException
{
- if ( argument.startsWith( "${" ) )
+ if( argument.startsWith( "${" ) )
{
- if ( argument.endsWith( "}" ) )
+ if( argument.endsWith( "}" ) )
{
- final String key = argument.substring( 2, argument.length()
- 1 );
+ String key = argument.substring( 2, argument.length() - 1 );
Object value = m_map.get( key );
- if ( value != null )
+ if( value != null )
{
if( value instanceof EntryModel )
{
- return ((EntryModel)value).getValue();
- }
- else
+ return ( (EntryModel) value ).getValue();
+ } else
{
return value;
}
- }
- else
+ } else
{
- final String error = "Unresolvable primative context
value: '" + key + "'.";
+ String error = "Unresolvable primative context value: '"
+ key + "'.";
throw new ModelException( error );
}
- }
- else
+ } else
{
- final String error = "Illegal format for context reference:
'" + argument + "'.";
+ String error = "Illegal format for context reference: '" +
argument + "'.";
throw new ModelException( error );
}
- }
- else
+ } else
{
//
// the argument is a simple type that takes a single String value
@@ -447,101 +375,87 @@

try
{
- Class[] params = new Class[]{ String.class };
+ Class[] params = new Class[]{String.class};
Constructor constructor = clazz.getConstructor( params );
- Object[] values = new Object[]{ argument };
+ Object[] values = new Object[]{argument};
return constructor.newInstance( values );
- }
- catch( NoSuchMethodException e )
+ } catch( NoSuchMethodException e )
{
String error = "Class: '" + clazz.getName() + "' does not
implement a single string argument constructor.";
throw new ModelException( error );
- }
- catch( InstantiationException e )
+ } catch( InstantiationException e )
{
String error = "Unable to instantiate instance of class: " +
clazz.getName() + " with the single argument: '" + argument + "'";
throw new ModelException( error, e );
- }
- catch( IllegalAccessException e )
+ } catch( IllegalAccessException e )
{
String error = "Cannot access single string parameter
constructor for the class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
- }
- catch( InvocationTargetException e )
+ } catch( InvocationTargetException e )
{
String error = "Exception occurred in constructor for the
class: '" + clazz.getName() + "'.";
throw new ModelException( error, e.getTargetException() );
- }
- catch( SecurityException e )
+ } catch( SecurityException e )
{
String error = "Construction of instance is not allowed for
the class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
- }
- catch( IllegalArgumentException e )
+ } catch( IllegalArgumentException e )
{
- String error = "Unexpected exception while creating a single
string parameter value for the class: '"+ clazz.getName() + "'.";
+ String error = "Unexpected exception while creating a single
string parameter value for the class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
- }
- catch( RuntimeException e )
+ } catch( RuntimeException e )
{
- String error = "Unexpected exception while creating a single
string parameter value for the class: '"+ clazz.getName() + "'.";
+ String error = "Unexpected exception while creating a single
string parameter value for the class: '" + clazz.getName() + "'.";
throw new ModelException( error, e );
}
}
}

/**
- * Return the classname of the parameter implementation to use.
- * @param classLoader the classloader to use
- * @return the parameter class
- * @exception ModelException if the parameter class cannot be resolved
- */
- Class getParameterClass( String classname, ClassLoader classLoader )
+ * Return the classname of the parameter implementation to use.
+ *
+ * @param classLoader the classloader to use
+ *
+ * @return the parameter class
+ *
+ * @throws ModelException if the parameter class cannot be resolved
+ */
+ Class getParameterClass( String classname, ClassLoader classLoader )
throws ModelException
{
try
{
return classLoader.loadClass( classname );
- }
- catch ( final ClassNotFoundException e )
+ } catch( ClassNotFoundException e )
{
- if ( "int".equals( classname ) )
+ if( "int".equals( classname ) )
{
return int.class;
- }
- else if ( "short".equals( classname ) )
+ } else if( "short".equals( classname ) )
{
return short.class;
- }
- else if ( "long".equals( classname ) )
+ } else if( "long".equals( classname ) )
{
return long.class;
- }
- else if ( "byte".equals( classname ) )
+ } else if( "byte".equals( classname ) )
{
return byte.class;
- }
- else if ( "double".equals( classname ) )
+ } else if( "double".equals( classname ) )
{
return double.class;
- }
- else if ( "byte".equals( classname ) )
+ } else if( "byte".equals( classname ) )
{
return byte.class;
- }
- else if ( "float".equals( classname ) )
+ } else if( "float".equals( classname ) )
{
return float.class;
- }
- else if ( "char".equals( classname ) )
+ } else if( "char".equals( classname ) )
{
return char.class;
- }
- else if ( "boolean".equals( classname ) )
+ } else if( "boolean".equals( classname ) )
{
return boolean.class;
- }
- else
+ } else
{
throw new ModelException( "Could not locate the parameter
implementation for class: '" + classname + "'.", e );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModel.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.data.BlockCompositionDirective;
@@ -40,9 +39,9 @@
import net.dpml.composition.model.DuplicateNameException;
import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ModelRepository;
+import net.dpml.composition.model.ProfileUnknownException;
import net.dpml.composition.model.ServiceModel;
import net.dpml.composition.model.TypeRepository;
-import net.dpml.composition.model.ProfileUnknownException;
import net.dpml.composition.model.TypeUnknownException;
import net.dpml.composition.provider.ComponentContext;
import net.dpml.composition.provider.ContainmentContext;
@@ -74,71 +73,50 @@
import java.util.LinkedList;
import java.util.List;

-
/**
-* Containment model implmentation within which composite models are
aggregated
-* as a part of a containment deployment model.
-*
-* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
-* @version $Id$
-*/
+ * Containment model implmentation within which composite models are
aggregated as a part of a containment deployment
+ * model.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id$
+ */
public class DefaultContainmentModel extends DefaultDeploymentModel
implements ContainmentModel
{
- //--------------------------------------------------------------
- // static
- //--------------------------------------------------------------

private static final Resources REZ =
ResourceManager.getPackageResources( DefaultContainmentModel.class );
-
private static final ContainmentProfileBuilder BUILDER = new
ContainmentProfileBuilder();
-
private static final XMLContainmentProfileCreator CREATOR = new
XMLContainmentProfileCreator();
-
private static final XMLTargetsCreator TARGETS = new XMLTargetsCreator();

- //--------------------------------------------------------------
- // immutable state
- //--------------------------------------------------------------
-
private final LinkedList m_compositionListeners = new LinkedList();
-
private final DefaultState m_assembly = new DefaultState();
-
private final ContainmentContext m_context;
-
private final String m_partition;
-
private final ServiceModel[] m_services;
-
private final DefaultState m_commissioned = new DefaultState();
-
private final DefaultState m_dirty = new DefaultState();

- //--------------------------------------------------------------
- // constructor
- //--------------------------------------------------------------
-
/**
- * Creation of a new containment model.
- *
- * @param context the containment context that establishes
- * the structural association of this containment model
- * within a parent scope
- */
+ * Creation of a new containment model.
+ *
+ * @param context the containment context that establishes the
structural association of this containment model
+ * within a parent scope
+ */
public DefaultContainmentModel( ContainmentContext context )
throws ModelException
{
super( context );
m_context = context;
-
if( null == context.getPartitionName() )
{
m_partition = DeploymentModel.SEPARATOR;
}
else
{
- m_partition = context.getPartitionName() + context.getName() +
DeploymentModel.SEPARATOR;
+ String partitionName = context.getPartitionName();
+ String contextName = context.getName();
+ m_partition = partitionName + contextName +
DeploymentModel.SEPARATOR;
}

//
@@ -148,9 +126,9 @@
//

DeploymentProfile[] profiles =
context.getContainmentProfile().getProfiles();
- for( int i=0; i<profiles.length; i++ )
+ for( int i = 0; i < profiles.length; i++ )
{
- addModel( profiles[i] );
+ addModel( profiles[ i ] );
}

//
@@ -161,22 +139,21 @@
m_services = helper.createServiceExport();
}

- //--------------------------------------------------------------
- // Commissionable
- //--------------------------------------------------------------
-
/**
- * Commission the appliance.
- *
- * @exception Exception if a commissioning error occurs
- */
- public void commission() throws Exception
+ * Commission the appliance.
+ *
+ * @throws Exception if a commissioning error occurs
+ */
+ public void commission()
+ throws Exception
{
assemble();
synchronized( m_commissioned )
{
if( m_commissioned.isEnabled() )
+ {
return;
+ }

//
// get the startup sequence and from this
@@ -184,15 +161,12 @@
// and deploy them
//
DeploymentModel[] startup = getStartupGraph();
-
- Commissioner commissioner =
- new Commissioner( getLogger(), true, this.getName() );
-
+ Commissioner commissioner = new Commissioner( getLogger(), true,
this.getName() );
try
{
- for( int i=0; i<startup.length; i++ )
+ for( int i = 0; i < startup.length; i++ )
{
- final DeploymentModel child = startup[i];
+ final DeploymentModel child = startup[ i ];
commissioner.commission( child );
}
}
@@ -213,33 +187,30 @@
}

/**
- * Decommission the appliance. Once an appliance is
- * decommissioned it may be re-commissioned.
- */
+ * Decommission the appliance. Once an appliance is decommissioned it
may be re-commissioned.
+ */
public void decommission()
{
synchronized( m_commissioned )
{
- if( !m_commissioned.isEnabled() ) return;
-
+ if( m_commissioned.isEnabled() == false )
+ {
+ return;
+ }
if( getLogger().isDebugEnabled() )
{
String message = "decommissioning";
getLogger().debug( message );
}
-
super.decommission();
-
DeploymentModel[] shutdown = getShutdownGraph();
-
Commissioner commissioner =
- new Commissioner( getLogger(), false );
-
+ new Commissioner( getLogger(), false );
try
{
- for( int i=0; i<shutdown.length; i++ )
+ for( int i = 0; i < shutdown.length; i++ )
{
- final DeploymentModel child = shutdown[i];
+ final DeploymentModel child = shutdown[ i ];
child.decommission();
}
}
@@ -247,68 +218,63 @@
{
commissioner.dispose();
}
-
m_commissioned.setEnabled( false );
}
}

- //--------------------------------------------------------------
- // DeploymentModel
- //--------------------------------------------------------------
-
/**
- * Return the classloader model.
- *
- * @return the classloader model
- */
+ * Return the classloader model.
+ *
+ * @return the classloader model
+ */
public ClassLoaderModel getClassLoaderModel()
{
return m_context.getClassLoaderModel();
}

/**
- * Returns the maximum allowable time for deployment.
- *
- * @return the maximum time expressed in millisecond of how
- * long a deployment may take.
- */
+ * Returns the maximum allowable time for deployment.
+ *
+ * @return the maximum time expressed in millisecond of how long a
deployment may take.
+ */
public long getDeploymentTimeout()
{
return 0;
}

/**
- * Return the set of services produced by the model.
- * @return the services
- */
+ * Return the set of services produced by the model.
+ *
+ * @return the services
+ */
public ServiceDescriptor[] getServices()
{
return m_context.getContainmentProfile().getExportDirectives();
}

/**
- * Return TRUE is this model is capable of supporting a supplied
- * depedendency.
- * @return true if this model can fulfill the dependency
- */
+ * Return TRUE is this model is capable of supporting a supplied
depedendency.
+ *
+ * @return true if this model can fulfill the dependency
+ */
public boolean isaCandidate( DependencyDescriptor dependency )
{
return isaCandidate( dependency.getReference() );
}

/**
- * Return TRUE is this model is capable of supporting a supplied
- * service.
- *
- * @param reference the service reference descriptor
- * @return true if this model can fulfill the service
- */
+ * Return TRUE is this model is capable of supporting a supplied service.
+ *
+ * @param reference the service reference descriptor
+ *
+ * @return true if this model can fulfill the service
+ */
public boolean isaCandidate( ReferenceDescriptor reference )
{
ServiceDescriptor[] services = getServices();
- for( int i=0; i<services.length; i++ )
+ for( int i = 0; i < services.length; i++ )
{
- ServiceDescriptor service = services[i];
+ ServiceDescriptor service = services[ i ];
if( service.getReference().matches( reference ) )
{
return true;
@@ -318,51 +284,55 @@
}

/**
- * Returns the assembled state of the model.
- * @return true if this model is assembled
- */
+ * Returns the assembled state of the model.
+ *
+ * @return true if this model is assembled
+ */
public boolean isAssembled()
{
return m_assembly.isEnabled();
}

/**
- * Assemble the model. Model assembly is a process of
- * wiring together candidate service providers with consumers.
- * The assembly implementation will assemble each deployment
- * model contained within this model.
- *
- * @exception AssemblyException if assembly cannot be fulfilled
- */
- public void assemble() throws AssemblyException
+ * Assemble the model. Model assembly is a process of wiring together
candidate service providers with consumers.
+ * The assembly implementation will assemble each deployment model
contained within this model.
+ *
+ * @throws AssemblyException if assembly cannot be fulfilled
+ */
+ public void assemble()
+ throws AssemblyException
{
List list = new ArrayList();
assemble( list );
}

/**
- * Assemble the model.
- * @param subjects the list of deployment targets making up the assembly
chain
- * @exception AssemblyException if an error occurs during model assembly
- */
- public void assemble( List subjects ) throws AssemblyException
+ * Assemble the model.
+ *
+ * @param subjects the list of deployment targets making up the assembly
chain
+ *
+ * @throws AssemblyException if an error occurs during model assembly
+ */
+ public void assemble( List subjects )
+ throws AssemblyException
{
synchronized( m_assembly )
{
if( isAssembled() )
{
- if( !m_dirty.isEnabled() ) return;
+ if( !m_dirty.isEnabled() )
+ {
+ return;
+ }
}
-
getLogger().debug( "assembly phase" );
DefaultContainmentModelAssemblyHelper helper =
- new DefaultContainmentModelAssemblyHelper( m_context, this );
-
+ new DefaultContainmentModelAssemblyHelper( m_context, this );
DeploymentModel[] models =
- m_context.getModelRepository().getModels();
- for( int i=0; i<models.length; i++ )
+ m_context.getModelRepository().getModels();
+ for( int i = 0; i < models.length; i++ )
{
- DeploymentModel model = models[i];
+ DeploymentModel model = models[ i ];
helper.assembleModel( model, subjects );
}
m_assembly.setEnabled( true );
@@ -371,8 +341,8 @@
}

/**
- * Disassemble the model.
- */
+ * Disassemble the model.
+ */
public void disassemble()
{
synchronized( m_assembly )
@@ -381,12 +351,11 @@
{
return;
}
-
getLogger().debug( "disassembly phase" );
DeploymentModel[] models =
m_context.getModelRepository().getModels();
- for( int i=0; i<models.length; i++ )
+ for( int i = 0; i < models.length; i++ )
{
- DeploymentModel model = models[i];
+ DeploymentModel model = models[ i ];
if( model instanceof ContainmentModel )
{
ContainmentModel containment = (ContainmentModel) model;
@@ -406,45 +375,47 @@
{
model.getContextModel().setProvider( null );
DependencyModel[] dependencies = model.getDependencyModels();
- for( int i=0; i<dependencies.length; i++ )
+ for( int i = 0; i < dependencies.length; i++ )
{
- DependencyModel dependency = dependencies[i];
+ DependencyModel dependency = dependencies[ i ];
dependency.setProvider( null );
}
}

/**
- * Return the set of models assigned as providers.
- * @return the providers consumed by the model
- * @exception IllegalStateException if the model is not in an assembled
state
- */
+ * Return the set of models assigned as providers.
+ *
+ * @return the providers consumed by the model
+ *
+ * @throws IllegalStateException if the model is not in an assembled
state
+ */
public DeploymentModel[] getProviders()
{
- if( !isAssembled() )
+ if( isAssembled() == false )
{
- final String error =
- "Model is not assembled " + this;
- throw new IllegalStateException( error );
+ String error = "Model is not assembled " + this;
+ throw new IllegalStateException( error );
}
-
ArrayList list = new ArrayList();
DeploymentModel[] models =
m_context.getModelRepository().getModels();
- for( int i=0; i<models.length; i++ )
+ for( int i = 0; i < models.length; i++ )
{
- DeploymentModel model = models[i];
+ DeploymentModel model = models[ i ];
DeploymentModel[] providers = model.getProviders();
- for( int j=0; j<providers.length; j++ )
+ for( int j = 0; j < providers.length; j++ )
{
- DeploymentModel provider = providers[j];
- final String path = provider.getPath();
- final String root = getPartition();
- if( !path.startsWith( root ) )
+ DeploymentModel provider = providers[ j ];
+ String path = provider.getPath();
+ String root = getPartition();
+ if( path.startsWith( root ) == false )
{
- list.add( providers[j] );
+ list.add( providers[ j ] );
}
}
}
- return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
+ DeploymentModel[] result = new DeploymentModel[ list.size() ];
+ list.toArray( result );
+ return result;
}

//--------------------------------------------------------------
@@ -452,9 +423,10 @@
//--------------------------------------------------------------

/**
- * Add a composition listener to the model.
- * @param listener the composition listener
- */
+ * Add a composition listener to the model.
+ *
+ * @param listener the composition listener
+ */
public void addCompositionListener( CompositionListener listener )
{
synchronized( m_compositionListeners )
@@ -464,9 +436,10 @@
}

/**
- * Remove a composition listener from the model.
- * @param listener the composition listener
- */
+ * Remove a composition listener from the model.
+ *
+ * @param listener the composition listener
+ */
public void removeCompositionListener( CompositionListener listener )
{
synchronized( m_compositionListeners )
@@ -476,25 +449,28 @@
}

/**
- * Return the set of service export mappings
- * @return the set of export directives published by the model
- */
+ * Return the set of service export mappings
+ *
+ * @return the set of export directives published by the model
+ */
public ServiceModel[] getServiceModels()
{
return m_services;
}

/**
- * Return the set of service export directives for a supplied class.
- * @param clazz a cleaa identifying the directive
- * @return the export directives
- */
+ * Return the set of service export directives for a supplied class.
+ *
+ * @param clazz a cleaa identifying the directive
+ *
+ * @return the export directives
+ */
public ServiceModel getServiceModel( Class clazz )
{
ServiceModel[] models = getServiceModels();
- for( int i=0; i<models.length; i++ )
+ for( int i = 0; i < models.length; i++ )
{
- ServiceModel model = models[i];
+ ServiceModel model = models[ i ];
if( clazz.isAssignableFrom( model.getServiceClass() ) )
{
return model;
@@ -504,34 +480,42 @@
}

/**
- * Get the startup sequence for the model.
- */
+ * Get the startup sequence for the model.
+ */
public DeploymentModel[] getStartupGraph()
{
- return m_context.getDependencyGraph().getStartupGraph();
+ DependencyGraph dependencyGraph = m_context.getDependencyGraph();
+ DeploymentModel[] startupGraph = dependencyGraph.getStartupGraph();
+ return startupGraph;
}

/**
- * Get the shutdown sequence for the model.
- */
+ * Get the shutdown sequence for the model.
+ */
public DeploymentModel[] getShutdownGraph()
{
- return m_context.getDependencyGraph().getShutdownGraph();
+ DependencyGraph dependencyGraph = m_context.getDependencyGraph();
+ DeploymentModel[] shutdownGraph = dependencyGraph.getShutdownGraph();
+ return shutdownGraph;
}

/**
- * Add a model referenced by a url to this model.
- * @param url the url of the model to include
- * @return the model
- * @exception ModelException if a model related error occurs
- */
- public ContainmentModel addContainmentModel( URL url ) throws
ModelException
+ * Add a model referenced by a url to this model.
+ *
+ * @param url the url of the model to include
+ *
+ * @return the model
+ *
+ * @throws ModelException if a model related error occurs
+ */
+ public ContainmentModel addContainmentModel( URL url )
+ throws ModelException
{
return addContainmentModel( url, null );
}

public ContainmentModel addContainmentModel( URL block, URL config )
- throws ModelException
+ throws ModelException
{
ContainmentModel model = createContainmentModel( null, block );
addModel( model.getName(), model );
@@ -540,26 +524,28 @@
}

/**
- * Addition of a new subsidiary model within
- * the containment context.
- *
- * @param model a containment or component model
- * @return the supplied model
- */
- public DeploymentModel addModel( DeploymentModel model ) throws
ModelException
+ * Addition of a new subsidiary model within the containment context.
+ *
+ * @param model a containment or component model
+ *
+ * @return the supplied model
+ */
+ public DeploymentModel addModel( DeploymentModel model )
+ throws ModelException
{
final String name = model.getName();
return addModel( name, model );
}

/**
- * Addition of a new subsidiary model within
- * the containment context using a supplied profile.
- *
- * @param profile a containment or deployment profile
- * @return the model based on the supplied profile
- * @exception ModelException if an error occurs during model establishment
- */
+ * Addition of a new subsidiary model within the containment context
using a supplied profile.
+ *
+ * @param profile a containment or deployment profile
+ *
+ * @return the model based on the supplied profile
+ *
+ * @throws ModelException if an error occurs during model establishment
+ */
public DeploymentModel addModel( DeploymentProfile profile )
throws ModelException
{
@@ -570,13 +556,14 @@
}

/**
- * Addition of a new subsidiary model within
- * the containment context using a supplied profile.
- *
- * @param profile a containment or deployment profile
- * @return the model based on the supplied profile
- * @exception ModelException if an error occurs during model establishment
- */
+ * Addition of a new subsidiary model within the containment context
using a supplied profile.
+ *
+ * @param profile a containment or deployment profile
+ *
+ * @return the model based on the supplied profile
+ *
+ * @throws ModelException if an error occurs during model establishment
+ */
DeploymentModel createDeploymentModel( DeploymentProfile profile )
throws ModelException
{
@@ -585,14 +572,15 @@
}

/**
- * Addition of a new subsidiary model within
- * the containment context using a supplied profile.
- *
- * @param profile a containment or deployment profile
- * @return the model based on the supplied profile
- * @exception ModelException if an error occurs during model establishment
- * @exception NullArgumentException if the profile argument is null.
- */
+ * Addition of a new subsidiary model within the containment context
using a supplied profile.
+ *
+ * @param profile a containment or deployment profile
+ *
+ * @return the model based on the supplied profile
+ *
+ * @throws ModelException if an error occurs during model
establishment
+ * @throws NullArgumentException if the profile argument is null.
+ */
DeploymentModel createDeploymentModel( String name, DeploymentProfile
profile )
throws ModelException, NullArgumentException
{
@@ -600,7 +588,6 @@
{
throw new NullArgumentException( "profile" );
}
-
DeploymentModel model;
if( profile instanceof ContainmentProfile )
{
@@ -614,8 +601,7 @@
}
else if( profile instanceof NamedComponentProfile )
{
- ComponentProfile deployment =
- createComponentProfile( (NamedComponentProfile) profile );
+ ComponentProfile deployment = createComponentProfile(
(NamedComponentProfile) profile );
model = createComponentModel( deployment );
}
else if( profile instanceof BlockIncludeDirective )
@@ -635,22 +621,22 @@
// of a custom profile handler.
//

- final String error =
- REZ.getString(
- "containment.unknown-profile-class.error",
- getPath(),
- profile.getClass().getName() );
+ Class profileClass = profile.getClass();
+ String profileClassName = profileClass.getName();
+ String path = getPath();
+ String error = REZ.getString(
"containment.unknown-profile-class.error", path, profileClassName );
throw new ModelException( error );
}
return model;
}

/**
- * Removal of a named model for the containment model.
- *
- * @param name the name of the subsidiary model to be removed
- * @exception IllegalArgumentException if the supplied name is unknown
- */
+ * Removal of a named model for the containment model.
+ *
+ * @param name the name of the subsidiary model to be removed
+ *
+ * @throws IllegalArgumentException if the supplied name is unknown
+ */
public void removeModel( String name )
throws IllegalArgumentException
{
@@ -661,10 +647,7 @@
model = repository.getModel( name );
if( null == model )
{
- final String error =
- "No model named [" + name
- + "] is referenced with the model ["
- + this + "].";
+ String error = "No model named [" + name + "] is referenced
with the model [" + this + "].";
throw new IllegalArgumentException( error );
}
if( model instanceof ContainmentModel )
@@ -682,80 +665,91 @@
private void removeChildModels( ContainmentModel container )
{
DeploymentModel[] children = container.getModels();
- for( int i = 0 ; i < children.length ; i++ )
- container.removeModel( children[i].getName() );
+ for( int i = 0; i < children.length; i++ )
+ {
+ container.removeModel( children[ i ].getName() );
+ }
}

/**
- * Return the partition name established by this containment context.
- * @return the partition name
- */
+ * Return the partition name established by this containment context.
+ *
+ * @return the partition name
+ */
public String getPartition()
{
return m_partition;
}

/**
- * Return the set of immediate child models nested
- * within this model.
- *
- * @return the nested model
- */
+ * Return the set of immediate child models nested within this model.
+ *
+ * @return the nested model
+ */
public DeploymentModel[] getModels()
{
- return m_context.getModelRepository().getModels();
+ ModelRepository modelRepository = m_context.getModelRepository();
+ DeploymentModel[] models = modelRepository.getModels();
+ return models;
}

/**
- * Return a child model relative to a supplied name.
- *
- * @param path a relative or absolute path
- * @return the named model or null if the name is unknown
- * @exception IllegalArgumentException if the name if badly formed
- */
+ * Return a child model relative to a supplied name.
+ *
+ * @param path a relative or absolute path
+ *
+ * @return the named model or null if the name is unknown
+ *
+ * @throws IllegalArgumentException if the name if badly formed
+ */
public DeploymentModel getModel( String path )
{
- DefaultContainmentModelNavigationHelper helper =
- new DefaultContainmentModelNavigationHelper( m_context, this );
- return helper.getModel( path );
+ DefaultContainmentModelNavigationHelper helper = new
DefaultContainmentModelNavigationHelper( m_context, this );
+ DeploymentModel model = helper.getModel( path );
+ return model;
}

/**
- * Resolve a model capable of supporting the supplied service reference.
- *
- * @param descriptor a service reference descriptor
- * @return the model or null if unresolvable
- */
+ * Resolve a model capable of supporting the supplied service reference.
+ *
+ * @param descriptor a service reference descriptor
+ *
+ * @return the model or null if unresolvable
+ */
public DeploymentModel getModel( ReferenceDescriptor descriptor )
- throws AssemblyException
+ throws AssemblyException
{
- DefaultContainmentModelAssemblyHelper helper =
- new DefaultContainmentModelAssemblyHelper( m_context, this );
- return helper.findServiceProvider( descriptor );
+ DefaultContainmentModelAssemblyHelper helper = new
DefaultContainmentModelAssemblyHelper( m_context, this );
+ DeploymentModel serviceProvider = helper.findServiceProvider(
descriptor );
+ return serviceProvider;
}

/**
- * Resolve a model capable of supporting the supplied service reference.
- *
- * @param dependency a dependency descriptor
- * @return the model or null if unresolvable
- * @exception AssemblyException if an assembly error occurs
- */
+ * Resolve a model capable of supporting the supplied service reference.
+ *
+ * @param dependency a dependency descriptor
+ *
+ * @return the model or null if unresolvable
+ *
+ * @throws AssemblyException if an assembly error occurs
+ */
public DeploymentModel getModel( DependencyDescriptor dependency )
- throws AssemblyException
+ throws AssemblyException
{
- DefaultContainmentModelAssemblyHelper helper =
- new DefaultContainmentModelAssemblyHelper( m_context, this );
- return helper.findDependencyProvider( dependency );
+ DefaultContainmentModelAssemblyHelper helper = new
DefaultContainmentModelAssemblyHelper( m_context, this );
+ DeploymentModel dependencyProvider = helper.findDependencyProvider(
dependency );
+ return dependencyProvider;
}

/**
- * Apply a set of override targets resolvable from a supplied url.
- * @param config a url resolvable to a TargetDirective[]
- * @exception ModelException if an error occurs
- */
+ * Apply a set of override targets resolvable from a supplied url.
+ *
+ * @param config a url resolvable to a TargetDirective[]
+ *
+ * @throws ModelException if an error occurs
+ */
public void applyTargets( URL config )
- throws ModelException
+ throws ModelException
{
if( config != null )
{
@@ -765,16 +759,17 @@
}

/**
- * Apply a set of override targets.
- * @param targets a set of target directives
- * @throws ModelException
- */
- public void applyTargets( TargetDirective[]targets ) throws
ModelException
+ * Apply a set of override targets.
+ *
+ * @param targets a set of target directives
+ */
+ public void applyTargets( TargetDirective[] targets )
+ throws ModelException
{
- for( int i=0; i<targets.length; i++ )
+ for( int i = 0; i < targets.length; i++ )
{
- TargetDirective target = targets[i];
- final String path = target.getPath();
+ TargetDirective target = targets[ i ];
+ String path = target.getPath();
DeploymentModel model = getModel( path );
if( model != null )
{
@@ -787,18 +782,16 @@
{
deployment.setConfiguration( config );
}
-
Parameters params = target.getParameters();
if( params != null )
{
- deployment.setParameters( params );
+ deployment.setParameters( params );
}
}
}
else
{
- final String warning =
- REZ.getString( "target.ignore", path, toString() );
+ String warning = REZ.getString( "target.ignore", path,
toString() );
getLogger().warn( warning );
}
}
@@ -808,12 +801,13 @@
// private
//--------------------------------------------------------------

- private DeploymentModel addModel(
- String name, DeploymentModel model ) throws DuplicateNameException
+ private DeploymentModel addModel( String name, DeploymentModel model )
+ throws DuplicateNameException
{
if( model.equals( this ) )
+ {
return model;
-
+ }
m_dirty.setEnabled( true );
ModelRepository repository = m_context.getModelRepository();
synchronized( repository )
@@ -831,22 +825,23 @@
Iterator iterator = m_compositionListeners.iterator();
while( iterator.hasNext() )
{
- final CompositionListener listener =
- (CompositionListener) iterator.next();
+ CompositionListener listener = (CompositionListener)
iterator.next();
try
{
listener.modelAdded( event );
}
catch( Throwable e )
{
- final String error =
- "A composition listener raised an exception";
+ String error = "A composition listener raised an exception";
getLogger().warn( error, e );
}
}
ContainmentModel parent = m_context.getParentContainmentModel();
if( parent instanceof DefaultContainmentModel )
- ((DefaultContainmentModel) parent).fireModelAddedEvent( event );
+ {
+ DefaultContainmentModel container = (DefaultContainmentModel)
parent;
+ container.fireModelAddedEvent( event );
+ }
}

private void fireModelRemovedEvent( CompositionEvent event )
@@ -854,85 +849,84 @@
Iterator iterator = m_compositionListeners.iterator();
while( iterator.hasNext() )
{
- final CompositionListener listener =
- (CompositionListener) iterator.next();
+ final CompositionListener listener = (CompositionListener)
iterator.next();
try
{
listener.modelRemoved( event );
}
catch( Throwable e )
{
- final String error =
- "A composition listener raised an exception";
+ String error = "A composition listener raised an exception";
getLogger().warn( error, e );
}
}
ContainmentModel parent = m_context.getParentContainmentModel();
if( parent instanceof DefaultContainmentModel )
{
- DefaultContainmentModel model = (DefaultContainmentModel) parent;
- model.fireModelRemovedEvent( event );
+ DefaultContainmentModel container = (DefaultContainmentModel)
parent;
+ container.fireModelRemovedEvent( event );
}
}

/**
- * Creation of a new instance of a deployment model within
- * this containment context.
- *
- * @param profile a containment profile
- * @return the composition model
- */
- private ComponentModel createComponentModel( final ComponentProfile
profile )
+ * Creation of a new instance of a deployment model within this
containment context.
+ *
+ * @param profile a containment profile
+ *
+ * @return the composition model
+ */
+ private ComponentModel createComponentModel( ComponentProfile profile )
throws ModelException
{
DefaultContainmentModelComponentHelper helper = new
DefaultContainmentModelComponentHelper( m_context, this );
ComponentContext context = helper.createComponentContext( profile );
ModelFactory factory = m_context.getModelFactory();
- return factory.createComponentModel( context );
+ ComponentModel componentModel = factory.createComponentModel(
context );
+ return componentModel;
}

/**
- * Creation of a new instance of a containment model within
- * this containment context.
- *
- * @param profile a containment profile
- * @return the composition model
- */
+ * Creation of a new instance of a containment model within this
containment context.
+ *
+ * @param profile a containment profile
+ *
+ * @return the composition model
+ */
private ContainmentModel createContainmentModel( ContainmentProfile
profile )
throws ModelException
{
final String name = profile.getName();
- return createContainmentModel( name, profile );
+ ContainmentModel containmentModel = createContainmentModel( name,
profile );
+ return containmentModel;
}

/**
- * Creation of a new instance of a containment model within
- * this containment context.
- *
- * @param name the containment name
- * @param profile a containment profile
- * @return the composition model
- */
+ * Creation of a new instance of a containment model within this
containment context.
+ *
+ * @param name the containment name
+ * @param profile a containment profile
+ *
+ * @return the composition model
+ */
private ContainmentModel createContainmentModel( String name,
ContainmentProfile profile )
throws ModelException
{
- return createContainmentModel( name, profile, new URL[0] );
+ return createContainmentModel( name, profile, new URL[ 0 ] );
}

/**
- * Creation of a new instance of a containment model within
- * this containment context.
- *
- * @param name the containment name
- * @param profile a containment profile
- * @param implicit any implicit urls to include in the container
classloader
- * @return the composition model
- */
- private ContainmentModel createContainmentModel( final String name,
final ContainmentProfile profile, URL[] implicit )
+ * Creation of a new instance of a containment model within this
containment context.
+ *
+ * @param name the containment name
+ * @param profile a containment profile
+ * @param implicit any implicit urls to include in the container
classloader
+ *
+ * @return the composition model
+ */
+ private ContainmentModel createContainmentModel( String name,
ContainmentProfile profile, URL[] implicit )
throws ModelException
{
final String partition = getPartition();
-
if( getLogger().isDebugEnabled() )
{
final String message = REZ.getString( "containment.add", name );
@@ -941,26 +935,24 @@

// TODO: Replace with the LogService facade.
Logger log = new ConsoleLogger();
-
try
{
- final ClassLoaderModel classLoaderModel =
m_context.getClassLoaderModel().createClassLoaderModel( log, profile,
implicit );
-
- final File dir = new File( m_context.getWorkingDirectory(), name
);
- final File temp = new File( m_context.getTempDirectory(), name );
- final Logger logger = getLogger().getChildLogger( name );
-
+ // TODO: Niclas: Why is a ClassLoaderModel used to create a
ClassLoaderModel. It seems weird.
+ ClassLoaderModel classLoaderModel =
m_context.getClassLoaderModel();
+ ClassLoaderModel model =
classLoaderModel.createClassLoaderModel( log, profile, implicit );
+ File dir = new File( m_context.getWorkingDirectory(), name );
+ File temp = new File( m_context.getTempDirectory(), name );
+ Logger logger = getLogger().getChildLogger( name );
ModelRepository modelRepository = m_context.getModelRepository();
-
DependencyGraph graph = m_context.getDependencyGraph();
+ long defaultDeploymentTimeout =
m_context.getDefaultDeploymentTimeout();
+ ModelFactory modelFactory = m_context.getModelFactory();
+ net.dpml.composition.provider.Runtime runtime =
m_context.getRuntime();

- DefaultContainmentContext context = new
DefaultContainmentContext( logger, classLoaderModel, modelRepository, graph,
- dir, temp, this, profile, partition, name,
m_context.getModelFactory(), m_context.getRuntime(),
- m_context.getDefaultDeploymentTimeout()
+ DefaultContainmentContext context = new
DefaultContainmentContext( logger, model, modelRepository, graph,
+ dir, temp, this, profile, partition, name, modelFactory,
runtime, defaultDeploymentTimeout
);
-
- ModelFactory factory = m_context.getModelFactory();
- return factory.createContainmentModel( context );
+ return modelFactory.createContainmentModel( context );
}
catch( ModelException e )
{
@@ -979,19 +971,21 @@
}

/**
- * Add a containment profile that is derived from an external resource.
- * @param directive the block composition directive
- * @return the containment model established by the include
- */
+ * Add a containment profile that is derived from an external resource.
+ *
+ * @param directive the block composition directive
+ *
+ * @return the containment model established by the include
+ */
private ContainmentModel createContainmentModel(
BlockCompositionDirective directive )
throws ModelException
{
- final String name = directive.getName();
+ String name = directive.getName();
ContainmentModel model;
try
{
- Artifact artifact = directive.getArtifact();
- final URL url = artifact.toURL();
+ Artifact artifact = directive.getArtifact();
+ URL url = artifact.toURL();
model = createContainmentModel( name, url );
}
catch( ModelException e )
@@ -1003,25 +997,23 @@
String error = "Unable to include block [" + name + "] into the
containmment model [" + getQualifiedName() + "] because of a repository
related error.";
throw new ModelException( error, e );
}
-
TargetDirective[] targets = directive.getTargetDirectives();
model.applyTargets( targets );
return model;
}

/**
- * Create a containment model that is derived from an external
- * source profile defintion.
- *
- * @param directive the block include directive
- * @return the containment model established by the include
- */
+ * Create a containment model that is derived from an external source
profile defintion.
+ *
+ * @param directive the block include directive
+ *
+ * @return the containment model established by the include
+ */
private ContainmentModel createContainmentModel( BlockIncludeDirective
directive )
throws ModelException
{
- final String name = directive.getName();
- final String path = directive.getPath();
-
+ String name = directive.getName();
+ String path = directive.getPath();
try
{
if( path.indexOf( ":" ) < 0 )
@@ -1038,26 +1030,25 @@
}
catch( MalformedURLException e )
{
- final String error = "Unable to include block [" + name + "]
into the containmment model [" + getQualifiedName() + "] because of a url
related error.";
+ String error = "Unable to include block [" + name + "] into the
containmment model [" + getQualifiedName() + "] because of a url related
error.";
throw new ModelException( error, e );
}
}

/**
- * Create a containment model that is derived from an external
- * source containment profile defintion.
- *
- * @param name the name of the containment model to be created.
- * @param url the Url of the containment model.
- * @return the containment model established by the include
- */
+ * Create a containment model that is derived from an external source
containment profile defintion.
+ *
+ * @param name the name of the containment model to be created.
+ * @param url the Url of the containment model.
+ *
+ * @return the containment model established by the include
+ */
private ContainmentModel createContainmentModel( String name, URL url )
- throws ModelException
+ throws ModelException
{
if( "artifact".equals( url.getProtocol() ) )
{
String spec = url.toString();
-
if( spec.startsWith( "artifact:block:" ) )
{
return processArtifactBlock( spec, name, url );
@@ -1068,17 +1059,16 @@
}
else
{
- final String error = "Don't know what to do with artifact: "
+ url;
+ String error = "Don't know what to do with artifact: " + url;
throw new ModelException( error );
}
}
-
final String path = url.toString();
if( path.endsWith( ".jar" ) )
{
return processJarFile( url, name );
}
- else if( path.endsWith( ".xml" ) || path.endsWith( ".block" ))
+ else if( path.endsWith( ".xml" ) || path.endsWith( ".block" ) )
{
return processBlockFile( path, name );
}
@@ -1088,7 +1078,7 @@
}
else if( path.endsWith( ".bar" ) )
{
- final String error = "Cannot execute a block archive: " + path;
+ String error = "Cannot execute a block archive: " + path;
throw new ModelException( error );
}
else
@@ -1097,57 +1087,64 @@
}
}

- private ContainmentModel processDirectory( final String path, String
name )
+ private ContainmentModel processDirectory( String path, String name )
throws ModelException
{
try
{
verifyPath( path );
return createContainmentModel( name, new URL( path + "/" ) );
- } catch( MalformedURLException e )
+ }
+ catch( MalformedURLException e )
{
String message = "Unable to create block from [" + path + "] in
the containmment model [" + getQualifiedName() + "] due to a build related
error.";
throw new ModelException( message, e );
}
}

- private ContainmentModel processBlockDirectory( final String path, URL
url, String name )
+ private ContainmentModel processBlockDirectory( String path, URL url,
String name )
throws ModelException
{
try
{
verifyPath( path );
-
URL blockURL = new URL( url.toString() + "BLOCK-INF/block.xml" );
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
Configuration config = builder.build( blockURL.toString() );
ContainmentProfile profile = CREATOR.createContainmentProfile(
config );
-
String message = "including composite block: " +
blockURL.toString();
getLogger().debug( message );
-
- return createContainmentModel( getName( name, profile ),
profile, new URL[]{ url } );
- } catch( MalformedURLException e )
+ String containerName = getName( name, profile );
+ URL[] implicit = new URL[]{ url };
+ ContainmentModel containmentModel = createContainmentModel(
containerName, profile, implicit );
+ return containmentModel;
+ }
+ catch( MalformedURLException e )
{
String message = "Unable to create block from [" + url + "] in
the containmment model [" + getQualifiedName() + "] due to a build related
error.";
throw new ModelException( message, e );
- } catch( SAXException e )
+ }
+ catch( SAXException e )
{
String message = "Unable to create block from [" + url + "] in
the containmment model [" + getQualifiedName() + "] due to a build related
error.";
throw new ModelException( message, e );
- } catch( ConfigurationException e )
+ }
+ catch( ConfigurationException e )
{
String message = "Unable to create block from [" + url + "] in
the containmment model [" + getQualifiedName() + "] due to a build related
error.";
throw new ModelException( message, e );
- } catch( IOException e )
+ }
+ catch( IOException e )
{
String message = "Unable to create block from [" + url + "] in
the containmment model [" + getQualifiedName() + "] due to a build related
error.";
throw new ModelException( message, e );
- } catch( ModelException e )
+ }
+ catch( ModelException e )
{
String message = "Unable to create block from [" + url + "] in
the containmment model [" + getQualifiedName() + "] due to a build related
error.";
throw new ModelException( message, e );
- } catch( Exception e )
+ }
+ catch( Exception e )
{
String message = "Unable to create block from [" + url + "] in
the containmment model [" + getQualifiedName() + "] due to a build related
error.";
throw new ModelException( message, e );
@@ -1161,27 +1158,32 @@
{
DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
Configuration config = builder.build( path );
- final ContainmentProfile profile =
CREATOR.createContainmentProfile( config );
- final String message = "including composite block: " + path;
+ ContainmentProfile profile = CREATOR.createContainmentProfile(
config );
+ String message = "including composite block: " + path;
getLogger().debug( message );
return createContainmentModel( getName( name, profile ), profile
);
- } catch( SAXException e )
+ }
+ catch( SAXException e )
{
String message = "Unable to create block from block file [" +
path + "] in the containmment model [" + getQualifiedName() + "] due to a
build related error.";
throw new ModelException( message, e );
- } catch( ConfigurationException e )
+ }
+ catch( ConfigurationException e )
{
String message = "Unable to create block from block file [" +
path + "] in the containmment model [" + getQualifiedName() + "] due to a
build related error.";
throw new ModelException( message, e );
- } catch( IOException e )
+ }
+ catch( IOException e )
{
String message = "Unable to create block from block file [" +
path + "] in the containmment model [" + getQualifiedName() + "] due to a
build related error.";
throw new ModelException( message, e );
- } catch( ModelException e )
+ }
+ catch( ModelException e )
{
String message = "Unable to create block from block file [" +
path + "] in the containmment model [" + getQualifiedName() + "] due to a
build related error.";
throw new ModelException( message, e );
- } catch( Exception e )
+ }
+ catch( Exception e )
{
String message = "Unable to create block from block file [" +
path + "] in the containmment model [" + getQualifiedName() + "] due to a
build related error.";
throw new ModelException( message, e );
@@ -1202,27 +1204,26 @@
ContainmentProfile profile = BUILDER.createContainmentProfile(
stream );
String message = "including composite block: " +
blockURL.toString();
getLogger().debug( message );
-
- return createContainmentModel( getName( name, profile ),
profile, new URL[]{ url } );
+ return createContainmentModel( getName( name, profile ),
profile, new URL[]{url} );
}
catch( MalformedURLException e )
{
- final String error = "Unable to create block from embedded
descriptor [" + blockURL + "] in the containmment model [" +
getQualifiedName() + "] due to a build related error.";
+ String error = "Unable to create block from embedded descriptor
[" + blockURL + "] in the containmment model [" + getQualifiedName() + "] due
to a build related error.";
throw new ModelException( error, e );
}
catch( IOException e )
{
- final String error = "Unable to create block from embedded
descriptor [" + blockURL + "] in the containmment model [" +
getQualifiedName() + "] due to a build related error.";
+ String error = "Unable to create block from embedded descriptor
[" + blockURL + "] in the containmment model [" + getQualifiedName() + "] due
to a build related error.";
throw new ModelException( error, e );
}
catch( ModelException e )
{
- final String error = "Unable to create block from embedded
descriptor [" + blockURL + "] in the containmment model [" +
getQualifiedName() + "] due to a build related error.";
+ String error = "Unable to create block from embedded descriptor
[" + blockURL + "] in the containmment model [" + getQualifiedName() + "] due
to a build related error.";
throw new ModelException( error, e );
}
catch( Exception e )
{
- final String error = "Unable to create block from embedded
descriptor [" + blockURL + "] in the containmment model [" +
getQualifiedName() + "] due to a build related error.";
+ String error = "Unable to create block from embedded descriptor
[" + blockURL + "] in the containmment model [" + getQualifiedName() + "] due
to a build related error.";
throw new ModelException( error, e );
}
}
@@ -1238,7 +1239,7 @@
ContainmentProfile profile = BUILDER.createContainmentProfile(
stream );
String message = "including composite block: " +
blockURL.toString();
getLogger().debug( message );
- return createContainmentModel( getName( name, profile ),
profile, new URL[]{ url } );
+ return createContainmentModel( getName( name, profile ),
profile, new URL[]{url} );
}
catch( MalformedURLException e )
{
@@ -1271,25 +1272,24 @@
}
catch( ModelException e )
{
- String error = "Unable to create block from descriptor [" +
url.toString() + "] in the containmment model [" + getQualifiedName() + "]
due to a build related error.";
+ String error = "Unable to create block from descriptor [" + url
+ "] in the containmment model [" + getQualifiedName() + "] due to a build
related error.";
throw new ModelException( error, e );
}
catch( RuntimeException e )
{
- String error = "Unable to create block from descriptor [" +
url.toString() + "] in the containmment model [" + getQualifiedName() + "]
due to a build related error.";
+ String error = "Unable to create block from descriptor [" + url
+ "] in the containmment model [" + getQualifiedName() + "] due to a build
related error.";
throw new ModelException( error, e );
}
}

/**
- * Verify the a path is valid. The implementation will
- * throw an exception if a connection to a url established
- * using the path agument cann be resolved.
- *
- * @exception ModelException if the path is not resolvable
- * to a url connection
- */
- private void verifyPath( String path ) throws ModelException
+ * Verify the a path is valid. The implementation will throw an
exception if a connection to a url established
+ * using the path agument cann be resolved.
+ *
+ * @throws ModelException if the path is not resolvable to a url
connection
+ */
+ private void verifyPath( String path )
+ throws ModelException
{
try
{
@@ -1299,8 +1299,7 @@
}
catch( java.io.FileNotFoundException e )
{
- final String error =
- "File not found: " + path;
+ String error = "File not found: " + path;
throw new ModelException( error );
}
catch( MalformedURLException e )
@@ -1322,19 +1321,23 @@

private String getName( String name, DeploymentProfile profile )
{
- if( name != null ) return name;
+ if( name != null )
+ {
+ return name;
+ }
return profile.getName();
}

/**
- * Conver a classic url to a jar url. If the supplied url protocol is not
- * the "jar" protocol, a ne url is created by prepending jar: and adding
the
- * trailing "!/".
- *
- * @param url the url to convert
- * @return the converted url
- * @exception MalformedURLException if something goes wrong
- */
+ * Conver a classic url to a jar url. If the supplied url protocol is
not the "jar" protocol, a ne url is created
+ * by prepending jar: and adding the trailing "!/".
+ *
+ * @param url the url to convert
+ *
+ * @return the converted url
+ *
+ * @throws MalformedURLException if something goes wrong
+ */
private URL convertToJarURL( URL url )
throws MalformedURLException
{
@@ -1342,7 +1345,6 @@
{
return url;
}
-
String path = "jar:" + url.toString() + "!/";
try
{
@@ -1356,14 +1358,14 @@
}

/**
- * Create a full deployment profile using a supplied named
- * profile reference.
- *
- * @param profile the named profile reference directive
- * @return the deployment profile
- * @exception ModelException if an error occurs during
- * profile creation
- */
+ * Create a full deployment profile using a supplied named profile
reference.
+ *
+ * @param profile the named profile reference directive
+ *
+ * @return the deployment profile
+ *
+ * @throws ModelException if an error occurs during profile creation
+ */
private ComponentProfile createComponentProfile( NamedComponentProfile
profile )
throws ModelException
{
@@ -1373,35 +1375,46 @@
final String classname = holder.getClassname();
final String key = holder.getKey();
TypeRepository repository =
- m_context.getClassLoaderModel().getTypeRepository();
+ m_context.getClassLoaderModel().getTypeRepository();
Type type = repository.getType( classname );
ComponentProfile template =
- repository.getProfile( type, key );
+ repository.getProfile( type, key );
return new ComponentProfile( profile.getName(), template );
}
catch( NullArgumentException e )
{
- String error = REZ.getString(
"containment.model.create.deployment.error", profile.getKey(), getPath(),
profile.getClassname() );
+ String key = profile.getKey();
+ String path = getPath();
+ String classname = profile.getClassname();
+ String error = REZ.getString(
"containment.model.create.deployment.error", key, path, classname );
throw new ModelException( error, e );
}
catch( ProfileUnknownException e )
{
- String error = REZ.getString(
"containment.model.create.deployment.error", profile.getKey(), getPath(),
profile.getClassname() );
+ String key = profile.getKey();
+ String path = getPath();
+ String classname = profile.getClassname();
+ String error = REZ.getString(
"containment.model.create.deployment.error", key, path, classname );
throw new ModelException( error, e );
}
catch( TypeUnknownException e )
{
- String error = REZ.getString(
"containment.model.create.deployment.error", profile.getKey(), getPath(),
profile.getClassname() );
+ String key = profile.getKey();
+ String path = getPath();
+ String classname = profile.getClassname();
+ String error = REZ.getString(
"containment.model.create.deployment.error", key, path, classname );
throw new ModelException( error, e );
}
catch( RuntimeException e )
{
- String error = REZ.getString(
"containment.model.create.deployment.error", profile.getKey(), getPath(),
profile.getClassname() );
+ String key = profile.getKey();
+ String path = getPath();
+ String classname = profile.getClassname();
+ String error = REZ.getString(
"containment.model.create.deployment.error", key, path, classname );
throw new ModelException( error, e );
}
}

-
private TargetDirective[] getTargets( final URL url )
throws ModelException
{

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
Tue Jun 28 08:36:24 2005
@@ -15,11 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.model.AssemblyException;
+import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.model.ComponentModel;
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.DependencyModel;
@@ -32,7 +32,6 @@
import net.dpml.composition.model.ProviderNotFoundException;
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.model.TypeUnknownException;
-import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.provider.ContainmentContext;
import net.dpml.lang.NullArgumentException;
import net.dpml.meta.info.DependencyDescriptor;
@@ -43,35 +42,24 @@
import java.util.List;

/**
- * A utility class that assists in the location of a model relative
- * a supplied path.
+ * A utility class that assists in the location of a model relative a
supplied path.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
class DefaultContainmentModelAssemblyHelper
{
- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
private final ContainmentContext m_context;
-
private final DefaultContainmentModel m_model;

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------
-
- public DefaultContainmentModelAssemblyHelper( ContainmentContext context,
- DefaultContainmentModel model )
+ public DefaultContainmentModelAssemblyHelper( ContainmentContext
context, DefaultContainmentModel model )
{
m_context = context;
m_model = model;
}

private void assembleComponent( ComponentModel model, List subjects )
- throws AssemblyException
+ throws AssemblyException
{
ModelRepository repository = m_context.getModelRepository();

@@ -80,9 +68,9 @@
//

DependencyModel[] dependencies = model.getDependencyModels();
- for ( int i = 0; i < dependencies.length; i++ )
+ for( int i = 0; i < dependencies.length; i++ )
{
- DependencyModel dependency = dependencies[i];
+ DependencyModel dependency = dependencies[ i ];
if( null == dependency.getProvider() )
{
try
@@ -91,7 +79,7 @@
DeploymentModel provider = findDependencyProvider(
repository, dependency, subjects );
dependency.setProvider( provider );
}
- catch ( AssemblyException e )
+ catch( AssemblyException e )
{
if( dependency.getDependency().isRequired() )
{
@@ -99,7 +87,7 @@
throw new AssemblyException( error, e );
}
}
- catch ( RuntimeException e )
+ catch( RuntimeException e )
{
if( dependency.getDependency().isRequired() )
{
@@ -120,13 +108,12 @@
//-------------------------------------------------------------------

/**
- * Assemble a target model during which all deployment and runtime
- * dependencies are assigned a provider model.
+ * Assemble a target model during which all deployment and runtime
dependencies are assigned a provider model.
*
- * @param model the target model to be assembled
+ * @param model the target model to be assembled
* @param subjects
- * @exception NullArgumentException if either the model argument or the
- * subjects argument is null.
+ *
+ * @throws NullArgumentException if either the model argument or the
subjects argument is null.
*/
public void assembleModel( DeploymentModel model, List subjects )
throws AssemblyException, NullArgumentException
@@ -147,7 +134,6 @@
{
return;
}
-
if( model instanceof ComponentModel )
{
assembleComponent( (ComponentModel) model, subjects );
@@ -168,7 +154,7 @@
{
return getProfiles( repository, types );
}
- catch ( TypeUnknownException tue )
+ catch( TypeUnknownException tue )
{
// will not happen
final String error = "An irrational condition has occured.";
@@ -184,12 +170,10 @@
return findDependencyProvider( repository, dependency, list );
}

- private DeploymentModel findDependencyProvider( ModelRepository
repository,
- DependencyDescriptor dependency, List subjects )
+ private DeploymentModel findDependencyProvider( ModelRepository
repository, DependencyDescriptor dependency, List subjects )
throws AssemblyException
{
- DeploymentModel[] candidates = repository
- .getCandidateProviders( dependency );
+ DeploymentModel[] candidates = repository.getCandidateProviders(
dependency );
ModelSelector selector = new DefaultModelSelector();
DeploymentModel model = selector.select( candidates, dependency );
//checkCyclic( model, subjects );
@@ -206,54 +190,44 @@

DeploymentProfile[] profiles = findDependencyProfiles( dependency );
ProfileSelector profileSelector = new DefaultProfileSelector();
- DeploymentProfile profile = profileSelector.select( profiles,
- dependency );
+ DeploymentProfile profile = profileSelector.select( profiles,
dependency );
if( profile != null )
{
try
{
- DeploymentModel solution = m_model
- .createDeploymentModel( profile );
+ DeploymentModel solution = m_model.createDeploymentModel(
profile );
assembleModel( solution, subjects );
m_model.addModel( solution );
return solution;
}
- catch ( AssemblyException ae )
+ catch( AssemblyException ae )
{
- final String error = "Nested assembly failure while
attempting to construct model"
- + " for the profile: "
- + profile
- + " for the dependency: [" + dependency + "].";
+ String error = "Nested assembly failure while attempting to
construct model for the profile: " + profile + " for the dependency: [" +
dependency + "].";
throw new AssemblyException( error, ae );
}
- catch ( ModelException me )
+ catch( ModelException me )
{
- final String error = "Nested model failure while attempting
to add model"
- + " for the profile: "
- + profile
- + " for the dependency: [" + dependency + "].";
+ final String error = "Nested model failure while attempting
to add model for the profile: " + profile + " for the dependency: [" +
dependency + "].";
throw new AssemblyException( error, me );
}
}
else
{
- final String error = "Unable to locate a service provider for
the dependency: [ "
- + dependency + "].";
+ String error = "Unable to locate a service provider for the
dependency: [ " + dependency + "].";
throw new AssemblyException( error );
}
}

- private DeploymentModel findDependencyProvider( ModelRepository
repository,
- DependencyModel dependency, List subjects )
- throws AssemblyException
+ private DeploymentModel findDependencyProvider( ModelRepository
repository, DependencyModel dependencyModel, List subjects )
+ throws AssemblyException
{
- String path = dependency.getPath();
+ String path = dependencyModel.getPath();
if( null != path )
{
DeploymentModel model = m_model.getModel( path );
if( null == model )
{
- final String error = "The supplied dependency path [" + path
+ "] does not reference a known component.";
+ String error = "The supplied dependencyModel path [" + path
+ "] does not reference a known component.";
throw new AssemblyException( error );
}
assembleModel( model, subjects );
@@ -261,34 +235,33 @@
}
else
{
- return findDependencyProvider( repository, dependency
- .getDependency(), subjects );
+ DependencyDescriptor dependency =
dependencyModel.getDependency();
+ DeploymentModel dependencyProvider = findDependencyProvider(
repository, dependency, subjects );
+ return dependencyProvider;
}
}

private DeploymentProfile[] findServiceProfiles( ReferenceDescriptor
reference )
{
- TypeRepository repository = m_context.getClassLoaderModel()
- .getTypeRepository();
+ ClassLoaderModel classLoaderModel = m_context.getClassLoaderModel();
+ TypeRepository repository = classLoaderModel.getTypeRepository();
Type[] types = repository.getTypes( reference );
try
{
return getProfiles( repository, types );
}
- catch ( TypeUnknownException tue )
+ catch( TypeUnknownException tue )
{
// will not happen
- final String error = "An irrational condition has occured.";
+ String error = "An irrational condition has occured.";
throw new ModelRuntimeException( error, tue );
}
}

- private DeploymentModel findServiceProvider( ModelRepository repository,
- ReferenceDescriptor reference, List subjects )
- throws AssemblyException
+ private DeploymentModel findServiceProvider( ModelRepository repository,
ReferenceDescriptor reference, List subjects )
+ throws AssemblyException
{
- DeploymentModel[] candidates = repository
- .getCandidateProviders( reference );
+ DeploymentModel[] candidates = repository.getCandidateProviders(
reference );
ModelSelector selector = new DefaultModelSelector();
DeploymentModel model = selector.select( candidates, reference );
if( model != null )
@@ -304,63 +277,57 @@

DeploymentProfile[] profiles = findServiceProfiles( reference );
ProfileSelector profileSelector = new DefaultProfileSelector();
- DeploymentProfile profile = profileSelector
- .select( profiles, reference );
+ DeploymentProfile profile = profileSelector.select( profiles,
reference );
if( profile != null )
{
try
{
- DeploymentModel solution = m_model
- .createDeploymentModel( profile );
+ DeploymentModel solution = m_model.createDeploymentModel(
profile );
assembleModel( solution, subjects );
m_model.addModel( solution );
return solution;
}
- catch ( AssemblyException ae )
+ catch( AssemblyException ae )
{
- final String error = "Nested assembly failure while
attempting to construct model"
- + " for the profile: ["
- + profile
- + "] for the reference: [" + reference + "].";
+ String error = "Nested assembly failure while attempting to
construct model" + " for the profile: [" + profile + "] for the reference: ["
+ reference + "].";
throw new AssemblyException( error, ae );
}
- catch ( ModelException me )
+ catch( ModelException me )
{
- final String error = "Nested model failure while attempting
to add model"
- + " for the profile: "
- + profile
- + " for the reference: [" + reference + "].";
+ String error = "Nested model failure while attempting to add
model" + " for the profile: " + profile + " for the reference: [" + reference
+ "].";
throw new AssemblyException( error, me );
}
}
else
{
- final String error = "Unable to locate a service provider for
the reference: [ "
- + reference + "].";
+ String error = "Unable to locate a service provider for the
reference: [ " + reference + "].";
throw new ProviderNotFoundException( error );
}
}

DeploymentModel findServiceProvider( ReferenceDescriptor reference )
- throws AssemblyException
+ throws AssemblyException
{
ArrayList list = new ArrayList();
ModelRepository repository = m_context.getModelRepository();
- return findServiceProvider( repository, reference, list );
+ DeploymentModel serviceProvider = findServiceProvider( repository,
reference, list );
+ return serviceProvider;
}

- private DeploymentProfile[] getProfiles( TypeRepository repository,
- Type[] types ) throws TypeUnknownException
+ private DeploymentProfile[] getProfiles( TypeRepository repository,
Type[] types )
+ throws TypeUnknownException
{
ArrayList list = new ArrayList();
- for ( int i = 0; i < types.length; i++ )
+ for( int i = 0; i < types.length; i++ )
{
- DeploymentProfile[] profiles = repository.getProfiles( types[i]
);
- for ( int j = 0; j < profiles.length; j++ )
+ DeploymentProfile[] profiles = repository.getProfiles( types[ i
] );
+ for( int j = 0; j < profiles.length; j++ )
{
- list.add( profiles[j] );
+ list.add( profiles[ j ] );
}
}
- return (DeploymentProfile[]) list.toArray( new DeploymentProfile[0]
);
+ DeploymentProfile[] result = new DeploymentProfile[ list.size() ];
+ list.toArray( result );
+ return result;
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelComponentHelper.java
Tue Jun 28 08:36:24 2005
@@ -15,13 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.data.ComponentProfile;
+import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.DependencyGraph;
import net.dpml.composition.model.ModelException;
+import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.model.TypeUnknownException;
import net.dpml.composition.provider.ComponentContext;
import net.dpml.composition.provider.ContainmentContext;
@@ -42,32 +43,20 @@
*/
class DefaultContainmentModelComponentHelper
{
- //-------------------------------------------------------------------
- // static
- //-------------------------------------------------------------------

private static final Resources REZ =
ResourceManager.getPackageResources(
DefaultContainmentModelComponentHelper.class );
-
- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
private final ContainmentContext m_context;
private final ContainmentModel m_model;

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------
-
- /**
- * Creation of a component context creation helper.
- * @param context the containment model context
- * @param model the containment model
- * @exception NullArgumentException if either the context argument or the
model
- * argument is null.
- */
- public DefaultContainmentModelComponentHelper(
- ContainmentContext context, ContainmentModel model )
+ /**
+ * Creation of a component context creation helper.
+ *
+ * @param context the containment model context
+ * @param model the containment model
+ *
+ * @throws NullArgumentException if either the context argument or the
model argument is null.
+ */
+ public DefaultContainmentModelComponentHelper( ContainmentContext
context, ContainmentModel model )
{
if( context == null )
{
@@ -81,42 +70,42 @@
m_model = model;
}

- //-------------------------------------------------------------------
- // implementation
- //-------------------------------------------------------------------
-
- /**
- * Creation of a new component model relative to a supplied profile.
- *
- * @param profile the component profile
- * @return the component model context
- * @exception NullArgumentException if the profile argument is null.
- */
- public ComponentContext createComponentContext( final ComponentProfile
profile )
+ /**
+ * Creation of a new component model relative to a supplied profile.
+ *
+ * @param profile the component profile
+ *
+ * @return the component model context
+ *
+ * @throws NullArgumentException if the profile argument is null.
+ */
+ public ComponentContext createComponentContext( ComponentProfile profile
)
throws ModelException, NullArgumentException
{
if( null == profile )
{
throw new NullArgumentException( "profile" );
}
-
final String name = profile.getName();
final String partition = m_model.getPartition();
// TODO: Get hold of the LogService facade.
Logger logger = new ConsoleLogger();
-
DependencyGraph graph = m_context.getDependencyGraph();
ClassLoader classloader = m_context.getClassLoader();
final File dir = new File( m_context.getWorkingDirectory(), name );
final File temp = new File( m_context.getTempDirectory(), name );
-
try
{
Class base = classloader.loadClass( profile.getClassname() );
- Type type =
m_model.getClassLoaderModel().getTypeRepository().getType( base );
-
- return new DefaultComponentContext( logger, name, classloader,
graph, m_model,
- profile, type, base, dir, temp, partition,
m_context.getRuntime(), m_context.getDefaultDeploymentTimeout() );
+ ClassLoaderModel classLoaderModel =
m_model.getClassLoaderModel();
+ TypeRepository typeRepository =
classLoaderModel.getTypeRepository();
+ Type type = typeRepository.getType( base );
+ long defaultDeploymentTimeout =
m_context.getDefaultDeploymentTimeout();
+ net.dpml.composition.provider.Runtime runtime =
m_context.getRuntime();
+ ComponentContext compContext = new DefaultComponentContext(
logger, name, classloader, graph, m_model,
+ profile, type, base, dir, temp, partition, runtime,
defaultDeploymentTimeout
+ );
+ return compContext;
}
catch( ClassNotFoundException e )
{

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelExportHelper.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelExportHelper.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelExportHelper.java
Tue Jun 28 08:36:24 2005
@@ -15,9 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

+import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.ServiceDirective;
import net.dpml.composition.model.ContainmentModel;
@@ -26,65 +26,53 @@
import net.dpml.composition.model.ModelRepository;
import net.dpml.composition.model.ModelSelector;
import net.dpml.composition.model.TypeRepository;
+import net.dpml.composition.model.ClassLoaderModel;
import net.dpml.composition.provider.ContainmentContext;
import net.dpml.meta.info.DependencyDescriptor;
+import net.dpml.meta.info.ReferenceDescriptor;

/**
- * A utility class that assists in the location of a model relative
- * a supplied path.
+ * A utility class that assists in the location of a model relative a
supplied path.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
class DefaultContainmentModelExportHelper
{
- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
private final ContainmentContext m_context;
private final ContainmentModel m_model;

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------
-
- public DefaultContainmentModelExportHelper(
- ContainmentContext context, ContainmentModel model )
+ public DefaultContainmentModelExportHelper( ContainmentContext context,
ContainmentModel model )
{
m_context = context;
m_model = model;
}

- //-------------------------------------------------------------------
- // implementation
- //-------------------------------------------------------------------
-
- public DefaultServiceModel[] createServiceExport() throws ModelException
+ public DefaultServiceModel[] createServiceExport()
+ throws ModelException
{
-
- ServiceDirective[] export =
- m_context.getContainmentProfile().getExportDirectives();
+ ContainmentProfile containmentProfile =
m_context.getContainmentProfile();
+ ServiceDirective[] export = containmentProfile.getExportDirectives();
DefaultServiceModel[] services = new DefaultServiceModel[
export.length ];
- for( int i=0; i<export.length; i++ )
+ for( int i = 0; i < export.length; i++ )
{
- ServiceDirective service = export[i];
+ ServiceDirective service = export[ i ];
Class clazz = getServiceExportClass( service );
- DeploymentModel provider =
- locateImplementionProvider( service );
- services[i] =
- new DefaultServiceModel( service, clazz, provider );
+ DeploymentModel provider = locateImplementionProvider( service );
+ services[ i ] = new DefaultServiceModel( service, clazz,
provider );
}
return services;
}

- /**
- * Return the class declared by a container service export declaration.
- * @return the exported service interface class
- * @exception ModelException if the class cannot be resolved
- */
+ /**
+ * Return the class declared by a container service export declaration.
+ *
+ * @return the exported service interface class
+ *
+ * @throws ModelException if the class cannot be resolved
+ */
private Class getServiceExportClass( ServiceDirective service )
- throws ModelException
+ throws ModelException
{
String classname = service.getReference().getClassname();
try
@@ -104,19 +92,19 @@
}
}

- /**
- * Given a service directive declared by a container, locate a model
- * with this containment model to map as the provider. If not model
- * is explicity declared, the implementation will attempt to construct
- * a new model based on packaged profiles and add the created model to
- * the set of models within this container.
- *
- * @param service the service directive
- * @return the implementing deployment model
- * @exception ModelException if an implementation is not resolvable
- */
+ /**
+ * Given a service directive declared by a container, locate a model
with this containment model to map as the
+ * provider. If not model is explicity declared, the implementation
will attempt to construct a new model based on
+ * packaged profiles and add the created model to the set of models
within this container.
+ *
+ * @param service the service directive
+ *
+ * @return the implementing deployment model
+ *
+ * @throws ModelException if an implementation is not resolvable
+ */
private DeploymentModel locateImplementionProvider( ServiceDirective
service )
- throws ModelException
+ throws ModelException
{
final String path = service.getPath();
if( null != path )
@@ -124,15 +112,8 @@
DeploymentModel provider = m_model.getModel( path );
if( null == provider )
{
- final String error =
- "Implemention provider path ["
- + path
- + "] for the exported service ["
- + service.getReference()
- + "] in the containment model "
- + m_model
- + " does not reference a known model.";
- throw new ModelException( error );
+ String error = "Implemention provider path [" + path + "]
for the exported service [" + service.getReference() + "] in the containment
model " + m_model + " does not reference a known model.";
+ throw new ModelException( error );
}
else
{
@@ -141,14 +122,11 @@
}
else
{
- final DependencyDescriptor dependency =
- new DependencyDescriptor(
- "export",
- service.getReference() );
-
- final ModelRepository repository =
m_context.getModelRepository();
- final DeploymentModel[] candidates = repository.getModels();
- final ModelSelector selector = new DefaultModelSelector();
+ ReferenceDescriptor reference = service.getReference();
+ DependencyDescriptor dependency = new DependencyDescriptor(
"export", reference );
+ ModelRepository repository = m_context.getModelRepository();
+ DeploymentModel[] candidates = repository.getModels();
+ ModelSelector selector = new DefaultModelSelector();
DeploymentModel provider = selector.select( candidates,
dependency );
if( null != provider )
{
@@ -156,25 +134,19 @@
}
else
{
- TypeRepository repo =
- m_context.getClassLoaderModel().getTypeRepository();
- DeploymentProfile profile =
- repo.getProfile( dependency, false );
+ ClassLoaderModel classLoaderModel =
m_context.getClassLoaderModel();
+ TypeRepository repo = classLoaderModel.getTypeRepository();
+ DeploymentProfile profile = repo.getProfile( dependency,
false );
if( profile != null )
{
return m_model.addModel( profile );
}
else
{
- final String error =
- "Could not locate a provider for the exported service
["
- + dependency.getReference()
- + "] in the containment model "
- + m_model;
+ String error = "Could not locate a provider for the
exported service [" + dependency.getReference() + "] in the containment model
" + m_model;
throw new ModelException( error );
}
}
}
}
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelNavigationHelper.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelNavigationHelper.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelNavigationHelper.java
Tue Jun 28 08:36:24 2005
@@ -15,49 +15,34 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.model.ContainmentModel;
import net.dpml.composition.model.DeploymentModel;
+import net.dpml.composition.model.ModelRepository;
import net.dpml.composition.provider.ContainmentContext;

/**
- * A utility class that assists in the location of a model relative
- * a supplied path.
+ * A utility class that assists in the location of a model relative a
supplied path.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
class DefaultContainmentModelNavigationHelper
{
- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------

private final ContainmentContext m_context;
private final ContainmentModel m_model;

- //-------------------------------------------------------------------
- // constructor
- //-------------------------------------------------------------------
-
- public DefaultContainmentModelNavigationHelper(
- ContainmentContext context, ContainmentModel model )
+ public DefaultContainmentModelNavigationHelper( ContainmentContext
context, ContainmentModel model )
{
m_context = context;
m_model = model;
}

- //-------------------------------------------------------------------
- // implementation
- //-------------------------------------------------------------------
-
public DeploymentModel getModel( String path )
{
- ContainmentModel parent =
- m_context.getParentContainmentModel();
-
+ ContainmentModel parent = m_context.getParentContainmentModel();
if( "".equals( path ) )
{
return m_model;
@@ -80,7 +65,8 @@
// path can be transfored to a relative reference
//

- return m_model.getModel( path.substring( 1 ) );
+ String subpath = path.substring( 1 );
+ return m_model.getModel( subpath );
}
}
else
@@ -95,7 +81,6 @@
//

final String root = getRootName( path );
-
if( "..".equals( root ) )
{
//
@@ -106,15 +91,12 @@

if( null != parent )
{
- final String remainder = getRemainder( root, path );
+ String remainder = getRemainder( root, path );
return parent.getModel( remainder );
}
else
{
- final String error =
- "Supplied path ["
- + path
- + "] references a container above the root container.";
+ String error = "Supplied path [" + path + "] references
a container above the root container.";
throw new IllegalArgumentException( error );
}
}
@@ -125,7 +107,7 @@
// equivalent to "xxx/yyy"
//

- final String remainder = getRemainder( root, path );
+ String remainder = getRemainder( root, path );
return m_model.getModel( remainder );
}
else if( path.indexOf( "/" ) < 0 )
@@ -144,8 +126,8 @@
// getModel to the container
//

- DeploymentModel model =
- m_context.getModelRepository().getModel( root );
+ ModelRepository modelRepository =
m_context.getModelRepository();
+ DeploymentModel model = modelRepository.getModel( root );
if( model != null )
{
//
@@ -156,17 +138,13 @@

if( model instanceof ContainmentModel )
{
- ContainmentModel container =
- (ContainmentModel) model;
+ ContainmentModel container = (ContainmentModel)
model;
final String remainder = getRemainder( root, path );
return container.getModel( remainder );
}
else
{
- final String error =
- "The path element [" + root
- + "] does not reference a containment model within
["
- + m_model + "].";
+ String error = "The path element [" + root + "] does
not reference a containment model within [" + m_model + "].";
throw new IllegalArgumentException( error );
}
}
@@ -177,10 +155,7 @@
// known container
//

- final String error =
- "Unable to locate a container with name ["
- + root + "] within the container ["
- + m_model + "].";
+ String error = "Unable to locate a container with name
[" + root + "] within the container [" + m_model + "].";
throw new IllegalArgumentException( error );
}
}
@@ -190,13 +165,13 @@
private String getRootName( String path )
{
int n = path.indexOf( "/" );
- if( n < 0 )
+ if( n < 0 )
{
return path;
}
else
{
- return path.substring( 0, n );
+ return path.substring( 0, n );
}
}

@@ -204,5 +179,4 @@
{
return path.substring( name.length() + 1 );
}
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextMap.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextMap.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextMap.java
Tue Jun 28 08:36:24 2005
@@ -39,22 +39,9 @@
*/
public class DefaultContextMap extends HashMap
{
- //==============================================================
- // static
- //==============================================================
-
- private static final Resources REZ =
- ResourceManager.getPackageResources( DefaultContextMap.class );
+ private static final Resources REZ =
ResourceManager.getPackageResources( DefaultContextMap.class );

- //==============================================================
- // immutable state
- //==============================================================
-
- private final Map m_map;
-
- //==============================================================
- // constructor
- //==============================================================
+ private final Map m_contextEntryHandlers;

/**
* <p>Creation of a new default context.</p>
@@ -63,7 +50,7 @@
*/
public DefaultContextMap( Map map )
{
- m_map = map;
+ m_contextEntryHandlers = map;
}

//==============================================================
@@ -84,7 +71,7 @@
* @exception ModelRuntimeException if the key is unresolvable
* @exception NullArgumentException if the key argument is null.
*/
- public Object get( final Object key )
+ public Object get( Object key )
throws NullArgumentException, IllegalArgumentException,
ModelRuntimeException
{
if( null == key )
@@ -92,7 +79,7 @@
throw new NullArgumentException( "key" );
}

- EntryModel model = (EntryModel) m_map.get( key.toString() );
+ EntryModel model = (EntryModel) m_contextEntryHandlers.get(
key.toString() );
if( null == model )
{
throw new IllegalArgumentException( key.toString() );

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContextModel.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.data.ConstructorDirective;
@@ -36,11 +35,10 @@

import java.util.Hashtable;
import java.util.Map;
-
+import java.util.Collection;

/**
- * <p>Specification of a context model from which a
- * a fully qualifed context can be established.</p>
+ * <p>Specification of a context model from which a a fully qualifed context
can be established.</p>
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
@@ -48,9 +46,6 @@
public class DefaultContextModel
implements ContextModel
{
- //==============================================================
- // static
- //==============================================================

private static final Resources REZ;

@@ -58,7 +53,7 @@
{
REZ = ResourceManager.getPackageResources( DefaultContextModel.class
);
}
-
+
public static boolean isaStandardKey( String key )
{
boolean isComposition = key.startsWith( "urn:composition:" );
@@ -66,37 +61,23 @@
return isComposition || isMetro;
}

- //==============================================================
- // immutable state
- //==============================================================
-
private final ContextDescriptor m_descriptor;
-
private final ContextDirective m_directive;
-
private final ComponentContext m_context;
-
private final Map m_map = new Hashtable();
-
private DeploymentModel m_provider;

- //==============================================================
- // constructor
- //==============================================================
-
- /**
- * <p>Default implementation of the context model. The implementation
- * takes an inital system context as the base for context value
- * establishment and uses this to set standard context entries.</p>
- *
- * @param descriptor the contextualization stage descriptor that describes
- * the set of context entries that the component type is requesting
- * @param directive the contextualization directive that describes a set
- * of context entry creation strategies
- * @param context the component model context argument
- * @exception NullArgumentException if either the logger, the descriptor
or the
- * context argument is null.
- */
+ /**
+ * <p>Default implementation of the context model. The implementation
takes an inital system context as the base
+ * for context value establishment and uses this to set standard context
entries.</p>
+ *
+ * @param descriptor the contextualization stage descriptor that
describes the set of context entries that the
+ * component type is requesting
+ * @param directive the contextualization directive that describes a
set of context entry creation strategies
+ * @param context the component model context argument
+ *
+ * @throws NullArgumentException if either the logger, the descriptor or
the context argument is null.
+ */
public DefaultContextModel( ContextDescriptor descriptor,
ContextDirective directive, ComponentContext context )
throws ModelException, NullArgumentException
{
@@ -104,7 +85,6 @@
{
throw new NullArgumentException( "descriptor" );
}
-
if( null == context )
{
throw new NullArgumentException( "context" );
@@ -120,15 +100,15 @@
//

EntryDescriptor[] entries = descriptor.getEntries();
- for( int i=0; i<entries.length; i++ )
+ for( int i = 0; i < entries.length; i++ )
{
- EntryDescriptor entry = entries[i];
+ EntryDescriptor entry = entries[ i ];
String alias = entry.getAlias();
final String key = entry.getKey();
if( isaStandardKey( key ) )
{
- DefaultImportModel model = new DefaultImportModel( entry,
key, m_context );
- setEntryModel( alias, model );
+ DefaultImportModel model = new DefaultImportModel( entry,
key, m_context );
+ setEntryModel( alias, model );
}
else
{
@@ -143,9 +123,7 @@
{
if( entry.isRequired() )
{
- final String error =
- REZ.getString(
- "context.missing-directive.error", key );
+ String error = REZ.getString(
"context.missing-directive.error", key );
throw new ModelException( error );
}
}
@@ -163,8 +141,7 @@
// importing under an alias of a container scoped key
//

- ImportDirective importDirective =
- (ImportDirective) entryDirective;
+ ImportDirective importDirective = (ImportDirective)
entryDirective;
String ref = importDirective.getImportKey();
DefaultImportModel model = new DefaultImportModel(
entry, ref, m_context );
setEntryModel( alias, model );
@@ -172,22 +149,13 @@
else if( entryDirective instanceof ConstructorDirective )
{
ConstructorDirective constructor =
(ConstructorDirective) entryDirective;
- DefaultConstructorModel model =
- new DefaultConstructorModel(
- entry,
- constructor,
- context,
- m_map );
+ DefaultConstructorModel model = new
DefaultConstructorModel( entry, constructor, context, m_map );
setEntryModel( alias, model );
}
else
{
- String modelClass =
- entryDirective.getClass().getName();
- final String error =
- REZ.getString(
- "context.unsupported-directive.error",
- key, modelClass );
+ String modelClass =
entryDirective.getClass().getName();
+ String error = REZ.getString(
"context.unsupported-directive.error", key, modelClass );
throw new ModelException( error );
}
}
@@ -199,27 +167,27 @@
{
return m_provider;
}
-
+
public void setProvider( DeploymentModel provider )
{
m_provider = provider;
}
-
- /**
- * Return the classname of a custom casting class.
- *
- * @return the custom context casting class (possibly null)
- */
+
+ /**
+ * Return the classname of a custom casting class.
+ *
+ * @return the custom context casting class (possibly null)
+ */
public String getCastingClassname()
{
return m_descriptor.getContextInterfaceClassname();
}

- /**
- * Return the context implementation classname.
- *
- * @return the context implementation class (possibly null)
- */
+ /**
+ * Return the context implementation classname.
+ *
+ * @return the context implementation class (possibly null)
+ */
public String getImplementationClassname()
{
if( null == m_directive )
@@ -232,68 +200,63 @@
}
}

- //==============================================================
- // ContextModel
- //==============================================================
-
- /**
- * Return the set of entry models associated with this context model.
- *
- * @return the entry models
- */
+ /**
+ * Return the set of entry models associated with this context model.
+ *
+ * @return the entry models
+ */
public EntryModel[] getEntryModels()
{
- return (EntryModel[]) m_map.values().toArray( new EntryModel[0] );
+ Collection values = m_map.values();
+ EntryModel[] array = new EntryModel[ values.size() ];
+ values.toArray( array );
+ return array;
}

- /**
- * Return an entry model matching the supplied key.
- *
- * @return the entry model or null if tyhe key is unknown
- */
+ /**
+ * Return an entry model matching the supplied key.
+ *
+ * @return the entry model or null if tyhe key is unknown
+ */
public EntryModel getEntryModel( String key )
{
return (EntryModel) m_map.get( key );
}

- /**
- * Set the entry model relative to a supplied key.
- *
- * @param key the entry key
- * @param model the entry model
- */
+ /**
+ * Set the entry model relative to a supplied key.
+ *
+ * @param key the entry key
+ * @param model the entry model
+ */
public void setEntryModel( String key, EntryModel model )
{
m_map.put( key, model );
}

- /**
- * Set the entry to a suplied value.
- *
- * @param key the entry key
- * @param value the entry value
- */
+ /**
+ * Set the entry to a suplied value.
+ *
+ * @param key the entry key
+ * @param value the entry value
+ */
public void setEntry( String key, Object value )
{
EntryDescriptor descriptor = m_descriptor.getEntry( key );
if( null == descriptor )
{
- final String error =
- "Invalid context entry key ["
- + key
- + "].";
+ String error = "Invalid context entry key [" + key + "].";
throw new ModelRuntimeException( error );
}
- OverrideEntryModel model =
- new OverrideEntryModel( descriptor, value );
+ OverrideEntryModel model = new OverrideEntryModel( descriptor, value
);
setEntryModel( key, model );
}

- /**
- * Return the context map established for the component.
- *
- * @return the context map
- */
+ /**
+ * Return the context map established for the component.
+ *
+ * @return the context map
+ */
public Map getContextMap()
{
return new DefaultContextMap( m_map );

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependencyModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependencyModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDependencyModel.java
Tue Jun 28 08:36:24 2005
@@ -40,43 +40,26 @@
public class DefaultDependencyModel
implements DependencyModel
{
- //--------------------------------------------------------------
- // static
- //--------------------------------------------------------------
-
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultDependencyModel.class );

- //--------------------------------------------------------------
- // immutable state
- //--------------------------------------------------------------
-
private final DependencyDescriptor m_descriptor;
-
private final DependencyDirective m_directive;
-
private final String m_source;
-
private final Logger m_logger;
-
private DeploymentModel m_provider;

-
- //--------------------------------------------------------------
- // constructor
- //--------------------------------------------------------------
-
- /**
- * Creation of a new dependency model.
- *
- * @param logger the logging channel
- * @param partition the partition
- * @param descriptor the dependency descriptor
- * @param directive the dependency directive (possibly null)
- * @exception NullArgumentException if either the logger argument or the
- * descriptor argument is null.
- */
+ /**
+ * Creation of a new dependency model.
+ *
+ * @param logger the logging channel
+ * @param partition the partition
+ * @param descriptor the dependency descriptor
+ * @param directive the dependency directive (possibly null)
+ * @exception NullArgumentException if either the logger argument or the
+ * descriptor argument is null.
+ */
public DefaultDependencyModel( Logger logger, String partition,
DependencyDescriptor descriptor, DependencyDirective directive )
- throws NullArgumentException
+ throws NullArgumentException
{
if( descriptor == null )
{
@@ -98,7 +81,7 @@
if( directive.getSource() != null )
{
m_source = resolvePath( partition, directive.getSource() );
- final String message = REZ.getString(
"dependency.path.debug", m_source, directive.getKey() );
+ String message = REZ.getString( "dependency.path.debug",
m_source, directive.getKey() );
m_logger.debug( message );
}
else
@@ -121,44 +104,40 @@
{
m_provider = provider;
}
-
- //--------------------------------------------------------------
- // DependencyModel
- //--------------------------------------------------------------
-
- /**
- * Return the dependency descriptor.
- *
- * @return the descriptor
- */
+
+ /**
+ * Return the dependency descriptor.
+ *
+ * @return the descriptor
+ */
public DependencyDescriptor getDependency()
{
return m_descriptor;
}

- /**
- * Return an explicit path to a supplier component.
- * If a dependency directive has been declared
- * and the directive contains a source declaration, the value
- * returned is the result of parsing the source value relative
- * to the absolute address of the implementing component.
- *
- * @return the explicit path
- */
+ /**
+ * Return an explicit path to a supplier component.
+ * If a dependency directive has been declared
+ * and the directive contains a source declaration, the value
+ * returned is the result of parsing the source value relative
+ * to the absolute address of the implementing component.
+ *
+ * @return the explicit path
+ */
public String getPath()
{
return m_source;
}

- /**
- * Filter a set of candidate service descriptors and return the
- * set of acceptable service as a ordered sequence.
- *
- * @param candidates the set of candidate services for the dependency
- * matching the supplied key
- * @return the accepted candidates in ranked order
- * @exception IllegalArgumentException if the key is unknown
- */
+ /**
+ * Filter a set of candidate service descriptors and return the
+ * set of acceptable service as a ordered sequence.
+ *
+ * @param candidates the set of candidate services for the dependency
+ * matching the supplied key
+ * @return the accepted candidates in ranked order
+ * @exception IllegalArgumentException if the key is unknown
+ */
public ServiceDescriptor[] filter( ServiceDescriptor[] candidates )
{
if( m_directive != null )
@@ -171,14 +150,14 @@
return candidates;
}

- /**
- * Filter a set of candidate service descriptors and return the
- * set of acceptable service as a ordered sequence.
- *
- * @param directive the dependency directive
- * @param services the set of candidate services for the dependency
- * @return the accepted candidates in ranked order
- */
+ /**
+ * Filter a set of candidate service descriptors and return the
+ * set of acceptable service as a ordered sequence.
+ *
+ * @param directive the dependency directive
+ * @param services the set of candidate services for the dependency
+ * @return the accepted candidates in ranked order
+ */
private ServiceDescriptor[] filter( DependencyDirective directive,
ServiceDescriptor[] services )
{
SelectionDirective[] filters = getFilters( directive );
@@ -244,8 +223,7 @@
}
else
{
- final String error =
- REZ.getString( "dependency.invalid-criteria.error", criteria,
feature );
+ String error = REZ.getString(
"dependency.invalid-criteria.error", criteria, feature );
throw new IllegalArgumentException( error );
}
}
@@ -267,8 +245,6 @@
}
else
{
- System.out.println( "Niclas: Partition:" + partition );
- System.out.println( "NICLAS: Path:" + path );
return path;
}
}
@@ -295,11 +271,11 @@
}
}

- /**
- * Return the required selection constraints.
- * @param directive the dependency directive
- * @return the set of required selection directives
- */
+ /**
+ * Return the required selection constraints.
+ * @param directive the dependency directive
+ * @return the set of required selection directives
+ */
private SelectionDirective[] getFilters( DependencyDirective directive )
{
ArrayList list = new ArrayList();
@@ -312,6 +288,8 @@
list.add( selection );
}
}
- return (SelectionDirective[]) list.toArray( new
SelectionDirective[0] );
+ SelectionDirective[] array = new SelectionDirective[ list.size() ];
+ list.toArray( array );
+ return array;
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentContext.java
Tue Jun 28 08:36:24 2005
@@ -41,10 +41,6 @@
public class DefaultDeploymentContext extends DefaultContext
implements DeploymentContext
{
- //---------------------------------------------------------
- // immutable state
- //---------------------------------------------------------
-
private final String m_name;
private final String m_partition;
private final Logger m_logger;
@@ -54,26 +50,20 @@
private final Runtime m_runtime;
private final long m_timeout;

- //---------------------------------------------------------
- // constructor
- //---------------------------------------------------------
-
- /**
- * Creation of a new deployment context.
- *
- * @param logger the logging channel to assign
- * @param partition the assigned partition name
- * @param name the profile name
- * @param mode the deployment mode
- * @param graph the parent deployment assembly graph
- * @param timeout the default deployment timeout
- * @exception NullArgumentException if any one of the runtime, logger,
name, mode
- * profile or system argument is null.
- */
- public DefaultDeploymentContext(
- Logger logger, String partition, String name,
- Mode mode, DeploymentProfile profile, DependencyGraph graph,
- Runtime runtime, long timeout )
+ /**
+ * Creation of a new deployment context.
+ *
+ * @param logger the logging channel to assign
+ * @param partition the assigned partition name
+ * @param name the profile name
+ * @param mode the deployment mode
+ * @param graph the parent deployment assembly graph
+ * @param timeout the default deployment timeout
+ * @exception NullArgumentException if any one of the runtime, logger,
name, mode
+ * profile or system argument is null.
+ */
+ public DefaultDeploymentContext( Logger logger, String partition, String
name, Mode mode, DeploymentProfile profile,
+ DependencyGraph graph, Runtime runtime,
long timeout )
throws NullArgumentException
{
super();
@@ -113,43 +103,39 @@
m_timeout = timeout;
}

- //---------------------------------------------------------
- // DeploymentContext
- //---------------------------------------------------------
-
- /**
- * Return the runtime provider.
- *
- * @return the runtime provider
- */
+ /**
+ * Return the runtime provider.
+ *
+ * @return the runtime provider
+ */
public Runtime getRuntime()
{
return m_runtime;
}

- /**
- * Return the profile name.
- * @return the name
- */
+ /**
+ * Return the profile name.
+ * @return the name
+ */
public String getName()
{
return m_name;
}

- /**
- * Return the assigned partition name.
- *
- * @return the partition name
- */
+ /**
+ * Return the assigned partition name.
+ *
+ * @return the partition name
+ */
public String getPartitionName()
{
return m_partition;
}

- /**
- * Return the model fully qualified name.
- * @return the fully qualified name
- */
+ /**
+ * Return the model fully qualified name.
+ * @return the fully qualified name
+ */
public String getQualifiedName()
{
if( null == getPartitionName() )
@@ -162,50 +148,50 @@
}
}

- /**
- * Return the mode of establishment.
- * @return the mode
- */
+ /**
+ * Return the mode of establishment.
+ * @return the mode
+ */
public Mode getMode()
{
return m_mode;
}

- /**
- * Return the deployment profile.
- *
- * @return the profile
- */
+ /**
+ * Return the deployment profile.
+ *
+ * @return the profile
+ */
public DeploymentProfile getProfile()
{
return m_profile;
}

- /**
- * Return the assigned logger.
- * @return the logging channel
- */
+ /**
+ * Return the assigned logger.
+ * @return the logging channel
+ */
public Logger getLogger()
{
return m_logger;
}

- /**
- * Return the dependency graph used to construct
- * deployment and decommissioning sequences.
- *
- * @return the dependency graph
- */
+ /**
+ * Return the dependency graph used to construct
+ * deployment and decommissioning sequences.
+ *
+ * @return the dependency graph
+ */
public DependencyGraph getDependencyGraph()
{
return m_graph;
}

- /**
- * Return the default deployment timeout.
- *
- * @return the profile
- */
+ /**
+ * Return the default deployment timeout.
+ *
+ * @return the profile
+ */
public long getDefaultDeploymentTimeout()
{
return m_timeout;

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultDeploymentModel.java
Tue Jun 28 08:36:24 2005
@@ -32,22 +32,8 @@
public abstract class DefaultDeploymentModel
implements DeploymentModel
{
- //--------------------------------------------------------------
- // immutable state
- //--------------------------------------------------------------
-
private final DeploymentContext m_context;

- //--------------------------------------------------------------
- // muttable state
- //--------------------------------------------------------------
-
- private Logger m_logger;
-
- //--------------------------------------------------------------
- // constructor
- //--------------------------------------------------------------
-
/**
* Creation of an abstract model. The model associated a name and a
partition.
*
@@ -63,7 +49,6 @@
throw new NullArgumentException( "context" );
}
m_context = context;
- m_logger = m_context.getLogger();
}

//--------------------------------------------------------------
@@ -207,7 +192,7 @@
*/
public Logger getLogger()
{
- return m_logger;
+ return m_context.getLogger();
}

//--------------------------------------------------------------
@@ -221,6 +206,8 @@

public boolean equals( Object other )
{
+ // TODO: Niclas: Is it really true that instance equality is
expected??
+ // And if so, remove this method, if not don't forget the hashCode()
method.
boolean equal = super.equals( other );
return equal;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultEntryModel.java
Tue Jun 28 08:36:24 2005
@@ -34,22 +34,14 @@
public abstract class DefaultEntryModel
implements EntryModel
{
- //==============================================================
- // immmutable state
- //==============================================================
-
private EntryDescriptor m_descriptor;

- //==============================================================
- // constructor
- //==============================================================
-
- /**
- * Creation of a new context entry import model.
- *
- * @param descriptor the context entry descriptor
- * @exception NullArgumentException is the descriptor argument is null.
- */
+ /**
+ * Creation of a new context entry import model.
+ *
+ * @param descriptor the context entry descriptor
+ * @exception NullArgumentException is the descriptor argument is null.
+ */
public DefaultEntryModel( EntryDescriptor descriptor )
throws NullArgumentException
{
@@ -60,25 +52,22 @@
m_descriptor = descriptor;
}

- //==============================================================
- // EntryModel
- //==============================================================
-
- /**
- * Return the context entry key.
- *
- * @return the key
- */
+ /**
+ * Return the context entry key.
+ *
+ * @return the key
+ */
public String getKey()
{
return m_descriptor.getKey();
}

- /**
- * Return the context entry value.
- *
- * @return the context entry value
- */
- public abstract Object getValue() throws ModelException;
+ /**
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
+ public abstract Object getValue()
+ throws ModelException;

}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultFileSelector.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultFileSelector.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultFileSelector.java
Tue Jun 28 08:36:24 2005
@@ -24,16 +24,17 @@
public class DefaultFileSelector implements FileSelector
{
/**
- * This file selector implementation will not filter any file
- * candidates, but instead allow all selections.
- *
- * @param basedir <code>File</code> object for the base directory
- * @param filename the name of the file to check
- * @param file <code>File</code> object for this filename
- * @return whether the file should be selected or not
- */
+ * This file selector implementation will not filter any file
+ * candidates, but instead allow all selections.
+ *
+ * @param basedir <code>File</code> object for the base directory
+ * @param filename the name of the file to check
+ * @param file <code>File</code> object for this filename
+ * @return whether the file should be selected or not
+ */
public boolean isSelected( File basedir, String filename, File file )
{
+ // TODO: Niclas: What on earth is this class needed for??
return true;
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultFilesetModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultFilesetModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultFilesetModel.java
Tue Jun 28 08:36:24 2005
@@ -14,7 +14,6 @@
* limitations under the License.
*
*/
-
package net.dpml.composition.model.impl;

import net.dpml.composition.data.ExcludeDirective;
@@ -26,79 +25,60 @@
import java.io.IOException;
import java.util.ArrayList;

-
/**
-* Implementation of a <code>FilesetModel</code> in which a set
-* of <code>IncludeDirective</code> objects, a set of
-* <code>ExcludeDirective</code> objects, a set of default
-* includes and excludes, and a base directory anchor are used
-* to resolve and build a set of files specified by a
-* <code>FilesetDirective</code>.
-*
-* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
-* @version $Id$
-*/
+ * Implementation of a <code>FilesetModel</code> in which a set of
<code>IncludeDirective</code> objects, a set of
+ * <code>ExcludeDirective</code> objects, a set of default includes and
excludes, and a base directory anchor are used
+ * to resolve and build a set of files specified by a
<code>FilesetDirective</code>.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id$
+ */
public class DefaultFilesetModel
implements FilesetModel
{
+
/**
- * Base directory anchor from which to begin filset resolution.
- */
+ * Base directory anchor from which to begin filset resolution.
+ */
private File m_anchor = null;
-
/**
- * Array of <code>IncludeDirective</code> objects to use during
- * fileset resolution.
- */
+ * Array of <code>IncludeDirective</code> objects to use during fileset
resolution.
+ */
private IncludeDirective[] m_includes = null;
-
/**
- * Array of <code>ExcludeDirective</code> objects to use during
- * fileset resolution.
- */
+ * Array of <code>ExcludeDirective</code> objects to use during fileset
resolution.
+ */
private ExcludeDirective[] m_excludes = null;
-
/**
- * Array of <code>String</code> objects to use as a default set
- * of fileset includes.
- */
+ * Array of <code>String</code> objects to use as a default set of
fileset includes.
+ */
private String[] m_defaultIncludes = null;
-
/**
- * Array of <code>String</code> objects to use as a default set
- * of fileset excludes.
- */
+ * Array of <code>String</code> objects to use as a default set of
fileset excludes.
+ */
private String[] m_defaultExcludes = null;
-
/**
- * Array of <code>File</code> objects representing the results
- * of fileset resolution.
- */
+ * Array of <code>File</code> objects representing the results of
fileset resolution.
+ */
private ArrayList m_list = null;
-
/**
- * Container-supplied logger instance.
- */
+ * Container-supplied logger instance.
+ */
private final Logger m_logger;
-
+
/**
- * Constructs a new default fileset model.
- *
- * @param anchor base directory anchor from which to begin
- * fileset resolution
- * @param includes array of <code>IncludeDirective</code> objects
- * to use during fileset resolution
- * @param excludes array of <code>ExcludeDirective</code> objects
- * to use during fileset resolution
- * @param defaultIncludes array of <code>String</code> objects
- * to use as a default set of fileset includes
- * @param defaultExcludes array of <code>String</code> objects
- * to use as a default set of fileset excludes
- * @param logger <code>Logger</code> for the fileset model to use
- */
- public DefaultFilesetModel(File anchor, IncludeDirective[] includes,
- ExcludeDirective[] excludes, String[] defaultIncludes,
- String[] defaultExcludes, Logger logger)
+ * Constructs a new default fileset model.
+ *
+ * @param anchor base directory anchor from which to begin
fileset resolution
+ * @param includes array of <code>IncludeDirective</code> objects
to use during fileset resolution
+ * @param excludes array of <code>ExcludeDirective</code> objects
to use during fileset resolution
+ * @param defaultIncludes array of <code>String</code> objects to use as
a default set of fileset includes
+ * @param defaultExcludes array of <code>String</code> objects to use as
a default set of fileset excludes
+ * @param logger <code>Logger</code> for the fileset model to
use
+ */
+ public DefaultFilesetModel(
+ File anchor, IncludeDirective[] includes, ExcludeDirective[]
excludes,
+ String[] defaultIncludes, String[] defaultExcludes, Logger logger )
{
m_logger = logger;
m_list = new ArrayList();
@@ -108,122 +88,142 @@
setDefaultIncludes( defaultIncludes );
setDefaultExcludes( defaultExcludes );
}
-
+
/**
- * Establishes the base directory anchor for the fileset resolution.
- *
- * @param anchor the base directory anchor
- */
- private void setBaseDirectory(File anchor) {
+ * Establishes the base directory anchor for the fileset resolution.
+ *
+ * @param anchor the base directory anchor
+ */
+ private void setBaseDirectory( File anchor )
+ {
m_anchor = anchor;
}

/**
- * Establishes the set of <code>IncludeDirective</code> objects
- * to use during fileset resolution.
- *
- * @param includes array of <code>IncludeDirective</code> objects
- */
- private void setIncludeDirectives(IncludeDirective[] includes) {
+ * Establishes the set of <code>IncludeDirective</code> objects to use
during fileset resolution.
+ *
+ * @param includes array of <code>IncludeDirective</code> objects
+ */
+ private void setIncludeDirectives( IncludeDirective[] includes )
+ {
m_includes = includes;
}

/**
- * Establishes the set of <code>ExcludeDirective</code> objects
- * to use during fileset resolution.
- *
- * @param excludes array of <code>ExcludeDirectives</code>
- */
- private void setExcludeDirectives(ExcludeDirective[] excludes) {
+ * Establishes the set of <code>ExcludeDirective</code> objects to use
during fileset resolution.
+ *
+ * @param excludes array of <code>ExcludeDirectives</code>
+ */
+ private void setExcludeDirectives( ExcludeDirective[] excludes )
+ {
m_excludes = excludes;
}

/**
- * Establishes a set of default includes to use during fileset
- * resolution in lieu of an explicit specification of a set
- * of <code>IncludeDirective</code> objects.
- *
- * @param defaultIncludes array of <code>String</code> objects
- * representing a set of default fileset includes
- */
- private void setDefaultIncludes(String[] defaultIncludes) {
- if (defaultIncludes == null) {
+ * Establishes a set of default includes to use during fileset
resolution in lieu of an explicit specification of a
+ * set of <code>IncludeDirective</code> objects.
+ *
+ * @param defaultIncludes array of <code>String</code> objects
representing a set of default fileset includes
+ */
+ private void setDefaultIncludes( String[] defaultIncludes )
+ {
+ if( defaultIncludes == null )
+ {
//m_defaultIncludes = new String[1];
//m_defaultIncludes[0] = "*.jar";
- m_defaultIncludes = new String[0];
- } else {
+ m_defaultIncludes = new String[ 0 ];
+ } else
+ {
m_defaultIncludes = defaultIncludes;
}
}

/**
- * Establishes a set of default excludes to use during fileset
- * resolution in lieu of an explicit specification of a set
- * of <code>ExcludeDirective</code> objects.
- *
- * @param defaultExcludes array of <code>String</code> objects
- * representing a set of default fileset excludes
- */
- private void setDefaultExcludes(String[] defaultExcludes) {
- if (defaultExcludes == null) {
- m_defaultExcludes = new String[0];
- } else {
+ * Establishes a set of default excludes to use during fileset
resolution in lieu of an explicit specification of a
+ * set of <code>ExcludeDirective</code> objects.
+ *
+ * @param defaultExcludes array of <code>String</code> objects
representing a set of default fileset excludes
+ */
+ private void setDefaultExcludes( String[] defaultExcludes )
+ {
+ if( defaultExcludes == null )
+ {
+ m_defaultExcludes = new String[ 0 ];
+ } else
+ {
m_defaultExcludes = defaultExcludes;
}
}

/**
- * Returns a set of <code>File</code> objects representing the
- * results of the fileset resolution. This array will contain
- * fully qualified filenames based on the base directory anchor.
- *
- * @return an array of files to include in the classpath
- */
- public ArrayList getIncludes() {
+ * Returns a set of <code>File</code> objects representing the results
of the fileset resolution. This array will
+ * contain fully qualified filenames based on the base directory anchor.
+ *
+ * @return an array of files to include in the classpath
+ */
+ public ArrayList getIncludes()
+ {
return m_list;
}

/**
- * Resolves the specified include and exclude directives from
- * the base directory anchor and produces an array of files
- * to include in the classpath.
- */
- public void resolveFileset() throws IOException, IllegalStateException {
+ * Resolves the specified include and exclude directives from the base
directory anchor and produces an array of
+ * files to include in the classpath.
+ */
+ public void resolveFileset()
+ throws IOException, IllegalStateException
+ {
// sanity check...
- if (m_anchor == null) {
- throw new IllegalStateException("No basedir set");
+ if( m_anchor == null )
+ {
+ String message = "No basedir set";
+ throw new IllegalStateException( message );
}
- if (!m_anchor.exists()) {
- throw new IllegalStateException("basedir " + m_anchor
- + " does not exist");
+ if( m_anchor.exists() == false )
+ {
+ String message = "basedir " + m_anchor + " does not exist";
+ throw new IllegalStateException( message );
}
-
- if (!m_anchor.isDirectory()) {
- throw new IllegalStateException("basedir " + m_anchor
- + " is not a directory");
+ if( m_anchor.isDirectory() == false )
+ {
+ String message = "basedir " + m_anchor + " is not a directory";
+ throw new IllegalStateException( message );
}

// Return the directory attribute as a classpath if there are no
// includes
- if ( m_includes.length == 0 && m_defaultIncludes.length == 0 ) {
+ if( m_includes.length == 0 && m_defaultIncludes.length == 0 )
+ {
m_list.add( m_anchor );
- m_logger.debug("candidates=[" + m_anchor + "]");
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = "candidates=[" + m_anchor + "]";
+ m_logger.debug( message );
+ }
return;
}

// create a directory scanner
DirectoryScanner ds = new DirectoryScanner();
- ds.setLogger(m_logger);
+ ds.setLogger( m_logger );

// Supply the directory scanner with our base directory anchor
ds.setBasedir( m_anchor );
- m_logger.debug( "ds.basedir=[" + ds.getBasedir() + "]" );
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = "ds.basedir=[" + ds.getBasedir() + "]";
+ m_logger.debug( message );
+ }

// Any default excludes to add?
- for (int i = 0; i < m_defaultExcludes.length; i++ )
+ for( int i = 0; i < m_defaultExcludes.length; i++ )
{
- m_logger.debug("m_defaultExcludes[" + i + "]=[" +
m_defaultExcludes[i] + "]");
- ds.addDefaultExclude( m_defaultExcludes[i] );
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = "m_defaultExcludes[" + i + "]=[" +
m_defaultExcludes[ i ] + "]";
+ m_logger.debug( message );
+ }
+ ds.addDefaultExclude( m_defaultExcludes[ i ] );
}

// Supply the directory scanner with our set of includes.
@@ -231,30 +231,41 @@
// but we have them in the form of IncludeDirective[].
// So.. we need to first convert...
String[] includes = new String[ m_includes.length ];
- if (m_includes.length == 0)
+ if( m_includes.length == 0 )
{
- for (int i = 0; i < m_defaultIncludes.length; i++)
+ for( int i = 0; i < m_defaultIncludes.length; i++ )
{
- includes[i] = m_defaultIncludes[i];
- m_logger.debug("includes[" + i + "]=[" + includes[i] + "]");
+ includes[ i ] = m_defaultIncludes[ i ];
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = "includes[" + i + "]=[" + includes[ i ]
+ "]";
+ m_logger.debug( message );
+ }
}
- }
- else
+ } else
{
- for (int i = 0; i < m_includes.length; i++ )
+ for( int i = 0; i < m_includes.length; i++ )
{
- includes[i] = m_includes[i].getPath();
- m_logger.debug("includes[" + i + "]=[" + includes[i] + "]");
+ includes[ i ] = m_includes[ i ].getPath();
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = "includes[" + i + "]=[" + includes[ i ]
+ "]";
+ m_logger.debug( message );
+ }
}
}
ds.setIncludes( includes );

// Same thing for the set of excludes...
String[] excludes = new String[ m_excludes.length ];
- for (int i = 0; i < m_excludes.length; i++ )
+ for( int i = 0; i < m_excludes.length; i++ )
{
- excludes[i] = m_excludes[i].getPath();
- m_logger.debug("excludes[" + i + "]=[" + excludes[i] + "]");
+ excludes[ i ] = m_excludes[ i ].getPath();
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = "excludes[" + i + "]=[" + excludes[ i ] +
"]";
+ m_logger.debug( message );
+ }
}
ds.setExcludes( excludes );

@@ -265,17 +276,33 @@
// Scan the directory (which doesn't do much right now) and output
// some stuff to debug
ds.scan();
- m_logger.debug( ds.toString() );
+
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = ds.toString();
+ m_logger.debug( message );
+ }
String[] candidates = ds.getIncludedFiles();
- if ( candidates.length > 0 ) {
- for (int i = 0; i < candidates.length; i++) {
- File file = new File( m_anchor, candidates[i] );
- m_logger.debug("candidates[" + i + "]=[" +
file.getAbsolutePath() + "]");
+ if( candidates.length > 0 )
+ {
+ for( int i = 0; i < candidates.length; i++ )
+ {
+ File file = new File( m_anchor, candidates[ i ] );
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = "candidates[" + i + "]=[" +
file.getAbsolutePath() + "]";
+ m_logger.debug( message );
+ }
m_list.add( file );
}
- } else {
+ } else
+ {
m_list.add( m_anchor );
- m_logger.debug("candidates=[" + m_anchor + "]");
+ if( m_logger.isDebugEnabled() )
+ {
+ String message = "candidates=[" + m_anchor + "]";
+ m_logger.debug( message );
+ }
}
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultImportModel.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultImportModel.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultImportModel.java
Tue Jun 28 08:36:24 2005
@@ -15,64 +15,41 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.model.impl;

-import net.dpml.composition.model.ModelException;
import net.dpml.composition.model.ContainmentModel;
+import net.dpml.composition.model.ModelException;
import net.dpml.composition.provider.ComponentContext;
-
import net.dpml.context.ContextException;
-
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;
-
import net.dpml.lang.NullArgumentException;
-
import net.dpml.meta.info.EntryDescriptor;

-
-
/**
* Default implementation of a the context entry import model.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public class DefaultImportModel extends DefaultEntryModel
+public class DefaultImportModel
+ extends DefaultEntryModel
{
- //==============================================================
- // static
- //==============================================================

private static final Resources REZ =
ResourceManager.getPackageResources( DefaultImportModel.class );
-
- //==============================================================
- // immutable state
- //==============================================================
-
private final String m_key;
-
private final ComponentContext m_context;
+ private final Object m_value;

- //==============================================================
- // mutable state
- //==============================================================
-
- private Object m_value;
-
- //==============================================================
- // constructor
- //==============================================================
-
- /**
- * Creation of a new context entry import model.
- *
- * @param descriptor the context entry descriptor
- * @param key the container scoped key
- * @param context the containment context
- * @exception NullArgumentException is any one of the arguments is null.
- */
+ /**
+ * Creation of a new context entry import model.
+ *
+ * @param descriptor the context entry descriptor
+ * @param key the container scoped key
+ * @param context the containment context
+ *
+ * @throws NullArgumentException is any one of the arguments is null.
+ */
public DefaultImportModel( EntryDescriptor descriptor, String key,
ComponentContext context )
throws ModelException, NullArgumentException
{
@@ -85,19 +62,19 @@
{
throw new NullArgumentException( "context" );
}
-
m_key = key;
m_context = context;
-
if( DefaultContextModel.isaStandardKey( key ) == false )
{
final String error = REZ.getString(
"context.non-standard-key.error", key );
throw new ModelException( error );
}
-
- if( !descriptor.isVolatile() )
+ if( descriptor.isVolatile() == false )
{
m_value = getValue();
+ } else
+ {
+ m_value = null;
}
}

@@ -105,32 +82,33 @@
// EntryModel
//--------------------------------------------------------------

- /**
- * Return the context entry value.
- *
- * @return the context entry value
- */
- public Object getValue() throws ModelException
+ /**
+ * Return the context entry value.
+ *
+ * @return the context entry value
+ */
+ public Object getValue()
+ throws ModelException
{
- if( m_value != null ) return m_value;
+ if( m_value != null )
+ {
+ return m_value;
+ }
return getStandardEntry( m_key );
}

-
private Object getStandardEntry( String key )
{
if( key.startsWith( "urn:metro:" ) )
{
return getStandardMetroEntry( key );
- }
- else if( key.startsWith( "urn:composition:" ) )
+ } else if( key.startsWith( "urn:composition:" ) )
{
return getStandardCompositionEntry( key );
- }
- else
+ } else
{
final String error =
- "Unknown key [" + key + "]";
+ "Unknown key [" + key + "]";
throw new IllegalArgumentException( error );
}
}
@@ -140,20 +118,16 @@
if( key.equals( ComponentContext.NAME_KEY ) )
{
return m_context.getName();
- }
- else if( key.equals( ComponentContext.PARTITION_KEY ) )
+ } else if( key.equals( ComponentContext.PARTITION_KEY ) )
{
return m_context.getPartitionName();
- }
- else if( key.equals( ComponentContext.CLASSLOADER_KEY ) )
+ } else if( key.equals( ComponentContext.CLASSLOADER_KEY ) )
{
return m_context.getClassLoader();
- }
- else if( key.equals( ComponentContext.DIR_KEY ) )
+ } else if( key.equals( ComponentContext.DIR_KEY ) )
{
return m_context.getWorkingDirectory();
- }
- else if( key.equals( ComponentContext.TEMP_KEY ) )
+ } else if( key.equals( ComponentContext.TEMP_KEY ) )
{
return m_context.getTempDirectory();
}
@@ -165,14 +139,12 @@
if( key.equals( ContainmentModel.KEY ) )
{
return m_context.getContainmentModel();
- }
- else
+ } else
{
try
{
return m_context.get( key );
- }
- catch( ContextException e )
+ } catch( ContextException e )
{
return null;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
Tue Jun 28 08:36:24 2005
@@ -42,8 +42,10 @@
import net.dpml.logging.ConsoleLogger;
import net.dpml.logging.Logger;
import net.dpml.system.Factory;
+import net.dpml.transit.TransitException;
import net.dpml.transit.repository.Repository;
import net.dpml.transit.repository.StandardLoader;
+import org.osgi.framework.BundleContext;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

@@ -61,34 +63,24 @@
public class DefaultModelFactory
implements ModelFactory
{
-
- //-------------------------------------------------------------------
- // static
- //-------------------------------------------------------------------
-
private static final XMLContainmentProfileCreator CREATOR = new
XMLContainmentProfileCreator();
private static final Resources REZ =
ResourceManager.getPackageResources( DefaultModelFactory.class );

- //-------------------------------------------------------------------
- // immutable state
- //-------------------------------------------------------------------
-
private final CompositionContext m_context;
private final Logger m_logger;
+
/**
* The runtime system used by this model factory.
*/
private final Runtime m_runtime;

- //-------------------------------------------------------------------
- // mutable state
- //-------------------------------------------------------------------
-
/**
* The root containment model against which refresh actions are resolved.
*/
private final ContainmentModel m_root;

+ private final BundleContext m_OsgiContext;
+
//-------------------------------------------------------------------
// constructor
//-------------------------------------------------------------------
@@ -99,7 +91,8 @@
* @param context the composition context
* @param uri the URI to the runtime artifact
*/
- DefaultModelFactory( CompositionContext context, URI uri, URL kernel,
URL[] deployment, URL overrides )
+ DefaultModelFactory( CompositionContext context, URI uri, URL kernel,
URL[] deployment,
+ URL overrides, BundleContext osgi )
throws ModelException, NullArgumentException
{
if( context == null )
@@ -110,6 +103,11 @@
{
throw new NullArgumentException( "deployment" );
}
+ if( osgi == null )
+ {
+ throw new NullArgumentException( "osgi" );
+ }
+ m_OsgiContext = osgi;
m_context = context;
m_logger = new ConsoleLogger();
Configuration config = getKernelConfiguration( kernel );
@@ -134,12 +132,11 @@
URL url = deployment[ i ];
if( getLogger().isInfoEnabled() )
{
- getLogger().debug( "installing: "+ url );
+ getLogger().debug( "installing: " + url );
}
try
{
m_root.addContainmentModel( url );
-
} catch( ModelException e )
{
final String error = "Install failure: " + url;
@@ -272,13 +269,14 @@
* constructing model instances.
*
* @param context a potentially foreign containment context
+ * @param isRootModel true if the containment model to be created is the
root container.
*
* @return the containment model
*/
- private ContainmentModel createContainmentModel( ContainmentContext
context, boolean root )
+ private ContainmentModel createContainmentModel( ContainmentContext
context, boolean isRootModel )
throws ModelException
{
- if( root )
+ if( isRootModel )
{
return new DefaultCompositionController( m_context, context );
} else
@@ -303,16 +301,14 @@
}
// TODO: Exchange for a OSGi LogService facade.
final Logger logger = new ConsoleLogger();
-
ClassLoader root = m_context.getAPIClassLoader();
try
{
ClassLoaderDirective classLoaderDirective =
profile.getClassLoaderDirective();
ClassLoaderContext classLoaderContext = new
DefaultClassLoaderContext( logger, root, classLoaderDirective );
ClassLoaderModel classLoaderModel = new DefaultClassLoaderModel(
classLoaderContext );
- return new DefaultContainmentContext( logger, classLoaderModel,
null, null, profile, this,
- m_runtime,
m_context.getDefaultDeploymentTimeout()
- );
+ long defaultDeploymentTimeout =
m_context.getDefaultDeploymentTimeout();
+ return new DefaultContainmentContext( logger, classLoaderModel,
null, null, profile, this, m_runtime, defaultDeploymentTimeout );
} catch( NullArgumentException e )
{
String error = REZ.getString(
"factory.containment.create.error", profile.getName() );
@@ -350,8 +346,7 @@
{
try
{
- DefaultConfigurationBuilder builder =
- new DefaultConfigurationBuilder();
+ DefaultConfigurationBuilder builder = new
DefaultConfigurationBuilder();
return builder.build( url.toString() );
} catch( SAXException e )
{
@@ -400,7 +395,7 @@
}

/**
- * Create a runtime using the supplied artifact. The implementation
+ * Create a runtime using the supplied artifact.
*/
private Runtime createRuntime( URI uri )
throws CompositionException
@@ -415,7 +410,7 @@
{
Repository repository = new StandardLoader();
ClassLoader classloader =
CompositionContext.class.getClassLoader();
- Object plugin = repository.getPlugin( classloader, uri, new
Object[]{ } );
+ Object plugin = repository.getPlugin( classloader, uri, new
Object[]{m_OsgiContext} );
if( plugin instanceof Factory )
{
object = ( (Factory) plugin ).create();
@@ -423,6 +418,10 @@
{
object = plugin;
}
+ } catch( TransitException e )
+ {
+ String error = "Unexpected error while attempting to
construct runtime plugin from [" + uri + "].";
+ throw new CompositionException( error, e );
} catch( IOException e )
{
String error = "Unexpected error while attempting to
construct runtime plugin from [" + uri + "].";

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelRepository.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelRepository.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelRepository.java
Tue Jun 28 08:36:24 2005
@@ -29,6 +29,7 @@
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
+import java.util.Collection;


/**
@@ -42,10 +43,6 @@
public class DefaultModelRepository
implements ModelRepository
{
- //------------------------------------------------------------------
- // immutable state
- //------------------------------------------------------------------
-
/**
* The parent appliance repository.
*/
@@ -58,12 +55,7 @@
*/
private final Map m_models = new Hashtable();

- //------------------------------------------------------------------
- // constructor
- //------------------------------------------------------------------
-
- public DefaultModelRepository(
- ModelRepository parent, Logger logger )
+ public DefaultModelRepository( ModelRepository parent, Logger logger )
{
m_parent = parent;
m_logger = logger;
@@ -145,7 +137,9 @@
list.add( models[i] );
}
}
- return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
+ DeploymentModel[] result = new DeploymentModel[ list.size() ];
+ list.toArray( result );
+ return result;
}

/**
@@ -154,8 +148,7 @@
* @param reference a service reference
* @return the candidate models
*/
- public DeploymentModel[] getCandidateProviders(
- ReferenceDescriptor reference )
+ public DeploymentModel[] getCandidateProviders( ReferenceDescriptor
reference )
{
ArrayList list = new ArrayList();
Iterator iterator = m_models.values().iterator();
@@ -171,12 +164,14 @@
if( m_parent != null )
{
DeploymentModel[] models = m_parent.getCandidateProviders(
reference );
- for( int i=0; i<models.length; i++ )
+ for( int i = 0; i < models.length; i++ )
{
list.add( models[i] );
}
}
- return (DeploymentModel[]) list.toArray( new DeploymentModel[0] );
+ DeploymentModel[] result = new DeploymentModel[ list.size() ];
+ list.toArray( result );
+ return result;
}

//------------------------------------------------------------------
@@ -238,8 +233,10 @@
*/
public DeploymentModel[] getModels()
{
- return (DeploymentModel[]) m_models.values().toArray(
- new DeploymentModel[0] );
+ Collection collection = m_models.values();
+ DeploymentModel[] result = new DeploymentModel[ collection.size() ];
+ collection.toArray( result );
+ return result;
}

/**
@@ -253,11 +250,7 @@
DeploymentModel model = (DeploymentModel) m_models.get( name );
if( model == null && m_logger != null )
{
- m_logger.debug(
- "Can't find '"
- + name
- + "' in model repository: "
- + m_models );
+ m_logger.debug( "Can't find '" + name + "' in model repository:
" + m_models );
}
return model;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/impl/src/test/net/dpml/composition/model/impl/fileset/FilesetModelTestCase.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/impl/src/test/net/dpml/composition/model/impl/fileset/FilesetModelTestCase.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/impl/src/test/net/dpml/composition/model/impl/fileset/FilesetModelTestCase.java
Tue Jun 28 08:36:24 2005
@@ -17,20 +17,17 @@

package net.dpml.composition.model.impl.fileset;

-import java.util.ArrayList;
-import java.io.File;
-import java.io.IOException;
-
import junit.framework.TestCase;
-
+import net.dpml.composition.data.ExcludeDirective;
import net.dpml.composition.data.FilesetDirective;
import net.dpml.composition.data.IncludeDirective;
-import net.dpml.composition.data.ExcludeDirective;
import net.dpml.composition.model.impl.DefaultFilesetModel;
-
-import net.dpml.logging.ConsoleLogger;
import net.dpml.logging.ConsoleLogger;

+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
public class FilesetModelTestCase extends TestCase
{
private static File getWorkDir()

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/data/writer/ContainmentProfileWriter.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/data/writer/ContainmentProfileWriter.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/data/writer/ContainmentProfileWriter.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.data.writer;

import net.dpml.composition.data.ContainmentProfile;
@@ -23,21 +22,22 @@
import java.io.OutputStream;

/**
-* Interface implemented by objects supporting the writing
-* of a {@link ContainmentProfile} to an output stream.
-*
-* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
-* @version $Id$
-*/
+ * Interface implemented by objects supporting the writing of a {@link
ContainmentProfile} to an output stream.
+ *
+ * @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
+ * @version $Id$
+ */
public interface ContainmentProfileWriter
{
+
/**
- * Write a {@link ContainmentProfile} to a stream
- *
- * @param profile the profile instance
- * @param stream the destination stream
- * @throws Exception if an error occurs while writting to the stream
- */
+ * Write a {@link ContainmentProfile} to a stream
+ *
+ * @param profile the profile instance
+ * @param stream the destination stream
+ *
+ * @throws Exception if an error occurs while writting to the stream
+ */
void writeContainmentProfile( ContainmentProfile profile, OutputStream
stream )
throws Exception;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.data.ClassLoaderDirective;
@@ -35,56 +34,53 @@
*/
public interface ClassLoaderContext extends Context
{
- /**
- * Return the logging channel to be applied to the
- * classloader model.
- *
- * @return the system logging channel
- */
+
+ /**
+ * Return the logging channel to be applied to the classloader model.
+ *
+ * @return the system logging channel
+ */
Logger getLogger();

- /**
- * Return the base directory from which relative library directives
- * and fileset directory paths may be resolved.
- *
- * @return the base directory
- */
+ /**
+ * Return the base directory from which relative library directives and
fileset directory paths may be resolved.
+ *
+ * @return the base directory
+ */
File getBaseDirectory();

- /**
- * Return the classloader to be assigned as the parent classloader
- * of the classloader created by the model.
- *
- * @return the classloader
- */
+ /**
+ * Return the classloader to be assigned as the parent classloader of
the classloader created by the model.
+ *
+ * @return the classloader
+ */
ClassLoader getClassLoader();

- /**
- * Return the classloader directive to be applied to the
- * classloader model.
- *
- * @return the classloader directive
- */
+ /**
+ * Return the classloader directive to be applied to the classloader
model.
+ *
+ * @return the classloader directive
+ */
ClassLoaderDirective getClassLoaderDirective();

- /**
- * Return the type repository established by the parent classloader.
- *
- * @return the type repository
- */
+ /**
+ * Return the type repository established by the parent classloader.
+ *
+ * @return the type repository
+ */
TypeRepository getTypeRepository();

- /**
- * Return the service repository established by the parent classloader.
- *
- * @return the service repository
- */
+ /**
+ * Return the service repository established by the parent classloader.
+ *
+ * @return the service repository
+ */
ServiceRepository getServiceRepository();

- /**
- * Return any implied urls to include in the classloader.
- *
- * @return the implied urls
- */
+ /**
+ * Return any implied urls to include in the classloader.
+ *
+ * @return the implied urls
+ */
URL[] getImplicitURLs();
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ComponentContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ComponentContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ComponentContext.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.data.ComponentProfile;
@@ -33,77 +32,74 @@
*/
public interface ComponentContext extends DeploymentContext
{
+
/**
* The standard context entry key for the partition name.
*/
static final String PARTITION_KEY = ContextDescriptor.PARTITION_KEY;
-
/**
* The standard context entry key for the partition name.
*/
static final String NAME_KEY = ContextDescriptor.NAME_KEY;
-
/**
* The standard context entry key for the partition name.
*/
static final String CLASSLOADER_KEY = ContextDescriptor.CLASSLOADER_KEY;
-
/**
* The standard context entry key for the partition name.
*/
static final String DIR_KEY = ContextDescriptor.DIR_KEY;
-
/**
* The standard context entry key for the partition name.
*/
static final String TEMP_KEY = ContextDescriptor.TEMP_KEY;

- /**
- * Return the working directory for the component.
- *
- * @return the working directory
- */
+ /**
+ * Return the working directory for the component.
+ *
+ * @return the working directory
+ */
File getWorkingDirectory();

- /**
- * Return the temporary directory for the component.
- *
- * @return the temporary directory
- */
+ /**
+ * Return the temporary directory for the component.
+ *
+ * @return the temporary directory
+ */
File getTempDirectory();

- /**
- * Return the deployment profile.
- *
- * @return the profile
- */
+ /**
+ * Return the deployment profile.
+ *
+ * @return the profile
+ */
ComponentProfile getComponentProfile();

- /**
- * Return the component type.
- *
- * @return the type defintion
- */
+ /**
+ * Return the component type.
+ *
+ * @return the type defintion
+ */
Type getType();

- /**
- * Return the component class.
- *
- * @return the class
- */
+ /**
+ * Return the component class.
+ *
+ * @return the class
+ */
Class getDeploymentClass();

- /**
- * Return the classloader for the component.
- *
- * @return the classloader
- */
+ /**
+ * Return the classloader for the component.
+ *
+ * @return the classloader
+ */
ClassLoader getClassLoader();

- /**
- * Return the enclosing containment model.
- * @return the containment model that component is within
- */
+ /**
+ * Return the enclosing containment model.
+ *
+ * @return the containment model that component is within
+ */
ContainmentModel getContainmentModel();
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionContext.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.context.Context;
@@ -28,30 +27,32 @@
*/
public interface CompositionContext extends Context
{
- /**
- * Return the API classloader.
- *
- * @return the API classloader
- */
+
+ /**
+ * Return the API classloader.
+ *
+ * @return the API classloader
+ */
ClassLoader getAPIClassLoader();

- /**
- * Return the SPI classloader.
- *
- * @return the SPI classloader
- */
+ /**
+ * Return the SPI classloader.
+ *
+ * @return the SPI classloader
+ */
ClassLoader getSPIClassLoader();

- /**
- * Return the default deployment phase timeout value.
- * @return the timeout value
- */
+ /**
+ * Return the default deployment phase timeout value.
+ *
+ * @return the timeout value
+ */
long getDefaultDeploymentTimeout();

- /**
- * Return the enabled status of the audit policy.
- * @return TRUE if audit enabled
- */
+ /**
+ * Return the enabled status of the audit policy.
+ *
+ * @return TRUE if audit enabled
+ */
boolean isAuditEnabled();
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionCriteria.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionCriteria.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionCriteria.java
Tue Jun 28 08:36:24 2005
@@ -15,17 +15,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import java.io.File;
-import java.util.Map;
import java.net.URL;
+import java.util.Map;

/**
- * CompositionCriteria is convinience interface that extends Map with
- * a set of operations that enable easy manipulation of the composition
- * context parameters.
+ * CompositionCriteria is convinience interface that extends Map with a set
of operations that enable easy manipulation
+ * of the composition context parameters.
*
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
@@ -38,118 +36,127 @@
//--------------------------------------------------------------

String GROUP = "dpml.composition";
-
String AUDIT_ENABLED_KEY = GROUP + ".audit";
-
- /**
- * The activation runtime artifact key.
- */
+ /**
+ * The activation runtime artifact key.
+ */
String RUNTIME_ARTIFACT_KEY = GROUP + ".runtime";
-
- /**
- * The default deployment timeout key.
- */
+ /**
+ * The default deployment timeout key.
+ */
String DEPLOYMENT_TIMEOUT_KEY = GROUP + ".timeout";
-
- /**
- * The root container path key.
- */
+ /**
+ * The root container path key.
+ */
String KERNEL_KEY = GROUP + ".kernel";
-
- /**
- * The deployment blocks sequence.
- */
+ /**
+ * The deployment blocks sequence.
+ */
String DEPLOYMENT_KEY = GROUP + ".deployment";
-
- /**
- * The deployment blocks sequence.
- */
+ /**
+ * The deployment blocks sequence.
+ */
String OVERRIDE_KEY = GROUP + ".override";
-
- String[] KEYS =
- new String[]{
+ String[] KEYS = new String[]
+ {
AUDIT_ENABLED_KEY,
- RUNTIME_ARTIFACT_KEY, DEPLOYMENT_TIMEOUT_KEY, KERNEL_KEY,
- DEPLOYMENT_KEY, OVERRIDE_KEY };
+ RUNTIME_ARTIFACT_KEY,
+ DEPLOYMENT_TIMEOUT_KEY,
+ KERNEL_KEY,
+ DEPLOYMENT_KEY,
+ OVERRIDE_KEY
+ };


//--------------------------------------------------------------
// criteria setters
//--------------------------------------------------------------

- /**
- * Set the audit enabled policy
- * @param mode TRUE to enabled audit mode else FALSE
- */
+ /**
+ * Set the audit enabled policy
+ *
+ * @param mode TRUE to enabled audit mode else FALSE
+ */
void setAuditMode( boolean mode );

- /**
- * Set the runtime artifact specification.
- * @param spec and artifact uri referencing a plugin runtime factory
- */
+ /**
+ * Set the runtime artifact specification.
+ *
+ * @param spec and artifact uri referencing a plugin runtime factory
+ */
void setRuntimeSpecification( String spec );

- /**
- * Set the default deployment timeout value.
- * @param timeout and default deployment timeout
- */
+ /**
+ * Set the default deployment timeout value.
+ *
+ * @param timeout and default deployment timeout
+ */
void setDefaultDeploymentTimeout( long timeout );

- /**
- * Set the path to the kernel directive.
- * @param path the kernel path
- */
+ /**
+ * Set the path to the kernel directive.
+ *
+ * @param path the kernel path
+ */
void setKernelPath( String path );

- /**
- * Set the path to the deployment override configuration.
- * @param path the override path
- */
+ /**
+ * Set the path to the deployment override configuration.
+ *
+ * @param path the override path
+ */
void setOverridePath( String path );

- /**
- * Set the set of paths to the deployment targets.
- * @param values an array of paths referencing deployment targets
- */
+ /**
+ * Set the set of paths to the deployment targets.
+ *
+ * @param values an array of paths referencing deployment targets
+ */
void setDeploymentPath( String[] values );

//--------------------------------------------------------------
// criteria getters
//--------------------------------------------------------------

- /**
- * Get the audit enabled policy
- * @return TRUE if audit is enabled else FALSE
- */
+ /**
+ * Get the audit enabled policy
+ *
+ * @return TRUE if audit is enabled else FALSE
+ */
Boolean getAuditMode();

- /**
- * Get the runtime artifact.
- * @return the artifact referencing a runtime factory plugin
- */
+ /**
+ * Get the runtime artifact.
+ *
+ * @return the artifact referencing a runtime factory plugin
+ */
String getRuntimeSpecification();

- /**
- * Get the default deployment timeout value.
- * @return the default deployment timeout
- */
+ /**
+ * Get the default deployment timeout value.
+ *
+ * @return the default deployment timeout
+ */
Long getDefaultDeploymentTimeout();

- /**
- * Get the kernel directive path
- * @return the url to the kernel directive
- */
+ /**
+ * Get the kernel directive path
+ *
+ * @return the url to the kernel directive
+ */
String getKernelPath();

- /**
- * Get the deployment override path
- * @return the path to the override configuration
- */
+ /**
+ * Get the deployment override path
+ *
+ * @return the path to the override configuration
+ */
String getOverridePath();

- /**
- * Return the sequence of deployment urls
- * @return the block urls
- */
+ /**
+ * Return the sequence of deployment urls
+ *
+ * @return the block urls
+ */
URL[] getDeploymentURLs( File base );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.model.ModelException;
@@ -27,23 +26,24 @@
*/
public class CompositionException extends ModelException
{
+
/**
* Construct a new <code>CompositionException</code> instance.
*
* @param message The detail message for this exception.
*/
- public CompositionException( final String message )
+ public CompositionException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>SystemException</code> instance.
*
* @param message The detail message for this exception.
- * @param cause the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public CompositionException( final String message, final Throwable cause
)
+ public CompositionException( String message, Throwable cause )
{
super( message, cause );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionFactory.java
Tue Jun 28 08:36:24 2005
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.model.ContainmentModel;
@@ -29,24 +28,29 @@
*/
public interface CompositionFactory
{
- /**
- * Return the default criteria map.
- *
- * @return a new instance of the default factory criteria
- */
- CompositionCriteria createCompositionCriteria();

- /**
- * Creation of a new root containment model.
- * @return the root container
- */
- ContainmentModel createContainmentModel() throws CompositionException;
-
- /**
- * Creation of a new root containment model.
- * @param map the composition criteria
- * @return the root container
- */
- ContainmentModel createContainmentModel( Map map ) throws
CompositionException;
+ /**
+ * Return the default criteria map.
+ *
+ * @return a new instance of the default factory criteria
+ */
+ CompositionCriteria createCompositionCriteria();

+ /**
+ * Creation of a new root containment model.
+ *
+ * @return the root container
+ */
+ ContainmentModel createContainmentModel()
+ throws CompositionException;
+
+ /**
+ * Creation of a new root containment model.
+ *
+ * @param map the composition criteria
+ *
+ * @return the root container
+ */
+ ContainmentModel createContainmentModel( Map map )
+ throws CompositionException;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionHelper.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionHelper.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionHelper.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.model.ComponentModel;
@@ -33,6 +32,7 @@
*/
public class CompositionHelper
{
+
private static final String LINE =
"-----------------------------------------\n";

private CompositionHelper()
@@ -64,83 +64,104 @@
}
}

- private static void printContainmentModel(
- StringBuffer buffer, String lead, ContainmentModel model )
+ private static void printContainmentModel( StringBuffer buffer, String
lead, ContainmentModel model )
{
- buffer.append(
- "\n" + lead
- + "container:"
- + model
- + ")" );
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( "container:" );
+ buffer.append( model );
+ buffer.append( ")" );
printClassloader( buffer, lead, model );
printDeploymentModel( buffer, lead, model );
DeploymentModel[] models = model.getModels();
if( models.length > 0 )
{
- buffer.append( "\n" + lead + " children:" );
- for( int i=0; i<models.length; i++ )
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( " children:" );
+ for( int i = 0; i < models.length; i++ )
{
- DeploymentModel m = models[i];
+ DeploymentModel m = models[ i ];
printModel( buffer, " " + lead, m );
}
}
models = model.getStartupGraph();
if( models.length > 0 )
{
- buffer.append( "\n" + lead + " startup:" );
- for( int i=0; i<models.length; i++ )
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( " startup:" );
+ for( int i = 0; i < models.length; i++ )
{
- DeploymentModel m = models[i];
- buffer.append( "\n" + " " + lead + (i+1) + ": " + m );
+ DeploymentModel m = models[ i ];
+ buffer.append( "\n " );
+ buffer.append( lead );
+ buffer.append( i + 1 );
+ buffer.append( ": " );
+ buffer.append( m );
}
}
- models = ((ContainmentModel)model).getShutdownGraph();
+ models = ( (ContainmentModel) model ).getShutdownGraph();
if( models.length > 0 )
{
- buffer.append( "\n" + lead + " shutdown:" );
- for( int i=0; i<models.length; i++ )
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( " shutdown:" );
+ for( int i = 0; i < models.length; i++ )
{
- DeploymentModel m = models[i];
- buffer.append( "\n" + " " + lead + (i+1) + ": " + m );
+ DeploymentModel m = models[ i ];
+ buffer.append( "\n " );
+ buffer.append( lead );
+ buffer.append( i + 1 );
+ buffer.append( ": " );
+ buffer.append( m );
}
}
}

- private static void printComponentModel(
- StringBuffer buffer, String lead, ComponentModel model )
+ private static void printComponentModel( StringBuffer buffer, String
lead, ComponentModel model )
{
- buffer.append(
- "\n" + lead
- + "component:"
- + model + "("
- + model.getDeploymentTimeout()
- + ")" );
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( "component:" );
+ buffer.append( model );
+ buffer.append( "(" );
+ buffer.append( model.getDeploymentTimeout() );
+ buffer.append( ")" );
printDeploymentModel( buffer, lead, model );
}

- private static void printDeploymentModel(
- StringBuffer buffer, String lead, DeploymentModel model )
+ private static void printDeploymentModel( StringBuffer buffer, String
lead, DeploymentModel model )
{
DeploymentModel[] providers = model.getProviders();
DeploymentModel[] consumers = model.getConsumerGraph();
-
- if(( providers.length == 0 ) && ( consumers.length == 0 ))
+ if( ( providers.length == 0 ) && ( consumers.length == 0 ) )
{
return;
}
-
- if( providers.length > 0 ) for( int i=0; i<providers.length; i++ )
+ if( providers.length > 0 )
{
- DeploymentModel m = providers[i];
- buffer.append( "\n" + lead + " <-- consumes: " + m );
+ for( int i = 0; i < providers.length; i++ )
+ {
+ DeploymentModel m = providers[ i ];
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( " <-- consumes: " );
+ buffer.append( m );
+ }
}
-
- if( consumers.length > 0 ) for( int i=0; i<consumers.length; i++ )
+ if( consumers.length > 0 )
{
- DeploymentModel m = consumers[i];
- if( isDirectProvider( m, model ) )
+ for( int i = 0; i < consumers.length; i++ )
{
- buffer.append( "\n" + lead + " --> supplies: " + m );
+ DeploymentModel m = consumers[ i ];
+ if( isDirectProvider( m, model ) )
+ {
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( " --> supplies: " );
+ buffer.append( m );
+ }
}
}
}
@@ -149,10 +170,13 @@
{
String name = model.getQualifiedName();
DeploymentModel[] providers = consumer.getProviders();
- for( int i=0; i<providers.length; i++ )
+ for( int i = 0; i < providers.length; i++ )
{
- DeploymentModel m = providers[i];
- if( m.getQualifiedName().equals( name ) ) return true;
+ DeploymentModel m = providers[ i ];
+ if( m.getQualifiedName().equals( name ) )
+ {
+ return true;
+ }
}
return false;
}
@@ -160,14 +184,20 @@
private static void printClassloader( StringBuffer buffer, String lead,
ContainmentModel model )
{
ClassLoader cl = model.getClassLoaderModel().getClassLoader();
- buffer.append( "\n" + lead + " classloader: " + cl );
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( " classloader: " );
+ buffer.append( cl );
if( cl instanceof URLClassLoader )
{
URLClassLoader ucl = (URLClassLoader) cl;
URL[] urls = ucl.getURLs();
- for( int i = 0 ; i < urls.length ; i++ )
+ for( int i = 0; i < urls.length; i++ )
{
- buffer.append( "\n" + lead + " " + urls[i] );
+ buffer.append( "\n" );
+ buffer.append( lead );
+ buffer.append( " " );
+ buffer.append( urls[ i ] );
}
}
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionRuntimeException.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionRuntimeException.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/CompositionRuntimeException.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.model.ModelRuntimeException;
@@ -27,26 +26,26 @@
*/
public class CompositionRuntimeException extends ModelRuntimeException
{
+
/**
* Construct a new <code>CompositionRuntimeException</code> instance.
*
* @param message The detail message for this exception.
*/
- public CompositionRuntimeException( final String message )
+ public CompositionRuntimeException( String message )
{
- this( message, null );
+ super( message );
}

/**
* Construct a new <code>CompositionRuntimeException</code> instance.
*
* @param message The detail message for this exception.
- * @param cause the root cause of the exception
+ * @param cause the root cause of the exception
*/
- public CompositionRuntimeException( final String message, final
Throwable cause )
+ public CompositionRuntimeException( String message, Throwable cause )
{
super( message, cause );
}
-
}


Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ContainmentContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ContainmentContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ContainmentContext.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.data.ContainmentProfile;
@@ -34,61 +33,60 @@
public interface ContainmentContext extends DeploymentContext
{

- /**
- * Return the model factory.
- *
- * @return the model factory.
- */
+ /**
+ * Return the model factory.
+ *
+ * @return the model factory.
+ */
ModelFactory getModelFactory();

- /**
- * Return the classloader model.
- *
- * @return the type manager assigned to the containment model.
- */
+ /**
+ * Return the classloader model.
+ *
+ * @return the type manager assigned to the containment model.
+ */
ClassLoaderModel getClassLoaderModel();

- /**
- * Return the working directory for a container.
- *
- * @return the working directory
- */
+ /**
+ * Return the working directory for a container.
+ *
+ * @return the working directory
+ */
File getWorkingDirectory();

- /**
- * Return the temporary directory for a container.
- *
- * @return the temporary directory
- */
+ /**
+ * Return the temporary directory for a container.
+ *
+ * @return the temporary directory
+ */
File getTempDirectory();

- /**
- * Return the containment profile.
- *
- * @return the containment profile
- */
+ /**
+ * Return the containment profile.
+ *
+ * @return the containment profile
+ */
ContainmentProfile getContainmentProfile();

- /**
- * Return the containment classloader.
- *
- * @return the classloader model
- */
+ /**
+ * Return the containment classloader.
+ *
+ * @return the classloader model
+ */
ClassLoader getClassLoader();

- /**
- * Return the model repository.
- *
- * @return the model repository
- */
+ /**
+ * Return the model repository.
+ *
+ * @return the model repository
+ */
ModelRepository getModelRepository();

- /**
- * Return the parent container model. If the container is a root
- * container, the operation shall return a null value.
- *
- * @return the parent containment model
- */
+ /**
+ * Return the parent container model. If the container is a root
container, the operation shall return a null
+ * value.
+ *
+ * @return the parent containment model
+ */
ContainmentModel getParentContainmentModel();
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/DeploymentContext.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/DeploymentContext.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/DeploymentContext.java
Tue Jun 28 08:36:24 2005
@@ -15,14 +15,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

+import net.dpml.composition.data.DeploymentProfile;
+import net.dpml.composition.data.Mode;
import net.dpml.composition.model.DependencyGraph;
import net.dpml.context.Context;
import net.dpml.logging.Logger;
-import net.dpml.composition.data.Mode;
-import net.dpml.composition.data.DeploymentProfile;

/**
* Deployment context that is supplied to a deployment model.
@@ -30,66 +29,71 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public interface DeploymentContext extends Context
+public interface DeploymentContext extends Context
{
+
final String SEPARATOR = "/";

- /**
- * Return the deployment target name.
- * @return the name
- */
+ /**
+ * Return the deployment target name.
+ *
+ * @return the name
+ */
String getName();

- /**
- * Return the deployment poartition.
- * @return the partition
- */
+ /**
+ * Return the deployment poartition.
+ *
+ * @return the partition
+ */
String getPartitionName();

- /**
- * Return the model fully qualified name.
- * @return the fully qualified name
- */
+ /**
+ * Return the model fully qualified name.
+ *
+ * @return the fully qualified name
+ */
String getQualifiedName();

- /**
- * Return the mode of establishment.
- * @return the mode
- */
+ /**
+ * Return the mode of establishment.
+ *
+ * @return the mode
+ */
Mode getMode();

- /**
- * Return the assigned logger.
- * @return the logging channel
- */
+ /**
+ * Return the assigned logger.
+ *
+ * @return the logging channel
+ */
Logger getLogger();

- /**
- * Return the runtime.
- *
- * @return the runtime
- */
+ /**
+ * Return the runtime.
+ *
+ * @return the runtime
+ */
Runtime getRuntime();

- /**
- * Return the dependency graph used to construct
- * deployment and decommissioning sequences.
- *
- * @return the dependency graph
- */
+ /**
+ * Return the dependency graph used to construct deployment and
decommissioning sequences.
+ *
+ * @return the dependency graph
+ */
DependencyGraph getDependencyGraph();

- /**
- * Return the deployment profile.
- *
- * @return the profile
- */
+ /**
+ * Return the deployment profile.
+ *
+ * @return the profile
+ */
DeploymentProfile getProfile();

- /**
- * Return the default deployment timeout.
- *
- * @return the profile
- */
+ /**
+ * Return the default deployment timeout.
+ *
+ * @return the profile
+ */
long getDefaultDeploymentTimeout();
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/LifestyleFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/LifestyleFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/LifestyleFactory.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.model.ComponentModel;
@@ -28,10 +27,12 @@
*/
public interface LifestyleFactory
{
- /**
- * Create a new lifestyle manager.
- * @param model the component model
- * @return the runtime appliance
- */
+ /**
+ * Create a new lifestyle manager.
+ *
+ * @param model the component model
+ *
+ * @return the runtime appliance
+ */
LifestyleManager createLifestyleManager( ComponentModel model );
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/LifestyleManager.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/LifestyleManager.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/LifestyleManager.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.model.Commissionable;
@@ -29,11 +28,11 @@
*/
public interface LifestyleManager extends Commissionable, Resolver
{
+
/**
* Release and finalize the supplied object.
*
* @param instance the object to be released
*/
void finalize( Object instance );
-
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ModelFactory.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ModelFactory.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/ModelFactory.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.model.ComponentModel;
@@ -28,63 +27,63 @@
* @author <a href="http://www.dpml.net";>The Digital Product Meta Library</a>
* @version $Id$
*/
-public interface ModelFactory
+public interface ModelFactory
{
- /**
- * Creation of a new root containment model.
- *
- * @param url a url of a containment profile
- * @return the containment model
- * @exception ModelException if an error occurs during model establishment
- */
+
+ /**
+ * Creation of a new root containment model.
+ *
+ * @param url a url of a containment profile
+ * @return the containment model
+ * @exception ModelException if an error occurs during model
establishment
+ */
//ContainmentModel createRootContainmentModel( URL url )
// throws ModelException;

- /**
- * Creation of a new root containment model.
- *
- * @param profile a containment profile
- * @return the containment model
- * @exception ModelException if an error occurs during model establishment
- */
+ /**
+ * Creation of a new root containment model.
+ *
+ * @param profile a containment profile
+ * @return the containment model
+ * @exception ModelException if an error occurs during model
establishment
+ */
//ContainmentModel createRootContainmentModel( ContainmentProfile
profile )
// throws ModelException;

- /**
- * Creation of a new root containment model.
- *
- * @param configuration the root container configuration
- * @return the containment model
- * @exception ModelException if an error occurs during model establishment
- */
+ /**
+ * Creation of a new root containment model.
+ *
+ * @param configuration the root container configuration
+ * @return the containment model
+ * @exception ModelException if an error occurs during model
establishment
+ */
//ContainmentModel createRootContainmentModel( Configuration config )
// throws ModelException;

- /**
- * Return the root containment model.
- *
- * @return the root containment model
- */
+ /**
+ * Return the root containment model.
+ *
+ * @return the root containment model
+ */
ContainmentModel getRootModel();

- /**
- * Creation of a new nested component model using a supplied component
- * context.
- *
- * @param context a potentially foreign component context
- * @return the compoent model
- */
+ /**
+ * Creation of a new nested component model using a supplied component
context.
+ *
+ * @param context a potentially foreign component context
+ *
+ * @return the compoent model
+ */
ComponentModel createComponentModel( ComponentContext context )
- throws ModelException;
-
+ throws ModelException;

- /**
- * Creation of a new nested containment model using a supplied
- * containment context.
- *
- * @param context a potentially foreign containment context
- * @return the containment model
- */
+ /**
+ * Creation of a new nested containment model using a supplied
containment context.
+ *
+ * @param context a potentially foreign containment context
+ *
+ * @return the containment model
+ */
ContainmentModel createContainmentModel( ContainmentContext context )
- throws ModelException;
+ throws ModelException;
}

Modified:
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/Runtime.java
==============================================================================
---
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/Runtime.java
(original)
+++
development/laboratory/users/niclas/osgi/metro/composition/spi/src/main/net/dpml/composition/provider/Runtime.java
Tue Jun 28 08:36:24 2005
@@ -15,7 +15,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package net.dpml.composition.provider;

import net.dpml.composition.model.DeploymentModel;
@@ -28,45 +27,50 @@
*/
public interface Runtime
{
- //------------------------------------------------------------------
- // runtime operations
- //------------------------------------------------------------------
-
- /**
- * Request the commissioning of a runtime for a supplied deployment
- * model.
- * @param model the deployment model
- * @exception Exception of a commissioning error occurs
- */
- void commission( DeploymentModel model ) throws Exception;
-
- /**
- * Request the decommissioning of a runtime for a supplied deployment
- * model.
- * @param model the deployment model
- */
+ /**
+ * Request the commissioning of a runtime for a supplied deployment
model.
+ *
+ * @param model the deployment model
+ *
+ * @throws Exception of a commissioning error occurs
+ */
+ void commission( DeploymentModel model )
+ throws Exception;
+
+ /**
+ * Request the decommissioning of a runtime for a supplied deployment
model.
+ *
+ * @param model the deployment model
+ */
void decommission( DeploymentModel model );

- /**
- * Request resolution of an object from the runtime.
- * @param model the deployment model
- * @exception Exception if a deployment error occurs
- */
- Object resolve( DeploymentModel model ) throws Exception;
-
- /**
- * Request resolution of an object from the runtime.
- * @param model the deployment model
- * @param proxy if TRUE the return value will be proxied if the
- * underlying component typoe suppports proxy representation
- * @exception Exception if a deployment error occurs
- */
- Object resolve( DeploymentModel model, boolean proxy ) throws Exception;
-
- /**
- * Request the release of an object from the runtime.
- * @param model the deployment model
- * @param instance the object to release
- */
+ /**
+ * Request resolution of an object from the runtime.
+ *
+ * @param model the deployment model
+ *
+ * @throws Exception if a deployment error occurs
+ */
+ Object resolve( DeploymentModel model )
+ throws Exception;
+
+ /**
+ * Request resolution of an object from the runtime.
+ *
+ * @param model the deployment model
+ * @param proxy if TRUE the return value will be proxied if the
underlying component typoe suppports proxy
+ * representation
+ *
+ * @throws Exception if a deployment error occurs
+ */
+ Object resolve( DeploymentModel model, boolean proxy )
+ throws Exception;
+
+ /**
+ * Request the release of an object from the runtime.
+ *
+ * @param model the deployment model
+ * @param instance the object to release
+ */
void release( DeploymentModel model, Object instance );
}

Modified: development/laboratory/users/niclas/osgi/metro/index.xml
==============================================================================
--- development/laboratory/users/niclas/osgi/metro/index.xml (original)
+++ development/laboratory/users/niclas/osgi/metro/index.xml Tue Jun 28
08:36:24 2005
@@ -4,7 +4,7 @@
<import uri="artifact:module:dpml/transit/dpml-transit#2912"/>

<!-- Metro Modules -->
-
+<!-- Something awkwadr with building the Module, so we figure that out later.
<project file="module.xml">
<info>
<group>dpml/metro</group>
@@ -12,11 +12,11 @@
<type>module</type>
</info>
<dependencies>
- <include key="dpml-transit"/>
- <include key="dpml-util"/>
+ <include key="dpml-transit"/>
+ <include key="dpml-util"/>
</dependencies>
</project>
-
+-->
<!-- FROM PUBLIC INDEX -->

<!-- Activity -->
@@ -207,10 +207,7 @@
<info>
<group>dpml/metro/tools</group>
<name>dpml-metro-main</name>
- <types>
- <type>jar</type>
- <type>plugin</type>
- </types>
+ <type>jar</type>
</info>
<dependencies>
<include key="dpml-composition-api"/>

Modified: development/laboratory/users/niclas/osgi/metro/main/build.xml
==============================================================================
--- development/laboratory/users/niclas/osgi/metro/main/build.xml
(original)
+++ development/laboratory/users/niclas/osgi/metro/main/build.xml Tue
Jun 28 08:36:24 2005
@@ -58,6 +58,7 @@
</target>

<target name="package" depends="standard.package">
+ <x:export class="net.dpml.metro.Metro"/>
<x:replicate todir="target/bundle-content/" flatten="true"/>
<x:property name="jarfilename" feature="filename" />
<x:property name="transitdir" feature="spec" key="dpml-transit-main" />



  • svn commit: r2931 - in development/laboratory/users/niclas/osgi/metro: . activation/api/src/main/net/dpml/activation activation/impl activation/impl/src/main/net/dpml/activation/impl composition/api/src/main/net/dpml/composition/data composition/api/src/main/net/dpml/composition/event composition/api/src/main/net/dpml/composition/model composition/impl/src/main/net/dpml/composition/data/writer composition/impl/src/main/net/dpml/composition/model/impl composition/impl/src/test/net/dpml/composition/model/impl/fileset composition/spi/src/main/net/dpml/composition/data/writer composition/spi/src/main/net/dpml/composition/provider main osgi, niclas, 06/28/2005

Archive powered by MHonArc 2.6.24.

Top of Page