| import aQute.bnd.service.*; |
| public class MakeCopy implements MakePlugin { |
| public Resource make(Builder builder, String destination, Map<String,String> argumentsOnMake) throws Exception { |
| String type = argumentsOnMake.get("type"); |
| if (!type.equals("copy")) |
| String from = argumentsOnMake.get("from"); |
| String content = argumentsOnMake.get("content"); |
| throw new IllegalArgumentException("No 'from' or 'content' field in copy " + argumentsOnMake); |
| return new EmbeddedResource(content.getBytes("UTF-8"), 0); |
| File f = builder.getFile(from); |
| return new FileResource(f); |
| return new URLResource(url); |
| catch (MalformedURLException mfue) { |
| throw new IllegalArgumentException("Copy source does not exist " + from + " for destination " |