77
77
import com.eucalyptus.util.BaseDirectory;
78
78
import com.eucalyptus.util.EucalyptusProperties;
79
79
import com.eucalyptus.util.LogUtil;
80
import com.eucalyptus.util.ServiceJarFile;
81
80
import com.google.common.collect.Lists;
82
81
import com.google.common.collect.Multimap;
83
82
import com.google.common.collect.Multimaps;
109
public static void initBootstrappers( ) {
108
public static void initDiscovery( ) {
110
109
File libDir = new File( BaseDirectory.LIB.toString( ) );
111
110
for ( File f : libDir.listFiles( ) ) {
112
111
if ( f.getName( ).startsWith( Component.eucalyptus.name() ) && f.getName( ).endsWith( ".jar" ) && !f.getName( ).matches( ".*-ext-.*" ) ) {
113
112
LOG.debug( "Found eucalyptus component jar: " + f.getName( ) );
116
jar = new ServiceJarFile( f );
114
ServiceJarDiscovery.processFile( f );
117
115
} catch ( IOException e ) {
118
116
LOG.error( e.getMessage( ) );
121
List<Bootstrapper> bsList = jar.getBootstrappers( );
122
for ( Bootstrapper bootstrap : bsList ) {
123
for ( Resource r : Resource.values( ) ) {
124
if ( r.providedBy( bootstrap.getClass( ) ) || Resource.Final.equals( r ) ) {
125
Provides provides = bootstrap.getClass( ).getAnnotation( Provides.class );
126
if( provides == null ) {
127
LOG.info( "-X Skipping bootstrapper " + bootstrap.getClass( ).getSimpleName( ) + " since Provides is not specified." );
129
Component component = provides.component( );
130
if ( component != null && !component.isEnabled( ) ) {
131
LOG.info( "-X Skipping bootstrapper " + bootstrap.getClass( ).getSimpleName( ) + " since Provides.component=" + component.toString( ) + " is disabled." );
134
if ( checkDepends( bootstrap ) ) {
137
} catch ( Throwable e ) {
139
for( Bootstrapper exists : r.getBootstrappers( ) ) {
140
if( exists.equals( bootstrap ) ) {
141
LOG.fatal( "Duplicate bootstrapper registration: " + exists.getClass( ) +
142
"\n==> Old definition source: " + exists.getClass( ).getProtectionDomain( ).getCodeSource( ).getLocation( ).getPath( ) +
143
"\n==> New definition source: " + f.getAbsolutePath( ) );
148
LOG.info( "-> Associated bootstrapper " + bootstrap.getClass( ).getSimpleName( ) + " with resource " + r.toString( ) + "." );
121
ServiceJarDiscovery.runDiscovery( );
124
public static void initBootstrappers( ) {
125
for ( Bootstrapper bootstrap : BootstrapperDiscovery.getBootstrappers( ) ) {
126
for ( Resource r : Resource.values( ) ) {
127
if ( r.providedBy( bootstrap.getClass( ) ) || Resource.Final.equals( r ) ) {
128
Provides provides = bootstrap.getClass( ).getAnnotation( Provides.class );
129
if ( provides == null ) {
130
LOG.info( "-X Skipping bootstrapper " + bootstrap.getClass( ).getSimpleName( ) + " since Provides is not specified." );
132
Component component = provides.component( );
133
if ( component != null && !component.isEnabled( ) ) {
134
LOG.info( "-X Skipping bootstrapper " + bootstrap.getClass( ).getSimpleName( ) + " since Provides.component=" + component.toString( )
138
if ( checkDepends( bootstrap ) ) {
141
} catch ( Throwable e ) {
145
LOG.info( "-> Associated bootstrapper " + bootstrap.getClass( ).getSimpleName( ) + " with resource " + r.toString( ) + "." );
157
} catch (IOException e) {