eclipse rcp - P2.inf: refer update sites based on location -


i have developed rcp application , providing p2 update functionality.

in p2.inf providing url update site. don't want user add site have disabled option add site. p2.inf looks like:

instructions.configure=\   addrepository(type:0,location:http${#58}//blrupdates.com/updates);\   addrepository(type:1,location:http${#58}//blrupdates.com/updates); 

if user location bangalore, rcp application should go brlupdates.com, if user location chennai rcp application should update @ chnupdates.com.

how add repository location in p2.inf?

-priyank

you need add repository programatically. following solution taken here. solution, i'm not sure work use redirection. define 1 p2 repository , redirect user location based repository.

import org.eclipse.equinox.internal.p2.ui.model.metadatarepositoryelement; import org.eclipse.equinox.internal.p2.ui.model.elementutils;  @suppresswarnings("restriction") public class p2util {   private static string update_site = "http://www.example.com/update_site";    public static void setrepositories() throws invocationtargetexception {     try {       final metadatarepositoryelement element = new metadatarepositoryelement(null, new uri(update_site), true);       elementutils.updaterepositoryusingelements(new metadatarepositoryelement[] {element}, null);     } catch (urisyntaxexception e) {       e.printstacktrace();       throw new invocationtargetexception(e);     }   } } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -