tools/twiddle/cli/src/main/java/org/mobicents/tools/twiddle/jslee/ProfileEditCommand.java
@Override
	protected void processArguments(String[] args) throws CommandException {
		//first, we must get atleast -t, possibly -p, depending on those we call different method on ProfileProvisioningMBean
		//String sopts = ":t:p:ldwecrog:s";
		String sopts = "-:l:xdwecrog:s";
	
		LongOpt[] lopts = { 
				//conf part
				//new LongOpt("table", LongOpt.REQUIRED_ARGUMENT, null, 't'),
				//new LongOpt("profile", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
				 new LongOpt("noprefix", LongOpt.NO_ARGUMENT, null, 0x1000),
				//operration part
				new LongOpt("list", LongOpt.NO_ARGUMENT, null, 'l'),
                new LongOpt("extlist", LongOpt.NO_ARGUMENT, null, 'x'),
				new LongOpt("dirty", LongOpt.NO_ARGUMENT, null, 'd'),
				new LongOpt("write", LongOpt.NO_ARGUMENT, null, 'w'),
				new LongOpt("edit", LongOpt.NO_ARGUMENT, null, 'e'),
				new LongOpt("commit", LongOpt.NO_ARGUMENT, null, 'c'),
				new LongOpt("restore", LongOpt.NO_ARGUMENT, null, 'r'),
				new LongOpt("close", LongOpt.NO_ARGUMENT, null, 'o'),
				//get,set,bussines
				new LongOpt("get", LongOpt.REQUIRED_ARGUMENT, null, 'g'),
				new LongOpt("set", LongOpt.NO_ARGUMENT, null, 's'),
					//options for set
					new LongOpt("name", LongOpt.REQUIRED_ARGUMENT, null, SetAttributeOperation.name),
					new LongOpt("separator", LongOpt.OPTIONAL_ARGUMENT, null, SetAttributeOperation.separator),
					new LongOpt("value", LongOpt.OPTIONAL_ARGUMENT, null, SetAttributeOperation.value),
				//new LongOpt("bussines", LongOpt.NO_ARGUMENT, null, 'b'),
				};

		Getopt getopt = new Getopt(null, args, sopts, lopts);
		getopt.setOpterr(false);
		int nonOptArgIndex = 0;
		int code;
		while ((code = getopt.getopt()) != -1) {
			switch (code) {
			case ':':
				throw new CommandException("Option requires an argument: " + args[getopt.getOptind() - 1]);

			case '?':
				throw new CommandException("Invalid (or ambiguous) option: " + args[getopt.getOptind() - 1]);

				//CONF PART
//			case 't':
//				this.profileTableName = getopt.getOptarg();
//				break;
//			case 'p':
//				this.profileName = getopt.getOptarg();
//				break;
				// OPERATION PART
			case 0x1000:
				break;
			case 1:
				//non opt args, table and profile name(maybe)
				switch(nonOptArgIndex)
				{
				case 0:
					profileTableName  = getopt.getOptarg();
					nonOptArgIndex++;
					break;
				case 1:
					profileName  = getopt.getOptarg();
					nonOptArgIndex++;
					break;
				default:
					throw new CommandException("Command: \"" + getName() + "\" expects at most two non opt arguments!");
				}
				break;
				
				
			case 'l':
				//list
				super.operation = new ListOperation(super.context, super.log, this);
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
            case 'x':
                //extlist
                super.operation = new ExtListOperation(super.context, super.log, this);
                prepareCommand();
                super.operation.buildOperation(getopt, args);
                break;
			case 'd':
				//dirt
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"isProfileDirty");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'w':
				//write
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"isProfileWriteable");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'e':
				//edit
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"editProfile");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'c':
				//commit
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"commitProfile");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'r':
				//restore
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"restoreProfile");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'o':
				//close
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"closeProfile");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'g':
				//get
				super.operation = new GetAttributeOperation(super.context, super.log, this);
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 's':
				//set
				super.operation = new SetAttributeOperation(super.context, super.log, this);
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
//			case 'b':
//				//bussines
//				super.operation = new BussinesMethodOperation(super.context, super.log, this);
//				super.operation.buildOperation(getopt, args);
//				break;	
			
				
			default:
				throw new CommandException("Command: \"" + getName() + "\", found unexpected opt: " + args[getopt.getOptind() - 1]);

			}
		}
	}
@Override
	protected void processArguments(String[] args) throws CommandException {
		//first, we must get atleast -t, possibly -p, depending on those we call different method on ProfileProvisioningMBean
		//String sopts = ":t:p:ldwecrog:s";
		String sopts = "-:l:xdwecrog:s";
	
		LongOpt[] lopts = { 
				//conf part
				//new LongOpt("table", LongOpt.REQUIRED_ARGUMENT, null, 't'),
				//new LongOpt("profile", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
				 new LongOpt("noprefix", LongOpt.NO_ARGUMENT, null, 0x1000),
				//operration part
				new LongOpt("list", LongOpt.NO_ARGUMENT, null, 'l'),
                new LongOpt("extlist", LongOpt.NO_ARGUMENT, null, 'x'),
				new LongOpt("dirty", LongOpt.NO_ARGUMENT, null, 'd'),
				new LongOpt("write", LongOpt.NO_ARGUMENT, null, 'w'),
				new LongOpt("edit", LongOpt.NO_ARGUMENT, null, 'e'),
				new LongOpt("commit", LongOpt.NO_ARGUMENT, null, 'c'),
				new LongOpt("restore", LongOpt.NO_ARGUMENT, null, 'r'),
				new LongOpt("close", LongOpt.NO_ARGUMENT, null, 'o'),
				//get,set,bussines
				new LongOpt("get", LongOpt.REQUIRED_ARGUMENT, null, 'g'),
				new LongOpt("set", LongOpt.NO_ARGUMENT, null, 's'),
					//options for set
					new LongOpt("name", LongOpt.REQUIRED_ARGUMENT, null, SetAttributeOperation.name),
					new LongOpt("separator", LongOpt.OPTIONAL_ARGUMENT, null, SetAttributeOperation.separator),
					new LongOpt("value", LongOpt.OPTIONAL_ARGUMENT, null, SetAttributeOperation.value),
				//new LongOpt("bussines", LongOpt.NO_ARGUMENT, null, 'b'),
				};

		Getopt getopt = new Getopt(null, args, sopts, lopts);
		getopt.setOpterr(false);
		int nonOptArgIndex = 0;
		int code;
		while ((code = getopt.getopt()) != -1) {
			switch (code) {
			case ':':
				throw new CommandException("Option requires an argument: " + args[getopt.getOptind() - 1]);

			case '?':
				throw new CommandException("Invalid (or ambiguous) option: " + args[getopt.getOptind() - 1]);

				//CONF PART
//			case 't':
//				this.profileTableName = getopt.getOptarg();
//				break;
//			case 'p':
//				this.profileName = getopt.getOptarg();
//				break;
				// OPERATION PART
			case 0x1000:
				break;
			case 1:
				//non opt args, table and profile name(maybe)
				switch(nonOptArgIndex)
				{
				case 0:
					profileTableName  = getopt.getOptarg();
					nonOptArgIndex++;
					break;
				case 1:
					profileName  = getopt.getOptarg();
					nonOptArgIndex++;
					break;
				default:
					throw new CommandException("Command: \"" + getName() + "\" expects at most two non opt arguments!");
				}
				break;
				
				
			case 'l':
				//list
				super.operation = new ListOperation(super.context, super.log, this);
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
            case 'x':
                //extlist
                super.operation = new ExtListOperation(super.context, super.log, this);
                prepareCommand();
                super.operation.buildOperation(getopt, args);
                break;
			case 'd':
				//dirt
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"isProfileDirty");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'w':
				//write
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"isProfileWriteable");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'e':
				//edit
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"editProfile");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'c':
				//commit
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"commitProfile");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'r':
				//restore
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"restoreProfile");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'o':
				//close
				super.operation = new SimpleInvokeOperation(super.context, super.log, this,"closeProfile");
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 'g':
				//get
				super.operation = new GetAttributeOperation(super.context, super.log, this);
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
			case 's':
				//set
				super.operation = new SetAttributeOperation(super.context, super.log, this);
				prepareCommand();
				super.operation.buildOperation(getopt, args);
				break;
