Repository: lens
Updated Branches:
  refs/heads/master 0e4c18cb9 -> 7e9e47ea6


LENS-879 : Adds Base framework for scheduler


Project: http://git-wip-us.apache.org/repos/asf/lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/lens/commit/7e9e47ea
Tree: http://git-wip-us.apache.org/repos/asf/lens/tree/7e9e47ea
Diff: http://git-wip-us.apache.org/repos/asf/lens/diff/7e9e47ea

Branch: refs/heads/master
Commit: 7e9e47ea66109470327607fafb26045080fc969d
Parents: 0e4c18c
Author: Ajay Yadava <ajayyad...@apache.org>
Authored: Thu Dec 10 16:28:40 2015 +0530
Committer: Amareshwari Sriramadasu <amareshw...@apache.org>
Committed: Thu Dec 10 16:28:40 2015 +0530

----------------------------------------------------------------------
 .../lens/api/query/SchedulerJobHandle.java      |  82 ++++++
 .../apache/lens/api/query/SchedulerJobInfo.java |  68 +++++
 .../api/query/SchedulerJobInstanceHandle.java   |  86 ++++++
 .../api/query/SchedulerJobInstanceInfo.java     |  84 ++++++
 .../src/main/resources/scheduler-job-0.1.xsd    | 283 +++++++++++++++++++
 .../src/main/resources/example-job.xml          |  55 ++++
 .../api/scheduler/QuerySchedulerService.java    |  26 --
 .../server/api/scheduler/SchedulerJobStats.java |  29 ++
 .../server/api/scheduler/SchedulerService.java  | 238 ++++++++++++++++
 .../lens/server/metrics/MetricsServiceImpl.java |   4 +-
 .../scheduler/QuerySchedulerServiceImpl.java    |  55 ----
 .../server/scheduler/SchedulerServiceImpl.java  | 200 +++++++++++++
 .../src/main/resources/lensserver-default.xml   |   2 +-
 .../server/healthcheck/TestHealthChecks.java    |   4 +-
 pom.xml                                         |   2 +-
 src/site/apt/admin/config.apt                   |   2 +-
 16 files changed, 1132 insertions(+), 88 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobHandle.java
