Re: Contributing a Symbol Provider
Hi Daniel, No, your method is fine. I needed my method as I needed some properties accessible before I could start up the Registry, so this killed two birds with one stone. If you don't need the properties until after building the Registry, then you will be fine with the documented method. Richard On 28 July 2015 at 19:19, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hi, I've implemented a working solution using the method on this page: http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile I implemented a SymbolProvider, a buildFileSymbolProvider method and a contributeSymbolSource method. How is your method different from that one? Should I prefer your method? What will happen when I use my method? Regards, Daniel P. -Ursprüngliche Nachricht- Von: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] Gesendet: Dienstag, 28. Juli 2015 16:56 An: Tapestry users Betreff: Re: Contributing a Symbol Provider On Tue, 28 Jul 2015 10:31:55 -0300, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello, Hi! I want to provide additional configuration on startup to my Tapestry application. I want to store the additional configuration in a file containing lines key=value. I know I can contribute a symbol provider to load a file and access the symbols this way. But I can't find the documentation for - How to write a Symbol Provider Implement the SymbolProvider interface. It has a single method, String valueForSymbol(String symbolName). It should return a String if that implementation provides a value for that symbol name and null if not. - what method to write in the AppModule to contribute the Symbol Provider public static void contributeSymbolProvider(OrderedConfigurationSymbolProvider configuration) { configuration.add(MyProvider, new YourSymbolProviderImplementation(), before:*); } -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org -- Richard Kirby, Technical Director CAPDM Limited Direct phone: 0131 477 8629 Email: r...@capdm.com Website: www.capdm.com Registered in Scotland: SC168970 VAT: 682 846 983 Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK
Contributing a Symbol Provider
Hello, I want to provide additional configuration on startup to my Tapestry application. I want to store the additional configuration in a file containing lines key=value. I know I can contribute a symbol provider to load a file and access the symbols this way. But I can't find the documentation for - what method to write in the AppModule to contribute the Symbol Provider - How to write a Symbol Provider Can anyone help? Regards, Daniel P.
Re: Contributing a Symbol Provider
Hi Daniel, I use the following sort of code: SymbolProvider provider = new MySymbolProvider(File configFile); ContributionDef contribution = new org.apache.tapestry5.internal.SyntheticSymbolSourceContributionDef(MyConfig, provider, before:ApplicationDefaults); ... RegistryBuilder builder = new RegistryBuilder(); builder.add(new org.apache.tapestry5.internal.SyntheticModuleDef(contribution)); Note that I am using 2 internal package classes, so not guaranteed across Tapestry versions, but it does work for me. Richard On 28 July 2015 at 14:31, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello, I want to provide additional configuration on startup to my Tapestry application. I want to store the additional configuration in a file containing lines key=value. I know I can contribute a symbol provider to load a file and access the symbols this way. But I can't find the documentation for - what method to write in the AppModule to contribute the Symbol Provider - How to write a Symbol Provider Can anyone help? Regards, Daniel P. -- Richard Kirby, Technical Director CAPDM Limited Direct phone: 0131 477 8629 Email: r...@capdm.com Website: www.capdm.com Registered in Scotland: SC168970 VAT: 682 846 983 Registered address: 22 Forth Street, Edinburgh, EH1 3LH, UK
Re: Contributing a Symbol Provider
On Tue, 28 Jul 2015 10:31:55 -0300, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello, Hi! I want to provide additional configuration on startup to my Tapestry application. I want to store the additional configuration in a file containing lines key=value. I know I can contribute a symbol provider to load a file and access the symbols this way. But I can't find the documentation for - How to write a Symbol Provider Implement the SymbolProvider interface. It has a single method, String valueForSymbol(String symbolName). It should return a String if that implementation provides a value for that symbol name and null if not. - what method to write in the AppModule to contribute the Symbol Provider public static void contributeSymbolProvider(OrderedConfigurationSymbolProvider configuration) { configuration.add(MyProvider, new YourSymbolProviderImplementation(), before:*); } -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
AW: Contributing a Symbol Provider
Hi, I've implemented a working solution using the method on this page: http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile I implemented a SymbolProvider, a buildFileSymbolProvider method and a contributeSymbolSource method. How is your method different from that one? Should I prefer your method? What will happen when I use my method? Regards, Daniel P. -Ursprüngliche Nachricht- Von: Thiago H de Paula Figueiredo [mailto:thiag...@gmail.com] Gesendet: Dienstag, 28. Juli 2015 16:56 An: Tapestry users Betreff: Re: Contributing a Symbol Provider On Tue, 28 Jul 2015 10:31:55 -0300, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hello, Hi! I want to provide additional configuration on startup to my Tapestry application. I want to store the additional configuration in a file containing lines key=value. I know I can contribute a symbol provider to load a file and access the symbols this way. But I can't find the documentation for - How to write a Symbol Provider Implement the SymbolProvider interface. It has a single method, String valueForSymbol(String symbolName). It should return a String if that implementation provides a value for that symbol name and null if not. - what method to write in the AppModule to contribute the Symbol Provider public static void contributeSymbolProvider(OrderedConfigurationSymbolProvider configuration) { configuration.add(MyProvider, new YourSymbolProviderImplementation(), before:*); } -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: AW: Contributing a Symbol Provider
On Tue, 28 Jul 2015 15:19:33 -0300, Poggenpohl, Daniel daniel.poggenp...@isst.fraunhofer.de wrote: Hi, Hi! I've implemented a working solution using the method on this page: http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile I implemented a SymbolProvider, a buildFileSymbolProvider method and a contributeSymbolSource method. How is your method different from that one? The method is exactly the same: creating one SymbolSource implementation and contribute it to the SymbolSource distributed configuration. The URL above just provides two SymbolSource implementations based on property files and declares both as services, which is good but not a requirement for it to work, while I just provided a sketch on how to implement them and how to contribute them. -- Thiago H. de Paula Figueiredo Tapestry, Java and Hibernate consultant and developer http://machina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org