anatole tresch werner keil
play

Anatole Tresch & Werner Keil Trivadis AG @atsticks - PowerPoint PPT Presentation

Anatole Tresch & Werner Keil Trivadis AG @atsticks @wernerkeil Apache T amaya Configuration Management Bio Anatole Tresch Principal Consultant, Trivadis AG (Switzerland) Star Spec Lead JSR 354 Technical


  1. Anatole Tresch & Werner Keil Trivadis AG @atsticks @wernerkeil

  2. Apache T amaya Configuration Management

  3. Bio Anatole Tresch ● Principal Consultant, Trivadis AG (Switzerland) ● Star Spec Lead JSR 354 ● Technical Architect, Lead Engineer ● PPMC Member Apache Tamaya ● Twitter/Google+: @atsticks ● anatole@apache.org ● anatole.tresch@trivadis.com ● JUG Switzerland, Zurich Java Community 3

  4. Bio Werner Keil ● Consultant – Coach ● Creative Cosmopolitan ● Open Source Evangelist ● Software Architect ● JCP EC Member ● Tamaya Committer ● Java EE | DevOps Guy … ● Twitter/Google+: @wernerkeil ● wkeil@apache.org 4

  5. Agenda ● General Infos ● What is Configuration? ● Use Cases ● Apache Tamaya ● Core Concepts ● Extensions ● Outlook 5

  6. General Infos 6

  7. History of Apache Tamaya ● 2012 : Configuration was voted an important aspect for Java EE 8 ● 2013 : ● Setup of Java EE Configuration JSR failed ● Standardization on SE Level did not have enough momentum ● BUT : ● Configuration is a crucial cross cutting concern ● There is no (really NO!) defacto standard ● Reinventing the wheel is daily business 7

  8. The People behind Tamaya • John D. Ament (Mentor) • David Blevins (Champion) • Werner Keil • Gerhard Petracek (Mentor) • Mark Struberg (Mentor) • Anatole Tresch • Oliver B. Fischer • ... • 8 •

  9. The Objectives of Apache Tamaya ● Define a common API for accessing configuration ● Minimalistic, also fits into ME ● Flexible, pluggable and extendible design ● support functional programming style ● Be compatible with Java 7 and beyond ● Provide a reference implementation ● Provide Extension Modules for Additional Features ● If possible, create a Standard! • • 9

  10. What is Configuration?

  11. What people think is configuration? ● Many different interested stakeholders ● Many things to configure ● Divergent views ● Setup for a server environment ● Parameters of a runtime (staging, localization etc.) ● Deployment descriptors ● Technology-specific components (beans, wirings etc.) ● Resource-specific settings (data sources, message queues etc.) ● Dynamic scripting facility, Different scopes (global, ear, app, …) ● Different granularities, varying levels of applicability, Different formats … 11

  12. What we think is configuration Component Y Configuration <dependency> Configuration : Components : <dependency>  Data, Value Types  Behaviour and state  Transitive Deps  Transitive Deps  Scopes Component X  Scopes  Key, value pairs  Code  Static  Dynamic  Serializable  Not serializalbe 12

  13. Use Cases

  14. UC: Access Configuration Similarly MicroService PaaS Build-Tool Cache SaaS Container IaaS API API Configuration ● Any Location SPI ● Any Format ● Any Policy 14

  15. UC: Reduce Redundancy File 1 Cache Configuration : Cache Configuration : Tamaya Cache.host.ip= 192.168.1.10 Tamaya Cache.host.ip= ${env:HOST_IP} Cache Cache.stage= test Configuration Cache.stage= ${env:STAGE} Configuration Cache.param=cacheValue Cache.param=cacheValue Redundant! File 2 Foo Configuration : Foo Configuration : Tamaya Service.host.ip= ${env:HOST_IP} Tamaya Service.host.ip= 192.168.1.10 Configuration Service.stage= ${env:STAGE} Service Foo Service.stage= test Configuration Service.param=paramValue Service.param=paramValue 15

  16. UC: Convention over Configuration Defaults : env.host.ip= ${env:HOST_IP} env.stage=$ {env:STAGE} Cache Configuration : Cache.host.ip= ${cfg:env.host.ip} Tamaya Cache Cache.stage=$ {cfg:env.stage} Configuration Cache.param=cacheValue Foo Configuration : Tamaya Service.host.ip= ${cfg:env.host.ip} Service Foo Configuration Service.stage=$ {cfg:env.stage} Service.param=paramValue 16

  17. UC: Pluggable Config Backends Your Project Unified Config API  Unified API for Tamaya Configuration configuration access Classic Policy Remote Policy (PropertySources) (PropertySources)  Policies can be provided as jar- artifacts separately ??? Classic: Distributed: ZooKeeper Myproject/bin/...  Additional Etcd Myproject/conf/server.xml ... benefits: config Myproject/conf/cluster.xml documentation Myproject/conf/security.xml Myproject/lib/... ... 17

  18. UC: Enterprise Integration Your Project Unified Config API Tamaya Configuration Classic Policy Config Integration (PropertySources) (PropertySources) Myproject/bin/... Company X: Company Z: Myproject/conf/server.xml Config SOAP Config Rest Myproject/conf/cluster.xml Myproject/conf/security.xml Company Y: Company A: Myproject/lib/... etcd Legacy Config ... 18

  19. UC: Enforceable Policies Define, implement and distribute Company Wide Configuration Policy Config Policy Locations :  file:${filedir} Tamaya  classpath:META-INF/defaults/ Configuration Cache configuration.*  classpath:META-INF/${STAGE}/ <implements> Policy configuration.*  url:http://myserver.int/cfg  System properties  Env. Properties Tamaya Formats : Service Configuration  properties Foo <implements>  xml Policy  json  yaml 19

  20. Summary: Why we need Tamaya? ● Reinventing the wheel is daily business, leading to ● Higher Efforts in Enterprise Integration ● Configuration Redundancies and Inconsistencies ● Unclear or Complex Handling when remote Configuration should be supported as well ● Make Projects Integration Raedy with Company Infrastructure ● Make your Configuration Backends Pluggable 20

  21. The API 21

  22. Let's start simple! ● Add dependency org.apache.tamaya:core:1.0-incubating ● Add Config to META-INF/javaconfiguration.properties ● Use it! Configuration config = ConfigurationProvider. getConfiguration (); String name = config.getOrDefault( "name", "John" ); int ChildNum = config.get( "childNum", int .class ); 22

  23. ConfigurationProvider public class ConfigurationProvider{ public static Configuration getConfiguration(); public static ConfigurationContext getConfigurationContext(); public static ConfigurationContextBuilder getConfigurationContextBuilder() public static void setConfigurationContext( ConfigurationContext context); } 23

  24. Configuration public interface Configuration{ String get(String key); String getOrDefault(String key, String defaultValue); <T> T get(String key, Class<T> type); <T> T get(String key, TypeLiteral<T> type); <T> T getOrDefault(String key, Class<T> type, T defaultValue); <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue); Map<String,String> getProperties(); // Functional Extension Points Configuration with(ConfigOperator operator): <T> T query(ConfigQuery<T> query); } 24

  25. Core Concepts ● Configuration provides properties Configuration ● built up by an ordered list of ConfigurationContext PropertySources e r P r o p e r t y C o n v e r t ● SPI PropertyFilters PropertyProviders ● PropertyConverter CombinationPolicy <provides> ● CombinationPolicy PropertySource ● PropertyFilter PropertySource ● Extensions (discussed later) PropertySource PropertySource 25

  26. Overriding Basics #default ordinal = 0 name=Benjamin childNum=0 tamaya.ordinal=10 family=Tresch name=Anatole #override ordinal childNum=3 tamaya.ordinal = 10 family=Tresch name=Anatole childNum=3 26

  27. CombinationPolicy list=a,b,c list{collection-type}=List tamaya.ordinal=10 list=aa,bb,a,b,c list{collection-type}=List tamaya.ordinal = 10 list=aa,bb 27

  28. SPI: PropertySource PropertySourceProvider public interface PropertySource { static final String TAMAYA_ORDINAL = "tamaya.ordinal"; String getName(); int getOrdinal(); String get(String key); Map<String, String> getProperties(); } public interface PropertySourceProvider { Collection<PropertySource> getPropertySources(); }

  29. Extension Modules 29

  30. Available Plugins • Tamaya-inject: Configuration Injection and Templates • Tamaya-resolver: Expression resolution, placeholders, dynamic values • Tamaya-resources: Ant styled resource resolution • Tamaya-format : Abstraction of a format, separating parsing from semantic mapping to configuration • Format Extensions: yaml*, json, ini, ... • Tamaya-spring : Integration with Spring • Tamaya-classloader-support: Managing Tamaya Services within Classloading Hierarchies • Tamaya-cdi: Integration with CDI • Tamaya-server: REST/JSON Configuration Server • Tamaya-remote : Client PropertySource matching server component * work in progress • Tamaya-docs* : Configuration Documentation 30

  31. Planned Features ● Java EE: Configuring EE, where possible ● Karaf Integration ● Source Integrations: ● Commons-config ● Etcd ● Zookeeper ● ... ● Runtime Integrations: ● ??? 31

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend