blob: 0ba8f6a4a94c419f6f99c7cf7548e463e03a1836 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2010 Cloudsmith Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Cloudsmith Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.internal.p2.metadata.repository.ant;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.metadata.repository.Messages;
import org.eclipse.equinox.internal.p2.repository.Activator;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
public class AbstractMDRTask extends Task {
/*
* Return the provisioning agent. Throw an exception if it cannot be obtained.
*/
public static IProvisioningAgent getAgent() throws BuildException {
IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(Activator.getContext(), IProvisioningAgent.SERVICE_NAME);
if (agent == null)
throw new BuildException(Messages.no_provisioning_agent);
return agent;
}
}