Re: [equinox-dev] Starting equinox framework in program

2008-09-04 Thread Thomas Watson
In the Galileo release (3.5), Equinox is implementing the next version of
the OSGi R4.2 specification.  One of the new features in OSGi R4.2 is the
ability to boot another framework instance.  See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=23 for more information.

You should be able to do something like this

Properties configuration = new Properties();
configuration.put(SystemBundle.STORAGE, "/path/to/my/configuration");
SystemBundle equinox = new Equinox();
equinox.init(configuration);
BundleContext systemContext = equinox.getBundleContext();
// manage your bundles here

// now start the framework
equinox.start();


Note that the for RFC 132 is still early and evolving.  It would be good to
get others experience with using this new feature.  If you have any issues
or questions about using this feature please respond in the bug report
https://bugs.eclipse.org/bugs/show_bug.cgi?id=23


Tom





   
  From:   "林恺" <[EMAIL PROTECTED]>  


   
  To: "Equinox development mailing list"   
   

   
  Date:   09/04/2008 06:04 AM   
   

                   
  Subject:    Re: [equinox-dev] Starting equinox framework in program   
   

   





Meng,
   Thanks again. The reason why I did not install my plug-in in my
application is: my application is not an RCP-based application, most of
them might be headless application or web UI application. I developed this
plug-in because I was building an IDE to support the development and
monitor Equinox-based application, and my monitor plug-in is part of this
IDE.
   I have thought about using Runtime.exec() to start my another Equinox
framework, but how can I get BundleContext using this method?

Link

2008/9/4 Meng Xin Zhu <[EMAIL PROTECTED]>
  Why not install those plug-ins in your application? Then your plug-in can
  be in charge of monitoring and manging those plug-ins. The
  EclipseStarter.startup you called in your plug-in that is the main
  function of your app. You can easily find that Equinox prevents the
  framework running again if it's running in the source code of
  EclipseStarter. If you want to start another Equinox framework, try
  Runtime.exec.
  ___
  equinox-dev mailing list
  equinox-dev@eclipse.org
  https://dev.eclipse.org/mailman/listinfo/equinox-dev

<><>___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Re: [equinox-dev] Starting equinox framework in program

2008-09-04 Thread 林恺
Meng,   Thanks again. The reason why I did not install my plug-in in my
application is: my application is not an RCP-based application, most of them
might be headless application or web UI application. I developed this
plug-in because I was building an IDE to support the development and monitor
Equinox-based application, and my monitor plug-in is part of this IDE.
   I have thought about using Runtime.exec() to start my another Equinox
framework, but how can I get BundleContext using this method?

Link

2008/9/4 Meng Xin Zhu <[EMAIL PROTECTED]>

> Why not install those plug-ins in your application? Then your plug-in can
> be in charge of monitoring and manging those plug-ins. The
> EclipseStarter.startup you called in your plug-in that is the main function
> of your app. You can easily find that Equinox prevents the framework running
> again if it's running in the source code of EclipseStarter. If you want to
> start another Equinox framework, try Runtime.exec.
>
>
___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Re: [equinox-dev] Starting equinox framework in program

2008-09-04 Thread Meng Xin Zhu
Why not install those plug-ins in your application? Then your plug-in can
be in charge of monitoring and manging those plug-ins. The
EclipseStarter.startup you called in your plug-in that is the main function
of your app. You can easily find that Equinox prevents the framework
running again if it's running in the source code of EclipseStarter. If you
want to start another Equinox framework, try Runtime.exec.




|>
| From:  |
|>
  
>--|
  |"林恺" <[EMAIL PROTECTED]> 
  |
  
>--|
|>
| To:|
|>
  
>--|
  |"Equinox development mailing list"  
 |
  
>--|
|>
| Date:  |
|>
  
>--|
  |2008-09-04 11:54 
 |
  
>--|
|>
| Subject:   |
|>
  
>------------------------------|
  |Re: [equinox-dev] Starting equinox framework in program  
 |
  
>--|
|>
| Sent by:   |
|>
  
>--|
  |[EMAIL PROTECTED]
   |
  
>--|





Meng,
  Thanks for your reply.
   Yes, my plug-in is an UI Eclipse plugin. And it's true that Equinox
framework will be start firstly when Eclipse launched. But the problem is
the Equinox framework I want to start is not the framework of Eclipse
platform where my plug-in is install in. The Equinox framework I want to
start is another framework (application), and all the bundle is in a
folder.
  I want to start another Equinox framework through my plug-in, and install
