Bee Config reaches beta release

[b][url=/bee-config]Bee Config[/url][/b], the simple Scala API for loading configuration files, has needed very few changes over the last few months and is now in preparation for full release. It is feature-complete and mostly ready for production use. It now has a Maven/Ivy repository for automatic dependency. If no significant changes are needed during December, the first release candidate will be announced in a few weeks.

Bee Config is now at v1.4.0

Version 1.4.0 of Bee Config is now available. This follows two enhancements. Firstly, the reloader tool has been improved. Secondly, it is now possible to wrap a config and register it as a JMX bean, allowing a configuration to be accessed and modified by standard JVM tools whilst the program is running.

Bee Client is now at v0.22.4

Version 0.22.4 of Bee Client is now available. This is a bugfix release. Unclean handling of non-textual content has been tidied up. Status equals method has been changed to behave more intuitively, comparing only the status code now. History of commits

Bee Client is now at v0.22.6

Version 0.22.6 of Bee Client is now available. This brings some minor feature enhancements. Small improvements to the following classes: Status, Domain, Href, Path History of commits

Bee Client is now at v0.22.8

Version 0.22.8 of Bee Client is now available. This brings some minor API changes; the corresponding old API is now deprecated. Small alterations to the following constants: CookieJar.Empty, CredentialSuite.Empty The old names (CookieJar.empty and CredentialSuite.empty) should be replaced with the new names with capital ‘E’. History of commits

Bee client is now at v0.23.1

Version 0.23.1 of Bee Client is now available. This brings some minor API changes; RequestBody now implements equals and hashCode methods appropriately according to its implemention subclasses. MediaType.contentType field has been renamed to mainType to reflect its purpose more correctly. (It would be possible to use type but this wasn’t adopted because of the inconsistency this introduces into source code at usage sites, vs the subType field.) History of commits

Bee Client is now at v0.24.0

