Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Force removal of another WCB before installing

The "WCB: Java development" forum contains threads on issues that are related to Java while programming a WCB (WebManager Component Bundle). If you have questions that have impact on Java code, post them in this forum. Some example topics: authorization, the different component types, setting up component dependencies, data access, and so forth.

Answered
Not marked as answered yet

Forums  >  WCB: Java development  >  Force removal of another WCB before installing


Author Force removal of another WCB before installing
Cthulhu



Posts: 212

Posted: 21-10-2009 13:24

Hey guys,

Not a really big issue, but just a curiosity. We've had to change the WCB ID of one of our WCB's that's being used by a number of people in our organization. This also means that, in order to install it properly, the old WCB (a presentation one) has to be removed.

Is there some way to check for the existence of another WCB, and fail the install if it already exists? Preferably with an error report in the log in the WCB panel, which (iirc) probably means it'd have to be configured in the pom.xml file.

Would this be possible somehow?

bramk



Posts: 35

Posted: 22-10-2009 16:37 Solved

Hi Cthulhu,

AFAIK there is no way to specify this through a manifest entry. OSGi has a Require-Bundle directive (which should probably be used a little as possible) but you can not negate it. Thus preventing the bundle install wont work.

However you can prevent it from being activated by checking and throwing an exception before initialization from the activator. This will be shown in the console log and you could also go ahead and uninstall it on the fly if you must.



@Override
public void init(BundleContext bundleContext,
DependencyManager dependencyManager) throws Exception {

if(oldWcbStillInstalled(bundleContext))
throw new Exception("Please uninstall the old WCB first");

super.init(bundleContext, dependencyManager);
}



Regards,
Bram

Cthulhu



Posts: 212

Posted: 23-10-2009 12:10

Ah, that'll work. That would prevent the WCB from initializing, right? So that it'll only appear as 'resolved' in the browser.

Back to top

New message: "Force removal of another WCB before installing"
Message:
bold boitalicd underline url quote code smile cool eek grin mad razz sad wink
 
© 2012 GX Software B.V.

Disclaimer

This website (Connect.gxsoftware.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.