all the bundles of the application through my plug-in, then I can control
and monitor the bundles on the Equinox framework. For that my plug-in is a
Bundle Monitor tool to control another Equinox-based application.


2008/9/4 Meng Xin Zhu <[EMAIL PROTECTED]>
  As you said your application is an Eclipse plug-in, I assume it's RCP
  application whether it has UI or not. Equiiox(OSGi) framework would be
  started firstly when your application launch, then your plug-in can
  obtain BundleContext in its bundle activator. Don't need explicitly call
  EclipseStarter.startup to launch OSGi framework.



___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev






<><>___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Re: [equinox-dev] Starting equinox framework in program

2008-09-03 Thread 林恺
Meng,  Thanks for your reply.
   Yes, my plug-in is an UI Eclipse plugin. And it's true that Equinox
framework will be start firstly when Eclipse launched. But the problem is
the Equinox framework I want to start is not the framework of Eclipse
platform where my plug-in is install in. The Equinox framework I want to
start is another framework (application), and all the bundle is in a
folder.
  I want to start another Equinox framework through my plug-in, and install
all the bundles of the application through my plug-in, then I can control
and monitor the bundles on the Equinox framework. For that my plug-in is a
Bundle Monitor tool to control another Equinox-based application.


2008/9/4 Meng Xin Zhu <[EMAIL PROTECTED]>

> As you said your application is an Eclipse plug-in, I assume it's RCP
> application whether it has UI or not. Equiiox(OSGi) framework would be
> started firstly when your application launch, then your plug-in can obtain
> BundleContext in its bundle activator. Don't need explicitly call
> EclipseStarter.startup to launch OSGi framework.
>
___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Re: [equinox-dev] Starting equinox framework in program

2008-09-03 Thread 林恺
Meng,  Thanks for your reply.
   Yes, my plug-in is an UI Eclipse plugin. And it's true that Equinox
framework will be start firstly when Eclipse launched. But the problem is
the Equinox framework I want to start is not the framework of Eclipse
platform where my plug-in is install in. The Equinox framework I want to
start is another framework (application), and all the bundle is in a
folder.
  I want to start another Equinox framework through my plug-in, and install
all the bundles of the application through my plug-in, then I can control
and monitor the bundles on the Equinox framework. For that my plug-in is a
Bundle Monitor tool to control another Equinox-based application.


2008/9/4 Meng Xin Zhu <[EMAIL PROTECTED]>

> As you said your application is an Eclipse plug-in, I assume it's RCP
> application whether it has UI or not. Equiiox(OSGi) framework would be
> started firstly when your application launch, then your plug-in can obtain
> BundleContext in its bundle activator. Don't need explicitly call
> EclipseStarter.startup to launch OSGi framework.
>
___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Re: [equinox-dev] Starting equinox framework in program

2008-09-03 Thread Meng Xin Zhu
As you said your application is an Eclipse plug-in, I assume it's RCP
application whether it has UI or not. Equiiox(OSGi) framework would be
started firstly when your application launch, then your plug-in can obtain
BundleContext in its bundle activator. Don't need explicitly call
EclipseStarter.startup to launch OSGi framework.



|>
| From:  |
|>
  
>--|
  |"林恺" <[EMAIL PROTECTED]> 
  |
  
>--|
|>
| To:|
|>
  
>--|
  |"Equinox development mailing list"  
 |
  
>--|
|>
| Date:  |
|>
  
>--|
  |2008-09-04 09:32 
 |
  
>--|
|>
| Subject:   |
|>
  
>------------------------------|
  |Re: [equinox-dev] Starting equinox framework in program  
 |
  
>--|
|>
| Sent by:   |
|>
  
>--|
  |[EMAIL PROTECTED]
   |
  
>--|





Tom,
Thanks for your reply. I sorry that I did not express my question
clearly.
I was finding a way to start an Equinox framework through Java
application. It looks like: I have a set of bundles in a folder which
construct an application. In a normal way when I want to start the
framework, I just need to click the launcher or type a command line in the
console. What I need is to write a program, this program may NOT be a
bundle, and start the Equinox framework and install all the bundles in the
folder but no need to click or type something. I have search on google and
found that EclipseStarter can do this in Java application, and I have try
it. Code likes:

public static void main(String[] args) {
 BundleContext context = null;
 // start up OSGI framework.
context = EclipseStarter.startup(new String[] { "-console" },
null);
context.installBundle("file:path/to/bundle.jar");
  }

