Skip to content

Commit e3ec50b

Browse files
committed
Revert "fixed #197"
1 parent cd693b3 commit e3ec50b

File tree

12 files changed

+368
-379
lines changed

12 files changed

+368
-379
lines changed

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

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -69,43 +69,42 @@
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-
*
105-
* @return true if installed, false otherwise
106-
*/
107-
public boolean isInstalled() {
108-
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+
* @return true if installed, false otherwise
105+
*/
106+
public boolean isInstalled() {
107+
ServerManager sm = new ServerManager(client);
109108
DatabaseManager dm = new DatabaseManager(client);
110109

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

155154
return (appserversOk && dbsOk && forestsOk);
156-
}
155+
}
157156

158-
/**
157+
/**
159158
* Validates the MarkLogic server to ensure compatibility with the hub
160159
* @throws ServerValidationException if the server is not compatible
161160
*/

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ 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));
7172

7273
FlowModelFactory flowModelFactory = new FlowModelFactory(
7374
this.entitiesInServer.get(entityName), entityName);
@@ -96,9 +97,11 @@ private void setEntityModules(EntityModel entityModel, String entityFilePath,
9697
for (String folderName : folderNames) {
9798
if (folderName.equalsIgnoreCase(RestModelFactory.REST_FOLDER_NAME)) {
9899
restModel = restModelFactory.createRest(modulesParentDirectory, syncStatusService);
100+
entityModel.setSynched(entityModel.isSynched() && restModel.isSynched());
99101
} else {
100102
FlowModel flowModel = flowModelFactory.createFlow(modulesParentDirectory,
101103
folderName, flowType, syncStatusService);
104+
entityModel.setSynched(entityModel.isSynched() && flowModel.isSynched());
102105
flows.add(flowModel);
103106
}
104107
}

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

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

4748
Scaffolding.createFlow(entityName, flowName, flowType, pluginFormat,
4849
dataFormat, userPluginDirPath);
@@ -71,6 +72,7 @@ public FlowModel createFlow(String parentDirPath, String flowName,
7172
&& flowType.equals(flow.getType())) {
7273
synched = syncStatusService.isDirectorySynched(absolutePath);
7374
}
75+
flowModel.setSynched(synched);
7476
return flowModel;
7577
}
7678
}

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

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

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

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+
6388
public RestModel getInputRest() {
6489
return inputRest;
6590
}
@@ -82,6 +107,8 @@ public String toString() {
82107
sb.append("{");
83108
sb.append("entityName=");
84109
sb.append(entityName);
110+
sb.append("isSynched=");
111+
sb.append(isSynched);
85112
sb.append("}");
86113

87114
return sb.toString();

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

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

55
private String entityName;
66
private String flowName;
7+
private boolean isSynched;
78
private TreeData treeData;
89

910
public String getEntityName() {
@@ -23,6 +24,14 @@ public void setFlowName(String flowName) {
2324
this.flowName = flowName;
2425
}
2526

27+
public boolean isSynched() {
28+
return isSynched;
29+
}
30+
31+
public void setSynched(boolean isSynched) {
32+
this.isSynched = isSynched;
33+
}
34+
2635
public TreeData getTreeData() {
2736
return treeData;
2837
}
@@ -37,8 +46,10 @@ public String toString() {
3746
sb.append("{");
3847
sb.append("entityName=");
3948
sb.append(entityName);
40-
sb.append(" flowName=");
49+
sb.append("flowName=");
4150
sb.append(flowName);
51+
sb.append("isSynched=");
52+
sb.append(isSynched);
4253
sb.append("}");
4354

4455
return sb.toString();

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

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

3333
public void installUserModules() throws DataHubException {
34-
LOGGER.debug("installUserModules");
3534
DataHub dataHub = getDataHub();
3635
try {
37-
LOGGER.debug("pluginDir:" + environmentConfiguration.getUserPluginDir());
3836
dataHub.installUserModules(environmentConfiguration.getUserPluginDir());
3937
} catch(Throwable e) {
4038
throw new DataHubException(e.getMessage(), e);

0 commit comments

Comments
 (0)