/*
* Copyright 2003-2004 The Apache Software Foundation
* 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.
*/
namespace Apache.Avalon.Composition.Model.Default
{
using System;
using Apache.Avalon.Framework;
using Apache.Avalon.Composition.Model;
using Apache.Avalon.Composition.Data;
/// Default implementation of a deployment context.
///
///
/// Avalon Development Team
///
/// $Revision: 1.1 $ $Date: 2004/02/28 22:15:42 $
///
public class DefaultDeploymentContext : Apache.Avalon.Framework.DefaultContext, IDeploymentContext
{
//---------------------------------------------------------
// immutable state
//---------------------------------------------------------
//UPGRADE_NOTE: Final was removed from the declaration of 'm_name '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'
private String m_name;
//UPGRADE_NOTE: Final was removed from the declaration of 'm_partition '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'
private String m_partition;
//UPGRADE_NOTE: Final was removed from the declaration of 'm_logger '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'
private ILogger m_logger;
//UPGRADE_NOTE: Final was removed from the declaration of 'm_mode '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'
private Mode m_mode;
//UPGRADE_NOTE: Final was removed from the declaration of 'm_graph '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'
private DependencyGraph m_graph;
//UPGRADE_NOTE: Final was removed from the declaration of 'm_system '. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1003"'
private ISystemContext m_system;
//---------------------------------------------------------
// constructor
//---------------------------------------------------------
/// Creation of a new deployment context.
///
///
/// the logging channel to assign
///
/// the assigned partition name
///
/// the profile name
///
/// the deployment mode
///
/// the parent deployment assembly graph
///
public DefaultDeploymentContext(ILogger logger, ISystemContext system, String partition, String name, Mode mode, DependencyGraph graph)
{
if (logger == null)
{
throw new System.ArgumentNullException("logger");
}
if ((System.Object) name == null)
{
throw new System.ArgumentNullException("name");
}
if (system == null)
{
throw new System.ArgumentNullException("system");
}
m_graph = new DependencyGraph(graph);
if (graph != null)
{
graph.AddChild(m_graph);
}
m_logger = logger;
m_system = system;
m_partition = partition;
m_name = name;
m_mode = mode;
}
//---------------------------------------------------------
// DeploymentContext
//---------------------------------------------------------
/// Return the system context.
///
///
/// the system context
///
public virtual ISystemContext SystemContext
{
get
{
return m_system;
}
}
/// Return the profile name.
/// the name
///
public virtual String Name
{
get
{
return m_name;
}
}
/// Return the assigned partition name.
///
///
/// the partition name
///
public virtual String PartitionName
{
get
{
return m_partition;
}
}
/// Return the model fully qualified name.
/// the fully qualified name
///
public virtual String QualifiedName
{
get
{
if (null == PartitionName)
{
return IDeploymentContext_Fields.SEPARATOR;
}
else
{
return PartitionName + Name;
}
}
}
/// Return the mode of establishment.
/// the mode
///
public virtual Mode Mode
{
get
{
return m_mode;
}
}
/// Return the assigned logger.
/// the logging channel
///
public virtual ILogger Logger
{
get
{
return m_logger;
}
}
/// Return the dependency graph used to construct
/// deployment and decommissioning sequences.
///
///
/// the dependency graph
///
public virtual DependencyGraph DependencyGraph
{
get
{
return m_graph;
}
}
}
}