merge latest scm-manager 2 changes into default branch
3
.dockerignore
Normal file
@@ -0,0 +1,3 @@
|
||||
# ignore everything except scm-server.tar.gz
|
||||
**
|
||||
!scm-server/target/*.tar.gz
|
||||
@@ -29,3 +29,8 @@ Desktop DF$
|
||||
# jrebel
|
||||
rebel.xml
|
||||
\.pyc
|
||||
# ui
|
||||
scm-ui/build
|
||||
scm-ui/coverage
|
||||
/?node_modules/
|
||||
|
||||
|
||||
BIN
.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
2
.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Keep this version number in sync with Jenkinsfile
|
||||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
|
||||
20
Dockerfile
Normal file
@@ -0,0 +1,20 @@
|
||||
FROM openjdk:8u171-alpine3.8
|
||||
|
||||
ENV SCM_HOME=/var/lib/scm
|
||||
|
||||
RUN set -x \
|
||||
&& apk add --no-cache mercurial bash \
|
||||
&& addgroup -S -g 1000 scm \
|
||||
&& adduser -S -s /bin/false -G scm -h /opt/scm-server -D -H -u 1000 scm \
|
||||
&& mkdir ${SCM_HOME} \
|
||||
&& chown scm:scm ${SCM_HOME}
|
||||
|
||||
ADD scm-server/target/scm-server-app.tar.gz /opt
|
||||
RUN chown -R scm:scm /opt/scm-server
|
||||
|
||||
WORKDIR /opt/scm-server
|
||||
VOLUME [ "${SCM_HOME}", "/opt/scm-server/var/log" ]
|
||||
EXPOSE 8080
|
||||
USER scm
|
||||
|
||||
ENTRYPOINT [ "/opt/scm-server/bin/scm-server" ]
|
||||
171
Jenkinsfile
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
#!groovy
|
||||
|
||||
// Keep the version in sync with the one used in pom.xml in order to get correct syntax completion.
|
||||
@Library('github.com/cloudogu/ces-build-lib@59d3e94')
|
||||
import com.cloudogu.ces.cesbuildlib.*
|
||||
|
||||
node('docker') {
|
||||
|
||||
// Change this as when we go back to default - necessary for proper SonarQube analysis
|
||||
mainBranch = '2.0.0-m3'
|
||||
|
||||
properties([
|
||||
// Keep only the last 10 build to preserve space
|
||||
buildDiscarder(logRotator(numToKeepStr: '10')),
|
||||
disableConcurrentBuilds(),
|
||||
parameters([
|
||||
string(name: 'dockerTag', trim: true, defaultValue: 'latest', description: 'Extra Docker Tag for cloudogu/scm-manager image')
|
||||
])
|
||||
])
|
||||
|
||||
timeout(activity: true, time: 30, unit: 'MINUTES') {
|
||||
|
||||
catchError {
|
||||
|
||||
Maven mvn = setupMavenBuild()
|
||||
|
||||
stage('Checkout') {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
mvn 'clean install -Pdoc -DskipTests'
|
||||
}
|
||||
|
||||
stage('Unit Test') {
|
||||
mvn 'test -Dsonia.scm.test.skip.hg=true -Dmaven.test.failure.ignore=true'
|
||||
}
|
||||
|
||||
stage('Integration Test') {
|
||||
mvn 'verify -Pit -pl :scm-webapp,:scm-it -Dmaven.test.failure.ignore=true'
|
||||
}
|
||||
|
||||
stage('SonarQube') {
|
||||
|
||||
analyzeWith(mvn)
|
||||
|
||||
if (!waitForQualityGateWebhookToBeCalled()) {
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
}
|
||||
}
|
||||
|
||||
def commitHash = getCommitHash()
|
||||
def dockerImageTag = "2.0.0-dev-${commitHash.substring(0,7)}-${BUILD_NUMBER}"
|
||||
|
||||
if (isMainBranch()) {
|
||||
|
||||
stage('Lifecycle') {
|
||||
nexusPolicyEvaluation iqApplication: selectedApplication('scm'), iqScanPatterns: [[scanPattern: 'scm-server/target/scm-server-app.zip']], iqStage: 'build'
|
||||
}
|
||||
|
||||
stage('Archive') {
|
||||
archiveArtifacts 'scm-webapp/target/scm-webapp.war'
|
||||
archiveArtifacts 'scm-server/target/scm-server-app.*'
|
||||
archiveArtifacts 'scm-webapp/target/scm-webapp-restdocs.zip'
|
||||
}
|
||||
|
||||
stage('Docker') {
|
||||
def image = docker.build('cloudogu/scm-manager')
|
||||
docker.withRegistry('', 'hub.docker.com-cesmarvin') {
|
||||
image.push(dockerImageTag)
|
||||
image.push('latest')
|
||||
if (!'latest'.equals(params.dockerTag)) {
|
||||
image.push(params.dockerTag)
|
||||
|
||||
def newDockerTag = "2.0.0-${commitHash.substring(0,7)}-dev-${params.dockerTag}"
|
||||
currentBuild.description = newDockerTag
|
||||
image.push(newDockerTag)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stage('Deployment') {
|
||||
build job: 'scm-manager/next-scm.cloudogu.com', propagate: false, wait: false, parameters: [
|
||||
string(name: 'changeset', value: commitHash),
|
||||
string(name: 'imageTag', value: dockerImageTag)
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Archive Unit and integration test results, if any
|
||||
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml,**/target/jest-reports/TEST-*.xml'
|
||||
|
||||
// Find maven warnings and visualize in job
|
||||
warnings consoleParsers: [[parserName: 'Maven']], canRunOnFailed: true
|
||||
|
||||
mailIfStatusChanged(commitAuthorEmail)
|
||||
}
|
||||
}
|
||||
|
||||
String mainBranch
|
||||
|
||||
Maven setupMavenBuild() {
|
||||
// Keep this version number in sync with .mvn/maven-wrapper.properties
|
||||
Maven mvn = new MavenInDocker(this, '3.5.2-jdk-8')
|
||||
|
||||
if (isMainBranch()) {
|
||||
// Release starts javadoc, which takes very long, so do only for certain branches
|
||||
mvn.additionalArgs += ' -DperformRelease'
|
||||
// JDK8 is more strict, we should fix this before the next release. Right now, this is just not the focus, yet.
|
||||
mvn.additionalArgs += ' -Dmaven.javadoc.failOnError=false'
|
||||
}
|
||||
return mvn
|
||||
}
|
||||
|
||||
void analyzeWith(Maven mvn) {
|
||||
|
||||
withSonarQubeEnv('sonarcloud.io-scm') {
|
||||
|
||||
String mvnArgs = "${env.SONAR_MAVEN_GOAL} " +
|
||||
"-Dsonar.host.url=${env.SONAR_HOST_URL} " +
|
||||
"-Dsonar.login=${env.SONAR_AUTH_TOKEN} "
|
||||
|
||||
if (isPullRequest()) {
|
||||
echo "Analysing SQ in PR mode"
|
||||
mvnArgs += "-Dsonar.pullrequest.base=${env.CHANGE_TARGET} " +
|
||||
"-Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} " +
|
||||
"-Dsonar.pullrequest.key=${env.CHANGE_ID} " +
|
||||
"-Dsonar.pullrequest.provider=bitbucketcloud " +
|
||||
"-Dsonar.pullrequest.bitbucketcloud.owner=sdorra " +
|
||||
"-Dsonar.pullrequest.bitbucketcloud.repository=scm-manager " +
|
||||
"-Dsonar.cpd.exclusions=**/*StoreFactory.java,**/*UserPassword.js "
|
||||
} else {
|
||||
mvnArgs += " -Dsonar.branch.name=${env.BRANCH_NAME} "
|
||||
if (!isMainBranch()) {
|
||||
// Avoid exception "The main branch must not have a target" on main branch
|
||||
mvnArgs += " -Dsonar.branch.target=${mainBranch} "
|
||||
}
|
||||
}
|
||||
mvn "${mvnArgs}"
|
||||
}
|
||||
}
|
||||
|
||||
boolean isMainBranch() {
|
||||
return mainBranch.equals(env.BRANCH_NAME)
|
||||
}
|
||||
|
||||
boolean waitForQualityGateWebhookToBeCalled() {
|
||||
boolean isQualityGateSucceeded = true
|
||||
timeout(time: 5, unit: 'MINUTES') { // Needed when there is no webhook for example
|
||||
def qGate = waitForQualityGate()
|
||||
echo "SonarQube Quality Gate status: ${qGate.status}"
|
||||
if (qGate.status != 'OK') {
|
||||
isQualityGateSucceeded = false
|
||||
}
|
||||
}
|
||||
return isQualityGateSucceeded
|
||||
}
|
||||
|
||||
String getCommitAuthorComplete() {
|
||||
new Sh(this).returnStdOut 'hg log --branch . --limit 1 --template "{author}"'
|
||||
}
|
||||
|
||||
String getCommitHash() {
|
||||
new Sh(this).returnStdOut 'hg log --branch . --limit 1 --template "{node}"'
|
||||
}
|
||||
|
||||
String getCommitAuthorEmail() {
|
||||
def matcher = getCommitAuthorComplete() =~ "<(.*?)>"
|
||||
matcher ? matcher[0][1] : ""
|
||||
}
|
||||
21
deployments/helm/.helmignore
Normal file
@@ -0,0 +1,21 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
5
deployments/helm/Chart.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
apiVersion: v1
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for SCM-Manager
|
||||
name: scm-manager
|
||||
version: 0.1.0
|
||||
19
deployments/helm/templates/NOTES.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range .Values.ingress.hosts }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "scm-manager.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get svc -w {{ include "scm-manager.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "scm-manager.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP:{{ .Values.service.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ include "scm-manager.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
||||
32
deployments/helm/templates/_helpers.tpl
Normal file
@@ -0,0 +1,32 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "scm-manager.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "scm-manager.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "scm-manager.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
160
deployments/helm/templates/configmap.yaml
Normal file
@@ -0,0 +1,160 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "scm-manager.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
data:
|
||||
server-config.xml: |
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
|
||||
<Configure id="ScmServer" class="org.eclipse.jetty.server.Server">
|
||||
|
||||
<New id="httpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
|
||||
<!-- increase header size for mercurial -->
|
||||
<Set name="requestHeaderSize">16384</Set>
|
||||
<Set name="responseHeaderSize">16384</Set>
|
||||
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
<!--
|
||||
We have to enable ForwardedRequestCustomizer in order to understand X-Forwarded-xxx headers.
|
||||
Without the ForwardedRequestCustomizer, scm will possibly generate wrong links
|
||||
-->
|
||||
<Call name="addCustomizer">
|
||||
<Arg><New class="org.eclipse.jetty.server.ForwardedRequestCustomizer"/></Arg>
|
||||
</Call>
|
||||
{{- end }}
|
||||
</New>
|
||||
|
||||
<!--
|
||||
Connectors
|
||||
-->
|
||||
<Call name="addConnector">
|
||||
<Arg>
|
||||
<New class="org.eclipse.jetty.server.ServerConnector">
|
||||
<Arg name="server">
|
||||
<Ref refid="ScmServer" />
|
||||
</Arg>
|
||||
<Arg name="factories">
|
||||
<Array type="org.eclipse.jetty.server.ConnectionFactory">
|
||||
<Item>
|
||||
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
|
||||
<Arg name="config">
|
||||
<Ref refid="httpConfig" />
|
||||
</Arg>
|
||||
</New>
|
||||
</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
<Set name="port">
|
||||
<SystemProperty name="jetty.port" default="8080" />
|
||||
</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</Call>
|
||||
|
||||
<New id="scm-webapp" class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
<Set name="contextPath">/scm</Set>
|
||||
<Set name="war">
|
||||
<SystemProperty name="basedir" default="."/>/var/webapp/scm-webapp.war</Set>
|
||||
<!-- disable directory listings -->
|
||||
<Call name="setInitParameter">
|
||||
<Arg>org.eclipse.jetty.servlet.Default.dirAllowed</Arg>
|
||||
<Arg>false</Arg>
|
||||
</Call>
|
||||
<Set name="tempDirectory">
|
||||
<SystemProperty name="basedir" default="."/>/work/scm
|
||||
</Set>
|
||||
</New>
|
||||
|
||||
<New id="docroot" class="org.eclipse.jetty.webapp.WebAppContext">
|
||||
<Set name="contextPath">/</Set>
|
||||
<Set name="baseResource">
|
||||
<New class="org.eclipse.jetty.util.resource.ResourceCollection">
|
||||
<Arg>
|
||||
<Array type="java.lang.String">
|
||||
<Item>
|
||||
<SystemProperty name="basedir" default="."/>/var/webapp/docroot</Item>
|
||||
</Array>
|
||||
</Arg>
|
||||
</New>
|
||||
</Set>
|
||||
<Set name="tempDirectory">
|
||||
<SystemProperty name="basedir" default="."/>/work/docroot
|
||||
</Set>
|
||||
</New>
|
||||
|
||||
<Set name="handler">
|
||||
<New class="org.eclipse.jetty.server.handler.HandlerCollection">
|
||||
<Set name="handlers">
|
||||
<Array type="org.eclipse.jetty.server.Handler">
|
||||
<Item>
|
||||
<Ref id="scm-webapp" />
|
||||
</Item>
|
||||
<Item>
|
||||
<Ref id="docroot" />
|
||||
</Item>
|
||||
</Array>
|
||||
</Set>
|
||||
</New>
|
||||
</Set>
|
||||
|
||||
</Configure>
|
||||
|
||||
logging.xml: |
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<!--
|
||||
in a container environment we only need stdout
|
||||
-->
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
|
||||
</encoder>
|
||||
|
||||
</appender>
|
||||
|
||||
<logger name="sonia.scm" level="INFO" />
|
||||
|
||||
<!-- suppress massive gzip logging -->
|
||||
<logger name="sonia.scm.filter.GZipFilter" level="WARN" />
|
||||
<logger name="sonia.scm.filter.GZipResponseStream" level="WARN" />
|
||||
|
||||
<logger name="sonia.scm.util.ServiceUtil" level="WARN" />
|
||||
|
||||
<!-- event bus -->
|
||||
<logger name="sonia.scm.event.LegmanScmEventBus" level="INFO" />
|
||||
|
||||
<!-- shiro -->
|
||||
<!--
|
||||
<logger name="org.apache.shiro" level="INFO" />
|
||||
<logger name="org.apache.shiro.authc.pam.ModularRealmAuthenticator" level="DEBUG" />
|
||||
-->
|
||||
|
||||
<!-- svnkit -->
|
||||
<!--
|
||||
<logger name="svnkit" level="WARN" />
|
||||
<logger name="svnkit.network" level="DEBUG" />
|
||||
<logger name="svnkit.fsfs" level="WARN" />
|
||||
-->
|
||||
|
||||
<!-- javahg -->
|
||||
<!--
|
||||
<logger name="com.aragost.javahg" level="DEBUG" />
|
||||
-->
|
||||
|
||||
<!-- ehcache -->
|
||||
<!--
|
||||
<logger name="net.sf.ehcache" level="DEBUG" />
|
||||
-->
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
93
deployments/helm/templates/deployment.yaml
Normal file
@@ -0,0 +1,93 @@
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "scm-manager.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
chart: {{ include "scm-manager.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
replicas: 1 # could not be scaled
|
||||
strategy:
|
||||
type: Recreate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
spec:
|
||||
initContainers:
|
||||
- name: volume-permissions
|
||||
image: alpine:3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ['sh', '-c', 'chown 1000:1000 /data']
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
{{- if .Values.plugins }}
|
||||
- name: install-plugins
|
||||
image: alpine:3.8
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ['sh', '/scripts/install-plugins.sh']
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
- name: scripts
|
||||
mountPath: /scripts
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /scm
|
||||
port: http
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /scm
|
||||
port: http
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/scm
|
||||
- name: config
|
||||
mountPath: /opt/scm-server/conf
|
||||
volumes:
|
||||
- name: data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ include "scm-manager.fullname" . }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "scm-manager.fullname" . }}
|
||||
{{- if .Values.plugins }}
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: {{ include "scm-manager.fullname" . }}-scripts
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{ toYaml . | indent 8 }}
|
||||
{{- end }}
|
||||
38
deployments/helm/templates/ingress.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
{{- $fullName := include "scm-manager.fullname" . -}}
|
||||
{{- $ingressPath := .Values.ingress.path -}}
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
labels:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
chart: {{ include "scm-manager.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ . | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: {{ $ingressPath }}
|
||||
backend:
|
||||
serviceName: {{ $fullName }}
|
||||
servicePort: http
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
24
deployments/helm/templates/pvc.yaml
Normal file
@@ -0,0 +1,24 @@
|
||||
{{- if .Values.persistence.enabled -}}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ include "scm-manager.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
{{- if (eq "-" .Values.persistence.storageClass) }}
|
||||
storageClassName: ""
|
||||
{{- else }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
21
deployments/helm/templates/scripts.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
{{- if .Values.plugins }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "scm-manager.fullname" . }}-scripts
|
||||
labels:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
data:
|
||||
install-plugins.sh: |
|
||||
#!/bin/sh
|
||||
mkdir -p /data/plugins
|
||||
chown 1000:1000 /data/plugins
|
||||
{{ range $i, $plugin := .Values.plugins }}
|
||||
# install plugin {{ $plugin.name }}
|
||||
wget -O /data/plugins/{{ $plugin.name }}.smp {{ $plugin.url }}
|
||||
chown 1000:1000 /data/plugins/{{ $plugin.name }}.smp
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
19
deployments/helm/templates/service.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "scm-manager.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
chart: {{ include "scm-manager.chart" . }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: 8080
|
||||
protocol: TCP
|
||||
name: http
|
||||
selector:
|
||||
app: {{ include "scm-manager.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
69
deployments/helm/values.yaml
Normal file
@@ -0,0 +1,69 @@
|
||||
# Default values for scm-manager.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
# replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: cloudogu/scm-manager
|
||||
# TODO change after release, to something more stable
|
||||
tag: latest
|
||||
pullPolicy: Always
|
||||
|
||||
# plugins:
|
||||
# - name: scm-review-plugin
|
||||
# url: https://oss.cloudogu.com/jenkins/job/scm-manager/job/scm-manager-bitbucket/job/scm-review-plugin/job/develop/lastSuccessfulBuild/artifact/target/scm-review-plugin-2.0.0-SNAPSHOT.smp
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
service:
|
||||
type: LoadBalancer
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
path: /
|
||||
hosts:
|
||||
- scm-manager.local
|
||||
tls: []
|
||||
# - secretName: scm-manager-tls
|
||||
# hosts:
|
||||
# - scm-manager.local
|
||||
|
||||
## Enable persistence using Persistent Volume Claims
|
||||
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||
##
|
||||
persistence:
|
||||
enabled: true
|
||||
## ghost data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## If set to "-", storageClassName: "", which disables dynamic provisioning
|
||||
## If undefined (the default) or set to null, no storageClassName spec is
|
||||
## set, choosing the default provisioner. (gp2 on AWS, standard on
|
||||
## GKE, AWS & OpenStack)
|
||||
##
|
||||
# storageClass: "-"
|
||||
accessMode: ReadWriteOnce
|
||||
size: 12Gi
|
||||
|
||||
resources:
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
limits:
|
||||
cpu: 2000m
|
||||
memory: 2048Mi
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 256Mi
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
@@ -29,46 +29,28 @@
|
||||
<!ELEMENT scm-version (#PCDATA)>
|
||||
|
||||
<!--- contains informations of the plugin for the plugin backend -->
|
||||
<!ELEMENT information (author|artifactId|category|tags|description|groupId|name|screenshots|url|version|wiki)*>
|
||||
<!ELEMENT information (author|category|description|name|version|displayName|avatarUrl)*>
|
||||
|
||||
<!--- plugin author -->
|
||||
<!ELEMENT author (#PCDATA)>
|
||||
|
||||
<!--- maven artifact id -->
|
||||
<!ELEMENT artifactId (#PCDATA)>
|
||||
|
||||
<!--- category of the plugin -->
|
||||
<!ELEMENT category (#PCDATA)>
|
||||
|
||||
<!--- tags of the plugin -->
|
||||
<!ELEMENT tags (tag)*>
|
||||
|
||||
<!--- single tag -->
|
||||
<!ELEMENT tag (#PCDATA)>
|
||||
|
||||
<!--- description of the plugin -->
|
||||
<!ELEMENT description (#PCDATA)>
|
||||
|
||||
<!--- maven groupId id -->
|
||||
<!ELEMENT groupId (#PCDATA)>
|
||||
|
||||
<!--- name of the plugin or the name of the os condition -->
|
||||
<!ELEMENT name (#PCDATA)>
|
||||
|
||||
<!--- contains screenshots of the plugin -->
|
||||
<!ELEMENT screenshots (screenshot)*>
|
||||
|
||||
<!--- single screenshot of the plugin -->
|
||||
<!ELEMENT screenshot (#PCDATA)>
|
||||
|
||||
<!--- the url of the plugin homepage -->
|
||||
<!ELEMENT url (#PCDATA)>
|
||||
|
||||
<!--- the current version of the plugin -->
|
||||
<!ELEMENT version (#PCDATA)>
|
||||
|
||||
<!--- the url of a wiki page -->
|
||||
<!ELEMENT wiki (#PCDATA)>
|
||||
<!--- plugin displayName -->
|
||||
<!ELEMENT displayName (#PCDATA)>
|
||||
|
||||
<!--- url of the plugin avatar -->
|
||||
<!ELEMENT avatarUrl (#PCDATA)>
|
||||
|
||||
<!--- true if the plugin should load child classes first, the default is false -->
|
||||
<!ELEMENT child-first-classloader (#PCDATA)>
|
||||
@@ -121,4 +103,4 @@
|
||||
<!ELEMENT event (#PCDATA)>
|
||||
|
||||
<!--- extension point -->
|
||||
<!ELEMENT extension-point (class|description)*>
|
||||
<!ELEMENT extension-point (class|description)*>
|
||||
|
||||
BIN
docs/logo/favicon_16x16px.ico
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
0
scm-webapp/src/main/webapp/resources/images/favicon.ico → docs/logo/favicon_16x16px_transparent.ico
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
1
docs/logo/scm-manager_logo.ai
Normal file
@@ -0,0 +1 @@
|
||||
%!PS-Adobe-2.0
|
||||
BIN
docs/logo/scm-manager_logo.jpg
Normal file
|
After Width: | Height: | Size: 45 KiB |
BIN
docs/logo/scm-manager_logo.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
docs/logo/scm-manager_logo_img.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
docs/logo/scm-manager_logo_img.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
docs/logo/scm-manager_logo_img_neg.jpg
Normal file
|
After Width: | Height: | Size: 25 KiB |
BIN
docs/logo/scm-manager_logo_img_neg.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
BIN
docs/logo/scm-manager_logo_neg.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
docs/logo/scm-manager_logo_neg.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
docs/logo/scm-manager_logo_neg1.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
docs/logo/scm-manager_logo_neg1.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
docs/logo/scm-manager_logo_pos1.jpg
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
docs/logo/scm-manager_logo_pos1.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
76
docs/mercurial/clone-empty.md
Normal file
@@ -0,0 +1,76 @@
|
||||
# Clone empty repository
|
||||
|
||||
```http
|
||||
GET /scm/hg/hgtest?cmd=capabilities HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1efk0qxy1dj5v133hev91zwsf4;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 05:57:18 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 130.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
.
|
||||
lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=bookmarks.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1rsxj8u1rq9wizawhyyxok2p5;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 05:57:18 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 0.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
GET /scm/hg/hgtest?cmd=batch HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: cmds=heads+%3Bknown+nodes%3D.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=ewyx4m53d8dajjsob6gxobne;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 05:57:18 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 42.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
0000000000000000000000000000000000000000
|
||||
;
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1o0hou15jtiywsywutf30qwm8;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 05:57:18 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 15.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
.
|
||||
publishing.True
|
||||
```
|
||||
117
docs/mercurial/push-bookmark.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# Push bookmark
|
||||
|
||||
```http
|
||||
GET /scm/hg/hgtest?cmd=capabilities HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=7rq9vpp9svfm1sicq7h9vetmv;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 08:08:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 130.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
|
||||
|
||||
GET /scm/hg/hgtest?cmd=batch HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: cmds=heads+%3Bknown+nodes%3Def5993bb4abb32a0565c347844c6d939fc4f4b98.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
T 172.17.0.2:8080 -> 172.17.0.1:36576 [AP]
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1553csz4sf7scyvw8mqnqfirn;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 08:08:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 43.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
ef5993bb4abb32a0565c347844c6d939fc4f4b98
|
||||
;1
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=11xa5u3nrmx8k1nar3sazg6jzh;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 08:08:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 15.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
publishing.True
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=bookmarks.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1p1uzcvfe1pvzh2buzo658rxw;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 08:08:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 0.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1mhlj3ucfzdp6ifmzoua4zwit;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 08:08:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 15.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
publishing.True
|
||||
|
||||
POST /scm/hg/hgtest?cmd=pushkey HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
content-type: application/mercurial-0.1.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: key=markone&namespace=bookmarks&new=ef5993bb4abb32a0565c347844c6d939fc4f4b98&old=.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
content-length: 0.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=s4vtagb303dv1xg809wnp7e8z;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 08:08:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 2.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
.
|
||||
1
|
||||
```
|
||||
167
docs/mercurial/push-multiple-branches-to-new.md
Normal file
@@ -0,0 +1,167 @@
|
||||
# Push multiple branches to new repository
|
||||
|
||||
```http
|
||||
GET /scm/hg/hgtest?cmd=capabilities HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1wu06ykfd4bcv1uv731y4hss2m;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 07:55:14 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 130.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
|
||||
|
||||
GET /scm/hg/hgtest?cmd=batch HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: cmds=heads+%3Bknown+nodes%3Def5993bb4abb32a0565c347844c6d939fc4f4b98.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1rajglvqx222g5nppcq3jdfk0;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 07:55:14 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 43.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
0000000000000000000000000000000000000000
|
||||
;0
|
||||
|
||||
GET /scm/hg/hgtest?cmd=known HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: nodes=c0ceccb3b2f0f5c977ff32b9337519e5f37942c2+187ddf37e237c370514487a0bb1a226f11a780b3+b5914611f84eae14543684b2721eec88b0edac12+8b63a323606f10c86b30465570c2574eb7a3a989.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=a5vykp1f0ga2186l8v3gu6lid;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 07:55:14 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 4.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
0000
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=s8lpwqm4c2nqs9kwcg2ca6vm;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 07:55:14 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 15.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
publishing.True
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=bookmarks.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1d2qj3kynxlhvk31oli4kk7vf;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 07:55:14 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 0.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
POST /scm/hg/hgtest?cmd=unbundle HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
content-type: application/mercurial-0.1.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: heads=686173686564+6768033e216468247bd031a0a2d9876d79818f8f.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
content-length: 913.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HG10GZx...oh.U......E.1.....2q.<...s.1.YK*e#..b..{....{..%A.....
|
||||
,\.....Y.XV....Q/J......`Q/.z.{...<.7....r.s.~?.?..<o....O.]....?.}..m?]z..I..u..}.a..rg..R[i.,D ...!.1..h.r.....G...M.\...J[.....+{.k...u..bL.!....F('..=Q.'......W.>5.~`..?..........O.j.0.....Ih.....!@.P... ..a
|
||||
;!y..cT...]q.8Zg=...<..,.tq.*.........l........';..w^...w...-......Co..Fs.HYg...
|
||||
9.F#.P......1..;......D.H.9$@.^....r:E..18...H....3..h...-.=.6l......=q .)."Yg..p\...s@.#.H.*....c8&96..2.GjJ.`.J....r...=Q1..@R.3.o{q...|.......yq.k..,cY..:[... ...S.2...VYp..c5..&.SFR.............V.d..o..........,.. A..M....k...0_.LO1..1"4.;...B....5.9.".U.m.e......]\../p..;?C..<vW.....|......F.8,....s....2.T
|
||||
N. .k..>W9.........n.~o..gW...Q;..$....S..X.CN.5I].H..!.@...U..J...L.lY.../.-...6.:.Q.'...>.e'..<#3........OL}.52ra[..g*Y:Y....w...=..Z\...S.......tz..;..mf...W......&yUN.r.......4...........`..F...nT..U9................_.~..?...BwzUN.r....B.
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=163487i0ayf9s1k2ng9e1azadj;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 07:55:14 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 102.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
1
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 5 changesets with 3 changes to 3 files
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=a3i712yjss6t1xsxltnssq0tl;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 07:55:14 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 58.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
c0ceccb3b2f0f5c977ff32b9337519e5f37942c2.1
|
||||
publishing.True
|
||||
|
||||
POST /scm/hg/hgtest?cmd=pushkey HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
content-type: application/mercurial-0.1.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: key=ef5993bb4abb32a0565c347844c6d939fc4f4b98&namespace=phases&new=0&old=1.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
content-length: 0.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=g8cavdze42d83knmuasrlg10;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 07:55:14 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 2.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
.
|
||||
1
|
||||
```
|
||||
183
docs/mercurial/push-multiple-branches.md
Normal file
@@ -0,0 +1,183 @@
|
||||
# Push multiple branches
|
||||
|
||||
```http
|
||||
GET /scm/hg/hgtest?cmd=capabilities HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1mvm1rxg8333iib7754ksusxc;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 130.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
|
||||
|
||||
GET /scm/hg/hgtest?cmd=batch HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: cmds=heads+%3Bknown+nodes%3Def5993bb4abb32a0565c347844c6d939fc4f4b98.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=58p9y9vcnz5cjs22dtw8mpwk;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 43.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
c0ceccb3b2f0f5c977ff32b9337519e5f37942c2
|
||||
;0
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=v5wfwj8k4t261dp6808cdouoa;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 15.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
publishing.True
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=bookmarks.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=3pgqytfhm4za1dco9p41j9yz5;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 0.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
GET /scm/hg/hgtest?cmd=branchmap HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
.
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1tiz6zf7ui54e1j3d4vouxig5m;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 48.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
default c0ceccb3b2f0f5c977ff32b9337519e5f37942c2
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=bookmarks.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1augu4tc71xax1dit20dtxzkez;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 0.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
POST /scm/hg/hgtest?cmd=unbundle HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
content-type: application/mercurial-0.1.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: heads=686173686564+95373ca7cd5371cb6c49bb755ee451d9ec585845.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
content-length: 746.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HG10GZx...]H.Q...z..r.,.Y..Bw.~..c.Z&...hf.:......e.XK.X,...
|
||||
,2.E1.B+...(.B"."*..z1.*......M...........93..k|..I..<...h..J_.L.9>.h..@.....op..^.....#....;.*..W....T@....!..dY....jT..A0O6.}..S.2..JPU.O6...aa...rY.VOf9.....7Ukj.&..<...z...j......%}..Jc.8c....k.."9.&".I.P.\..$.At......0..1..g.2.)<..$.. E..dn#....#.Y$3...n...5....J.e.......SNHN.q.MD..4..."I..`PF..?GH1..F..uES..Rl$47.....a........D.1...87.k.t..D..O_.3..6'cN.w.M..|@E.).X!.h*....U.B.X.....h..$.`4...
|
||||
-..O.:./..oWN.....3...x.L......_[..../..k.R$.x.2..kkv.\2R....4...@.2...1Q..T
|
||||
..(..m....s.Uo.......{.d.....Y....TYO...S.Pl`a5. ."N$.@...b...qJ.l.).n...1..F.Zy.....&>v;.q.....Jy..X.?.;....>U..|.....d.Y.*.q...NR.3...h.T..x..,.]...p{.^S.S...~..`..q.\j{.oCI.............K.....l9n.s......
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1e4fnqpncil9z1f7a2pya26nt7;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 102.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
1
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 4 changesets with 2 changes to 2 files
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=f9hvrjssniym1qe33q0u8r2m8;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 101.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
b5914611f84eae14543684b2721eec88b0edac12.1
|
||||
187ddf37e237c370514487a0bb1a226f11a780b3.1
|
||||
publishing.True
|
||||
|
||||
POST /scm/hg/hgtest?cmd=pushkey HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
content-type: application/mercurial-0.1.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: key=ef5993bb4abb32a0565c347844c6d939fc4f4b98&namespace=phases&new=0&old=1.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
content-length: 0.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=z5lrut6940a650sw6x9bls8a;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:16:50 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 2.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
1
|
||||
```
|
||||
147
docs/mercurial/push-single-changeset.md
Normal file
@@ -0,0 +1,147 @@
|
||||
# Push single changeset
|
||||
|
||||
```http
|
||||
GET /scm/hg/hgtest?cmd=capabilities HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=18r2i2jsba46d14ncsmcjdhaem;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:03:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 130.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch stream unbundle=HG10GZ,HG10BZ,HG10UN httpheader=1024
|
||||
|
||||
GET /scm/hg/hgtest?cmd=batch HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: cmds=heads+%3Bknown+nodes%3Dc0ceccb3b2f0f5c977ff32b9337519e5f37942c2.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=1fw0i0c5zpy281gfgha0f26git;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:03:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 43.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
0000000000000000000000000000000000000000
|
||||
;0
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=dfa46uaqgf39w3jhk857oymu;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:03:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 15.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
publishing.True
|
||||
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=bookmarks.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=2sk1llvrsagg33xgmwyirfpi;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:03:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 0.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
POST /scm/hg/hgtest?cmd=unbundle HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
content-type: application/mercurial-0.1.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: heads=686173686564+6768033e216468247bd031a0a2d9876d79818f8f.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
content-length: 261.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HG10GZx.c``8w.....>|=Y..h.q.....N.......%......Z....&&&.&...YZ.&.&[$.........$.%q..&%..d&.).....%*.....Y.....9z...v\..FF......
|
||||
..F..\.z%.%\\.)).)
|
||||
.P[....D..[un..L).nc..q.m*.H.l#C...eZJ..YJ.Q.qR...e.aJ.EjjJ.AZ..A.Q..E.1.T.'D..C....7s.}..4G........3.S.mL.0.....zk
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=hlucs5utn1ifnpehqmjpt593;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:03:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 102.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
1
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 1 changes to 1 files
|
||||
|
||||
T 172.17.0.1:33206 -> 172.17.0.2:8080 [AP]
|
||||
GET /scm/hg/hgtest?cmd=listkeys HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: namespace=phases.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=15xomlrxl8qja1cj47rjpqda0y;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:03:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 58.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
c0ceccb3b2f0f5c977ff32b9337519e5f37942c2.1
|
||||
publishing.True
|
||||
|
||||
POST /scm/hg/hgtest?cmd=pushkey HTTP/1.1.
|
||||
Accept-Encoding: identity.
|
||||
content-type: application/mercurial-0.1.
|
||||
vary: X-HgArg-1.
|
||||
x-hgarg-1: key=c0ceccb3b2f0f5c977ff32b9337519e5f37942c2&namespace=phases&new=0&old=1.
|
||||
accept: application/mercurial-0.1.
|
||||
authorization: Basic c2NtYWRtaW46c2NtYWRtaW4=.
|
||||
content-length: 0.
|
||||
host: localhost:8080.
|
||||
user-agent: mercurial/proto-1.0 (Mercurial 4.3.1).
|
||||
|
||||
HTTP/1.1 200 OK.
|
||||
Set-Cookie: JSESSIONID=5zrop5v8e661ipk12tvru525;Path=/scm.
|
||||
Expires: Thu, 01 Jan 1970 00:00:00 GMT.
|
||||
Set-Cookie: rememberMe=deleteMe; Path=/scm; Max-Age=0; Expires=Wed, 28-Mar-2018 06:03:35 GMT.
|
||||
Content-Type: application/mercurial-0.1.
|
||||
Content-Length: 2.
|
||||
Server: Jetty(7.6.21.v20160908).
|
||||
|
||||
1
|
||||
```
|
||||
9
lerna.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"packages": [
|
||||
"scm-ui/*",
|
||||
"scm-plugins/*"
|
||||
],
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"version": "2.0.0-SNAPSHOT"
|
||||
}
|
||||
225
mvnw
vendored
Executable file
@@ -0,0 +1,225 @@
|
||||
#!/bin/sh
|
||||
# ----------------------------------------------------------------------------
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Maven2 Start Up Batch script
|
||||
#
|
||||
# Required ENV vars:
|
||||
# ------------------
|
||||
# JAVA_HOME - location of a JDK home dir
|
||||
#
|
||||
# Optional ENV vars
|
||||
# -----------------
|
||||
# M2_HOME - location of maven2's installed home dir
|
||||
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
# e.g. to debug Maven itself, use
|
||||
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||
|
||||
if [ -f /etc/mavenrc ] ; then
|
||||
. /etc/mavenrc
|
||||
fi
|
||||
|
||||
if [ -f "$HOME/.mavenrc" ] ; then
|
||||
. "$HOME/.mavenrc"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
# OS specific support. $var _must_ be set to either true or false.
|
||||
cygwin=false;
|
||||
darwin=false;
|
||||
mingw=false
|
||||
case "`uname`" in
|
||||
CYGWIN*) cygwin=true ;;
|
||||
MINGW*) mingw=true;;
|
||||
Darwin*) darwin=true
|
||||
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
if [ -x "/usr/libexec/java_home" ]; then
|
||||
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||
else
|
||||
export JAVA_HOME="/Library/Java/Home"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
if [ -r /etc/gentoo-release ] ; then
|
||||
JAVA_HOME=`java-config --jre-home`
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$M2_HOME" ] ; then
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
|
||||
# need this for relative symlinks
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="`dirname "$PRG"`/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
if $cygwin ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
# For Migwn, ensure paths are in UNIX format before anything is touched
|
||||
if $mingw ; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||
# TODO classpath?
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ]; then
|
||||
javaExecutable="`which javac`"
|
||||
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||
# readlink(1) is not available as standard on Solaris 10.
|
||||
readLink=`which readlink`
|
||||
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||
if $darwin ; then
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||
else
|
||||
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||
fi
|
||||
javaHome="`dirname \"$javaExecutable\"`"
|
||||
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||
JAVA_HOME="$javaHome"
|
||||
export JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$JAVACMD" ] ; then
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
else
|
||||
JAVACMD="`which java`"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||
echo " We cannot execute $JAVACMD" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$JAVA_HOME" ] ; then
|
||||
echo "Warning: JAVA_HOME environment variable is not set."
|
||||
fi
|
||||
|
||||
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||
|
||||
# traverses directory structure from process work directory to filesystem root
|
||||
# first directory with .mvn subdirectory is considered project base directory
|
||||
find_maven_basedir() {
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Path not specified to find_maven_basedir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
basedir="$1"
|
||||
wdir="$1"
|
||||
while [ "$wdir" != '/' ] ; do
|
||||
if [ -d "$wdir"/.mvn ] ; then
|
||||
basedir=$wdir
|
||||
break
|
||||
fi
|
||||
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||
if [ -d "${wdir}" ]; then
|
||||
wdir=`cd "$wdir/.."; pwd`
|
||||
fi
|
||||
# end of workaround
|
||||
done
|
||||
echo "${basedir}"
|
||||
}
|
||||
|
||||
# concatenates all lines of a file
|
||||
concat_lines() {
|
||||
if [ -f "$1" ]; then
|
||||
echo "$(tr -s '\n' ' ' < "$1")"
|
||||
fi
|
||||
}
|
||||
|
||||
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||
if [ -z "$BASE_DIR" ]; then
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||
echo $MAVEN_PROJECTBASEDIR
|
||||
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin; then
|
||||
[ -n "$M2_HOME" ] &&
|
||||
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||
[ -n "$JAVA_HOME" ] &&
|
||||
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||
[ -n "$CLASSPATH" ] &&
|
||||
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||
fi
|
||||
|
||||
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
exec "$JAVACMD" \
|
||||
$MAVEN_OPTS \
|
||||
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||
143
mvnw.cmd
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||
@REM or more contributor license agreements. See the NOTICE file
|
||||
@REM distributed with this work for additional information
|
||||
@REM regarding copyright ownership. The ASF licenses this file
|
||||
@REM to you under the Apache License, Version 2.0 (the
|
||||
@REM "License"); you may not use this file except in compliance
|
||||
@REM with the License. You may obtain a copy of the License at
|
||||
@REM
|
||||
@REM http://www.apache.org/licenses/LICENSE-2.0
|
||||
@REM
|
||||
@REM Unless required by applicable law or agreed to in writing,
|
||||
@REM software distributed under the License is distributed on an
|
||||
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
@REM KIND, either express or implied. See the License for the
|
||||
@REM specific language governing permissions and limitations
|
||||
@REM under the License.
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM ----------------------------------------------------------------------------
|
||||
@REM Maven2 Start Up Batch script
|
||||
@REM
|
||||
@REM Required ENV vars:
|
||||
@REM JAVA_HOME - location of a JDK home dir
|
||||
@REM
|
||||
@REM Optional ENV vars
|
||||
@REM M2_HOME - location of maven2's installed home dir
|
||||
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
|
||||
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||
@REM e.g. to debug Maven itself, use
|
||||
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||
@REM ----------------------------------------------------------------------------
|
||||
|
||||
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||
@echo off
|
||||
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
|
||||
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||
|
||||
@REM set %HOME% to equivalent of $HOME
|
||||
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||
|
||||
@REM Execute a user defined script before this one
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
||||
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
||||
:skipRcPre
|
||||
|
||||
@setlocal
|
||||
|
||||
set ERROR_CODE=0
|
||||
|
||||
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||
@setlocal
|
||||
|
||||
@REM ==== START VALIDATION ====
|
||||
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME not found in your environment. >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
:OkJHome
|
||||
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||
|
||||
echo.
|
||||
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||
echo location of your Java installation. >&2
|
||||
echo.
|
||||
goto error
|
||||
|
||||
@REM ==== END VALIDATION ====
|
||||
|
||||
:init
|
||||
|
||||
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||
@REM Fallback to current working directory if not found.
|
||||
|
||||
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||
|
||||
set EXEC_DIR=%CD%
|
||||
set WDIR=%EXEC_DIR%
|
||||
:findBaseDir
|
||||
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||
cd ..
|
||||
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||
set WDIR=%CD%
|
||||
goto findBaseDir
|
||||
|
||||
:baseDirFound
|
||||
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||
cd "%EXEC_DIR%"
|
||||
goto endDetectBaseDir
|
||||
|
||||
:baseDirNotFound
|
||||
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||
cd "%EXEC_DIR%"
|
||||
|
||||
:endDetectBaseDir
|
||||
|
||||
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||
|
||||
@setlocal EnableExtensions EnableDelayedExpansion
|
||||
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||
|
||||
:endReadAdditionalConfig
|
||||
|
||||
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||
|
||||
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||
|
||||
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||
if ERRORLEVEL 1 goto error
|
||||
goto end
|
||||
|
||||
:error
|
||||
set ERROR_CODE=1
|
||||
|
||||
:end
|
||||
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||
|
||||
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
||||
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
||||
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
||||
:skipRcPost
|
||||
|
||||
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
||||
|
||||
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
||||
|
||||
exit /B %ERROR_CODE%
|
||||
34
package.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "root",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"scm-ui/*",
|
||||
"scm-plugins/*"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "webpack --mode=production --config=scm-ui/ui-scripts/src/webpack.config.js",
|
||||
"build:dev": "webpack --mode=development --config=scm-ui/ui-scripts/src/webpack.config.js",
|
||||
"test": "lerna run --scope '@scm-manager/ui-*' test",
|
||||
"typecheck": "lerna run --scope '@scm-manager/ui-*' typecheck",
|
||||
"serve": "webpack-dev-server --mode=development --config=scm-ui/ui-scripts/src/webpack.config.js",
|
||||
"deploy": "ui-scripts publish"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-reflow": "^0.2.7",
|
||||
"lerna": "^3.17.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"gitdiff-parser": "https://github.com/scm-manager/gitdiff-parser#6baa7278824ecd17a199d842ca720d0453f68982"
|
||||
},
|
||||
"babel": {
|
||||
"presets": [
|
||||
"@scm-manager/babel-preset"
|
||||
]
|
||||
},
|
||||
"jest": {
|
||||
"preset": "@scm-manager/jest-preset"
|
||||
},
|
||||
"prettier": "@scm-manager/prettier-config",
|
||||
"dependencies": {}
|
||||
}
|
||||
570
pom.xml
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -68,11 +69,12 @@
|
||||
<module>scm-annotation-processor</module>
|
||||
<module>scm-core</module>
|
||||
<module>scm-test</module>
|
||||
<module>scm-ui</module>
|
||||
<module>scm-plugins</module>
|
||||
<module>scm-dao-xml</module>
|
||||
<module>scm-webapp</module>
|
||||
<module>scm-server</module>
|
||||
<module>scm-clients</module>
|
||||
<module>scm-it</module>
|
||||
</modules>
|
||||
|
||||
<repositories>
|
||||
@@ -82,15 +84,6 @@
|
||||
<name>scm-manager release repository</name>
|
||||
<url>http://maven.scm-manager.org/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>ossrh</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
<updatePolicy>daily</updatePolicy>
|
||||
</snapshots>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
@@ -112,43 +105,368 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- JUnit 5 -->
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit-pioneer</groupId>
|
||||
<artifactId>junit-pioneer</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<version>${hamcrest.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<version>${hamcrest.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>${mokito.version}</version>
|
||||
<scope>test</scope>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>shiro-unit</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>ssp-lib</artifactId>
|
||||
<version>${ssp.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>ssp-processor</artifactId>
|
||||
<version>${ssp.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.webcohesion.enunciate</groupId>
|
||||
<artifactId>enunciate-core-annotations</artifactId>
|
||||
<version>${enunciate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${org.mapstruct.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>de.otto.edison</groupId>
|
||||
<artifactId>edison-hal</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.16.18</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- rest api -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jaxrs</artifactId>
|
||||
<version>${resteasy.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jaxb-provider</artifactId>
|
||||
<version>${resteasy.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-jackson2-provider</artifactId>
|
||||
<version>${resteasy.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-multipart-provider</artifactId>
|
||||
<version>${resteasy.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-guice</artifactId>
|
||||
<version>${resteasy.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.resteasy</groupId>
|
||||
<artifactId>resteasy-servlet-initializer</artifactId>
|
||||
<version>${resteasy.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>${jaxrs.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JUnit 5 -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-params</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.junit-pioneer</groupId>
|
||||
<artifactId>junit-pioneer</artifactId>
|
||||
<version>0.3.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<version>${hamcrest.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-library</artifactId>
|
||||
<version>${hamcrest.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>${mockito.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<version>${mockito.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>3.10.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- http -->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- logging -->
|
||||
|
||||
<dependency>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>${logback.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- xml -->
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>${jaxb.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>${jaxb.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>${jaxb.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<version>1.1.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- utils -->
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.13</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>buildfrontend-maven-plugin</artifactId>
|
||||
<version>2.5.0</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.webcohesion.enunciate</groupId>
|
||||
<artifactId>enunciate-maven-plugin</artifactId>
|
||||
<version>${enunciate.version}</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<artifactId>smp-maven-plugin</artifactId>
|
||||
<version>1.0.0-alpha-8</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.22.0</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-enforcer-plugin</artifactId>
|
||||
<version>1.4.1</version>
|
||||
<version>3.0.0-M1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>enforce-java</id>
|
||||
@@ -170,17 +488,39 @@
|
||||
<requireMavenVersion>
|
||||
<version>[3.1,)</version>
|
||||
</requireMavenVersion>
|
||||
<!--
|
||||
enforce java 1.8 compatible bytecode
|
||||
-->
|
||||
<enforceBytecodeVersion>
|
||||
<maxJdkVersion>1.8</maxJdkVersion>
|
||||
<ignoreClasses>
|
||||
<!--
|
||||
ignore java 9 module info classes
|
||||
because jaxb is compiled with java 7 expect of module-info, which is compiled with java 9
|
||||
-->
|
||||
<ignoreClass>module-info</ignoreClass>
|
||||
</ignoreClasses>
|
||||
</enforceBytecodeVersion>
|
||||
</rules>
|
||||
<fail>true</fail>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>extra-enforcer-rules</artifactId>
|
||||
<version>1.0-beta-7</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>1.15</version>
|
||||
<!-- Note: 1.17 seems to have problems with JDK8. When updating, use > 1.17, if available!
|
||||
https://github.com/mojohaus/animal-sniffer/issues/53 -->
|
||||
<version>1.16</version>
|
||||
<configuration>
|
||||
<signature>
|
||||
<groupId>org.codehaus.mojo.signature</groupId>
|
||||
@@ -198,6 +538,25 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.legman</groupId>
|
||||
<artifactId>legman-maven-plugin</artifactId>
|
||||
<version>${legman.version}</version>
|
||||
<configuration>
|
||||
<fail>true</fail>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<!-- Prevent usage of guava annotations that would be silently ignored -> hard to find.
|
||||
We use legman annotations instead, that provide additional features such as weak references. -->
|
||||
<goal>guava-migration-check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
@@ -215,13 +574,13 @@
|
||||
see https://blogs.oracle.com/darcy/entry/bootclasspath_older_source
|
||||
-->
|
||||
<compilerArgument>-Xlint:unchecked,-options</compilerArgument>
|
||||
<compilerArgument>-parameters</compilerArgument>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
</configuration>
|
||||
@@ -248,7 +607,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9</version>
|
||||
<configuration>
|
||||
<useStandardDocletOptions>true</useStandardDocletOptions>
|
||||
<charset>${project.build.sourceEncoding}</charset>
|
||||
@@ -261,7 +619,6 @@
|
||||
<links>
|
||||
<link>http://download.oracle.com/javase/8/docs/api/</link>
|
||||
<link>http://download.oracle.com/docs/cd/E17802_01/products/products/servlet/2.5/docs/servlet-2_5-mr2/</link>
|
||||
<link>http://jersey.java.net/nonav/apidocs/${jersey.version}/jersey/</link>
|
||||
<link>https://google.github.io/guice/api-docs/${guice.version}/javadoc</link>
|
||||
<link>http://www.slf4j.org/api/</link>
|
||||
<link>http://shiro.apache.org/static/current/apidocs/</link>
|
||||
@@ -290,7 +647,6 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
@@ -316,13 +672,13 @@
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!-- code coverage -->
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.7.7.201606060606</version>
|
||||
<version>0.8.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
@@ -338,59 +694,59 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
<!-- reporting -->
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.2</version>
|
||||
<configuration>
|
||||
<reportPlugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<configuration>
|
||||
<linkXref>true</linkXref>
|
||||
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
|
||||
<targetJdk>${project.build.javaLevel}</targetJdk>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</reportPlugins>
|
||||
</configuration>
|
||||
<version>3.7</version>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-pmd-plugin</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<configuration>
|
||||
<sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
|
||||
<targetJdk>${project.build.javaLevel}</targetJdk>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
<profiles>
|
||||
|
||||
<profile>
|
||||
@@ -434,18 +790,9 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.8.1</version>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
<doclet>org.jboss.apiviz.APIviz</doclet>
|
||||
<docletArtifact>
|
||||
<groupId>org.jboss.apiviz</groupId>
|
||||
<artifactId>apiviz</artifactId>
|
||||
<version>1.3.2.GA</version>
|
||||
</docletArtifact>
|
||||
<additionalparam>
|
||||
-sourceclasspath ${project.build.outputDirectory}
|
||||
-nopackagediagram
|
||||
</additionalparam>
|
||||
<failOnError>false</failOnError>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
@@ -474,41 +821,62 @@
|
||||
|
||||
<properties>
|
||||
<!-- test libraries -->
|
||||
<mokito.version>1.10.19</mokito.version>
|
||||
<mockito.version>2.23.0</mockito.version>
|
||||
<hamcrest.version>1.3</hamcrest.version>
|
||||
<junit.version>4.12</junit.version>
|
||||
<junit.version>5.2.0</junit.version>
|
||||
|
||||
<!-- logging libraries -->
|
||||
<slf4j.version>1.7.22</slf4j.version>
|
||||
<logback.version>1.1.10</logback.version>
|
||||
<slf4j.version>1.7.25</slf4j.version>
|
||||
<logback.version>1.2.3</logback.version>
|
||||
<servlet.version>3.0.1</servlet.version>
|
||||
|
||||
<jaxrs.version>2.1.1</jaxrs.version>
|
||||
<resteasy.version>3.6.2.Final</resteasy.version>
|
||||
<jersey-client.version>1.19.4</jersey-client.version>
|
||||
<enunciate.version>2.11.1</enunciate.version>
|
||||
<jackson.version>2.10.0</jackson.version>
|
||||
<guice.version>4.0</guice.version>
|
||||
<jersey.version>1.19.4</jersey.version>
|
||||
|
||||
<jaxb.version>2.3.0</jaxb.version>
|
||||
|
||||
<!-- event bus -->
|
||||
<legman.version>1.2.0</legman.version>
|
||||
|
||||
<legman.version>1.5.1</legman.version>
|
||||
|
||||
<!-- webserver -->
|
||||
<jetty.version>9.2.10.v20150310</jetty.version>
|
||||
<jetty.maven.version>9.2.10.v20150310</jetty.maven.version>
|
||||
<jetty.version>9.4.22.v20191022</jetty.version>
|
||||
<jetty.maven.version>9.4.22.v20191022</jetty.maven.version>
|
||||
|
||||
<!-- security libraries -->
|
||||
<ssp.version>1.0.0-SNAPSHOT</ssp.version>
|
||||
<shiro.version>1.4.0-RC2</shiro.version>
|
||||
<ssp.version>1.2.0</ssp.version>
|
||||
<shiro.version>1.4.1</shiro.version>
|
||||
|
||||
<!-- repostitory libraries -->
|
||||
<jgit.version>v4.5.2.201704071617-r-scm1</jgit.version>
|
||||
<svnkit.version>1.8.15-scm1</svnkit.version>
|
||||
<!-- repository libraries -->
|
||||
<jgit.version>v5.4.0.201906121030-r-scm2</jgit.version>
|
||||
<svnkit.version>1.9.0-scm3</svnkit.version>
|
||||
|
||||
<!-- util libraries -->
|
||||
<guava.version>22.0</guava.version>
|
||||
<quartz.version>2.2.3</quartz.version>
|
||||
<guava.version>26.0-jre</guava.version>
|
||||
|
||||
<!-- frontend -->
|
||||
<nodejs.version>10.16.0</nodejs.version>
|
||||
<yarn.version>1.16.0</yarn.version>
|
||||
|
||||
<!-- build properties -->
|
||||
<project.build.javaLevel>1.8</project.build.javaLevel>
|
||||
<project.test.javaLevel>1.8</project.test.javaLevel>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<netbeans.hint.license>SCM-BSD</netbeans.hint.license>
|
||||
<jdk.classifier />
|
||||
<org.mapstruct.version>1.2.0.Final</org.mapstruct.version>
|
||||
|
||||
<!-- Sonar exclusions -->
|
||||
<!-- *StoreFactory classes are excluded because extracting the floating store parameter classes in a generic -->
|
||||
<!-- common class creates runtime errors (IncompatibleClassChange) -->
|
||||
<!-- *UserPassword JS files are excluded because extraction of common code would not make the code more readable -->
|
||||
<sonar.cpd.exclusions>**/*StoreFactory.java,**/*UserPassword.js</sonar.cpd.exclusions>
|
||||
|
||||
<sonar.nodejs.executable>./scm-ui/target/frontend/buildfrontend-node/node-v${nodejs.version}-linux-x64/bin/node</sonar.nodejs.executable>
|
||||
|
||||
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
<artifactId>scm</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-annotation-processor</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<name>scm-annotation-processor</name>
|
||||
@@ -26,9 +27,9 @@
|
||||
<!-- rest api -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
<artifactId>jersey-core</artifactId>
|
||||
<version>${jersey.version}</version>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>${jaxrs.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- event bus -->
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
|
||||
*
|
||||
* <p>
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* <p>
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
@@ -11,7 +11,7 @@
|
||||
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||
* nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
@@ -22,13 +22,11 @@
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* <p>
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.annotation;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -104,35 +102,28 @@ import javax.xml.transform.stream.StreamResult;
|
||||
import static javax.lang.model.util.ElementFilter.methodsIn;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@SupportedAnnotationTypes("*")
|
||||
@MetaInfServices(Processor.class)
|
||||
@SuppressWarnings({ "Since16", "Since15" })
|
||||
@SuppressWarnings({"Since16", "Since15"})
|
||||
@SupportedSourceVersion(SourceVersion.RELEASE_8)
|
||||
public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
|
||||
private static final String DESCRIPTOR_MODULE = "META-INF/scm/module.xml";
|
||||
private static final String DESCRIPTOR_PLUGIN = "META-INF/scm/plugin.xml";
|
||||
|
||||
private static final String EL_MODULE = "module";
|
||||
|
||||
private static final String EMPTY = "";
|
||||
|
||||
private static final String PROPERTY_VALUE = "yes";
|
||||
|
||||
private static final Set<String> SUBSCRIBE_ANNOTATIONS = ImmutableSet.of(Subscribe.class.getName());
|
||||
|
||||
private static final Set<ClassAnnotation> CLASS_ANNOTATIONS = ImmutableSet.of(
|
||||
new ClassAnnotation("rest-resource", Path.class),
|
||||
new ClassAnnotation("rest-provider", Provider.class)
|
||||
);
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
private static final Set<String> SUBSCRIBE_ANNOTATIONS =
|
||||
ImmutableSet.of(Subscribe.class.getName());
|
||||
private static final Set<ClassAnnotation> CLASS_ANNOTATIONS =
|
||||
ImmutableSet.of(new ClassAnnotation("rest-resource", Path.class),
|
||||
new ClassAnnotation("rest-provider", Provider.class));
|
||||
|
||||
@Override
|
||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||
public boolean process(Set<? extends TypeElement> annotations,
|
||||
RoundEnvironment roundEnv) {
|
||||
if (!roundEnv.processingOver()) {
|
||||
Set<DescriptorElement> descriptorElements = Sets.newHashSet();
|
||||
Set<TypeElement> subscriberAnnotations = Sets.newHashSet();
|
||||
@@ -150,10 +141,12 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
}
|
||||
|
||||
for (ClassAnnotation ca : CLASS_ANNOTATIONS) {
|
||||
TypeElement annotation = findAnnotation(annotations, ca.annotationClass);
|
||||
TypeElement annotation = findAnnotation(annotations,
|
||||
ca.annotationClass);
|
||||
|
||||
if (annotation != null) {
|
||||
scanForClassAnnotations(descriptorElements, roundEnv, annotation, ca.elementName);
|
||||
scanForClassAnnotations(descriptorElements, roundEnv, annotation,
|
||||
ca.elementName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,6 +160,7 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void close(Closeable closeable) {
|
||||
if (closeable != null) {
|
||||
try {
|
||||
@@ -177,13 +171,14 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private TypeElement findAnnotation(Set<? extends TypeElement> annotations,
|
||||
Class<? extends Annotation> annotationClass) {
|
||||
TypeElement annotation = null;
|
||||
|
||||
for (TypeElement te : annotations) {
|
||||
if (te.getQualifiedName().toString().equals(annotationClass.getName())) {
|
||||
annotation = te;
|
||||
for (TypeElement typeElement : annotations) {
|
||||
if (typeElement.getQualifiedName().toString().equals(annotationClass.getName())) {
|
||||
annotation = typeElement;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -192,18 +187,22 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
|
||||
private File findDescriptor(Filer filer) throws IOException {
|
||||
FileObject f = filer.getResource(StandardLocation.CLASS_OUTPUT, EMPTY, DESCRIPTOR_PLUGIN);
|
||||
FileObject f = filer.getResource(StandardLocation.CLASS_OUTPUT, EMPTY,
|
||||
DESCRIPTOR_PLUGIN);
|
||||
File file = new File(f.toUri());
|
||||
|
||||
if (!file.exists()) {
|
||||
f = filer.getResource(StandardLocation.CLASS_OUTPUT, EMPTY, DESCRIPTOR_MODULE);
|
||||
f = filer.getResource(StandardLocation.CLASS_OUTPUT, EMPTY,
|
||||
DESCRIPTOR_MODULE);
|
||||
file = new File(f.toUri());
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
private Document parseDocument(File file) {
|
||||
Document doc = null;
|
||||
InputStream input = null;
|
||||
@@ -219,8 +218,8 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
doc = builder.newDocument();
|
||||
doc.appendChild(doc.createElement(EL_MODULE));
|
||||
}
|
||||
}
|
||||
catch (ParserConfigurationException | SAXException | IOException | DOMException ex) {
|
||||
} catch (ParserConfigurationException | SAXException | IOException
|
||||
| DOMException ex) {
|
||||
printException("could not parse document", ex);
|
||||
} finally {
|
||||
close(input);
|
||||
@@ -229,6 +228,7 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
return doc;
|
||||
}
|
||||
|
||||
|
||||
private String prepareArrayElement(Object obj) {
|
||||
String v = obj.toString();
|
||||
|
||||
@@ -243,6 +243,7 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
private void printException(String msg, Throwable throwable) {
|
||||
processingEnv.getMessager().printMessage(Kind.ERROR, msg);
|
||||
|
||||
@@ -251,11 +252,16 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
processingEnv.getMessager().printMessage(Kind.ERROR, stack);
|
||||
}
|
||||
|
||||
private void scanForClassAnnotations(Set<DescriptorElement> descriptorElements,
|
||||
RoundEnvironment roundEnv, TypeElement annotation, String elementName) {
|
||||
|
||||
private void scanForClassAnnotations(
|
||||
Set<DescriptorElement> descriptorElements, RoundEnvironment roundEnv,
|
||||
TypeElement annotation, String elementName) {
|
||||
|
||||
Set<ClassWithAttributes> classes = Sets.newHashSet();
|
||||
|
||||
for (Element e : roundEnv.getElementsAnnotatedWith(annotation)) {
|
||||
if (e.getKind().isClass() || e.getKind().isInterface()) {
|
||||
|
||||
if (isClassOrInterface(e)) {
|
||||
TypeElement type = (TypeElement) e;
|
||||
String desc = processingEnv.getElementUtils().getDocComment(type);
|
||||
|
||||
@@ -265,9 +271,7 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
|
||||
classes.add(
|
||||
new ClassWithAttributes(
|
||||
type.getQualifiedName().toString(),
|
||||
desc,
|
||||
getAttributesFromAnnotation(e, annotation)
|
||||
type.getQualifiedName().toString(), desc, getAttributesFromAnnotation(e, annotation)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -276,8 +280,15 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
descriptorElements.add(new ClassSetElement(elementName, classes));
|
||||
}
|
||||
|
||||
private void scanForSubscriberAnnotations(Set<DescriptorElement> descriptorElements, RoundEnvironment roundEnv,
|
||||
TypeElement annotation) {
|
||||
|
||||
private boolean isClassOrInterface(Element e) {
|
||||
return e.getKind().isClass() || e.getKind().isInterface();
|
||||
}
|
||||
|
||||
|
||||
private void scanForSubscriberAnnotations(
|
||||
Set<DescriptorElement> descriptorElements, RoundEnvironment roundEnv,
|
||||
TypeElement annotation) {
|
||||
for (Element el : roundEnv.getElementsAnnotatedWith(annotation)) {
|
||||
if (el.getKind() == ElementKind.METHOD) {
|
||||
ExecutableElement ee = (ExecutableElement) el;
|
||||
@@ -305,6 +316,7 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void write(Set<DescriptorElement> descriptorElements) {
|
||||
Filer filer = processingEnv.getFiler();
|
||||
|
||||
@@ -327,6 +339,7 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void writeDocument(Document doc, File file) {
|
||||
Writer writer = null;
|
||||
|
||||
@@ -346,26 +359,30 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
private Map<String, String> getAttributesFromAnnotation(Element el, TypeElement annotation) {
|
||||
private Map<String, String> getAttributesFromAnnotation(Element el,
|
||||
TypeElement annotation) {
|
||||
Map<String, String> attributes = Maps.newHashMap();
|
||||
|
||||
for (AnnotationMirror am : el.getAnnotationMirrors()) {
|
||||
String qn = am.getAnnotationType().asElement().toString();
|
||||
for (AnnotationMirror annotationMirror : el.getAnnotationMirrors()) {
|
||||
String qn = annotationMirror.getAnnotationType().asElement().toString();
|
||||
|
||||
if (qn.equals(annotation.toString())) {
|
||||
for (Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : am.getElementValues().entrySet()) {
|
||||
for (Entry<? extends ExecutableElement,
|
||||
? extends AnnotationValue> entry : annotationMirror.getElementValues().entrySet()) {
|
||||
attributes.put(entry.getKey().getSimpleName().toString(),
|
||||
getValue(entry.getValue()));
|
||||
}
|
||||
|
||||
// add default values
|
||||
for (ExecutableElement meth : methodsIn(am.getAnnotationType().asElement().getEnclosedElements())) {
|
||||
for (ExecutableElement meth : methodsIn(annotationMirror.getAnnotationType().asElement().getEnclosedElements())) {
|
||||
String attribute = meth.getSimpleName().toString();
|
||||
AnnotationValue defaultValue = meth.getDefaultValue();
|
||||
if (defaultValue != null && !attributes.containsKey(attribute)) {
|
||||
attributes.put(attribute, getValue(defaultValue));
|
||||
String value = getValue(defaultValue);
|
||||
if (value != null && !value.isEmpty()) {
|
||||
attributes.put(attribute, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -374,6 +391,7 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
|
||||
private String getValue(AnnotationValue v) {
|
||||
String value;
|
||||
Object object = v.getValue();
|
||||
@@ -388,7 +406,6 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
if (it.hasNext()) {
|
||||
buffer.append(",");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
value = buffer.toString();
|
||||
@@ -399,17 +416,17 @@ public final class ScmAnnotationProcessor extends AbstractProcessor {
|
||||
return value;
|
||||
}
|
||||
|
||||
//~--- inner classes --------------------------------------------------------
|
||||
|
||||
private static final class ClassAnnotation {
|
||||
|
||||
private final String elementName;
|
||||
private final Class<? extends Annotation> annotationClass;
|
||||
public ClassAnnotation(String elementName,
|
||||
Class<? extends Annotation> annotationClass) {
|
||||
|
||||
ClassAnnotation(String elementName, Class<? extends Annotation> annotationClass) {
|
||||
this.elementName = elementName;
|
||||
this.annotationClass = annotationClass;
|
||||
}
|
||||
|
||||
private final Class<? extends Annotation> annotationClass;
|
||||
private final String elementName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package sonia.scm.api.v2.resources;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation to specify the source of an enricher.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 2.0.0
|
||||
*/
|
||||
@Documented
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Enrich {
|
||||
|
||||
/**
|
||||
* Source mapping class.
|
||||
*
|
||||
* @return source mapping class
|
||||
*/
|
||||
Class<?> value();
|
||||
}
|
||||
@@ -33,8 +33,6 @@
|
||||
|
||||
package sonia.scm.plugin;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package sonia.scm.security;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Use this annotation to mark REST resource methods that may be accessed <b>without</b> authentication.
|
||||
* To mark all methods of a complete class you can annotate the class instead.
|
||||
*/
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface AllowAnonymousAccess {
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>sonia.scm.clients</groupId>
|
||||
<artifactId>scm-clients</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<name>scm-clients</name>
|
||||
|
||||
<modules>
|
||||
<module>scm-client-api</module>
|
||||
<module>scm-client-impl</module>
|
||||
<module>scm-cli-client</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--
|
||||
scm-core with excludes.
|
||||
TODO: create a module only for data objects.
|
||||
-->
|
||||
|
||||
<dependency>
|
||||
<artifactId>scm-core</artifactId>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<type>jar</type>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>aopalliance</artifactId>
|
||||
<groupId>aopalliance</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guice</artifactId>
|
||||
<groupId>com.google.inject</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guice-multibindings</artifactId>
|
||||
<groupId>com.google.inject.extensions</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guice-servlet</artifactId>
|
||||
<groupId>com.google.inject.extensions</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>jersey-core</artifactId>
|
||||
<groupId>com.sun.jersey</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guice-throwingproviders</artifactId>
|
||||
<groupId>com.google.inject.extensions</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<groupId>commons-lang</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,218 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>scm-clients</artifactId>
|
||||
<groupId>sonia.scm.clients</groupId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>scm-cli-client</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<name>scm-cli-client</name>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- fix javadoc -->
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>${servlet.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.transaction</groupId>
|
||||
<artifactId>jta</artifactId>
|
||||
<version>1.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.scm.clients</groupId>
|
||||
<artifactId>scm-client-impl</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>args4j</groupId>
|
||||
<artifactId>args4j</artifactId>
|
||||
<version>2.0.29</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>${logback.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.21</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.mycila.maven-license-plugin</groupId>
|
||||
<artifactId>maven-license-plugin</artifactId>
|
||||
<version>1.9.0</version>
|
||||
<configuration>
|
||||
<header>http://download.scm-manager.org/licenses/mvn-license.txt</header>
|
||||
<includes>
|
||||
<include>src/**</include>
|
||||
<include>**/test/**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>target/**</exclude>
|
||||
<exclude>.hg/**</exclude>
|
||||
<exclude>**/*.ftl</exclude>
|
||||
</excludes>
|
||||
<strictCheck>true</strictCheck>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>sonia.scm.cli.App</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||
</descriptorRefs>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
<id>it</id>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactItems>
|
||||
<artifactItem>
|
||||
<groupId>sonia.scm</groupId>
|
||||
<artifactId>scm-webapp</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<type>war</type>
|
||||
<outputDirectory>${project.build.directory}/webapp</outputDirectory>
|
||||
<destFileName>scm-webapp.war</destFileName>
|
||||
</artifactItem>
|
||||
</artifactItems>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>2.12</version>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<scm.version>${project.version}</scm.version>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>integration-test</id>
|
||||
<goals>
|
||||
<goal>integration-test</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>verify</id>
|
||||
<goals>
|
||||
<goal>verify</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${jetty.maven.version}</version>
|
||||
<configuration>
|
||||
<stopPort>8085</stopPort>
|
||||
<stopKey>STOP</stopKey>
|
||||
<systemProperties>
|
||||
<systemProperty>
|
||||
<name>scm.home</name>
|
||||
<value>target/scm-it</value>
|
||||
</systemProperty>
|
||||
<systemProperty>
|
||||
<name>file.encoding</name>
|
||||
<value>UTF-8</value>
|
||||
</systemProperty>
|
||||
</systemProperties>
|
||||
<httpConnector>
|
||||
<port>8081</port>
|
||||
</httpConnector>
|
||||
<webApp>
|
||||
<contextPath>/scm</contextPath>
|
||||
</webApp>
|
||||
<war>${project.build.directory}/webapp/scm-webapp.war</war>
|
||||
<scanIntervalSeconds>0</scanIntervalSeconds>
|
||||
<daemon>true</daemon>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>start-jetty</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>deploy-war</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>stop-jetty</id>
|
||||
<phase>post-integration-test</phase>
|
||||
<goals>
|
||||
<goal>stop</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
@@ -1,339 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.cli.cmd.CommandDescriptor;
|
||||
import sonia.scm.cli.cmd.SubCommand;
|
||||
import sonia.scm.cli.cmd.SubCommandHandler;
|
||||
import sonia.scm.cli.cmd.SubCommandOptionHandler;
|
||||
import sonia.scm.cli.config.ConfigOptionHandler;
|
||||
import sonia.scm.cli.config.ScmClientConfig;
|
||||
import sonia.scm.cli.config.ServerConfig;
|
||||
import sonia.scm.util.IOUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
|
||||
/** the logger for App */
|
||||
private static final Logger logger = LoggerFactory.getLogger(App.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public App()
|
||||
{
|
||||
this(System.in, System.out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param input
|
||||
* @param output
|
||||
*/
|
||||
public App(BufferedReader input, PrintWriter output)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param input
|
||||
* @param output
|
||||
*/
|
||||
public App(InputStream input, OutputStream output)
|
||||
{
|
||||
this.input = new BufferedReader(new InputStreamReader(input));
|
||||
this.output = new PrintWriter(output);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new App().run(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
protected void run(String[] args)
|
||||
{
|
||||
CmdLineParser parser = new CmdLineParser(this);
|
||||
|
||||
try
|
||||
{
|
||||
parser.parseArgument(args);
|
||||
}
|
||||
catch (CmdLineException ex)
|
||||
{
|
||||
|
||||
// todo error handling
|
||||
logger.warn("could not parse commandline", ex);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
configureLogger();
|
||||
loadConfig();
|
||||
|
||||
I18n i18n = new I18n();
|
||||
|
||||
if ((args.length == 0) || (subcommand == null) || help)
|
||||
{
|
||||
printHelp(parser, i18n);
|
||||
}
|
||||
else
|
||||
{
|
||||
subcommand.init(input, output, i18n, config);
|
||||
subcommand.run(arguments);
|
||||
}
|
||||
|
||||
IOUtil.close(input);
|
||||
IOUtil.close(output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
private void configureLogger()
|
||||
{
|
||||
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||
|
||||
lc.getLogger(Logger.ROOT_LOGGER_NAME).setLevel(loggingLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
private void loadConfig()
|
||||
{
|
||||
if (config == null)
|
||||
{
|
||||
config = ScmClientConfig.getInstance().getDefaultConfig();
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(serverUrl))
|
||||
{
|
||||
config.setServerUrl(serverUrl);
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(username))
|
||||
{
|
||||
config.setUsername(username);
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(password))
|
||||
{
|
||||
config.setPassword(password);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param parser
|
||||
* @param i18n
|
||||
*/
|
||||
private void printHelp(CmdLineParser parser, I18n i18n)
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.USAGE));
|
||||
output.println();
|
||||
output.append(i18n.getMessage(I18n.OPTIONS)).println(":");
|
||||
output.println();
|
||||
parser.printUsage(output, i18n.getBundle());
|
||||
output.println();
|
||||
output.append(i18n.getMessage(I18n.SUBCOMMANDS_TITLE)).println(":");
|
||||
output.println();
|
||||
|
||||
String group = null;
|
||||
List<CommandDescriptor> descList =
|
||||
SubCommandHandler.getInstance().getDescriptors();
|
||||
int length = 0;
|
||||
|
||||
for (CommandDescriptor desc : descList)
|
||||
{
|
||||
int l = desc.getName().length();
|
||||
|
||||
if (l > length)
|
||||
{
|
||||
length = l;
|
||||
}
|
||||
}
|
||||
|
||||
length += 5;
|
||||
|
||||
for (CommandDescriptor desc :
|
||||
SubCommandHandler.getInstance().getDescriptors())
|
||||
{
|
||||
if ((group == null) ||!group.equals(desc.getGroup()))
|
||||
{
|
||||
output.println();
|
||||
group = desc.getGroup();
|
||||
output.append(i18n.getMessage(group)).println(":");
|
||||
output.println();
|
||||
}
|
||||
|
||||
int l = desc.getName().length();
|
||||
|
||||
output.append(" ").append(desc.getName());
|
||||
l = length - l;
|
||||
|
||||
for (int i = 0; i < l; i++)
|
||||
{
|
||||
output.append(" ");
|
||||
}
|
||||
|
||||
output.println(i18n.getMessage(desc.getUsage()));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--config",
|
||||
usage = "optionConfig",
|
||||
metaVar = "config",
|
||||
handler = ConfigOptionHandler.class,
|
||||
aliases = { "-c" }
|
||||
)
|
||||
private ServerConfig config;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--help",
|
||||
usage = "optionHelpText",
|
||||
aliases = { "-h" }
|
||||
)
|
||||
private boolean help = false;
|
||||
|
||||
/** Field description */
|
||||
@Argument(index = 1, metaVar = "arg")
|
||||
private List<String> arguments = new ArrayList<>();
|
||||
|
||||
/** Field description */
|
||||
private BufferedReader input;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--logging-level",
|
||||
usage = "optionLoggingLevel",
|
||||
handler = LoggingLevelOptionHandler.class,
|
||||
aliases = { "-l" }
|
||||
)
|
||||
private Level loggingLevel = Level.ERROR;
|
||||
|
||||
/** Field description */
|
||||
private PrintWriter output;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--password",
|
||||
usage = "optionPassword",
|
||||
aliases = { "-p" }
|
||||
)
|
||||
private String password;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--server",
|
||||
usage = "optionServerUrl",
|
||||
aliases = { "-s" }
|
||||
)
|
||||
private String serverUrl;
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
index = 0,
|
||||
metaVar = "metaVar_command",
|
||||
handler = SubCommandOptionHandler.class
|
||||
)
|
||||
private SubCommand subcommand;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--user",
|
||||
usage = "optionUsername",
|
||||
aliases = { "-u" }
|
||||
)
|
||||
private String username;
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.cli;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.OptionDef;
|
||||
import org.kohsuke.args4j.spi.OptionHandler;
|
||||
import org.kohsuke.args4j.spi.Parameters;
|
||||
import org.kohsuke.args4j.spi.Setter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class BooleanModifyOptionHandler extends OptionHandler<Boolean>
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param parser
|
||||
* @param option
|
||||
* @param setter
|
||||
*/
|
||||
public BooleanModifyOptionHandler(CmdLineParser parser, OptionDef option,
|
||||
Setter<? super Boolean> setter)
|
||||
{
|
||||
super(parser, option, setter);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param params
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws CmdLineException
|
||||
*/
|
||||
@Override
|
||||
public int parseArguments(Parameters params) throws CmdLineException
|
||||
{
|
||||
Boolean bool = Boolean.valueOf(params.getParameter(0));
|
||||
|
||||
setter.addValue(bool);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultMetaVariable()
|
||||
{
|
||||
return I18n.BOOLEAN;
|
||||
}
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class I18n
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String ERROR = "error";
|
||||
|
||||
/** Field description */
|
||||
public static final String GROUP_NOT_FOUND = "groupNotFound";
|
||||
|
||||
/** Field description */
|
||||
public static final String LEVEL = "level";
|
||||
|
||||
|
||||
public static final String BOOLEAN = "boolean";
|
||||
|
||||
/** Field description */
|
||||
public static final String OPTIONS = "options";
|
||||
|
||||
/** Field description */
|
||||
public static final String REPOSITORY_NOT_FOUND = "repositoryNotFound";
|
||||
|
||||
/** Field description */
|
||||
public static final String RESOURCE_BUNDLE = "sonia.resources.i18n";
|
||||
|
||||
/** Field description */
|
||||
public static final String SUBCOMMANDS_TITLE = "subCommandsTitle";
|
||||
|
||||
/** Field description */
|
||||
public static final String USAGE = "usage";
|
||||
|
||||
/** Field description */
|
||||
public static final String USER_NOT_FOUND = "userNotFound";
|
||||
|
||||
/** the logger for I18n */
|
||||
private static final Logger logger = LoggerFactory.getLogger(I18n.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public I18n()
|
||||
{
|
||||
bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ResourceBundle getBundle()
|
||||
{
|
||||
return bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param key
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getMessage(String key)
|
||||
{
|
||||
String value = key;
|
||||
|
||||
try
|
||||
{
|
||||
value = bundle.getString(key);
|
||||
}
|
||||
catch (MissingResourceException ex)
|
||||
{
|
||||
logger.warn("could not find resource for key {}", key);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private ResourceBundle bundle;
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.OptionDef;
|
||||
import org.kohsuke.args4j.spi.OptionHandler;
|
||||
import org.kohsuke.args4j.spi.Parameters;
|
||||
import org.kohsuke.args4j.spi.Setter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class LoggingLevelOptionHandler extends OptionHandler<Level>
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param parser
|
||||
* @param option
|
||||
* @param setter
|
||||
*/
|
||||
public LoggingLevelOptionHandler(CmdLineParser parser, OptionDef option,
|
||||
Setter<? super Level> setter)
|
||||
{
|
||||
super(parser, option, setter);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param params
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws CmdLineException
|
||||
*/
|
||||
@Override
|
||||
public int parseArguments(Parameters params) throws CmdLineException
|
||||
{
|
||||
String value = params.getParameter(0);
|
||||
Level l = Level.toLevel(value);
|
||||
|
||||
setter.addValue(l);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultMetaVariable()
|
||||
{
|
||||
return I18n.LEVEL;
|
||||
}
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Sebastian Sdorra All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||
* nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Localizable;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* TODO create real implementation
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class SimpleLocalizable implements Localizable
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public SimpleLocalizable(String message)
|
||||
{
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param args
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String format(Object... args)
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param locale
|
||||
* @param args
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String formatWithLocale(Locale locale, Object... args)
|
||||
{
|
||||
return message;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final String message;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.group.Group;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "add-members",
|
||||
usage = "usageAddMember",
|
||||
group = "group"
|
||||
)
|
||||
public class AddMembersSubCommand extends MembersSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param group
|
||||
* @param members
|
||||
*/
|
||||
@Override
|
||||
protected void modifyMembers(Group group, List<String> members)
|
||||
{
|
||||
group.getMembers().addAll(members);
|
||||
}
|
||||
}
|
||||
@@ -1,147 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.repository.Permission;
|
||||
import sonia.scm.repository.PermissionType;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "add-permission",
|
||||
usage = "usageAddPermission",
|
||||
group = "repository"
|
||||
)
|
||||
public class AddPermissionSubCommand extends PermissionSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public PermissionType getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isGroup()
|
||||
{
|
||||
return group;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param group
|
||||
*/
|
||||
public void setGroup(boolean group)
|
||||
{
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public void setType(PermissionType type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param permissions
|
||||
*/
|
||||
@Override
|
||||
protected void modifyPermissions(List<Permission> permissions)
|
||||
{
|
||||
permissions.add(new Permission(name, type, group));
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--group",
|
||||
usage = "optionPermissionGroup",
|
||||
aliases = { "-g" }
|
||||
)
|
||||
private boolean group = false;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--name",
|
||||
usage = "optionPermissionName",
|
||||
required = true,
|
||||
aliases = { "-n" }
|
||||
)
|
||||
private String name;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--type",
|
||||
usage = "optionPermissionType",
|
||||
required = true,
|
||||
metaVar = "permissiontype",
|
||||
aliases = { "-t" }
|
||||
)
|
||||
private PermissionType type;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Command
|
||||
{
|
||||
String name() default "";
|
||||
String usage() default "";
|
||||
String group() default "misc";
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.util.AssertUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class CommandDescriptor implements Comparable<CommandDescriptor>
|
||||
{
|
||||
|
||||
/** the logger for CommandDescriptor */
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(CommandDescriptor.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param commandClass
|
||||
*/
|
||||
public CommandDescriptor(Class<? extends SubCommand> commandClass)
|
||||
{
|
||||
AssertUtil.assertIsNotNull(commandClass);
|
||||
this.commandClass = commandClass;
|
||||
|
||||
Command cmd = commandClass.getAnnotation(Command.class);
|
||||
|
||||
if (cmd != null)
|
||||
{
|
||||
this.name = cmd.name();
|
||||
this.group = cmd.group();
|
||||
this.usage = cmd.usage();
|
||||
}
|
||||
|
||||
if (Util.isEmpty(name))
|
||||
{
|
||||
name = commandClass.getSimpleName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @param usage
|
||||
* @param commandClass
|
||||
*/
|
||||
public CommandDescriptor(String name, String usage,
|
||||
Class<? extends SubCommand> commandClass)
|
||||
{
|
||||
this.name = name;
|
||||
this.usage = usage;
|
||||
this.commandClass = commandClass;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param desc
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(CommandDescriptor desc)
|
||||
{
|
||||
int result = group.compareTo(desc.group);
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
result = name.compareTo(desc.name);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SubCommand createSubCommand()
|
||||
{
|
||||
SubCommand command = null;
|
||||
|
||||
try
|
||||
{
|
||||
command = commandClass.newInstance();
|
||||
command.setCommandName(name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.error("could not create SubCommand {}", commandClass.getName());
|
||||
}
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Class<? extends SubCommand> getCommandClass()
|
||||
{
|
||||
return commandClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getGroup()
|
||||
{
|
||||
return group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getUsage()
|
||||
{
|
||||
return usage;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Class<? extends SubCommand> commandClass;
|
||||
|
||||
/** Field description */
|
||||
private String group = "misc";
|
||||
|
||||
/** Field description */
|
||||
private String name;
|
||||
|
||||
/** Field description */
|
||||
private String usage = "";
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.cli.wrapper.GroupWrapper;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.group.Group;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "create-group",
|
||||
usage = "usageCreateGroup",
|
||||
group = "group"
|
||||
)
|
||||
public class CreateGroupSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<String> getMembers()
|
||||
{
|
||||
return members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param description
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param members
|
||||
*/
|
||||
public void setMembers(List<String> members)
|
||||
{
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
Group group = new Group();
|
||||
|
||||
group.setName(name);
|
||||
group.setDescription(description);
|
||||
group.setType(type);
|
||||
group.setMembers(members);
|
||||
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
session.getGroupHandler().create(group);
|
||||
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("group", new GroupWrapper(group));
|
||||
renderTemplate(env, GetGroupSubCommand.TEMPLATE);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--description",
|
||||
usage = "optionGroupDescription",
|
||||
aliases = { "-d" }
|
||||
)
|
||||
private String description;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--member",
|
||||
usage = "optionGroupMember",
|
||||
aliases = { "-m" }
|
||||
)
|
||||
private List<String> members;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--name",
|
||||
usage = "optionGroupName",
|
||||
required = true,
|
||||
aliases = { "-n" }
|
||||
)
|
||||
private String name;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--type",
|
||||
usage = "optionGroupType",
|
||||
aliases = { "-t" }
|
||||
)
|
||||
private String type = "xml";
|
||||
}
|
||||
@@ -1,220 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.cli.wrapper.RepositoryWrapper;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "create-repository",
|
||||
usage = "usageCreateRepository",
|
||||
group = "repository"
|
||||
)
|
||||
public class CreateRepositorySubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getContact()
|
||||
{
|
||||
return contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isPublicReadable()
|
||||
{
|
||||
return publicReadable;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param contact
|
||||
*/
|
||||
public void setContact(String contact)
|
||||
{
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param description
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param publicReadable
|
||||
*/
|
||||
public void setPublicReadable(boolean publicReadable)
|
||||
{
|
||||
this.publicReadable = publicReadable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
Repository repository = new Repository();
|
||||
|
||||
repository.setName(name);
|
||||
repository.setType(type);
|
||||
repository.setContact(contact);
|
||||
repository.setDescription(description);
|
||||
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
session.getRepositoryHandler().create(repository);
|
||||
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, GetRepositorySubCommand.TEMPLATE);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--contact",
|
||||
usage = "optionRepositoryContact",
|
||||
aliases = { "-c" }
|
||||
)
|
||||
private String contact;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--description",
|
||||
usage = "optionRepositoryDescription",
|
||||
aliases = { "-d" }
|
||||
)
|
||||
private String description;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--name",
|
||||
required = true,
|
||||
usage = "optionRepositoryName",
|
||||
aliases = { "-n" }
|
||||
)
|
||||
private String name;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--public",
|
||||
usage = "optionRepositoryPublic",
|
||||
aliases = { "-p" }
|
||||
)
|
||||
private boolean publicReadable;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--type",
|
||||
required = true,
|
||||
usage = "optionRepositoryType",
|
||||
aliases = { "-t" }
|
||||
)
|
||||
private String type;
|
||||
}
|
||||
@@ -1,274 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.cli.wrapper.UserWrapper;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.user.User;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "create-user",
|
||||
usage = "usageCreateUser",
|
||||
group = "user"
|
||||
)
|
||||
public class CreateUserSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDisplayName()
|
||||
{
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getMail()
|
||||
{
|
||||
return mail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isAdmin()
|
||||
{
|
||||
return admin;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param admin
|
||||
*/
|
||||
public void setAdmin(boolean admin)
|
||||
{
|
||||
this.admin = admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param displayName
|
||||
*/
|
||||
public void setDisplayName(String displayName)
|
||||
{
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param mail
|
||||
*/
|
||||
public void setMail(String mail)
|
||||
{
|
||||
this.mail = mail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param password
|
||||
*/
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
User user = new User();
|
||||
|
||||
user.setName(name);
|
||||
user.setAdmin(admin);
|
||||
user.setDisplayName(displayName);
|
||||
user.setPassword(password);
|
||||
user.setMail(mail);
|
||||
user.setType(type);
|
||||
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
session.getUserHandler().create(user);
|
||||
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("user", new UserWrapper(user));
|
||||
renderTemplate(env, GetUserSubCommand.TEMPLATE);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--admin",
|
||||
usage = "optionUserAdmin",
|
||||
aliases = { "-a" }
|
||||
)
|
||||
private boolean admin = false;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--display-name",
|
||||
usage = "optionUserDisplayName",
|
||||
required = true,
|
||||
aliases = { "-d" }
|
||||
)
|
||||
private String displayName;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--mail",
|
||||
usage = "optionUserMail",
|
||||
aliases = { "-m" }
|
||||
)
|
||||
private String mail;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--name",
|
||||
usage = "optionUserName",
|
||||
required = true,
|
||||
aliases = { "-n" }
|
||||
)
|
||||
private String name;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--password",
|
||||
usage = "optionUserPassword",
|
||||
aliases = { "-p" }
|
||||
)
|
||||
private String password;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--type",
|
||||
usage = "optionUserType",
|
||||
aliases = { "-t" }
|
||||
)
|
||||
private String type = "xml";
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.cli.config.ScmClientConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "delete-config",
|
||||
usage = "usageDeleteConfig",
|
||||
group = "config"
|
||||
)
|
||||
public class DeleteConfigSubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientConfig.getInstance().delete();
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "delete-group",
|
||||
usage = "usageDeleteGroup",
|
||||
group = "group"
|
||||
)
|
||||
public class DeleteGroupSubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
session.getGroupHandler().delete(name);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionGroupName",
|
||||
metaVar = "groupname",
|
||||
required = true
|
||||
)
|
||||
private String name;
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.group.Group;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "delete-members",
|
||||
usage = "usageDeleteMembers",
|
||||
group = "group"
|
||||
)
|
||||
public class DeleteMembersSubCommand extends MembersSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param group
|
||||
* @param members
|
||||
*/
|
||||
@Override
|
||||
protected void modifyMembers(Group group, List<String> members)
|
||||
{
|
||||
group.getMembers().removeAll(members);
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
import sonia.scm.repository.Permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "delete-permission",
|
||||
usage = "usageDeletePermission",
|
||||
group = "repository"
|
||||
)
|
||||
public class DeletePermissionSubCommand extends PermissionSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param permissions
|
||||
*/
|
||||
@Override
|
||||
protected void modifyPermissions(List<Permission> permissions)
|
||||
{
|
||||
permissions.removeIf(p -> name.equals(p.getName()));
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--name",
|
||||
usage = "optionPermissionName",
|
||||
required = true,
|
||||
aliases = { "-n" }
|
||||
)
|
||||
private String name;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "delete-repository",
|
||||
usage = "usageDeleteRepository",
|
||||
group = "repository"
|
||||
)
|
||||
public class DeleteRepositorySubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
session.getRepositoryHandler().delete(id);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionRepositoryId",
|
||||
metaVar = "repositoryid",
|
||||
required = true
|
||||
)
|
||||
private String id;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "delete-user",
|
||||
usage = "usageDeleteUser",
|
||||
group = "user"
|
||||
)
|
||||
public class DeleteUserSubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
session.getUserHandler().delete(name);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionUserName",
|
||||
metaVar = "username",
|
||||
required = true
|
||||
)
|
||||
private String name;
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||
* nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.41
|
||||
*/
|
||||
@Command(
|
||||
name = "encrypt",
|
||||
usage = "usageEncrypt",
|
||||
group = "security"
|
||||
)
|
||||
public class EncryptSubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
public void setValue(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
String enc = createSession().getSecurityHandler().encrypt(value);
|
||||
|
||||
output.println(enc);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionEncryptValue",
|
||||
metaVar = "value",
|
||||
required = true
|
||||
)
|
||||
private String value;
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||
* nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "generate-key",
|
||||
usage = "usageGenerateKey",
|
||||
group = "security"
|
||||
)
|
||||
public class GenerateKeySubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
output.println(createSession().getSecurityHandler().generateKey());
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.wrapper.GroupWrapper;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.group.Group;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "get-group",
|
||||
usage = "usageGetGroup",
|
||||
group = "group"
|
||||
)
|
||||
public class GetGroupSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String TEMPLATE = "/sonia/resources/get-group.ftl";
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
Group group = session.getGroupHandler().get(name);
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("group", new GroupWrapper(group));
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.GROUP_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionGroupName",
|
||||
metaVar = "groupname",
|
||||
required = true
|
||||
)
|
||||
private String name;
|
||||
}
|
||||
@@ -1,140 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.wrapper.RepositoryWrapper;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "get-repository",
|
||||
usage = "usageGetRepository",
|
||||
group = "repository"
|
||||
)
|
||||
public class GetRepositorySubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String TEMPLATE = "/sonia/resources/get-repository.ftl";
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
Repository repository;
|
||||
|
||||
int index = id.indexOf("/");
|
||||
|
||||
if (index > 0)
|
||||
{
|
||||
String type = id.substring(0, index);
|
||||
String name = id.substring(index + 1);
|
||||
|
||||
repository = session.getRepositoryHandler().get(type, name);
|
||||
}
|
||||
else
|
||||
{
|
||||
repository = session.getRepositoryHandler().get(id);
|
||||
}
|
||||
|
||||
if (repository != null)
|
||||
{
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.REPOSITORY_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionRepositoryIdOrTypeAndName",
|
||||
metaVar = "repositoryid",
|
||||
required = true
|
||||
)
|
||||
private String id;
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.wrapper.UserWrapper;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.user.User;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "get-user",
|
||||
usage = "usageGetUser",
|
||||
group = "user"
|
||||
)
|
||||
public class GetUserSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String TEMPLATE = "/sonia/resources/get-user.ftl";
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
User user = session.getUserHandler().get(name);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("user", new UserWrapper(user));
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.USER_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionUserName",
|
||||
metaVar = "username",
|
||||
required = true
|
||||
)
|
||||
private String name;
|
||||
}
|
||||
@@ -1,186 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Sebastian Sdorra All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||
* nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.ConfigurationException;
|
||||
import sonia.scm.client.ImportBundleRequest;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.43
|
||||
*/
|
||||
@Command(
|
||||
name = "import-from-bundle",
|
||||
usage = "usageImportBundle",
|
||||
group = "repository"
|
||||
)
|
||||
public class ImportBundleSubCommand extends ImportSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public File getBundle()
|
||||
{
|
||||
return bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isCompressed()
|
||||
{
|
||||
return compressed;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param bundle
|
||||
*/
|
||||
public void setBundle(File bundle)
|
||||
{
|
||||
this.bundle = bundle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param compressed
|
||||
*/
|
||||
public void setCompressed(boolean compressed)
|
||||
{
|
||||
this.compressed = compressed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
if (!bundle.exists())
|
||||
{
|
||||
throw new ConfigurationException("could not find bundle");
|
||||
}
|
||||
else
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
ImportBundleRequest req = new ImportBundleRequest(getType(), name,
|
||||
Files.asByteSource(bundle));
|
||||
|
||||
req.setCompressed(compressed);
|
||||
|
||||
Repository repository =
|
||||
session.getRepositoryHandler().importFromBundle(req);
|
||||
|
||||
printImportedRepository(repository);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--bundle",
|
||||
required = true,
|
||||
usage = "optionRepositoryBundle",
|
||||
aliases = { "-b" }
|
||||
)
|
||||
private File bundle;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--compressed",
|
||||
usage = "optionRepositoryBundleCompressed",
|
||||
aliases = { "-c" }
|
||||
)
|
||||
private boolean compressed = false;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--name",
|
||||
required = true,
|
||||
usage = "optionRepositoryName",
|
||||
aliases = { "-n" }
|
||||
)
|
||||
private String name;
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import sonia.scm.client.ImportResultWrapper;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.43
|
||||
*/
|
||||
@Command(
|
||||
name = "import-from-directory",
|
||||
usage = "usageImportDirectory",
|
||||
group = "repository"
|
||||
)
|
||||
public class ImportDirectorySubCommand extends ImportSubCommand
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String TEMPLATE =
|
||||
"/sonia/resources/import-from-directory.ftl";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
ImportResultWrapper wrapper =
|
||||
session.getRepositoryHandler().importFromDirectory(getType());
|
||||
Map<String, Object> env = Maps.newHashMap();
|
||||
|
||||
env.put("importedDirectories", wrapper.getImportedDirectories());
|
||||
env.put("failedDirectories", wrapper.getFailedDirectories());
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Sebastian Sdorra All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||
* nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import sonia.scm.cli.wrapper.RepositoryWrapper;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.43
|
||||
*/
|
||||
public abstract class ImportSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param repository
|
||||
*/
|
||||
protected void printImportedRepository(Repository repository)
|
||||
{
|
||||
Map<String, Object> env = Maps.newHashMap();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, GetRepositorySubCommand.TEMPLATE);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionRepositoryType",
|
||||
metaVar = "repositorytype",
|
||||
required = true
|
||||
)
|
||||
private String type;
|
||||
}
|
||||
@@ -1,142 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2014, Sebastian Sdorra All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||
* binary form must reproduce the above copyright notice, this list of
|
||||
* conditions and the following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||
* nor the names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
import sonia.scm.client.ImportUrlRequest;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "import-from-url",
|
||||
usage = "usageImportUrl",
|
||||
group = "repository"
|
||||
)
|
||||
public class ImportUrlSubCommand extends ImportSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public URL getUrl()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param url
|
||||
*/
|
||||
public void setUrl(URL url)
|
||||
{
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
|
||||
ImportUrlRequest request = new ImportUrlRequest(getType(), name,
|
||||
url.toExternalForm());
|
||||
Repository repository =
|
||||
session.getRepositoryHandler().importFromUrl(request);
|
||||
|
||||
printImportedRepository(repository);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--name",
|
||||
required = true,
|
||||
usage = "optionRepositoryName",
|
||||
aliases = { "-n" }
|
||||
)
|
||||
private String name;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--url",
|
||||
required = true,
|
||||
usage = "optionRemoteRepositoryUrl",
|
||||
aliases = { "-r" }
|
||||
)
|
||||
private URL url;
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.cli.wrapper.WrapperUtil;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.group.Group;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "list-groups",
|
||||
usage = "usageListGroups",
|
||||
group = "group"
|
||||
)
|
||||
public class ListGroupsSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String TEMPLATE = "/sonia/resources/list-groups.ftl";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
List<Group> groups = session.getGroupHandler().getAll();
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("groups", WrapperUtil.wrapGroups(groups));
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.cli.wrapper.WrapperUtil;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "list-repositories",
|
||||
usage = "usageListRepositories",
|
||||
group = "repository"
|
||||
)
|
||||
public class ListRepositoriesSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String TEMPLATE =
|
||||
"/sonia/resources/list-repositories.ftl";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
List<Repository> repositories = session.getRepositoryHandler().getAll();
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("repositories", WrapperUtil.wrapRepositories(config, repositories));
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.cli.wrapper.WrapperUtil;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.user.User;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "list-users",
|
||||
usage = "usageListUsers",
|
||||
group = "user"
|
||||
)
|
||||
public class ListUsersSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String TEMPLATE = "/sonia/resources/list-users.ftl";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
List<User> users = session.getUserHandler().getAll();
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("users", WrapperUtil.wrapUsers(users));
|
||||
renderTemplate(env, TEMPLATE);
|
||||
}
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.wrapper.GroupWrapper;
|
||||
import sonia.scm.client.GroupClientHandler;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.group.Group;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public abstract class MembersSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param group
|
||||
* @param members
|
||||
*/
|
||||
protected abstract void modifyMembers(Group group, List<String> members);
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<String> getMembers()
|
||||
{
|
||||
return members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param members
|
||||
*/
|
||||
public void setMembers(List<String> members)
|
||||
{
|
||||
this.members = members;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
GroupClientHandler handler = session.getGroupHandler();
|
||||
Group group = handler.get(name);
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
modifyMembers(group, members);
|
||||
handler.modify(group);
|
||||
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("group", new GroupWrapper(group));
|
||||
renderTemplate(env, GetGroupSubCommand.TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.GROUP_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--member",
|
||||
usage = "optionGroupMember",
|
||||
required = true,
|
||||
aliases = { "-m" }
|
||||
)
|
||||
private List<String> members;
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionGroupName",
|
||||
metaVar = "groupname",
|
||||
required = true
|
||||
)
|
||||
private String name;
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.wrapper.GroupWrapper;
|
||||
import sonia.scm.client.GroupClientHandler;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.group.Group;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "modify-group",
|
||||
usage = "usageModifyGroup",
|
||||
group = "group"
|
||||
)
|
||||
public class ModifyGroupSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param description
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
GroupClientHandler handler = session.getGroupHandler();
|
||||
Group group = handler.get(name);
|
||||
|
||||
if (group != null)
|
||||
{
|
||||
if (Util.isNotEmpty(description))
|
||||
{
|
||||
group.setDescription(description);
|
||||
}
|
||||
|
||||
handler.modify(group);
|
||||
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("group", new GroupWrapper(group));
|
||||
renderTemplate(env, GetGroupSubCommand.TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.GROUP_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--description",
|
||||
usage = "optionGroupDescription",
|
||||
aliases = { "-d" }
|
||||
)
|
||||
private String description;
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionGroupName",
|
||||
metaVar = "groupname",
|
||||
required = true
|
||||
)
|
||||
private String name;
|
||||
}
|
||||
@@ -1,269 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.cli.BooleanModifyOptionHandler;
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.wrapper.RepositoryWrapper;
|
||||
import sonia.scm.client.RepositoryClientHandler;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "modify-repository",
|
||||
usage = "usageModifyRepository",
|
||||
group = "repository"
|
||||
)
|
||||
public class ModifyRepositorySubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Boolean getArchvied()
|
||||
{
|
||||
return archvied;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getContact()
|
||||
{
|
||||
return contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDescription()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Boolean getPublicReadable()
|
||||
{
|
||||
return publicReadable;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param archvied
|
||||
*/
|
||||
public void setArchvied(Boolean archvied)
|
||||
{
|
||||
this.archvied = archvied;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param contact
|
||||
*/
|
||||
public void setContact(String contact)
|
||||
{
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param description
|
||||
*/
|
||||
public void setDescription(String description)
|
||||
{
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param publicReadable
|
||||
*/
|
||||
public void setPublicReadable(Boolean publicReadable)
|
||||
{
|
||||
this.publicReadable = publicReadable;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
RepositoryClientHandler handler = session.getRepositoryHandler();
|
||||
Repository repository = handler.get(id);
|
||||
|
||||
if (repository != null)
|
||||
{
|
||||
if (Util.isNotEmpty(contact))
|
||||
{
|
||||
repository.setContact(contact);
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(description))
|
||||
{
|
||||
repository.setDescription(description);
|
||||
}
|
||||
|
||||
if (archvied != null)
|
||||
{
|
||||
repository.setArchived(archvied);
|
||||
}
|
||||
|
||||
if (publicReadable != null)
|
||||
{
|
||||
repository.setPublicReadable(publicReadable);
|
||||
}
|
||||
|
||||
handler.modify(repository);
|
||||
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, GetRepositorySubCommand.TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.REPOSITORY_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--archived",
|
||||
usage = "optionRepositoryArchive",
|
||||
aliases = { "-a" },
|
||||
handler = BooleanModifyOptionHandler.class
|
||||
)
|
||||
private Boolean archvied;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--contact",
|
||||
usage = "optionRepositoryContact",
|
||||
aliases = { "-c" }
|
||||
)
|
||||
private String contact;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--description",
|
||||
usage = "optionRepositoryDescription",
|
||||
aliases = { "-d" }
|
||||
)
|
||||
private String description;
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionRepositoryId",
|
||||
metaVar = "repositoryid",
|
||||
required = true
|
||||
)
|
||||
private String id;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--public",
|
||||
usage = "optionRepositoryPublic",
|
||||
aliases = { "-p" },
|
||||
handler = BooleanModifyOptionHandler.class
|
||||
)
|
||||
private Boolean publicReadable;
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.wrapper.UserWrapper;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.client.UserClientHandler;
|
||||
import sonia.scm.user.User;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "modify-user",
|
||||
usage = "usageModifyUser",
|
||||
group = "user"
|
||||
)
|
||||
public class ModifyUserSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDisplayName()
|
||||
{
|
||||
return displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getMail()
|
||||
{
|
||||
return mail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param displayName
|
||||
*/
|
||||
public void setDisplayName(String displayName)
|
||||
{
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param mail
|
||||
*/
|
||||
public void setMail(String mail)
|
||||
{
|
||||
this.mail = mail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param password
|
||||
*/
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
UserClientHandler handler = session.getUserHandler();
|
||||
User user = handler.get(name);
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
if (Util.isNotEmpty(displayName))
|
||||
{
|
||||
user.setDisplayName(displayName);
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(mail))
|
||||
{
|
||||
user.setMail(mail);
|
||||
}
|
||||
|
||||
if (Util.isNotEmpty(password))
|
||||
{
|
||||
user.setPassword(password);
|
||||
}
|
||||
|
||||
handler.modify(user);
|
||||
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("user", new UserWrapper(user));
|
||||
renderTemplate(env, GetUserSubCommand.TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.USER_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--display-name",
|
||||
usage = "optionUserDisplayName",
|
||||
aliases = { "-d" }
|
||||
)
|
||||
private String displayName;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--mail",
|
||||
usage = "optionUserMail",
|
||||
aliases = { "-m" }
|
||||
)
|
||||
private String mail;
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionUserName",
|
||||
metaVar = "username",
|
||||
required = true
|
||||
)
|
||||
private String name;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--password",
|
||||
usage = "optionUserPassword",
|
||||
aliases = { "-p" }
|
||||
)
|
||||
private String password;
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.wrapper.RepositoryWrapper;
|
||||
import sonia.scm.client.RepositoryClientHandler;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.repository.Permission;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public abstract class PermissionSubCommand extends TemplateSubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param permissions
|
||||
*/
|
||||
protected abstract void modifyPermissions(List<Permission> permissions);
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
RepositoryClientHandler handler = session.getRepositoryHandler();
|
||||
Repository repository = handler.get(id);
|
||||
|
||||
if (repository != null)
|
||||
{
|
||||
List<Permission> permissions = repository.getPermissions();
|
||||
|
||||
if (permissions == null)
|
||||
{
|
||||
permissions = new ArrayList<>();
|
||||
}
|
||||
|
||||
modifyPermissions(permissions);
|
||||
repository.setPermissions(permissions);
|
||||
handler.modify(repository);
|
||||
|
||||
Map<String, Object> env = new HashMap<>();
|
||||
|
||||
env.put("repository", new RepositoryWrapper(config, repository));
|
||||
renderTemplate(env, GetRepositorySubCommand.TEMPLATE);
|
||||
}
|
||||
else
|
||||
{
|
||||
output.println(i18n.getMessage(I18n.REPOSITORY_NOT_FOUND));
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Argument(
|
||||
usage = "optionRepositoryId",
|
||||
metaVar = "repositoryid",
|
||||
required = true
|
||||
)
|
||||
private String id;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
import sonia.scm.ScmState;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @version 1.9
|
||||
*/
|
||||
@Command(
|
||||
name = "server-version",
|
||||
usage = "usageServerVersion",
|
||||
group = "misc"
|
||||
)
|
||||
public class ServerVersionSubCommand extends SubCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
ScmClientSession session = createSession();
|
||||
ScmState state = session.getState();
|
||||
String version = null;
|
||||
if ( state != null ){
|
||||
version = state.getVersion();
|
||||
|
||||
}
|
||||
if ( Util.isEmpty(version) ){
|
||||
version = VersionSubCommand.DEFAULT_VERSION;
|
||||
}
|
||||
|
||||
output.append("scm-manager version: ").println( version );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.cli.config.ScmClientConfig;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Command(
|
||||
name = "store-config",
|
||||
usage = "usageStoreConfig",
|
||||
group = "config"
|
||||
)
|
||||
public class StoreConfigSubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
output.println("store config");
|
||||
ScmClientConfig.getInstance().store();
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.cli.I18n;
|
||||
import sonia.scm.cli.config.ServerConfig;
|
||||
import sonia.scm.client.ScmClient;
|
||||
import sonia.scm.client.ScmClientSession;
|
||||
import sonia.scm.util.IOUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public abstract class SubCommand
|
||||
{
|
||||
|
||||
/** the logger for SubCommand */
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(SubCommand.class);
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
protected abstract void run();
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param input
|
||||
* @param output
|
||||
* @param i18n
|
||||
* @param config
|
||||
*/
|
||||
public void init(BufferedReader input, PrintWriter output, I18n i18n,
|
||||
ServerConfig config)
|
||||
{
|
||||
this.input = input;
|
||||
this.output = output;
|
||||
this.i18n = i18n;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param args
|
||||
*/
|
||||
public void run(Collection<String> args)
|
||||
{
|
||||
CmdLineParser parser = new CmdLineParser(this);
|
||||
|
||||
try
|
||||
{
|
||||
parser.parseArgument(args);
|
||||
|
||||
if (help)
|
||||
{
|
||||
parser.printUsage(output, i18n.getBundle());
|
||||
System.exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
run();
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(session);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (CmdLineException ex)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
logger.warn("could not parse comannd line", ex);
|
||||
}
|
||||
|
||||
if (!help)
|
||||
{
|
||||
output.append(i18n.getMessage(I18n.ERROR)).append(": ");
|
||||
output.println(ex.getMessage());
|
||||
output.println();
|
||||
}
|
||||
|
||||
printHelp(parser);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getCommandName()
|
||||
{
|
||||
return commandName;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setCommandName(String name)
|
||||
{
|
||||
this.commandName = name;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
protected ScmClientSession createSession()
|
||||
{
|
||||
if (Util.isNotEmpty(config.getUsername())
|
||||
&& Util.isNotEmpty(config.getPassword()))
|
||||
{
|
||||
session = ScmClient.createSession(config.getServerUrl(),
|
||||
config.getUsername(),
|
||||
config.getPassword());
|
||||
}
|
||||
else
|
||||
{
|
||||
session = ScmClient.createSession(config.getServerUrl());
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param parser
|
||||
*/
|
||||
protected void printHelp(CmdLineParser parser)
|
||||
{
|
||||
parser.printUsage(output, i18n.getBundle());
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
protected ServerConfig config;
|
||||
|
||||
/** Field description */
|
||||
protected I18n i18n;
|
||||
|
||||
/** Field description */
|
||||
protected BufferedReader input;
|
||||
|
||||
/** Field description */
|
||||
protected PrintWriter output;
|
||||
|
||||
/** Field description */
|
||||
private String commandName;
|
||||
|
||||
/** Field description */
|
||||
@Option(
|
||||
name = "--help",
|
||||
usage = "optionHelpText",
|
||||
aliases = { "-h" }
|
||||
)
|
||||
private boolean help = false;
|
||||
|
||||
/** Field description */
|
||||
private ScmClientSession session;
|
||||
}
|
||||
@@ -1,234 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.ConfigurationException;
|
||||
import sonia.scm.util.IOUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class SubCommandHandler
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String RESOURCE_SERVICES =
|
||||
"META-INF/services/".concat(SubCommand.class.getName());
|
||||
|
||||
/** Field description */
|
||||
private static volatile SubCommandHandler instance;
|
||||
|
||||
/** the logger for SubCommandOptionHandler */
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(SubCommandOptionHandler.class);
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
private SubCommandHandler()
|
||||
{
|
||||
subCommands = new HashMap<>();
|
||||
loadSubCommands();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static SubCommandHandler getInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
synchronized (SubCommandHandler.class)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new SubCommandHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public CommandDescriptor getDescriptor(String name)
|
||||
{
|
||||
return subCommands.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<CommandDescriptor> getDescriptors()
|
||||
{
|
||||
List<CommandDescriptor> descs =
|
||||
new ArrayList<>(subCommands.values());
|
||||
|
||||
Collections.sort(descs);
|
||||
|
||||
return descs;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param url
|
||||
*/
|
||||
private void loadSubCommand(URL url)
|
||||
{
|
||||
BufferedReader reader = null;
|
||||
|
||||
try
|
||||
{
|
||||
reader = new BufferedReader(new InputStreamReader(url.openStream()));
|
||||
|
||||
String line = reader.readLine();
|
||||
|
||||
while (line != null)
|
||||
{
|
||||
parseLine(line);
|
||||
line = reader.readLine();
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.error("could not load commands");
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(reader);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
private void loadSubCommands()
|
||||
{
|
||||
try
|
||||
{
|
||||
Enumeration<URL> enm =
|
||||
SubCommandHandler.class.getClassLoader().getResources(
|
||||
RESOURCE_SERVICES);
|
||||
|
||||
while (enm.hasMoreElements())
|
||||
{
|
||||
URL url = enm.nextElement();
|
||||
|
||||
loadSubCommand(url);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw new ConfigurationException("could not load SubComamnds", ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param line
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void parseLine(String line)
|
||||
{
|
||||
line = line.trim();
|
||||
|
||||
if (Util.isNotEmpty(line) &&!line.startsWith("#"))
|
||||
{
|
||||
try
|
||||
{
|
||||
Class<? extends SubCommand> clazz =
|
||||
(Class<? extends SubCommand>) Class.forName(line);
|
||||
CommandDescriptor desc = new CommandDescriptor(clazz);
|
||||
|
||||
subCommands.put(desc.getName(), desc);
|
||||
}
|
||||
catch (ClassNotFoundException ex)
|
||||
{
|
||||
logger.warn("could not found command class {}", line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Map<String, CommandDescriptor> subCommands;
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.OptionDef;
|
||||
import org.kohsuke.args4j.spi.OptionHandler;
|
||||
import org.kohsuke.args4j.spi.Parameters;
|
||||
import org.kohsuke.args4j.spi.Setter;
|
||||
import sonia.scm.cli.SimpleLocalizable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class SubCommandOptionHandler extends OptionHandler<SubCommand>
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param parser
|
||||
* @param option
|
||||
* @param setter
|
||||
*/
|
||||
public SubCommandOptionHandler(CmdLineParser parser, OptionDef option,
|
||||
Setter<? super SubCommand> setter)
|
||||
{
|
||||
super(parser, option, setter);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param parameters
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws CmdLineException
|
||||
*/
|
||||
@Override
|
||||
public int parseArguments(Parameters parameters) throws CmdLineException
|
||||
{
|
||||
String name = parameters.getParameter(0);
|
||||
CommandDescriptor desc =
|
||||
SubCommandHandler.getInstance().getDescriptor(name);
|
||||
|
||||
if (desc != null)
|
||||
{
|
||||
owner.stopOptionParsing();
|
||||
setter.addValue(desc.createSubCommand());
|
||||
}
|
||||
else
|
||||
{
|
||||
String msg = "command ".concat(name).concat(" not found");
|
||||
|
||||
throw new CmdLineException(owner, new SimpleLocalizable(msg));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultMetaVariable()
|
||||
{
|
||||
return "command";
|
||||
}
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
import sonia.scm.ConfigurationException;
|
||||
import sonia.scm.util.IOUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public abstract class TemplateSubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getTemplate()
|
||||
{
|
||||
return template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public File getTemplateFile()
|
||||
{
|
||||
return templateFile;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param template
|
||||
*/
|
||||
public void setTemplate(String template)
|
||||
{
|
||||
this.template = template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param templateFile
|
||||
*/
|
||||
public void setTemplateFile(File templateFile)
|
||||
{
|
||||
this.templateFile = templateFile;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param env
|
||||
* @param defaultTemplate
|
||||
*/
|
||||
protected void renderTemplate(Map<String, Object> env, String defaultTemplate)
|
||||
{
|
||||
Configuration configuration = new Configuration(Configuration.VERSION_2_3_20);
|
||||
Reader reader = null;
|
||||
|
||||
try
|
||||
{
|
||||
if ((templateFile != null) && templateFile.exists())
|
||||
{
|
||||
reader = new FileReader(templateFile);
|
||||
}
|
||||
else if (Util.isNotEmpty(template))
|
||||
{
|
||||
reader = new StringReader(template);
|
||||
}
|
||||
else
|
||||
{
|
||||
reader = new InputStreamReader(
|
||||
TemplateSubCommand.class.getResourceAsStream(defaultTemplate));
|
||||
}
|
||||
|
||||
Template tpl = new Template("default-template", reader, configuration);
|
||||
|
||||
tpl.process(env, output);
|
||||
}
|
||||
catch (TemplateException | IOException ex)
|
||||
{
|
||||
throw new ConfigurationException("could not render template", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(reader);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@Option(name = "--template", usage = "optionTemplate")
|
||||
private String template;
|
||||
|
||||
/** Field description */
|
||||
@Option(name = "--template-file", usage = "optionTemplateFile")
|
||||
private File templateFile;
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.cmd;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.util.IOUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.9
|
||||
*/
|
||||
@Command(
|
||||
name = "version",
|
||||
usage = "usageVersion",
|
||||
group = "misc"
|
||||
)
|
||||
public class VersionSubCommand extends SubCommand
|
||||
{
|
||||
|
||||
/** Default version {@link String} */
|
||||
public static final String DEFAULT_VERSION = "unknown";
|
||||
|
||||
/** Path to the maven properties file of the scm-core artifact */
|
||||
public static final String MAVEN_PROPERTIES =
|
||||
"/META-INF/maven/sonia.scm.clients/scm-cli-client/pom.properties";
|
||||
|
||||
/** Maven property for the version of the artifact */
|
||||
public static final String MAVEN_PROPERTY_VERSION = "version";
|
||||
|
||||
/** the logger for VersionSubCommand */
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(VersionSubCommand.class);
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected void run()
|
||||
{
|
||||
String version = getVersion();
|
||||
|
||||
output.append("scm-cli-client version: ").println(version);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getVersion()
|
||||
{
|
||||
String version = null;
|
||||
InputStream stream = null;
|
||||
|
||||
try
|
||||
{
|
||||
stream = VersionSubCommand.class.getResourceAsStream(MAVEN_PROPERTIES);
|
||||
|
||||
if (stream != null)
|
||||
{
|
||||
Properties properties = new Properties();
|
||||
|
||||
properties.load(stream);
|
||||
version = properties.getProperty(MAVEN_PROPERTY_VERSION);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.warn("could not parse maven.properties", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(stream);
|
||||
}
|
||||
|
||||
if (Util.isEmpty(version))
|
||||
{
|
||||
version = DEFAULT_VERSION;
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.config;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
import org.kohsuke.args4j.OptionDef;
|
||||
import org.kohsuke.args4j.spi.OptionHandler;
|
||||
import org.kohsuke.args4j.spi.Parameters;
|
||||
import org.kohsuke.args4j.spi.Setter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class ConfigOptionHandler extends OptionHandler<ServerConfig>
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param parser
|
||||
* @param option
|
||||
* @param setter
|
||||
*/
|
||||
public ConfigOptionHandler(CmdLineParser parser, OptionDef option,
|
||||
Setter<? super ServerConfig> setter)
|
||||
{
|
||||
super(parser, option, setter);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param parameters
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws CmdLineException
|
||||
*/
|
||||
@Override
|
||||
public int parseArguments(Parameters parameters) throws CmdLineException
|
||||
{
|
||||
String name = parameters.getParameter(0);
|
||||
ServerConfig config = ScmClientConfig.getInstance().getConfig(name);
|
||||
|
||||
setter.addValue(config);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String getDefaultMetaVariable()
|
||||
{
|
||||
return "metaVar_config";
|
||||
}
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.config;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import javax.xml.bind.annotation.*;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@XmlRootElement(name = "client-config")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class ScmClientConfig
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String DEFAULT_NAME = "default";
|
||||
|
||||
/** Field description */
|
||||
private static volatile ScmClientConfig instance;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
private ScmClientConfig()
|
||||
{
|
||||
this.serverConfigMap = new HashMap<>();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static ScmClientConfig getInstance()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
synchronized (ScmClientConfig.class)
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = load();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private static ScmClientConfig load()
|
||||
{
|
||||
ScmClientConfigFileHandler fileHandler = new ScmClientConfigFileHandler();
|
||||
ScmClientConfig config = fileHandler.read();
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
config = new ScmClientConfig();
|
||||
}
|
||||
|
||||
config.setFileHandler(fileHandler);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
public void delete()
|
||||
{
|
||||
fileHandler.delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
public void store()
|
||||
{
|
||||
fileHandler.write(this);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ServerConfig getConfig(String name)
|
||||
{
|
||||
return serverConfigMap.computeIfAbsent(name, k -> new ServerConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ServerConfig getDefaultConfig()
|
||||
{
|
||||
return getConfig(DEFAULT_NAME);
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param fileHandler
|
||||
*/
|
||||
private void setFileHandler(ScmClientConfigFileHandler fileHandler)
|
||||
{
|
||||
this.fileHandler = fileHandler;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@XmlTransient
|
||||
private ScmClientConfigFileHandler fileHandler;
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "server-config")
|
||||
@XmlJavaTypeAdapter(XmlConfigAdapter.class)
|
||||
private Map<String, ServerConfig> serverConfigMap;
|
||||
}
|
||||
@@ -1,306 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.config;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.util.IOUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.prefs.Preferences;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.CipherInputStream;
|
||||
import javax.crypto.CipherOutputStream;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
import javax.crypto.spec.PBEParameterSpec;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Marshaller;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class ScmClientConfigFileHandler
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String DEFAULT_CONFIG_NAME = ".scm-cli-config.enc.xml";
|
||||
|
||||
/** Field description */
|
||||
public static final String ENV_CONFIG_FILE = "SCM_CLI_CONFIG";
|
||||
|
||||
/** Field description */
|
||||
public static final String PREF_SECRET_KEY = "scm.client.key";
|
||||
|
||||
/** Field description */
|
||||
public static final String SALT = "AE16347F";
|
||||
|
||||
/** Field description */
|
||||
public static final int SPEC_ITERATION = 12;
|
||||
|
||||
/** Field description */
|
||||
private static final String CIPHER_NAME = "PBEWithMD5AndDES";
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public ScmClientConfigFileHandler()
|
||||
{
|
||||
prefs = Preferences.userNodeForPackage(ScmClientConfigFileHandler.class);
|
||||
key = prefs.get(PREF_SECRET_KEY, null);
|
||||
|
||||
if (Util.isEmpty(key))
|
||||
{
|
||||
key = createNewKey();
|
||||
prefs.put(PREF_SECRET_KEY, key);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
context = JAXBContext.newInstance(ScmClientConfig.class);
|
||||
}
|
||||
catch (JAXBException ex)
|
||||
{
|
||||
throw new ScmConfigException(
|
||||
"could not create JAXBContext for ScmClientConfig", ex);
|
||||
}
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
public void delete()
|
||||
{
|
||||
File configFile = getConfigFile();
|
||||
|
||||
if (configFile.exists() &&!configFile.delete())
|
||||
{
|
||||
throw new ScmConfigException("could not delete config file");
|
||||
}
|
||||
|
||||
prefs.remove(PREF_SECRET_KEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ScmClientConfig read()
|
||||
{
|
||||
ScmClientConfig config = null;
|
||||
File configFile = getConfigFile();
|
||||
|
||||
if (configFile.exists())
|
||||
{
|
||||
InputStream input = null;
|
||||
|
||||
try
|
||||
{
|
||||
Cipher c = createCipher(Cipher.DECRYPT_MODE);
|
||||
|
||||
input = new CipherInputStream(new FileInputStream(configFile), c);
|
||||
|
||||
Unmarshaller um = context.createUnmarshaller();
|
||||
|
||||
config = (ScmClientConfig) um.unmarshal(input);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ScmConfigException("could not read config file", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(input);
|
||||
}
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
public void write(ScmClientConfig config)
|
||||
{
|
||||
File configFile = getConfigFile();
|
||||
OutputStream output = null;
|
||||
|
||||
try
|
||||
{
|
||||
Cipher c = createCipher(Cipher.ENCRYPT_MODE);
|
||||
|
||||
output = new CipherOutputStream(new FileOutputStream(configFile), c);
|
||||
|
||||
Marshaller m = context.createMarshaller();
|
||||
|
||||
m.marshal(config, output);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ScmConfigException("could not write config file", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close(output);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param mode
|
||||
*
|
||||
* @return
|
||||
*
|
||||
*
|
||||
* @throws InvalidAlgorithmParameterException
|
||||
* @throws InvalidKeyException
|
||||
* @throws InvalidKeySpecException
|
||||
* @throws NoSuchAlgorithmException
|
||||
* @throws NoSuchPaddingException
|
||||
*/
|
||||
private Cipher createCipher(int mode)
|
||||
throws NoSuchAlgorithmException, NoSuchPaddingException,
|
||||
InvalidKeySpecException, InvalidKeyException,
|
||||
InvalidAlgorithmParameterException
|
||||
{
|
||||
SecretKey sk = createSecretKey();
|
||||
Cipher cipher = Cipher.getInstance(CIPHER_NAME);
|
||||
PBEParameterSpec spec = new PBEParameterSpec(SALT.getBytes(),
|
||||
SPEC_ITERATION);
|
||||
|
||||
cipher.init(mode, sk, spec);
|
||||
|
||||
return cipher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String createNewKey()
|
||||
{
|
||||
return UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws InvalidKeySpecException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
private SecretKey createSecretKey()
|
||||
throws NoSuchAlgorithmException, InvalidKeySpecException
|
||||
{
|
||||
PBEKeySpec keySpec = new PBEKeySpec(key.toCharArray());
|
||||
SecretKeyFactory factory = SecretKeyFactory.getInstance(CIPHER_NAME);
|
||||
|
||||
return factory.generateSecret(keySpec);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private File getConfigFile()
|
||||
{
|
||||
File configFile = null;
|
||||
String configPath = System.getenv(ENV_CONFIG_FILE);
|
||||
|
||||
if (Util.isEmpty(configPath))
|
||||
{
|
||||
configFile = new File(System.getProperty("user.home"),
|
||||
DEFAULT_CONFIG_NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
configFile = new File(configPath);
|
||||
}
|
||||
|
||||
return configFile;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private JAXBContext context;
|
||||
|
||||
/** Field description */
|
||||
private String key;
|
||||
|
||||
/** Field description */
|
||||
private Preferences prefs;
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.config;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class ScmConfigException extends RuntimeException
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final long serialVersionUID = -4226165375815233654L;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public ScmConfigException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public ScmConfigException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param cause
|
||||
*/
|
||||
public ScmConfigException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public ScmConfigException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.config;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.Validateable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class ServerConfig implements Validateable
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public ServerConfig() {}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param serverUrl
|
||||
* @param username
|
||||
* @param password
|
||||
*/
|
||||
public ServerConfig(String serverUrl, String username, String password)
|
||||
{
|
||||
this.serverUrl = serverUrl;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getServerUrl()
|
||||
{
|
||||
return serverUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
|
||||
// TODO
|
||||
return true;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param password
|
||||
*/
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param serverUrl
|
||||
*/
|
||||
public void setServerUrl(String serverUrl)
|
||||
{
|
||||
this.serverUrl = serverUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param username
|
||||
*/
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private String password;
|
||||
|
||||
/** Field description */
|
||||
private String serverUrl;
|
||||
|
||||
/** Field description */
|
||||
private String username;
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.config;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class XmlConfigAdapter
|
||||
extends XmlAdapter<XmlConfigSet, Map<String, ServerConfig>>
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param map
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public XmlConfigSet marshal(Map<String, ServerConfig> map) throws Exception
|
||||
{
|
||||
Set<XmlConfigElement> set = new HashSet<>();
|
||||
|
||||
for (Map.Entry<String, ServerConfig> e : map.entrySet())
|
||||
{
|
||||
set.add(new XmlConfigElement(e.getKey(), e.getValue()));
|
||||
}
|
||||
|
||||
return new XmlConfigSet(set);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param set
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Map<String, ServerConfig> unmarshal(XmlConfigSet set) throws Exception
|
||||
{
|
||||
Map<String, ServerConfig> map = new HashMap<>();
|
||||
|
||||
for (XmlConfigElement e : set)
|
||||
{
|
||||
map.put(e.getName(), e.getConfig());
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.cli.config;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@XmlRootElement(name = "server")
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
public class XmlConfigElement
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public XmlConfigElement() {}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
* @param config
|
||||
*/
|
||||
public XmlConfigElement(String name, ServerConfig config)
|
||||
{
|
||||
this.name = name;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ServerConfig getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param config
|
||||
*/
|
||||
public void setConfig(ServerConfig config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "server-config")
|
||||
private ServerConfig config;
|
||||
|
||||
/** Field description */
|
||||
private String name;
|
||||
}
|
||||