001/*
002 * (C) Copyright 2006-2007 Nuxeo SA (http://nuxeo.com/) and others.
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 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id: MimetypeDescriptor.java 20310 2007-06-11 15:54:14Z lgodard $
020 */
021package org.nuxeo.ecm.platform.mimetype.service;
022
023import org.nuxeo.common.xmap.annotation.XNode;
024import org.nuxeo.common.xmap.annotation.XObject;
025
026/**
027 * Filename extension definition.
028 * <p>
029 * Allow the mimetype service to guess which mimetype to use for each extension. Ambiguous extensions (such as xml) tell
030 * the service that a binary sniffing operation is advised to guess the right mimetype.
031 *
032 * @author <a href="mailto:og@nuxeo.com">Olivier Grisel</a>
033 */
034@XObject("fileExtension")
035public class ExtensionDescriptor {
036
037    @XNode("@name")
038    protected String name;
039
040    @XNode("@mimetype")
041    protected String mimetype;
042
043    protected boolean ambiguous = false;
044
045    public ExtensionDescriptor() {
046    }
047
048    public ExtensionDescriptor(String name) {
049        this.name = name;
050    }
051
052    public String getMimetype() {
053        return mimetype;
054    }
055
056    public void setMimetype(String mimetype) {
057        this.mimetype = mimetype;
058    }
059
060    public boolean isAmbiguous() {
061        return ambiguous;
062    }
063
064    @XNode("@ambiguous")
065    public void setAmbiguous(boolean ambiguous) {
066        this.ambiguous = ambiguous;
067    }
068
069    public String getName() {
070        return name;
071    }
072
073}