----------------------------------------------------------------------
diff --git 
a/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobHandle.java 
b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobHandle.java
new file mode 100644
index 0000000..aa4dc13
--- /dev/null
+++ b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobHandle.java
@@ -0,0 +1,82 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lens.api.query;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.commons.lang.StringUtils;
+
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+/**
+ * Handle for <code>SchedulerJob</code>.
+ */
+@XmlRootElement
+@AllArgsConstructor
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
+@EqualsAndHashCode(callSuper = false)
+public class SchedulerJobHandle implements Serializable {
+
+  /**
+   * The Constant serialVersionUID.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * The handle id.
+   */
+  @XmlElement
+  @Getter
+  private UUID handleId;
+
+  /**
+   * From string.
+   *
+   * @param handle the handle for scheduler job
+   * @return the handle for
+   */
+  public static SchedulerJobHandle fromString(String handle) {
+    return new SchedulerJobHandle(UUID.fromString(handle));
+  }
+
+  public String getHandleIdString() {
+    if (handleId == null) {
+      return StringUtils.EMPTY;
+    }
+    return handleId.toString();
+  }
+
+  /**
+   * String representation of the SchedulerJobHandle.
+   * @return string representation of the handleId
+   */
+  @Override
+  public String toString() {
+    return getHandleIdString();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInfo.java
----------------------------------------------------------------------
diff --git 
a/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInfo.java 
b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInfo.java
new file mode 100644
index 0000000..1ae7894
--- /dev/null
+++ b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInfo.java
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.lens.api.query;
+
+import org.apache.lens.api.scheduler.XJob;
+
+import lombok.Data;
+/**
+ * POJO to represent the <code>job</code> table in the database.
+ */
+@Data
+public class SchedulerJobInfo {
+
+  /**
+   * ID of the job.
+   * Each job has a unique id which can be used to query it.
+   *
+   * @param id new value for ID.
+   * @return ID for the current job.
+   */
+  private SchedulerJobHandle id;
+
+  /**
+   * Definition of the job scheduled.
+   */
+  private XJob job;
+
+  /**
+   * @param userName userName to be set.
+   * @return name of the user who scheduled this job.
+   */
+  private String userName;
+
+  /**
+   * @param status status of this job.
+   * @return current status of this job
+   */
+  private String status;
+
+  /**
+   * @param createdOn time to be set as createdOn.
+   * @return time when this job was submitted.
+   */
+  private long createdOn;
+
+  /**
+   * @param modifiedOn time to be set as modifiedOn time for this job.
+   * @return last modified time for this job
+   */
+  private long modifiedOn;
+
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInstanceHandle.java
----------------------------------------------------------------------
diff --git 
a/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInstanceHandle.java
 
b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInstanceHandle.java
new file mode 100644
index 0000000..c124a38
--- /dev/null
+++ 
b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInstanceHandle.java
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lens.api.query;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.commons.lang.StringUtils;
+
+import lombok.AccessLevel;
+import lombok.AllArgsConstructor;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+/**
+ * Handle for <code>SchedulerJobInstance</code>
+ */
+@XmlRootElement
+@AllArgsConstructor
+@NoArgsConstructor(access = AccessLevel.PROTECTED)
+@EqualsAndHashCode(callSuper = false)
+public class SchedulerJobInstanceHandle implements Serializable {
+
+  /**
+   * The Constant serialVersionUID.
+   */
+  private static final long serialVersionUID = 1L;
+
+  /**
+   * The handle id.
+   */
+  @XmlElement
+  @Getter
+  private UUID handleId;
+
+  /**
+   * From string.
+   *
+   * @param handle the handle
+   * @return the <code>SchedulerJobInstance</code>'s handle
+   */
+  public static SchedulerJobInstanceHandle fromString(String handle) {
+    return new SchedulerJobInstanceHandle(UUID.fromString(handle));
+  }
+
+  /**
+   * Returns handle id as a string.
+   * @return handleId as a string.
+   */
+  public String getHandleIdString() {
+    if (handleId == null) {
+      return StringUtils.EMPTY;
+    }
+    return handleId.toString();
+  }
+
+  /**
+   * String representation of the SchedulerJobInstanceHandle.
+   * @return the handleID as a string
+   */
+  @Override
+  public String toString() {
+    return getHandleIdString();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInstanceInfo.java
----------------------------------------------------------------------
diff --git 
a/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInstanceInfo.java
 
b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInstanceInfo.java
new file mode 100644
index 0000000..9146cf0
--- /dev/null
+++ 
b/lens-api/src/main/java/org/apache/lens/api/query/SchedulerJobInstanceInfo.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.lens.api.query;
+
+import org.apache.lens.api.LensSessionHandle;
+
+import lombok.Data;
+/**
+ * POJO for an instance of SchedulerJob.
+ */
+@Data
+public class SchedulerJobInstanceInfo {
+
+  /**
+   * @param id new id for the instance of scheduler job.
+   * @return unique id for this instance of scheduler job.
+   */
+  private SchedulerJobInstanceHandle id;
+
+  /**
+   * @param jobId new id for the scheduler job.
+   * @return id for the scheduler job to which this instance belongs.
+   */
+  private SchedulerJobHandle jobId;
+
+  /**
+   * @param sessionHandle new session handle.
+   * @return session handle for this instance.
+   */
+  private LensSessionHandle sessionHandle;
+
+  /**
+   * @param startTime start time to be set for the instance.
+   * @return actual start time of this instance.
+   */
+  private long startTime;
+
+  /**
+   * @param endTime end time to be set for the instance.
+   * @return actual finish time of this instance.
+   */
+  private long endTime;
+
+  /**
+   * @param resultPath result path to be set.
+   * @return result path of this instance.
+   */
+  private String resultPath;
+
+  /**
+   * @param query query to be set
+   * @return query of this instance.
+   */
+  private String query;
+
+  /**
+   * @param status status to be set.
+   * @return status of this instance.
+   */
+  private String status;
+
+  /**
+   * @param createdOn time to be set as created_on time for the instance.
+   * @return created_on time of this instance.
+   */
+  private long createdOn;
+
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-api/src/main/resources/scheduler-job-0.1.xsd
----------------------------------------------------------------------
diff --git a/lens-api/src/main/resources/scheduler-job-0.1.xsd 
b/lens-api/src/main/resources/scheduler-job-0.1.xsd
new file mode 100644
index 0000000..4e6c68b
--- /dev/null
+++ b/lens-api/src/main/resources/scheduler-job-0.1.xsd
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+           attributeFormDefault="unqualified" elementFormDefault="qualified"
+           targetNamespace="uri:lens:job:0.1" xmlns="uri:lens:job:0.1"
+           xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"; jaxb:version="2.1">
+
+    <xs:annotation>
+        <xs:appinfo>
+            <jaxb:schemaBindings>
+                <jaxb:package name="org.apache.lens.api.scheduler" />
+            </jaxb:schemaBindings>
+        </xs:appinfo>
+    </xs:annotation>
+
+    <xs:element name="job" type="x_job" />
+
+    <xs:complexType name="x_job">
+        <xs:annotation>
+            <xs:documentation>
+                XJob represents a job that can be scheduled on lens.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element type="non_empty_string" name="name">
+                <xs:annotation>
+                    <xs:documentation>
+                        Name of the scheduled job. It need not be unique.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
+            <xs:element type="x_execution" name="execution">
+                <xs:annotation>
+                    <xs:documentation>
+                        Contains the information for the executable and 
session.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
+            <xs:element type="x_trigger" name="trigger">
+                <xs:annotation>
+                    <xs:documentation>
+                        Trigger is the gating condition for an instance of job 
to be launched.
+                        Currently only time based triggers are supported.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
+            <xs:element type="map_type" name="job_conf" minOccurs="0" 
maxOccurs="unbounded" >
+                <xs:annotation>
+                    <xs:documentation>
+                        Configuration for the job e.g. number of retries etc.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
+            <xs:element type="xs:dateTime" name="start_time">
+                <xs:annotation>
+                    <xs:documentation>
+                        Start time of this job's schedule  e.g. 
2013-11-30T00:00:00
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
+            <xs:element type="xs:dateTime" name="end_time">
+                <xs:annotation>
+                    <xs:documentation>
+                        End time of this job's schedule e.g. 
2013-11-30T00:00:00
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="x_execution">
+        <xs:annotation>
+            <xs:documentation>
+                Task which has to be scheduled. Currently only query is 
supported.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <!-- Session related information for the job like db, conf, 
resource_path etc. -->
+            <xs:element type="x_session_type" name="session">
+            </xs:element>
+            <xs:choice>
+                <!-- Executable for the job e.g. query.
+                See x_job_query documentation for detailed documentation on 
query -->
+                <xs:element name="query" type="x_job_query" />
+            </xs:choice>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="x_session_type">
+        <xs:sequence>
+            <xs:element name="db" type="xs:string">
+                <xs:annotation>
+                    <xs:documentation>
+                        Database name to be used in session e.g. myDB
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="conf" type="map_type" minOccurs="0" 
maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        Configuration for session.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element type="xs:string" name="resource_path" minOccurs="0" 
maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        Path for resources like jars etc. e.g. /path/to/my/jar
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="x_job_query">
+        <xs:annotation>
+            <xs:documentation>
+                A query which is executed in each run of the job.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="query" type="non_empty_string">
+                <xs:annotation>
+                    <xs:documentation>
+                        A query which is executed in each run of the job.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+            <xs:element name="conf" type="map_type" minOccurs="0" 
maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        Configuration for the query which is executed
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
+
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="x_trigger">
+        <xs:annotation>
+            <xs:documentation>
+                Trigger is the gating condition for an instance of job to be 
launched.
+                Currently only time based triggers are supported.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:choice>
+            <!-- Frequency for the job.
+            Frequency of schedule. Frequency can either be
+                1) an enum from (DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY)
+                2) a cron_expression
+            -->
+            <xs:element name="frequency" type="x_frequency" />
+        </xs:choice>
+    </xs:complexType>
+
+    <xs:complexType name="map_type">
+        <xs:annotation>
+            <xs:documentation>
+                A type to represent key, value pairs.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:sequence>
+            <xs:element name="key" type="non_empty_string" />
+            <xs:element name="value" type="xs:string" />
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="x_frequency">
+        <xs:annotation>
+            <xs:documentation>
+                Frequency of schedule. Frequency can either be
+                1) an enum from (DAILY, WEEKLY, MONTHLY, QUARTERLY, YEARLY)
+                2) a cron_expression
+            </xs:documentation>
+        </xs:annotation>
+        <xs:choice>
+            <xs:element name="enum" type="x_frequency_enum" />
+            <xs:element name="cron_expression" type="x_cron_expression" />
+        </xs:choice>
+        <xs:attribute type="xs:string" name="timezone" />
+    </xs:complexType>
+
+    <xs:simpleType name="x_frequency_enum">
+        <xs:annotation>
+            <xs:documentation>
+                Valid enum expressions which can be used as frequency.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="DAILY" />
+            <xs:enumeration value="WEEKLY" />
+            <xs:enumeration value="MONTHLY" />
+            <xs:enumeration value="QUARTERLY" />
+            <xs:enumeration value="YEARLY" />
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="x_cron_expression">
+        <xs:annotation>
+            <xs:documentation>
+                Source: 
https://quartz-scheduler.org/xml/job_scheduling_data_1_8.xsd
+                To examine you can break it up visually like as below.
+                SECONDS: (
+                
((([0-9]|[0-5][0-9])(-([0-9]|[0-5][0-9]))?,)*([0-9]|[0-5][0-9])(-([0-9]|[0-5][0-9]))?)
+                | (([\*]|[0-9]|[0-5][0-9])/([0-9]|[0-5][0-9])) | ([\?])
+                | ([\*]) ) [\s] MINUTES: (
+                
((([0-9]|[0-5][0-9])(-([0-9]|[0-5][0-9]))?,)*([0-9]|[0-5][0-9])(-([0-9]|[0-5][0-9]))?)
+                | (([\*]|[0-9]|[0-5][0-9])/([0-9]|[0-5][0-9])) | ([\?])
+                | ([\*]) ) [\s] HOURS: (
+                
((([0-9]|[0-1][0-9]|[2][0-3])(-([0-9]|[0-1][0-9]|[2][0-3]))?,)*([0-9]|[0-1][0-9]|[2][0-3])(-([0-9]|[0-1][0-9]|[2][0-3]))?)
+                |
+                (([\*]|[0-9]|[0-1][0-9]|[2][0-3])/([0-9]|[0-1][0-9]|[2][0-3]))
+                | ([\?]) | ([\*]) ) [\s] DAY OF MONTH: (
+                
((([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])(-([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1]))?,)*([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])(-([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1]))?(C)?)
+                |
+                
(([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])/([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])(C)?)
+                | (L(-[0-9])?) | (L(-[1-2][0-9])?) | (L(-[3][0-1])?) |
+                (LW) | ([1-9]W) | ([1-3][0-9]W) | ([\?]) | ([\*]) )[\s]
+                MONTH: (
+                
((([1-9]|0[1-9]|1[0-2])(-([1-9]|0[1-9]|1[0-2]))?,)*([1-9]|0[1-9]|1[0-2])(-([1-9]|0[1-9]|1[0-2]))?)
+                | (([1-9]|0[1-9]|1[0-2])/([1-9]|0[1-9]|1[0-2])) |
+                
(((JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(-(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?,)*(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(-(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?)
+                |
+                
((JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)/(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))
+                | ([\?]) | ([\*]) )[\s] DAY OF WEEK: (
+                (([1-7](-([1-7]))?,)*([1-7])(-([1-7]))?) |
+                ([1-7]/([1-7])) |
+                
(((MON|TUE|WED|THU|FRI|SAT|SUN)(-(MON|TUE|WED|THU|FRI|SAT|SUN))?,)*(MON|TUE|WED|THU|FRI|SAT|SUN)(-(MON|TUE|WED|THU|FRI|SAT|SUN))?(C)?)
+                |
+                
((MON|TUE|WED|THU|FRI|SAT|SUN)/(MON|TUE|WED|THU|FRI|SAT|SUN)(C)?)
+                | (([1-7]|(MON|TUE|WED|THU|FRI|SAT|SUN))(L|LW)?) |
+                (([1-7]|MON|TUE|WED|THU|FRI|SAT|SUN)#([1-7])?) | ([\?])
+                | ([\*]) ) YEAR (OPTIONAL): ( [\s]? ([\*])? |
+                ((19[7-9][0-9])|(20[0-9][0-9]))? |
+                
(((19[7-9][0-9])|(20[0-9][0-9]))/((19[7-9][0-9])|(20[0-9][0-9])))?
+                |
+                
((((19[7-9][0-9])|(20[0-9][0-9]))(-((19[7-9][0-9])|(20[0-9][0-9])))?,)*((19[7-9][0-9])|(20[0-9][0-9]))(-((19[7-9][0-9])|(20[0-9][0-9])))?)?
+                )
+            </xs:documentation>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:pattern
+                    
value="(((([0-9]|[0-5][0-9])(-([0-9]|[0-5][0-9]))?,)*([0-9]|[0-5][0-9])(-([0-9]|[0-5][0-9]))?)|(([\*]|[0-9]|[0-5][0-9])/([0-9]|[0-5][0-9]))|([\?])|([\*]))[\s](((([0-9]|[0-5][0-9])(-([0-9]|[0-5][0-9]))?,)*([0-9]|[0-5][0-9])(-([0-9]|[0-5][0-9]))?)|(([\*]|[0-9]|[0-5][0-9])/([0-9]|[0-5][0-9]))|([\?])|([\*]))[\s](((([0-9]|[0-1][0-9]|[2][0-3])(-([0-9]|[0-1][0-9]|[2][0-3]))?,)*([0-9]|[0-1][0-9]|[2][0-3])(-([0-9]|[0-1][0-9]|[2][0-3]))?)|(([\*]|[0-9]|[0-1][0-9]|[2][0-3])/([0-9]|[0-1][0-9]|[2][0-3]))|([\?])|([\*]))[\s](((([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])(-([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1]))?,)*([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])(-([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1]))?(C)?)|(([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])/([1-9]|[0][1-9]|[1-2][0-9]|[3][0-1])(C)?)|(L(-[0-9])?)|(L(-[1-2][0-9])?)|(L(-[3][0-1])?)|(LW)|([1-9]W)|([1-3][0-9]W)|([\?])|([\*]))[\s](((([1-9]|0[1-9]|1[0-2])(-([1-9]|0[1-9]|1[0-2]))?,)*([1-9]|0[1-9]|1[0-2])(-([1-9]|0[1-9]|1[0-2]))?)|(([1-9]|0[1-9]|1[0-2])/([1
 
-9]|0[1-9]|1[0-2]))|(((JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(-(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?,)*(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)(-(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))?)|((JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)/(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC))|([\?])|([\*]))[\s]((([1-7](-([1-7]))?,)*([1-7])(-([1-7]))?)|([1-7]/([1-7]))|(((MON|TUE|WED|THU|FRI|SAT|SUN)(-(MON|TUE|WED|THU|FRI|SAT|SUN))?,)*(MON|TUE|WED|THU|FRI|SAT|SUN)(-(MON|TUE|WED|THU|FRI|SAT|SUN))?(C)?)|((MON|TUE|WED|THU|FRI|SAT|SUN)/(MON|TUE|WED|THU|FRI|SAT|SUN)(C)?)|(([1-7]|(MON|TUE|WED|THU|FRI|SAT|SUN))?(L|LW)?)|(([1-7]|MON|TUE|WED|THU|FRI|SAT|SUN)#([1-7])?)|([\?])|([\*]))([\s]?(([\*])?|(19[7-9][0-9])|(20[0-9][0-9]))?|
 (((19[7-9][0-9])|(20[0-9][0-9]))/((19[7-9][0-9])|(20[0-9][0-9])))?| 
((((19[7-9][0-9])|(20[0-9][0-9]))(-((19[7-9][0-9])|(20[0-9][0-9])))?,)*((19[7-9][0-9])|(20[0-9][0-9]))(-((19[7-9][0-9])|(20[0-9][0-9])))?)?)"
 />
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="non_empty_string">
+        <xs:annotation>
+            <xs:documentation>
+                A type to represent non empty strings.
+            </xs:documentation>
+        </xs:annotation>
+        <xs:restriction base="xs:string">
+            <xs:minLength value="1"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+</xs:schema>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-examples/src/main/resources/example-job.xml
----------------------------------------------------------------------
diff --git a/lens-examples/src/main/resources/example-job.xml 
b/lens-examples/src/main/resources/example-job.xml
new file mode 100644
index 0000000..93f36d4
--- /dev/null
+++ b/lens-examples/src/main/resources/example-job.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+-->
+<job xmlns="uri:lens:job:0.1">
+    <name>Sample Scheduler job</name>
+    <execution>
+        <resource_path>/path/to/a/resource/</resource_path>
+        <session>
+            <db>myDb</db>
+            <conf>
+                <key>userName</key>
+                <value>ajayyadava</value>
+            </conf>
+        </session>
+        <query>
+            <query>cube select measure2 from sample_cube where 
time_range_in(dt, '2014-06-24-23', '2014-06-25-00')</query>
+            <conf>
+                <key>queryKey1</key>
+                <value>queryValue1</value>
+            </conf>
+        </query>
+    </execution>
+    <trigger>
+        <frequency timezone="UTC">
+            <!--You can also specify a frequency enum here instead of cron 
expression e.g.
+            <enum>DAILY</enum>
+            -->
+            <cron_expression>0 15 10 * * ? 2014</cron_expression> <!-- Fire at 
10:15am every day during the year 2014-->
+        </frequency>
+    </trigger>
+    <job_conf>
+        <key>key1</key>
+        <value>value1</value>
+    </job_conf>
+    <start_time>2013-11-30T00:00:00</start_time>
+    <end_time>2015-12-30T00:00:00</end_time>
+</job>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/QuerySchedulerService.java
----------------------------------------------------------------------
diff --git 
a/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/QuerySchedulerService.java
 
b/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/QuerySchedulerService.java
deleted file mode 100644
index 9f48d27..0000000
--- 
a/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/QuerySchedulerService.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.lens.server.api.scheduler;
-
-/**
- * The Interface QuerySchedulerService.
- */
-public interface QuerySchedulerService {
-
-}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/SchedulerJobStats.java
----------------------------------------------------------------------
diff --git 
a/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/SchedulerJobStats.java
 
b/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/SchedulerJobStats.java
new file mode 100644
index 0000000..4952057
--- /dev/null
+++ 
b/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/SchedulerJobStats.java
@@ -0,0 +1,29 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.lens.server.api.scheduler;
+
+import lombok.Data;
+
+/**
+ * Stats for a scheduler's job.
+ */
+@Data
+public class SchedulerJobStats {
+
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/SchedulerService.java
----------------------------------------------------------------------
diff --git 
a/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/SchedulerService.java
 
b/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/SchedulerService.java
new file mode 100644
index 0000000..b6ec093
--- /dev/null
+++ 
b/lens-server-api/src/main/java/org/apache/lens/server/api/scheduler/SchedulerService.java
@@ -0,0 +1,238 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.lens.server.api.scheduler;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.lens.api.LensSessionHandle;
+import org.apache.lens.api.query.SchedulerJobHandle;
+import org.apache.lens.api.query.SchedulerJobInfo;
+import org.apache.lens.api.query.SchedulerJobInstanceHandle;
+import org.apache.lens.api.query.SchedulerJobInstanceInfo;
+import org.apache.lens.api.scheduler.XJob;
+import org.apache.lens.server.api.error.LensException;
+
+
+/**
+ * Scheduler interface.
+ */
+public interface SchedulerService {
+
+  /**
+   * Submit a job.
+   *
+   * @param sessionHandle handle for this session.
+   * @param job           job to be submitted.
+   * @return unique id for the submitted job.
+   * @throws LensException the lens exception
+   */
+  SchedulerJobHandle submitJob(LensSessionHandle sessionHandle, XJob job) 
throws LensException;
+
+  /**
+   * Schedule a job.
+   *
+   * @param sessionHandle handle for the current session.
+   * @param jobHandle     handle for the job to be scheduled.
+   * @throws LensException the lens exception
+   */
+  void scheduleJob(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle) throws LensException;
+
+
+  /**
+   * Submit a job and also schedule it.
+   *
+   * @param sessionHandle handle for the session.
+   * @param job           job definition.
+   * @return unique id of the job which is submitted and scheduled.
+   * @throws LensException the lens exception
+   */
+  SchedulerJobHandle submitAndScheduleJob(LensSessionHandle sessionHandle, 
XJob job) throws LensException;
+
+  /**
+   * Returns the definition of a job.
+   *
+   * @param sessionHandle handle for the session.
+   * @param jobHandle     handle for the job
+   * @return job definition
+   * @throws LensException the lens exception
+   */
+  XJob getJobDefinition(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle) throws LensException;
+
+
+  /**
+   * Returns the details of a job. Details may contain extra system 
information like id for the job.
+   *
+   * @param sessionHandle handle for the session.
+   * @param jobHandle     handle for the job
+   * @return job details for the job
+   * @throws LensException the lens exception
+   */
+  SchedulerJobInfo getJobDetails(LensSessionHandle sessionHandle,
+                                 SchedulerJobHandle jobHandle) throws 
LensException;
+
+  /**
+   * Update a job with new definition.
+   *
+   * Updates will be applied only for newer instances. Running instances will 
be running with old definition
+   *
+   * @param sessionHandle
+   * @param jobHandle        handle for the job which you want to update.
+   * @param newJobDefinition
+   * @return true or false based on whether the update was successful or 
failed.
+   * @throws LensException the lens exception
+   */
+  boolean updateJob(LensSessionHandle sessionHandle,
+                    SchedulerJobHandle jobHandle, XJob newJobDefinition) 
throws LensException;
+
+
+  /**
+   * End a job by specifying an expiry time.
+   *
+   * @param sessionHandle handle for the current session.
+   * @param jobHandle     handle for the job
+   * @param expiryTime    time after which the job shouldn't execute.
+   * @throws LensException the lens exception
+   */
+  void expireJob(LensSessionHandle sessionHandle, SchedulerJobHandle jobHandle,
+                 Date expiryTime) throws LensException;
+
+
+  /**
+   * Suspend a job.
+   *
+   * If the job is not in scheduled state, it will return true.
+   * Once a job is suspended, no further instances of that job will run.
+   * Any running instances of that job will continue normally.
+   *
+   * @param sessionHandle handle for the current session.
+   * @param jobHandle     handle for the job
+   * @return true if the job was suspended successfully, false otherwise.
+   * @throws LensException the lens exception
+   */
+  boolean suspendJob(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle) throws LensException;
+
+
+  /**
+   * Resume a job from a given time.
+   *
+   * @param sessionHandle handle for the session.
+   * @param jobHandle     handle for the job
+   * @param effectiveTime time from which to resume the instances.
+   * @return true if the job was resumed successfully, false otherwise.
+   * @throws LensException the lens exception
+   */
+  boolean resumeJob(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle,
+                    Date effectiveTime) throws LensException;
+
+  /**
+   * Delete a job.
+   *
+   * @param sessionHandle handle for the session.
+   * @param jobHandle     handle for the job
+   * @return true if the job was deleted successfully.
+   * @throws LensException the lens exception
+   */
+  boolean deleteJob(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle) throws LensException;
+
+
+  /**
+   * @param sessionHandle handle for the current session.
+   * @param state         filter for status, if specified only jobs in that 
state will be returned,
+   *                      if null no entries will be removed from result
+   * @param user          filter for user who submitted the job, if specified 
only jobs submitted by the given user
+   *                      will be returned, if not specified no entries will 
be removed from result on basis of userName
+   * @param jobName       filter for jobName, if specified only the jobs with 
name same as given name will be considered
+   *                      , else no jobs will be filtered out on the basis of 
name.
+   * @param startTime     if specified only instances with scheduleTime after 
this time will be considered.
+   * @param endTime       if specified only instances with scheduleTime before 
this time will be considered.
+   * @return A collection of stats per job
+   * @throws LensException
+   */
+  Collection<SchedulerJobStats> getAllJobStats(LensSessionHandle sessionHandle,
+                                      String state, String user,
+                                      String jobName, long startTime, long 
endTime) throws LensException;
+
+  /**
+   * Returns stats for a job.
+   *
+   * @param sessionHandle handle for session.
+   * @param handle        handle for the job
+   * @param state         filter for status, if specified only jobs in that 
state will be returned,
+   *                      if null no entries will be removed from result
+   * @param startTime     if specified only instances with scheduleTime after 
this time will be considered.
+   * @param endTime       if specified only instances with scheduleTime before 
this time will be considered.
+   * @throws LensException the lens exception
+   */
+  SchedulerJobStats getJobStats(LensSessionHandle sessionHandle, 
SchedulerJobHandle handle,
+                       String state, long startTime, long endTime) throws 
LensException;
+
+
+  /**
+   * Returns handles for last <code>numResults</code> instances for the job.
+   *
+   * @param sessionHandle handle for the session.
+   * @param jobHandle     handle for the job
+   * @param numResults    - number of results to be returned, default 100.
+   * @return list of instance ids for the job
+   * @throws LensException the lens exception
+   */
+  List<String> getJobInstances(LensSessionHandle sessionHandle,
+                               SchedulerJobHandle jobHandle, Long numResults) 
throws LensException;
+
+  /**
+   * Kills a running job instance.
+   *
+   * If the job instance is already completed or not in running state, this 
will be a no-op and will return false.
+   *
+   * @param sessionHandle  handle for the session.
+   * @param instanceHandle handle for the instance
+   * @return true if the instance was killed successfully, false otherwise.
+   * @throws LensException the lens exception
+   */
+  boolean killInstance(LensSessionHandle sessionHandle,
+                        SchedulerJobInstanceHandle instanceHandle) throws 
LensException;
+
+  /**
+   * Reruns a failed/killed/completed job instance.
+   *
+   * If the instance is not in a terminal state, then this operation will be a 
no-op and will return false.
+   *
+   * @param sessionHandle  handle for the session.
+   * @param instanceHandle handle for the instance
+   * @return true if the instance was re run successfully, false otherwise.
+   * @throws LensException the lens exception
+   */
+  boolean rerunInstance(LensSessionHandle sessionHandle,
+                        SchedulerJobInstanceHandle instanceHandle) throws 
LensException;
+
+  /**
+   * Instance details for an instance.
+   *
+   * @param sessionHandle  handle for the session.
+   * @param instanceHandle handle for the instance.
+   * @return details for the instance.
+   * @throws LensException the lens exception
+   */
+  SchedulerJobInstanceInfo getInstanceDetails(LensSessionHandle sessionHandle,
+                                              SchedulerJobInstanceHandle 
instanceHandle) throws LensException;
+
+
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
 
b/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
index 3389aba..6852265 100644
--- 
a/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
+++ 
b/lens-server/src/main/java/org/apache/lens/server/metrics/MetricsServiceImpl.java
@@ -48,7 +48,7 @@ import org.apache.lens.server.api.session.SessionService;
 import org.apache.lens.server.healthcheck.LensServiceHealthCheck;
 import org.apache.lens.server.query.QueryExecutionServiceImpl;
 import org.apache.lens.server.quota.QuotaServiceImpl;
-import org.apache.lens.server.scheduler.QuerySchedulerServiceImpl;
+import org.apache.lens.server.scheduler.SchedulerServiceImpl;
 import org.apache.lens.server.session.DatabaseResourceService;
 import org.apache.lens.server.session.HiveSessionService;
 
@@ -263,7 +263,7 @@ public class MetricsServiceImpl extends AbstractService 
implements MetricsServic
     healthCheck.register(CubeMetastoreService.NAME, new 
LensServiceHealthCheck(CubeMetastoreService.NAME));
     healthCheck.register(HiveSessionService.NAME, new 
LensServiceHealthCheck(HiveSessionService.NAME));
     healthCheck.register(QueryExecutionServiceImpl.NAME, new 
LensServiceHealthCheck(QueryExecutionServiceImpl.NAME));
-    healthCheck.register(QuerySchedulerServiceImpl.NAME, new 
LensServiceHealthCheck(QuerySchedulerServiceImpl.NAME));
+    healthCheck.register(SchedulerServiceImpl.NAME, new 
LensServiceHealthCheck(SchedulerServiceImpl.NAME));
     healthCheck.register(QuotaServiceImpl.NAME, new 
LensServiceHealthCheck(QuotaServiceImpl.NAME));
     healthCheck.register(MetricsServiceImpl.NAME, new 
LensServiceHealthCheck(MetricsServiceImpl.NAME));
     healthCheck.register(EventServiceImpl.NAME, new 
LensServiceHealthCheck(EventServiceImpl.NAME));

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-server/src/main/java/org/apache/lens/server/scheduler/QuerySchedulerServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/main/java/org/apache/lens/server/scheduler/QuerySchedulerServiceImpl.java
 
b/lens-server/src/main/java/org/apache/lens/server/scheduler/QuerySchedulerServiceImpl.java
deleted file mode 100644
index 24949bd..0000000
--- 
a/lens-server/src/main/java/org/apache/lens/server/scheduler/QuerySchedulerServiceImpl.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.lens.server.scheduler;
-
-import org.apache.lens.server.BaseLensService;
-import org.apache.lens.server.api.health.HealthStatus;
-import org.apache.lens.server.api.scheduler.QuerySchedulerService;
-
-import org.apache.hive.service.cli.CLIService;
-
-/**
- * The Class QuerySchedulerServiceImpl.
- */
-public class QuerySchedulerServiceImpl extends BaseLensService implements 
QuerySchedulerService {
-
-  /**
-   * The constant name for scheduler service.
-   */
-  public static final String NAME = "scheduler";
-
-  /**
-   * Instantiates a new query scheduler service impl.
-   *
-   * @param cliService the cli service
-   */
-  public QuerySchedulerServiceImpl(CLIService cliService) {
-    super(NAME, cliService);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public HealthStatus getHealthStatus() {
-    return this.getServiceState().equals(STATE.STARTED)
-        ? new HealthStatus(true, "Query scheduler service is healthy.")
-        : new HealthStatus(false, "Query scheduler service is down.");
-  }
-}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
 
b/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
new file mode 100644
index 0000000..ce98601
--- /dev/null
+++ 
b/lens-server/src/main/java/org/apache/lens/server/scheduler/SchedulerServiceImpl.java
@@ -0,0 +1,200 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.lens.server.scheduler;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.lens.api.LensSessionHandle;
+import org.apache.lens.api.query.SchedulerJobHandle;
+import org.apache.lens.api.query.SchedulerJobInfo;
+import org.apache.lens.api.query.SchedulerJobInstanceHandle;
+import org.apache.lens.api.query.SchedulerJobInstanceInfo;
+import org.apache.lens.api.scheduler.XJob;
+import org.apache.lens.server.BaseLensService;
+import org.apache.lens.server.api.error.LensException;
+import org.apache.lens.server.api.health.HealthStatus;
+import org.apache.lens.server.api.scheduler.SchedulerJobStats;
+import org.apache.lens.server.api.scheduler.SchedulerService;
+
+import org.apache.hive.service.cli.CLIService;
+/**
+ * The Class QuerySchedulerService.
+ */
+public class SchedulerServiceImpl extends BaseLensService implements 
SchedulerService {
+
+  /**
+   * The constant name for scheduler service.
+   */
+  public static final String NAME = "scheduler";
+
+  /**
+   * Instantiates a new scheduler service.
+   *
+   * @param cliService the cli service
+   */
+  public SchedulerServiceImpl(CLIService cliService) {
+    super(NAME, cliService);
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public HealthStatus getHealthStatus() {
+    return this.getServiceState().equals(STATE.STARTED)
+        ? new HealthStatus(true, "Scheduler service is healthy.")
+        : new HealthStatus(false, "Scheduler service is down.");
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public SchedulerJobHandle submitJob(LensSessionHandle sessionHandle, XJob 
job) throws LensException {
+    return null;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void scheduleJob(LensSessionHandle sessionHandle,
+                                        SchedulerJobHandle jobHandle) throws 
LensException {
+  }
+
+  @Override
+  public SchedulerJobHandle submitAndScheduleJob(LensSessionHandle 
sessionHandle, XJob job) throws LensException {
+    return null;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public XJob getJobDefinition(LensSessionHandle sessionHandle, 
SchedulerJobHandle jobHandle) throws LensException {
+    return null;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public SchedulerJobInfo getJobDetails(LensSessionHandle sessionHandle,
+                                        SchedulerJobHandle jobHandle) throws 
LensException {
+    return null;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean updateJob(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle,
+                           XJob newJobDefinition) throws LensException {
+    return false;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void expireJob(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle,
+                        Date expiryTime) throws LensException {
+
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean suspendJob(LensSessionHandle sessionHandle, 
SchedulerJobHandle jobHandle) throws LensException {
+    return false;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean resumeJob(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle,
+                           Date effectiveTime) throws LensException {
+    return false;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean deleteJob(LensSessionHandle sessionHandle, SchedulerJobHandle 
jobHandle) throws LensException {
+    return false;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public Collection<SchedulerJobStats> getAllJobStats(LensSessionHandle 
sessionHandle, String state, String user,
+                                             String jobName, long startTime, 
long endTime) throws LensException {
+    return null;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public SchedulerJobStats getJobStats(LensSessionHandle sessionHandle, 
SchedulerJobHandle handle, String state,
+                              long startTime, long endTime) throws 
LensException {
+    return null;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean rerunInstance(LensSessionHandle sessionHandle,
+                               SchedulerJobInstanceHandle instanceHandle) 
throws LensException {
+    return false;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public List<String> getJobInstances(LensSessionHandle sessionHandle,
+                                      SchedulerJobHandle jobHandle, Long 
numResults) throws LensException {
+    return null;
+  }
+
+  @Override
+  public boolean killInstance(LensSessionHandle sessionHandle,
+                              SchedulerJobInstanceHandle instanceHandle) 
throws LensException {
+    return false;
+  }
+
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public SchedulerJobInstanceInfo getInstanceDetails(LensSessionHandle 
sessionHandle,
+                                                     
SchedulerJobInstanceHandle instanceHandle) throws LensException {
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-server/src/main/resources/lensserver-default.xml
----------------------------------------------------------------------
diff --git a/lens-server/src/main/resources/lensserver-default.xml 
b/lens-server/src/main/resources/lensserver-default.xml
index 39b72dc..cac641a 100644
--- a/lens-server/src/main/resources/lensserver-default.xml
+++ b/lens-server/src/main/resources/lensserver-default.xml
@@ -91,7 +91,7 @@
 
   <property>
     <name>lens.server.scheduler.service.impl</name>
-    <value>org.apache.lens.server.scheduler.QuerySchedulerServiceImpl</value>
+    <value>org.apache.lens.server.scheduler.SchedulerServiceImpl</value>
     <description>Implementation class for query scheduler service</description>
   </property>
 

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/lens-server/src/test/java/org/apache/lens/server/healthcheck/TestHealthChecks.java
----------------------------------------------------------------------
diff --git 
a/lens-server/src/test/java/org/apache/lens/server/healthcheck/TestHealthChecks.java
 
b/lens-server/src/test/java/org/apache/lens/server/healthcheck/TestHealthChecks.java
index e11413e..8e22c7a 100644
--- 
a/lens-server/src/test/java/org/apache/lens/server/healthcheck/TestHealthChecks.java
+++ 
b/lens-server/src/test/java/org/apache/lens/server/healthcheck/TestHealthChecks.java
@@ -32,7 +32,7 @@ import 
org.apache.lens.server.metastore.CubeMetastoreServiceImpl;
 import org.apache.lens.server.metastore.MetastoreApp;
 import org.apache.lens.server.metrics.MetricsServiceImpl;
 import org.apache.lens.server.quota.QuotaServiceImpl;
-import org.apache.lens.server.scheduler.QuerySchedulerServiceImpl;
+import org.apache.lens.server.scheduler.SchedulerServiceImpl;
 import org.apache.lens.server.session.HiveSessionService;
 
 import org.glassfish.jersey.client.ClientConfig;
@@ -93,7 +93,7 @@ public class TestHealthChecks extends LensJerseyTest {
 
   @Test
   public void testQuerySchedulerServiceHealth() throws Exception {
-    checkHealth(QuerySchedulerServiceImpl.NAME);
+    checkHealth(SchedulerServiceImpl.NAME);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 732b3bb..746204e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -58,7 +58,7 @@
     <commons.collections.version>3.2.1</commons.collections.version>
     <joda.time.version>2.0</joda.time.version>
     <guava.version>13.0.1</guava.version>
-    <lombok.version>1.12.4</lombok.version>
+    <lombok.version>1.16.6</lombok.version>
     <lombok.maven.plugin.version>1.16.4.1</lombok.maven.plugin.version>
     <typesafe.config.version>1.2.1</typesafe.config.version>
     <logback.version>1.1.3</logback.version>

http://git-wip-us.apache.org/repos/asf/lens/blob/7e9e47ea/src/site/apt/admin/config.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/admin/config.apt b/src/site/apt/admin/config.apt
index bcf4b7d..54f827e 100644
--- a/src/site/apt/admin/config.apt
+++ b/src/site/apt/admin/config.apt
@@ -165,7 +165,7 @@ Lens server configuration
 *--+--+---+--+
 
|68|lens.server.savedquery.ws.resource.impl|org.apache.lens.server.query.save.SavedQueryResource|Implementation
 class for Saved query Resource|
 *--+--+---+--+
-|69|lens.server.scheduler.service.impl|org.apache.lens.server.scheduler.QuerySchedulerServiceImpl|Implementation
 class for query scheduler service|
+|69|lens.server.scheduler.service.impl|org.apache.lens.server.scheduler.QuerySchedulerService|Implementation
 class for query scheduler service|
 *--+--+---+--+
 
|70|lens.server.scheduler.ws.resource.impl|org.apache.lens.server.scheduler.ScheduleResource|Implementation
 class for query scheduler resource|
 *--+--+---+--+

Reply via email to