//			case 'b':
//				//bussines
//				super.operation = new BussinesMethodOperation(super.context, super.log, this);
//				super.operation.buildOperation(getopt, args);
//				break;	
			
				
			default:
				throw new CommandException("Command: \"" + getName() + "\", found unexpected opt: " + args[getopt.getOptind() - 1]);

			}
		}
	}
@ Override protected void processArguments ( String [ ] args ) throws CommandException { //first, we must get atleast -t, possibly -p, depending on those we call different method on ProfileProvisioningMBean
 //String sopts = ":t:p:ldwecrog:s";
 String sopts = "-:l:xdwecrog:s" ; LongOpt [ ] lopts = { //conf part
 //new LongOpt("table", LongOpt.REQUIRED_ARGUMENT, null, 't'),
 //new LongOpt("profile", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
 new LongOpt ( "noprefix" , LongOpt . NO_ARGUMENT , null , 0x1000 ) , //operration part
 new LongOpt ( "list" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "extlist" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "dirty" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "write" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "edit" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "commit" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "restore" , LongOpt . NO_ARGUMENT , null , ' ' ) , new LongOpt ( "close" , LongOpt . NO_ARGUMENT , null , ' ' ) , //get,set,bussines
 new LongOpt ( "get" , LongOpt . REQUIRED_ARGUMENT , null , ' ' ) , new LongOpt ( "set" , LongOpt . NO_ARGUMENT , null , ' ' ) , //options for set
 new LongOpt ( "name" , LongOpt . REQUIRED_ARGUMENT , null , SetAttributeOperation . name ) , new LongOpt ( "separator" , LongOpt . OPTIONAL_ARGUMENT , null , SetAttributeOperation . separator ) , new LongOpt ( "value" , LongOpt . OPTIONAL_ARGUMENT , null , SetAttributeOperation . value ) , //new LongOpt("bussines", LongOpt.NO_ARGUMENT, null, 'b'),
 } ; Getopt getopt = new Getopt ( null , args , sopts , lopts ) ; getopt . setOpterr ( false ) ; int nonOptArgIndex = 0 ; int code ; while ( ( code = getopt . getopt ( ) ) != - 1 ) { switch ( code ) { case ' ' : throw new CommandException ( "Option requires an argument: " + args [ getopt . getOptind ( ) - 1 ] ) ; case ' ' : throw new CommandException ( "Invalid (or ambiguous) option: " + args [ getopt . getOptind ( ) - 1 ] ) ; //CONF PART
 //			case 't':
 //				this.profileTableName = getopt.getOptarg();
 //				break;
 //			case 'p':
 //				this.profileName = getopt.getOptarg();
 //				break;
 // OPERATION PART
 case 0x1000 : break ; case 1 : //non opt args, table and profile name(maybe)
 switch ( nonOptArgIndex ) { case 0 : profileTableName = getopt . getOptarg ( ) ; nonOptArgIndex ++ ; break ; case 1 : profileName = getopt . getOptarg ( ) ; nonOptArgIndex ++ ; break ; default : throw new CommandException ( "Command: \"" + getName ( ) + "\" expects at most two non opt arguments!" ) ; } break ; case ' ' : //list
 super . operation = new ListOperation ( super . context , super . log , this ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //extlist
 super . operation = new ExtListOperation ( super . context , super . log , this ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //dirt
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "isProfileDirty" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //write
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "isProfileWriteable" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //edit
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "editProfile" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //commit
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "commitProfile" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //restore
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "restoreProfile" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //close
 super . operation = new SimpleInvokeOperation ( super . context , super . log , this , "closeProfile" ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //get
 super . operation = new GetAttributeOperation ( super . context , super . log , this ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; case ' ' : //set
 super . operation = new SetAttributeOperation ( super . context , super . log , this ) ; prepareCommand ( ) ; super . operation . buildOperation ( getopt , args ) ; break ; //			case 'b':
 //				//bussines
 //				super.operation = new BussinesMethodOperation(super.context, super.log, this);
 //				super.operation.buildOperation(getopt, args);
 //				break;	
 default : throw new CommandException ( "Command: \"" + getName ( ) + "\", found unexpected opt: " + args [ getopt . getOptind ( ) - 1 ] ) ; } } }
/* (non-Javadoc)
@see org.mobicents.tools.twiddle.AbstractSleeCommand#processArguments(java.lang.String[])
/ * ( non - Javadoc )