branch feature/GIT updated (dfbf300 -> d992d03)
This is an automated email from the git hooks/post-receive script. New change to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git from dfbf300 The path where the local repositories will be stored is directly given to the providers, instead of giving the session ID only new d992d03 Add classes so that each struts action calls a different class and changed the method names so that each action calls the execute() method The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit d992d034a718207b30f721410ddc83b042110d65 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed May 13 16:07:34 2015 +0200 Add classes so that each struts action calls a different class and changed the method names so that each action calls the execute() method Summary of changes: .../scmwebeditor/uiweb/actions/BrowseAction.java | 56 +------------- .../uiweb/actions/DetectScmAction.java | 69 +++++++++++++++++ .../scmwebeditor/uiweb/actions/EditAction.java | 2 +- .../uiweb/actions/ListBranchesAction.java | 90 ++++++++++++++++++++++ .../scmwebeditor/uiweb/actions/SaveAction.java | 5 +- swe-ui-web/src/main/resources/struts.xml | 28 +++---- .../webapp/WEB-INF/content/modificationViewer.jsp | 23 ------ 7 files changed, 175 insertions(+), 98 deletions(-) create mode 100644 swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/DetectScmAction.java create mode 100644 swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ListBranchesAction.java -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/GIT in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit d992d034a718207b30f721410ddc83b042110d65 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed May 13 16:07:34 2015 +0200 Add classes so that each struts action calls a different class and changed the method names so that each action calls the execute() method --- .../scmwebeditor/uiweb/actions/BrowseAction.java | 56 +------------- .../uiweb/actions/DetectScmAction.java | 69 +++++++++++++++++ .../scmwebeditor/uiweb/actions/EditAction.java | 2 +- .../uiweb/actions/ListBranchesAction.java | 90 ++++++++++++++++++++++ .../scmwebeditor/uiweb/actions/SaveAction.java | 5 +- swe-ui-web/src/main/resources/struts.xml | 28 +++---- .../webapp/WEB-INF/content/modificationViewer.jsp | 23 ------ 7 files changed, 175 insertions(+), 98 deletions(-) diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/BrowseAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/BrowseAction.java index e7aa635..4ebcae9 100644 --- a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/BrowseAction.java +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/BrowseAction.java @@ -21,14 +21,12 @@ */ package org.nuiton.scmwebeditor.uiweb.actions; -import com.google.common.collect.Lists; import com.jgeppert.struts2.jquery.tree.result.TreeNode; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.shiro.codec.Base64; import org.apache.shiro.crypto.BlowfishCipherService; import org.apache.struts2.interceptor.ServletResponseAware; -import org.nuiton.scmwebeditor.api.OperationNotSupportedException; import org.nuiton.scmwebeditor.api.ScmConnection; import org.nuiton.scmwebeditor.api.ScmProvider; import org.nuiton.scmwebeditor.api.ScmWebEditorConfig; @@ -78,8 +76,6 @@ public class BrowseAction extends AbstractScmWebEditorAction implements ServletR protected boolean scmSupportsBranches; - protected String detectedScm; - protected transient HttpServletResponse response; public boolean getError() { return error; } @@ -124,13 +120,7 @@ public class BrowseAction extends AbstractScmWebEditorAction implements ServletR public void setScmSupportsBranches(boolean scmSupportsBranches) { this.scmSupportsBranches = scmSupportsBranches; } - public String getDetectedScm() { return detectedScm; } - - public void setDetectedScm(String detectedScm) { - this.detectedScm = detectedScm; - } - - public String browse() { + public String execute() { if (log.isDebugEnabled()) { log.debug("Enter in browse action"); @@ -266,50 +256,6 @@ public class BrowseAction extends AbstractScmWebEditorAction implements ServletR return SUCCESS; } - public String listBranchesJSON() { - - if (username == null) { - username = "anonymous"; - } - if (pw == null) { - pw = "anonymous"; - } - - ScmProvider provider = ScmWebEditorConfig.getProvider(scmType); - - scmSupportsBranches = provider.supportsBranches(); - - try { - branches = provider.listBranches(address, username, pw); - } catch (OperationNotSupportedException e) { - if (log.isDebugEnabled()) { - log.debug("The SCM " + scmType + " does not support branches", e); - } - } - - return SUCCESS; - } - - public String detectScm() { - - List<String> supportedScms = Lists.newArrayList(ScmWebEditorConfig.getProviders().keySet()); - - for (String scm : supportedScms) { - - ScmProvider provider = ScmWebEditorConfig.getProvider(scm); - - if (provider.addressSeemsCompatible(address)) { - detectedScm = scm; - - return SUCCESS; - } - } - - detectedScm = null; - - return SUCCESS; - } - public List<TreeNode> getNodes() { return nodes; } diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/DetectScmAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/DetectScmAction.java new file mode 100644 index 0000000..740e838 --- /dev/null +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/DetectScmAction.java @@ -0,0 +1,69 @@ +/* + * #%L + * ScmWebEditor + * %% + * Copyright (C) 2009 - 2015 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.scmwebeditor.uiweb.actions; + +import com.google.common.collect.Lists; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.scmwebeditor.api.ScmProvider; +import org.nuiton.scmwebeditor.api.ScmWebEditorConfig; + +import java.util.List; + +public class DetectScmAction extends AbstractScmWebEditorAction { + + private static final Log log = LogFactory.getLog(DetectScmAction.class); + + protected String address; + + protected String detectedScm; + + + public String getAddress() { return address; } + + public void setAddress(String address) { this.address = address; } + + public String getDetectedScm() { return detectedScm; } + + public void setDetectedScm(String detectedScm) { this.detectedScm = detectedScm; } + + + public String execute() { + + List<String> supportedScms = Lists.newArrayList(ScmWebEditorConfig.getProviders().keySet()); + + for (String scm : supportedScms) { + + ScmProvider provider = ScmWebEditorConfig.getProvider(scm); + + if (provider.addressSeemsCompatible(address)) { + detectedScm = scm; + + return SUCCESS; + } + } + + detectedScm = null; + + return SUCCESS; + } +} diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java index a373bad..b71fcd5 100644 --- a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/EditAction.java @@ -41,7 +41,7 @@ public class EditAction extends ScmWebEditorMainAction { this.scmSupportsBranches = scmSupportsBranches; } - public String edit() { + public String execute() { HttpSession session = request.getSession(); String sessionId = session.getId(); diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ListBranchesAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ListBranchesAction.java new file mode 100644 index 0000000..b21dad0 --- /dev/null +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/ListBranchesAction.java @@ -0,0 +1,90 @@ +/* + * #%L + * ScmWebEditor + * %% + * Copyright (C) 2009 - 2015 CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.scmwebeditor.uiweb.actions; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.scmwebeditor.api.OperationNotSupportedException; +import org.nuiton.scmwebeditor.api.ScmProvider; +import org.nuiton.scmwebeditor.api.ScmWebEditorConfig; + +import java.util.List; + +public class ListBranchesAction extends AbstractScmWebEditorAction { + + private static final Log log = LogFactory.getLog(ListBranchesAction.class); + + protected String address; + + protected boolean scmSupportsBranches; + + protected List<String> branches; + + protected String username; + + protected String pw; + + + public String getAddress() { return address; } + + public void setAddress(String address) { this.address = address; } + + public boolean isScmSupportsBranches() { return scmSupportsBranches; } + + public void setScmSupportsBranches(boolean scmSupportsBranches) { this.scmSupportsBranches = scmSupportsBranches; } + + public List<String> getBranches() { return branches; } + + public void setBranches(List<String> branches) { this.branches = branches; } + + public String getUsername() { return username; } + + public void setUsername(String username) { this.username = username; } + + public String getPw() { return pw; } + + public void setPw(String pw) { this.pw = pw; } + + public String execute() { + + if (username == null) { + username = "anonymous"; + } + if (pw == null) { + pw = "anonymous"; + } + + ScmProvider provider = ScmWebEditorConfig.getProvider(scmType); + + scmSupportsBranches = provider.supportsBranches(); + + try { + branches = provider.listBranches(address, username, pw); + } catch (OperationNotSupportedException e) { + if (log.isDebugEnabled()) { + log.debug("The SCM " + scmType + " does not support branches", e); + } + } + + return SUCCESS; + } +} diff --git a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/SaveAction.java b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/SaveAction.java index 703a21f..f28d668 100644 --- a/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/SaveAction.java +++ b/swe-ui-web/src/main/java/org/nuiton/scmwebeditor/uiweb/actions/SaveAction.java @@ -51,7 +51,8 @@ public class SaveAction extends ScmWebEditorCommitAction { return date; } - public String save() { + + public String execute() { if (log.isDebugEnabled()) { log.debug("originText : " + origText); @@ -64,7 +65,7 @@ public class SaveAction extends ScmWebEditorCommitAction { return SUCCESS; } - result = execute(); + result = super.execute(); date = new Date(); diff --git a/swe-ui-web/src/main/resources/struts.xml b/swe-ui-web/src/main/resources/struts.xml index a9f3907..d019364 100644 --- a/swe-ui-web/src/main/resources/struts.xml +++ b/swe-ui-web/src/main/resources/struts.xml @@ -64,19 +64,19 @@ <default-interceptor-ref name="scmwebeditorDefaultStack"/> - <action name="checkout" class="org.nuiton.scmwebeditor.uiweb.actions.ScmWebEditorMainAction" method="execute"> + <action name="checkout" class="org.nuiton.scmwebeditor.uiweb.actions.ScmWebEditorMainAction"> <result name="noParameter" >/WEB-INF/content/outConnection.jsp</result> <result name="errorPath" >/WEB-INF/content/badFileRedirect.jsp</result> </action> - <action name="edit" class="org.nuiton.scmwebeditor.uiweb.actions.EditAction" method="edit"> + <action name="edit" class="org.nuiton.scmwebeditor.uiweb.actions.EditAction"> <result name="noParameter" >/WEB-INF/content/outConnection.jsp</result> <result name="login" >/WEB-INF/content/privateScmRedirect.jsp</result> <result name="errorPath" >/WEB-INF/content/badFileRedirect.jsp</result> <result name="editPage" >/WEB-INF/content/modificationViewer.jsp</result> </action> - <action name="commit" class="org.nuiton.scmwebeditor.uiweb.actions.ScmWebEditorCommitAction" method="execute"> + <action name="commit" class="org.nuiton.scmwebeditor.uiweb.actions.ScmWebEditorCommitAction"> <result name="success" >/WEB-INF/content/redirect.jsp</result> <result name="login" >/WEB-INF/content/modificationViewer.jsp</result> <result name="error">/WEB-INF/content/badFileRedirect.jsp</result> @@ -85,39 +85,33 @@ <result name="fileModify">/WEB-INF/content/fileModify.jsp</result> </action> - <action name="save" class="org.nuiton.scmwebeditor.uiweb.actions.SaveAction" method="save"> + <action name="save" class="org.nuiton.scmwebeditor.uiweb.actions.SaveAction"> <result>/WEB-INF/content/save.jsp</result> </action> - <action name="reset" class="org.nuiton.scmwebeditor.uiweb.actions.ResetAction" > + <action name="reset" class="org.nuiton.scmwebeditor.uiweb.actions.ResetAction"> <result>/WEB-INF/content/reset.jsp</result> <result name="authError">/WEB-INF/content/reset.jsp</result> <result name="errorPath">/WEB-INF/content/reset.jsp</result> </action> - <action name="logout" class="org.nuiton.scmwebeditor.uiweb.actions.LogoutAction" > + <action name="logout" class="org.nuiton.scmwebeditor.uiweb.actions.LogoutAction"> <result>/WEB-INF/content/logout.jsp</result> </action> - <action name="doUpload" class="org.nuiton.scmwebeditor.uiweb.actions.UploadAction" > + <action name="doUpload" class="org.nuiton.scmwebeditor.uiweb.actions.UploadAction"> <result>/WEB-INF/content/uploadSuccess.jsp</result> <result name="redirect" >/WEB-INF/content/uploadForm.jsp</result> <result name="login" >/WEB-INF/content/uploadForm.jsp</result> <result name="error" >/WEB-INF/content/uploadForm.jsp</result> </action> - <action name="uploadFile" class="org.nuiton.scmwebeditor.uiweb.actions.UploadAction" > - <result>/WEB-INF/content/upload.jsp</result> - <result name="login" >/WEB-INF/content/upload.jsp</result> - <result name="error" >/WEB-INF/content/upload.jsp</result> - </action> - - <action name="preview" class="org.nuiton.scmwebeditor.uiweb.actions.PreviewAction" > + <action name="preview" class="org.nuiton.scmwebeditor.uiweb.actions.PreviewAction"> <result>/WEB-INF/content/preview.jsp</result> </action> - <action name="browse" class="org.nuiton.scmwebeditor.uiweb.actions.BrowseAction" method="browse"> + <action name="browse" class="org.nuiton.scmwebeditor.uiweb.actions.BrowseAction"> <param name="address"/> <result name="root">/WEB-INF/content/browse.jsp</result> <result name="success" type="json"> @@ -126,11 +120,11 @@ <result name="authError" >/WEB-INF/content/loginBrowse.jsp</result> </action> - <action name="getBranches" class="org.nuiton.scmwebeditor.uiweb.actions.BrowseAction" method="listBranchesJSON"> + <action name="getBranches" class="org.nuiton.scmwebeditor.uiweb.actions.ListBranchesAction"> <result name="success" type="json"/> </action> - <action name="detectScm" class="org.nuiton.scmwebeditor.uiweb.actions.BrowseAction" method="detectScm"> + <action name="detectScm" class="org.nuiton.scmwebeditor.uiweb.actions.DetectScmAction"> <result name="success" type="json"/> </action> diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp index fa130fe..9caa33f 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -443,29 +443,6 @@ </div> - -<!-- - <div id="uploadFormId" > - <s:form method="POST" id="uploadForm" action="uploadFile" enctype="multipart/form-data"> - - - <label>Upload a picture : <input type="file" name="upload"/></label><br/> - <label>Path on scm : <input type="text" name="scmPath" /></label><br/> - <label>username : <input type="text" name="username" /></label><br/> - <label>password : <input type="password" name="pw" /></label><br/> - - <sj:submit - id="ajaxUploadButton" - targets="targetContentUpload" - button="true" - value="upload" - > - </sj:submit> - - </s:form> - </div> - --> - <div id="targetContentUpload"></div> </div> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm