Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3.x refactor #764

Merged
merged 28 commits into from
Mar 2, 2018
Merged

Feature/3.x refactor #764

merged 28 commits into from
Mar 2, 2018

Conversation

aebadirad
Copy link
Contributor

No description provided.

aebadirad and others added 25 commits February 14, 2018 19:48
# Conflicts:
#	marklogic-data-hub/src/test/java/com/marklogic/hub/EntityManagerTest.java
…cies on unsupporting libraries for hub config and remove the json ignore for the interface exposed methods

protected final Logger logger = LoggerFactory.getLogger(this.getClass());
//HubDatabase stuff goes here
enum HubDatabase {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems redundant with DatabaseKind, except that this enum has only staging and final. Does it make sense to have both?

logger.info("Initializing the Hub Project");
hubConfig.initHubProject();
}
void initProject();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a javadoc comment saying what this does.

for (Resource r : resolver.getResources("classpath*:/ml-modules-jobs/options/*.xml")) {
options.add(r.getFilename().replace(".xml", ""));
}
void clearUserModules();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TODO in the comment doesn't belong here anymore.

if (check.finalPortInUse) {
check.finalPortInUseBy = serverName;
}
void runPreInstallCheck();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems odd that this is void. What happens as a result of calling this method? Will I get an exception if the check fails? What does it mean to fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, it only populates things. The install process is disconnected a bit

check.serverVersionOk = isServerVersionValid(check.serverVersion);
return check;
}
void runPreInstallCheck(Versions versions);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above


/**
* Removes user's modules from the modules db
* TODO: this becomes much simpler when we move code into the server dir
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this TODO from the comment now?

}

/**
* Installs the data hub configuration and server-side modules into MarkLogic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove server-side modules reference?

}

/**
* Installs the data hub configuration and server-side modules into MarkLogic
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove server-side modules reference?


private static final String GRADLE_PROPERTIES_FILENAME = "gradle.properties";

private HubConfigImpl hubConfig;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about accepted best practice, but I'm inclined to use HubConfig here instead of HubConfigImpl, unless there's a compelling reason to do otherwise. Do we need to use the Impl class?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, unless there's some access to non-interface methods in here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do to encapsulate our reliance on the mgmt library we use to manage clients from being exposed through the interface.

@@ -186,7 +183,7 @@ private void installUserModules(HubConfig hubConfig, boolean forceLoad, DeployUs
loadUserModulesCommand.setForceLoad(forceLoad);
commands.add(loadUserModulesCommand);

SimpleAppDeployer deployer = new SimpleAppDeployer(hubConfig.getManageClient(), hubConfig.getAdminManager());
SimpleAppDeployer deployer = new SimpleAppDeployer(((HubConfigImpl)hubConfig).getManageClient(), ((HubConfigImpl)hubConfig).getAdminManager());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be using HubConfig here, not HubConfigImpl.

Copy link
Contributor Author

@aebadirad aebadirad Mar 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exposes implementation of the manageclient & other mgmt library methods. Direction is to remove or encapsulate any dependencies that aren't directly supported.

This exposes the impl class to our datahubservice, which relies on the non-interface methods provided by the hubconfigimpl. A better way would be to provide OOTB a way to deploy user code from datahub interface that takes a hubconfig object as a parameter. that is then called by this private class.

Copy link

@grechaw grechaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing here concerns me much.
I would make sure the copyrights are in each file, just because it's a task someone will have to do later. Otherwise, OK to merge at your discretion.

* 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.
*/
package com.marklogic.hub;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have to include this copyright and apache message in each file.


private static final String GRADLE_PROPERTIES_FILENAME = "gradle.properties";

private HubConfigImpl hubConfig;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, unless there's some access to non-interface methods in here.

throw new InvalidDBOperationError(kind, "test appserver existence");
}
return exists;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

begs the question whether the databases should all be in a HashMap<DatabaseKind,DatabasClient> of course that can be a future refactor too

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally attached and managed from in hubconfig, as well.

@aebadirad aebadirad merged commit ed1e837 into develop Mar 2, 2018
@aebadirad aebadirad deleted the feature/3.X_Refactor branch March 2, 2018 19:46
@aebadirad aebadirad restored the feature/3.X_Refactor branch March 2, 2018 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants