|
|||
|
|||
|
|
Shell+ Documents is a fully functional namespace extension demo that allows users to create virtual directories and share them with other users. The project is built on Delphi using Shell+ Components and RemObjects SDK. Shell+ Documents project can be used as prototype for building real namespace extensions for corporate and personal use. This article will describe the process of building true namespace extension client and application server for handling local and remote requests. You can download binaries and source code below this article. Shell+
Documents Overview
Shell+ Documents consists of two modules - Shell namespace client and Application Server. Namespace client is built with Shell+ and handles the following tasks:
Application Server is built with RemObjects SDK and handles the following tasks:
The data is stored in the database file that handled by Application Server. It is a simple implemplementation of filesystem-in-a-file approach.
Application Server class model We use two generic terms in this project: Worker - is the class that contains implementation of all methods; Service - is the RO-based class that is accessible remotely: from local or networked clients, it translates calls to the Worker-classes. Basic implementation for Worker is TCustomDocumentsWorker and basic implementation for Service is TCustomDocumentsService. Worker class is inherited from usual TDataModule, and Service class is a RemObjects service. Both, Worker and Service implementing one interface - ICustomDocumentsService. This makes our class model pretty ease to use for local and networked operations. TCustomDocumentsService have two successors - for local and remote connections. Shell namespace extension client connecting to the TLocalDocumentsService. This class automatically chooses which Worker to use (Local or Remote) and executes method on the appropriate Worker. Thats ease, because they are imlementing same interface. TLocalDocumentsWorker working directly with the database, and TRemoteDocumentsWorker executes methods of TRemoteDocumentsService on the remote server. The better way to see the interoperability of these modules is the UML-schema (built with Model Maker). On the schema below you can see, how server processes the call within local area: LocalDocumentsService just translates the call to LocalDocumentsWorker. And on the schema below, you can see how server processes the call to networked area: LocalDocumentsService translates call to the RemoteDocumentsWorker, which in his turn, translates call to another server's RemoteDocumentsService and then to LocalDocumentsWorker of another server. The basic element for information exchange is described by TsdElement class. Instances of this class are used to describe databases, files and folders inside the virtual namespace. TsdElement class contains ServerName property and LocalDocumentsServices uses this property to decide which worker to use.
Namespace extension implementation Namespace extension have much simplier design. As usually with Shell+ it has the follwing classes:
The main component on the TsxModule is TsxVirtualFolder. It contains information about NSE registration (JunctionPoint, etc,) and basic behaviour like URLHandler (allows to display readable path names for virtual folders). VirtualFolder component linked to other UI-specific components on TsxModule: TsxExtractIcon (displaying custom icon for namespace), TsxShellPropSheetExt (provides special properties dialog for NSE's root), TsxNamespaceDetails (contains information about Details View settings), TsxSysShellView (handles general UI tasks for NSE), TSxExplorerMenu and TSxExplorerToolbar components (add commands to Explorer menu and toolbar) and TSxExplorerBand (provides ability to display custom Explorer band for searching documents on server side). Also, VirtualFolder component linked to the TsxByHandProvider component, which hosted on the PermanentModule. This component allows to provide any tree-like data to the Windows Shell. DataProvider component also linked to some UI-components, but these components are related to the items that DataProvider produces to the Windows Shell: TSxGrainMenu (provides menu items to the NSE elements), TSxIconList (stores icon images to be displayed for virtual items) and TsxNamespacePropertySheet (describes property pages that will be displayed for virtual items). Shell+ uses own class (TsxCustomDataGrain and its successors) to describe items in the virtual namespace, so we made several methods to convert information from TsxElement class to DataGrain and vice-versa. The methods called DataGrainToSDElement and SDElementToDataGrain. As you can see from the source code, we use these methods everywhere. Object model for this and any other namespace extensions built with Shell+ looks this way: TsxByHandProvider component have many different events, however their implementations are small and simple. Everything starts from OnPopulate event. It is executed as soon as Windows Shell need to display contents of the root folder. The event handler should retrieve and provide the list of available databases. Later, when user will choose the database or folder in the database, event handler will retreve the list of items again and provide them to the Windows Shell as well. The important feature of this example - is server based document searching feature. Unlike standard Windows Search, this feature it executes searching process on the server side and returns only items that meets conditions, entered by the user. Searching feature implemented as standard Explorer Band that makes it very handy and useful for the user. It works this way: 1. When user click "Search" button,
program creates instance of TsdElement and stores searching query to the TsdElement.Keywords
property. That's all folks :)
Download source code and binaries
|
Components
| Download | Purchase
| Support | About
Us
Copyright © 2016 ALDYN Software. All rights reserved. Copyright © 2001 - 2011 Shell+ Development Group. All rights reserved. |