I had the same problem while invoking the update operation programmatically. To overcome this issue the P2 community suggested to override UIService within the ProvisioningAgent:
/**
* This service forces P2 not to open a validation dialog ("...you're installing
* untrusted content..."). Otherwise the dialog will block headless RCP
* applications during install/update operations.
*
* @author e.reiswich
* @date 2011-02-14
*
*/
public class ValidationDialogService extends UIServices {
private final Logger LOGGER = Logger
.getLogger(ValidationDialogService.class.getName());
@Override
public AuthenticationInfo getUsernamePassword(String location) {
// nothing yet
return null;
}
@Override
public AuthenticationInfo getUsernamePassword(String location,
AuthenticationInfo previousInfo) {
// nothing yet
return null;
}
@Override
public TrustInfo getTrustInfo(Certificate[][] untrustedChain,
String[] unsignedDetail) {
LOGGER.info("TrustedInfo overridden");
boolean trustUnsigned = true;
boolean persistTrust = true;
Certificate[] trusted = new Certificate[0];
TrustInfo trustInfo = new TrustInfo(trusted, trustUnsigned,
persistTrust);
return trustInfo;
}
/**
* This method will override the default UIServices instance within the
* provisioning agent. This will prevent the blocking "...you're installing
* untrusted content..." dialog to appear.
*
* @param agent
* The P2 provisioning agent.
*/
public void bindProvisioningAgent(IProvisioningAgent agent) {
LOGGER.info("ValidationDialogService: UIServices overridden");
agent.registerService(UIServices.SERVICE_NAME, this);
}
}
The IProvisioningAgent instance is retrieved using DS.