View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.vafer.jdeb.descriptors;
17  
18  import java.io.IOException;
19  import java.io.InputStream;
20  import java.text.ParseException;
21  
22  import org.vafer.jdeb.utils.VariableResolver;
23  
24  /**
25   * Reflecting the package control file
26   * 
27   * @author Torsten Curdt <tcurdt@vafer.org>
28   */
29  public final class PackageDescriptor extends AbstractDescriptor {
30  
31  	private final static String[] keys = {
32  		"Package",
33  		"Source",
34  		"Version",
35  		"Section",
36  		"Priority",
37  		"Architecture",
38  		"Essential",
39  		"Depends",
40  		"Pre-Depends",
41  		"Recommends",
42  		"Suggests",
43  		"Breaks",
44  		"Enhances",
45  		"Conflicts",
46  		"Provides",
47  		"Replaces",
48  		"Installed-Size",
49  		"Maintainer",
50  		"Description",
51  		"Homepage",
52  	};
53  
54  	private final static String[] mandatoryKeys = {
55  		"Package",
56  		"Version",
57  		"Section",
58  		"Priority",
59  		"Architecture",
60  		"Maintainer",
61  		"Description"
62  	};
63  	
64  	public PackageDescriptor() {
65  		this(null);
66  	}
67  
68  	public PackageDescriptor( final VariableResolver pResolver ) {
69  		super(pResolver);
70  	}
71  
72  	public PackageDescriptor( final InputStream pInput, final VariableResolver pResolver )  throws IOException, ParseException {	
73  		this(pResolver);
74  		parse(pInput);
75  	}
76  
77  	public String[] getMandatoryKeys() {
78  		return mandatoryKeys;
79  	}
80  
81  	public String toString() {
82  		return toString(keys);
83  	}
84  
85  }