For my application is an ECLIIPSE PLUG-IN, when I use the same code
snipe to start another Equinox framework, I got the error message that told
me "framework is running". I think the reason is that Eclipse platform has
already use EclipseStarter to start itself, and when you try to use
EclipseStarter to start another Equinox framework, you get such error.
EclipseStarter is a static utility class.
   I wonder whether there is a way to fix the problem using EclipseStarter
or there is another way to start Equinox framework as I need and got
BundleContext like the method  EclipseStarter.startup().



2008/9/3 Thomas Watson <[EMAIL PROTECTED]>
  I need to better understand your requirements:

  Are you simply trying to get a valid BundleContext? If so you get access
  to your bundle's BundleContext when you bundle is activated. The
  BundleContext is passed to you in your
  BundleActivator.start(BundleContext) method.

  >From your description it does not sound like you want to actually start
  another instance of the Equinox when your bundle is already running in an
  instance of 

Re: [equinox-dev] Starting equinox framework in program

2008-09-03 Thread 林恺
Tom,Thanks for your reply. I sorry that I did not express my question
clearly.
I was finding a way to start an Equinox framework through Java
application. It looks like: I have a set of bundles in a folder which
construct an application. In a normal way when I want to start the
framework, I just need to click the launcher or type a command line in the
console. What I need is to write a program, this program may NOT be a
bundle, and start the Equinox framework and install all the bundles in the
folder but no need to click or type something. I have search on google and
found that EclipseStarter can do this in Java application, and I have try
it. Code likes:

public static void main(String[] args) {
 BundleContext context = null; // start up OSGI framework.
context = EclipseStarter.startup(new String[] { "-console" }, null);
context.installBundle("file:path/to/bundle.jar");
  }

For my application is an ECLIIPSE PLUG-IN, when I use the same code
snipe to start another Equinox framework, I got the error message that told
me "framework is running". I think the reason is that Eclipse platform has
already use EclipseStarter to start itself, and when you try to use
EclipseStarter to start another Equinox framework, you get such error.
EclipseStarter is a static utility class.
   I wonder whether there is a way to fix the problem using EclipseStarter
or there is another way to start Equinox framework as I need and got
BundleContext like the method  EclipseStarter.startup().



2008/9/3 Thomas Watson <[EMAIL PROTECTED]>

> I need to better understand your requirements:
>
> Are you simply trying to get a valid BundleContext? If so you get access to
> your bundle's BundleContext when you bundle is activated. The BundleContext
> is passed to you in your BundleActivator.start(BundleContext) method.
>
> From your description it does not sound like you want to actually start
> another instance of the Equinox when your bundle is already running in an
> instance of the Framework. Instead you simply need to get access to your
> bundle's BundleContext so you can interact with the Framework.
>
> HTH.
>
> Tom
>
___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Re: [equinox-dev] Starting equinox framework in program

2008-09-03 Thread Thomas Watson
I need to better understand your requirements:

Are you simply trying to get a valid BundleContext?  If so you get access
to your bundle's BundleContext when you bundle is activated.  The
BundleContext is passed to you in your BundleActivator.start(BundleContext)
method.

From your description it does not sound like you want to actually start
another instance of the Equinox when your bundle is already running in an
instance of the Framework.  Instead you simply need to get access to your
bundle's BundleContext so you can interact with the Framework.

HTH.

Tom





   
  From:   "林恺" <[EMAIL PROTECTED]>  


   
  To: equinox-dev@eclipse.org   
   

   
  Date:   09/02/2008 09:15 PM   
   

   
  Subject:[equinox-dev] Starting equinox framework in program   
   

   





 I was trying to build an OSGi runtime monitor to control and monitor
the equinox framework. This OSGi runtime monitor is an Eclipse plugin, and
is something just like the OSGi console when we running equinox application
in eclipse through OSGi Framework launch configuration, and we can list
bundle and service information, start and stop bundle and so on.

 The problem is I can find the way to start equinox framework programly
and get the BundleContext. I have search on google, and get this method:

  BundleContext  context = EclipseStarter.startup(new String[]
{ "-console", "-clean" }, null);

 This can work when I put it in a Java Application, but when I put it
in an Eclipse Plugin, I got this error message:

 java.lang.IllegalStateException: Platform already running

 The reason for this may be : We have started the Eclipse platform, and
then we use EclipseStarter to start our equinox framework, we get this
error.

 Is there a way I can start equinox framework in program and get the
BundleContext? When we running equinox application in eclipse through OSGi
Framework launch configuration, It seems the way. Does anyone can give me
some help?

Thanks.
Link___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev

<><>___
equinox-dev mailing list
equinox-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/equinox-dev