001 /*
002 * Copyright 2005 The Apache Software Foundation.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.vafer.jdeb.descriptors;
017
018 import java.io.IOException;
019 import java.io.InputStream;
020 import java.text.ParseException;
021
022 import org.vafer.jdeb.utils.VariableResolver;
023
024 /**
025 * Reflecting the package control file
026 *
027 * @author Torsten Curdt <tcurdt@vafer.org>
028 */
029 public final class PackageDescriptor extends AbstractDescriptor {
030
031 private final static String[] keys = {
032 "Package",
033 "Source",
034 "Version",
035 "Section",
036 "Priority",
037 "Architecture",
038 "Essential",
039 "Depends",
040 "Pre-Depends",
041 "Recommends",
042 "Suggests",
043 "Breaks",
044 "Enhances",
045 "Conflicts",
046 "Provides",
047 "Replaces",
048 "Installed-Size",
049 "Maintainer",
050 "Description",
051 "Homepage",
052 };
053
054 private final static String[] mandatoryKeys = {
055 "Package",
056 "Version",
057 "Section",
058 "Priority",
059 "Architecture",
060 "Maintainer",
061 "Description"
062 };
063
064 public PackageDescriptor() {
065 this(null);
066 }
067
068 public PackageDescriptor( final VariableResolver pResolver ) {
069 super(pResolver);
070 }
071
072 public PackageDescriptor( final InputStream pInput, final VariableResolver pResolver ) throws IOException, ParseException {
073 this(pResolver);
074 parse(pInput);
075 }
076
077 public String[] getMandatoryKeys() {
078 return mandatoryKeys;
079 }
080
081 public String toString() {
082 return toString(keys);
083 }
084
085 }