coherence-community / oracle-bedrock

Oracle Bedrock
Other
55 stars 31 forks source link

Introduce support for Java Expression Language #219

Closed brianoliver closed 8 years ago

brianoliver commented 9 years ago

Consider the scenario where a developer wants to set the hostname of a platform as a system property when realizing an application.

When they define the schema for the application they may not know, care or don't want to be bound to the actual platform. Furthermore the platform on which they want to realize the application may not yet be created.

The challenge we have at the moment is that we have no way of parameterizing system properties or for that matter Options, that may need to be resolved during realization time. This forces developers to a). make Schema's dependent on specific Platforms, which is against the underlying objectives of Schemas in the first place and b). define platforms before schemas, ie: "correctly order their code", when in reality it is not required.

eg:

Platform platform = ... ;
SomeSchema schema = new SomeSchema().setProperty("foo", platform.getFoo());

Instead we should be able to define the above Schema as follows;

SomeSchema schema = new SomeSchema().setProperty("foo", "${platform.foo}");

And then later when an application is realized with a Platform, the property "{$platform.foo}" is evaluated and injected.

This effectively removes the requirement for many specialized methods in Oracle Tools, particularly when dealing with Remote Platforms.

eg:

schema.setProperty("localhost.name", "${platform.hostname}");

NOTE: This also removes the requirement for the PlatformAware interface. See #218.

Ultimately we should provide support for both eager ($-based expressions) and lazy (#-based expression) evaluation. Eager evaluation would occur prior to an Application/Platform etc being realized. Lazy would occur (for Java applications only), after a Java Application was realized. eg: Once the JavaApplicationLauncher has started we could perform another pass of expression evaluation for lazily defined expressions in System Properties.

We could also use this for generating unique ports. eg:

schema.setProperty("connect.to", "${platform.availablePort}");
brianoliver commented 8 years ago

This issue was imported from JIRA ORACLETOOLS-219

brianoliver commented 9 years ago

Reported by @brianoliver

brianoliver commented 8 years ago

Marked as fixed by @brianoliver on Tuesday, January 26th 2016, 3:38:35 pm