You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by sr...@apache.org on 2013/04/26 17:50:36 UTC

[20/47] Fixes for Checkstyle

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/client/FalconClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/client/FalconClient.java b/client/src/main/java/org/apache/falcon/client/FalconClient.java
index c4f5748..bc8efc1 100644
--- a/client/src/main/java/org/apache/falcon/client/FalconClient.java
+++ b/client/src/main/java/org/apache/falcon/client/FalconClient.java
@@ -18,30 +18,21 @@
 
 package org.apache.falcon.client;
 
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.Properties;
-
-import javax.ws.rs.HttpMethod;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
 import org.apache.falcon.entity.v0.SchemaHelper;
 import org.apache.falcon.resource.APIResult;
 import org.apache.falcon.resource.EntityList;
 import org.apache.falcon.resource.InstancesResult;
 
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
+import javax.ws.rs.HttpMethod;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import java.io.*;
+import java.util.Properties;
 
 /**
  * Client API to submit and manage Falcon Entities (Cluster, Feed, Process) jobs
@@ -49,639 +40,637 @@ import com.sun.jersey.api.client.config.DefaultClientConfig;
  */
 public class FalconClient {
 
-	private String baseUrl;
-	protected static WebResource service;
-	public static final String WS_HEADER_PREFIX = "header:";
-	private static final String REMOTE_USER = "Remote-User";
-	private static final String USER = System.getProperty("user.name");
-	private static final String FALCON_INSTANCE_ACTION_CLUSTERS = "falcon.instance.action.clusters";
-	private static final String FALCON_INSTANCE_SOURCE_CLUSTERS = "falcon.instance.source.clusters";
-	/**
-	 * Create a Falcon client instance.
-	 * 
-	 * @param falconUrl
-	 *            of the server to which client interacts
-	 * @throws IOException
-	 */
-	public FalconClient(String falconUrl) throws IOException {
-		this.baseUrl = notEmpty(falconUrl, "FalconUrl");
-		if (!this.baseUrl.endsWith("/")) {
-			this.baseUrl += "/";
-		}
-		Client client = Client.create(new DefaultClientConfig());
-		setFalconTimeOut(client);
-		FalconClient.service = client.resource(UriBuilder.fromUri(baseUrl)
-				.build());
-		client.resource(UriBuilder.fromUri(baseUrl).build());
-
-		// addHeaders();
-	}
-
-	private void setFalconTimeOut(Client client) throws IOException {
-		Properties prop = new Properties();
-		InputStream input = FalconClient.class
-				.getResourceAsStream("/client.properties");
-		int readTimeout = 0;
-		int connectTimeout = 0;
-		if (input != null) {
-			prop.load(input);
-			readTimeout = prop.containsKey("falcon.read.timeout") ? Integer
-					.parseInt(prop.getProperty("falcon.read.timeout")) : 180000;
-			connectTimeout = prop.containsKey("falcon.connect.timeout") ? Integer
-					.parseInt(prop.getProperty("falcon.connect.timeout"))
-					: 180000;
-		} else {
-			readTimeout = 180000;
-			connectTimeout = 180000;
-		}
-		client.setConnectTimeout(connectTimeout);
-		client.setReadTimeout(readTimeout);
-	}
-
-	/**
-	 * Methods allowed on Entity Resources
-	 */
-	protected static enum Entities {
-		VALIDATE("api/entities/validate/", HttpMethod.POST, MediaType.TEXT_XML), SUBMIT(
-				"api/entities/submit/", HttpMethod.POST, MediaType.TEXT_XML), UPDATE(
-				"api/entities/update/", HttpMethod.POST, MediaType.TEXT_XML), SUBMITandSCHEDULE(
-				"api/entities/submitAndSchedule/", HttpMethod.POST,
-				MediaType.TEXT_XML), SCHEDULE("api/entities/schedule/",
-				HttpMethod.POST, MediaType.TEXT_XML), SUSPEND(
-				"api/entities/suspend/", HttpMethod.POST, MediaType.TEXT_XML), RESUME(
-				"api/entities/resume/", HttpMethod.POST, MediaType.TEXT_XML), DELETE(
-				"api/entities/delete/", HttpMethod.DELETE, MediaType.TEXT_XML), STATUS(
-				"api/entities/status/", HttpMethod.GET, MediaType.TEXT_XML), DEFINITION(
-				"api/entities/definition/", HttpMethod.GET, MediaType.TEXT_XML), LIST(
-				"api/entities/list/", HttpMethod.GET, MediaType.TEXT_XML), DEPENDENCY(
-				"api/entities/dependencies/", HttpMethod.GET,
-				MediaType.TEXT_XML);
-
-		private String path;
-		private String method;
-		private String mimeType;
-
-		Entities(String path, String method, String mimeType) {
-			this.path = path;
-			this.method = method;
-			this.mimeType = mimeType;
-		}
-	}
-
-	/**
-	 * Methods allowed on Process Instance Resources
-	 */
-	protected static enum Instances {
-		RUNNING("api/instance/running/", HttpMethod.GET,
-				MediaType.APPLICATION_JSON), STATUS("api/instance/status/",
-				HttpMethod.GET, MediaType.APPLICATION_JSON), KILL(
-				"api/instance/kill/", HttpMethod.POST,
-				MediaType.APPLICATION_JSON), SUSPEND("api/instance/suspend/",
-				HttpMethod.POST, MediaType.APPLICATION_JSON), RESUME(
-				"api/instance/resume/", HttpMethod.POST,
-				MediaType.APPLICATION_JSON), RERUN("api/instance/rerun/",
-				HttpMethod.POST, MediaType.APPLICATION_JSON) ,LOG("api/instance/logs/",
-				HttpMethod.GET, MediaType.APPLICATION_JSON);
-		private String path;
-		private String method;
-		private String mimeType;
-
-		Instances(String path, String method, String mimeType) {
-			this.path = path;
-			this.method = method;
-			this.mimeType = mimeType;
-		}
-	}
-	
-	protected static enum AdminOperations {
-		
-		STACK("api/admin/stack", HttpMethod.GET,
-				MediaType.TEXT_PLAIN), 
-		VERSION("api/admin/version", HttpMethod.GET,
-				MediaType.TEXT_PLAIN);
-		private String path;
-		private String method;
-		private String mimeType;
-		
-		AdminOperations(String path, String method, String mimeType) {
-			this.path = path;
-			this.method = method;
-			this.mimeType = mimeType;
-		}
-	}
-
-	public String notEmpty(String str, String name) {
-		if (str == null) {
-
-			throw new IllegalArgumentException(name + " cannot be null");
-		}
-		if (str.length() == 0) {
-			throw new IllegalArgumentException(name + " cannot be empty");
-		}
-		return str;
-	}
-
-	/**
-	 * Check if the object is not null.
-	 * 
-	 * @param <T>
-	 * @param obj
-	 * @param name
-	 * @return string
-	 */
-	public static <T> T notNull(T obj, String name) {
-		if (obj == null) {
-			throw new IllegalArgumentException(name + " cannot be null");
-		}
-		return obj;
-	}
-
-	public String schedule(String entityType, String entityName, String colo)
-			throws FalconCLIException {
-
-		return sendEntityRequest(Entities.SCHEDULE, entityType, entityName,
-				colo);
-
-	}
-
-	public String suspend(String entityType, String entityName, String colo)
-			throws FalconCLIException {
-
-		return sendEntityRequest(Entities.SUSPEND, entityType, entityName, colo);
-
-	}
-
-	public String resume(String entityType, String entityName, String colo)
-			throws FalconCLIException {
-
-		return sendEntityRequest(Entities.RESUME, entityType, entityName, colo);
-
-	}
-
-	public String delete(String entityType, String entityName)
-			throws FalconCLIException {
-
-		return sendEntityRequest(Entities.DELETE, entityType, entityName, null);
-
-	}
-
-	public String validate(String entityType, String filePath)
-			throws FalconCLIException {
-		InputStream entityStream = getServletInputStream(filePath);
-		return sendEntityRequestWithObject(Entities.VALIDATE, entityType,
-				entityStream, null);
-	}
-
-	public String submit(String entityType, String filePath)
-			throws FalconCLIException {
-		InputStream entityStream = getServletInputStream(filePath);
-		return sendEntityRequestWithObject(Entities.SUBMIT, entityType,
-				entityStream, null);
-	}
-
-	public String update(String entityType, String entityName, String filePath) 
-			throws FalconCLIException {
-		InputStream entityStream = getServletInputStream(filePath);
-		return sendEntityRequestWithNameAndObject(Entities.UPDATE, entityType,
-				entityName, entityStream);
-	}
-
-	public String submitAndSchedule(String entityType, String filePath) 
-			throws FalconCLIException {
-		InputStream entityStream = getServletInputStream(filePath);
-		return sendEntityRequestWithObject(Entities.SUBMITandSCHEDULE,
-				entityType, entityStream, null);
-	}
-
-	public String getStatus(String entityType, String entityName, String colo)
-			throws FalconCLIException {
-
-		return sendEntityRequest(Entities.STATUS, entityType, entityName, colo);
-
-	}
-
-	public String getDefinition(String entityType, String entityName)
-			throws FalconCLIException {
-
-		return sendDefinitionRequest(Entities.DEFINITION, entityType,
-				entityName);
-
-	}
-
-	public String getDependency(String entityType, String entityName)
-			throws FalconCLIException {
-		return sendDependencyRequest(Entities.DEPENDENCY, entityType,
-				entityName);
-	}
-
-	public String getEntityList(String entityType) throws FalconCLIException {
-		return sendListRequest(Entities.LIST, entityType);
-	}
-
-	public String getRunningInstances(String type, String entity, String colo)
-			throws FalconCLIException {
-
-		return sendInstanceRequest(Instances.RUNNING, type, entity, null, null,
-				null, null, colo);
-	}
-
-	public String getStatusOfInstances(String type, String entity,
-			String start, String end, String runid, String colo)
-			throws FalconCLIException {
-
-		return sendInstanceRequest(Instances.STATUS, type, entity, start, end,
-				null, null, colo);
-	}
-
-	public String killInstances(String type, String entity, String start,
-			String end, String colo, String clusters, String sourceClusters)
-			throws FalconCLIException, UnsupportedEncodingException {
-
-		return sendInstanceRequest(Instances.KILL, type, entity, start, end,
-				getServletInputStream(clusters, sourceClusters, null), null, colo);
-	}
-
-	public String suspendInstances(String type, String entity, String start,
-			String end, String colo, String clusters, String sourceClusters)
-			throws FalconCLIException, UnsupportedEncodingException {
-
-		return sendInstanceRequest(Instances.SUSPEND, type, entity, start, end,
-				getServletInputStream(clusters, sourceClusters, null), null, colo);
-	}
-
-	public String resumeInstances(String type, String entity, String start,
-			String end, String colo, String clusters, String sourceClusters)
-			throws FalconCLIException, UnsupportedEncodingException {
-
-		return sendInstanceRequest(Instances.RESUME, type, entity, start, end,
-				getServletInputStream(clusters, sourceClusters, null), null, colo);
-	}
-
-	public String rerunInstances(String type, String entity, String start,
-			String end, String filePath, String colo, String clusters,
-			String sourceClusters) throws FalconCLIException, IOException {
-		StringBuffer sb = new StringBuffer();
-		if(filePath != null)	
-		{
-			BufferedReader in = new BufferedReader(new FileReader(filePath));
-		    String str;
-		    while ((str = in.readLine()) != null) {
-		    	sb.append(str).append("\n");
-		    }
-		    in.close();
-		}
-		String temp = (sb.length() == 0) ? null : sb.toString();
-		return sendInstanceRequest(Instances.RERUN, type, entity, start, end,
-				getServletInputStream(clusters, sourceClusters, temp), null, colo);
-	}
-
-	public String rerunInstances(String type, String entity, String start,
-			String end, String colo, String clusters, String sourceClusters)
-			throws FalconCLIException, UnsupportedEncodingException {
-		return sendInstanceRequest(Instances.RERUN, type, entity, start, end,
-				getServletInputStream(clusters, sourceClusters, "oozie.wf.rerun.failnodes=true\n"), null, colo);
-	}
-	
-	public String getLogsOfInstances(String type, String entity, String start,
-			String end, String colo, String runId) throws FalconCLIException {
-
-		return sendInstanceRequest(Instances.LOG, type, entity, start, end,
-				null, runId, colo);
-	}
-	
-	public String getThreadDump() throws FalconCLIException{
-		return sendAdminRequest(AdminOperations.STACK);
-	}
-	
-	public String getVersion() throws FalconCLIException{
-		return sendAdminRequest(AdminOperations.VERSION);
-	}
-
-	/**
-	 * Converts a InputStream into ServletInputStream
-	 * 
-	 * @param filePath
-	 * @return ServletInputStream
-	 * @throws FalconCLIException
-	 * @throws java.io.IOException
-	 */
-	private InputStream getServletInputStream(String filePath)
-			throws FalconCLIException {
-		if (filePath == null) {
-			return null;
-		}
-		InputStream stream = null;
-		try {
-			stream = new FileInputStream(filePath);
-		} catch (FileNotFoundException e) {
-			throw new FalconCLIException("File not found:", e);
-		} catch (IOException e) {
-			throw new FalconCLIException("Unable to read file: ", e);
-		}
-		return stream;
-	}
-	
-	private InputStream getServletInputStream(String clusters,
-			String sourceClusters, String properties) throws FalconCLIException,
-			UnsupportedEncodingException {
-		
-		InputStream stream = null;
-		StringBuffer sb = new StringBuffer();
-		if (clusters != null) {
-			sb.append(FALCON_INSTANCE_ACTION_CLUSTERS + "=" + clusters + "\n");
-		}
-		if (sourceClusters != null) {
-			sb.append(FALCON_INSTANCE_SOURCE_CLUSTERS + "=" + sourceClusters + "\n");
-		} 
-		if(properties != null) {
-			sb.append(properties);
-		}
-		stream = new ByteArrayInputStream(sb.toString().getBytes("UTF-8"));
-		return (sb.length() == 0) ? null : stream;
-	}
-	// private ServletInputStream getServletInputStream(final InputStream
-	// stream)
-	// throws IOException {
-	// return new ServletInputStream() {
-	//
-	// @Override
-	// public int read() throws IOException {
-	// return stream.read();
-	// }
-	// };
-	// }
-
-	private String sendEntityRequest(Entities entities, String entityType,
-			String entityName, String colo) throws FalconCLIException {
-		
-		WebResource resource = service.path(entities.path)
-				.path(entityType).path(entityName);
-		if (colo != null) {
-			resource = resource.queryParam("colo", colo);
-		}
-		ClientResponse clientResponse = resource.header(REMOTE_USER, USER)
-				.accept(entities.mimeType).type(MediaType.TEXT_XML)
-				.method(entities.method, ClientResponse.class);
-
-		checkIfSuccessfull(clientResponse);
-
-		return parseAPIResult(clientResponse);
-	}
-
-	private String sendDefinitionRequest(Entities entities, String entityType,
-			String entityName) throws FalconCLIException {
-
-		ClientResponse clientResponse = service.path(entities.path)
-				.path(entityType).path(entityName).header(REMOTE_USER, USER)
-				.accept(entities.mimeType).type(MediaType.TEXT_XML)
-				.method(entities.method, ClientResponse.class);
-
-		checkIfSuccessfull(clientResponse);
-		return clientResponse.getEntity(String.class);
-	}
-
-	private String sendDependencyRequest(Entities entities, String entityType,
-			String entityName) throws FalconCLIException {
-
-		ClientResponse clientResponse = service.path(entities.path)
-				.path(entityType).path(entityName).header(REMOTE_USER, USER)
-				.accept(entities.mimeType).type(MediaType.TEXT_XML)
-				.method(entities.method, ClientResponse.class);
-
-		checkIfSuccessfull(clientResponse);
-
-		return parseEntityList(clientResponse);
-
-	}
-
-	private String sendListRequest(Entities entities, String entityType)
-			throws FalconCLIException {
-
-		ClientResponse clientResponse = service.path(entities.path)
-				.path(entityType).header(REMOTE_USER, USER)
-				.accept(entities.mimeType).type(MediaType.TEXT_XML)
-				.method(entities.method, ClientResponse.class);
-
-		checkIfSuccessfull(clientResponse);
-
-		return parseEntityList(clientResponse);
-
-	}
-
-	private String sendEntityRequestWithObject(Entities entities,
-			String entityType, Object requestObject, String colo) throws FalconCLIException {
-		
-		WebResource resource = service.path(entities.path)
-				.path(entityType);
-		if (colo != null) {
-			resource = resource.queryParam("colo", colo);
-		}
-		ClientResponse clientResponse = resource.header(REMOTE_USER, USER)
-				.accept(entities.mimeType).type(MediaType.TEXT_XML)
-				.method(entities.method, ClientResponse.class, requestObject);
-
-		checkIfSuccessfull(clientResponse);
-
-		return parseAPIResult(clientResponse);
-
-	}
-
-	private String sendEntityRequestWithNameAndObject(Entities entities,
-			String entityType, String entityName, Object requestObject)
-			throws FalconCLIException {
-		
-		ClientResponse clientResponse = service.path(entities.path)
-				.path(entityType).path(entityName).header(REMOTE_USER, USER)
-				.accept(entities.mimeType).type(MediaType.TEXT_XML)
-				.method(entities.method, ClientResponse.class, requestObject);
-
-		checkIfSuccessfull(clientResponse);
-
-		return parseAPIResult(clientResponse);
-
-	}
-
-	public InstancesResult instanceCmd(Instances instances, String type, String name, String start, String end, String colo) {
+    private String baseUrl;
+    protected static WebResource service;
+    public static final String WS_HEADER_PREFIX = "header:";
+    private static final String REMOTE_USER = "Remote-User";
+    private static final String USER = System.getProperty("user.name");
+    private static final String FALCON_INSTANCE_ACTION_CLUSTERS = "falcon.instance.action.clusters";
+    private static final String FALCON_INSTANCE_SOURCE_CLUSTERS = "falcon.instance.source.clusters";
+
+    /**
+     * Create a Falcon client instance.
+     *
+     * @param falconUrl of the server to which client interacts
+     * @throws IOException
+     */
+    public FalconClient(String falconUrl) throws IOException {
+        this.baseUrl = notEmpty(falconUrl, "FalconUrl");
+        if (!this.baseUrl.endsWith("/")) {
+            this.baseUrl += "/";
+        }
+        Client client = Client.create(new DefaultClientConfig());
+        setFalconTimeOut(client);
+        FalconClient.service = client.resource(UriBuilder.fromUri(baseUrl)
+                .build());
+        client.resource(UriBuilder.fromUri(baseUrl).build());
+
+        // addHeaders();
+    }
+
+    private void setFalconTimeOut(Client client) throws IOException {
+        Properties prop = new Properties();
+        InputStream input = FalconClient.class
+                .getResourceAsStream("/client.properties");
+        int readTimeout = 0;
+        int connectTimeout = 0;
+        if (input != null) {
+            prop.load(input);
+            readTimeout = prop.containsKey("falcon.read.timeout") ? Integer
+                    .parseInt(prop.getProperty("falcon.read.timeout")) : 180000;
+            connectTimeout = prop.containsKey("falcon.connect.timeout") ? Integer
+                    .parseInt(prop.getProperty("falcon.connect.timeout"))
+                    : 180000;
+        } else {
+            readTimeout = 180000;
+            connectTimeout = 180000;
+        }
+        client.setConnectTimeout(connectTimeout);
+        client.setReadTimeout(readTimeout);
+    }
+
+    /**
+     * Methods allowed on Entity Resources.
+     */
+    protected static enum Entities {
+        VALIDATE("api/entities/validate/", HttpMethod.POST, MediaType.TEXT_XML), SUBMIT(
+                "api/entities/submit/", HttpMethod.POST, MediaType.TEXT_XML), UPDATE(
+                "api/entities/update/", HttpMethod.POST, MediaType.TEXT_XML), SUBMITandSCHEDULE(
+                "api/entities/submitAndSchedule/", HttpMethod.POST,
+                MediaType.TEXT_XML), SCHEDULE("api/entities/schedule/",
+                HttpMethod.POST, MediaType.TEXT_XML), SUSPEND(
+                "api/entities/suspend/", HttpMethod.POST, MediaType.TEXT_XML), RESUME(
+                "api/entities/resume/", HttpMethod.POST, MediaType.TEXT_XML), DELETE(
+                "api/entities/delete/", HttpMethod.DELETE, MediaType.TEXT_XML), STATUS(
+                "api/entities/status/", HttpMethod.GET, MediaType.TEXT_XML), DEFINITION(
+                "api/entities/definition/", HttpMethod.GET, MediaType.TEXT_XML), LIST(
+                "api/entities/list/", HttpMethod.GET, MediaType.TEXT_XML), DEPENDENCY(
+                "api/entities/dependencies/", HttpMethod.GET,
+                MediaType.TEXT_XML);
+
+        private String path;
+        private String method;
+        private String mimeType;
+
+        Entities(String path, String method, String mimeType) {
+            this.path = path;
+            this.method = method;
+            this.mimeType = mimeType;
+        }
+    }
+
+    /**
+     * Methods allowed on Process Instance Resources.
+     */
+    protected static enum Instances {
+        RUNNING("api/instance/running/", HttpMethod.GET,
+                MediaType.APPLICATION_JSON), STATUS("api/instance/status/",
+                HttpMethod.GET, MediaType.APPLICATION_JSON), KILL(
+                "api/instance/kill/", HttpMethod.POST,
+                MediaType.APPLICATION_JSON), SUSPEND("api/instance/suspend/",
+                HttpMethod.POST, MediaType.APPLICATION_JSON), RESUME(
+                "api/instance/resume/", HttpMethod.POST,
+                MediaType.APPLICATION_JSON), RERUN("api/instance/rerun/",
+                HttpMethod.POST, MediaType.APPLICATION_JSON), LOG("api/instance/logs/",
+                HttpMethod.GET, MediaType.APPLICATION_JSON);
+        private String path;
+        private String method;
+        private String mimeType;
+
+        Instances(String path, String method, String mimeType) {
+            this.path = path;
+            this.method = method;
+            this.mimeType = mimeType;
+        }
+    }
+
+    protected static enum AdminOperations {
+
+        STACK("api/admin/stack", HttpMethod.GET,
+                MediaType.TEXT_PLAIN),
+        VERSION("api/admin/version", HttpMethod.GET,
+                MediaType.TEXT_PLAIN);
+        private String path;
+        private String method;
+        private String mimeType;
+
+        AdminOperations(String path, String method, String mimeType) {
+            this.path = path;
+            this.method = method;
+            this.mimeType = mimeType;
+        }
+    }
+
+    public String notEmpty(String str, String name) {
+        if (str == null) {
+
+            throw new IllegalArgumentException(name + " cannot be null");
+        }
+        if (str.length() == 0) {
+            throw new IllegalArgumentException(name + " cannot be empty");
+        }
+        return str;
+    }
+
+    /**
+     * Check if the object is not null.
+     *
+     * @param <T>
+     * @param obj
+     * @param name
+     * @return string
+     */
+    public static <T> T notNull(T obj, String name) {
+        if (obj == null) {
+            throw new IllegalArgumentException(name + " cannot be null");
+        }
+        return obj;
+    }
+
+    public String schedule(String entityType, String entityName, String colo)
+            throws FalconCLIException {
+
+        return sendEntityRequest(Entities.SCHEDULE, entityType, entityName,
+                colo);
+
+    }
+
+    public String suspend(String entityType, String entityName, String colo)
+            throws FalconCLIException {
+
+        return sendEntityRequest(Entities.SUSPEND, entityType, entityName, colo);
+
+    }
+
+    public String resume(String entityType, String entityName, String colo)
+            throws FalconCLIException {
+
+        return sendEntityRequest(Entities.RESUME, entityType, entityName, colo);
+
+    }
+
+    public String delete(String entityType, String entityName)
+            throws FalconCLIException {
+
+        return sendEntityRequest(Entities.DELETE, entityType, entityName, null);
+
+    }
+
+    public String validate(String entityType, String filePath)
+            throws FalconCLIException {
+        InputStream entityStream = getServletInputStream(filePath);
+        return sendEntityRequestWithObject(Entities.VALIDATE, entityType,
+                entityStream, null);
+    }
+
+    public String submit(String entityType, String filePath)
+            throws FalconCLIException {
+        InputStream entityStream = getServletInputStream(filePath);
+        return sendEntityRequestWithObject(Entities.SUBMIT, entityType,
+                entityStream, null);
+    }
+
+    public String update(String entityType, String entityName, String filePath)
+            throws FalconCLIException {
+        InputStream entityStream = getServletInputStream(filePath);
+        return sendEntityRequestWithNameAndObject(Entities.UPDATE, entityType,
+                entityName, entityStream);
+    }
+
+    public String submitAndSchedule(String entityType, String filePath)
+            throws FalconCLIException {
+        InputStream entityStream = getServletInputStream(filePath);
+        return sendEntityRequestWithObject(Entities.SUBMITandSCHEDULE,
+                entityType, entityStream, null);
+    }
+
+    public String getStatus(String entityType, String entityName, String colo)
+            throws FalconCLIException {
+
+        return sendEntityRequest(Entities.STATUS, entityType, entityName, colo);
+
+    }
+
+    public String getDefinition(String entityType, String entityName)
+            throws FalconCLIException {
+
+        return sendDefinitionRequest(Entities.DEFINITION, entityType,
+                entityName);
+
+    }
+
+    public String getDependency(String entityType, String entityName)
+            throws FalconCLIException {
+        return sendDependencyRequest(Entities.DEPENDENCY, entityType,
+                entityName);
+    }
+
+    public String getEntityList(String entityType) throws FalconCLIException {
+        return sendListRequest(Entities.LIST, entityType);
+    }
+
+    public String getRunningInstances(String type, String entity, String colo)
+            throws FalconCLIException {
+
+        return sendInstanceRequest(Instances.RUNNING, type, entity, null, null,
+                null, null, colo);
+    }
+
+    public String getStatusOfInstances(String type, String entity,
+                                       String start, String end, String runid, String colo)
+            throws FalconCLIException {
+
+        return sendInstanceRequest(Instances.STATUS, type, entity, start, end,
+                null, null, colo);
+    }
+
+    public String killInstances(String type, String entity, String start,
+                                String end, String colo, String clusters, String sourceClusters)
+            throws FalconCLIException, UnsupportedEncodingException {
+
+        return sendInstanceRequest(Instances.KILL, type, entity, start, end,
+                getServletInputStream(clusters, sourceClusters, null), null, colo);
+    }
+
+    public String suspendInstances(String type, String entity, String start,
+                                   String end, String colo, String clusters, String sourceClusters)
+            throws FalconCLIException, UnsupportedEncodingException {
+
+        return sendInstanceRequest(Instances.SUSPEND, type, entity, start, end,
+                getServletInputStream(clusters, sourceClusters, null), null, colo);
+    }
+
+    public String resumeInstances(String type, String entity, String start,
+                                  String end, String colo, String clusters, String sourceClusters)
+            throws FalconCLIException, UnsupportedEncodingException {
+
+        return sendInstanceRequest(Instances.RESUME, type, entity, start, end,
+                getServletInputStream(clusters, sourceClusters, null), null, colo);
+    }
+
+    public String rerunInstances(String type, String entity, String start,
+                                 String end, String filePath, String colo, String clusters,
+                                 String sourceClusters) throws FalconCLIException, IOException {
+        StringBuffer sb = new StringBuffer();
+        if (filePath != null) {
+            BufferedReader in = new BufferedReader(new FileReader(filePath));
+            String str;
+            while ((str = in.readLine()) != null) {
+                sb.append(str).append("\n");
+            }
+            in.close();
+        }
+        String temp = (sb.length() == 0) ? null : sb.toString();
+        return sendInstanceRequest(Instances.RERUN, type, entity, start, end,
+                getServletInputStream(clusters, sourceClusters, temp), null, colo);
+    }
+
+    public String rerunInstances(String type, String entity, String start,
+                                 String end, String colo, String clusters, String sourceClusters)
+            throws FalconCLIException, UnsupportedEncodingException {
+        return sendInstanceRequest(Instances.RERUN, type, entity, start, end,
+                getServletInputStream(clusters, sourceClusters, "oozie.wf.rerun.failnodes=true\n"), null, colo);
+    }
+
+    public String getLogsOfInstances(String type, String entity, String start,
+                                     String end, String colo, String runId) throws FalconCLIException {
+
+        return sendInstanceRequest(Instances.LOG, type, entity, start, end,
+                null, runId, colo);
+    }
+
+    public String getThreadDump() throws FalconCLIException {
+        return sendAdminRequest(AdminOperations.STACK);
+    }
+
+    public String getVersion() throws FalconCLIException {
+        return sendAdminRequest(AdminOperations.VERSION);
+    }
+
+    /**
+     * Converts a InputStream into ServletInputStream.
+     *
+     * @param filePath
+     * @return ServletInputStream
+     * @throws FalconCLIException
+     * @throws java.io.IOException
+     */
+    private InputStream getServletInputStream(String filePath)
+            throws FalconCLIException {
+        if (filePath == null) {
+            return null;
+        }
+        InputStream stream = null;
+        try {
+            stream = new FileInputStream(filePath);
+        } catch (FileNotFoundException e) {
+            throw new FalconCLIException("File not found:", e);
+        } catch (IOException e) {
+            throw new FalconCLIException("Unable to read file: ", e);
+        }
+        return stream;
+    }
+
+    private InputStream getServletInputStream(String clusters,
+                                              String sourceClusters, String properties) throws FalconCLIException,
+                                                                                               UnsupportedEncodingException {
+
+        InputStream stream = null;
+        StringBuffer sb = new StringBuffer();
+        if (clusters != null) {
+            sb.append(FALCON_INSTANCE_ACTION_CLUSTERS + "=" + clusters + "\n");
+        }
+        if (sourceClusters != null) {
+            sb.append(FALCON_INSTANCE_SOURCE_CLUSTERS + "=" + sourceClusters + "\n");
+        }
+        if (properties != null) {
+            sb.append(properties);
+        }
+        stream = new ByteArrayInputStream(sb.toString().getBytes("UTF-8"));
+        return (sb.length() == 0) ? null : stream;
+    }
+    // private ServletInputStream getServletInputStream(final InputStream
+    // stream)
+    // throws IOException {
+    // return new ServletInputStream() {
+    //
+    // @Override
+    // public int read() throws IOException {
+    // return stream.read();
+    // }
+    // };
+    // }
+
+    private String sendEntityRequest(Entities entities, String entityType,
+                                     String entityName, String colo) throws FalconCLIException {
+
+        WebResource resource = service.path(entities.path)
+                .path(entityType).path(entityName);
+        if (colo != null) {
+            resource = resource.queryParam("colo", colo);
+        }
+        ClientResponse clientResponse = resource.header(REMOTE_USER, USER)
+                .accept(entities.mimeType).type(MediaType.TEXT_XML)
+                .method(entities.method, ClientResponse.class);
+
+        checkIfSuccessfull(clientResponse);
+
+        return parseAPIResult(clientResponse);
+    }
+
+    private String sendDefinitionRequest(Entities entities, String entityType,
+                                         String entityName) throws FalconCLIException {
+
+        ClientResponse clientResponse = service.path(entities.path)
+                .path(entityType).path(entityName).header(REMOTE_USER, USER)
+                .accept(entities.mimeType).type(MediaType.TEXT_XML)
+                .method(entities.method, ClientResponse.class);
+
+        checkIfSuccessfull(clientResponse);
+        return clientResponse.getEntity(String.class);
+    }
+
+    private String sendDependencyRequest(Entities entities, String entityType,
+                                         String entityName) throws FalconCLIException {
+
+        ClientResponse clientResponse = service.path(entities.path)
+                .path(entityType).path(entityName).header(REMOTE_USER, USER)
+                .accept(entities.mimeType).type(MediaType.TEXT_XML)
+                .method(entities.method, ClientResponse.class);
+
+        checkIfSuccessfull(clientResponse);
+
+        return parseEntityList(clientResponse);
+    }
+
+    private String sendListRequest(Entities entities, String entityType)
+            throws FalconCLIException {
+
+        ClientResponse clientResponse = service.path(entities.path)
+                .path(entityType).header(REMOTE_USER, USER)
+                .accept(entities.mimeType).type(MediaType.TEXT_XML)
+                .method(entities.method, ClientResponse.class);
+
+        checkIfSuccessfull(clientResponse);
+
+        return parseEntityList(clientResponse);
+    }
+
+    private String sendEntityRequestWithObject(Entities entities, String entityType,
+                                               Object requestObject, String colo) throws FalconCLIException {
+        WebResource resource = service.path(entities.path)
+                .path(entityType);
+        if (colo != null) {
+            resource = resource.queryParam("colo", colo);
+        }
+        ClientResponse clientResponse = resource.header(REMOTE_USER, USER)
+                .accept(entities.mimeType).type(MediaType.TEXT_XML)
+                .method(entities.method, ClientResponse.class, requestObject);
+
+        checkIfSuccessfull(clientResponse);
+
+        return parseAPIResult(clientResponse);
+    }
+
+    private String sendEntityRequestWithNameAndObject(Entities entities, String entityType, String entityName,
+                                                      Object requestObject) throws FalconCLIException {
+
+        ClientResponse clientResponse = service.path(entities.path)
+                .path(entityType).path(entityName).header(REMOTE_USER, USER)
+                .accept(entities.mimeType).type(MediaType.TEXT_XML)
+                .method(entities.method, ClientResponse.class, requestObject);
+
+        checkIfSuccessfull(clientResponse);
+
+        return parseAPIResult(clientResponse);
+    }
+
+    public InstancesResult instanceCmd(Instances instances, String type, String name,
+                                       String start, String end, String colo) {
         WebResource resource = service.path(instances.path).path(type).path(name);
         resource = resource.queryParam("start", start);
-        if(end != null)
+        if (end != null) {
             resource = resource.queryParam("end", end);
+        }
         resource = resource.queryParam("colo", colo);
-        
-        return resource.header(REMOTE_USER, USER).accept(instances.mimeType).method(instances.method, InstancesResult.class);
-	}
-	
-	private String sendInstanceRequest(Instances instances, String type,
-			String entity, String start, String end, InputStream props,
-			String runid, String colo) throws FalconCLIException {
-		WebResource resource = service.path(instances.path).path(type)
-				.path(entity);
-		if (start != null) {
-			resource = resource.queryParam("start", start);
-		}
-		if (end != null) {
-			resource = resource.queryParam("end", end);
-		}
-		if (runid != null) {
-			resource = resource.queryParam("runid", runid);
-		}
-		if (colo != null) {
-			resource = resource.queryParam("colo", colo);
-		}
-		
-
-		ClientResponse clientResponse = null;
-		if (props == null) {
-			clientResponse = resource.header(REMOTE_USER, USER)
-					.accept(instances.mimeType)
-					.method(instances.method, ClientResponse.class);
-		} else {
-			clientResponse = resource.header(REMOTE_USER, USER)
-					.accept(instances.mimeType)
-					.method(instances.method, ClientResponse.class, props);
-		}
-		checkIfSuccessfull(clientResponse);
-		
-		if(instances.name().equals("LOG"))
-			return parseProcessInstanceResultLogs(clientResponse, runid);
-		else
-			return parseProcessInstanceResult(clientResponse);
-
-	}
-	
-	private String sendAdminRequest(AdminOperations job) 
-			throws FalconCLIException {
-		
-		ClientResponse clientResponse = service.path(job.path)
-				.header(REMOTE_USER, USER).accept(job.mimeType)
-				.type(MediaType.TEXT_PLAIN).method(job.method, ClientResponse.class);
-		return parseStringResult(clientResponse);	
-	}
-	
-	private String parseAPIResult(ClientResponse clientResponse)
-			throws FalconCLIException {
-
-		APIResult result = clientResponse.getEntity(APIResult.class);
-		return result.getMessage();
-
-	}
-
-	private String parseEntityList(ClientResponse clientResponse)
-			throws FalconCLIException {
-
-		EntityList result = clientResponse.getEntity(EntityList.class);
-		if (result == null || result.getElements() == null) {
-			return "";
-		}
-		return result.toString();
-
-	}
-
-	private String parseStringResult(ClientResponse clientResponse)
-			throws FalconCLIException {
-
-		return clientResponse.getEntity(String.class);
-	}
-
-	private String parseProcessInstanceResult(ClientResponse clientResponse) {
-		InstancesResult result = clientResponse
-				.getEntity(InstancesResult.class);
-		StringBuffer sb = new StringBuffer();
-		String toAppend = null;
-		
-		sb.append("Consolidated Status: " + result.getStatus() + "\n");
-		
-		sb.append("\nInstances:\n");
-		sb.append("Instance\t\tCluster\t\tSourceCluster\t\tStatus\t\tStart\t\tEnd\t\tDetails\t\t\t\t\tLog\n");
-		sb.append("----------------------------------------------------------------------------------------------------------------------------------------\n");
-		if(result.getInstances() != null){
-			for (InstancesResult.Instance instance : result.getInstances()) {
-				
-				toAppend = instance.getInstance() != null  ? instance.getInstance() : "-";
-				sb.append(toAppend + "\t");
-				
-				toAppend = instance.getCluster() != null ? instance.getCluster() : "-";
-				sb.append(toAppend + "\t");
-				
-				toAppend = instance.getSourceCluster() != null ? instance.getSourceCluster() : "-";
-				sb.append(toAppend + "\t");	
-				
-				toAppend =  (instance.getStatus() != null ? instance.getStatus().toString() : "-");
-				sb.append(toAppend + "\t");	
-				
-				toAppend = instance.getStartTime() != null ? SchemaHelper.formatDateUTC(instance.getStartTime()) : "-";
-				sb.append(toAppend + "\t");	
-				
-				toAppend = instance.getEndTime() != null ? SchemaHelper.formatDateUTC(instance.getEndTime()) : "-";
-				sb.append(toAppend + "\t");
-				
-				toAppend = (instance.getDetails() != null && !instance.getDetails().equals("")) ? instance.getDetails() : "-";
-				sb.append(toAppend + "\t");
-				
-				toAppend = instance.getLogFile() != null ? instance.getLogFile() : "-";
-				sb.append(toAppend + "\n");	
-				
-			}
-		}
-		sb.append("\nAdditional Information:\n");
-		sb.append("Response: " + result.getMessage());
-		sb.append("Request Id: " + result.getRequestId() );
-		return sb.toString();
-	}
-	
-	private String parseProcessInstanceResultLogs(ClientResponse clientResponse, String runid) {
-		InstancesResult result = clientResponse
-				.getEntity(InstancesResult.class);
-		StringBuffer sb = new StringBuffer();
-		String toAppend = null;
-		
-		sb.append("Consolidated Status: " + result.getStatus() + "\n");
-		
-		sb.append("\nInstances:\n");
-		sb.append("Instance\t\tCluster\t\tSourceCluster\t\tStatus\t\tRunID\t\t\tLog\n");
-		sb.append("----------------------------------------------------------------------------------------------------\n");
-		if(result.getInstances() != null){
-			for (InstancesResult.Instance instance : result.getInstances()) {
-				
-				toAppend = (instance.getInstance() != null ) ? instance.getInstance() : "-";
-				sb.append(toAppend + "\t");
-				
-				toAppend = instance.getCluster() != null ? instance.getCluster() : "-";
-				sb.append(toAppend + "\t");
-				
-				toAppend = instance.getSourceCluster() != null ? instance.getSourceCluster() : "-";
-				sb.append(toAppend + "\t");	
-				
-				toAppend =  (instance.getStatus() != null ? instance.getStatus().toString() : "-");
-				sb.append(toAppend + "\t");	
-				
-				toAppend =  (runid != null ? runid : "latest");
-				sb.append(toAppend + "\t");	
-				
-				toAppend = instance.getLogFile() != null ? instance.getLogFile() : "-";
-				sb.append(toAppend + "\n");	
-				
-				
-				if (instance.actions != null) {
-					sb.append("actions:\n");
-					for (InstancesResult.InstanceAction action : instance.actions) {
-						sb.append("    ").append(action.getAction()+ "\t" + action.getStatus() + "\t" + action.getLogFile()).append("\n");
-					}
-				}
-			}
-		}
-		sb.append("\nAdditional Information:\n");
-		sb.append("Response: " + result.getMessage());
-		sb.append("Request Id: " + result.getRequestId() );
-		return sb.toString();
-	}
-	private void checkIfSuccessfull(ClientResponse clientResponse)
-			throws FalconCLIException {
-		if (clientResponse.getStatus() == Response.Status.BAD_REQUEST
-				.getStatusCode()) {
-			throw FalconCLIException.fromReponse(clientResponse);
-		}
-
-	}
 
+        return resource.header(REMOTE_USER, USER)
+                .accept(instances.mimeType)
+                .method(instances.method, InstancesResult.class);
+    }
+
+    private String sendInstanceRequest(Instances instances, String type,
+                                       String entity, String start, String end, InputStream props,
+                                       String runid, String colo) throws FalconCLIException {
+        WebResource resource = service.path(instances.path).path(type)
+                .path(entity);
+        if (start != null) {
+            resource = resource.queryParam("start", start);
+        }
+        if (end != null) {
+            resource = resource.queryParam("end", end);
+        }
+        if (runid != null) {
+            resource = resource.queryParam("runid", runid);
+        }
+        if (colo != null) {
+            resource = resource.queryParam("colo", colo);
+        }
+
+        ClientResponse clientResponse;
+        if (props == null) {
+            clientResponse = resource.header(REMOTE_USER, USER)
+                    .accept(instances.mimeType)
+                    .method(instances.method, ClientResponse.class);
+        } else {
+            clientResponse = resource.header(REMOTE_USER, USER)
+                    .accept(instances.mimeType)
+                    .method(instances.method, ClientResponse.class, props);
+        }
+        checkIfSuccessfull(clientResponse);
+
+        if (instances.name().equals("LOG")) {
+            return parseProcessInstanceResultLogs(clientResponse, runid);
+        } else {
+            return parseProcessInstanceResult(clientResponse);
+        }
+
+    }
+
+    private String sendAdminRequest(AdminOperations job)
+            throws FalconCLIException {
+
+        ClientResponse clientResponse = service.path(job.path)
+                .header(REMOTE_USER, USER).accept(job.mimeType)
+                .type(MediaType.TEXT_PLAIN).method(job.method, ClientResponse.class);
+        return parseStringResult(clientResponse);
+    }
+
+    private String parseAPIResult(ClientResponse clientResponse)
+            throws FalconCLIException {
+
+        APIResult result = clientResponse.getEntity(APIResult.class);
+        return result.getMessage();
+    }
+
+    private String parseEntityList(ClientResponse clientResponse)
+            throws FalconCLIException {
+
+        EntityList result = clientResponse.getEntity(EntityList.class);
+        if (result == null || result.getElements() == null) {
+            return "";
+        }
+        return result.toString();
+
+    }
+
+    private String parseStringResult(ClientResponse clientResponse)
+            throws FalconCLIException {
+
+        return clientResponse.getEntity(String.class);
+    }
+
+    private String parseProcessInstanceResult(ClientResponse clientResponse) {
+        InstancesResult result = clientResponse
+                .getEntity(InstancesResult.class);
+        StringBuilder sb = new StringBuilder();
+        String toAppend;
+
+        sb.append("Consolidated Status: ").append(result.getStatus()).append("\n");
+
+        sb.append("\nInstances:\n");
+        sb.append("Instance\t\tCluster\t\tSourceCluster\t\tStatus\t\tStart\t\tEnd\t\tDetails\t\t\t\t\tLog\n");
+        sb.append("-----------------------------------------------------------------------------------------------\n");
+        if (result.getInstances() != null) {
+            for (InstancesResult.Instance instance : result.getInstances()) {
+
+                toAppend = instance.getInstance() != null ? instance.getInstance() : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = instance.getCluster() != null ? instance.getCluster() : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = instance.getSourceCluster() != null ? instance.getSourceCluster() : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = (instance.getStatus() != null ? instance.getStatus().toString() : "-");
+                sb.append(toAppend).append("\t");
+
+                toAppend = instance.getStartTime() != null
+                        ? SchemaHelper.formatDateUTC(instance.getStartTime()) : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = instance.getEndTime() != null
+                        ? SchemaHelper.formatDateUTC(instance.getEndTime()) : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = (instance.getDetails() != null && !instance.getDetails().equals(""))
+                        ? instance.getDetails() : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = instance.getLogFile() != null ? instance.getLogFile() : "-";
+                sb.append(toAppend).append("\n");
+
+            }
+        }
+        sb.append("\nAdditional Information:\n");
+        sb.append("Response: ").append(result.getMessage());
+        sb.append("Request Id: ").append(result.getRequestId());
+        return sb.toString();
+    }
+
+    private String parseProcessInstanceResultLogs(ClientResponse clientResponse, String runid) {
+        InstancesResult result = clientResponse
+                .getEntity(InstancesResult.class);
+        StringBuilder sb = new StringBuilder();
+        String toAppend;
+
+        sb.append("Consolidated Status: ").append(result.getStatus()).append("\n");
+
+        sb.append("\nInstances:\n");
+        sb.append("Instance\t\tCluster\t\tSourceCluster\t\tStatus\t\tRunID\t\t\tLog\n");
+        sb.append("-----------------------------------------------------------------------------------------------\n");
+        if (result.getInstances() != null) {
+            for (InstancesResult.Instance instance : result.getInstances()) {
+
+                toAppend = (instance.getInstance() != null) ? instance.getInstance() : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = instance.getCluster() != null ? instance.getCluster() : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = instance.getSourceCluster() != null ? instance.getSourceCluster() : "-";
+                sb.append(toAppend).append("\t");
+
+                toAppend = (instance.getStatus() != null ? instance.getStatus().toString() : "-");
+                sb.append(toAppend).append("\t");
+
+                toAppend = (runid != null ? runid : "latest");
+                sb.append(toAppend).append("\t");
+
+                toAppend = instance.getLogFile() != null ? instance.getLogFile() : "-";
+                sb.append(toAppend).append("\n");
+
+                if (instance.actions != null) {
+                    sb.append("actions:\n");
+                    for (InstancesResult.InstanceAction action : instance.actions) {
+                        sb.append("    ").append(action.getAction()).append("\t");
+                        sb.append(action.getStatus()).append("\t").append(action.getLogFile()).append("\n");
+                    }
+                }
+            }
+        }
+        sb.append("\nAdditional Information:\n");
+        sb.append("Response: ").append(result.getMessage());
+        sb.append("Request Id: ").append(result.getRequestId());
+        return sb.toString();
+    }
+
+    private void checkIfSuccessfull(ClientResponse clientResponse)
+            throws FalconCLIException {
+        if (clientResponse.getStatus() == Response.Status.BAD_REQUEST
+                .getStatusCode()) {
+            throw FalconCLIException.fromReponse(clientResponse);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java b/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
index 8bf8341..cde7792 100644
--- a/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
+++ b/client/src/main/java/org/apache/falcon/entity/v0/DateValidator.java
@@ -20,62 +20,66 @@ package org.apache.falcon.entity.v0;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+/**
+ * Date utility class.
+ */
 public class DateValidator {
 
-    private static final String DATE_PATTERN = "(2\\d\\d\\d|19\\d\\d)-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])T([0-1][0-9]|2[0-3]):([0-5][0-9])Z";
-	private static final Pattern pattern = Pattern.compile(DATE_PATTERN);
+    private static final String DATE_PATTERN =
+            "(2\\d\\d\\d|19\\d\\d)-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])T([0-1][0-9]|2[0-3]):([0-5][0-9])Z";
+    private static final Pattern pattern = Pattern.compile(DATE_PATTERN);
+
+    private DateValidator() {
+    }
 
-	/**
-	 * Validate date format with regular expression
-	 * 
-	 * @param date
-	 *            date address for validation
-	 * @return true valid date fromat, false invalid date format
-	 */
-	public static boolean validate(final String date) {
+    /**
+     * Validate date format with regular expression.
+     *
+     * @param date date address for validation
+     * @return true valid date fromat, false invalid date format
+     */
+    public static boolean validate(final String date) {
 
-		Matcher matcher = pattern.matcher(date);
+        Matcher matcher = pattern.matcher(date);
 
-		if (matcher.matches()) {
+        if (matcher.matches()) {
 
-			matcher.reset();
+            matcher.reset();
 
-			if (matcher.find()) {
+            if (matcher.find()) {
 
-				int year = Integer.parseInt(matcher.group(1));
-				String month = matcher.group(2);
-				String day = matcher.group(3);
+                int year = Integer.parseInt(matcher.group(1));
+                String month = matcher.group(2);
+                String day = matcher.group(3);
 
-				if (day.equals("31")
-						&& (month.equals("4") || month.equals("6")
-								|| month.equals("9") || month.equals("11")
-								|| month.equals("04") || month.equals("06") || month
-									.equals("09"))) {
-					return false; // only 1,3,5,7,8,10,12 has 31 days
-				} else if (month.equals("2") || month.equals("02")) {
-					// leap year
-					if (year % 4 == 0) {
-						if (day.equals("30") || day.equals("31")) {
-							return false;
-						} else {
-							return true;
-						}
-					} else {
-						if (day.equals("29") || day.equals("30")
-								|| day.equals("31")) {
-							return false;
-						} else {
-							return true;
-						}
-					}
-				} else {
-					return true;
-				}
-			} else {
-				return false;
-			}
-		} else {
-			return false;
-		}
-	}
+                if (day.equals("31")
+                        && (month.equals("4") || month.equals("6")
+                        || month.equals("9") || month.equals("11")
+                        || month.equals("04") || month.equals("06") || month.equals("09"))) {
+                    return false; // only 1,3,5,7,8,10,12 has 31 days
+                } else if (month.equals("2") || month.equals("02")) {
+                    // leap year
+                    if (year % 4 == 0) {
+                        if (day.equals("30") || day.equals("31")) {
+                            return false;
+                        } else {
+                            return true;
+                        }
+                    } else {
+                        if (day.equals("29") || day.equals("30") || day.equals("31")) {
+                            return false;
+                        } else {
+                            return true;
+                        }
+                    }
+                } else {
+                    return true;
+                }
+            } else {
+                return false;
+            }
+        } else {
+            return false;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/entity/v0/Entity.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/Entity.java b/client/src/main/java/org/apache/falcon/entity/v0/Entity.java
index 3947e72..9fb926d 100644
--- a/client/src/main/java/org/apache/falcon/entity/v0/Entity.java
+++ b/client/src/main/java/org/apache/falcon/entity/v0/Entity.java
@@ -18,11 +18,10 @@
 
 package org.apache.falcon.entity.v0;
 
-import java.io.StringReader;
-import java.io.StringWriter;
-
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
+import java.io.StringReader;
+import java.io.StringWriter;
 
 public abstract class Entity {
     public abstract String getName();
@@ -38,18 +37,17 @@ public abstract class Entity {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o)
+        if (this == o) {
             return true;
-        if (o==null || !o.getClass().equals(this.getClass()))
+        }
+        if (o == null || !o.getClass().equals(this.getClass())) {
             return false;
+        }
 
         Entity entity = (Entity) o;
 
         String name = getName();
-        if (name != null ? !name.equals(entity.getName()) : entity.getName() != null)
-            return false;
-
-        return true;
+        return !(name != null ? !name.equals(entity.getName()) : entity.getName() != null);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java b/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java
index 752a92d..d33bdf0 100644
--- a/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java
+++ b/client/src/main/java/org/apache/falcon/entity/v0/EntityType.java
@@ -18,25 +18,20 @@
 
 package org.apache.falcon.entity.v0;
 
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.ValidationEvent;
-import javax.xml.bind.ValidationEventHandler;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-
 import org.apache.falcon.entity.v0.cluster.Cluster;
 import org.apache.falcon.entity.v0.feed.Feed;
 import org.apache.falcon.entity.v0.process.Process;
 
+import javax.xml.bind.*;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
 /**
  * Enum for types of entities in Falcon Process, Feed and Cluster
  */
 public enum EntityType {
-    FEED(Feed.class, "/feed-0.1.xsd", "name"), 
-    PROCESS(Process.class, "/process-0.1.xsd", "name"), 
+    FEED(Feed.class, "/feed-0.1.xsd", "name"),
+    PROCESS(Process.class, "/process-0.1.xsd", "name"),
     CLUSTER(Cluster.class, "/cluster-0.1.xsd", "name");
 
     //Fail unmarshalling of whole xml if unmarshalling of any element fails
@@ -46,7 +41,7 @@ public enum EntityType {
             return false;
         }
     }
-    
+
     private static final String NS = "http://www.w3.org/2001/XMLSchema";
 
     private final Class<? extends Entity> clazz;
@@ -62,7 +57,7 @@ public enum EntityType {
         this.schemaFile = schemaFile;
         try {
             jaxbContext = JAXBContext.newInstance(typeClass);
-            synchronized(this) {
+            synchronized (this) {
                 SchemaFactory schemaFactory = SchemaFactory.newInstance(NS);
                 schema = schemaFactory.newSchema(getClass().getResource(schemaFile));
             }
@@ -78,24 +73,24 @@ public enum EntityType {
     public String getSchemaFile() {
         return schemaFile;
     }
-    
+
     public Marshaller getMarshaller() throws JAXBException {
         Marshaller marshaller = jaxbContext.createMarshaller();
         marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
         return marshaller;
     }
-    
+
     public Unmarshaller getUnmarshaller() throws JAXBException {
         Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
         unmarshaller.setSchema(schema);
         unmarshaller.setEventHandler(new EventHandler());
         return unmarshaller;
     }
-    
+
     public boolean isSchedulable() {
         return this != EntityType.CLUSTER;
     }
-    
+
     public String[] getImmutableProperties() {
         return immutableProperties;
     }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java b/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java
index 300de7b..0d1be26 100644
--- a/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java
+++ b/client/src/main/java/org/apache/falcon/entity/v0/Frequency.java
@@ -25,7 +25,7 @@ import java.util.regex.Pattern;
 
 public class Frequency {
     private static final Pattern PATTERN = Pattern.compile("(minutes|hours|days|months)\\((\\d+)\\)");
-    
+
     public static enum TimeUnit {
         minutes(Calendar.MINUTE), hours(Calendar.HOUR), days(Calendar.DATE), months(Calendar.MONTH);
 
@@ -39,7 +39,7 @@ public class Frequency {
             return calendarUnit;
         }
     }
-    
+
     private TimeUnit timeUnit;
     private int frequency;
 
@@ -47,29 +47,30 @@ public class Frequency {
         this.frequency = freq;
         this.timeUnit = timeUnit;
     }
-    
+
     public Frequency(String strValue) {
         Matcher matcher = PATTERN.matcher(strValue);
-        if(!matcher.matches())
+        if (!matcher.matches()) {
             throw new IllegalArgumentException("Invalid frequency: " + strValue);
-        
+        }
+
         timeUnit = TimeUnit.valueOf(matcher.group(1));
         frequency = Integer.valueOf(matcher.group(2));
     }
-    
+
     public static Frequency fromString(String strValue) {
         return new Frequency(strValue);
     }
-    
+
     public static String toString(Frequency freq) {
         return freq.toString();
     }
-    
+
     @Override
     public String toString() {
         return timeUnit.name() + "(" + frequency + ")";
     }
-    
+
     public TimeUnit getTimeUnit() {
         return timeUnit;
     }
@@ -77,20 +78,23 @@ public class Frequency {
     public int getFrequency() {
         return frequency;
     }
-    
+
     @Override
     public boolean equals(Object obj) {
-        if(obj == null)
+        if (obj == null) {
             return false;
-        
-        if(!(obj instanceof Frequency))
+        }
+
+        if (!(obj instanceof Frequency)) {
             return false;
-        
+        }
+
         Frequency freq = (Frequency) obj;
-        if(this == freq)
+        if (this == freq) {
             return true;
-        
-        return this.getFrequency() == freq.getFrequency() && 
+        }
+
+        return this.getFrequency() == freq.getFrequency() &&
                 this.getTimeUnit() == freq.getTimeUnit();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java b/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
index d4e57f9..9baf827 100644
--- a/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
+++ b/client/src/main/java/org/apache/falcon/entity/v0/SchemaHelper.java
@@ -40,8 +40,9 @@ public class SchemaHelper {
     }
 
     public static Date parseDateUTC(String dateStr) {
-        if(!DateValidator.validate(dateStr))
+        if (!DateValidator.validate(dateStr)) {
             throw new IllegalArgumentException(dateStr + " is not a valid UTC string");
+        }
         try {
             return getDateFormat().parse(dateStr);
         } catch (ParseException e) {

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/resource/APIResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/APIResult.java b/client/src/main/java/org/apache/falcon/resource/APIResult.java
index bf4cad2..7b138bc 100644
--- a/client/src/main/java/org/apache/falcon/resource/APIResult.java
+++ b/client/src/main/java/org/apache/falcon/resource/APIResult.java
@@ -18,8 +18,7 @@
 
 package org.apache.falcon.resource;
 
-import java.io.StringWriter;
-import java.util.UUID;
+import org.apache.log4j.NDC;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -27,11 +26,10 @@ import javax.xml.bind.Marshaller;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlRootElement;
-
-import org.apache.log4j.NDC;
+import java.io.StringWriter;
+import java.util.UUID;
 
 /**
- * 
  * APIResult is the output returned by all the APIs; status-SUCCEEDED or FAILED
  * message- detailed message
  */

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/resource/EntityList.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/EntityList.java b/client/src/main/java/org/apache/falcon/resource/EntityList.java
index 79247e3..24771cc 100644
--- a/client/src/main/java/org/apache/falcon/resource/EntityList.java
+++ b/client/src/main/java/org/apache/falcon/resource/EntityList.java
@@ -29,7 +29,7 @@ import javax.xml.bind.annotation.XmlRootElement;
 @XmlAccessorType(XmlAccessType.FIELD)
 public class EntityList {
 
-    @XmlElement (name = "entity")
+    @XmlElement(name = "entity")
     private EntityElement[] elements;
 
     public static class EntityElement {
@@ -54,7 +54,8 @@ public class EntityList {
     }
 
     //For JAXB
-    public EntityList() {}
+    public EntityList() {
+    }
 
     public EntityList(Entity[] elements) {
         EntityElement[] items = new EntityElement[elements.length];

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/java/org/apache/falcon/resource/InstancesResult.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/falcon/resource/InstancesResult.java b/client/src/main/java/org/apache/falcon/resource/InstancesResult.java
index 7d64111..f790df1 100644
--- a/client/src/main/java/org/apache/falcon/resource/InstancesResult.java
+++ b/client/src/main/java/org/apache/falcon/resource/InstancesResult.java
@@ -18,36 +18,35 @@
 
 package org.apache.falcon.resource;
 
-import java.util.Date;
-
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
+import java.util.Date;
 
 @XmlRootElement
 public class InstancesResult extends APIResult {
-	public static enum WorkflowStatus {
-		WAITING, RUNNING, SUSPENDED, KILLED, FAILED, SUCCEEDED, ERROR
-	}
+    public static enum WorkflowStatus {
+        WAITING, RUNNING, SUSPENDED, KILLED, FAILED, SUCCEEDED, ERROR
+    }
 
-	@XmlElement
+    @XmlElement
     private Instance[] instances;
 
     private InstancesResult() { // for jaxb
         super();
     }
-    
+
     public InstancesResult(String message, Instance[] instances) {
-    	this(Status.SUCCEEDED, message, instances);
+        this(Status.SUCCEEDED, message, instances);
     }
 
     public InstancesResult(Status status, String message,
                            Instance[] instanceExes) {
-    	super(status, message);
-    	this.instances = instanceExes;
+        super(status, message);
+        this.instances = instanceExes;
     }
 
-	public InstancesResult(Status status, String message) {
-	    super(status, message);
+    public InstancesResult(Status status, String message) {
+        super(status, message);
     }
 
 
@@ -55,24 +54,24 @@ public class InstancesResult extends APIResult {
         return instances;
     }
 
-	public void setInstances(Instance[] instances) {
-		this.instances = instances;
-	}
-	
-	@XmlRootElement(name = "instance")
-	public static class Instance {
-		@XmlElement
-		public String instance;
+    public void setInstances(Instance[] instances) {
+        this.instances = instances;
+    }
 
-		@XmlElement
-		public WorkflowStatus status;
+    @XmlRootElement(name = "instance")
+    public static class Instance {
+        @XmlElement
+        public String instance;
 
         @XmlElement
-		public String logFile;
+        public WorkflowStatus status;
+
+        @XmlElement
+        public String logFile;
 
         @XmlElement
         public String cluster;
-        
+
         @XmlElement
         public String sourceCluster;
 
@@ -81,108 +80,108 @@ public class InstancesResult extends APIResult {
 
         @XmlElement
         public Date endTime;
-        
+
         @XmlElement
         public String details;
 
-		@XmlElement
-		public InstanceAction[] actions;
+        @XmlElement
+        public InstanceAction[] actions;
 
-		public Instance() {
-		}
+        public Instance() {
+        }
 
-		public Instance(String cluster, String instance, WorkflowStatus status) {
-			this.cluster = cluster;
-			this.instance = instance;
-			this.status = status;
-		}
+        public Instance(String cluster, String instance, WorkflowStatus status) {
+            this.cluster = cluster;
+            this.instance = instance;
+            this.status = status;
+        }
 
         public String getInstance() {
             return instance;
         }
-        
+
         public WorkflowStatus getStatus() {
             return status;
         }
-        
-		public String getLogFile() {
-			return logFile;
-		}
-
-		public String getCluster() {
-			return cluster;
-		}
-
-		public String getSourceCluster() {
-			return sourceCluster;
-		}
-
-		public Date getStartTime() {
-			return startTime;
-		}
-
-		public Date getEndTime() {
-			return endTime;
-		}
-
-		public InstanceAction[] getActions() {
-			return actions;
-		}
-		
-		public String getDetails() {
-			return details;
-		}
-
-
-		@Override
-		public String toString() {
-			return "{instance:"
-					+ this.instance
-					+ ", status:"
-					+ this.status
-					+ (this.logFile == null ? "" : ", log:" + this.logFile)
-					+ (this.sourceCluster == null ? "" : ", source-cluster:"
-							+ this.sourceCluster)
-					+ (this.cluster == null ? "" : ", cluster:"
-							+ this.cluster) + "}";
-		}
+
+        public String getLogFile() {
+            return logFile;
+        }
+
+        public String getCluster() {
+            return cluster;
+        }
+
+        public String getSourceCluster() {
+            return sourceCluster;
+        }
+
+        public Date getStartTime() {
+            return startTime;
+        }
+
+        public Date getEndTime() {
+            return endTime;
+        }
+
+        public InstanceAction[] getActions() {
+            return actions;
+        }
+
+        public String getDetails() {
+            return details;
+        }
+
+
+        @Override
+        public String toString() {
+            return "{instance:"
+                    + this.instance
+                    + ", status:"
+                    + this.status
+                    + (this.logFile == null ? "" : ", log:" + this.logFile)
+                    + (this.sourceCluster == null ? "" : ", source-cluster:"
+                    + this.sourceCluster)
+                    + (this.cluster == null ? "" : ", cluster:"
+                    + this.cluster) + "}";
+        }
+    }
+
+    @XmlRootElement(name = "actions")
+    public static class InstanceAction {
+        @XmlElement
+        public String action;
+        @XmlElement
+        public String status;
+        @XmlElement
+        public String logFile;
+
+        public InstanceAction() {
+        }
+
+        public InstanceAction(String action, String status, String logFile) {
+            this.action = action;
+            this.status = status;
+            this.logFile = logFile;
+        }
+
+        public String getAction() {
+            return action;
+        }
+
+        public String getStatus() {
+            return status;
+        }
+
+        public String getLogFile() {
+            return logFile;
+        }
+
+        @Override
+        public String toString() {
+            return "{action:" + this.action + ", status:" + this.status
+                    + (this.logFile == null ? "" : ", log:" + this.logFile)
+                    + "}";
+        }
     }
-    
-	@XmlRootElement(name = "actions")
-	public static class InstanceAction {
-		@XmlElement
-		public String action;
-		@XmlElement
-		public String status;
-		@XmlElement
-		public String logFile;
-
-		public InstanceAction() {
-		}
-
-		public InstanceAction(String action, String status, String logFile) {
-			this.action = action;
-			this.status = status;
-			this.logFile = logFile;
-		}
-
-		public String getAction() {
-			return action;
-		}
-
-		public String getStatus() {
-			return status;
-		}
-
-		public String getLogFile() {
-			return logFile;
-		}
-
-		@Override
-		public String toString() {
-			return "{action:" + this.action + ", status:" + this.status
-					+ (this.logFile == null ? "" : ", log:" + this.logFile)
-					+ "}";
-		}
-	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/a4d79f0c/client/src/main/resources/cluster-0.1.xsd
----------------------------------------------------------------------
diff --git a/client/src/main/resources/cluster-0.1.xsd b/client/src/main/resources/cluster-0.1.xsd
index a7e6245..b8643a7 100644
--- a/client/src/main/resources/cluster-0.1.xsd
+++ b/client/src/main/resources/cluster-0.1.xsd
@@ -16,9 +16,9 @@
   See the License for the specific language governing permissions and
   limitations under the License.
   -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" 
-            targetNamespace="uri:falcon:cluster:0.1" xmlns="uri:falcon:cluster:0.1"
-            xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified"
+           targetNamespace="uri:falcon:cluster:0.1" xmlns="uri:falcon:cluster:0.1"
+           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1">
     <xs:annotation>
         <xs:documentation>
             Licensed to the Apache Software Foundation (ASF) under one or more
@@ -40,7 +40,7 @@
         </xs:documentation>
         <xs:appinfo>
             <jaxb:schemaBindings>
-                <jaxb:package name="org.apache.falcon.entity.v0.cluster" />
+                <jaxb:package name="org.apache.falcon.entity.v0.cluster"/>
             </jaxb:schemaBindings>
         </xs:appinfo>
     </xs:annotation>
@@ -57,13 +57,13 @@
             </xs:documentation>
         </xs:annotation>
         <xs:sequence>
-            <xs:element type="interfaces" name="interfaces" />
-            <xs:element type="locations" name="locations" />
-            <xs:element type="properties" name="properties" minOccurs="0" />
+            <xs:element type="interfaces" name="interfaces"/>
+            <xs:element type="locations" name="locations"/>
+            <xs:element type="properties" name="properties" minOccurs="0"/>
         </xs:sequence>
-        <xs:attribute type="IDENTIFIER" name="name" use="required" />
-        <xs:attribute type="xs:string" name="description" />
-        <xs:attribute type="xs:string" name="colo" use="required" />
+        <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+        <xs:attribute type="xs:string" name="description"/>
+        <xs:attribute type="xs:string" name="colo" use="required"/>
     </xs:complexType>
     <xs:complexType name="locations">
         <xs:annotation>
@@ -71,7 +71,7 @@
             </xs:documentation>
         </xs:annotation>
         <xs:sequence>
-            <xs:element type="location" name="location" maxOccurs="unbounded" minOccurs="1" />
+            <xs:element type="location" name="location" maxOccurs="unbounded" minOccurs="1"/>
         </xs:sequence>
     </xs:complexType>
     <xs:complexType name="property">
@@ -84,8 +84,8 @@
                 should be defined here.
             </xs:documentation>
         </xs:annotation>
-        <xs:attribute type="xs:string" name="name" use="required" />
-        <xs:attribute type="xs:string" name="value" use="required" />
+        <xs:attribute type="xs:string" name="name" use="required"/>
+        <xs:attribute type="xs:string" name="value" use="required"/>
     </xs:complexType>
     <xs:complexType name="interface">
         <xs:annotation>
@@ -99,9 +99,9 @@
                 version: The current runtime version of each interface.
             </xs:documentation>
         </xs:annotation>
-        <xs:attribute type="interfacetype" name="type" use="required" />
-        <xs:attribute type="xs:string" name="endpoint" use="required" />
-        <xs:attribute type="xs:string" name="version" use="required" />
+        <xs:attribute type="interfacetype" name="type" use="required"/>
+        <xs:attribute type="xs:string" name="endpoint" use="required"/>
+        <xs:attribute type="xs:string" name="version" use="required"/>
     </xs:complexType>
     <xs:complexType name="properties">
         <xs:annotation>
@@ -110,7 +110,7 @@
             </xs:documentation>
         </xs:annotation>
         <xs:sequence>
-            <xs:element type="property" name="property" maxOccurs="unbounded" minOccurs="0" />
+            <xs:element type="property" name="property" maxOccurs="unbounded" minOccurs="0"/>
         </xs:sequence>
     </xs:complexType>
     <xs:complexType name="location">
@@ -126,8 +126,8 @@
                 locations.
             </xs:documentation>
         </xs:annotation>
-        <xs:attribute type="IDENTIFIER" name="name" use="required" />
-        <xs:attribute type="xs:string" name="path" use="required" />
+        <xs:attribute type="IDENTIFIER" name="name" use="required"/>
+        <xs:attribute type="xs:string" name="path" use="required"/>
     </xs:complexType>
     <xs:complexType name="interfaces">
         <xs:annotation>
@@ -136,7 +136,7 @@
             </xs:documentation>
         </xs:annotation>
         <xs:sequence>
-            <xs:element type="interface" name="interface" maxOccurs="unbounded" minOccurs="3" />
+            <xs:element type="interface" name="interface" maxOccurs="unbounded" minOccurs="3"/>
         </xs:sequence>
     </xs:complexType>
     <xs:simpleType name="interfacetype">
@@ -158,17 +158,17 @@
             </xs:documentation>
         </xs:annotation>
         <xs:restriction base="xs:string">
-            <xs:enumeration value="readonly" />
-            <xs:enumeration value="write" />
-            <xs:enumeration value="execute" />
-            <xs:enumeration value="workflow" />
-            <xs:enumeration value="messaging" />
-            <xs:enumeration value="registry" />
+            <xs:enumeration value="readonly"/>
+            <xs:enumeration value="write"/>
+            <xs:enumeration value="execute"/>
+            <xs:enumeration value="workflow"/>
+            <xs:enumeration value="messaging"/>
+            <xs:enumeration value="registry"/>
         </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="IDENTIFIER">
         <xs:restriction base="xs:string">
-            <xs:pattern value="(([a-zA-Z]([\-a-zA-Z0-9])*){1,39})" />
+            <xs:pattern value="(([a-zA-Z]([\-a-zA-Z0-9])*){1,39})"/>
         </xs:restriction>
     </xs:simpleType>
 </xs:schema>