This project has retired. For details please refer to its
Attic page.
001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018 package org.apache.oozie.servlet;
019
020 import java.io.IOException;
021
022 import javax.servlet.http.HttpServletRequest;
023 import javax.servlet.http.HttpServletResponse;
024
025 import org.apache.oozie.DagEngine;
026 import org.apache.oozie.DagEngineException;
027 import org.apache.oozie.client.rest.JsonBean;
028 import org.apache.oozie.service.DagEngineService;
029 import org.apache.oozie.service.Services;
030
031 @SuppressWarnings("serial")
032 public class V2JobServlet extends V1JobServlet {
033
034 private static final String INSTRUMENTATION_NAME = "v2job";
035
036 public V2JobServlet() {
037 super(INSTRUMENTATION_NAME);
038 }
039
040 @Override
041 protected JsonBean getWorkflowJob(HttpServletRequest request, HttpServletResponse response) throws XServletException {
042 JsonBean jobBean = super.getWorkflowJobBean(request, response);
043 return jobBean;
044 }
045
046 @Override
047 protected JsonBean getWorkflowAction(HttpServletRequest request, HttpServletResponse response) throws XServletException {
048 JsonBean actionBean = super.getWorkflowActionBean(request, response);
049 return actionBean;
050 }
051
052 @Override
053 protected int getCoordinatorJobLength(int defaultLen, int len) {
054 return (len < 0) ? defaultLen : len;
055 }
056
057 @Override
058 protected String getJMSTopicName(HttpServletRequest request, HttpServletResponse response) throws XServletException,
059 IOException {
060 String topicName;
061 String jobId = getResourceName(request);
062 DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request));
063 try {
064 topicName = dagEngine.getJMSTopicName(jobId);
065 }
066 catch (DagEngineException ex) {
067 throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
068 }
069 return topicName;
070 }
071 }