Skip to content

Commit 01b6208

Browse files
committed
Initial version
1 parent d5672be commit 01b6208

14 files changed

Lines changed: 1139 additions & 2 deletions

File tree

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Compiled source #
2+
###################
3+
*.com
4+
*.class
5+
*.dll
6+
*.exe
7+
*.o
8+
*.so
9+
target/
10+
bin/
11+
12+
# Packages #
13+
############
14+
# it's better to unpack these files and commit the raw source
15+
# git has its own built in compression methods
16+
*.7z
17+
*.dmg
18+
*.gz
19+
*.iso
20+
*.jar
21+
*.rar
22+
*.tar
23+
*.zip
24+
25+
# Logs and databases #
26+
######################
27+
*.log
28+
*.sql
29+
*.sqlite
30+
db/
31+
32+
# IDE Config files #
33+
######################
34+
nb-configuration.xml
35+
.project
36+
.settings/
37+
nbproject/
38+
*.iml
39+
.idea
40+
.classpath
41+
42+
# OS generated files #
43+
######################
44+
.DS_Store
45+
.DS_Store?
46+
._*
47+
.Spotlight-V100
48+
.Trashes
49+
ehthumbs.db
50+
Thumbs.db

CHANGELOG.MD

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Change Log
2+
All notable changes to this project will be documented in this file.
3+
This project adheres to [Semantic Versioning](http://semver.org/).
4+
5+
## 1.0.0
6+
###### <<release-date>>
7+
### Added
8+
* Support for triggering a _Pull Request_ by the _Consumer_ system. The extension
9+
allows the back-end to trigger both a "normal" Pull Request as described in the
10+
ebMS3 Core Specification or a "selective" Pull Request as specified in section
11+
5.1 of ebMS3 Part 2 Advanced Features.
12+
NOTE: This version only allows the "simple" selection criteria.

README.md

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,74 @@
1-
# pullrequest-trigger
2-
Is a Holodeck B2B Extension that allows &lt;i>Pull Request&lt;/i>s to be triggered by the back-end application.
1+
# Holodeck B2B Pull Request trigger extension
2+
This extension allows the _Consumer_ application to control when _Pull Request_s are send by Holodeck B2B
3+
instead of the default fixed intervals. It also allows to specify the _criteria_ of a "selective" Pull Request
4+
as specified in [section 5.1 of ebMS V3 part 2 (Advanced Features)](http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/part2/201004/cs01/ebms-v3.0-part2-cs01.html#__RefHeading__435723_822242408).
5+
6+
Currently the trigger mechanism is file based; the back-end application writes a XML document to a specific
7+
directory where it is read by the extension and a corresponding Pull Request is triggered.
8+
__________________
9+
For more information on using Holodeck B2B visit the website at http://holodeck-b2b.org
10+
Lead developer: Sander Fieten
11+
Code hosted at https://github.com/holodeck-b2b/pullrequest-trigger
12+
Issue tracker https://github.com/holodeck-b2b/pullrequest-trigger/issues
13+
14+
## Installation
15+
### Prerequisites
16+
This extension can be used with Holodeck B2B version 4.1.0 and later.
17+
18+
### Configuration
19+
To enable the trigger mechanism a _worker_ that will watch for _trigger documents_ has to be added to the
20+
Holodeck B2B instance. The worker class is `org.holodeckb2b.ebms3.pulling.trigger.filebased.WatchForTriggerFile`
21+
and it takes one parameter _watchPath_ that should point to the directory where the trigger documents are
22+
placed by the back-end. As the worker will look for any file with "xml" extension it is recommended to use
23+
a specific directory for triggers only.
24+
Furthermore the regular worker _interval_ parameter can be used to set the interval at which the worker
25+
should check for new triggers.
26+
27+
If you will only be using "trigger based" pulling on this Holodeck B2B instance you should disable the
28+
standard "interval based" pull mechanism by removing or deactivating the _pullConfigWatcher_ worker.
29+
30+
## Usage
31+
Pull Request can only be triggered for existing P-Modes that define how the Pull Request must be
32+
processed.So before triggering a request the P-Mode must have been registered in Holodeck B2B, either
33+
manually by an operator or automatically by the back-end.
34+
35+
To trigger a Pull Request the back-end application must create a _"Pull Request trigger document"_ in the
36+
directory specified in the _watchPath_ parameter of the watcher described above. These "trigger" documents
37+
are XML documents that MUST have the "xml" extension. They must contain at least the P-Mode that governs
38+
the processing of the Pull Request and can further configure the MPC [sub-channel] and selection criteria
39+
to use for pulling. Their structure is defined by XML schema
40+
[http://holodeck-b2b.org/schemas/2018/02/pullrequest/metdata](src/main/resources/pulltrigger.xsd).
41+
**NOTE:** In the current version only the "simple" selection criteria as described in section 5.1 of the
42+
ebMS V3 Part 2 Specification are supported.
43+
44+
When the watcher detects a trigger document it will check that the P-Mode exists and submit a Pull Request
45+
Signal message unit to the Holodeck B2B Core to trigger the pull process. After processing the file, i.e.
46+
after the Pull Request has been submitted, the extension will be changed to "triggered". When an error
47+
occurs on submit the extension will be changed to "rejected" and information on the error will be written
48+
to a file with the same name but with extension "err".
49+
50+
## Contributing
51+
We are using the simplified Github workflow to accept modifications which means you should:
52+
* create an issue related to the problem you want to fix or the function you want to add (good for traceability and cross-reference)
53+
* fork the repository
54+
* create a branch (optionally with the reference to the issue in the name)
55+
* write your code, including comments
56+
* commit incrementally with readable and detailed commit messages
57+
* run integration tests to check everything works on runtime
58+
* Update the changelog with a short description of the changes including a reference to the issues fixed
59+
* submit a pull request *against the 'next' branch* of this repository
60+
61+
If your contribution is more than a patch, please contact us beforehand to discuss which branch you can best submit the pull request to.
62+
63+
### Submitting bugs
64+
You can report issues directly on the [project Issue Tracker](https://github.com/holodeck-b2b/pullrequest-trigger/issues).
65+
Please document the steps to reproduce your problem in as much detail as you can (if needed and possible include screenshots).
66+
67+
## Versioning
68+
Version numbering follows the [Semantic versioning](http://semver.org/) approach.
69+
70+
## License
71+
This Holodeck B2B extension is licensed under the General Public License V3 (GPLv3) which is included in the LICENSE file in the root of the project.
72+
73+
## Support
74+
Commercial Holodeck B2B support is provided by Chasquis Consulting. Visit [Chasquis-Consulting.com](http://chasquis-consulting.com/holodeck-b2b-support/) for more information.

pom.xml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>org.holodeckb2b.extensions</groupId>
7+
<artifactId>pullrequest-trigger</artifactId>
8+
<version>1.0.0</version>
9+
<packaging>jar</packaging>
10+
<properties>
11+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
12+
<maven.compiler.source>1.8</maven.compiler.source>
13+
<maven.compiler.target>1.8</maven.compiler.target>
14+
</properties>
15+
<name>Holodeck B2B Pull Request trigger Extension</name>
16+
<description>
17+
This project contains the Holodeck B2B extension that allows the "Consumer" application to trigger
18+
sending of a PullRequest.
19+
</description>
20+
<inceptionYear>2018</inceptionYear>
21+
<url>http://holodeck-b2b.org</url>
22+
<scm>
23+
<url>https://github.com/holodeck-b2b/pullrequest-trigger</url>
24+
<connection>scm:git:https://github.com/holodeck-b2b/pullrequest-trigger</connection>
25+
</scm>
26+
27+
<organization>
28+
<name>The Holodeck B2B Team</name>
29+
<url>http://www.holodeck-b2b.org/team</url>
30+
</organization>
31+
<developers>
32+
<developer>
33+
<name>Sander Fieten</name>
34+
<organization>Chasquis</organization>
35+
<organizationUrl>http://chasquis-consulting.com/holodeck-b2b-support/</organizationUrl>
36+
<email>sander at chasquis-consulting.com/</email>
37+
<roles>
38+
<role>Architect</role>
39+
<role>Lead developer</role>
40+
</roles>
41+
<timezone>Europe/Amsterdam</timezone>
42+
</developer>
43+
</developers>
44+
45+
<licenses>
46+
<license>
47+
<name>GNU General Public License v3</name>
48+
<url>http://www.gnu.org/licenses/gpl-3.0.html</url>
49+
</license>
50+
</licenses>
51+
52+
<dependencies>
53+
<dependency>
54+
<groupId>org.holodeckb2b</groupId>
55+
<artifactId>holodeckb2b-interfaces</artifactId>
56+
<version>4.1.0-SNAPSHOT</version>
57+
<scope>provided</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.holodeckb2b</groupId>
61+
<artifactId>holodeckb2b-core</artifactId>
62+
<version>4.1.0-SNAPSHOT</version>
63+
<scope>provided</scope>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.simpleframework</groupId>
67+
<artifactId>simple-xml</artifactId>
68+
<version>2.7.1</version>
69+
</dependency>
70+
<!-- Dependencies for testing -->
71+
<dependency>
72+
<groupId>junit</groupId>
73+
<artifactId>junit</artifactId>
74+
<scope>test</scope>
75+
<version>4.9</version>
76+
</dependency>
77+
</dependencies>
78+
79+
</project>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* Copyright (C) 2014 The Holodeck B2B Team, Sander Fieten
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
package org.holodeckb2b.ebms3.pulling.trigger.filebased;
18+
19+
import org.holodeckb2b.common.messagemodel.SelectivePullRequest;
20+
import org.holodeckb2b.interfaces.messagemodel.IAgreementReference;
21+
import org.simpleframework.xml.Attribute;
22+
import org.simpleframework.xml.Text;
23+
24+
/**
25+
* Represents the <code>AgreementRef</code> element from a Pull Request meta-data XML document.
26+
* <p>This class implements {@link IAgreementReference} so it can directly be used to create {@link
27+
* SelectivePullRequest} instances.
28+
*
29+
* @author Sander Fieten (sander at holodeck-b2b.org)
30+
*/
31+
public class AgreementReference implements IAgreementReference {
32+
33+
@Text
34+
private String name;
35+
36+
@Attribute(name = "type", required = false)
37+
private String type;
38+
39+
@Override
40+
public String getName() {
41+
return name;
42+
}
43+
44+
@Override
45+
public String getType() {
46+
return type;
47+
}
48+
49+
@Override
50+
public String getPModeId() {
51+
return null;
52+
}
53+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/**
2+
*
3+
*/
4+
package org.holodeckb2b.ebms3.pulling.trigger.filebased;
5+
6+
import org.holodeckb2b.interfaces.general.IService;
7+
import org.holodeckb2b.interfaces.messagemodel.IAgreementReference;
8+
import org.simpleframework.xml.Element;
9+
10+
/**
11+
* Represents the <code>Criteria</code> element from a Pull Request meta-data XML document. This element contains the
12+
* criteria for a <i>selective</i> Pull Request. The possible selection criteria are described in section 5.1 of the
13+
* ebMS 3 Part 2 Specification.
14+
* <p>NOTE: In the current version only the <i>simple</i> criteria are supported.
15+
*
16+
* @author Sander Fieten (sander at holodeck-b2b.org)
17+
*/
18+
public class Criteria {
19+
20+
@Element(name="RefToMessageId", required=false)
21+
private String refToMessageId;
22+
23+
@Element(name="ConversationId", required=false)
24+
private String conversationId;
25+
26+
@Element(name="AgreementRef", required=false)
27+
private AgreementReference agreementRef;
28+
29+
@Element(name="Service", required=false)
30+
private Service service;
31+
32+
@Element(name="Action", required=false)
33+
private String action;
34+
35+
/**
36+
* Gets the <i>RefToMessageId</i> selection criterion that should be included in the PullRequest.
37+
*
38+
* @return The <i>RefToMessageId</i> of the message to be pulled
39+
*/
40+
public String getReferencedMessageId() {
41+
return refToMessageId;
42+
}
43+
44+
/**
45+
* Gets the <i>ConversationId</i> selection criterion that should be included in the PullRequest.
46+
*
47+
* @return The <i>ConversationId</i> of the message to be pulled
48+
*/
49+
public String getConversationId() {
50+
return conversationId;
51+
}
52+
53+
/**
54+
* Gets the <i>Agreement Reference</i> selection criterion that should be included in the PullRequest.
55+
*
56+
* @return The <i>Agreement Reference</i> of the message to be pulled
57+
*/
58+
public IAgreementReference getAgreementRef() {
59+
return agreementRef;
60+
}
61+
62+
/**
63+
* Gets the <i>Service</i> selection criterion that should be included in the PullRequest.
64+
*
65+
* @return The <i>Service</i> of the message to be pulled
66+
*/
67+
public IService getService() {
68+
return service;
69+
}
70+
71+
/**
72+
* Gets the <i>Action</i> selection criterion that should be included in the PullRequest.
73+
*
74+
* @return The <i>Action</i> of the message to be pulled
75+
*/
76+
public String getAction() {
77+
return action;
78+
}
79+
}

0 commit comments

Comments
 (0)