Hi Brett,

I've tried both approaches (jaxp.properties and using META-INF/services). I
assume that jaxp.properties runtime implementation replacement for SAX
parsers is also using SPI internally.

Thanks,
Sergey

On Tue, Apr 14, 2015 at 9:39 PM, Brett Randall <javabr...@gmail.com> wrote:

> Hi Sergey,
>
> You mention that you want to use a service-provider pattern (Services API?
> - per the JAR specification?) but you describe using jaxp.properties.  Have
> your tried including a META-INF/services/org.xml.sax.driver or
> META-INF/services/javax.xml.transform.TransformerFactory in your project?
> It is possible that this approach classloads slightly differently to
> jaxp.properties, and the AspectJ load-time weaver instrumentation might
> work with this approach.  I have not tried this.
>
> Best
> Brett
>
> On 14 April 2015 at 09:29, Sergey Gorbaty <sergey.gorb...@salesforce.com>
> wrote:
>
>> In my Java application I'm using a custom xml parser implementation that
>> is
>> loaded by Java runtime using service provider pattern. E.g. I specify in
>> jaxp.properties:
>> javax.xml.parsers.SAXParserFactory=org.my.parser.MyCustomParserFactory.
>>
>> This allows me to keep existing code below but use a different
>> implementation at runtime.
>> XMLReader xr = XMLReaderFactory.newXMLReader();
>>
>> In my case xr becomes an instance of org.my.parser.MyCustomParser.
>>
>> In my Aspect I declare MyCustomParser to be of a certain type, which adds
>> an
>> additional object for tracking to each XMLReader instance.  Like so:
>>
>> declare parents: org.my.parser.MyCustomParser implements Markable;
>>
>> This effectively works on any class at runtime except on the objects
>> loaded
>> by Java using service provider pattern. Has anyone come across this?
>>
>> AJ 1.8.4 with Java 7.
>>
>> -Sergey
>>
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@eclipse.org
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>>
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>



-- 
-Sergey
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to