Skip to content

Instantly share code, notes, and snippets.

@matthewromano
matthewromano / BlindTrustManager.java
Last active October 14, 2021 16:01
Trust Manager to trust all SSL certificates
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import javax.net.ssl.X509TrustManager;
public class BlindTrustManager implements X509TrustManager {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
@matthewromano
matthewromano / AddP2Repo.java
Created November 6, 2011 21:17
Add a P2 Repository at runtime to and Eclipse RCP Application
private void addRuntimeP2Repository(IProgressMonitor monitor, ProvisioningSession session, URI runtimeRepoURI) throws ProvisionException, OperationCanceledException {
//Create Metadata repository manager and add the new repository location
IMetadataRepositoryManager metaDataRepoManager = ProvUI.getMetadataRepositoryManager(session);
metaDataRepoManager.loadRepository(runtimeRepoURI, monitor);
//Create artifact repository manager and add the new repository location
IArtifactRepositoryManager artifactDataRepoManager = ProvUI.getArtifactRepositoryManager(session);
artifactDataRepoManager.loadRepository(runtimeRepoURI, monitor);
}
@matthewromano
matthewromano / GetP2ProvisioningAgent.java
Created November 6, 2011 21:15
Method to retrieve the P2 Provisioning Agent
private IProvisioningAgent getProvisioingAgent() {
final IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(FraudPlugin.bundleContext,
IProvisioningAgent.SERVICE_NAME);
if (agent == null) {
LogHelper.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
"No provisioning agent found. This application is not set up for updates."));
}
return agent;
}