Skip to content

Commit cd693b3

Browse files
committed
Merge pull request #213 from marklogic/dino/197-Refactor-to-autodeploy
fixed #197
2 parents be718b2 + aa7e2eb commit cd693b3

File tree

12 files changed

+379
-368
lines changed

12 files changed

+379
-368
lines changed

marklogic-data-hub/src/main/java/com/marklogic/hub/DataHub.java

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -69,42 +69,43 @@
6969

7070
public class DataHub {
7171

72-
static final private Logger LOGGER = LoggerFactory.getLogger(DataHub.class);
73-
74-
private ManageConfig config;
75-
private ManageClient client;
76-
77-
private File assetInstallTimeFile = new File("./assetInstallTime.properties");
78-
private HubConfig hubConfig;
79-
80-
public DataHub(HubConfig hubConfig) {
81-
init(hubConfig);
82-
}
83-
84-
public DataHub(String host, String username, String password) {
85-
hubConfig = new HubConfig();
86-
hubConfig.host = host;
87-
hubConfig.adminUsername = username;
88-
hubConfig.adminPassword = password;
89-
init(hubConfig);
90-
}
91-
92-
private void init(HubConfig hubConfig) {
93-
this.hubConfig = hubConfig;
94-
config = new ManageConfig(hubConfig.host, 8002, hubConfig.adminUsername, hubConfig.adminPassword);
95-
client = new ManageClient(config);
96-
}
97-
98-
public void setAssetInstallTimeFile(File assetInstallTimeFile) {
99-
this.assetInstallTimeFile = assetInstallTimeFile;
100-
}
101-
102-
/**
103-
* Determines if the data hub is installed in MarkLogic
104-
* @return true if installed, false otherwise
105-
*/
106-
public boolean isInstalled() {
107-
ServerManager sm = new ServerManager(client);
72+
static final private Logger LOGGER = LoggerFactory.getLogger(DataHub.class);
73+
74+
private ManageConfig config;
75+
private ManageClient client;
76+
77+
private File assetInstallTimeFile = new File("./assetInstallTime.properties");
78+
private HubConfig hubConfig;
79+
80+
public DataHub(HubConfig hubConfig) {
81+
init(hubConfig);
82+
}
83+
84+
public DataHub(String host, String username, String password) {
85+
hubConfig = new HubConfig();
86+
hubConfig.host = host;
87+
hubConfig.adminUsername = username;
88+
hubConfig.adminPassword = password;
89+
init(hubConfig);
90+
}
91+
92+
private void init(HubConfig hubConfig) {
93+
this.hubConfig = hubConfig;
94+
config = new ManageConfig(hubConfig.host, 8002, hubConfig.adminUsername, hubConfig.adminPassword);
95+
client = new ManageClient(config);
96+
}
97+
98+
public void setAssetInstallTimeFile(File assetInstallTimeFile) {
99+
this.assetInstallTimeFile = assetInstallTimeFile;
100+
}
101+
102+
/**
103+
* Determines if the data hub is installed in MarkLogic
104+
*
105+
* @return true if installed, false otherwise
106+
*/
107+
public boolean isInstalled() {
108+
ServerManager sm = new ServerManager(client);
108109
DatabaseManager dm = new DatabaseManager(client);
109110

110111
ResourcesFragment srf = sm.getAsXml();
@@ -152,9 +153,9 @@ public boolean isInstalled() {
152153
boolean forestsOk = (stagingForestsExist && finalForestsExist && tracingForestsExist);
153154

154155
return (appserversOk && dbsOk && forestsOk);
155-
}
156+
}
156157

157-
/**
158+
/**
158159
* Validates the MarkLogic server to ensure compatibility with the hub
159160
* @throws ServerValidationException if the server is not compatible
160161
*/

quick-start/src/main/java/com/marklogic/hub/factory/EntityModelFactory.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public EntityModel createEntity(String entityName, String entityFilePath, SyncSt
6868
EntityModel entityModel = new EntityModel();
6969
entityModel.setEntityName(entityName);
7070
//this will be updated after traversing its modules
71-
entityModel.setSynched(this.entitiesInServer.containsKey(entityName));
7271

7372
FlowModelFactory flowModelFactory = new FlowModelFactory(
7473
this.entitiesInServer.get(entityName), entityName);
@@ -97,11 +96,9 @@ private void setEntityModules(EntityModel entityModel, String entityFilePath,
9796
for (String folderName : folderNames) {
9897
if (folderName.equalsIgnoreCase(RestModelFactory.REST_FOLDER_NAME)) {
9998
restModel = restModelFactory.createRest(modulesParentDirectory, syncStatusService);
100-
entityModel.setSynched(entityModel.isSynched() && restModel.isSynched());
10199
} else {
102100
FlowModel flowModel = flowModelFactory.createFlow(modulesParentDirectory,
103101
folderName, flowType, syncStatusService);
104-
entityModel.setSynched(entityModel.isSynched() && flowModel.isSynched());
105102
flows.add(flowModel);
106103
}
107104
}

quick-start/src/main/java/com/marklogic/hub/factory/FlowModelFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public FlowModel createNewFlow(File userPluginDirPath, String flowName,
4343
FlowModel flowModel = new FlowModel();
4444
flowModel.setEntityName(entityName);
4545
flowModel.setFlowName(flowName);
46-
flowModel.setSynched(false);
4746

4847
Scaffolding.createFlow(entityName, flowName, flowType, pluginFormat,
4948
dataFormat, userPluginDirPath);
@@ -72,7 +71,6 @@ public FlowModel createFlow(String parentDirPath, String flowName,
7271
&& flowType.equals(flow.getType())) {
7372
synched = syncStatusService.isDirectorySynched(absolutePath);
7473
}
75-
flowModel.setSynched(synched);
7674
return flowModel;
7775
}
7876
}

quick-start/src/main/java/com/marklogic/hub/model/EntityModel.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ public class EntityModel {
99
private String entityName;
1010
private List<FlowModel> inputFlows;
1111
private List<FlowModel> harmonizeFlows;
12-
private boolean isSynched;
1312
private RestModel inputRest;
1413
private RestModel harmonizeRest;
1514

@@ -61,30 +60,6 @@ public void setHarmonizeFlows(List<FlowModel> harmonizeFlows) {
6160
this.harmonizeFlows = harmonizeFlows;
6261
}
6362

64-
public boolean isSynched() {
65-
return isSynched;
66-
}
67-
68-
public void setSynched(boolean isSynched) {
69-
this.isSynched = isSynched;
70-
}
71-
72-
public void setInputFlowsSynched(boolean synched) {
73-
if (inputFlows != null) {
74-
for (FlowModel model : inputFlows) {
75-
model.setSynched(synched);
76-
}
77-
}
78-
}
79-
80-
public void setHarmonizeFlowsSynched(boolean synched) {
81-
if (harmonizeFlows != null) {
82-
for (FlowModel model : harmonizeFlows) {
83-
model.setSynched(synched);
84-
}
85-
}
86-
}
87-
8863
public RestModel getInputRest() {
8964
return inputRest;
9065
}
@@ -107,8 +82,6 @@ public String toString() {
10782
sb.append("{");
10883
sb.append("entityName=");
10984
sb.append(entityName);
110-
sb.append("isSynched=");
111-
sb.append(isSynched);
11285
sb.append("}");
11386

11487
return sb.toString();

quick-start/src/main/java/com/marklogic/hub/model/FlowModel.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ public class FlowModel {
44

55
private String entityName;
66
private String flowName;
7-
private boolean isSynched;
87
private TreeData treeData;
98

109
public String getEntityName() {
@@ -24,14 +23,6 @@ public void setFlowName(String flowName) {
2423
this.flowName = flowName;
2524
}
2625

27-
public boolean isSynched() {
28-
return isSynched;
29-
}
30-
31-
public void setSynched(boolean isSynched) {
32-
this.isSynched = isSynched;
33-
}
34-
3526
public TreeData getTreeData() {
3627
return treeData;
3728
}
@@ -46,10 +37,8 @@ public String toString() {
4637
sb.append("{");
4738
sb.append("entityName=");
4839
sb.append(entityName);
49-
sb.append("flowName=");
40+
sb.append(" flowName=");
5041
sb.append(flowName);
51-
sb.append("isSynched=");
52-
sb.append(isSynched);
5342
sb.append("}");
5443

5544
return sb.toString();

quick-start/src/main/java/com/marklogic/hub/service/DataHubService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ public void install() throws DataHubException {
3131
}
3232

3333
public void installUserModules() throws DataHubException {
34+
LOGGER.debug("installUserModules");
3435
DataHub dataHub = getDataHub();
3536
try {
37+
LOGGER.debug("pluginDir:" + environmentConfiguration.getUserPluginDir());
3638
dataHub.installUserModules(environmentConfiguration.getUserPluginDir());
3739
} catch(Throwable e) {
3840
throw new DataHubException(e.getMessage(), e);

0 commit comments

Comments
 (0)