Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Alternatives of Handling a Running Framework"

m (Alternatives of Handling a Running Fw moved to Alternatives of Handling a Running Framework)
(API names are renamed)
 
Line 1: Line 1:
 
==How to handle a running framework==
 
==How to handle a running framework==
This document is related with [[Equinox Framework Handler|FrameworkHandler]].
+
There is a need for manipulating configurations of not only a non-running framework but also a running framework. Other than [[Equinox_FrameworkAdmin#Current_our_proposal|what we propose]], there are several alternatives.
 
+
There is a need for manipulating configurations of not only a non-running fw but also a running fw. Other than [[Equinox_Framework_Handler#Current_our_proposal|what we propose]], there are several alternatives.
+
  
 
===Alternative 1===
 
===Alternative 1===
First, leave getFwHandlerRunning() method in FwHandlerAdmin interface as an API.
+
As same as the proposal, a bundle registers a FrameworkAdmin service for a target  framework and launcher implementation where its getRunningManipulator() will return an initialized Manipulator object if the running environment is the target framework and launcher implementation.
 
+
# A bundle registers a FwHandlerAdmin service for a particular fw and launcher implementation. Here, getFwHandlerRunning() of the FwHandlerAdmin object will return an initialized FwHandler object if the running environment is the target fw and launcher implementation. Otherwise, it will return null.
+
  
The difference between the our proposal and this is, there is no service property representing whether this FwHandlerAdmin object can create a FwHandler object representing running environment, like the one keyed by FwHandlerAdmin.SERVICE_PROP_KEY_RUNNING_FW_FLAG.
+
The difference between the our proposal and the alternative 1 is, there is no service property representing whether this FrameworkAdmin object can create a Manipulator object representing a running environment, like the one keyed by FrameworkAdmin.SERVICE_PROP_KEY_RUNNING_SYSTEM_FLAG as in the proposal.
  
Therefore, a client bundle can get the initialized FwHandler object as follows;
+
Therefore, a client bundle can get the initialized Manipulator object as follows;
 
<pre>
 
<pre>
 
String filter = null;
 
String filter = null;
String clazz = FwHandlerAdmin.class.getName();
+
String clazz = FrameworkAdmin.class.getName();
 
ServiceReference references[] =
 
ServiceReference references[] =
 
  context.getServiceReferences(clazz, filter);
 
  context.getServiceReferences(clazz, filter);
FwHandler fwHandler = null;
+
Manipulator Manipulator = null;
 
For( each references[] ){
 
For( each references[] ){
FwHandlerAdmin fwHandlerAdmin = (FwHandlerAdmin) context.getService(references[i]);
+
FrameworkAdmin FrameworkAdmin = (FrameworkAdmin) context.getService(references[i]);
fwHandler = fwHandlerAdmin.getFwHandlerRunning();
+
Manipulator = FrameworkAdmin.getRunningManipulator();
if(fwHandler!=null)
+
if(Manipulator!=null)
 
break;
 
break;
 
}
 
}
// parameters fwHandler keeps are set according to the running fw and launcher.
+
// Manipulator object will keep parameters set according to the running framework and launcher.
 
</pre>
 
</pre>
  
Line 30: Line 26:
 
Compared to it, our proposal has some merit and demerit.
 
Compared to it, our proposal has some merit and demerit.
  
Merit: Finding out the one that can handle the running fw and launcher is less costly.
+
Merit: Finding out the one that can handle the running framework and launcher is less costly.
Demerit: more standardized service property name, such as FwHandlerAdmin.SERVICE_PROP_KEY_RUNNING_FW_FLAG.
+
Demerit: more standardized service property name, such as FrameworkAdmin.SERVICE_PROP_KEY_RUNNING_SYSTEM_FLAG.
  
We adopt but alternative 1 but the proposal because we think the merit is larger than the demerit.
+
We adopt not alternative 1 but the proposal, because we think the merit is larger than the demerit.
  
 
===Alternative 2===
 
===Alternative 2===
First, remove getFwHandlerRunning() method in FwHandlerAdmin interface as an API. In other words, there is no method which creates an initialized FwHandler object according to the running fw and launcher state.  
+
First, remove FrameworkAdmin#getRunningManipulator() from the API. In other words, there is no method which creates an initialized Manipulator object according to the running framework and launcher state.  
  
In this way, by the following procedure, a client can get a FwHandler object which keeps the information about running fw.  
+
In this way, by the following procedure, a client can get a Manipulator object which keeps the information about running system (framework and launcher).  
  
 
<pre>
 
<pre>
  // Get values required for filtering in order to get the proper FwHandler service object that can manipulate the  running fw, somehow. The information will be set as fw name/version, launcher name/version.
+
  // Get values required for filtering in order to get the proper Manipulator service object that can manipulate the  running framework, <span style="color:red">somehow</span>. The information will be set as framework name/version, launcher name/version.
 
String filter = create filter expression using the values.
 
String filter = create filter expression using the values.
String clazz = FwHandlerAdmin.class.getName();
+
String clazz = FrameworkAdmin.class.getName();
 
ServiceReference references[] =
 
ServiceReference references[] =
 
  context.getServiceReferences(clazz, filter);
 
  context.getServiceReferences(clazz, filter);
FwHandlerAdmin fwHandlerAdmin = (FwHandlerAdmin) context.getService(references[0]);
+
FrameworkAdmin FrameworkAdmin = (FrameworkAdmin) context.getService(references[0]);
FwHandler fwHandler = fwHandlerAdmin.getFwHandler(); <-- not initialized.
+
Manipulator Manipulator = FrameworkAdmin.getManipulator(); <-- not initialized.
Get Location information such as fw configuration location, fw persistent data location, and fw launcher location , somehow.
+
Get Location information such as framework configuration location, framework persistent data location, and framework launcher location , <span style="color:red">somehow</span>.
Set those locations’ information to the fwHandler object.
+
Set those locations’ information to the Manipulator object.
fwHandler.load();
+
Manipulator.load();
// parameters fwHandler keeps are set according to the running fw and launcher.
+
// parameters Manipulator keeps are set according to the running framework and launcher.
 
</pre>
 
</pre>
  
 
In other words, realizing the following goals will be required.  
 
In other words, realizing the following goals will be required.  
*allow a client to know the values required for filtering in order to get the target FwHandler service object that can manipulate the running fw in a fw and launcher implementation independent way.
+
*allow a client to know the values required for filtering in order to get the target Manipulator service object that can manipulate the running framework in a framework and launcher implementation independent way.
*allow a client to know FwConfigLocation, FwPersistentDataLocation, and FwLauncherLocation of a running fw in a fw and launcher implementation independent way.
+
*allow a client to know FwConfigLocation, FwPersistentDataLocation, and FwLauncherLocation of a running framework in a framework and launcher implementation independent way.
*;FwConfigLocation: This location contains the fw config files that used for a target fw launch.  
+
*;FwConfigLocation: This location contains the framework config files that used for a target framework launch.  
*;FwPersistentDataLocation:  This location contains the fw persistent data files that used for a target fw launch.
+
*;FwPersistentDataLocation:  This location contains the framework persistent data files that used for a target framework launch.
*;FwLauncherLocation: This location contains the fw launcher file that used for a target fw launch.
+
*;FwLauncherLocation: This location contains the framework launcher file that used for a target framework launch.
  
 
Both of them should be standardized.
 
Both of them should be standardized.
  
Instead, there is no method which creates an initialized FwHandler object according to the running fw and launcher state.  
+
=== The way for a client to know the framework name/version, launcher name/version values about running environment===
 +
In order to know the values about running framework, cooperation of framework and launcher implementation is required.  
  
=== The way for a client to know the fw name/version, launcher name/version values about running environment===
 
In order to know the values about running fw, cooperation of fw and launcher implementation is required.
 
 
One of the standardized ways is as follows:
 
One of the standardized ways is as follows:
# A fw implementation will receive values about its launcher name, version, and location of its executable launcher, somehow, if executable launcher is used. The way how to pass the values from a launcher to a fw implementation is dependent on their implementation. The typical way is via system properties keyed by the predefined name. A fw implementation itself can specify its fw implementation name and version.
+
# A framework implementation will receive values about its launcher name, version, and location of its executable launcher, somehow, if executable launcher is used. The way how to pass the values from a launcher to a framework implementation is dependent on their implementation. The typical way is via system properties keyed by the predefined name. A framework implementation itself can specify its framework implementation name and version.
# Then, a fw implementation needs to tell these information to a client somehow. There are several ways to realize it.
+
# Then, a framework implementation needs to tell these information to a client somehow. There are several ways to realize it.
##One of them is assigning these values into the framework properties keyed by the standardized “MAGIC’ name. Those framework properties can be retrieved by calling BundleContext#getProperty(name). Samples of their MAGIG names are ''"org.osgi.framework.service.fwhandler.fwname/fwversion/lanchername/launcherversion"''.  
+
##One of them is assigning these values into the framework properties keyed by the standardized “MAGIC’ name. Those framework properties can be retrieved by calling BundleContext#getProperty(name). Samples of their MAGIG names are ''"org.osgi.framework.service.Manipulator.fwname/fwversion/lanchername/launcherversion"''.  
##The other is defining another service interface that is registered by a fw implementation and allows a client to get these information.
+
##The other is defining another service interface that is registered by a framework implementation and allows a client to get these information.
  
 
=== The way for a client to get the locations information used for the running environment===
 
=== The way for a client to get the locations information used for the running environment===
#One of them is assigning these values into the framework properties keyed by the standardized “MAGIC’ name. Those framework properties can be retrieved by calling BundleContext#getProperty(name). Samples of their MAGIG names are ''"org.osgi.framework.service.fwhandler.fwconfiglocation/fwpersistentdatalocation/launcherlocation"''.  
+
#One of them is assigning these values into the framework properties keyed by the standardized “MAGIC’ name. Those framework properties can be retrieved by calling BundleContext#getProperty(name). Samples of their MAGIG names are ''"org.osgi.framework.service.Manipulator.fwconfiglocation/fwpersistentdatalocation/launcherlocation"''.  
#The other is defining another service interface that is registered by a fw implementation and allows a client to get these information. (it might be similar interface as org.eclipse.osgi.service.datalocation.Location)
+
#The other is defining another service interface that is registered by a framework implementation and allows a client to get these information. (it might be similar interface as org.eclipse.osgi.service.datalocation.Location)
  
 
=== The reason why we don’t adopt alternative 2===
 
=== The reason why we don’t adopt alternative 2===
At this point, we would like to have less stuff to be standardized. Therefore, we choose the current proposal.
+
At this point, we would like to have less stuff to be standardized. The proposal can leave how to create an initialized Manipulator object according to the running system to the implementator of the target framework. Therefore, we choose the current proposal.

Latest revision as of 16:03, 24 January 2007

How to handle a running framework

There is a need for manipulating configurations of not only a non-running framework but also a running framework. Other than what we propose, there are several alternatives.

Alternative 1

As same as the proposal, a bundle registers a FrameworkAdmin service for a target framework and launcher implementation where its getRunningManipulator() will return an initialized Manipulator object if the running environment is the target framework and launcher implementation.

The difference between the our proposal and the alternative 1 is, there is no service property representing whether this FrameworkAdmin object can create a Manipulator object representing a running environment, like the one keyed by FrameworkAdmin.SERVICE_PROP_KEY_RUNNING_SYSTEM_FLAG as in the proposal.

Therefore, a client bundle can get the initialized Manipulator object as follows;

String filter = null;
String clazz = FrameworkAdmin.class.getName();
ServiceReference references[] =
 context.getServiceReferences(clazz, filter);
Manipulator Manipulator = null;
For( each references[] ){
FrameworkAdmin FrameworkAdmin = (FrameworkAdmin) context.getService(references[i]);
Manipulator = FrameworkAdmin.getRunningManipulator();
	if(Manipulator!=null)
		break;
}
// Manipulator object will keep parameters set according to the running framework and launcher.

The reason why we don’t adopt alternative 1

Compared to it, our proposal has some merit and demerit.

Merit: Finding out the one that can handle the running framework and launcher is less costly. Demerit: more standardized service property name, such as FrameworkAdmin.SERVICE_PROP_KEY_RUNNING_SYSTEM_FLAG.

We adopt not alternative 1 but the proposal, because we think the merit is larger than the demerit.

Alternative 2

First, remove FrameworkAdmin#getRunningManipulator() from the API. In other words, there is no method which creates an initialized Manipulator object according to the running framework and launcher state.

In this way, by the following procedure, a client can get a Manipulator object which keeps the information about running system (framework and launcher).

 // Get values required for filtering in order to get the proper Manipulator service object that can manipulate the  running framework, <span style="color:red">somehow</span>. The information will be set as framework name/version, launcher name/version.
String filter = create filter expression using the values.
String clazz = FrameworkAdmin.class.getName();
ServiceReference references[] =
 context.getServiceReferences(clazz, filter);
FrameworkAdmin FrameworkAdmin = (FrameworkAdmin) context.getService(references[0]);
Manipulator Manipulator = FrameworkAdmin.getManipulator(); <-- not initialized.
Get Location information such as framework configuration location, framework persistent data location, and framework launcher location , <span style="color:red">somehow</span>.
Set those locations’ information to the Manipulator object.
Manipulator.load();
// parameters Manipulator keeps are set according to the running framework and launcher.

In other words, realizing the following goals will be required.

  • allow a client to know the values required for filtering in order to get the target Manipulator service object that can manipulate the running framework in a framework and launcher implementation independent way.
  • allow a client to know FwConfigLocation, FwPersistentDataLocation, and FwLauncherLocation of a running framework in a framework and launcher implementation independent way.
    FwConfigLocation
    This location contains the framework config files that used for a target framework launch.
    FwPersistentDataLocation
    This location contains the framework persistent data files that used for a target framework launch.
    FwLauncherLocation
    This location contains the framework launcher file that used for a target framework launch.

Both of them should be standardized.

The way for a client to know the framework name/version, launcher name/version values about running environment

In order to know the values about running framework, cooperation of framework and launcher implementation is required.

One of the standardized ways is as follows:

  1. A framework implementation will receive values about its launcher name, version, and location of its executable launcher, somehow, if executable launcher is used. The way how to pass the values from a launcher to a framework implementation is dependent on their implementation. The typical way is via system properties keyed by the predefined name. A framework implementation itself can specify its framework implementation name and version.
  2. Then, a framework implementation needs to tell these information to a client somehow. There are several ways to realize it.
    1. One of them is assigning these values into the framework properties keyed by the standardized “MAGIC’ name. Those framework properties can be retrieved by calling BundleContext#getProperty(name). Samples of their MAGIG names are "org.osgi.framework.service.Manipulator.fwname/fwversion/lanchername/launcherversion".
    2. The other is defining another service interface that is registered by a framework implementation and allows a client to get these information.

The way for a client to get the locations information used for the running environment

  1. One of them is assigning these values into the framework properties keyed by the standardized “MAGIC’ name. Those framework properties can be retrieved by calling BundleContext#getProperty(name). Samples of their MAGIG names are "org.osgi.framework.service.Manipulator.fwconfiglocation/fwpersistentdatalocation/launcherlocation".
  2. The other is defining another service interface that is registered by a framework implementation and allows a client to get these information. (it might be similar interface as org.eclipse.osgi.service.datalocation.Location)

The reason why we don’t adopt alternative 2

At this point, we would like to have less stuff to be standardized. The proposal can leave how to create an initialized Manipulator object according to the running system to the implementator of the target framework. Therefore, we choose the current proposal.

Back to the top