Category Archives: aries

spi-fly weaving methods with parameters

When using apache aries for enable spi-fly I cant call the mehtods with parameters for dynamic weaving. Following is the bundle list I've used.

org.apache.aries.spifly.dynamic.bundle-1.0.2.jar asm-all-5.0.4.jar org.apache.aries.util-1.1.1.jar

and following headers in my pom.xml in maven bundle plugin

<SPI-Consumer>org.apache.aries.spifly.examples.client2.impl.Activator#getSpiProvider(java.lang.String, java.lang.String)</SPI-Consumer>

<SPI-Provider>org.apache.aries.spifly.examples.client2.impl.Activator</SPI-Provider>

I tried to read /META-INF/services/org.apache.aries.spifly.mysvc.SPIProvider

public static SPIProvider getSpiProvider(final String factoryId, final String fallbackClassName){

        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();

        String serviceId = "META-INF/services/" + "org.apache.aries.spifly.mysvc.SPIProvider";
        URL r = Thread.currentThread().getContextClassLoader().getResource(serviceId);
        System.out.println("*** Found resource: " + r);
        System.out.println("*** First line of content: " + new BufferedReader(new InputStreamReader(r.openStream())).readLine());
 
        //return null for the moment
        return null;

    }

If I remove the parameters from the getSpiProvider method and change the SPI-Consumer to the following maven-bundle-plugin entry in pom.xml

<SPI-Consumer>org.apache.aries.spifly.examples.client2.impl.Activator#getSpiProvider()</SPI-Consumer>

Any idea what went wrong here?. Can't we use methods with parameters for weaving?