void
ComponentImplementation::install()
throw(Components::CreateFailure)
{
    //
	// if already installed increment counter only
	//
	if (installation_count_)
	{
		installation_count_++;
		DEBUG_OUT3( "..... already installed (", installation_count_, ")" );
		return;
	}

	//
	// if without package increment counter only
	//
	if (package_.empty())
	{
		installation_count_++;
		return;
	}

	//
	// create directories for the component implementation
	//
	makeDir(data_.installation_dir);
    makeDir(build_dir_);

	//
	// package may be component or composition
	//
	Package archive = Package( package_ );
    std::string xmlfile_name = archive.getFileNameWithSuffix( ".cad" );
    if ( xmlfile_name != std::string( "" ) )
	{
		//
		// get info from the assembly package
		//
		CADReader reader;
		try 
		{
			reader.readCAD( package_, &(data_.assembly), build_path_ );
		}
		catch( CADReadException ) 
		{
			std::cerr << "!!!!! Error during reading .cad" << std::endl;
			removeFileOrDirectory(data_.installation_dir);
			removeFileOrDirectory(build_dir_);
			throw Components::CreateFailure();
		}
		data_.assembly.cad = getFileName( xmlfile_name );
	}
	else
	{
		xmlfile_name = archive.getFileNameWithSuffix( ".csd" );

		//
		// get info from the software package
		//
		CSDReader reader;
		try 
		{
			reader.readCSD( package_, &data_, build_path_ );
		}
		catch( CSDReadException ) 
		{
			std::cerr << "!!!!! Error during reading .csd" << std::endl;
			removeFileOrDirectory(data_.installation_dir);
			removeFileOrDirectory(build_dir_);
			throw Components::CreateFailure();
		}
		data_.csd = getFileName( xmlfile_name );
	}

    //
	// install any code
	//
    try	
	{
		installCode();
	}
	catch( Components::CreateFailure )
	{
		removeFileOrDirectory(data_.installation_dir);
		removeFileOrDirectory(build_dir_);
        throw Components::CreateFailure();
	}

	// increment installation counter ( to 1 )
	installation_count_++;
}