Repository: falcon Updated Branches: refs/heads/master 60e2f68b8 -> b2526d8f4
http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/client/src/main/java/org/apache/falcon/client/AbstractFalconClient.java ---------------------------------------------------------------------- diff --git a/client/src/main/java/org/apache/falcon/client/AbstractFalconClient.java b/client/src/main/java/org/apache/falcon/client/AbstractFalconClient.java index 4f86d9b..b3fd3ae 100644 --- a/client/src/main/java/org/apache/falcon/client/AbstractFalconClient.java +++ b/client/src/main/java/org/apache/falcon/client/AbstractFalconClient.java @@ -24,9 +24,11 @@ import org.apache.falcon.resource.APIResult; import org.apache.falcon.resource.EntityList; import org.apache.falcon.resource.EntitySummaryResult; import org.apache.falcon.resource.FeedInstanceResult; +import org.apache.falcon.resource.FeedLookupResult; import org.apache.falcon.resource.InstanceDependencyResult; import org.apache.falcon.resource.InstancesResult; import org.apache.falcon.resource.InstancesSummaryResult; +import org.apache.falcon.resource.SchedulableEntityInstanceResult; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -52,10 +54,9 @@ public abstract class AbstractFalconClient { * @param entityType Entity type. Valid options are cluster, feed or process. * @param filePath Path for the entity definition * @return - * @throws FalconCLIException + * @throws IOException */ - public abstract APIResult submit(String entityType, String filePath, String doAsUser) throws FalconCLIException, - IOException; + public abstract APIResult submit(String entityType, String filePath, String doAsUser); /** * Schedules an submitted process entity immediately. @@ -63,10 +64,9 @@ public abstract class AbstractFalconClient { * @param entityName Name of the entity. * @param colo Cluster name. * @return - * @throws FalconCLIException */ public abstract APIResult schedule(EntityType entityType, String entityName, String colo, Boolean skipDryRun, - String doAsuser, String properties) throws FalconCLIException; + String doAsuser, String properties); /** * Delete the specified entity. @@ -74,10 +74,9 @@ public abstract class AbstractFalconClient { * @param entityName Name of the entity. * @param doAsUser Proxy User. * @return - * @throws FalconCLIException */ public abstract APIResult delete(EntityType entityType, String entityName, - String doAsUser) throws FalconCLIException; + String doAsUser); /** * Validates the submitted entity. @@ -86,10 +85,9 @@ public abstract class AbstractFalconClient { * @param skipDryRun Dry run. * @param doAsUser Proxy User. * @return - * @throws FalconCLIException - */ + \ */ public abstract APIResult validate(String entityType, String filePath, Boolean skipDryRun, - String doAsUser) throws FalconCLIException; + String doAsUser); /** * Updates the submitted entity. @@ -99,10 +97,9 @@ public abstract class AbstractFalconClient { * @param skipDryRun Dry run. * @param doAsUser Proxy User. * @return - * @throws FalconCLIException */ public abstract APIResult update(String entityType, String entityName, String filePath, - Boolean skipDryRun, String doAsUser) throws FalconCLIException; + Boolean skipDryRun, String doAsUser); /** * Get definition of the entity. @@ -110,11 +107,9 @@ public abstract class AbstractFalconClient { * @param entityName Name of the entity. * @param doAsUser Proxy user. * @return - * @throws FalconCLIException */ public abstract Entity getDefinition(String entityType, String entityName, - String doAsUser) throws FalconCLIException; - + String doAsUser); /** @@ -133,11 +128,10 @@ public abstract class AbstractFalconClient { * @param doAsUser proxy user * @param allAttempts To get the instances corresponding to each run-id * @return - * @throws FalconCLIException */ public abstract InstancesResult getStatusOfInstances(String type, String entity, String start, String end, String - colo, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, Integer offset, Integer - numResults, String doAsUser, Boolean allAttempts) throws FalconCLIException; + colo, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, Integer offset, Integer + numResults, String doAsUser, Boolean allAttempts); /** * Suspend an entity. @@ -146,10 +140,8 @@ public abstract class AbstractFalconClient { * @param colo Colo on which the query should be run. * @param doAsUser proxy user * @return Status of the entity. - * @throws FalconCLIException */ - public abstract APIResult suspend(EntityType entityType, String entityName, String colo, String doAsUser) throws - FalconCLIException; + public abstract APIResult suspend(EntityType entityType, String entityName, String colo, String doAsUser); /** * Resume a supended entity. @@ -158,10 +150,8 @@ public abstract class AbstractFalconClient { * @param colo Colo on which the query should be run. * @param doAsUser proxy user * @return Result of the resume command. - * @throws FalconCLIException */ - public abstract APIResult resume(EntityType entityType, String entityName, String colo, String doAsUser) throws - FalconCLIException; + public abstract APIResult resume(EntityType entityType, String entityName, String colo, String doAsUser); /** * Get status of the entity. @@ -171,10 +161,9 @@ public abstract class AbstractFalconClient { * @param doAsUser proxy user * @param showScheduler whether the call should return the scheduler on which the entity is scheduled. * @return Status of the entity. - * @throws FalconCLIException */ public abstract APIResult getStatus(EntityType entityType, String entityName, String colo, String doAsUser, - boolean showScheduler) throws FalconCLIException; + boolean showScheduler); /** * Submits and schedules an entity. @@ -185,7 +174,7 @@ public abstract class AbstractFalconClient { * @return Result of the submit and schedule command. */ public abstract APIResult submitAndSchedule(String entityType, String filePath, Boolean skipDryRun, String doAsUser, - String properties) throws FalconCLIException; + String properties); /** * @@ -221,8 +210,8 @@ public abstract class AbstractFalconClient { * @return Total number of results and a list of entities. */ public abstract EntityList getEntityList(String entityType, String fields, String nameSubsequence, String - tagKeywords, String filterBy, String filterTags, String orderBy, String sortOrder, Integer offset, Integer - numResults, String doAsUser) throws FalconCLIException; + tagKeywords, String filterBy, String filterTags, String orderBy, String sortOrder, Integer offset, Integer + numResults, String doAsUser); /** * Given an EntityType and cluster, get list of entities along with summary of N recent instances of each entity. @@ -254,9 +243,8 @@ public abstract class AbstractFalconClient { */ public abstract EntitySummaryResult getEntitySummary(String entityType, String cluster, String start, String end, String fields, String filterBy, String filterTags, String - orderBy, String sortOrder, Integer offset, Integer - numResults, Integer numInstances, String doAsUser) throws - FalconCLIException; + orderBy, String sortOrder, Integer offset, Integer + numResults, Integer numInstances, String doAsUser); /** * Force updates the entity. @@ -268,7 +256,7 @@ public abstract class AbstractFalconClient { * @return Result of the validation. */ public abstract APIResult touch(String entityType, String entityName, String colo, Boolean skipDryRun, - String doAsUser) throws FalconCLIException; + String doAsUser); /** * Kill currently running instance(s) of an entity. @@ -281,11 +269,11 @@ public abstract class AbstractFalconClient { * process. * @param doAsUser proxy user * @return Result of the kill operation. + * @throws UnsupportedEncodingException */ public abstract InstancesResult killInstances(String type, String entity, String start, String end, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, - UnsupportedEncodingException; + String doAsUser) throws UnsupportedEncodingException; /** * Suspend instances of an entity. @@ -298,10 +286,11 @@ public abstract class AbstractFalconClient { * process. * @param doAsUser proxy user * @return Results of the suspend command. + * @throws UnsupportedEncodingException */ public abstract InstancesResult suspendInstances(String type, String entity, String start, String end, String colo, - String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, UnsupportedEncodingException; + String clusters, String sourceClusters, List<LifeCycle> lifeCycles, + String doAsUser) throws UnsupportedEncodingException; /** * Resume suspended instances of an entity. @@ -314,10 +303,11 @@ public abstract class AbstractFalconClient { * process. * @param doAsUser proxy user * @return Results of the resume command. + * @throws UnsupportedEncodingException */ public abstract InstancesResult resumeInstances(String type, String entity, String start, String end, String colo, - String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, UnsupportedEncodingException; + String clusters, String sourceClusters, List<LifeCycle> lifeCycles, + String doAsUser) throws UnsupportedEncodingException; /** * Rerun instances of an entity. On issuing a rerun, by default the execution resumes from the last failed node in @@ -332,11 +322,12 @@ public abstract class AbstractFalconClient { * @param isForced <optional param> can be used to forcefully rerun the entire instance. * @param doAsUser proxy user * @return Results of the rerun command. + * @throws IOException */ public abstract InstancesResult rerunInstances(String type, String entity, String start, String end, String filePath, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, Boolean isForced, - String doAsUser) throws FalconCLIException, IOException; + String doAsUser) throws IOException; /** * Get summary of instance/instances of an entity. @@ -363,7 +354,7 @@ public abstract class AbstractFalconClient { public abstract InstancesSummaryResult getSummaryOfInstances(String type, String entity, String start, String end, String colo, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, - String doAsUser) throws FalconCLIException; + String doAsUser); /** * Get falcon feed instance availability. @@ -378,7 +369,7 @@ public abstract class AbstractFalconClient { * @return Feed instance availability status */ public abstract FeedInstanceResult getFeedListing(String type, String entity, String start, String end, String colo, - String doAsUser) throws FalconCLIException; + String doAsUser); /** * Get log of a specific instance of an entity. @@ -408,8 +399,7 @@ public abstract class AbstractFalconClient { public abstract InstancesResult getLogsOfInstances(String type, String entity, String start, String end, String colo, String runId, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, - Integer offset, Integer numResults, String doAsUser) throws - FalconCLIException; + Integer offset, Integer numResults, String doAsUser); //RESUME CHECKSTYLE CHECK ParameterNumberCheck @@ -423,10 +413,11 @@ public abstract class AbstractFalconClient { * Execution(default). * @param doAsUser proxy user * @return List of instances currently running. + * @throws UnsupportedEncodingException */ public abstract InstancesResult getParamsOfInstance(String type, String entity, String start, String colo, List<LifeCycle> lifeCycles, String doAsUser) throws - FalconCLIException, UnsupportedEncodingException; + UnsupportedEncodingException; /** * Get dependent instances for a particular instance. @@ -437,17 +428,16 @@ public abstract class AbstractFalconClient { * @return Dependent instances for the specified instance */ public abstract InstanceDependencyResult getInstanceDependencies(String entityType, String entityName, - String instanceTime, String colo) throws - FalconCLIException; + String instanceTime, String colo); /** * Get version of the falcon server. * @return Version of the server. */ - public abstract String getVersion(String doAsUser) throws FalconCLIException; + public abstract String getVersion(String doAsUser); protected InputStream getServletInputStream(String clusters, String sourceClusters, String properties) throws - FalconCLIException, UnsupportedEncodingException { + UnsupportedEncodingException { InputStream stream; StringBuilder buffer = new StringBuilder(); @@ -463,4 +453,11 @@ public abstract class AbstractFalconClient { stream = new ByteArrayInputStream(buffer.toString().getBytes()); return (buffer.length() == 0) ? null : stream; } + + public abstract SchedulableEntityInstanceResult getFeedSlaMissPendingAlerts(String entityType, String entityName, + String start, String end, String colo); + + public abstract FeedLookupResult reverseLookUp(String entityType, String path, String doAs); + + public abstract EntityList getDependency(String entityType, String entityName, String doAs); } http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/client/src/main/java/org/apache/falcon/client/FalconCLIException.java ---------------------------------------------------------------------- diff --git a/client/src/main/java/org/apache/falcon/client/FalconCLIException.java b/client/src/main/java/org/apache/falcon/client/FalconCLIException.java index bd36243..de53595 100644 --- a/client/src/main/java/org/apache/falcon/client/FalconCLIException.java +++ b/client/src/main/java/org/apache/falcon/client/FalconCLIException.java @@ -26,8 +26,13 @@ import java.io.InputStream; /** * Exception thrown by FalconClient. + * This was converted to RuntimeException in FALCON-1609. + * Reasons: + * Ultimate goal of switching from current CLI to spring shell based CLI + * Spring Shell doesn't work well with unchecked Exceptions + * The exception currently only gets surfaced in CLI, and in code existing catch clauses will still work. */ -public class FalconCLIException extends Exception { +public class FalconCLIException extends RuntimeException{ private static final int MB = 1024 * 1024; http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/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 1014d64..371828f 100644 --- a/client/src/main/java/org/apache/falcon/client/FalconClient.java +++ b/client/src/main/java/org/apache/falcon/client/FalconClient.java @@ -131,7 +131,6 @@ public class FalconClient extends AbstractFalconClient { private static final String PROPERTIES_SUFFIX = ".properties"; public static final HostnameVerifier ALL_TRUSTING_HOSTNAME_VERIFIER = new HostnameVerifier() { - @Override public boolean verify(String hostname, SSLSession sslSession) { return true; } @@ -150,9 +149,9 @@ public class FalconClient extends AbstractFalconClient { * Create a Falcon client instance. * * @param falconUrl of the server to which client interacts - * @throws FalconCLIException - If unable to initialize SSL Props + * @ - If unable to initialize SSL Props */ - public FalconClient(String falconUrl) throws FalconCLIException { + public FalconClient(String falconUrl) { this(falconUrl, new Properties()); } @@ -161,9 +160,9 @@ public class FalconClient extends AbstractFalconClient { * * @param falconUrl of the server to which client interacts * @param properties client properties - * @throws FalconCLIException - If unable to initialize SSL Props + * @ - If unable to initialize SSL Props */ - public FalconClient(String falconUrl, Properties properties) throws FalconCLIException { + public FalconClient(String falconUrl, Properties properties) { try { String baseUrl = notEmpty(falconUrl, "FalconUrl"); if (!baseUrl.endsWith("/")) { @@ -212,7 +211,7 @@ public class FalconClient extends AbstractFalconClient { this.debugMode = debugMode; } - public static AuthenticatedURL.Token getToken(String baseUrl) throws FalconCLIException { + public static AuthenticatedURL.Token getToken(String baseUrl) { AuthenticatedURL.Token currentToken = new AuthenticatedURL.Token(); try { URL url = new URL(baseUrl + AUTH_URL); @@ -373,7 +372,7 @@ public class FalconClient extends AbstractFalconClient { } public APIResult schedule(EntityType entityType, String entityName, String colo, - Boolean skipDryRun, String doAsUser, String properties) throws FalconCLIException { + Boolean skipDryRun, String doAsUser, String properties) { String type = entityType.toString().toLowerCase(); ClientResponse clientResponse = new ResourceBuilder().path(Entities.SCHEDULE.path, type, entityName) .addQueryParam(COLO, colo).addQueryParam(SKIP_DRYRUN, skipDryRun) @@ -381,31 +380,28 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public APIResult suspend(EntityType entityType, String entityName, String colo, String doAsUser) - throws FalconCLIException { + public APIResult suspend(EntityType entityType, String entityName, String colo, String doAsUser) { String type = entityType.toString().toLowerCase(); ClientResponse clientResponse = new ResourceBuilder().path(Entities.SUSPEND.path, type, entityName) .addQueryParam(COLO, colo).addQueryParam(DO_AS_OPT, doAsUser).call(Entities.SUSPEND); return getResponse(APIResult.class, clientResponse); } - public APIResult resume(EntityType entityType, String entityName, String colo, String doAsUser) - throws FalconCLIException { + public APIResult resume(EntityType entityType, String entityName, String colo, String doAsUser) { String type = entityType.toString().toLowerCase(); ClientResponse clientResponse = new ResourceBuilder().path(Entities.RESUME.path, type, entityName) .addQueryParam(COLO, colo).addQueryParam(DO_AS_OPT, doAsUser).call(Entities.RESUME); return getResponse(APIResult.class, clientResponse); } - public APIResult delete(EntityType entityType, String entityName, String doAsUser) throws FalconCLIException { + public APIResult delete(EntityType entityType, String entityName, String doAsUser) { String type = entityType.toString().toLowerCase(); ClientResponse clientResponse = new ResourceBuilder().path(Entities.DELETE.path, type, entityName) .addQueryParam(DO_AS_OPT, doAsUser).call(Entities.DELETE); return getResponse(APIResult.class, clientResponse); } - public APIResult validate(String entityType, String filePath, Boolean skipDryRun, String doAsUser) - throws FalconCLIException { + public APIResult validate(String entityType, String filePath, Boolean skipDryRun, String doAsUser) { InputStream entityStream = getServletInputStream(filePath); ClientResponse clientResponse = new ResourceBuilder().path(Entities.VALIDATE.path, entityType) .addQueryParam(SKIP_DRYRUN, skipDryRun).addQueryParam(DO_AS_OPT, doAsUser) @@ -413,8 +409,7 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public APIResult submit(String entityType, String filePath, String doAsUser) - throws FalconCLIException { + public APIResult submit(String entityType, String filePath, String doAsUser) { InputStream entityStream = getServletInputStream(filePath); ClientResponse clientResponse = new ResourceBuilder().path(Entities.SUBMIT.path, entityType) .addQueryParam(DO_AS_OPT, doAsUser).call(Entities.SUBMIT, entityStream); @@ -422,7 +417,7 @@ public class FalconClient extends AbstractFalconClient { } public APIResult update(String entityType, String entityName, String filePath, - Boolean skipDryRun, String doAsUser) throws FalconCLIException { + Boolean skipDryRun, String doAsUser) { InputStream entityStream = getServletInputStream(filePath); Entities operation = Entities.UPDATE; ClientResponse clientResponse = new ResourceBuilder().path(operation.path, entityType, entityName) @@ -432,7 +427,7 @@ public class FalconClient extends AbstractFalconClient { } public APIResult updateClusterDependents(String clusterName, Boolean skipDryRun, - String doAsUser) throws FalconCLIException { + String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.UPDATEDEPENDENTS.path, clusterName) .addQueryParam(SKIP_DRYRUN, skipDryRun).addQueryParam(DO_AS_OPT, doAsUser) .call(Entities.UPDATEDEPENDENTS); @@ -441,7 +436,7 @@ public class FalconClient extends AbstractFalconClient { @Override public APIResult submitAndSchedule(String entityType, String filePath, Boolean skipDryRun, - String doAsUser, String properties) throws FalconCLIException { + String doAsUser, String properties) { InputStream entityStream = getServletInputStream(filePath); ClientResponse clientResponse = new ResourceBuilder().path(Entities.SUBMITANDSCHEDULE.path, entityType) .addQueryParam(SKIP_DRYRUN, skipDryRun).addQueryParam(DO_AS_OPT, doAsUser) @@ -450,7 +445,7 @@ public class FalconClient extends AbstractFalconClient { } public APIResult getStatus(EntityType entityType, String entityName, String colo, - String doAsUser, boolean showScheduler) throws FalconCLIException { + String doAsUser, boolean showScheduler) { String type = entityType.toString().toLowerCase(); ClientResponse clientResponse = new ResourceBuilder().path(Entities.STATUS.path, type, entityName) .addQueryParam(COLO, colo).addQueryParam(DO_AS_OPT, doAsUser) @@ -459,15 +454,14 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public Entity getDefinition(String entityType, String entityName, String doAsUser) throws FalconCLIException { + public Entity getDefinition(String entityType, String entityName, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.DEFINITION.path, entityType, entityName) .call(Entities.DEFINITION); String entity = getResponseAsString(clientResponse); return Entity.fromString(EntityType.getEnum(entityType), entity); } - public EntityList getDependency(String entityType, String entityName, String doAsUser) - throws FalconCLIException { + public EntityList getDependency(String entityType, String entityName, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.DEPENDENCY.path, entityType, entityName) .addQueryParam(DO_AS_OPT, doAsUser).call(Entities.DEPENDENCY); @@ -485,7 +479,7 @@ public class FalconClient extends AbstractFalconClient { //SUSPEND CHECKSTYLE CHECK ParameterNumberCheck public SchedulableEntityInstanceResult getFeedSlaMissPendingAlerts(String entityType, String entityName, - String startTime, String endTime, String colo) throws FalconCLIException { + String startTime, String endTime, String colo) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.SLA.path, entityType) .addQueryParam(START, startTime).addQueryParam(COLO, colo).addQueryParam(END, endTime) .addQueryParam(ENTITY_NAME, entityName).call(Entities.SLA); @@ -493,7 +487,7 @@ public class FalconClient extends AbstractFalconClient { } public TriageResult triage(String entityType, String entityName, String instanceTime, - String colo) throws FalconCLIException { + String colo) { ClientResponse clientResponse = new ResourceBuilder().path(Instances.TRIAGE.path, entityType, entityName) .addQueryParam(START, instanceTime).addQueryParam(COLO, colo).call(Instances.TRIAGE); return getResponse(TriageResult.class, clientResponse); @@ -502,7 +496,7 @@ public class FalconClient extends AbstractFalconClient { @Override public EntityList getEntityList(String entityType, String fields, String nameSubsequence, String tagKeywords, String filterBy, String filterTags, String orderBy, String sortOrder, - Integer offset, Integer numResults, String doAsUser) throws FalconCLIException { + Integer offset, Integer numResults, String doAsUser) { Entities operation = Entities.LIST; ClientResponse clientResponse = new ResourceBuilder().path(operation.path, entityType) .addQueryParam(DO_AS_OPT, doAsUser).addQueryParam(NUM_RESULTS, numResults) @@ -526,7 +520,7 @@ public class FalconClient extends AbstractFalconClient { public EntitySummaryResult getEntitySummary(String entityType, String cluster, String start, String end, String fields, String filterBy, String filterTags, String orderBy, String sortOrder, Integer offset, Integer numResults, - Integer numInstances, String doAsUser) throws FalconCLIException { + Integer numInstances, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Entities.SUMMARY.path, entityType) .addQueryParam(CLUSTER, cluster).addQueryParam(START, start).addQueryParam(END, end) .addQueryParam(SORT_ORDER, sortOrder).addQueryParam(ORDER_BY, orderBy) @@ -539,7 +533,7 @@ public class FalconClient extends AbstractFalconClient { @Override public APIResult touch(String entityType, String entityName, String colo, - Boolean skipDryRun, String doAsUser) throws FalconCLIException { + Boolean skipDryRun, String doAsUser) { Entities operation = Entities.TOUCH; ClientResponse clientResponse = new ResourceBuilder().path(operation.path, entityType, entityName) .addQueryParam(COLO, colo).addQueryParam(SKIP_DRYRUN, skipDryRun) @@ -549,7 +543,7 @@ public class FalconClient extends AbstractFalconClient { public InstancesResult getRunningInstances(String type, String entity, String colo, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, - Integer offset, Integer numResults, String doAsUser) throws FalconCLIException { + Integer offset, Integer numResults, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Instances.RUNNING.path, type, entity) .addQueryParam(FILTER_BY, filterBy).addQueryParam(ORDER_BY, orderBy) .addQueryParam(SORT_ORDER, sortOrder).addQueryParam(OFFSET, offset) @@ -562,7 +556,7 @@ public class FalconClient extends AbstractFalconClient { public InstancesResult getStatusOfInstances(String type, String entity, String start, String end, String colo, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, Integer offset, Integer numResults, - String doAsUser, Boolean allAttempts) throws FalconCLIException { + String doAsUser, Boolean allAttempts) { ClientResponse clientResponse = new ResourceBuilder().path(Instances.STATUS.path, type, entity) .addQueryParam(START, start).addQueryParam(END, end).addQueryParam(COLO, colo) .addQueryParam(LIFECYCLE, lifeCycles, type).addQueryParam(FILTER_BY, filterBy) @@ -576,7 +570,7 @@ public class FalconClient extends AbstractFalconClient { String start, String end, String colo, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, - String doAsUser) throws FalconCLIException { + String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Instances.SUMMARY.path, type, entity) .addQueryParam(START, start).addQueryParam(END, end).addQueryParam(COLO, colo) .addQueryParam(LIFECYCLE, lifeCycles, type).addQueryParam(USER, doAsUser).call(Instances.SUMMARY); @@ -585,7 +579,7 @@ public class FalconClient extends AbstractFalconClient { public FeedInstanceResult getFeedListing(String type, String entity, String start, - String end, String colo, String doAsUser) throws FalconCLIException { + String end, String colo, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Instances.KILL.path, type, entity) .addQueryParam(START, start).addQueryParam(END, end).addQueryParam(COLO, colo) .addQueryParam(USER, doAsUser).call(Instances.LISTING); @@ -594,7 +588,7 @@ public class FalconClient extends AbstractFalconClient { public InstancesResult searchInstances(String type, String nameSubsequence, String tagKeywords, String start, String end, String status, String orderBy, - Integer offset, Integer numResults) throws FalconCLIException { + Integer offset, Integer numResults) { ClientResponse clientResponse = new ResourceBuilder().path(Instances.SEARCH.path) .addQueryParam(ENTITY_TYPE, type) .addQueryParam(NAME_SUBSEQUENCE, nameSubsequence) @@ -612,7 +606,7 @@ public class FalconClient extends AbstractFalconClient { public InstancesResult killInstances(String type, String entity, String start, String end, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, UnsupportedEncodingException { + String doAsUser) throws UnsupportedEncodingException { InputStream props = getServletInputStream(clusters, sourceClusters, null); ClientResponse clientResponse = new ResourceBuilder().path(Instances.KILL.path, type, entity) .addQueryParam(START, start).addQueryParam(END, end).addQueryParam(COLO, colo) @@ -622,7 +616,7 @@ public class FalconClient extends AbstractFalconClient { public InstancesResult suspendInstances(String type, String entity, String start, String end, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, UnsupportedEncodingException { + String doAsUser) throws UnsupportedEncodingException { ClientResponse clientResponse = new ResourceBuilder().path(Instances.SUSPEND.path, type, entity) .addQueryParam(START, start).addQueryParam(END, end).addQueryParam(COLO, colo) .addQueryParam(LIFECYCLE, lifeCycles, type).addQueryParam(USER, doAsUser).call(Instances.SUSPEND); @@ -631,7 +625,7 @@ public class FalconClient extends AbstractFalconClient { public InstancesResult resumeInstances(String type, String entity, String start, String end, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, UnsupportedEncodingException { + String doAsUser) throws UnsupportedEncodingException { ClientResponse clientResponse = new ResourceBuilder().path(Instances.RESUME.path, type, entity) .addQueryParam(START, start).addQueryParam(END, end).addQueryParam(COLO, colo) .addQueryParam(LIFECYCLE, lifeCycles, type).addQueryParam(USER, doAsUser).call(Instances.RESUME); @@ -641,8 +635,7 @@ public class FalconClient extends AbstractFalconClient { public InstancesResult rerunInstances(String type, String entity, String start, String end, String filePath, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - Boolean isForced, String doAsUser) - throws FalconCLIException, IOException { + Boolean isForced, String doAsUser) throws IOException { StringBuilder buffer = new StringBuilder(); if (filePath != null) { @@ -671,7 +664,7 @@ public class FalconClient extends AbstractFalconClient { String end, String colo, String runId, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, Integer offset, - Integer numResults, String doAsUser) throws FalconCLIException { + Integer numResults, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(Instances.LOG.path, type, entity) .addQueryParam(START, start).addQueryParam(END, end).addQueryParam(COLO, colo) .addQueryParam(RUN_ID, runId).addQueryParam(LIFECYCLE, lifeCycles, type) @@ -685,7 +678,7 @@ public class FalconClient extends AbstractFalconClient { String start, String colo, List<LifeCycle> lifeCycles, String doAsUser) - throws FalconCLIException, UnsupportedEncodingException { + throws UnsupportedEncodingException { if (!DateValidator.validate(start)) { throw new FalconCLIException("Start date is mandatory and should be" + " a valid date in YYYY-MM-DDTHH:MMZ format."); @@ -697,16 +690,16 @@ public class FalconClient extends AbstractFalconClient { return getResponse(InstancesResult.class, clientResponse); } - public String getThreadDump(String doAsUser) throws FalconCLIException { + public String getThreadDump(String doAsUser) { return sendAdminRequest(AdminOperations.STACK, doAsUser); } @Override - public String getVersion(String doAsUser) throws FalconCLIException { + public String getVersion(String doAsUser) { return sendAdminRequest(AdminOperations.VERSION, doAsUser); } - public int getStatus(String doAsUser) throws FalconCLIException { + public int getStatus(String doAsUser) { AdminOperations job = AdminOperations.VERSION; ClientResponse clientResponse = new ResourceBuilder().path(job.path).addQueryParam(DO_AS_OPT, doAsUser) .call(job); @@ -714,7 +707,7 @@ public class FalconClient extends AbstractFalconClient { return clientResponse.getStatus(); } - public ClientResponse setSafemode(String safemode, String doAsUser) throws FalconCLIException { + public ClientResponse setSafemode(String safemode, String doAsUser) { AdminOperations job = AdminOperations.SAFEMODE; ClientResponse clientResponse = new ResourceBuilder().path(job.path).path(safemode) .addQueryParam(DO_AS_OPT, doAsUser).call(job); @@ -722,17 +715,17 @@ public class FalconClient extends AbstractFalconClient { return clientResponse; } - public String getDimensionList(String dimensionType, String cluster, String doAsUser) throws FalconCLIException { + public String getDimensionList(String dimensionType, String cluster, String doAsUser) { return sendMetadataDiscoveryRequest(MetadataOperations.LIST, dimensionType, null, cluster, doAsUser); } public String getReplicationMetricsDimensionList(String schedEntityType, String schedEntityName, - Integer numResults, String doAsUser) throws FalconCLIException { + Integer numResults, String doAsUser) { return sendRequestForReplicationMetrics(MetadataOperations.LIST, schedEntityType, schedEntityName, numResults, doAsUser); } - public LineageGraphResult getEntityLineageGraph(String pipelineName, String doAsUser) throws FalconCLIException { + public LineageGraphResult getEntityLineageGraph(String pipelineName, String doAsUser) { MetadataOperations operation = MetadataOperations.LINEAGE; ClientResponse clientResponse = new ResourceBuilder().path(operation.path).addQueryParam(DO_AS_OPT, doAsUser) .addQueryParam(FalconCLIConstants.PIPELINE_OPT, pipelineName).call(operation); @@ -742,7 +735,7 @@ public class FalconClient extends AbstractFalconClient { } public String getDimensionRelations(String dimensionType, String dimensionName, - String doAsUser) throws FalconCLIException { + String doAsUser) { return sendMetadataDiscoveryRequest(MetadataOperations.RELATIONS, dimensionType, dimensionName, null, doAsUser); } @@ -751,10 +744,8 @@ public class FalconClient extends AbstractFalconClient { * * @param filePath - Path of file to stream * @return ServletInputStream - * @throws FalconCLIException */ - private InputStream getServletInputStream(String filePath) - throws FalconCLIException { + private InputStream getServletInputStream(String filePath) { if (filePath == null) { return null; @@ -769,13 +760,13 @@ public class FalconClient extends AbstractFalconClient { } private <T> T getResponse(Class<T> clazz, - ClientResponse clientResponse) throws FalconCLIException { + ClientResponse clientResponse) { printClientResponse(clientResponse); checkIfSuccessful(clientResponse); return clientResponse.getEntity(clazz); } - private String getResponseAsString(ClientResponse clientResponse) throws FalconCLIException { + private String getResponseAsString(ClientResponse clientResponse) { printClientResponse(clientResponse); checkIfSuccessful(clientResponse); return clientResponse.getEntity(String.class); @@ -817,7 +808,7 @@ public class FalconClient extends AbstractFalconClient { } public ResourceBuilder addQueryParam(String paramName, List<LifeCycle> lifeCycles, - String type) throws FalconCLIException { + String type) { if (lifeCycles != null) { checkLifeCycleOption(lifeCycles, type); for (LifeCycle lifeCycle : lifeCycles) { @@ -876,7 +867,7 @@ public class FalconClient extends AbstractFalconClient { } } - public FeedLookupResult reverseLookUp(String type, String path, String doAsUser) throws FalconCLIException { + public FeedLookupResult reverseLookUp(String type, String path, String doAsUser) { Entities api = Entities.LOOKUP; ClientResponse response = new ResourceBuilder().path(api.path, type).addQueryParam(DO_AS_OPT, doAsUser) .addQueryParam(PATH, path).call(api); @@ -884,7 +875,7 @@ public class FalconClient extends AbstractFalconClient { } public FeedInstanceResult getFeedInstanceListing(String type, String entity, String start, String end, String colo - , String doAsUser) throws FalconCLIException { + , String doAsUser) { checkType(type); Instances api = Instances.LISTING; @@ -896,7 +887,7 @@ public class FalconClient extends AbstractFalconClient { public InstanceDependencyResult getInstanceDependencies(String entityType, String entityName, String instanceTime, - String colo) throws FalconCLIException { + String colo) { checkType(entityType); Instances api = Instances.DEPENDENCY; ClientResponse clientResponse = new ResourceBuilder().path(api.path, entityType, entityName) @@ -906,7 +897,7 @@ public class FalconClient extends AbstractFalconClient { //RESUME CHECKSTYLE CHECK VisibilityModifierCheck - private void checkLifeCycleOption(List<LifeCycle> lifeCycles, String type) throws FalconCLIException { + private void checkLifeCycleOption(List<LifeCycle> lifeCycles, String type) { if (lifeCycles != null && !lifeCycles.isEmpty()) { EntityType entityType = EntityType.getEnum(type); for (LifeCycle lifeCycle : lifeCycles) { @@ -917,7 +908,7 @@ public class FalconClient extends AbstractFalconClient { } } - protected void checkType(String type) throws FalconCLIException { + protected void checkType(String type) { if (type == null || type.isEmpty()) { throw new FalconCLIException("entity type is empty"); } else { @@ -929,7 +920,7 @@ public class FalconClient extends AbstractFalconClient { } } - private String sendAdminRequest(AdminOperations job, String doAsUser) throws FalconCLIException { + private String sendAdminRequest(AdminOperations job, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(job.path).addQueryParam(DO_AS_OPT, doAsUser) .call(job); return getResponseAsString(clientResponse); @@ -937,7 +928,7 @@ public class FalconClient extends AbstractFalconClient { private String sendRequestForReplicationMetrics(final MetadataOperations operation, final String schedEntityType, final String schedEntityName, Integer numResults, - final String doAsUser) throws FalconCLIException { + final String doAsUser) { WebResource resource = service.path(operation.path) .path(schedEntityName) .path(RelationshipType.REPLICATION_METRICS.getName()) @@ -971,7 +962,7 @@ public class FalconClient extends AbstractFalconClient { final String dimensionType, final String dimensionName, final String cluster, - final String doAsUser) throws FalconCLIException { + final String doAsUser) { WebResource resource; switch (operation) { case LIST: @@ -1011,45 +1002,44 @@ public class FalconClient extends AbstractFalconClient { } - public String getVertex(String id, String doAsUser) throws FalconCLIException { + public String getVertex(String id, String doAsUser) { return sendMetadataLineageRequest(MetadataOperations.VERTICES, id, doAsUser); } - public String getVertices(String key, String value, String doAsUser) throws FalconCLIException { + public String getVertices(String key, String value, String doAsUser) { return sendMetadataLineageRequest(MetadataOperations.VERTICES, key, value, doAsUser); } - public String getVertexEdges(String id, String direction, String doAsUser) throws FalconCLIException { + public String getVertexEdges(String id, String direction, String doAsUser) { return sendMetadataLineageRequestForEdges(MetadataOperations.VERTICES, id, direction, doAsUser); } - public String getEdge(String id, String doAsUser) throws FalconCLIException { + public String getEdge(String id, String doAsUser) { return sendMetadataLineageRequest(MetadataOperations.EDGES, id, doAsUser); } - public String enumerateExtensions() throws FalconCLIException { + public String enumerateExtensions() { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.ENUMERATE.path) .call(ExtensionOperations.ENUMERATE); return getResponse(String.class, clientResponse); } - public String getExtensionDefinition(final String extensionName) throws FalconCLIException { + public String getExtensionDefinition(final String extensionName) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.DEFINITION.path, extensionName) .call(ExtensionOperations.DEFINITION); return getResponse(String.class, clientResponse); } - public String getExtensionDescription(final String extensionName) throws FalconCLIException { + public String getExtensionDescription(final String extensionName) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.DESCRIBE.path, extensionName) .call(ExtensionOperations.DESCRIBE); return getResponse(String.class, clientResponse); } - public APIResult submitExtensionJob(final String extensionName, final String filePath, final String doAsUser) - throws FalconCLIException { + public APIResult submitExtensionJob(final String extensionName, final String filePath, final String doAsUser) { InputStream entityStream = getServletInputStream(filePath); ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.SUBMIT.path, extensionName) @@ -1059,7 +1049,7 @@ public class FalconClient extends AbstractFalconClient { } public APIResult submitAndScheduleExtensionJob(final String extensionName, final String filePath, - final String doAsUser) throws FalconCLIException { + final String doAsUser) { InputStream entityStream = getServletInputStream(filePath); ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.SUBMIT_AND_SCHEDULE.path, extensionName) @@ -1068,8 +1058,7 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public APIResult updateExtensionJob(final String extensionName, final String filePath, final String doAsUser) - throws FalconCLIException { + public APIResult updateExtensionJob(final String extensionName, final String filePath, final String doAsUser) { InputStream entityStream = getServletInputStream(filePath); ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.UPDATE.path, extensionName) @@ -1078,8 +1067,7 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public APIResult validateExtensionJob(final String extensionName, final String filePath, final String doAsUser) - throws FalconCLIException { + public APIResult validateExtensionJob(final String extensionName, final String filePath, final String doAsUser) { InputStream entityStream = getServletInputStream(filePath); ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.VALIDATE.path, extensionName) @@ -1088,7 +1076,7 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public APIResult scheduleExtensionJob(final String jobName, final String doAsUser) throws FalconCLIException { + public APIResult scheduleExtensionJob(final String jobName, final String doAsUser) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.SCHEDULE.path, jobName) .addQueryParam(DO_AS_OPT, doAsUser) @@ -1096,7 +1084,7 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public APIResult suspendExtensionJob(final String jobName, final String doAsUser) throws FalconCLIException { + public APIResult suspendExtensionJob(final String jobName, final String doAsUser) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.SUSPEND.path, jobName) .addQueryParam(DO_AS_OPT, doAsUser) @@ -1104,7 +1092,7 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public APIResult resumeExtensionJob(final String jobName, final String doAsUser) throws FalconCLIException { + public APIResult resumeExtensionJob(final String jobName, final String doAsUser) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.RESUME.path, jobName) .addQueryParam(DO_AS_OPT, doAsUser) @@ -1112,7 +1100,7 @@ public class FalconClient extends AbstractFalconClient { return getResponse(APIResult.class, clientResponse); } - public APIResult deleteExtensionJob(final String jobName, final String doAsUser) throws FalconCLIException { + public APIResult deleteExtensionJob(final String jobName, final String doAsUser) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.DELETE.path, jobName) .addQueryParam(DO_AS_OPT, doAsUser) @@ -1122,7 +1110,7 @@ public class FalconClient extends AbstractFalconClient { public ExtensionJobList listExtensionJob(final String extensionName, final String doAsUser, final String sortOrder, final String offset, - final String numResults, final String fields) throws FalconCLIException { + final String numResults, final String fields) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.LIST.path, extensionName) .addQueryParam(DO_AS_OPT, doAsUser) @@ -1137,8 +1125,7 @@ public class FalconClient extends AbstractFalconClient { public ExtensionInstanceList listExtensionInstance(final String jobName, final String doAsUser, final String fields, final String start, final String end, final String status, final String orderBy, final String sortOrder, - final String offset, final String numResults) - throws FalconCLIException { + final String offset, final String numResults) { ClientResponse clientResponse = new ResourceBuilder() .path(ExtensionOperations.INSTANCES.path, jobName) .addQueryParam(DO_AS_OPT, doAsUser) @@ -1155,7 +1142,7 @@ public class FalconClient extends AbstractFalconClient { } private String sendExtensionRequest(final ExtensionOperations operation, - final String extensionName) throws FalconCLIException { + final String extensionName) { WebResource resource; switch (operation) { case ENUMERATE: @@ -1181,27 +1168,27 @@ public class FalconClient extends AbstractFalconClient { } private String sendMetadataLineageRequest(MetadataOperations job, String id, - String doAsUser) throws FalconCLIException { + String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(job.path, id).addQueryParam(DO_AS_OPT, doAsUser) .call(job); return getResponseAsString(clientResponse); } private String sendMetadataLineageRequest(MetadataOperations job, String key, - String value, String doAsUser) throws FalconCLIException { + String value, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(job.path).addQueryParam(DO_AS_OPT, doAsUser) .addQueryParam(KEY, key).addQueryParam(VALUE, value).call(job); return getResponseAsString(clientResponse); } private String sendMetadataLineageRequestForEdges(MetadataOperations job, String id, - String direction, String doAsUser) throws FalconCLIException { + String direction, String doAsUser) { ClientResponse clientResponse = new ResourceBuilder().path(job.path, id, direction) .addQueryParam(DO_AS_OPT, doAsUser).call(job); return getResponseAsString(clientResponse); } - private void checkIfSuccessful(ClientResponse clientResponse) throws FalconCLIException { + private void checkIfSuccessful(ClientResponse clientResponse) { Response.Status.Family statusFamily = clientResponse.getClientResponseStatus().getFamily(); if (statusFamily != Response.Status.Family.SUCCESSFUL && statusFamily != Response.Status.Family.INFORMATIONAL) { throw FalconCLIException.fromReponse(clientResponse); http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/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 b91bdbe..1a208fa 100644 --- a/client/src/main/java/org/apache/falcon/resource/EntityList.java +++ b/client/src/main/java/org/apache/falcon/resource/EntityList.java @@ -56,14 +56,14 @@ public class EntityList { /** * List of fields returned by RestAPI. */ - public static enum EntityFieldList { + public enum EntityFieldList { TYPE, NAME, STATUS, TAGS, PIPELINES, CLUSTERS } /** * Filter by these Fields is supported by RestAPI. */ - public static enum EntityFilterByFields { + public enum EntityFilterByFields { TYPE, NAME, STATUS, PIPELINES, CLUSTER, TAGS } http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java ---------------------------------------------------------------------- diff --git a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java index 6c9237b..9169c18 100644 --- a/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java +++ b/prism/src/main/java/org/apache/falcon/resource/AbstractEntityManager.java @@ -319,7 +319,7 @@ public abstract class AbstractEntityManager extends AbstractMetadataResource { Entity entity = deserializeEntity(inputStream, entityType); verifySafemodeOperation(entity, EntityUtil.ENTITY_OPERATION.UPDATE); return update(entity, type, entityName, skipDryRun); - } catch (IOException | FalconException e) { + } catch (FalconException e) { LOG.error("Update failed", e); throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } @@ -756,7 +756,7 @@ public abstract class AbstractEntityManager extends AbstractMetadataResource { } protected Entity deserializeEntity(InputStream xmlStream, EntityType entityType) - throws IOException, FalconException { + throws FalconException { EntityParser<?> entityParser = EntityParserFactory.getParser(entityType); if (xmlStream.markSupported()) { http://git-wip-us.apache.org/repos/asf/falcon/blob/b2526d8f/unit/src/main/java/org/apache/falcon/unit/FalconUnitClient.java ---------------------------------------------------------------------- diff --git a/unit/src/main/java/org/apache/falcon/unit/FalconUnitClient.java b/unit/src/main/java/org/apache/falcon/unit/FalconUnitClient.java index 37221f3..fed50cf 100644 --- a/unit/src/main/java/org/apache/falcon/unit/FalconUnitClient.java +++ b/unit/src/main/java/org/apache/falcon/unit/FalconUnitClient.java @@ -35,9 +35,11 @@ import org.apache.falcon.resource.APIResult; import org.apache.falcon.resource.EntityList; import org.apache.falcon.resource.EntitySummaryResult; import org.apache.falcon.resource.FeedInstanceResult; +import org.apache.falcon.resource.FeedLookupResult; import org.apache.falcon.resource.InstanceDependencyResult; import org.apache.falcon.resource.InstancesResult; import org.apache.falcon.resource.InstancesSummaryResult; +import org.apache.falcon.resource.SchedulableEntityInstanceResult; import org.apache.falcon.resource.admin.AdminResource; import org.apache.falcon.util.DateUtil; import org.apache.falcon.workflow.WorkflowEngineFactory; @@ -96,11 +98,11 @@ public class FalconUnitClient extends AbstractFalconClient { * @return boolean */ @Override - public APIResult submit(String type, String filePath, String doAsUser) throws IOException, FalconCLIException { + public APIResult submit(String type, String filePath, String doAsUser) { try { return localSchedulableEntityManager.submit(type, filePath, doAsUser); - } catch (FalconException e) { + } catch (FalconException | IOException e) { throw new FalconCLIException("FAILED", e); } } @@ -112,17 +114,14 @@ public class FalconUnitClient extends AbstractFalconClient { * @param entityName entity name * @param cluster cluster on which it has to be scheduled * @return - * @throws FalconCLIException * @throws FalconException */ @Override public APIResult schedule(EntityType entityType, String entityName, String cluster, - Boolean skipDryRun, String doAsUser, String properties) throws FalconCLIException { + Boolean skipDryRun, String doAsUser, String properties) { try { return localSchedulableEntityManager.schedule(entityType, entityName, skipDryRun, properties); - } catch (FalconException e) { - throw new FalconCLIException(e); - } catch (AuthorizationException e) { + } catch (FalconException | AuthorizationException e) { throw new FalconCLIException(e); } } @@ -134,7 +133,7 @@ public class FalconUnitClient extends AbstractFalconClient { @Override public APIResult validate(String entityType, String filePath, Boolean skipDryRun, - String doAsUser) throws FalconCLIException { + String doAsUser) { try { return localSchedulableEntityManager.validate(entityType, filePath, skipDryRun, doAsUser); } catch (FalconException e) { @@ -144,7 +143,7 @@ public class FalconUnitClient extends AbstractFalconClient { @Override public APIResult update(String entityType, String entityName, String filePath, - Boolean skipDryRun, String doAsUser) throws FalconCLIException { + Boolean skipDryRun, String doAsUser) { try { return localSchedulableEntityManager.update(entityType, entityName, filePath, skipDryRun, "local", doAsUser); @@ -154,7 +153,7 @@ public class FalconUnitClient extends AbstractFalconClient { } @Override - public Entity getDefinition(String entityType, String entityName, String doAsUser) throws FalconCLIException { + public Entity getDefinition(String entityType, String entityName, String doAsUser) { String entity = localSchedulableEntityManager.getEntityDefinition(entityType, entityName); return Entity.fromString(EntityType.getEnum(entityType), entity); } @@ -164,7 +163,7 @@ public class FalconUnitClient extends AbstractFalconClient { public InstancesResult getStatusOfInstances(String type, String entity, String start, String end, String colo, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, Integer offset, Integer numResults, String doAsUser, - Boolean allAttempts) throws FalconCLIException { + Boolean allAttempts) { if (orderBy == null) { orderBy = DEFAULT_ORDERBY; } @@ -193,7 +192,7 @@ public class FalconUnitClient extends AbstractFalconClient { * @return boolean */ public APIResult schedule(EntityType entityType, String entityName, String startTime, int numInstances, - String cluster, Boolean skipDryRun, String properties) throws FalconCLIException { + String cluster, Boolean skipDryRun, String properties) { try { FalconUnitHelper.checkSchedulableEntity(entityType.toString()); Entity entity = EntityUtil.getEntity(entityType, entityName); @@ -238,32 +237,28 @@ public class FalconUnitClient extends AbstractFalconClient { } @Override - public APIResult suspend(EntityType entityType, String entityName, String colo, String doAsUser) throws - FalconCLIException { + public APIResult suspend(EntityType entityType, String entityName, String colo, String doAsUser) { return localSchedulableEntityManager.suspend(entityType.name(), entityName, colo); } @Override - public APIResult resume(EntityType entityType, String entityName, String colo, String doAsUser) throws - FalconCLIException { + public APIResult resume(EntityType entityType, String entityName, String colo, String doAsUser) { return localSchedulableEntityManager.resume(entityType.name(), entityName, colo); } @Override public APIResult getStatus(EntityType entityType, String entityName, String colo, String doAsUser, - boolean showScheduler) throws FalconCLIException { + boolean showScheduler) { return localSchedulableEntityManager.getStatus(entityType.name(), entityName, colo, showScheduler); } @Override public APIResult submitAndSchedule(String entityType, String filePath, Boolean skipDryRun, String doAsUser, - String properties) throws FalconCLIException { + String properties) { try { return localSchedulableEntityManager.submitAndSchedule(entityType, filePath, skipDryRun, doAsUser, properties); - } catch (FalconException e) { - throw new FalconCLIException(e); - } catch (IOException e) { + } catch (FalconException | IOException e) { throw new FalconCLIException(e); } } @@ -271,7 +266,7 @@ public class FalconUnitClient extends AbstractFalconClient { @Override public EntityList getEntityList(String entityType, String fields, String nameSubsequence, String tagKeywords, String filterBy, String filterTags, String orderBy, String sortOrder, - Integer offset, Integer numResults, String doAsUser) throws FalconCLIException { + Integer offset, Integer numResults, String doAsUser) { return localSchedulableEntityManager.getEntityList(fields, nameSubsequence, tagKeywords, entityType, filterTags, filterBy, orderBy, sortOrder, offset, numResults, doAsUser); } @@ -280,34 +275,34 @@ public class FalconUnitClient extends AbstractFalconClient { public EntitySummaryResult getEntitySummary(String entityType, String cluster, String start, String end, String fields, String filterBy, String filterTags, String orderBy, String sortOrder, Integer offset, Integer numResults, - Integer numInstances, String doAsUser) throws FalconCLIException { + Integer numInstances, String doAsUser) { return localSchedulableEntityManager.getEntitySummary(entityType, cluster, start, end, fields, filterBy, filterTags, orderBy, sortOrder, offset, numResults, numInstances, doAsUser); } @Override public APIResult touch(String entityType, String entityName, String colo, Boolean skipDryRun, - String doAsUser) throws FalconCLIException { + String doAsUser) { return localSchedulableEntityManager.touch(entityType, entityName, colo, skipDryRun); } public InstancesResult killInstances(String type, String entity, String start, String end, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, UnsupportedEncodingException { + String doAsUser) throws UnsupportedEncodingException { Properties props = getProperties(clusters, sourceClusters); return localInstanceManager.killInstance(props, type, entity, start, end, colo, lifeCycles); } public InstancesResult suspendInstances(String type, String entity, String start, String end, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, UnsupportedEncodingException { + String doAsUser) throws UnsupportedEncodingException { Properties props = getProperties(clusters, sourceClusters); return localInstanceManager.suspendInstance(props, type, entity, start, end, colo, lifeCycles); } public InstancesResult resumeInstances(String type, String entity, String start, String end, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, - String doAsUser) throws FalconCLIException, UnsupportedEncodingException { + String doAsUser) throws UnsupportedEncodingException { Properties props = getProperties(clusters, sourceClusters); return localInstanceManager.resumeInstance(props, type, entity, start, end, colo, lifeCycles); } @@ -315,15 +310,14 @@ public class FalconUnitClient extends AbstractFalconClient { public InstancesResult rerunInstances(String type, String entity, String start, String end, String filePath, String colo, String clusters, String sourceClusters, List<LifeCycle> lifeCycles, Boolean isForced, String doAsUser) throws - FalconCLIException, IOException { + IOException { Properties props = getProperties(clusters, sourceClusters); return localInstanceManager.reRunInstance(type, entity, start, end, props, colo, lifeCycles, isForced); } public InstancesSummaryResult getSummaryOfInstances(String type, String entity, String start, String end, String colo, List<LifeCycle> lifeCycles, String filterBy, - String orderBy, String sortOrder, String doAsUser) throws - FalconCLIException { + String orderBy, String sortOrder, String doAsUser) { if (StringUtils.isBlank(orderBy)) { orderBy = DEFAULT_ORDERBY; } @@ -335,32 +329,32 @@ public class FalconUnitClient extends AbstractFalconClient { } public FeedInstanceResult getFeedListing(String type, String entity, String start, String end, String colo, - String doAsUser) throws FalconCLIException { + String doAsUser) { return localInstanceManager.getListing(type, entity, start, end, colo); } public InstancesResult getLogsOfInstances(String type, String entity, String start, String end, String colo, String runId, List<LifeCycle> lifeCycles, String filterBy, String orderBy, String sortOrder, Integer offset, Integer numResults, - String doAsUser) throws FalconCLIException { + String doAsUser) { return localInstanceManager.getLogs(type, entity, start, end, colo, runId, lifeCycles, filterBy, orderBy, sortOrder, offset, numResults); } public InstancesResult getParamsOfInstance(String type, String entity, String start, String colo, - List<LifeCycle> lifeCycles, String doAsUser) throws FalconCLIException, + List<LifeCycle> lifeCycles, String doAsUser) throws UnsupportedEncodingException { return localInstanceManager.getInstanceParams(type, entity, start, colo, lifeCycles); } //RESUME CHECKSTYLE CHECK ParameterNumberCheck public InstanceDependencyResult getInstanceDependencies(String entityType, String entityName, String instanceTime, - String colo) throws FalconCLIException { + String colo) { return localInstanceManager.getInstanceDependencies(entityType, entityName, instanceTime, colo); } @Override - public String getVersion(String doAsUser) throws FalconCLIException { + public String getVersion(String doAsUser) { AdminResource resource = new AdminResource(); AdminResource.PropertyList propertyList = resource.getVersion(); Map<String, String> version = new LinkedHashMap<>(); @@ -375,6 +369,21 @@ public class FalconUnitClient extends AbstractFalconClient { return version.toString(); } + @Override + public SchedulableEntityInstanceResult getFeedSlaMissPendingAlerts(String entityType, String entityName, String start, String end, String colo) { + return null; + } + + @Override + public FeedLookupResult reverseLookUp(String entityType, String path, String doAs) { + return null; + } + + @Override + public EntityList getDependency(String entityType, String entityName, String doAs) { + return null; + } + private boolean checkAndUpdateCluster(Entity entity, EntityType entityType, String cluster) { if (entityType == EntityType.FEED) { return checkAndUpdateFeedClusters(entity, cluster);
