Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2088 - in development/main/metro: composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl system system/impl/src/main/net/dpml/system/impl system/spi/src/main/net/dpml/system

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2088 - in development/main/metro: composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl system system/impl/src/main/net/dpml/system/impl system/spi/src/main/net/dpml/system
  • Date: Sat, 19 Mar 2005 16:54:41 -0500

Author: mcconnell AT dpml.net
Date: Sat Mar 19 16:54:40 2005
New Revision: 2088

Added:
development/main/metro/system/build.xml
Modified:

development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/ProfilePackageBuilder.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java

development/main/metro/system/impl/src/main/net/dpml/system/impl/Resources.properties

development/main/metro/system/spi/src/main/net/dpml/system/SystemContext.java

development/main/metro/system/spi/src/main/net/dpml/system/SystemCriteria.java
Log:
Add support for strict component profile resolution. When using the -strict
command line option the implicit creation of component profiles will be
disabled. Without declaration of -strict the default behaviour remains
unchanged in that implicit profile creation is available. Setting the strict
policy as the default can be achieved by setting the property
'dpml.system.strict' to 'true' under ${user.home}/dpml.properties.

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/ProfilePackageBuilder.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/ProfilePackageBuilder.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/ProfilePackageBuilder.java
Sat Mar 19 16:54:40 2005
@@ -53,11 +53,30 @@
public ProfilePackage createProfilePackage( String name, Class clazz )
throws Exception
{
+ return createProfilePackage( name, clazz, true );
+ }
+
+ /**
+ * Create a {@link ProfilePackage} from a type.
+ *
+ * @param name the component type name
+ * @param clazz the component class
+ * @param strict the policy concerning profile creation
+ * @return the profile package
+ * @exception Exception if a error occurs during package creation
+ */
+ public ProfilePackage createProfilePackage( String name, Class clazz,
boolean strict )
+ throws Exception
+ {
ProfilePackage profiles = m_serial.createProfilePackage( name, clazz
);
if( profiles != null )
{
return profiles;
}
+ else if( strict )
+ {
+ return ProfilePackage.EMPTY_PACKAGE;
+ }
else
{
final String classname = clazz.getName();

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
Sat Mar 19 16:54:40 2005
@@ -233,9 +233,10 @@
// create the repository supporting type and service lookup
//

+ boolean policy =
context.getSystemContext().getStrictProfileCreationPolicy();
Logger typeLogger = getLocalLogger().getChildLogger( "types" );
m_types = new DefaultTypeRepository(
- typeLogger, m_classLoader, context.getTypeRepository(), types
);
+ typeLogger, m_classLoader, context.getTypeRepository(), types,
policy );
Logger serviceLogger = getLocalLogger().getChildLogger(
"services" );
m_services = new DefaultServiceRepository(
serviceLogger, context.getServiceRepository(), services );

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultContainmentModelAssemblyHelper.java
Sat Mar 19 16:54:40 2005
@@ -445,8 +445,7 @@
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 )
@@ -461,42 +460,52 @@
//

