Skip to main content
Jump to: navigation, search

Difference between revisions of "Riena/Getting Started with stages"

(Getting Started with Stages)
(Getting Started with Stages)
Line 6: Line 6:
  
 
While developing for example a URL for a remote service might look like:
 
While developing for example a URL for a remote service might look like:
 +
<pre>
 
http://localhost:8080/hessian/HelloWorldServiceWS
 
http://localhost:8080/hessian/HelloWorldServiceWS
 
another is
 
another is
 
http://localhost:8080/hessian/CustomerSearchWS
 
http://localhost:8080/hessian/CustomerSearchWS
 +
</pre>
 
and so on.
 
and so on.
 
Within our test environment they become:
 
Within our test environment they become:
 +
<pre>
 
http://your.inhouse.server:80/hessian/HelloWorldServiceWS
 
http://your.inhouse.server:80/hessian/HelloWorldServiceWS
 
http://your.inhouse.server:80/hessian/CustomerSearchWS
 
http://your.inhouse.server:80/hessian/CustomerSearchWS
 +
</pre>
 
and finally within production  
 
and finally within production  
 +
<pre>
 
https://your.prodhouse.server:80/hessian/HelloWorldServiceWS
 
https://your.prodhouse.server:80/hessian/HelloWorldServiceWS
 
https://your.prodhouse.server:80/hessian/CustomerSearchWS
 
https://your.prodhouse.server:80/hessian/CustomerSearchWS
 
+
</pre>
As you can see they have a lot in common. We could rewrite them with something like that:
+
As you can see they have a lot in common. We could rewrite them with something like that
 +
<pre>
 
${service_host}/hessian/HelloWorldServiceWS
 
${service_host}/hessian/HelloWorldServiceWS
 
${service_host}/hessian/CustomerSearchWS
 
${service_host}/hessian/CustomerSearchWS
 +
</pre>
 +
That looks cool.
  
 
+
===== StringVariableManager come to the rescue =====
 
+
=== StringVariableManager come to the rescue ===
+
 
Fortunately there is this great StringVariableManager within the bundle 'org.eclipse.core.variables'. One of things it can do is substituting variable expression within strings with their definition, e.g.
 
Fortunately there is this great StringVariableManager within the bundle 'org.eclipse.core.variables'. One of things it can do is substituting variable expression within strings with their definition, e.g.
 
<pre>
 
<pre>
 
"This is a ${what} bundle."  would become  "This is a great bundle."  with the definition: what := "great"
 
"This is a ${what} bundle."  would become  "This is a great bundle."  with the definition: what := "great"
 
</pre>
 
</pre>
The StringVariableManager can be configured programmatically via its API but more useful in our case by extensions.
+
The StringVariableManager can be configured programmatically via its API but more useful in our case by extensions, i.e. we can define variables e.g. with such an expression
 +
<pre>
 +
<extension point="org.eclipse.core.variables.valueVariables">
 +
<variable
 +
description="Name of the host to connect to"
 +
name="service_host"
 +
readOnly="true"
 +
initialValue="http://localhost:8080"/>
 +
</extension>
 +
</pre>
 +
===== Putting it together =====
 +
Riena performs such string substitutions within
 +
* all definitions for remote services
 +
* all extensions that get injected with Riena´s extension injector [[Link title]]
  
 +
To be continued!
  
  
 
[[Category:Riena]]
 
[[Category:Riena]]

Revision as of 09:56, 20 October 2008

Getting Started with Stages

Developing, integrating, testing, running and maintaining large client/server applications typically involve diverse setups. Stages are Riena´s approach to deal with that. Stages are a concept - not a service or a set classes.

All the different setups of servers and clients are almost identical (and that´s what they should). However, there is a small amount of - ermm - stuff (!) that is different. Basically, this mostly boils down to strings that are different e.g. within URLs (e.g. remote service locations) or other data that gets configured with extensions.

While developing for example a URL for a remote service might look like:

http://localhost:8080/hessian/HelloWorldServiceWS
another is
http://localhost:8080/hessian/CustomerSearchWS

and so on. Within our test environment they become:

http://your.inhouse.server:80/hessian/HelloWorldServiceWS
http://your.inhouse.server:80/hessian/CustomerSearchWS

and finally within production

https://your.prodhouse.server:80/hessian/HelloWorldServiceWS
https://your.prodhouse.server:80/hessian/CustomerSearchWS

As you can see they have a lot in common. We could rewrite them with something like that

${service_host}/hessian/HelloWorldServiceWS
${service_host}/hessian/CustomerSearchWS

That looks cool.

StringVariableManager come to the rescue

Fortunately there is this great StringVariableManager within the bundle 'org.eclipse.core.variables'. One of things it can do is substituting variable expression within strings with their definition, e.g.

"This is a ${what} bundle."  would become   "This is a great bundle."  with the definition: what := "great"

The StringVariableManager can be configured programmatically via its API but more useful in our case by extensions, i.e. we can define variables e.g. with such an expression

<extension point="org.eclipse.core.variables.valueVariables">
	<variable
		description="Name of the host to connect to"
		name="service_host"
		readOnly="true"
		initialValue="http://localhost:8080"/>
</extension>
Putting it together

Riena performs such string substitutions within

  • all definitions for remote services
  • all extensions that get injected with Riena´s extension injector Link title

To be continued!

Copyright © Eclipse Foundation, Inc. All Rights Reserved.