http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Credential.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Credential.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Credential.java
new file mode 100644
index 0000000..4f199f5
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Credential.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+import java.util.List;
+
+/**
+ * Represents the {@code <credential>} element and its siblings inside 
workflow XML / XSD.
+ * <p>
+ * By assigning non-{@code null} field values, the resulting parent {@code 
<workflow>} will have its
+ * optional {@code <credential>} element and its siblings filled.
+ * <p>
+ * This class is used only as part of a {@link 
org.apache.oozie.fluentjob.api.workflow.Workflow}, isn't
+ * to be used alone with Jobs API.
+ */
[email protected]
[email protected]
+public class Credential {
+    private final String name;
+    private final String type;
+    private final ImmutableList<ConfigurationEntry> configurationEntries;
+
+    public Credential(final String name, final String type, final 
ImmutableList<ConfigurationEntry> configurationEntries) {
+        this.name = name;
+        this.type = type;
+        this.configurationEntries = configurationEntries;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public List<ConfigurationEntry> getConfigurationEntries() {
+        return configurationEntries;
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/CredentialBuilder.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/CredentialBuilder.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/CredentialBuilder.java
new file mode 100644
index 0000000..098bc13
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/CredentialBuilder.java
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.oozie.fluentjob.api.ModifyOnce;
+import org.apache.oozie.fluentjob.api.action.Builder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A builder class for {@link Credential}.
+ * <p>
+ * The properties of the builder can only be set once, an attempt to set them 
a second time will trigger
+ * an {@link IllegalStateException}. The properties that are lists are an 
exception to this rule, of course multiple
+ * elements can be added / removed.
+ * <p>
+ * Builder instances can be used to build several elements, although 
properties already set cannot be changed after
+ * a call to {@link CredentialBuilder#build} either.
+ */
[email protected]
[email protected]
+public class CredentialBuilder implements Builder<Credential> {
+    private final ModifyOnce<String> name;
+    private final ModifyOnce<String> type;
+    private final List<ConfigurationEntry> configurationEntries;
+
+    public static CredentialBuilder create() {
+        final ModifyOnce<String> name = new ModifyOnce<>();
+        final ModifyOnce<String> type = new ModifyOnce<>();
+        final List<ConfigurationEntry> configurationEntries = new 
ArrayList<>();
+
+        return new CredentialBuilder(name, type, configurationEntries);
+    }
+
+    public static CredentialBuilder createFromExisting(final Credential 
credential) {
+        return new CredentialBuilder(new ModifyOnce<>(credential.getName()),
+                new ModifyOnce<>(credential.getType()),
+                new ArrayList<>(credential.getConfigurationEntries()));
+    }
+
+    private CredentialBuilder(final ModifyOnce<String> name,
+            final ModifyOnce<String> type,
+            final List<ConfigurationEntry> configurationEntries) {
+        this.name = name;
+        this.type = type;
+        this.configurationEntries = configurationEntries;
+    }
+
+    public CredentialBuilder withName(final String name) {
+        this.name.set(name);
+        return this;
+    }
+
+    public CredentialBuilder withType(final String type) {
+        this.type.set(type);
+        return this;
+    }
+
+    public CredentialBuilder withConfigurationEntry(final String name,
+                                                    final String description) {
+        this.configurationEntries.add(new ConfigurationEntry(name, 
description));
+        return this;
+    }
+
+    @Override
+    public Credential build() {
+        return new Credential(name.get(), type.get(), 
ImmutableList.copyOf(configurationEntries));
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Credentials.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Credentials.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Credentials.java
new file mode 100644
index 0000000..319839b
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Credentials.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+import java.util.List;
+
+/**
+ * Represents the {@code <credentials>} element and its siblings inside 
workflow XML / XSD.
+ * <p>
+ * By assigning non-{@code null} field values, the resulting parent {@code 
<workflow>} will have its
+ * optional {@code <credentials>} element and its siblings filled.
+ * <p>
+ * This class is used only as part of a {@link 
org.apache.oozie.fluentjob.api.workflow.Workflow}, isn't
+ * to be used alone with Jobs API.
+ */
[email protected]
[email protected]
+public class Credentials {
+    private final ImmutableList<Credential> credentials;
+
+    public Credentials(final ImmutableList<Credential> credentials) {
+        this.credentials = credentials;
+    }
+
+    public List<Credential> getCredentials() {
+        return credentials;
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/CredentialsBuilder.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/CredentialsBuilder.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/CredentialsBuilder.java
new file mode 100644
index 0000000..980106c
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/CredentialsBuilder.java
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.oozie.fluentjob.api.action.Builder;
+
+import java.util.List;
+
+/**
+ * A builder class for {@link Credentials}.
+ *
+ * The properties of the builder can only be set once, an attempt to set them 
a second time will trigger
+ * an {@link IllegalStateException}. The properties that are lists are an 
exception to this rule, of course multiple
+ * elements can be added / removed.
+ *
+ * Builder instances can be used to build several elements, although 
properties already set cannot be changed after
+ * a call to {@link CredentialsBuilder#build} either.
+ */
[email protected]
[email protected]
+public class CredentialsBuilder implements Builder<Credentials> {
+    private final ImmutableList.Builder<Credential> credentials;
+
+    public static CredentialsBuilder create() {
+        return new CredentialsBuilder(new ImmutableList.Builder<Credential>());
+    }
+
+    public static CredentialsBuilder createFromExisting(final Credentials 
credentials) {
+        return new CredentialsBuilder(new 
ImmutableList.Builder<Credential>().addAll(credentials.getCredentials()));
+    }
+
+    CredentialsBuilder(final ImmutableList.Builder<Credential> credentials) {
+        this.credentials = credentials;
+    }
+
+    public CredentialsBuilder withCredential(final String name,
+                                             final String value) {
+        this.credentials.add(new Credential(name, value, 
ImmutableList.<ConfigurationEntry>of()));
+        return this;
+    }
+
+    public CredentialsBuilder withCredential(final String name,
+                                             final String type,
+                                             final List<ConfigurationEntry> 
configurationEntries) {
+        this.credentials.add(new Credential(name, type, 
ImmutableList.copyOf(configurationEntries)));
+        return this;
+    }
+
+    public CredentialsBuilder withCredential(final Credential credential) {
+        this.credentials.add(credential);
+        return this;
+    }
+
+    @Override
+    public Credentials build() {
+        return new Credentials(credentials.build());
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Global.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Global.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Global.java
new file mode 100644
index 0000000..49ae1de
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Global.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.oozie.fluentjob.api.action.ActionAttributes;
+import org.apache.oozie.fluentjob.api.action.HasAttributes;
+import org.apache.oozie.fluentjob.api.action.Launcher;
+
+import java.util.List;
+import java.util.Map;
+
[email protected]
[email protected]
+public class Global implements HasAttributes {
+    private final ActionAttributes attributes;
+
+    Global(final ActionAttributes attributes) {
+        this.attributes = attributes;
+    }
+
+    public String getResourceManager() {
+        return attributes.getResourceManager();
+    }
+
+    public String getNameNode() {
+        return attributes.getNameNode();
+    }
+
+    public Launcher getLauncher() {
+        return attributes.getLauncher();
+    }
+
+    public List<String> getJobXmls() {
+        return attributes.getJobXmls();
+    }
+
+    public String getConfigProperty(final String property) {
+        return attributes.getConfiguration().get(property);
+    }
+
+    public Map<String, String> getConfiguration() {
+        return attributes.getConfiguration();
+    }
+
+    @Override
+    public ActionAttributes getAttributes() {
+        return attributes;
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/GlobalBuilder.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/GlobalBuilder.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/GlobalBuilder.java
new file mode 100644
index 0000000..8a80705
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/GlobalBuilder.java
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.oozie.fluentjob.api.action.ActionAttributesBuilder;
+import org.apache.oozie.fluentjob.api.action.Builder;
+import org.apache.oozie.fluentjob.api.action.HasAttributes;
+import org.apache.oozie.fluentjob.api.action.Launcher;
+
+/**
+ * A builder class for {@link Global}.
+ *
+ * The properties of the builder can only be set once, an attempt to set them 
a second time will trigger
+ * an {@link IllegalStateException}. The properties that are lists are an 
exception to this rule, of course multiple
+ * elements can be added / removed.
+ *
+ * Builder instances can be used to build several elements, although 
properties already set cannot be changed after
+ * a call to {@link GlobalBuilder#build} either.
+ */
[email protected]
[email protected]
+public class GlobalBuilder implements Builder<Global> {
+    private final ActionAttributesBuilder attributesBuilder;
+
+    public static GlobalBuilder create() {
+        return new GlobalBuilder(ActionAttributesBuilder.create());
+    }
+
+    public static GlobalBuilder createFromExisting(final HasAttributes 
hasAttributes) {
+        return new 
GlobalBuilder(ActionAttributesBuilder.createFromExisting(hasAttributes.getAttributes()));
+    }
+
+    private GlobalBuilder(final ActionAttributesBuilder attributesBuilder) {
+        this.attributesBuilder = attributesBuilder;
+    }
+
+    public GlobalBuilder withResourceManager(final String resourceManager) {
+        attributesBuilder.withResourceManager(resourceManager);
+        return this;
+    }
+
+    public GlobalBuilder withNameNode(final String nameNode) {
+        attributesBuilder.withNameNode(nameNode);
+        return this;
+    }
+
+    public GlobalBuilder withLauncher(final Launcher launcher) {
+        attributesBuilder.withLauncher(launcher);
+        return this;
+    }
+
+    public GlobalBuilder withJobXml(final String jobXml) {
+        attributesBuilder.withJobXml(jobXml);
+        return this;
+    }
+
+    public GlobalBuilder withoutJobXml(final String jobXml) {
+        attributesBuilder.withoutJobXml(jobXml);
+        return this;
+    }
+
+    public GlobalBuilder clearJobXmls() {
+        attributesBuilder.clearJobXmls();
+        return this;
+    }
+
+    public GlobalBuilder withConfigProperty(final String key, final String 
value) {
+        attributesBuilder.withConfigProperty(key, value);
+        return this;
+    }
+
+    @Override
+    public Global build() {
+        return new Global(attributesBuilder.build());
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Parameter.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Parameter.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Parameter.java
new file mode 100644
index 0000000..fb309d3
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Parameter.java
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+/**
+ * Represents the {@code <parameter>} element and its siblings inside workflow 
XML / XSD.
+ * <p>
+ * By assigning non-{@code null} field values, the resulting parent {@code 
<workflow>} will have its
+ * optional {@code <parameter>} element and its siblings filled.
+ * <p>
+ * This class is used only as part of a {@link 
org.apache.oozie.fluentjob.api.workflow.Workflow}, isn't
+ * to be used alone with Jobs API.
+ */
[email protected]
[email protected]
+public class Parameter {
+    private final String name;
+    private final String value;
+    private final String description;
+
+    public Parameter(final String name, final String value, final String 
description) {
+        this.name = name;
+        this.value = value;
+        this.description = description;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Parameters.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Parameters.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Parameters.java
new file mode 100644
index 0000000..e34dd3c
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Parameters.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
+import java.util.List;
+
+/**
+ * Represents the {@code <parameters>} element and its siblings inside 
workflow XML / XSD.
+ * <p>
+ * By assigning non-{@code null} field values, the resulting parent {@code 
<workflow>} will have its
+ * optional {@code <parameters>} element and its siblings filled.
+ * <p>
+ * This class is used only as part of a {@link 
org.apache.oozie.fluentjob.api.workflow.Workflow}, isn't
+ * to be used alone with Jobs API.
+ */
[email protected]
[email protected]
+public class Parameters {
+    private final ImmutableList<Parameter> parameters;
+
+    public Parameters(final ImmutableList<Parameter> parameters) {
+        this.parameters = parameters;
+    }
+
+    public List<Parameter> getParameters() {
+        return parameters;
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/ParametersBuilder.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/ParametersBuilder.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/ParametersBuilder.java
new file mode 100644
index 0000000..d522e90
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/ParametersBuilder.java
@@ -0,0 +1,66 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.oozie.fluentjob.api.action.Builder;
+
+/**
+ * A builder class for {@link Parameters}.
+ *
+ * The properties of the builder can only be set once, an attempt to set them 
a second time will trigger
+ * an {@link IllegalStateException}. The properties that are lists are an 
exception to this rule, of course multiple
+ * elements can be added / removed.
+ *
+ * Builder instances can be used to build several elements, although 
properties already set cannot be changed after
+ * a call to {@link ParametersBuilder#build} either.
+ */
[email protected]
[email protected]
+public class ParametersBuilder implements Builder<Parameters> {
+    private final ImmutableList.Builder<Parameter> parameters;
+
+    public static ParametersBuilder create() {
+        return new ParametersBuilder(new ImmutableList.Builder<Parameter>());
+    }
+
+    public static ParametersBuilder createFromExisting(final Parameters 
parameters) {
+        return new ParametersBuilder(new 
ImmutableList.Builder<Parameter>().addAll(parameters.getParameters()));
+    }
+
+    ParametersBuilder(final ImmutableList.Builder<Parameter> parameters) {
+        this.parameters = parameters;
+    }
+
+    public ParametersBuilder withParameter(final String name, final String 
value) {
+        return withParameter(name, value, null);
+    }
+
+    public ParametersBuilder withParameter(final String name, final String 
value, final String description) {
+        parameters.add(new Parameter(name, value, description));
+        return this;
+    }
+
+    @Override
+    public Parameters build() {
+        return new Parameters(parameters.build());
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Workflow.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Workflow.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Workflow.java
new file mode 100644
index 0000000..7a4ee02
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/Workflow.java
@@ -0,0 +1,141 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.oozie.fluentjob.api.action.Node;
+import org.apache.oozie.fluentjob.api.serialization.WorkflowMarshaller;
+
+import javax.xml.bind.JAXBException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.Queue;
+import java.util.Set;
+
+/**
+ * Being the topmost POJO in the Jobs API hierarchy, represents the {@code 
<workflow>} element
+ * and its siblings inside workflow XML / XSD.
+ * <p>
+ * By assigning non-{@code null} field values, the resulting {@code 
<workflow>} will have all its
+ * siblings filled.
+ * <p>
+ * This class is the root container POJO from a user's perspective to Jobs API.
+ */
[email protected]
[email protected]
+public class Workflow {
+    private final String name;
+    private final ImmutableSet<Node> nodes;
+    private final ImmutableSet<Node> roots;
+    private final Parameters parameters;
+    private final Global global;
+    private final Credentials credentials;
+
+    Workflow(final String name,
+             final ImmutableSet<Node> nodes,
+             final Parameters parameters,
+             final Global global,
+             final Credentials credentials) {
+        this.global = global;
+        checkUniqueNames(nodes);
+
+        this.name = name;
+        this.nodes = nodes;
+
+        final Set<Node> mutableRoots = findMutableRoots(nodes);
+
+        this.roots = ImmutableSet.copyOf(mutableRoots);
+
+        this.parameters = parameters;
+
+        this.credentials = credentials;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public Set<Node> getNodes() {
+        return nodes;
+    }
+
+    public Set<Node> getAllNodes() {
+        final Set<Node> allNodes = Sets.newLinkedHashSet();
+        final Queue<Node> nodesToAdd = new LinkedList<>();
+        nodesToAdd.addAll(nodes);
+
+        while (!nodesToAdd.isEmpty()) {
+            final Node nodeToAdd = nodesToAdd.poll();
+            allNodes.add(nodeToAdd);
+
+            nodesToAdd.addAll(nodeToAdd.getAllChildren());
+        }
+
+        return ImmutableSet.copyOf(allNodes);
+    }
+
+    public Set<Node> getRoots() {
+        return roots;
+    }
+
+    public Parameters getParameters() {
+        return parameters;
+    }
+
+    public Global getGlobal() {
+        return global;
+    }
+
+    public Credentials getCredentials() {
+        return credentials;
+    }
+
+    private void checkUniqueNames(final Set<Node> nodes) {
+        final Set<String> names = new HashSet<>();
+
+        for (final Node node : nodes) {
+            Preconditions.checkArgument(!names.contains(node.getName()),
+                    String.format("Duplicate name '%s' found in workflow 
'%s'", node.getName(), getName()));
+
+            names.add(node.getName());
+        }
+    }
+
+    private Set<Node> findMutableRoots(ImmutableSet<Node> nodes) {
+        final Set<Node> mutableRoots = new LinkedHashSet<>();
+
+        for (final Node node : nodes) {
+            if (node.getAllParents().isEmpty()) {
+                mutableRoots.add(node);
+            }
+        }
+
+        return mutableRoots;
+    }
+
+    public String asXml() throws JAXBException, UnsupportedEncodingException {
+        return WorkflowMarshaller.marshal(this);
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/WorkflowBuilder.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/WorkflowBuilder.java
 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/WorkflowBuilder.java
new file mode 100644
index 0000000..c3e588c
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/main/java/org/apache/oozie/fluentjob/api/workflow/WorkflowBuilder.java
@@ -0,0 +1,204 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api.workflow;
+
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableSet;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+import org.apache.oozie.fluentjob.api.ModifyOnce;
+import org.apache.oozie.fluentjob.api.action.Builder;
+import org.apache.oozie.fluentjob.api.action.Node;
+
+import java.security.SecureRandom;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Queue;
+import java.util.Set;
+
+/**
+ * A builder class for {@link Workflow}.
+ * <p>
+ * The properties of the builder can only be set once, an attempt to set them 
a second time will trigger
+ * an {@link IllegalStateException}. The properties that are lists are an 
exception to this rule, of course multiple
+ * elements can be added / removed.
+ * <p>
+ * Builder instances can be used to build several elements, although 
properties already set cannot be changed after
+ * a call to {@link WorkflowBuilder#build} either.
+ * <p>
+ * Being the topmost {@link Builder} from the user's perspective, it serves as 
a main entry point to create
+ * Workflow API POJOs.
+ */
[email protected]
[email protected]
+public class WorkflowBuilder implements Builder<Workflow> {
+    private final ModifyOnce<String> name;
+    private final List<Node> addedActions;
+    private ParametersBuilder parametersBuilder;
+    private GlobalBuilder globalBuilder;
+    private CredentialsBuilder credentialsBuilder;
+
+    public WorkflowBuilder() {
+        this.name = new ModifyOnce<>();
+        this.addedActions = new ArrayList<>();
+    }
+
+    public WorkflowBuilder withName(final String name) {
+        this.name.set(name);
+        return this;
+    }
+
+    public WorkflowBuilder withDagContainingNode(final Node node) {
+        this.addedActions.add(node);
+        return this;
+    }
+
+    public WorkflowBuilder withParameter(final String name, final String 
value) {
+        ensureParametersBuilder();
+        this.parametersBuilder.withParameter(name, value);
+        return this;
+    }
+
+    public WorkflowBuilder withParameter(final String name, final String 
value, final String description) {
+        this.parametersBuilder.withParameter(name, value, description);
+        return this;
+    }
+
+    private void ensureParametersBuilder() {
+        if (this.parametersBuilder == null) {
+            this.parametersBuilder = ParametersBuilder.create();
+        }
+    }
+
+    public WorkflowBuilder withGlobal(final Global global) {
+        this.globalBuilder = GlobalBuilder.createFromExisting(global);
+        return this;
+    }
+
+    /**
+     * Adds a {@link Credentials} to the {@link Workflow}.
+     * <p>
+     * Note that an explicit call to {@code 
WorkflowBuilder#withCredentials(Credentials)} can be omitted, since if
+     * {@link WorkflowBuilder#credentialsBuilder} is emtpy by the time {@link 
WorkflowBuilder#build()} is called,
+     * {@link Workflow#credentials} is built based on all the {@link 
Node#getCredentials()} that have been added to that
+     * {@code Workflow} in beforehand.
+     * <p>
+     * Note also that when {@code 
WorkflowBuilder#withCredentials(Credentials)} is explicitly called, the {@code 
<workflowapp />}'s
+     * {@code <credential />} section is generated only by using the {@code 
Credentials} defined on the {@code Workflow} level.
+     * <p>
+     * This way, users can, if they want to, omit calling {@code 
WorkflowBuilder#withCredentials(Credentials)} by default, but can
+     * also override the autogenerated {@code <credentials />} section of 
{@code <workflowapp />} by explicitly calling that method
+     * after another call to {@link CredentialsBuilder#build()}.
+     * @param credentials the {@code Credentials} to add, if want to override.
+     * @return this
+     */
+    public WorkflowBuilder withCredentials(final Credentials credentials) {
+        this.credentialsBuilder = 
CredentialsBuilder.createFromExisting(credentials);
+        return this;
+    }
+
+    @Override
+    public Workflow build() {
+        ensureName();
+
+        final Set<Node> nodes = new HashSet<>();
+        for (final Node node : addedActions) {
+            if (!nodes.contains(node)) {
+                nodes.addAll(getNodesInDag(node));
+            }
+        }
+
+        final ImmutableSet.Builder<Node> builder = new 
ImmutableSet.Builder<>();
+        builder.addAll(nodes);
+
+        final Parameters parameters;
+        if (parametersBuilder != null) {
+            parameters = parametersBuilder.build();
+        }
+        else {
+            parameters = null;
+        }
+
+        final Global global;
+        if (globalBuilder != null) {
+            global = globalBuilder.build();
+        }
+        else {
+            global = null;
+        }
+
+        final Credentials credentials;
+        if (credentialsBuilder != null) {
+            credentials = credentialsBuilder.build();
+        }
+        else {
+            final CredentialsBuilder actionCredentialsBuilder = 
CredentialsBuilder.create();
+            for (final Node action : addedActions) {
+                for (final Credential actionCredential : 
action.getCredentials()) {
+                    actionCredentialsBuilder.withCredential(actionCredential);
+                }
+            }
+
+            final Credentials actionCredentials = 
actionCredentialsBuilder.build();
+            if (actionCredentials.getCredentials().size() > 0) {
+                credentials = actionCredentialsBuilder.build();
+            } else {
+                credentials = null;
+            }
+        }
+
+        return new Workflow(name.get(), builder.build(), parameters, global, 
credentials);
+    }
+
+    private void ensureName() {
+        if (Strings.isNullOrEmpty(this.name.get())) {
+            final String type = "workflow";
+            final int randomSuffix = new SecureRandom().nextInt(1_000_000_000);
+
+            this.name.set(String.format("%s-%d", type, randomSuffix));
+        }
+    }
+
+    private static Set<Node> getNodesInDag(final Node node) {
+        final Set<Node> visited = new HashSet<>();
+        final Queue<Node> queue = new ArrayDeque<>();
+        visited.add(node);
+        queue.add(node);
+
+        Node current;
+        while ((current = queue.poll()) != null) {
+            visit(current.getAllParents(), visited, queue);
+            visit(current.getAllChildren(), visited, queue);
+        }
+
+        return visited;
+    }
+
+    // TODO: encapsulate into a more specific nested class, e.g. DagWalker#walk
+    private static void visit(final List<Node> toVisit, final Set<Node> 
visited, final Queue<Node> queue) {
+        for (final Node node : toVisit) {
+            if (!visited.contains(node)) {
+                visited.add(node);
+                queue.add(node);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/resources/action_mappings.xml
----------------------------------------------------------------------
diff --git a/fluent-job/fluent-job-api/src/main/resources/action_mappings.xml 
b/fluent-job/fluent-job-api/src/main/resources/action_mappings.xml
new file mode 100644
index 0000000..a5f890e
--- /dev/null
+++ b/fluent-job/fluent-job-api/src/main/resources/action_mappings.xml
@@ -0,0 +1,821 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  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.
+-->
+
+<mappings xmlns="http://dozer.sourceforge.net";
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+          xsi:schemaLocation="http://dozer.sourceforge.net
+          http://dozer.sourceforge.net/schema/beanmapping.xsd";>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.Delete</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.DELETE</class-b>
+
+        <field>
+            <a>path</a>
+            <b>path</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.Mkdir</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.MKDIR</class-b>
+
+        <field>
+            <a>path</a>
+            <b>path</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.Prepare</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.PREPARE</class-b>
+
+        <field>
+            <a is-accessible="true">deletes</a>
+            <b is-accessible="true">delete</b>
+        </field>
+
+        <field>
+            <a is-accessible="true">mkdirs</a>
+            <b is-accessible="true">mkdir</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.Streaming</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.STREAMING</class-b>
+
+        <field>
+            <a>mapper</a>
+            <b>mapper</b>
+        </field>
+
+        <field>
+            <a>reducer</a>
+            <b>reducer</b>
+        </field>
+
+        <field>
+            <a>recordReader</a>
+            <b>recordReader</b>
+        </field>
+
+        <field>
+            <a>recordReaderMappings</a>
+            <b>recordReaderMapping</b>
+        </field>
+
+        <field>
+            <a>envs</a>
+            <b>env</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.Pipes</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.PIPES</class-b>
+
+        <field>
+            <a>map</a>
+            <b>map</b>
+        </field>
+
+        <field>
+            <a>reduce</a>
+            <b>reduce</b>
+        </field>
+
+        <field>
+            <a>inputformat</a>
+            <b>inputformat</b>
+        </field>
+
+        <field>
+            <a>partitioner</a>
+            <b>partitioner</b>
+        </field>
+
+        <field>
+            <a>writer</a>
+            <b>writer</b>
+        </field>
+
+        <field>
+            <a>program</a>
+            <b>program</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        
<class-a>org.apache.oozie.fluentjob.api.action.MapReduceAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.MAPREDUCE</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field>
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field>
+            <a>streaming</a>
+            <b>streaming</b>
+        </field>
+
+        <field>
+            <a>pipes</a>
+            <b>pipes</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field>
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>configClass</a>
+            <b>configClass</b>
+        </field>
+
+        <field>
+            <a>files</a>
+            <b>file</b>
+        </field>
+
+        <field>
+            <a>archives</a>
+            <b>archive</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.DistcpAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.action.distcp.ACTION</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.DistcpPrepareConverter">
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.DistcpConfigurationConverter">
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>javaOpts</a>
+            <b>javaOpts</b>
+        </field>
+
+        <field>
+            <a>args</a>
+            <b>arg</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.HiveAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.action.hive.ACTION</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.HivePrepareConverter">
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.HiveLauncherConverter">
+            <a>launcher</a>
+            <b>launcher</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.HiveConfigurationConverter">
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field>
+            <a>script</a>
+            <b>script</b>
+        </field>
+
+        <field>
+            <a>query</a>
+            <b>query</b>
+        </field>
+
+        <field>
+            <a>params</a>
+            <b>param</b>
+        </field>
+
+        <field>
+            <a>args</a>
+            <b>argument</b>
+        </field>
+
+        <field>
+            <a>files</a>
+            <b>file</b>
+        </field>
+
+        <field>
+            <a>archives</a>
+            <b>archive</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.Hive2Action</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.action.hive2.ACTION</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.Hive2PrepareConverter">
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.Hive2LauncherConverter">
+            <a>launcher</a>
+            <b>launcher</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.Hive2ConfigurationConverter">
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field>
+            <a>jdbcUrl</a>
+            <b>jdbcUrl</b>
+        </field>
+
+        <field>
+            <a>password</a>
+            <b>password</b>
+        </field>
+
+        <field>
+            <a>script</a>
+            <b>script</b>
+        </field>
+
+        <field>
+            <a>query</a>
+            <b>query</b>
+        </field>
+
+        <field>
+            <a>params</a>
+            <b>param</b>
+        </field>
+
+        <field>
+            <a>args</a>
+            <b>argument</b>
+        </field>
+
+        <field>
+            <a>files</a>
+            <b>file</b>
+        </field>
+
+        <field>
+            <a>archives</a>
+            <b>archive</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.JavaAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.JAVA</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.InlineWorkflowPrepareConverter">
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.InlineWorkflowLauncherConverter">
+            <a>launcher</a>
+            <b>launcher</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.InlineWorkflowConfigurationConverter">
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>mainClass</a>
+            <b>mainClass</b>
+        </field>
+
+        <field>
+            <a>javaOptsString</a>
+            <b>javaOpts</b>
+        </field>
+
+        <field>
+            <a>javaOpts</a>
+            <b>javaOpt</b>
+        </field>
+
+        <field>
+            <a>args</a>
+            <b>arg</b>
+        </field>
+
+        <field>
+            <a>files</a>
+            <b>file</b>
+        </field>
+
+        <field>
+            <a>archives</a>
+            <b>archive</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.BooleanToFLAGConverter">
+            <a get-method="isCaptureOutput">captureOutput</a>
+            <b>captureOutput</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.PigAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.PIG</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.InlineWorkflowPrepareConverter">
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.InlineWorkflowLauncherConverter">
+            <a>launcher</a>
+            <b>launcher</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.InlineWorkflowConfigurationConverter">
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field>
+            <a>script</a>
+            <b>script</b>
+        </field>
+
+        <field>
+            <a>params</a>
+            <b>param</b>
+        </field>
+
+        <field>
+            <a>args</a>
+            <b>argument</b>
+        </field>
+
+        <field>
+            <a>files</a>
+            <b>file</b>
+        </field>
+
+        <field>
+            <a>archives</a>
+            <b>archive</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.ShellAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.action.shell.ACTION</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.ShellPrepareConverter">
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.ShellLauncherConverter">
+            <a>launcher</a>
+            <b>launcher</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.ShellConfigurationConverter">
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field>
+            <a>executable</a>
+            <b>exec</b>
+        </field>
+
+        <field>
+            <a>environmentVariables</a>
+            <b>envVar</b>
+        </field>
+
+        <field>
+            <a>arguments</a>
+            <b>argument</b>
+        </field>
+
+        <field>
+            <a>files</a>
+            <b>file</b>
+        </field>
+
+        <field>
+            <a>archives</a>
+            <b>archive</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.BooleanToShellFLAGConverter">
+            <a get-method="isCaptureOutput">captureOutput</a>
+            <b>captureOutput</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.SparkAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.action.spark.ACTION</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.SparkPrepareConverter">
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.SparkLauncherConverter">
+            <a>launcher</a>
+            <b>launcher</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.SparkConfigurationConverter">
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field>
+            <a>master</a>
+            <b>master</b>
+        </field>
+
+        <field>
+            <a>mode</a>
+            <b>mode</b>
+        </field>
+
+        <field>
+            <a>actionName</a>
+            <b>name</b>
+        </field>
+
+        <field>
+            <a>actionClass</a>
+            <b>clazz</b>
+        </field>
+
+        <field>
+            <a>jar</a>
+            <b>jar</b>
+        </field>
+
+        <field>
+            <a>sparkOpts</a>
+            <b>sparkOpts</b>
+        </field>
+
+        <field>
+            <a>args</a>
+            <b>arg</b>
+        </field>
+
+        <field>
+            <a>files</a>
+            <b>file</b>
+        </field>
+
+        <field>
+            <a>archives</a>
+            <b>archive</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.SqoopAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.action.sqoop.ACTION</class-b>
+
+        <field>
+            <a>resourceManager</a>
+            <b>resourceManager</b>
+        </field>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.SqoopPrepareConverter">
+            <a>prepare</a>
+            <b>prepare</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.SqoopLauncherConverter">
+            <a>launcher</a>
+            <b>launcher</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.SqoopConfigurationConverter">
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field>
+            <a>command</a>
+            <b>command</b>
+        </field>
+
+        <field>
+            <a>arguments</a>
+            <b>arg</b>
+        </field>
+
+        <field>
+            <a>files</a>
+            <b>file</b>
+        </field>
+
+        <field>
+            <a>archives</a>
+            <b>archive</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.SshAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.action.ssh.ACTION</class-b>
+
+        <field>
+            <a>host</a>
+            <b>host</b>
+        </field>
+
+        <field>
+            <a>command</a>
+            <b>command</b>
+        </field>
+
+        <field>
+            <a>args</a>
+            <b>args</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.BooleanToSshFLAGConverter">
+            <a get-method="isCaptureOutput">captureOutput</a>
+            <b>captureOutput</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.EmailAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.action.email.ACTION</class-b>
+
+        <field>
+            <a is-accessible="true">to</a>
+            <b>to</b>
+        </field>
+
+        <field>
+            <a>cc</a>
+            <b>cc</b>
+        </field>
+
+        <field>
+            <a>bcc</a>
+            <b>bcc</b>
+        </field>
+
+        <field>
+            <a>subject</a>
+            <b>subject</b>
+        </field>
+
+        <field>
+            <a>body</a>
+            <b>body</b>
+        </field>
+
+        <field>
+            <a>contentType</a>
+            <b>contentType</b>
+        </field>
+
+        <field>
+            <a>attachment</a>
+            <b>attachment</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.action.FSAction</class-a>
+        <class-b>org.apache.oozie.fluentjob.api.generated.workflow.FS</class-b>
+
+        <field>
+            <a>nameNode</a>
+            <b>nameNode</b>
+        </field>
+
+        <field>
+            <a>jobXmls</a>
+            <b>jobXml</b>
+        </field>
+
+        <field relationship-type="cumulative">
+            <a>deletes</a>
+            <b>deleteOrMkdirOrMove</b>
+            
<b-hint>org.apache.oozie.fluentjob.api.generated.workflow.DELETE</b-hint>
+        </field>
+
+        <field relationship-type="cumulative">
+            <a>mkdirs</a>
+            <b>deleteOrMkdirOrMove</b>
+            
<b-hint>org.apache.oozie.fluentjob.api.generated.workflow.MKDIR</b-hint>
+        </field>
+
+        <field relationship-type="cumulative">
+            <a>moves</a>
+            <b>deleteOrMkdirOrMove</b>
+            
<b-hint>org.apache.oozie.fluentjob.api.generated.workflow.MOVE</b-hint>
+        </field>
+
+        <field relationship-type="cumulative">
+            <a>chmods</a>
+            <b>deleteOrMkdirOrMove</b>
+            
<b-hint>org.apache.oozie.fluentjob.api.generated.workflow.CHMOD</b-hint>
+        </field>
+
+        <field relationship-type="cumulative">
+            <a>touchzs</a>
+            <b>deleteOrMkdirOrMove</b>
+            
<b-hint>org.apache.oozie.fluentjob.api.generated.workflow.TOUCHZ</b-hint>
+        </field>
+
+        <field relationship-type="cumulative">
+            <a>chgrps</a>
+            <b>deleteOrMkdirOrMove</b>
+            
<b-hint>org.apache.oozie.fluentjob.api.generated.workflow.CHGRP</b-hint>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        
<class-a>org.apache.oozie.fluentjob.api.action.SubWorkflowAction</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.SUBWORKFLOW</class-b>
+
+        <field>
+            <a>appPath</a>
+            <b>appPath</b>
+        </field>
+
+        <field 
custom-converter="org.apache.oozie.fluentjob.api.mapping.BooleanToFLAGConverter">
+            <a 
get-method="isPropagatingConfiguration">propagateConfiguration</a>
+            <b>propagateConfiguration</b>
+        </field>
+
+        <field>
+            <a>configuration</a>
+            <b>configuration</b>
+        </field>
+    </mapping>
+</mappings>

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/resources/checkstyle-header.txt
----------------------------------------------------------------------
diff --git a/fluent-job/fluent-job-api/src/main/resources/checkstyle-header.txt 
b/fluent-job/fluent-job-api/src/main/resources/checkstyle-header.txt
new file mode 100644
index 0000000..4247452
--- /dev/null
+++ b/fluent-job/fluent-job-api/src/main/resources/checkstyle-header.txt
@@ -0,0 +1,17 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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.
+ */
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/resources/checkstyle.xml
----------------------------------------------------------------------
diff --git a/fluent-job/fluent-job-api/src/main/resources/checkstyle.xml 
b/fluent-job/fluent-job-api/src/main/resources/checkstyle.xml
new file mode 100644
index 0000000..c6fca01
--- /dev/null
+++ b/fluent-job/fluent-job-api/src/main/resources/checkstyle.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" 
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd";>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  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.
+-->
+<module name="Checker">
+
+    <module name="RegexpSingleline">
+        <property name="severity" value="warning"/>
+        <property name="format" value="\s+$"/>
+        <property name="message" value="Line has trailing spaces."/>
+    </module>
+
+    <module name="Header">
+        <property name="headerFile" value="${checkstyle.header.file}"/>
+    </module>
+
+    <module name="TreeWalker">
+
+        <module name="LineLength">
+            <property name="severity" value="warning"/>
+            <property name="max" value="132"/>
+        </module>
+
+    </module>
+
+</module>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/resources/dozer_config.xml
----------------------------------------------------------------------
diff --git a/fluent-job/fluent-job-api/src/main/resources/dozer_config.xml 
b/fluent-job/fluent-job-api/src/main/resources/dozer_config.xml
new file mode 100644
index 0000000..55714c9
--- /dev/null
+++ b/fluent-job/fluent-job-api/src/main/resources/dozer_config.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  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.
+-->
+
+<mappings xmlns="http://dozer.sourceforge.net";
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+          xsi:schemaLocation="http://dozer.sourceforge.net
+          http://dozer.sourceforge.net/schema/beanmapping.xsd";>
+
+    <configuration>
+        <stop-on-errors>true</stop-on-errors>
+        <wildcard>false</wildcard>
+
+        <custom-converters>
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.GraphToWORKFLOWAPPConverter" >
+                <class-a>org.apache.oozie.fluentjob.api.dag.Graph</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.WORKFLOWAPP</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.GraphNodesToWORKFLOWAPPConverter" >
+                
<class-a>org.apache.oozie.fluentjob.api.mapping.GraphNodes</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.WORKFLOWAPP</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.DecisionConverter" >
+                <class-a>org.apache.oozie.fluentjob.api.dag.Decision</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.DECISION</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.StartConverter" >
+                <class-a>org.apache.oozie.fluentjob.api.dag.Start</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.START</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.ForkConverter" >
+                <class-a>org.apache.oozie.fluentjob.api.dag.Fork</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.FORK</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.JoinConverter" >
+                <class-a>org.apache.oozie.fluentjob.api.dag.Join</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.JOIN</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.MapToConfigurationPropertyConverter"
 >
+                <class-a>java.util.Map</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.CONFIGURATION</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.ExplicitNodeConverter" >
+                
<class-a>org.apache.oozie.fluentjob.api.dag.ExplicitNode</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.ACTION</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.ParametersConverter" >
+                
<class-a>org.apache.oozie.fluentjob.api.workflow.Parameters</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.PARAMETERS</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.GlobalConverter" >
+                
<class-a>org.apache.oozie.fluentjob.api.workflow.Global</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.GLOBAL</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.InlineWorkflowLauncherConverter" >
+                
<class-a>org.apache.oozie.fluentjob.api.action.Launcher</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.LAUNCHER</class-b>
+            </converter>
+
+            <converter 
type="org.apache.oozie.fluentjob.api.mapping.CredentialsConverter" >
+                
<class-a>org.apache.oozie.fluentjob.api.workflow.Credentials</class-a>
+                
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.CREDENTIALS</class-b>
+            </converter>
+        </custom-converters>
+
+    </configuration>
+
+</mappings>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/resources/mappingGraphToWORKFLOWAPP.xml
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/main/resources/mappingGraphToWORKFLOWAPP.xml 
b/fluent-job/fluent-job-api/src/main/resources/mappingGraphToWORKFLOWAPP.xml
new file mode 100644
index 0000000..780f963
--- /dev/null
+++ b/fluent-job/fluent-job-api/src/main/resources/mappingGraphToWORKFLOWAPP.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  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.
+-->
+
+<mappings xmlns="http://dozer.sourceforge.net";
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+          xsi:schemaLocation="http://dozer.sourceforge.net
+          http://dozer.sourceforge.net/schema/beanmapping.xsd";>
+
+    <mapping type="one-way">
+        <class-a>org.apache.oozie.fluentjob.api.dag.End</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.END</class-b>
+
+        <field>
+            <a>name</a>
+            <b>name</b>
+        </field>
+    </mapping>
+
+    <mapping type="one-way">
+        
<class-a>org.apache.oozie.fluentjob.api.dag.DagNodeWithCondition</class-a>
+        
<class-b>org.apache.oozie.fluentjob.api.generated.workflow.CASE</class-b>
+
+        <field>
+            <a>condition.condition</a>
+            <b>value</b>
+        </field>
+
+        <field>
+            <a>node.name</a>
+            <b>to</b>
+        </field>
+    </mapping>
+</mappings>

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/main/xjb/bindings.xml
----------------------------------------------------------------------
diff --git a/fluent-job/fluent-job-api/src/main/xjb/bindings.xml 
b/fluent-job/fluent-job-api/src/main/xjb/bindings.xml
new file mode 100644
index 0000000..48f6890
--- /dev/null
+++ b/fluent-job/fluent-job-api/src/main/xjb/bindings.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  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.
+-->
+
+<jaxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema";
+        xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"; version="2.1"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+        xmlns:namespace="http://jaxb2-commons.dev.java.net/namespace-prefix";
+        xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb 
http://java.sun.com/xml/ns/jaxb/bindingschema_2_1.xsd
+            http://jaxb2-commons.dev.java.net/namespace-prefix
+            
https://raw.githubusercontent.com/Siggen/jaxb2-namespace-prefix/master/src/main/resources/prefix-namespace-schema.xsd";>
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/distcp-action-1.0.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.action.distcp"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="distcp" />
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/email-action-0.2.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.action.email"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="email" />
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/hive2-action-1.0.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.action.hive2"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="hive2" />
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/hive-action-1.0.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.action.hive"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="hive" />
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+    <!--<jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/oozie-sla-0.2.xsd">-->
+
+        <!--<jaxb:schemaBindings>-->
+            <!--<jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.sla"/>-->
+        <!--</jaxb:schemaBindings>-->
+
+        <!--<jaxb:bindings>-->
+            <!--<namespace:prefix name="sla" />-->
+        <!--</jaxb:bindings>-->
+
+    <!--</jaxb:bindings>-->
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/oozie-workflow-1.0.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.workflow"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="workflow" />
+        </jaxb:bindings>
+
+        <jaxb:bindings 
node="//xs:complexType[@name='ACTION']/xs:sequence/xs:choice/xs:any">
+            <jaxb:property name="other" generateElementProperty="true"/>
+        </jaxb:bindings>
+
+        <jaxb:bindings 
node="//xs:complexType[@name='ACTION']/xs:sequence/xs:any[@namespace='uri:oozie:sla:0.1
 uri:oozie:sla:0.2']">
+            <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/oozie-sla-0.2.xsd">
+
+                <jaxb:schemaBindings>
+                    <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.sla"/>
+                </jaxb:schemaBindings>
+
+                <namespace:prefix name="sla" />
+            </jaxb:bindings>
+
+            <jaxb:property name="sla" generateElementProperty="true"/>
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/shell-action-1.0.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.action.shell"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="shell" />
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/spark-action-1.0.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.action.spark"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="spark" />
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/sqoop-action-1.0.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.action.sqoop"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="sqoop" />
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+    <jaxb:bindings schemaLocation = 
"../../../../../client/src/main/resources/ssh-action-0.2.xsd">
+
+        <jaxb:schemaBindings>
+            <jaxb:package name = 
"org.apache.oozie.fluentjob.api.generated.action.ssh"/>
+        </jaxb:schemaBindings>
+
+        <jaxb:bindings>
+            <namespace:prefix name="ssh" />
+        </jaxb:bindings>
+
+    </jaxb:bindings>
+
+</jaxb:bindings>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/NodesToPng.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/NodesToPng.java
 
b/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/NodesToPng.java
new file mode 100644
index 0000000..4b97327
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/NodesToPng.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api;
+
+import org.apache.oozie.fluentjob.api.dag.Graph;
+import org.apache.oozie.fluentjob.api.workflow.Workflow;
+import org.junit.rules.ExternalResource;
+
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Used in integration tests, eases the generation of visualized {@link 
Workflow} or {@link Graph} instances
+ * in {@code .png} format using a predefined datetime pattern name postfix.
+ */
+public class NodesToPng extends ExternalResource {
+    private final DateFormat df = new SimpleDateFormat("yyyyMMddhhmmss");
+    private Date testRunningOn;
+
+    @Override
+    protected void before() throws Throwable {
+        testRunningOn = new Date();
+    }
+
+    public void withWorkflow(final Workflow workflow) throws IOException {
+        final String fileName = String.format("%s-%s-workflow.png", 
df.format(testRunningOn), workflow.getName());
+        GraphVisualization.workflowToPng(workflow, fileName);
+    }
+
+    public void withGraph(final Graph graph) throws IOException {
+        final String fileName = String.format("%s-%s-graph.png", 
df.format(testRunningOn), graph.getName());
+        GraphVisualization.graphToPng(graph, fileName);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/TestCondition.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/TestCondition.java
 
b/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/TestCondition.java
new file mode 100644
index 0000000..5c0fab8
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/TestCondition.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class TestCondition {
+    @Test
+    public void testActualCondition() {
+        final String conditionString = "some_condition";
+        final Condition actualCondition = 
Condition.actualCondition(conditionString);
+
+        assertEquals(conditionString, actualCondition.getCondition());
+        assertFalse(actualCondition.isDefault());
+    }
+
+    @Test
+    public void testDefaultCondition() {
+        final Condition defaultCondition = Condition.defaultCondition();
+
+        assertTrue(defaultCondition.isDefault());
+    }
+}

http://git-wip-us.apache.org/repos/asf/oozie/blob/8a0a6487/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/TestModifyOnce.java
----------------------------------------------------------------------
diff --git 
a/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/TestModifyOnce.java
 
b/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/TestModifyOnce.java
new file mode 100644
index 0000000..6e1f11f
--- /dev/null
+++ 
b/fluent-job/fluent-job-api/src/test/java/org/apache/oozie/fluentjob/api/TestModifyOnce.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * 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 org.apache.oozie.fluentjob.api;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import static org.junit.Assert.assertEquals;
+
+public class TestModifyOnce {
+    @Rule
+    public final ExpectedException expectedException = 
ExpectedException.none();
+
+    @Test
+    public void testAllowOneModification() {
+        final String defaultValue = "Default value";
+        final ModifyOnce<String> instance = new ModifyOnce<>(defaultValue);
+
+        assertEquals(defaultValue, instance.get());
+
+        final String anotherValue = "Another value";
+        instance.set(anotherValue);
+
+        assertEquals(anotherValue, instance.get());
+    }
+
+    @Test
+    public void testThrowOnSecondModification() {
+        final ModifyOnce<String> instance = new ModifyOnce<>();
+        instance.set("First modification");
+
+        expectedException.expect(IllegalStateException.class);
+        instance.set("Second modification");
+    }
+}

Reply via email to