org.ow2.util.archive.impl.AbsArchiveImpl Maven / Gradle / Ivy
The newest version!
/**
* OW2 Util
* Copyright (C) 2008 Bull S.A.S.
* Contact: [email protected]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* --------------------------------------------------------------------------
* $Id: AbsArchiveImpl.java 4480 2009-01-23 10:18:17Z benoitf $
* --------------------------------------------------------------------------
*/
package org.ow2.util.archive.impl;
import java.util.Map;
import java.util.Set;
import java.util.jar.Attributes;
import java.util.jar.Manifest;
import org.ow2.util.archive.api.IArchive;
import org.ow2.util.archive.api.IArchiveMetadata;
/**
* Common code for analyzing manifest.
* @author Florent BENOIT
*/
public abstract class AbsArchiveImpl implements IArchive {
/**
* Logger.
*/
//private Log logger = LogFactory.getLog(AbsArchiveImpl.class);
/**
* Link to a metadata implementation.
*/
private IArchiveMetadata archiveMetadata = null;
/**
* Default constructor.
*/
public AbsArchiveImpl() {
this.archiveMetadata = new ArchiveMetadataImpl();
}
/**
* Read the manifest and complete the metadata.
* @param manifest the given manifest to analyze
*/
protected void readManifest(final Manifest manifest) {
// Now manifest is here, analyze it and populate metadata
Attributes attributes = manifest.getMainAttributes();
Set> entries = attributes.entrySet();
for (Map.Entry