Elite Replicator is a plugin for .TEXT 0.95 Blog Engine that enable your weblog to spread its posts to many other mirrors, installed on various different engines. It is based on a scheduling engine for ASPNET 1.1 created to execute some jobs at predefined intervals of time. The replicator check the weblog for the presence of new posts and apply some rules to decide where to send copies of them. This is a brief how-to note explaining installation and configuration of the plugin.
To install the plugin you have simply to copy some files in the directory hosting .TEXT and run a minimal database script onto the sql server database where .TEXT is installed. Here is the complete file listing and explanation:
(Paths are expressed relative to .TEXT root web directory)
1) bin directory
This directory contains the main assemblies for replicator and scheduler plus some engine adapter inherited from Imho Instant Blogger (http://imhoproject.org) that enable spreading posts over many type of blog-server engines. Compatible engine include Community Server, Wordpress, MovableType compatible and the same .TEXT. All the file in this directory must be copied into the /bin directory of the web application hosting .TEXT blog.
This asp.net page is a simply monitor for the activity of the scheduled It runs if copied into any .TEXT directory, but probably the better position is in the /Admin directory so it is protected by the same authentication of the .TEXT backend. It shows the running jobs with some information about them and permit to force its running at every time. Installation of monitor page is not vital for the replicator or scheduler to run.
This file contains some sections that must be copied into the .TEXT web.config file. The sections has to be copied according to it position in the template file as reported in the comments. See the Configuration section of this document to understand the configuration properties.
This file must run on the database hosting the .TEXT engine data and will create only a couple of stored procedures, a table and two triggers. The triggers add to the table the id of the newest post, and the procedures get the informations from this table.
The installation of Elite Replicator 1.0 insert three different sections into the configuration file of .TEXT. This sections have different configuration meaning.
HttpModule: This section is required to start the scheduling engine the first time a page of the web application is called. Probably the same behaviour may be obtained writing some instructions into the global.asax application class, but this require the recompilation of full engine. So I decided to intercept the BeginRequest event into the SchedulerModuler. This has impact on the web site performances only the firt time a page is called after an applcation restart. The required overhead if very tiny. To configure the HttpModule you have to enter a single line of xml into the configuration file indicating to enter the module at every asp.net page.
Scheduler: The settings applied to the schedulig engines are very simply. They begin with the element schedulerSettings that include a single attribute and a single subelement. The attribute is schedulerPrecision, an integer value expressed in milliseconds that tell the interval between two scheduler activities. Setting this timeout lower than 60000 ms (=1 minute) has no meaning because the minimum timeout applicable for a job has the same value. This parameter is useful only to fine tune the scheduler precision when there is no jobs that required this frequency of work. The inner element of schedulerSettings is jobs that contains job elements representing every single job that the scheduler must execute. A job element has this attributes:
minutes: interval between two execution of the job
name: unique name for the job (must be unique!!)
enabled: true if the job is enabled. If false the job will not be instantiated and will not appear in the jobmonitor
type: a fully qualified type name implementing Elite.Scheduler.IJob interface. This type will be instantiated when the scheduler starts and disposed wher the scheduler is disposed. You can implement your jobs simply extending this interface or most probably the abstract ScheduledJob class.
The assemblies contains two jobs. The first named PostReplicatorJob is responsible to read rules from the configuration and spread the posts across multiple sites. The other optional job, namer LogClenupJob is responsible of periodically clean the log file of the replicator (if enabled) after sending it to a given email address. The log file contains useful information about running of the replicator like number of posts replicated, and error occured.
Replication: The replication engine has the more complex configuration section because it define how to replicate posts across different blog, running on different engines. It starts with the element replicatorSettings that contains this attributes:
fromMail: email address for the from field of email messagges. It is useful to avoid relay problems
adminEmail: email address where to send backupped logs
mailServer: mail server to use for sending mails. If omitted it default to 127.0.0.1
logEnabled: True to enable logging
logFile: phisical path to the log file
dataProvider: fully qualified name of the datalayer class, targeting a specific database server (only sql server available).
sourceRoot: root url of the weblog
sourceUrlTemplate: template of the rewritten urls
connectionString: connection string to the .TEXT database
The inner element blogs contains a collection of item blog that define the weblogs managed by the replicator. The replicator is able to manage multiple source weblog defining different rules and targets for everyone. The blog element is the core on the rule engine. Id has two attributes:
key: a unique application key that identify the .text blog. It is composed by hostName and applicationId as defined in the blog_Config table. You may obtain this key concatenating the domain there the blog is hosted and the inner directory separated by a colon. E.g, if your blog is hosted at http://www.myblogs.com/blogname the key is "www.myblogs.com:blogname". If the blog is on the root directory simply leave empty the second part of the key: "www.myblogs.com:"
title: the title of the weblog. It is used for the footer of the replicated posts.
The element blog define with some inner elements the rules and the targets of this blog. Rules is an element that contains a series of rule tags. Here is the attributes that define a rule:
title: define a regular expression applied to the title of the post if matched cause the replication of the post
text: define a regular expression applied to the text of the post if matched cause the replication of the post
category: define a regular expression applied to the category of the post if matched cause the replication of the post
target: the target weblog to replicate if one of the regular expressions matches.
targetCategories: the category to assign to the post on the target blog.
Finally the last element in the blog section is the targets, that contains a collection of target. A target is a weblog that will receive the replicated posts. Te target section define the blogs and the required authentication/communication properties. Here is the attributes:
name:unique name used in the rules to reference the target
adapter:fully qualified type name to the adapter required to conecto to the target engine. It has to be one of DotTextAdapter, BloggerAdapter, CommunityServerAdapter, or MovableTypeAdapter. To implement a new adapter it is required to extend the abstract class Elite.IMHO.Engines.EngineAdapter.
url: url to the page or service used to post on the target. I remember that for connections to blogger it is required to use https:// protocol instead of http://
userName: username used to authenticate
password: password used to authenticate (Warning: The password is not encrypted or hashed so you have to be aware that none can have accesso to the configuration file)
The element target has a single subelement named footer. The footer define a brief footer that can be enqueued to the replicated post. A footer may include some macro to insert dynamic information in it. This macros are: blog.key, post.id, post.date, post.text, post.url and post.title. This macro are self-explanatory.
The file attached to this post contains both the binaries and the source files that can be recompiled simply opening the solution with Visual Studio.NET 2003. The Elite Replicator for .TEXT 1.0 is released under the terms of the Creative Common Public License (Attribution-NonCommercial-ShareAlike 2.0 Italy). Both the Replicator and the scheduler have separated license files because they may be used separately.
Please, for the blogger that decide to use this software to post a trackback to this article. Thank you.
Zip file: Elite.DotText.Replicator.zip (319 KB)