07 November 2007

Application Supplied System Properties

We added a feature in the 10.1.3.1 release which enables an application to supply its own set of System properties, which are added and removed to the global System property set as the application is started and stopped. The documentation for it is not extensive, but there's a how-to on OTN which walks through the use of it.

Check it out on OTN.

The System properties (name, value) are defined in the orion-application.xml descriptor provided with the application.

<orion-application>
<property name="application.tax.rate" value="10" />
<property name="application.tax.code" value="AU" />
</orion-application>
During deployment with ASC, the deployment plan editor can be used to view the set of specified System properties in the application. It can also be used to add, remove, edit the defined properties so they can be tailored to the specific deployment being performed.

05 November 2007

Run a Coherence Cache Server from JDeveloper

I was working on a Coherence based handson lab for the upcoming Open World conference last week. The lab configures Coherence to use a JPA based CacheStore to store/load cache entries into/from a database.

The labs are all based around an Ant script that runs the lab code, plus the Cache Servers. But one handy thing that could have been documented in the labs is the ability to run a Cache Server(s) directly from JDeveloper using its "Run Manager".

Here's how it works:

1. Have a project set up which has the Coherence JAR files added as a library.

2. Create a new Run Configuration for your Cache Server.

3. In the "Default Run Target" field enter:

C:\coherence-ejb3\coherence\lib\tangosol.jar!\com\tangosol\net\DefaultCacheServer.class

4. Specify any additional JVM or Coherence properties as desired.

Click save and you're done.



Now to run a Cache Server, simply select your Cache Server run target from the list and the Cache Server will start. A log window will open up showing the output from the Cache Server. The process running the Cache Server will be shown in the Process Manager window.



The other Run Configuration I found helpful was to launch the Console that comes with Coherence. This little application is a cache client, and allows you to interactively perform operations against the cache. Handy to quickly see the size of a cache or list out some elements from the cache to see that its containing the expected data objects.

To run this Coherence application, you create a new Run Configuration as above, except specifying the Default Run Target as:

C:\coherence-ejb3\coherence\lib\coherence.jar!\com\tangosol\coherence\component\application\Console.class



Since the Coherence console is an interactive application, one extra little step you need to do here is to enable "Allow Program Input" for this running process.

In the Run Configuration dialog, select the "Tool Settings" node and then check the "Allow Program Input" option.



Save the entry and execute it. You should then the Coherence Console application fire up and prompt for your command in the "Input: [ ]" field.