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

fixed #187 #190

Merged
merged 1 commit into from
Apr 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
xquery version "1.0-ml";

module namespace plugin = "http://marklogic.com/data-hub/plugins";

declare option xdmp:mapping "false";

(:~
: Writer Plugin
:
: @param $id - the identifier returned by the collector
: @param $envelope - the final envelope
Copy link
Contributor

Choose a reason for hiding this comment

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

Will the upstream processes always be envelopes? I get that they might be now, but is that the only kind of transform you intend to support? If you have broader capabilities in mind, then maybe

param $input - the conformed input

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 have no broader capabilities in mind.

: @param $options - a map containing options. Options are sent from Java
:
: @return - nothing
:)
declare function plugin:write(
$id as xs:string,
$envelope as node(),
$options as map:map) as empty-sequence()
{
xdmp:document-insert($id, $envelope)
};
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
boolean isRest = dir.endsWith("REST");

String dirStr = dir.toString();
boolean isInputDir = dirStr.matches(".*/input/.*");
boolean isConformanceDir = dirStr.matches(".*/conformance/.*");
boolean isInputDir = dirStr.matches(".*[/\\\\]input[/\\\\].*");
boolean isConformanceDir = dirStr.matches(".*[/\\\\]conformance[/\\\\].*");
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these lines looking at file paths? Should you be using File.separator 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.

You can do either. It's way uglier to do separator, IMO.

boolean isInputDir = dirStr.matches(".*\\" + File.separator + "input\\" + File.separator + ".*");

if (isRest) {
if (isInputDir) {
loadedFiles.addAll(hubModulesLoader.loadModules(dir.normalize().toAbsolutePath().toFile(), new AllButAssetsModulesFinder(), stagingClient));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class HubFileFilter implements FileFilter {

@Override
public boolean accept(File f) {
boolean result = f != null && !f.getName().startsWith(".") && !f.toString().matches(".*/REST/.*");
boolean result = f != null && !f.getName().startsWith(".") && !f.toString().matches(".*[/\\\\]REST[/\\\\].*");
Copy link
Contributor

Choose a reason for hiding this comment

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

File.separator?

return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ declare %private function flow:get-flow(
return
fn:doc($uri)/hub:flow
})
where $flow
return
<flow xmlns="http://marklogic.com/data-hub">
<name>{$flow-name}</name>
Expand Down