// Check that artifact exists
if (!artifact.isFile()) {
throw new JBIException("Artifact file not found: " + sua[i].getTarget().getArtifactsZip());
}
// Check that component exists
RegistryComponent component = getRegistry().getComponent(componentName);
if (component == null) {
throw new JBIException("Service assembly requires a missing component: " + componentName);
}
// Check component is fully installed
if (!component.getCurrentState().equals(RUNNING)) {
throw new JBIException("Component is not started: " + componentName);
}
// Check that we can deploy onto it
ServiceUnitManager mgr = ((Component)component.getComponent()).getServiceUnitManager();
if (mgr == null) {
throw new JBIException("Component does not accept deployments: " + componentName);
}
// Check for duplicate SU
Unit[] compUnits = component.getUnits();
for (int j = 0; j < compUnits.length; j++) {
if (compUnits[i].getName().equals(suName)) {
throw new JBIException("Service unit already installed on component: " + suName);
}
}