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.action.hadoop; 019 020 import java.io.IOException; 021 022 import org.apache.hadoop.mapred.JobClient; 023 import org.apache.hadoop.mapred.JobConf; 024 import org.apache.hadoop.util.ReflectionUtils; 025 import org.apache.oozie.service.HadoopAccessorService; 026 import org.apache.oozie.service.Services; 027 028 //TODO this class can go away once we use only 20.100+ 029 public class AuthHelper { 030 private static Class<? extends AuthHelper> KLASS = null; 031 032 @SuppressWarnings("unchecked") 033 public synchronized static AuthHelper get() { 034 if (KLASS == null) { 035 HadoopAccessorService has = Services.get().get(HadoopAccessorService.class); 036 if (has.getClass() == HadoopAccessorService.class) { 037 KLASS = AuthHelper.class; 038 } 039 else { 040 try { 041 KLASS = (Class<? extends AuthHelper>) Class 042 .forName("org.apache.oozie.action.hadoop.KerberosAuthHelper"); 043 } 044 catch (ClassNotFoundException e) { 045 throw new RuntimeException(e); 046 } 047 } 048 } 049 return ReflectionUtils.newInstance(KLASS, null); 050 } 051 052 public void set(JobClient jobClient, JobConf jobConf) throws IOException, InterruptedException { 053 } 054 055 }