Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Problem with p2 headless update with <no connection> case in eclipse 3.7(In case RCP application doest nave access to the p2 repository, the applicaion doesn tell the user it doesnt have connection/access to the repository, in stead it says that there is nothing to update)
icon5.gif  Problem with p2 headless update with <no connection> case in eclipse 3.7 [message #708058] Tue, 02 August 2011 11:59
Dan  is currently offline Dan Friend
Messages: 2
Registered: July 2011
Junior Member
Dear all,


I have RCP application that uses headless update with p2 repository, written in eclipse 3.6. After decission to be migrated to Eclipse 3.7 it turned out my workarround would not work, as some classes are no more there in 3.7. What was the issue in 3.6?

The issue in Eclipse 3.6: The application is checking for updates before the start of the core plugin. It tries to connect to the p2 repository. If there is connection to it, it searches for updates, if there are such, updates, if not it says nothing for update and continue. If there is no connection, there was exception that is deep in equinox/eclipse framework, that has been handled by the framework and it never appear to us, thus the application cannot say wheter there is connection or not, as result it says there is nothing to update.

The solution: After some days speding in solutions for this i found a workarround for this. Solution was creating a class for validating the "Status" of the repository, e.g. do i have connection to it or not. Here is my class:



public class RepositoryValidator {

private final static String urlExtension = "artifacts.jar"; //$NON-NLS-1$

private static RepositoryValidator instance;

private RepositoryValidator() {

}

public static RepositoryValidator sharedInstance() {
if (instance == null) {
instance = new RepositoryValidator();
}
return instance;
}

public IStatus checkRepositoryStatus(URI repoURI) {
try {
URI checkURI = new URI(repoURI.toString() + urlExtension);
ILog logger = Activator.getDefault().getLog();
logger.log(new Status(IStatus.INFO, Activator.PLUGIN_ID,
"CHECK REPOSITORY \"artifacts.jar\" - " //$NON-NLS-1$
+ checkURI.toString()));
long result = RepositoryTransport.getInstance().getLastModified(
checkURI, new NullProgressMonitor());
if (result == 0) {
logger.log(new Status(IStatus.INFO, Activator.PLUGIN_ID,
"RESULT FROM CHECK - " + result)); //$NON-NLS-1$
return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
"WRONG SERVER RESPONCE!!!"); //$NON-NLS-1$
}
} catch (Exception e) {
return new Status(IStatus.ERROR, Activator.PLUGIN_ID,
"CONNECTION EXCEPTION", e); //$NON-NLS-1$
}
return new Status(IStatus.OK, Activator.PLUGIN_ID,
"REPOSITORY IS REACHABLE AND OK!!!"); //$NON-NLS-1$


}
}


What i basically do here is checking when the artifacts.jar has been modified, if i can access it i have connection, if not i dont.

The Issue in Eclipse 3.7: In the solution for Eclipse 3.6 i was using RepositoryTransport class, which is no more available in 3.7. I was trying to find out whether this class have been replaced by other, or is there a method in the available class i could reach similar functionality. I could not find anything related to the subject, nor for the class, neither for the solution for the issue in 3.6.

Deos anybody know anything related to this issue? Is there fix for the solution in 3.6 itself, or does they decide to replace this class with anysimilar funcionality? Or if anybody has an idea for other workarround for this issue?

Thanks in advace.
Previous Topic:SWTBot OSGi trouble...
Next Topic:ConditionalPermissionAdmin and equinox.ds
Goto Forum:
  


Current Time: Fri Apr 26 08:55:40 GMT 2024

Powered by FUDForum. Page generated in 0.02505 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top