001/*
002 * (C) Copyright 2006-2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 *
017 * $Id: MimetypeDescriptor.java 20310 2007-06-11 15:54:14Z lgodard $
018 */
019package org.nuxeo.ecm.platform.mimetype.service;
020
021import org.nuxeo.common.xmap.annotation.XNode;
022import org.nuxeo.common.xmap.annotation.XObject;
023
024/**
025 * Filename extension definition.
026 * <p>
027 * Allow the mimetype service to guess which mimetype to use for each extension. Ambiguous extensions (such as xml) tell
028 * the service that a binary sniffing operation is advised to guess the right mimetype.
029 *
030 * @author <a href="mailto:og@nuxeo.com">Olivier Grisel</a>
031 */
032@XObject("fileExtension")
033public class ExtensionDescriptor {
034
035    @XNode("@name")
036    protected String name;
037
038    @XNode("@mimetype")
039    protected String mimetype;
040
041    protected boolean ambiguous = false;
042
043    public ExtensionDescriptor() {
044    }
045
046    public ExtensionDescriptor(String name) {
047        this.name = name;
048    }
049
050    public String getMimetype() {
051        return mimetype;
052    }
053
054    public void setMimetype(String mimetype) {
055        this.mimetype = mimetype;
056    }
057
058    public boolean isAmbiguous() {
059        return ambiguous;
060    }
061
062    @XNode("@ambiguous")
063    public void setAmbiguous(boolean ambiguous) {
064        this.ambiguous = ambiguous;
065    }
066
067    public String getName() {
068        return name;
069    }
070
071}