C U T B H P N

Project #1 - Text Search Component

Spring 2019

Version 1.2,
Due Date: Sunday, April 7th

Purpose:

Components are usually relatively small pieces of software built as libraries that expose an interface for accessing functionality and an object factory that allows a client to initialize the software by creating internal objects without binding to concrete definitions. Often a component provides to a client the means to manage the lifetime of internal objects and to specify that the component is no longer needed so it's binary library may be unloaded by the run-time environment1.

Microsoft developed, in the 90's, a Windows platform technology it calls the Component Object Model (COM) that is based on components. Its use is pervasive throughout their product ecosystem, e.g., Windows, the .Net framework, Office, IIS and many of its other enterprise server technologies.

In this project we will develop a Text Search program using components on both Windows and the Linux operating system. For the Windows-based program we will use the Microsoft COM technology. Linux does not support COM so we will build our own component infrastructure for that environment.

Requirements:

Your Text Search Program:
  1. Shall be implemented in C++11 using the latest version of Visual Studio for the COM-on-Windows program and latest stable version of g++ or clang for the Components-on-Linux program2.
  2. (5) Shall, on each platform, provide a console application that, given on the command line: a regular-expression search string, a path, and a set of file name patterns, identifies by name and path all those files matching one or more of the patterns and which contain an instance of the search string. It does this using the services of two components, described below.
  3. (5) The previous requirement shall be interpreted to include all common text formats, e.g., *.txt, *.h, *.cpp, *.cs, etc. It optionally3 will also be interpreted to include Microsoft Word doc and docx files on Windows. And, it optionally3 will also be interpreted to include Libre Office Writer odf files on Linux.
  4. (8) Shall, for each platform, provide a text search component that accepts a fully qualified file name and regular-expression text pattern. If the file matches the text pattern in one or more locations, it returns a list of line numbers where the matches occur. If no matches occur, it returns an empty list.
  5. (7) Shall, for each platform, provide a FileMgr component that finds the fully qualified names of all files residing in a directory tree rooted at a specified path and matching one or more of the filename patterns. It exposes these results by posting to an interface defined by FileMgr, but implemented by the user of its results4. Should an error occur during processing FileMgr will use that interface to post an error message.
  6. (5) Shall use a Powershell script on windows and a Bash script on Linux to demonstrate that the application, and its components, implement their required functionality. The combination of scripts and console applications should clearly show the initial requests, the output of the FileMgr, and the output of the file search processing PowerShell Example Script, Script note

  1. For COM, that's the Service Control Manager (SCM), effectionately know as the scum.
  2. Submission:
    • Please submit your projects using a single zip archive.
    • Submit your Windows code with a Visual Studio solution.
    • Please use Visual Studio Code to develop your project code for the Linux platform, but please supply a (gnu) makefile that will build both components as shared libraries and the application using the libraries. You may use CLang instead of g++ if you wish, provided that you have a version that implements C++11 threading features.
  3. You will receive a 5 point bonus for implementing each of the options, cited above.
  4. You may, alternately, chose to have the receiver implement a callback and pass a reference to FileMgr through an interface FileMgr implements. Note that implies two interfaces, one implemented by FileMgr to accept a reference to the receiver's callback and one implemented by the receiver to accept the callback results.

What you need to know:

In order to successfully meet these requirements you will:
  1. Install Linux, presumably in a Virtual Machine. I use Ubuntu in a VirtualBox virtual machine. You may use any distribution you like and might choose to use a VMWare Player virtual machine instead of VirtualBox.
  2. Know or learn how C++ classes and class hierarchies work, C++11 threading, and how to design interfaces and object factories. We will discuss examples of these in class.
  3. How COM works and how to use the ATL libraries. We will discuss this in detail in the first few weeks of classes.