001 /**
002 * Copyright (c) 2010 Yahoo! Inc. All rights reserved.
003 * Licensed under the Apache License, Version 2.0 (the "License");
004 * you may not use this file except in compliance with the License.
005 * You may obtain a copy of the License at
006 *
007 * http://www.apache.org/licenses/LICENSE-2.0
008 *
009 * Unless required by applicable law or agreed to in writing, software
010 * distributed under the License is distributed on an "AS IS" BASIS,
011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012 * See the License for the specific language governing permissions and
013 * limitations under the License. See accompanying LICENSE file.
014 */
015 package org.apache.oozie.service;
016
017 import org.apache.oozie.DagEngine;
018 import org.apache.oozie.service.Service;
019 import org.apache.oozie.service.Services;
020
021 /**
022 * Service that return a dag engine for a user.
023 */
024 public class DagEngineService implements Service {
025
026 /**
027 * Initialize the service.
028 *
029 * @param services services instance.
030 */
031 public void init(Services services) {
032 }
033
034 /**
035 * Destroy the service.
036 */
037 public void destroy() {
038 }
039
040 /**
041 * Return the public interface of the Dag engine service.
042 *
043 * @return {@link DagEngineService}.
044 */
045 public Class<? extends Service> getInterface() {
046 return DagEngineService.class;
047 }
048
049 /**
050 * Return a Dag engine.
051 *
052 * @param user user for the dag engine.
053 * @param authToken the authentication token.
054 * @return the dag engine for the specified user.
055 */
056 public DagEngine getDagEngine(String user, String authToken) {
057 return new DagEngine(user, authToken);
058 }
059
060 /**
061 * Return a Dag engine for a system user (no user, no group).
062 *
063 * @return a system Dag engine.
064 */
065 public DagEngine getSystemDagEngine() {
066 return new DagEngine();
067 }
068
069 }