From 9aec28b7a8a21fe58543da786a5ad492cdce1de5 Mon Sep 17 00:00:00 2001 From: Jorge Garcia Perez Date: Mon, 6 Jun 2016 11:28:22 -0300 Subject: [PATCH 1/3] Updated to DevKit 3.7.3 --- CHANGELOG.md | 17 + LICENSE_HEADER.txt | 8 - README.adoc | 526 ++++++++++++++++++ README.md | 241 -------- doc/mule-module-git.xml.sample | 41 -- icons/git-connector-24x16.png | Bin 1624 -> 1033 bytes icons/git-connector-48x32.png | Bin 5149 -> 2124 bytes pom.xml | 65 +-- .../org/mule/modules/git/GitConnector.java | 419 ++++++++++++++ .../modules/git/config/ConnectorConfig.java | 86 +++ src/main/resources/log4j2.xml | 16 + 11 files changed, 1082 insertions(+), 337 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 LICENSE_HEADER.txt create mode 100644 README.adoc delete mode 100644 README.md delete mode 100644 doc/mule-module-git.xml.sample create mode 100644 src/main/java/org/mule/modules/git/GitConnector.java create mode 100644 src/main/java/org/mule/modules/git/config/ConnectorConfig.java create mode 100644 src/main/resources/log4j2.xml diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..81b4a90 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# Git Release Notes +# -------------------------------------------------------------------- +# Date: +Example: 24-Jan-2015 +# Version: (default value: 0.1) +# Supported API versions: +Example: Salesforce Bulk API v.28, SOAP API V.28 (include links to API docs) +# Supported Mule Runtime Versions: +${project.devkitVersion} +# New Features and Functionality +(default value: Initial version) +Example: Added support for Query. http://github.com/mulesoft/git/issues/61 +# Closed Issues in this release +(include issue link when possible) +Example: Fixed problem with lost telefone on Bulk Update (CLDCONNECT-123). +# Known Issues in this release +Example: Session ID expires after 30 days. http://github.com/mulesoft/git/issues/62 diff --git a/LICENSE_HEADER.txt b/LICENSE_HEADER.txt deleted file mode 100644 index cbfcdf4..0000000 --- a/LICENSE_HEADER.txt +++ /dev/null @@ -1,8 +0,0 @@ -Mule Git Connector - -Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com - -The software in this package is published under the terms of the CPAL v1.0 -license, a copy of which has been included with this distribution in the -LICENSE.txt file. - diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..34b9624 --- /dev/null +++ b/README.adoc @@ -0,0 +1,526 @@ + +:toc: left +:toc-title: Connector Summary +:toclevels: 2 +:last-update-label!: +:docinfo: +:source-highlighter: coderay +:icons: font + + += Git Connector API Reference + + +*Additional Info* +[width="50", cols=".<60%,^40%" ] +|====================== +| Requires Mule Enterprise License | No icon:remove[] {nbsp} +| Requires Entitlement | No icon:remove[] {nbsp} +| Mule Version | 3.5.0 or higher +|====================== + + +== Configs +--- +=== Git Configuration +`` + + +`Connection Management` + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +| Name | Java Type | Description | Default Value | Required +|name | +++String+++ | The name of this configuration. With this name can be later referenced. | | *x*{nbsp} +| username | +++String+++ | +++A username+++ | | *x*{nbsp} +| password | +++String+++ | +++A password+++ | | *x*{nbsp} +| directory | +++String+++ | +++Default repository base directory+++ | | {nbsp} +|====================== + + + +== Processors + +--- + +=== Clone repository +`` + + + + ++++ +Clone a repository into a new directory or resset it if it exists +../../../doc/mule-module-git.xml.sample git:clone ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +uri | +++String+++ | +++The (possibly remote) repository to clone from.+++ | | *x*{nbsp} + + + + +| +bare | +++boolean+++ | +++True if you want a bare Git repository, false otherwise.+++ | false | {nbsp} + + + + +| +remote | +++String+++ | +++Name of the remote to keep track of the upstream repository.+++ | origin | {nbsp} + + + + +| +branch | +++String+++ | +++Name of the local branch into which the remote will be cloned.+++ | HEAD | {nbsp} + + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Reset repository +`` + + + + + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +branch | +++String+++ | ++++++ | HEAD | {nbsp} + + + + +| +overrideDirectory | +++String+++ | ++++++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Add +`` + + + + ++++ +Add file contents to the index +../../../doc/mule-module-git.xml.sample git:add ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +filePatterns | +++String+++ | +++List of file patterns to add content from. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be given to add all files in the directory, recursively. Use semicolon (";") to separete patterns+++ | | {nbsp} + + + + +| +forceAll | +++boolean+++ | +++Add all files+++ | false | {nbsp} + + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Create branch +`` + + + + ++++ +Create a local branch +../../../doc/mule-module-git.xml.sample git:create-branch ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +branchName | +++String+++ | +++Name of the new branch+++ | | *x*{nbsp} + + + + +| +force | +++boolean+++ | +++If true and the branch with the given name already exists, the start-point of an existing branch will be set to a new start-point; if false, the existing branch will not be changed.+++ | false | {nbsp} + + + + +| +startPoint | +++String+++ | +++The new branch head will point to this commit. It may be given as a branch name, a commit-id, or a tag. If this option is omitted, the current HEAD will be used instead.+++ | HEAD | {nbsp} + + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Delete branch +`` + + + + ++++ +Delete local branch +../../../doc/mule-module-git.xml.sample git:delete-branch ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +branchName | +++String+++ | +++Name of the branch to delete+++ | | *x*{nbsp} + + + + +| +force | +++boolean+++ | +++If false a check will be performed whether the branch to be deleted is already merged into the current branch and deletion will be refused in this case+++ | | *x*{nbsp} + + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Commit +`` + + + + ++++ +Record changes to the repository +../../../doc/mule-module-git.xml.sample git:commit ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +msg | +++String+++ | +++Commit message+++ | | *x*{nbsp} + + + + +| +committerName | +++String+++ | +++Name of the person performing this commit+++ | | *x*{nbsp} + + + + +| +committerEmail | +++String+++ | +++Email of the person performing this commit+++ | | *x*{nbsp} + + + + +| +authorName | +++String+++ | +++Name of the author of the changes to commit+++ | | {nbsp} + + + + +| +authorEmail | +++String+++ | +++Email of the author of the changes to commit+++ | | {nbsp} + + + + +| +all | +++boolean+++ | +++If set to true the Commit command automatically stages files that have been modified and deleted, but new files not known by the repository are not affected.+++ | false | {nbsp} + + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Push +`` + + + + ++++ +Update remote refs along with associated objects +../../../doc/mule-module-git.xml.sample git:push ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +remote | +++String+++ | +++The remote (uri or name) used for the push operation.+++ | origin | {nbsp} + + + + +| +force | +++boolean+++ | +++Sets the force preference for push operation+++ | false | {nbsp} + + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Pull +`` + + + + ++++ +Fetch from and merge with another repository or a local branch +../../../doc/mule-module-git.xml.sample git:pull ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Fetch +`` + + + + ++++ +Fetch changes from another repository +../../../doc/mule-module-git.xml.sample git:fetch ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + +--- + +=== Checkout +`` + + + + ++++ +Checkout a local branch or create a local branch from a remote branch +../../../doc/mule-module-git.xml.sample git:checkout +or +../../../doc/mule-module-git.xml.sample git:checkout ++++ + + + + +==== Attributes +[cols=".^20%,.^20%,.^35%,.^20%,^.^5%", options="header"] +|====================== +|Name |Java Type | Description | Default Value | Required +| config-ref | +++String+++ | Specify which config to use | |*x*{nbsp} + + + +| +branch | +++String+++ | +++Name of the branch to checkout+++ | | *x*{nbsp} + + + + +| +startPoint | +++String+++ | +++If specified creates a new branch pointing to this startPoint+++ | | {nbsp} + + + + +| +overrideDirectory | +++String+++ | +++Name of the directory to use for git repository+++ | | {nbsp} + + +|====================== + + + + + + + + + + + + + + + diff --git a/README.md b/README.md deleted file mode 100644 index 8879c7a..0000000 --- a/README.md +++ /dev/null @@ -1,241 +0,0 @@ -Mule Git Connector -================== - -Git is a free and open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. This connector will allow to interact with Git repositories. - -Installation ------------- - -The connector can either be installed for all applications running within the Mule instance or can be setup to be used -for a single application. - -*All Applications* - -Download the connector from the link above and place the resulting jar file in -/lib/user directory of the Mule installation folder. - -*Single Application* - -To make the connector available only to single application then place it in the -lib directory of the application otherwise if using Maven to compile and deploy -your application the following can be done: - -Add the connector's maven repo to your pom.xml: - - - - muleforge-releases - MuleForge Releases Repository - https://repository.muleforge.org/releases/ - default - - - -Add the connector as a dependency to your project. This can be done by adding -the following under the dependencies element in the pom.xml file of the -application: - - - org.mule.modules - mule-module-git - 1.4-SNAPSHOT - - -Configuration -------------- - -You can configure the connector as follows: - - - -Here is detailed list of all the configuration attributes: - -| attribute | description | optional | default value | -|:-----------|:-----------|:---------|:--------------| -|name|Give a name to this configuration so it can be later referenced by config-ref.|yes|| -|directory|Directory of your git repository|no| - - -Clone ------ - -Clone a repository into a new directory - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|uri| The (possibly remote) repository to clone from.|no|| -|bare| True if you want a bare Git repository, false otherwise.|yes|false| -|remote| Name of the remote to keep track of the upstream repository.|yes|origin| -|branch| Name of the local branch into which the remote will be cloned.|yes|HEAD| -|overrideDirectory| Name of the directory to use for git repository|yes|| - -Add ---- - -Add file contents to the index - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|filePattern| File to add content from. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be given to add all files in the directory, recursively.|no|| -|overrideDirectory| Name of the directory to use for git repository|yes|| - -Create Branch -------------- - -Create a local branch - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|name| Name of the new branch|no|| -|force| If true and the branch with the given name already exists, the start-point of an existing branch will be set to a new start-point; if false, the existing branch will not be changed.|yes|false| -|startPoint| The new branch head will point to this commit. It may be given as a branch name, a commit-id, or a tag. If this option is omitted, the current HEAD will be used instead.|yes|HEAD| -|overrideDirectory| Name of the directory to use for git repository|yes|| - -Delete Branch -------------- - -Delete local branch - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|name| Name of the branch to delete|no|| -|force| If false a check will be performed whether the branch to be deleted is already merged into the current branch and deletion will be refused in this case|no|| -|overrideDirectory| Name of the directory to use for git repository|yes|| - -Commit ------- - -Record changes to the repository - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|msg| Commit message|no|| -|committerName| Name of the person performing this commit|no|| -|committerEmail| Email of the person performing this commit|no|| -|authorName| Name of the author of the changes to commit|yes|| -|authorEmail| Email of the author of the changes to commit|yes|| -|overrideDirectory| Name of the directory to use for git repository|yes|| - -Push ----- - -Update remote refs along with associated objects - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|remote| The remote (uri or name) used for the push operation.|yes|origin| -|force| Sets the force preference for push operation|yes|false| -|overrideDirectory| Name of the directory to use for git repository|yes|| - -Pull ----- - -Fetch from and merge with another repository or a local branch - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|overrideDirectory| Name of the directory to use for git repository|yes|| - -Fetch ------ - -Fetch changes from another repository - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|overrideDirectory| Name of the directory to use for git repository|yes|| - -Checkout --------- - -Checkout a local branch or create a local branch from a remote branch - - - -or - - - - - - - -| attribute | description | optional | default value | possible values | -|:-----------|:-----------|:---------|:--------------|:----------------| -|config-ref|Specify which configuration to use for this invocation|yes|| -|branch| Name of the branch to checkout|no|| -|startPoint| If specified creates a new branch pointing to this startPoint|yes|| -|overrideDirectory| Name of the directory to use for git repository|yes|| - - - - - - - - - - - - - - - diff --git a/doc/mule-module-git.xml.sample b/doc/mule-module-git.xml.sample deleted file mode 100644 index c157c48..0000000 --- a/doc/mule-module-git.xml.sample +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/icons/git-connector-24x16.png b/icons/git-connector-24x16.png index e8650be7b8181d18c37b1cbd67480209c0d60e98..2155eb2f1412542bbc24a071e90a05d167f21f4e 100644 GIT binary patch delta 1011 zcmV={mM7QeDfCC=Lx*KUFJ05U{Po}wxxRkfH?c*|M_79lIihGG z!dkYO!IebmZGY>F*K~(OK|HuXU-zIB$=ki6GN%4;5+dLSFxXUcGKO)PJn2(A#FVSyz-vvD2I*K zwCo9dT5Nmbn-|jEoeJNBKWzSWXM~vvv)ZLUkF^@}i&H!&2<+q-c{-msTgVLcrzEBHjbuWv; z@8IhM^2O2h>D8yM^kEk@*wc*zV-JXJ5+IrU+39=aTLr{BCn(vMsPZGaRgM^1a-mpS ze&+t~_S&jaX7SV)$=aOivE`?=M<@GX?w}*f~b=i&1ubGxZD{4Xai|Qr1u^MhPr0 z?CoVri)>b=vo%{FhNeagy}BRTyzYf;)frB}X+D_bpdhXo*EF@7$>_05H*+p(J{g*y z4}VjT*AB&TLRt`S>Y$*(Bz9!{0=RIsq`AbdlKAy1ogQiue2DkiZ-wV1j~Lhz3L9E zsvWCre_dtz(X;J}W(v8Cb1OLK!+BQ>^=vwW=lZ594URH{y+A$oJ%jMC~ou239kwQe*oWfE^%MuXQ=Y+MoSzhbl3; hTK%Z=f01AZ$lsD~@Np^mauomo002ovPDHLkV1hmp?)?A& literal 1624 zcmbVMX;2eq7!HRRv3N9E(9yDn@j{b5LPB;+#3Y+Y)F6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6%AC;F!lKp&Y)h&^J0-g} z?~^Mo@qDb~JJCUjsHY2YeHh$_&g9U81tYb?A3_+STHA3CW4xwnXb?jw(i9^oMw$pH zMG$B>Fka%8Ctf0mqN(-3(_7wUb>~7nOA{m!6@%#-Y!wrWptXsQG&ZEJ0q=^n00fV( zCmtK4eCG{dS*XN)(%fc@pGKQhv2<+KF*QRqGmT=62n3O#^tOG2tb6(u#!BTw3z|3I z@8{W`KEByGpK=VA=tKpm)BwH(TA5g}Wg4BnzXn7I9{U60dPbe1GOA@Z-nyyAYap7G zT9;!8B3((V(;Z0D?kBhWhrhnv%a)z}QUjgvF*0i&nRT0xrq+ZW)f!+t(i9V#OoY|n%appgjy5D5XQPvouw68ka*gR8IVD2Dzu+I@=S#?M+9JcJHEAndoEu^ zeb&WE08G~E^h!mh1!aT@%qS))?jh6(khofAh6(pW4f_s^^3bbYJm0hZ@FnGu005}< zU4D7V*?fLptMR;|>iv{j(^UmctWDgcAnt#;i@gU%IA=)*zT*&S7@jE8yMKu8-Tl12 zeb>h;>W>sa+Rk0l!S_}!qqVNKT7*;%9}^qq@Y5ANk2Sotv!C^^b{!IoM|~@Cv;fjJ zKi|NaCobf;d_5=4Zaw6*)EfE*hUnf^;Dw&;?D*i=Trqy4i>=9R#|J~~cyVaj9cevT z&t>bL0-ttMD;KmL^GSCOeE5Gcz9U~}lFc8Vv6RnRJ9TazK>j-bCN&%}iesu?00000 LNkvXXu0mjfW6HTk diff --git a/pom.xml b/pom.xml index 317904e..e857ef1 100644 --- a/pom.xml +++ b/pom.xml @@ -1,65 +1,33 @@ - - org.mule.tools.devkit - mule-devkit-parent - 3.3.1 - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.mule.modules mule-module-git + 2.3.0-SNAPSHOT mule-module - Mule Git Connector - 2.2-SNAPSHOT - Git is a free and open source, distributed version control system designed to handle everything from - small to very large projects with speed and efficiency. This connector will allow to interact with Git - repositories. - - http://www.muleforge.org/projects/mule-module-git + Mule Git Anypoint Connector - - false - + + org.mule.tools.devkit + mule-devkit-parent + 3.8.0 + org.eclipse.jgit org.eclipse.jgit - 1.3.0 - - - - com.sun.jersey - jersey-client - 1.3 + 4.3.0.201604071810-r - - - org.mule.transports - mule-transport-axis - ${mule.version} - - - - org.mule.transports - mule-transport-vm - ${mule.version} - test - - - - scm:git:git://github.com:mulesoft/git-connector.git - - - scm:git:git@github.com:mulesoft/git-connector.git - - http://github.com/mulesoft/git-connector - - + + Community + LICENSE.md + false + mulesoft-releases @@ -67,6 +35,9 @@ http://repository.mulesoft.org/releases/ default + + jgit-repository + https://repo.eclipse.org/content/groups/releases/ + - diff --git a/src/main/java/org/mule/modules/git/GitConnector.java b/src/main/java/org/mule/modules/git/GitConnector.java new file mode 100644 index 0000000..1b28634 --- /dev/null +++ b/src/main/java/org/mule/modules/git/GitConnector.java @@ -0,0 +1,419 @@ +package org.mule.modules.git; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.jgit.api.AddCommand; +import org.eclipse.jgit.api.CheckoutCommand; +import org.eclipse.jgit.api.CloneCommand; +import org.eclipse.jgit.api.CommitCommand; +import org.eclipse.jgit.api.CreateBranchCommand; +import org.eclipse.jgit.api.DeleteBranchCommand; +import org.eclipse.jgit.api.FetchCommand; +import org.eclipse.jgit.api.Git; +import org.eclipse.jgit.api.PullCommand; +import org.eclipse.jgit.api.PushCommand; +import org.eclipse.jgit.api.ResetCommand.ResetType; +import org.eclipse.jgit.lib.Repository; +import org.eclipse.jgit.storage.file.FileRepositoryBuilder; +import org.mule.api.annotations.Config; +import org.mule.api.annotations.Connector; +import org.mule.api.annotations.Processor; +import org.mule.api.annotations.param.Default; +import org.mule.api.annotations.param.Optional; +import org.mule.modules.git.config.ConnectorConfig; + +@Connector(name = "git", friendlyName = "Git") +public class GitConnector { + + @Config + ConnectorConfig config; + + /** + * Clone a repository into a new directory or resset it if it exists + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:clone} + * + * @param uri + * The (possibly remote) repository to clone from. + * @param bare + * True if you want a bare Git repository, false otherwise. + * @param remote + * Name of the remote to keep track of the upstream repository. + * @param branch + * Name of the local branch into which the remote will be cloned. + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void cloneRepository(String uri, @Default("false") boolean bare, @Default("origin") String remote, @Default("HEAD") String branch, + @Optional String overrideDirectory) { + File dir = resolveDirectory(overrideDirectory); + boolean dirExists = dir.exists(); + + if (!dirExists) { + if (!dir.mkdirs()) { + throw new RuntimeException("Directory " + dir.getAbsolutePath() + " cannot be created"); + } + } + Git git = null; + try { + if (dirExists) { + git = Git.open(dir); + git.log().setMaxCount(1).call(); + } else { + CloneCommand cloneCommand = Git.cloneRepository(); + cloneCommand.setCredentialsProvider(config.getCredentialsProvider()); + cloneCommand.setBare(bare); + cloneCommand.setDirectory(dir); + cloneCommand.setRemote(remote); + cloneCommand.setBranch(branch); + cloneCommand.setURI(uri); + git = cloneCommand.call(); + } + } catch (Exception e) { + throw new RuntimeException("Cannot clone or open repository", e); + } finally { + if (git != null) { + git.close(); + } + } + + } + + @Processor + public void resetRepository(@Default("HEAD") String branch, @Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + try { + git.reset().setMode(ResetType.HARD).setRef(branch).call(); + } catch (Exception e) { + throw new RuntimeException("Cannot reset repository", e); + } finally { + if (git != null) { + git.close(); + } + } + } + + /** + * Add file contents to the index + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:add} + * + * @param filePatterns + * List of file patterns to add content from. Also a leading directory name (e.g. dir to add dir/file1 and dir/file2) can be given to add all + * files in the directory, recursively. Use semicolon (";") to separete patterns + * @param forceAll + * Add all files + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void add(@Optional String filePatterns, @Default("false") boolean forceAll, @Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + try { + AddCommand add = git.add(); + if (filePatterns != null) { + for (String file : filePatterns.split(";")) { + if (!file.trim().isEmpty()) { + add.addFilepattern(file.trim()); + } + } + } + if (forceAll) { + add.addFilepattern("."); + } + add.call(); + } catch (Exception e) { + throw new RuntimeException("Cannot add " + filePatterns, e); + } finally { + if (git != null) { + git.close(); + } + } + } + + /** + * Create a local branch + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:create-branch} + * + * @param branchName + * Name of the new branch + * @param force + * If true and the branch with the given name already exists, the start-point of an existing branch will be set to a new start-point; if false, + * the existing branch will not be changed. + * @param startPoint + * The new branch head will point to this commit. It may be given as a branch name, a commit-id, or a tag. If this option is omitted, the current + * HEAD will be used instead. + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void createBranch(String branchName, @Default("false") boolean force, @Default("HEAD") String startPoint, @Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + try { + CreateBranchCommand createBranch = git.branchCreate(); + createBranch.setName(branchName); + createBranch.setForce(force); + createBranch.setStartPoint(startPoint); + createBranch.call(); + git.close(); + } catch (Exception e) { + throw new RuntimeException("Unable to create branch " + branchName, e); + } finally { + if (git != null) { + git.close(); + } + } + } + + /** + * Delete local branch + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:delete-branch} + * + * @param branchName + * Name of the branch to delete + * @param force + * If false a check will be performed whether the branch to be deleted is already merged into the current branch and deletion will be refused in + * this case + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void deleteBranch(String branchName, boolean force, @Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + try { + DeleteBranchCommand deleteBranch = git.branchDelete(); + deleteBranch.setBranchNames(branchName); + deleteBranch.setForce(force); + + deleteBranch.call(); + } catch (Exception e) { + throw new RuntimeException("Unable to create branch " + branchName, e); + } finally { + if (git != null) { + git.close(); + } + } + } + + /** + * Record changes to the repository + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:commit} + * + * @param msg + * Commit message + * @param committerName + * Name of the person performing this commit + * @param committerEmail + * Email of the person performing this commit + * @param authorName + * Name of the author of the changes to commit + * @param authorEmail + * Email of the author of the changes to commit + * @param all + * If set to true the Commit command automatically stages files that have been modified and deleted, but new files not known by the repository + * are not affected. + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void commit(String msg, String committerName, String committerEmail, @Optional String authorName, @Optional String authorEmail, + @Default("false") boolean all, @Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + + try { + CommitCommand commit = git.commit(); + if (authorName != null && authorEmail != null) { + commit.setAuthor(authorName, authorEmail); + } + + commit.setCommitter(committerName, committerEmail); + commit.setMessage(msg); + commit.setAll(all); + + commit.call(); + } catch (Exception e) { + throw new RuntimeException("Unable to commit", e); + } finally { + if (git != null) { + git.close(); + } + } + } + + /** + * Update remote refs along with associated objects + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:push} + * + * @param remote + * The remote (uri or name) used for the push operation. + * @param force + * Sets the force preference for push operation + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void push(@Default("origin") String remote, @Default("false") boolean force, @Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + + try { + PushCommand push = git.push(); + push.setCredentialsProvider(config.getCredentialsProvider()); + push.setRemote(remote); + push.setForce(force); + + push.call(); + } catch (Exception e) { + throw new RuntimeException("Unable to push to " + remote, e); + } finally { + if (git != null) { + git.close(); + } + } + + } + + /** + * Fetch from and merge with another repository or a local branch + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:pull} + * + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void pull(@Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + + try { + PullCommand pull = git.pull(); + pull.setCredentialsProvider(config.getCredentialsProvider()); + + pull.call(); + } catch (Exception e) { + throw new RuntimeException("Unable to pull", e); + } finally { + if (git != null) { + git.close(); + } + } + } + + /** + * Fetch changes from another repository + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:fetch} + * + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void fetch(@Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + + try { + FetchCommand fetch = git.fetch(); + fetch.setCredentialsProvider(config.getCredentialsProvider()); + + fetch.call(); + } catch (Exception e) { + throw new RuntimeException("Unable to fetch", e); + } finally { + if (git != null) { + git.close(); + } + } + } + + /** + * Checkout a local branch or create a local branch from a remote branch + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:checkout} + * + * or + * + * {@sample.xml ../../../doc/mule-module-git.xml.sample git:checkout} + * + * @param startPoint + * If specified creates a new branch pointing to this startPoint + * @param branch + * Name of the branch to checkout + * @param overrideDirectory + * Name of the directory to use for git repository + */ + @Processor + public void checkout(String branch, @Optional String startPoint, @Optional String overrideDirectory) { + Git git = getGitIntance(overrideDirectory); + + try { + CheckoutCommand checkout = git.checkout(); + + checkout.setName(branch); + if (startPoint != null) { + checkout.setCreateBranch(true); + checkout.setStartPoint(startPoint); + } + + checkout.call(); + } catch (Exception e) { + throw new RuntimeException("Unable to fetch", e); + } finally { + if (git != null) { + git.close(); + } + } + } + + /** + * Depending on the value of overrideDirectory, it returns the directory to use as the git repo. + * + * @param overrideDirectory + * path or null if default is required + * @return file pointing to repository directory to use + */ + private File resolveDirectory(String overrideDirectory) { + File dir; + if (overrideDirectory == null) { + dir = new File(config.getDirectory()); + } else { + dir = new File(overrideDirectory); + } + return dir; + } + + // private Repository getGitRepo(String overrideDirectory) throws IOException { + // File dir = resolveDirectory(overrideDirectory); + // if (!dir.exists()) { + // throw new RuntimeException("Directory " + dir.getAbsolutePath() + " does not exists"); + // } + // + // FileRepositoryBuilder builder = new FileRepositoryBuilder(); + // Repository repository = builder.setGitDir(dir).readEnvironment().findGitDir().build(); + // return repository; + // } + + private Git getGitIntance(String overrideDirectory) { + File dir = resolveDirectory(overrideDirectory); + Git git = null; + try { + git = Git.open(dir); + } catch (IOException e) { + throw new RuntimeException("Could not open Git repository", e); + } + return git; + } + + public ConnectorConfig getConfig() { + return config; + } + + public void setConfig(ConnectorConfig config) { + this.config = config; + } + +} \ No newline at end of file diff --git a/src/main/java/org/mule/modules/git/config/ConnectorConfig.java b/src/main/java/org/mule/modules/git/config/ConnectorConfig.java new file mode 100644 index 0000000..b321c0b --- /dev/null +++ b/src/main/java/org/mule/modules/git/config/ConnectorConfig.java @@ -0,0 +1,86 @@ +package org.mule.modules.git.config; + +import org.eclipse.jgit.transport.CredentialsProvider; +import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; +import org.mule.api.ConnectionException; +import org.mule.api.annotations.Configurable; +import org.mule.api.annotations.Connect; +import org.mule.api.annotations.ConnectionIdentifier; +import org.mule.api.annotations.Disconnect; +import org.mule.api.annotations.TestConnectivity; +import org.mule.api.annotations.ValidateConnection; +import org.mule.api.annotations.components.ConnectionManagement; +import org.mule.api.annotations.display.Password; +import org.mule.api.annotations.param.ConnectionKey; +import org.mule.api.annotations.param.Optional; + +@ConnectionManagement(friendlyName = "Git Configuration") +public class ConnectorConfig { + + private String username; + private String password; + + /** + * Default repository base directory + */ + @Configurable + @Optional + private String directory; + + /** + * Connect + * + * @param username + * A username + * @param password + * A password + * @throws ConnectionException + */ + @Connect + @TestConnectivity + public void connect(@ConnectionKey String username, @Password String password) throws ConnectionException { + this.username = username; + this.password = password; + + } + + /** + * Disconnect + */ + @Disconnect + public void disconnect() { + this.username = null; + this.password = null; + } + + /** + * Are we connected + */ + @ValidateConnection + public boolean isConnected() { + // TODO: Change it to reflect that we are connected. + return username != null && password != null; + } + + /** + * Are we connected + */ + @ConnectionIdentifier + public String connectionId() { + return "001"; + } + + public CredentialsProvider getCredentialsProvider() { + CredentialsProvider credentialsProvider = new UsernamePasswordCredentialsProvider(username, password); + return credentialsProvider; + } + + public String getDirectory() { + return directory; + } + + public void setDirectory(String directory) { + this.directory = directory; + } + +} \ No newline at end of file diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml new file mode 100644 index 0000000..dcdf122 --- /dev/null +++ b/src/main/resources/log4j2.xml @@ -0,0 +1,16 @@ + + + + %-5level %d [%t] %c:%M(%L): %m%n + + + + + + + + + + + + \ No newline at end of file From 768e1d24ed5dbfc726ae36ca03793ab96af01730 Mon Sep 17 00:00:00 2001 From: Jorge Garcia Perez Date: Mon, 6 Jun 2016 11:31:20 -0300 Subject: [PATCH 2/3] Added LICENSE_HEADER.txt --- LICENSE_HEADER.txt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 LICENSE_HEADER.txt diff --git a/LICENSE_HEADER.txt b/LICENSE_HEADER.txt new file mode 100644 index 0000000..cbfcdf4 --- /dev/null +++ b/LICENSE_HEADER.txt @@ -0,0 +1,8 @@ +Mule Git Connector + +Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com + +The software in this package is published under the terms of the CPAL v1.0 +license, a copy of which has been included with this distribution in the +LICENSE.txt file. + From fa3d7b42959afd568e04a9a605a37089331c4da8 Mon Sep 17 00:00:00 2001 From: Jorge Garcia Perez Date: Mon, 6 Jun 2016 11:36:28 -0300 Subject: [PATCH 3/3] Added CHANGELOG.md --- CHANGELOG.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81b4a90..5479b16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,17 +1,14 @@ # Git Release Notes # -------------------------------------------------------------------- -# Date: -Example: 24-Jan-2015 -# Version: (default value: 0.1) -# Supported API versions: -Example: Salesforce Bulk API v.28, SOAP API V.28 (include links to API docs) +# Date: +06-Jun-2016 +# Version: +2.3.0 # Supported Mule Runtime Versions: ${project.devkitVersion} # New Features and Functionality -(default value: Initial version) -Example: Added support for Query. http://github.com/mulesoft/git/issues/61 +Updated to run on Mule Runtime ${project.devkitVersion} # Closed Issues in this release -(include issue link when possible) -Example: Fixed problem with lost telefone on Bulk Update (CLDCONNECT-123). +None # Known Issues in this release -Example: Session ID expires after 30 days. http://github.com/mulesoft/git/issues/62 +None