Skip to content

Commit ab441d9

Browse files
author
arnett, stu
committed
v2.1
1 parent c5d53a3 commit ab441d9

File tree

172 files changed

+23931
-700
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+23931
-700
lines changed

build.gradle

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
group = 'com.emc.ecs'
16-
version = '2.0'
15+
allprojects {
16+
group = 'com.emc.ecs'
17+
version = '2.1'
18+
}
1719

1820
ext.mainClass = 'com.emc.ecs.sync.EcsSync'
1921

2022
defaultTasks ':distZip'
2123

2224
buildscript {
2325
repositories {
24-
jcenter {
25-
url "http://jcenter.bintray.com/"
26-
}
26+
jcenter { url "http://jcenter.bintray.com/" }
2727
}
2828
dependencies {
2929
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.2'
@@ -41,7 +41,7 @@ repositories {
4141
mavenLocal()
4242
}
4343

44-
project(':client') {
44+
project(':ecs-sync-rest') {
4545
apply plugin: 'java'
4646
repositories {
4747
mavenCentral()
@@ -60,7 +60,7 @@ dependencies {
6060
"commons-cli:commons-cli:1.3.1",
6161
"com.google.code.gson:gson:2.0",
6262
"com.emc.ecs:atmos-client:2.2.2.1",
63-
"com.emc.ecs:object-client:2.1.0",
63+
"com.emc.ecs:object-client:2.1.1",
6464
"mysql:mysql-connector-java:5.1.37",
6565
"org.springframework:spring-jdbc:3.2.6.RELEASE",
6666
"org.springframework:spring-context:3.2.6.RELEASE",
@@ -69,7 +69,7 @@ dependencies {
6969
"net.java.truevfs:truevfs-profile-default:0.11.0",
7070
"com.sun.jersey:jersey-server:1.19",
7171
"org.xerial:sqlite-jdbc:3.8.11.1",
72-
project(':client')
72+
project(':ecs-sync-rest')
7373
testCompile "junit:junit:4.11",
7474
"org.hsqldb:hsqldb:2.3.2"
7575
}
@@ -135,5 +135,5 @@ distributions {
135135
}
136136

137137
task wrapper(type: Wrapper) {
138-
gradleVersion = '2.6'
138+
gradleVersion = '2.9'
139139
}

ecs-sync-cli/build.gradle ecs-sync-ctl/build.gradle

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version '1.1'
2-
31
defaultTasks 'shadowJar'
42

53
buildscript {
@@ -19,14 +17,14 @@ apply plugin: 'java'
1917
apply plugin: 'application'
2018
apply plugin: 'com.github.johnrengelman.shadow'
2119

22-
mainClassName = "com.emc.ecs.sync.cli.EcsSyncCli"
20+
mainClassName = "com.emc.ecs.sync.ctl.EcsSyncCtl"
2321

2422
dependencies {
2523
testCompile group: 'junit', name: 'junit', version: '4.11'
2624
compile "commons-cli:commons-cli:1.3.1"
2725
compile "log4j:log4j:1.2.17"
2826
compile "com.sun.jersey:jersey-client:1.19"
29-
compile project(':client')
27+
compile project(':ecs-sync-rest')
3028
}
3129

3230
compileJava {

ecs-sync-cli/src/main/java/com/emc/ecs/sync/cli/EcsSyncCli.java ecs-sync-ctl/src/main/java/com/emc/ecs/sync/ctl/EcsSyncCtl.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package com.emc.ecs.sync.cli;
1+
package com.emc.ecs.sync.ctl;
22

3-
import com.emc.ecs.sync.bean.*;
3+
import com.emc.ecs.sync.rest.*;
44
import com.sun.jersey.api.client.Client;
55
import com.sun.jersey.api.client.ClientResponse;
66
import com.sun.jersey.api.client.UniformInterfaceException;
@@ -15,8 +15,8 @@
1515
/**
1616
* Entry point class for the ECS Sync CLI
1717
*/
18-
public class EcsSyncCli {
19-
private static final Logger l4j = Logger.getLogger(EcsSyncCli.class);
18+
public class EcsSyncCtl {
19+
private static final Logger l4j = Logger.getLogger(EcsSyncCtl.class);
2020
private static final String PAUSE_OPT = "pause";
2121
private static final String RESUME_OPT = "resume";
2222
private static final String STOP_OPT = "stop";
@@ -33,7 +33,7 @@ public class EcsSyncCli {
3333
private static final String ENDPOINT_OPT = "endpoint";
3434

3535
private static final String DEFAULT_ENDPOINT = "http://localhost:9200";
36-
private static final String JAR_NAME = "ecs-sync-{version}";
36+
private static final String JAR_NAME = "ecs-sync-ctl-{version}";
3737

3838
private static final String LAYOUT_STRING_FILE = "%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n";
3939
private static final String LAYOUT_STRING_CONSOLE = "%d{MM-dd HH:mm:ss}%-5p [%t] %c{1}:%L - %m%n";
@@ -150,7 +150,7 @@ public static void main(String[] args) {
150150
if(cmd.hasOption(ENDPOINT_OPT)) {
151151
endpoint = cmd.getOptionValue(ENDPOINT_OPT);
152152
}
153-
EcsSyncCli cli = new EcsSyncCli(endpoint, null, null);
153+
EcsSyncCtl cli = new EcsSyncCtl(endpoint, null, null);
154154

155155

156156
if(cmd.hasOption(PAUSE_OPT)) {
@@ -399,7 +399,7 @@ private String simpleSize(long size) {
399399
private String user;
400400
private String pass;
401401

402-
public EcsSyncCli(String endpoint, String user, String pass) {
402+
public EcsSyncCtl(String endpoint, String user, String pass) {
403403
this.endpoint = endpoint;
404404
this.user = user;
405405
this.pass = pass;

client/src/main/java/com/emc/ecs/sync/bean/ErrorList.java ecs-sync-rest/src/main/java/com/emc/ecs/sync/rest/ErrorList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
package com.emc.ecs.sync.bean;
15+
package com.emc.ecs.sync.rest;
1616

1717
import javax.xml.bind.annotation.XmlElement;
1818
import javax.xml.bind.annotation.XmlRootElement;

client/src/main/java/com/emc/ecs/sync/bean/HostInfo.java ecs-sync-rest/src/main/java/com/emc/ecs/sync/rest/HostInfo.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,30 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
package com.emc.ecs.sync.bean;
15+
package com.emc.ecs.sync.rest;
1616

1717
import javax.xml.bind.annotation.XmlElement;
1818
import javax.xml.bind.annotation.XmlRootElement;
1919
import javax.xml.bind.annotation.XmlType;
2020

2121
@XmlRootElement(name = "HostInfo")
22-
@XmlType(propOrder = {"hostCpuCount", "hostCpuLoad", "hostMemoryUsed", "hostTotalMemory"})
22+
@XmlType(propOrder = {"ecsSyncVersion", "hostCpuCount", "hostCpuLoad", "hostMemoryUsed", "hostTotalMemory"})
2323
public class HostInfo {
24+
private String ecsSyncVersion;
2425
private int hostCpuCount;
2526
private double hostCpuLoad;
2627
private long hostMemoryUsed;
2728
private long hostTotalMemory;
2829

30+
@XmlElement(name = "EcsSyncVersion")
31+
public String getEcsSyncVersion() {
32+
return ecsSyncVersion;
33+
}
34+
35+
public void setEcsSyncVersion(String ecsSyncVersion) {
36+
this.ecsSyncVersion = ecsSyncVersion;
37+
}
38+
2939
@XmlElement(name = "HostCpuCount")
3040
public int getHostCpuCount() {
3141
return hostCpuCount;

client/src/main/java/com/emc/ecs/sync/bean/JobControl.java ecs-sync-rest/src/main/java/com/emc/ecs/sync/rest/JobControl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
package com.emc.ecs.sync.bean;
15+
package com.emc.ecs.sync.rest;
1616

1717
import javax.xml.bind.annotation.XmlElement;
1818
import javax.xml.bind.annotation.XmlRootElement;

client/src/main/java/com/emc/ecs/sync/bean/JobControlStatus.java ecs-sync-rest/src/main/java/com/emc/ecs/sync/rest/JobControlStatus.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
package com.emc.ecs.sync.bean;
15+
package com.emc.ecs.sync.rest;
1616

1717
import javax.xml.bind.annotation.XmlEnum;
1818

client/src/main/java/com/emc/ecs/sync/bean/JobInfo.java ecs-sync-rest/src/main/java/com/emc/ecs/sync/rest/JobInfo.java

+26-2
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,26 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
package com.emc.ecs.sync.bean;
15+
package com.emc.ecs.sync.rest;
1616

1717
import javax.xml.bind.annotation.XmlElement;
18+
import javax.xml.bind.annotation.XmlType;
1819

20+
@XmlType(propOrder = {"jobId", "status", "config", "progress"})
1921
public class JobInfo {
2022
private Integer jobId;
2123
private JobControlStatus status;
24+
private SyncConfig config;
25+
private SyncProgress progress;
2226

2327
public JobInfo() {
2428
}
2529

26-
public JobInfo(Integer jobId, JobControlStatus status) {
30+
public JobInfo(Integer jobId, JobControlStatus status, SyncConfig config, SyncProgress progress) {
2731
this.jobId = jobId;
2832
this.status = status;
33+
this.config = config;
34+
this.progress = progress;
2935
}
3036

3137
@XmlElement(name = "JobId")
@@ -45,4 +51,22 @@ public JobControlStatus getStatus() {
4551
public void setStatus(JobControlStatus status) {
4652
this.status = status;
4753
}
54+
55+
@XmlElement(name = "Config")
56+
public SyncConfig getConfig() {
57+
return config;
58+
}
59+
60+
public void setConfig(SyncConfig config) {
61+
this.config = config;
62+
}
63+
64+
@XmlElement(name = "Progress")
65+
public SyncProgress getProgress() {
66+
return progress;
67+
}
68+
69+
public void setProgress(SyncProgress progress) {
70+
this.progress = progress;
71+
}
4872
}

client/src/main/java/com/emc/ecs/sync/bean/JobList.java ecs-sync-rest/src/main/java/com/emc/ecs/sync/rest/JobList.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
package com.emc.ecs.sync.bean;
15+
package com.emc.ecs.sync.rest;
1616

1717
import javax.xml.bind.annotation.XmlElement;
1818
import javax.xml.bind.annotation.XmlRootElement;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2013-2016 EMC Corporation. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0.txt
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
package com.emc.ecs.sync.rest;
16+
17+
import javax.xml.bind.annotation.XmlAttribute;
18+
import javax.xml.bind.annotation.XmlElement;
19+
import java.util.ArrayList;
20+
import java.util.List;
21+
22+
public class ListPropEntry {
23+
private String name;
24+
private List<String> values = new ArrayList<>();
25+
26+
public ListPropEntry() {
27+
}
28+
29+
public ListPropEntry(String name, List<String> values) {
30+
this.name = name;
31+
this.values = values;
32+
}
33+
34+
@XmlAttribute(name = "name")
35+
public String getName() {
36+
return name;
37+
}
38+
39+
public void setName(String name) {
40+
this.name = name;
41+
}
42+
43+
@XmlElement(name = "Value")
44+
public List<String> getValues() {
45+
return values;
46+
}
47+
48+
public void setValues(List<String> values) {
49+
this.values = values;
50+
}
51+
}

client/src/main/java/com/emc/ecs/sync/bean/PluginConfig.java ecs-sync-rest/src/main/java/com/emc/ecs/sync/rest/PluginConfig.java

+42-9
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,33 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
package com.emc.ecs.sync.bean;
15+
package com.emc.ecs.sync.rest;
1616

1717
import javax.xml.bind.annotation.XmlAttribute;
1818
import javax.xml.bind.annotation.XmlElement;
1919
import javax.xml.bind.annotation.XmlTransient;
20-
import java.util.HashMap;
21-
import java.util.Map;
20+
import javax.xml.bind.annotation.XmlType;
21+
import java.util.*;
2222

23+
@XmlType(propOrder = {"pluginClass", "propEntries", "listPropEntries"})
2324
public class PluginConfig {
24-
protected Class pluginClass;
25+
protected String pluginClass;
2526
protected Map<String, String> customProperties = new HashMap<>();
27+
protected Map<String, List<String>> customListProperties = new HashMap<>();
2628

2729
public PluginConfig() {
2830
}
2931

30-
public PluginConfig(Class pluginClass) {
32+
public PluginConfig(String pluginClass) {
3133
this.pluginClass = pluginClass;
3234
}
3335

34-
@XmlAttribute(name = "Class")
35-
public Class getPluginClass() {
36+
@XmlAttribute(name = "class")
37+
public String getPluginClass() {
3638
return pluginClass;
3739
}
3840

39-
public void setPluginClass(Class pluginClass) {
41+
public void setPluginClass(String pluginClass) {
4042
this.pluginClass = pluginClass;
4143
}
4244

@@ -57,6 +59,23 @@ public void setPropEntries(PropEntry[] propEntries) {
5759
}
5860
}
5961

62+
@XmlElement(name = "ListProperty")
63+
public ListPropEntry[] getListPropEntries() {
64+
ListPropEntry[] entries = new ListPropEntry[customListProperties.size()];
65+
int i = 0;
66+
for (Map.Entry<String, List<String>> entry : customListProperties.entrySet()) {
67+
entries[i++] = new ListPropEntry(entry.getKey(), new ArrayList<>(entry.getValue()));
68+
}
69+
return entries;
70+
}
71+
72+
public void setListPropEntries(ListPropEntry[] listPropEntries) {
73+
customListProperties = new HashMap<>();
74+
for (ListPropEntry entry : listPropEntries) {
75+
customListProperties.put(entry.getName(), new ArrayList<>(entry.getValues()));
76+
}
77+
}
78+
6079
@XmlTransient
6180
public Map<String, String> getCustomProperties() {
6281
return customProperties;
@@ -66,7 +85,16 @@ public void setCustomProperties(Map<String, String> customProperties) {
6685
this.customProperties = customProperties;
6786
}
6887

69-
public PluginConfig withPluginClass(Class pluginClass) {
88+
@XmlTransient
89+
public Map<String, List<String>> getCustomListProperties() {
90+
return customListProperties;
91+
}
92+
93+
public void setCustomListProperties(Map<String, List<String>> customListProperties) {
94+
this.customListProperties = customListProperties;
95+
}
96+
97+
public PluginConfig withPluginClass(String pluginClass) {
7098
setPluginClass(pluginClass);
7199
return this;
72100
}
@@ -75,4 +103,9 @@ public PluginConfig addCustomProperty(String name, String value) {
75103
customProperties.put(name, value);
76104
return this;
77105
}
106+
107+
public PluginConfig addCustomListProperty(String name, String... values) {
108+
customListProperties.put(name, Arrays.asList(values));
109+
return this;
110+
}
78111
}

0 commit comments

Comments
 (0)