KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonicsystems > jarjar > JarJarTask


1 /*
2   Jar Jar Links - A utility to repackage and embed Java libraries
3   Copyright (C) 2004 Tonic Systems, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program; see the file COPYING. if not, write to
17   the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18   Boston, MA 02111-1307 USA
19 */

20
21 package com.tonicsystems.jarjar;
22
23 import com.tonicsystems.jarjar.util.*;
24 import java.util.*;
25
26 public class JarJarTask extends AntJarProcessor
27 {
28     private List patterns = new ArrayList();
29
30     public void addConfiguredRule(Rule rule) {
31         if (rule.getPattern() == null || rule.getResult() == null)
32             throw new IllegalArgumentException JavaDoc("The <rule> element requires both \"pattern\" and \"result\" attributes.");
33         patterns.add(rule);
34     }
35
36     public void addConfiguredZap(Zap zap) {
37         if (zap.getPattern() == null)
38             throw new IllegalArgumentException JavaDoc("The <zap> element requires a \"pattern\" attribute.");
39         patterns.add(zap);
40     }
41
42     public void addConfiguredKill(Kill kill) {
43         if (kill.getPattern() == null)
44             throw new IllegalArgumentException JavaDoc("The <kill> element requires a \"pattern\" attribute.");
45         patterns.add(kill);
46     }
47     
48     protected JarProcessor getJarProcessor() {
49         return new MainProcessor(patterns, verbose);
50     }
51
52     protected void cleanHelper() {
53         super.cleanHelper();
54         patterns.clear();
55     }
56 }
57
Popular Tags