public String ac_log_logger_set_$_2(Args args) { String name = args.argv(0); Level level = Level.valueOf(args.argv(1)); Logger logger = getLogger(name); if (logger == null) { throw new IllegalArgumentException("Logger not found: " + name); } logger.setLevel(level); return "Log level of " + name + " set to " + level; }
public String ac_meta_rm_principal_$_1( Args args )throws Exception { if( _userMetaDb == null ) { throw new Exception("UserMetaDb not open"); } _userMetaDb.removePrincipal( args.argv(0) ) ; return "" ; } /////////////////////////////////////////////////////////////////
private String test_dict(Args args, Map<String,Object> dict) throws CommandException { String name = args.argv(0) ; if( dict.get( name ) == null ){ throw new CommandException( 66 , "not found : "+name ); }return "" ; } private String show_dict(Args args, Map<String,Object> dict)
public String ac_set_keepalive_$_1(Args args) { long keepAlive = Long.parseLong(args.argv(0)); _keepAlive.schedule(keepAlive * 1000L); return "keepAlive value set to " + keepAlive + " seconds"; }
public String ac_add_$_3( Args args )throws Exception { if( ! args.argv(1).equals("to") ) { throw new CommandSyntaxException("keyword 'to' missing"); } String group = args.argv(2) ; String princ = args.argv(0) ; checkPermission( args.getOpt("auth" ) , "group."+group+".access" ) ; _userDb.addElement(group, princ); return "" ; } public static final String hh_remove = "<principalName> from <groupName>" ;
public DssServerSocketCreator(String arguments) throws Throwable { Args args = new Args(arguments); Class<? extends DssContextFactory> factory = Class.forName(args.argv(0)).asSubclass(DssContextFactory.class); args.shift(); Constructor<? extends DssContextFactory> cc = factory.getConstructor(String.class); try { this.factory = cc.newInstance(args.toString()); } catch (InvocationTargetException e) { throw e.getCause(); } }
protected Object buildArray(Args args) { int index = _argument.index(); Class<?> type = _field.getType().getComponentType(); Object values = Array.newInstance(type, args.argc() - index); for (int i = index; i < args.argc(); i++) { Object value = _typeConverter.apply(args.argv(i)); Array.set(values, i - index, value); } return values; } }
private void startListenerWithTls() throws ExecutionException, InterruptedException, UnknownHostException { checkArgument(args.hasOption("socketfactory"), "No Socketfactory provided to Core Domain for channel encryption"); String cellArgs = String.format("%s -socketfactory='%s'", Integer.parseInt((args.argc() == 1) ? args.argv(0) : args.argv(1)), args.getOpt("socketfactory")); lmTls = startListener(cellArgs); LOGGER.info("lmTls: {}; port; {} ", lmTls, lmTls.getListenPort()); info.addCore("tls", InetAddress.getLocalHost().getCanonicalHostName(), lmTls.getListenPort()); }
private void startListenerWithTcp() throws ExecutionException, InterruptedException, UnknownHostException { String cellArgs = String.format("%s -netmask='%s'", args.argv(0), args.getOption("netmask", "")); lmPlain = startListener(cellArgs); LOGGER.info("lmPlain: {}; port; {} ", lmPlain, lmPlain.getListenPort()); info.addCore("tcp", InetAddress.getLocalHost().getCanonicalHostName(), lmPlain.getListenPort()); }
public String ac_exec_$_1_99(Args args) throws CommandException { try { URI uri = new URI(args.argv(0)); args.shift(); return run_reader(uri, args); } catch (URISyntaxException e) { throw new CommandException(43 , e.getMessage()); } }
public String ac_exec_env_$_1_99(Args args) throws CommandException { try { URI uri = new URI("env", args.argv(0), null); args.shift(); return run_reader(uri, args); } catch (URISyntaxException e) { throw new CommandException(43, e.getMessage()); } }
public String ac_create_acl_$_1( Args args )throws Exception { checkDatabase() ; String aclName = args.argv(0) ; checkPermission( args , "acl."+aclName+".create"); _aclDb.createAclItem(aclName); return "" ; } public static final String hh_destroy_acl = "<aclName>" ;
public String ac_destroy_acl_$_1( Args args )throws Exception { checkDatabase() ; String aclName = args.argv(0) ; checkPermission( args , "acl."+aclName+".destroy"); _aclDb.removeAclItem(aclName); return "" ; } public static final String hh_show_acl = "<aclName> [-resolve]" ;
public String ac_create_user_$_1( Args args )throws Exception { checkPermission( args.getOpt("auth" ) , "user.*.create" ) ; String user = args.argv(0) ; _userMetaDb.createUser( user ) ; return "" ; } public static final String hh_create_group = "<groupName>" ;
public String ac_create_group_$_1( Args args )throws Exception { checkDatabase() ; String group = args.argv(0) ; checkPermission( args , "user."+group+".create" ) ; _userMetaDb.createGroup( group ) ; _userDb.createContainer( group ) ; _aclDb.createAclItem( "user."+group+".modify" ) ; return "" ; } public static final String hh_destroy_principal = "<principalName>" ;