001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.mobile.device;
016    
017    import java.util.Collections;
018    import java.util.HashSet;
019    import java.util.Map;
020    import java.util.Set;
021    
022    /**
023     * Class represents unknown device
024     *
025     * @author Milen Dyankov
026     * @author Michael C. Han
027     */
028    public class NoKnownDevices implements KnownDevices {
029    
030            public static NoKnownDevices getInstance() {
031                    return _instance;
032            }
033    
034            @Override
035            public Set<VersionableName> getBrands() {
036                    return _brands;
037            }
038    
039            @Override
040            public Set<VersionableName> getBrowsers() {
041                    return _browsers;
042            }
043    
044            @Override
045            public Map<Capability, Set<String>> getDeviceIds() {
046                    return Collections.emptyMap();
047            }
048    
049            @Override
050            public Set<VersionableName> getOperatingSystems() {
051                    return _operatingSystems;
052            }
053    
054            @Override
055            public Set<String> getPointingMethods() {
056                    return _pointingMethods;
057            }
058    
059            @Override
060            public void reload() {
061            }
062    
063            private NoKnownDevices() {
064                    _brands.add(VersionableName.UNKNOWN);
065    
066                    _brands = Collections.unmodifiableSet(_brands);
067    
068                    _browsers.add(VersionableName.UNKNOWN);
069    
070                    _browsers = Collections.unmodifiableSet(_browsers);
071    
072                    _operatingSystems.add(VersionableName.UNKNOWN);
073    
074                    _operatingSystems = Collections.unmodifiableSet(_operatingSystems);
075    
076                    _pointingMethods.add(VersionableName.UNKNOWN.getName());
077    
078                    _pointingMethods = Collections.unmodifiableSet(_pointingMethods);
079            }
080    
081            private static NoKnownDevices _instance = new NoKnownDevices();
082    
083            private Set<VersionableName> _brands = new HashSet<VersionableName>();
084            private Set<VersionableName> _browsers = new HashSet<VersionableName>();
085            private Set<VersionableName> _operatingSystems =
086                    new HashSet<VersionableName>();
087            private Set<String> _pointingMethods = new HashSet<String>();
088    
089    }