public static ArrayList < ACL > createAcl ( FailoverWatcher failoverWatcher , String znode ) { if ( znode . equals ( "/chronos" ) ) { return Ids . OPEN_ACL_UNSAFE ; } if ( failoverWatcher . isZkSecure ( ) ) { ArrayList < ACL > acls = new ArrayList < ACL > ( ) ; acls . add ( new ACL ( ZooDefs . Perms . READ , ZooDefs . Ids . ANYONE_ID_UNSAFE ) ) ; acls . add ( new ACL ( ZooDefs . Perms . ALL , new Id ( "sasl" , failoverWatcher . getZkAdmin ( ) ) ) ) ; return acls ; } else { return Ids . OPEN_ACL_UNSAFE ; } }
Create acl for znodes anyone could read but only admin can operate if set scure .