DeploymentProfile[] profiles = findServiceProfiles( reference );
- ProfileSelector profileSelector = new DefaultProfileSelector();
- DeploymentProfile profile = profileSelector
- .select( profiles, reference );
- if( profile != null )
+ if( profiles.length == 0 )
{
- try
+ final String error =
+ "Unable to locate any candidate deployment profiles for the
service reference: [ "
+ + reference + "].";
+ throw new ProviderNotFoundException( error );
+ }
+ else
+ {
+ ProfileSelector profileSelector = new DefaultProfileSelector();
+ DeploymentProfile profile = profileSelector.select( profiles,
reference );
+ if( null == profile )
{
- DeploymentModel solution = m_model
- .createDeploymentModel( profile );
- assembleModel( solution, subjects );
- m_model.addModel( solution );
- return solution;
+ final String error =
+ "Unable to locate a suitable deployment profile for the
service reference: [ "
+ + reference + "].";
+ throw new ProviderNotFoundException( error );
}
- catch ( AssemblyException ae )
+ else
{
- final String error = "Nested assembly failure while
attempting to construct model"
+ try
+ {
+ DeploymentModel solution = m_model
+ .createDeploymentModel( profile );
+ assembleModel( solution, subjects );
+ m_model.addModel( solution );
+ return solution;
+ }
+ catch ( AssemblyException ae )
+ {
+ final 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 )
- {
- final String error = "Nested model failure while attempting
to add model"
+ throw new AssemblyException( error, ae );
+ }
+ catch ( ModelException me )
+ {
+ final String error = "Nested model failure while
attempting to add model"
+ " for the profile: "
+ profile
+ " for the reference: [" + reference + "].";
- throw new AssemblyException( error, me );
+ throw new AssemblyException( error, me );
+ }
}
}
- else
- {
- final String error = "Unable to locate a service provider for
the reference: [ "
- + reference + "].";
- throw new ProviderNotFoundException( error );
- }
}

DeploymentModel findServiceProvider( ReferenceDescriptor reference )

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultTypeRepository.java
Sat Mar 19 16:54:40 2005
@@ -98,13 +98,16 @@

/**
* Creation of a new root type manager.
+ * @param logger the assigned logging channel
+ * @param classloader the classloader
* @param types the list of types local to the repository
+ * @param policy the implicit profile creation policy
* @exception NullPointerException if the type list is null
*/
- public DefaultTypeRepository( Logger logger, ClassLoader classloader,
List types )
+ public DefaultTypeRepository( Logger logger, ClassLoader classloader,
List types, boolean policy )
throws Exception
{
- this( logger, classloader, null, types );
+ this( logger, classloader, null, types, policy );
}

/**
@@ -113,10 +116,11 @@
* @param classloader the classloader
* @param parent the parent type repository
* @param types the list of types local to the repository
+ * @param policy the implicit profile creation policy
* @exception NullArgumentException if the type list is null
*/
public DefaultTypeRepository( final Logger logger, final ClassLoader
classloader,
- final TypeRepository parent, final List
types )
+ final TypeRepository parent, final List
types, boolean policy )
throws Exception, NullArgumentException
{
if( types == null )
@@ -147,7 +151,7 @@
final String classname = type.getInfo().getClassname();
Class clazz = m_classloader.loadClass( classname );

- ProfilePackage pack = PACKAGE_BUILDER.createProfilePackage(
name, clazz );
+ ProfilePackage pack = PACKAGE_BUILDER.createProfilePackage(
name, clazz, policy );
m_profiles.put( classname, pack );
int n = pack.getComponentProfiles().length;


Added: development/main/metro/system/build.xml
==============================================================================
--- (empty file)
+++ development/main/metro/system/build.xml Sat Mar 19 16:54:40 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ Copyright 2004 Stephen J McConnell
+ Copyright 2004 Niclas Hedhman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied.
+
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<project name="dpml-system" default="default" basedir="."
+ xmlns:transit="antlib:net.dpml.transit">
+
+ <transit:import uri="artifact:template:dpml/magic/reactor"/>
+
+</project>

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContext.java
Sat Mar 19 16:54:40 2005
@@ -55,6 +55,7 @@
private final File m_temp;
private final boolean m_info;
private final boolean m_debug;
+ private final boolean m_strict;
private final Logger m_logger;
private final LoggingManager m_logging;
private final Repository m_repository;
@@ -66,10 +67,24 @@
// constructors
//
------------------------------------------------------------------------

+ /*
DefaultSystemContext(
final Repository repository, final LoggingManager logging,
final Logger logger, final File home, final File work, final File
anchor, final File temp,
- final boolean info, final boolean debug, final boolean isolate,
String[] remainder, Properties properties )
+ final boolean info, final boolean debug, final boolean isolate,
String[] remainder,
+ final Properties properties )
+ throws NullArgumentException
+ {
+ this( repository, logging, logger, home, work, anchor, temp, info,
debug, isolate, false,
+ remainder, properties );
+ }
+ */
+
+ DefaultSystemContext(
+ final Repository repository, final LoggingManager logging,
+ final Logger logger, final File home, final File work, final File
anchor, final File temp,
+ final boolean info, final boolean debug, final boolean isolate, final
boolean strict,
+ String[] remainder, Properties properties )
throws NullArgumentException
{
super();
@@ -96,6 +111,7 @@
m_isolate = isolate;
m_remainder = remainder;
m_properties = properties;
+ m_strict = strict;

}

@@ -113,6 +129,15 @@
return m_debug;
}

+ /**
+ * Return the policy concerning the creation of profiles. If the value
+ * is TRUE then implicit profile creation is disabled.
+ */
+ public boolean getStrictProfileCreationPolicy()
+ {
+ return m_strict;
+ }
+
/**
* Return the application home directory.
*

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemContextFactory.java
Sat Mar 19 16:54:40 2005
@@ -209,6 +209,11 @@
criteria.setIsolationMode( true );
}

+ else if( m_line.hasOption( "strict" ) )
+ {
+ criteria.setStrictProfileCreationPolicy( true );
+ }
+
if( m_line.hasOption( "dir" ) )
{
String path = m_line.getOptionValue( "dir" );
@@ -276,6 +281,7 @@
createLoggingManager( m_repository, uri, dir, url, m_DebugMode );
Logger logger = logging.getLoggerForCategory( SystemContext.DOMAIN );
Repository repository = createRepository();
+ boolean strict = criteria.getStrictProfileCreationPolicy();

setupMonitors( logger );

@@ -319,7 +325,7 @@

return new DefaultSystemContext(
repository, logging, logger, Transit.DPML_HOME, dir, anchor,
temp,
- m_InfoMode, m_DebugMode, isolate, m_remainder, m_properties );
+ m_InfoMode, m_DebugMode, isolate, strict, m_remainder,
m_properties );
}

private void setupMonitors( Logger logger ) throws SystemException
@@ -577,6 +583,8 @@
new Option( "debug", REZ.getString( "cli-debug-description" ) ) );
options.addOption(
new Option( "info", REZ.getString( "cli-info-description" ) ) );
+ options.addOption(
+ new Option( "strict", REZ.getString( "cli-strict-description" ) )
);

options.addOption(
OptionBuilder.hasArg().withArgName( REZ.getString( "directory" ) )

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/DefaultSystemCriteria.java
Sat Mar 19 16:54:40 2005
@@ -58,7 +58,8 @@
SystemContext.TEMP_KEY,
SystemContext.DIR_KEY,
SystemContext.ANCHOR_KEY,
- SystemContext.ISOLATE_KEY
+ SystemContext.ISOLATE_KEY,
+ SystemContext.STRICT_KEY
};

/**
@@ -104,6 +105,12 @@
Boolean.class,
getDefaultBoolean(
properties.getProperty( SystemContext.ISOLATE_KEY ), true )
+ ),
+ new Parameter(
+ SystemContext.STRICT_KEY,
+ Boolean.class,
+ getDefaultBoolean(
+ properties.getProperty( SystemContext.STRICT_KEY ), false )
)
};
}
@@ -170,6 +177,15 @@
// SystemCriteria
//--------------------------------------------------------------

+ /**
+ * Set the policy concerning the creation of profiles. If the value
+ * is TRUE then implicit profile creation is disabled.
+ */
+ public void setStrictProfileCreationPolicy( boolean policy )
+ {
+ put( SystemContext.STRICT_KEY, new Boolean( policy ) );
+ }
+
/**
* Set the isolation enabled.
* @param mode TRUE to enable isolation mode else FALSE
@@ -263,6 +279,15 @@
}

/**
+ * Get the profile creation policy
+ * @return mode TRUE if profile creation policy is strict.
+ */
+ public boolean getStrictProfileCreationPolicy()
+ {
+ return getBooleanValue( SystemContext.STRICT_KEY );
+ }
+
+ /**
* Get the working directory.
* @return the working directory.
*/

Modified:
development/main/metro/system/impl/src/main/net/dpml/system/impl/Resources.properties
==============================================================================
---
development/main/metro/system/impl/src/main/net/dpml/system/impl/Resources.properties
(original)
+++
development/main/metro/system/impl/src/main/net/dpml/system/impl/Resources.properties
Sat Mar 19 16:54:40 2005
@@ -22,6 +22,7 @@

cli-debug-description=Enables debug mode.
cli-info-description=Lists info about the controller context.
+cli-strict-description=Disables the implicit creation of component profiles.

cli-logging-description=An artifact uri identifying a logging manager
factory.


Modified:
development/main/metro/system/spi/src/main/net/dpml/system/SystemContext.java
==============================================================================
---
development/main/metro/system/spi/src/main/net/dpml/system/SystemContext.java
(original)
+++
development/main/metro/system/spi/src/main/net/dpml/system/SystemContext.java
Sat Mar 19 16:54:40 2005
@@ -51,6 +51,7 @@
static final String TEMP_KEY = GROUP + ".temp";
static final String ANCHOR_KEY = GROUP + ".anchor";
static final String ISOLATE_KEY = GROUP + ".isolate";
+ static final String STRICT_KEY = GROUP + ".strict";

static final String[] KEYS =
new String[]{
@@ -59,7 +60,8 @@
LOGGING_CONFIGURATION_KEY,
HOME_KEY,
TEMP_KEY,
- ISOLATE_KEY
+ ISOLATE_KEY,
+ STRICT_KEY
};

/** Return the Info mode
@@ -72,6 +74,13 @@
*/
boolean getDebugMode();

+ /**
+ * Return the policy concerning the creation of implicit profiles. If
the value
+ * is FALSE then implicit profile creation is supported otherwise an
empty profile set
+ * will be assigned to a profile not explicitly declaring one or more
deployment profiles.
+ */
+ boolean getStrictProfileCreationPolicy();
+
/**
* Return the application home directory.
*

Modified:
development/main/metro/system/spi/src/main/net/dpml/system/SystemCriteria.java
==============================================================================
---
development/main/metro/system/spi/src/main/net/dpml/system/SystemCriteria.java
(original)
+++
development/main/metro/system/spi/src/main/net/dpml/system/SystemCriteria.java
Sat Mar 19 16:54:40 2005
@@ -43,6 +43,12 @@
*/
void setIsolationMode( boolean mode );

+ /**
+ * Set the policy concerning the creation of profiles. If the value
+ * is TRUE then implicit profile creation is disabled.
+ */
+ void setStrictProfileCreationPolicy( boolean policy );
+
/**
* Set the working directory.
* @param dir the working directory
@@ -80,6 +86,12 @@
boolean getIsolationMode();

/**
+ * Return the profile creation policy.
+ * @return TRUE if implicit profile creation is disabled
+ */
+ boolean getStrictProfileCreationPolicy();
+
+ /**
* Get the working directory.
* @return the working directory.
*/



  • svn commit: r2088 - in development/main/metro: composition/impl/src/main/net/dpml/composition/data/builder composition/impl/src/main/net/dpml/composition/model/impl system system/impl/src/main/net/dpml/system/impl system/spi/src/main/net/dpml/system, mcconnell, 03/19/2005

Archive powered by MHonArc 2.6.24.

Top of Page