Version 0.24.0 of Bee Client is now available. This brings one API change. Config now has a proxy field that is optional. The old apply signature is still available as a deprecated factory method, but you should upgrade your code to use the optionality. The meaning of the proxy field is thus: when some proxy is supplied, this is used for all requests made using this configuration when None is supplied, the standard JVM DefaultProxySelector operates and this means that the standard command-line flags are used when Some(Proxy.

Bee Client is now at v0.24.1

Version 0.24.1 of Bee Client is now available. This brings one API change. Config now has methods to make SSL connections operate in an insecure mode. This is intended for specialised purposes, e.g. code development, only. More information: Making proxied requests History of commits

Bee Client is now at v0.26.4

Version 0.26.4 of Bee Client is now available. This brings bugfixes to cookie handling: issue 22 cookie exipry, and issue 23 cookie domain matching Also, work is under way to provide client-side caching, following HTTP practice. This is not yet ready and will feature in a future release. History of commits

Bee Client is now at v0.26.6

Version 0.26.6 of Bee Client is now available. This brings a bugfix to date handling: issue 24 two-digit year Also, work to provide client-side caching, following HTTP practice, is nearly ready and a new version including it is to be expected soon. History of commits

Bee Config is now at v1.4.2

Version 1.4.2 of Bee Config is now available. This is a bugfix release. ConfigSource now has a canBeOpened method. SourceChangeDetector has been simplified by using the canBeOpened logic. ConfigSource has been modified to ensure that the counter is always updated. History of commits

Bee Config is now at v1.5.0

Version 1.5.0 of Bee Config is now available. This brings full Java support, whilst carrying forward the excellent Scala api. In previous versions, file i/o, parsing and config manipulation were all written in Scala, which was less easy to use from Java programs. Now, a new ConfigJ class in Java emulates the Config class in Scala. The Java parser is shared by both. The file i/o and parsing have been back-ported to Java, although this will not be evident in existing Scala programs (unless they happen to use the underlying utility classes explicitly).

Bee Config is now at v1.5.3

Version 1.5.3 of Bee Config is now available. This brings JavaBean integration, a new feature for those who would like easy configuration files combined with pojos with typed properties. The new feature allows you to load your Config from a file (or wherever) as normal, then use it to populate JavaBeans, which may themselves contain further JavaBeans. You can create your own JavaBean and pass it in. Or you can specify the class of the bean and it will be created reflectively for you.

Bee Config is now at v1.5.5

Version 1.5.5 of Bee Config is now available. This includes a small bugfix in the DimensionedValue class, which now treats kilograms (kg) as a special case. Previous announcement: v1.5.4 History of commits

Communicating Process Architectures - CPA2014 Conference Summary

The CPA2014 conference held in Oxford over the last few days brought together an interesting group of around three dozen experts in the field of communicating process architectures. Discussions were on concurrency and parallelism topics, both theoretical and practical, in areas related to communicating process architectures (CPA). Also known as process-oriented programming, CPA is about both concurrency (the natural expression of things that are happening alongside each other) and parallelism (the physical execution of many parts of a program at the same time) by means of process algebra formalisms and CSP in particular.

Wrestling With Concurrency - Scala Exchange 2012

I was very fortunate to join the London Scala Exchange conference over the last two days. A good range of quality talks were offered - some thought provoking, some highly entertaining. And most wrestled to some extent with concurrency. It seems that Scala is not yet at ease with itself in its concurrency model. The root of the issue is the JVM: threads are very expensive and limited to small numbers (say, 30).

Dispatch HTTP Critique

Dispatch is a library for asynchronous HTTP interaction. It provides a Scala vocabulary for Java’s async-http-client. It is apparently popular and crops up as a transitive dependency of several other popular Scala products. So it can’t be all bad. However, a recent project of ours had an unhappy experience with it. Disclaimer I’ll say at the outset that there is an alternative HTTP client of my own. So I’m biased.

Is Blocking Evil?

A recurring theme amongst Scala enthusiasts is the assertion that blocking is evil. Indeed at a recent conference more than one speaker had a slide on the screen with those words. I’ve been pondering the evil of blocking ever since. Is it always true? is it ever true even? The argument in favour of non-blocking I/O is an easy one: each JVM thread that’s blocked because it’s waiting for I/O cannot get on with something else useful instead.

Bee Config - simple, compelling replacement for Properties in Scala

The new Bee Config API provides an alternative to using java.util.Properties in Scala programs. The API provides a very simple Scala API for loading configuration files. Simplicity is the key! Often, java.util.Properties is still used in Scala applications, but it is often unsatisfactory. This API is broadly similar in intent, but pimped to work well in Scala. Features Config files are like properties files, except they are always Unicode.

Is Scala Good For the Enterprise Yet?

Can decision-makers realistically steer their development projects from Java to Scala yet, or is it too early?  Clearly, such a transition is not without risk.  Have the benefits now stacked up to outweigh the risks? An excellent blog post by Jim McBeath discusses the pros and cons in an objective way.  This is well worth reading. Paulo Vilella of Accenture added his views: “For small to medium projects, I believe Scala is right now a great alternative to Java for higher productivity and agility, without compromising on performance and compatibility.

Easy Pojos in Scala

A significant part of the lines of code in any enterprise Java application are devoted to plain old java objects (pojos) that carry data. Although they are simple, they represent a non-trivial effort in development and testing. And they make an application resistant to change because often a small change requires alteration of code in several places. Pojos written in Scala are so simple that the value of mixing Scala into Java development becomes worth the extra startup effort.

Move over Java, Scala has arrived!

Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages. It is also fully interoperable with Java. Code sizes are typically reduced by a factor of two to three when compared to an equivalent Java application. Scala - The New Kid on the Block Actually not so very new, Scala was initially developed during 2001 - 2003.


© Copyright 2012 Rick Beton Published under The MIT License. The MIT License Copyright (c) 2012 Rick Beton <> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Release Notes

Thu, 20 Jun 2013 v1.4.0 Reloader enhanced to offer more robust multithreading support new SourceChangeDetector class hived off Reloader (it could be used for any file-based cache) Thu, 20 Jun 2013 v1.3.1 - New MutableConfig refactors out the parts of the JMX bean needed for mutability from the parts needed for JMX integration. Thu, 20 Jun 2013 v1.3.0 - added support for JMX (experimental): A Config instance can be inserted into a JMX MBean with operations that allow values to be queried and altered.

5. Reloading configuration changes

Config is loaded once only, when it is constructed. You can use Reloader to load changes on the fly if you want to. Reloader is constructed using a File or other source, and a max age in seconds import val reloader = Reloader(new File("src/test/resources/sample2.txt"), 10) Reloader wraps Config loading so that changes to the source can be reloaded dynamically. If the config file is edited whilst the application is running, the new values are loaded in.

4. Nesting and subsections

A Config subsection is itself a Config instance - it’s easy to group your keys therefore. Here’s a sample file we’ll be discussing: xx.a.z1 = alpha-xx xx.a.z2 = beta-xx xx.b.z3 = gamma-xx xx.b.z4 = delta-xx [yy] a.z1 = alpha-yy a.z2 = beta-yy [zz] a.z1 = alpha-zz a.z2 = beta-zz There are two ways to deal with sections and hierarchies of settings. Prefixes The crudest is simply by choosing a common prefix on all the keys in the group.

3. Accessing config values

Config extends ListMap, making it very easy to use. It assumed that you are familiar with Scala’s Map (and ListMap) collection classes. For clarity, the following examples have the explicit type declared on each val, which is not usually necessary in Scala. Here’s a sample file we’ll be discussing: a = something b = else easy = true tau = 6.2832 somewhen = 1979-05-27T07:32:00Z coronation = 1953-06-02 triangle = 3, 4, 5 actors = "\"Harry\", Daniel Radcliffe", "\"Ron\", Rupert Grint", "\"Hermione\", Emma Watson" timeout = 60s maxHeap = 2 GiB maxTemp = 90°C Simple Cases ∘ Load a string value directly.

2. Load your config file

Scala API Simply construct Config instances using the factory method. import val config = Config(new File("src/test/resources/sample1.txt")) You can create a new Config instance from a File or anything that provides an InputStream. Or use the Config.fromClasspath method to read a resource from the classpath. When constructing a Config, you can include another Config as a fallback source of default values; this too can have a fallback so a chain of any length of them is possible.

How to Use Bee Config

1. The Config File Writing your config file is easy. It’s like a java.util.Properties file except it must be Unicode (ISO-10646) encoding, not ISO-8859 or some such. Nowadays there are plenty of tools to transcode text files, notably uconv on Linux/Unix computers, various IDEs, native2ascii in the JDK tool suite may be useful in some cases. The config file may optionally start with a Unicode byte-order-mark (BOM) and this is required for automatic switching between UTF-8, UTF-16 and UTF-32.

How to Get Bee Config

Bintray Scala 2.11 Scala 2.10 Option 1: Maven / Ivy dependency Please use the Set Me Up link you’ll find on one of the ‘Download’ pages, above. Option 2: manual download Browse one of the ‘Download’ pages, above. Choose a version and navigate to the Files tab to find the jars. Download the jars and put them on your classpath. You need bee-config_1.X.X.jar and you may find the javadoc and source jars useful during development, too.

Bee Config - Java & Scala Configuration API

Bee Config provides a very simple Java and Scala API for loading configuration files. Config files become Maps Simplicity is the key! Still often used in Scala applications, java.util.Properties is rarely satisfactory. Bee Config is broadly similar in intent, but pimped to work well in Scala. Why is Bee Config different: well, Properties files are sooo 20th Century. We need something similar, something as simple but something refreshed. We need to move on from ASCII to Unicode.