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 019package org.apache.hadoop.hbase.util; 020 021import java.io.IOException; 022 023import org.apache.yetus.audience.InterfaceAudience; 024import org.slf4j.Logger; 025import org.slf4j.LoggerFactory; 026import org.apache.hadoop.conf.Configuration; 027import org.apache.hadoop.fs.FileSystem; 028import org.apache.hadoop.fs.Path; 029import org.apache.hadoop.fs.permission.FsPermission; 030 031/** 032 * <a href="http://www.mapr.com/">MapR</a> implementation. 033 */ 034@InterfaceAudience.Private 035public class FSMapRUtils extends FSUtils { 036 private static final Logger LOG = LoggerFactory.getLogger(FSMapRUtils.class); 037 038 @Override 039 public void recoverFileLease(final FileSystem fs, final Path p, 040 Configuration conf, CancelableProgressable reporter) throws IOException { 041 LOG.info("Recovering file " + p.toString() + 042 " by changing permission to readonly"); 043 FsPermission roPerm = new FsPermission((short) 0444); 044 fs.setPermission(p, roPerm); 045 } 046}