src/main/java/de/vandermeer/execs/ExecS.java
protected int executeApplication(Object svc, String[] args, String orig){
		if(svc!=null && (svc instanceof ExecS_Application)){
			if(svc instanceof Gen_RunScripts){
				//hook for GenRunScripts to get current class map - registered applications
				((Gen_RunScripts)svc).setClassMap(this.classmap);
			}
			if(svc instanceof Gen_ExecJarScripts){
				//hook for Gen_ExecJarScripts to get current class map - registered applications
				((Gen_ExecJarScripts)svc).setClassMap(this.classmap);
			}
			return ((ExecS_Application)svc).executeApplication(ArrayUtils.remove(args, 0));
		}
		else if(svc==null){
			System.err.println("could not create object for class or application name <" + orig + ">");
			return -1;
		}
		else if(!(svc instanceof ExecS_Application)){
			System.err.println("given class or application name <" + orig + "> is not instance of " + ExecS_Application.class.getName());
			return -2;
		}
		else{
			System.err.println("unexpected error processing for class or application name <" + orig + ">");
			return -3;
		}
	}
protected int executeApplication(Object svc, String[] args, String orig){
		if(svc!=null && (svc instanceof ExecS_Application)){
			if(svc instanceof Gen_RunScripts){
				//hook for GenRunScripts to get current class map - registered applications
				((Gen_RunScripts)svc).setClassMap(this.classmap);
			}
			if(svc instanceof Gen_ExecJarScripts){
				//hook for Gen_ExecJarScripts to get current class map - registered applications
				((Gen_ExecJarScripts)svc).setClassMap(this.classmap);
			}
			return ((ExecS_Application)svc).executeApplication(ArrayUtils.remove(args, 0));
		}
		else if(svc==null){
			System.err.println("could not create object for class or application name <" + orig + ">");
			return -1;
		}
		else if(!(svc instanceof ExecS_Application)){
			System.err.println("given class or application name <" + orig + "> is not instance of " + ExecS_Application.class.getName());
			return -2;
		}
		else{
			System.err.println("unexpected error processing for class or application name <" + orig + ">");
			return -3;
		}
	}
protected int executeApplication ( Object svc , String [ ] args , String orig ) { if ( svc != null && ( svc instanceof ExecS_Application ) ) { if ( svc instanceof Gen_RunScripts ) { //hook for GenRunScripts to get current class map - registered applications ( ( Gen_RunScripts ) svc ) . setClassMap ( this . classmap ) ; } if ( svc instanceof Gen_ExecJarScripts ) { //hook for Gen_ExecJarScripts to get current class map - registered applications ( ( Gen_ExecJarScripts ) svc ) . setClassMap ( this . classmap ) ; } return ( ( ExecS_Application ) svc ) . executeApplication ( ArrayUtils . remove ( args , 0 ) ) ; } else if ( svc == null ) { System . err . println ( "could not create object for class or application name <" + orig + ">" ) ; return - 1 ; } else if ( ! ( svc instanceof ExecS_Application ) ) { System . err . println ( "given class or application name <" + orig + "> is not instance of " + ExecS_Application . class . getName ( ) ) ; return - 2 ; } else { System . err . println ( "unexpected error processing for class or application name <" + orig + ">" ) ; return - 3 ; } }
Executes an application.
@param svc the application, must not be null
@param args original command line arguments
@param orig the original name or class for the application for error messages
@return 0 on success, other than zero on failure (including failure of the executed application)
Executes an application .