class RuleCompositionServiceImpl extends AbstractJargonService implements RuleCompositionService {

	@Override
	public Rule addOutputParameterToRule(final String ruleAbsolutePath, final String parameterName)
			throws FileNotFoundException, DuplicateDataException, JargonException {

		log.info("addOutputParameterToRule()");

		if (ruleAbsolutePath == null || ruleAbsolutePath.isEmpty()) {
			throw new IllegalArgumentException("null or empty ruleAbsolutePath");
		}

		if (parameterName == null || parameterName.isEmpty()) {
			throw new IllegalArgumentException("null or empty parameterName");
		}

		Rule currentRule = loadRuleFromIrods(ruleAbsolutePath);
		log.info("found current rule, recompose by deleting input parameter and reformatting");

		List<IRODSRuleParameter> newParms = new ArrayList<IRODSRuleParameter>();

		for (int i = 0; i < currentRule.getOutputParameters().size(); i++) {
			if (currentRule.getOutputParameters().get(i).getUniqueName().equals(parameterName)) {
				log.error("duplicate output parameter");
				throw new DuplicateDataException("duplicate output parameter");
			} else {
				newParms.add(currentRule.getOutputParameters().get(i));
			}
		}

		IRODSRuleParameter newParam = new IRODSRuleParameter(parameterName, "");

		newParms.add(newParam);

		currentRule.setOutputParameters(newParms);

		log.info("added parameter...now store the rule");
		storeRule(ruleAbsolutePath, currentRule);
		log.info("parameter add completed");
		return currentRule;

	}

	public  RuleCompositionServiceImpl();
	public  RuleCompositionServiceImpl(final IRODSAccessObjectFactory irodsAccessObjectFactory,
			final IRODSAccount irodsAccount);

}