Item14089: Adding a mode=application
to CopyContrib
Priority: Enhancement
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: CopyContrib
Branches: master
Proposal (10 June 2016)
The
application
mode is similar to the
topics
mode. The following parameters will be honoured:
Name |
Description |
Default |
source |
A list of topics to be copied |
%BASEWEB%.%BASETOPIC% |
destination |
The destination web where the topics are to be copied |
|
template |
A template web to be used in case the destination web does not exist yet and needs to be created on the base of a template |
_default |
The
source
parameter will take a comma separated list of the form:
source_topic_name => target_topic_name [copy_type]
. White space will be ignored.
The significance of the parts is:
source_topic_name |
The topic to be copied. The name can be of the form web.topic . Web defaults to the BASEWEB . |
Mandatory |
target_topic_name |
The topic name to be created in the destination web. Defaults to the topic in the source_topic_name |
Optional |
[copy_type] |
The copy_type can be topic or stub . The default is topic . |
Optional |
For example:
mode=application;source=BookLayout;destination=Book;template=_default
will copy
%BASEWEB%.BookLayout
to
Book.BookLayout
. The
Book
web is created if it does not exist.
mode=application;source=ApplicationWebPreferencese=>WebPreferences;destination=Book;template=_default
will copy
%BASEWEB%.ApplicationWebPreferences
to
Book.WebPreferences
. The
Book
web is created if it does not exist.
mode=application;source=Applications.RenderSimpleTopicCreator[stub];destination=Book;template=_default
will copy
Applications.RenderSimpleTopicCreator
to
Book.RenderSimpleTopicCreator
as a stub. The
Book
web is created if it does not exist.
mode=application;source=ApplicationWebHome=>WebHome[stub];destination=Book;template=_default
will copy
%BASEWEB%.ApplicationWebHome
to
Book.WebHome
as a stub. The
Book
web is created if it does not exist.
As you can see, this construct caters for all deployment requirements of applications. A particular web can be supported by multiple applications. Home pages and preferences can be distributed as part of the Applications web.
Comments welcome
--
BramVanOosterhout - 10 Jun 2016
Implementation (12 August 2016)
Following up, I have created an implementation of the design presented. I attach the code. In summary I have:
- added a mode
application
to CopyContrib.pm
- implemented CopyContrib/ApplicationAgent.pm which:
- copies the default web
- uses TopicAgent to copy topics
- implements new functionality to create stubs
I have also implemented a new workbench function RenderApplicationDeployer, which takes a DeploymentList topic as input. The DeploymentList topic contains a table of the form:
source_topic_name |
target_topic_name |
copy_type |
RenderApplicationDeployer uses this table to generate the
mode=application
input parameters:
source_topic_name => target_topic_name [copy_type]
I have attached that code as well.
Now that I have completed this, I have a few questions:
--
BramVanOosterhout - 12 Aug 2016
Complete implementation for review (31 March 2017)
I have completed my updates to the CopyContrib for
mode=applications
The updated files are avalable in
CopyContrib-Application.tgz. They are:
file |
Purpose/Change |
lib/Foswiki/Contrib/CopyContrib.pm |
Added the stub and application mode. |
lib/Foswiki/Contrib/CopyContrib/CopyAgent.pm |
minor change. Added scalar . |
lib/Foswiki/Contrib/CopyContrib/WebAgent.pm |
minor change. Propagated the debug parameter. |
lib/Foswiki/Contrib/CopyContrib/TopicStubAgent.pm |
new module. Derived from TopicAgent.pm and will create a stub for a given topic . |
lib/Foswiki/Contrib/CopyContrib/ApplicationAgent.pm |
new module. Implements the copy of a web with new syntax. |
data/System/CopyContrib.txt |
Added descriptions for modes application and stub . |
I have also created an example of the use of the application as part of the WikiWorkbench.
The additional files are available in
WikiWorkbenchContrib-Deployment.tgz.
The example will deploy a new web, supporting the development of an application. It uses the DeploymentList. You can jump there in the Applications web. You are presented with a deployment list which has a
Deploy
button at the bottom.
Clicking
Deploy
will create a web similar to that created by the
New WikiApplication
button on the Applications.WebHome page.
The deployment list |
On successful completion... |
|
|
... creates the Testweb
Have a look. I look forward to your comments.
--
BramVanOosterhout - 31 Mar 2017