public static Map < String , Application > getApplicationsFromClassPath ( final String _application , final List < String > _classpath ) throws InstallationException { final Map < String , Application > appls = new HashMap <> ( ) ; try { final ClassLoader parent = Application . class . getClassLoader ( ) ; final List < URL > urls = new ArrayList <> ( ) ; for ( final String pathElement : _classpath ) { urls . add ( new File ( pathElement ) . toURI ( ) . toURL ( ) ) ; } final URLClassLoader cl = URLClassLoader . newInstance ( urls . toArray ( new URL [ urls . size ( ) ] ) , parent ) ; // get install application (read from all install xml files) final Enumeration < URL > urlEnum = cl . getResources ( "META-INF/efaps/install.xml" ) ; while ( urlEnum . hasMoreElements ( ) ) { // TODO: why class path? final URL url = urlEnum . nextElement ( ) ; final Application appl = Application . getApplication ( url , new URL ( url , "../../../" ) , _classpath ) ; appls . put ( appl . getApplication ( ) , appl ) ; } } catch ( final IOException e ) { throw new InstallationException ( "Could not access the install.xml file " + "(in path META-INF/efaps/ path of each eFaps install jar)." , e ) ; } return appls ; }
Method to get all applications from the class path .