Source Code Cross Referenced for Configuration.java in  » 6.0-JDK-Modules » j2me » com » sun » mmedia » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.mmedia 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright  1990-2007 Sun Microsystems, Inc. All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
004:         * 
005:         * This program is free software; you can redistribute it and/or
006:         * modify it under the terms of the GNU General Public License version
007:         * 2 only, as published by the Free Software Foundation.
008:         * 
009:         * This program is distributed in the hope that it will be useful, but
010:         * WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012:         * General Public License version 2 for more details (a copy is
013:         * included at /legal/license.txt).
014:         * 
015:         * You should have received a copy of the GNU General Public License
016:         * version 2 along with this work; if not, write to the Free Software
017:         * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
018:         * 02110-1301 USA
019:         * 
020:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
021:         * Clara, CA 95054 or visit www.sun.com if you need additional
022:         * information or have any questions.
023:         */
024:        package com.sun.mmedia;
025:
026:        import java.util.Hashtable;
027:
028:        import javax.microedition.media.Player;
029:
030:        /**
031:         *  The configuration module for MMAPI.
032:         *
033:         * @created    January 13, 2005
034:         */
035:        public abstract class Configuration {
036:
037:            /**
038:             * A hash table of the protocol and content handlers.
039:             */
040:            protected Hashtable handlers;
041:
042:            /**
043:             * A hash table of media processors.
044:             */
045:            protected Hashtable processors;
046:
047:            /**
048:             * A table of mime types.
049:             */
050:            protected Hashtable mimeTypes;
051:
052:            /**
053:             *  The current configuration object.
054:             */
055:            private static Configuration config;
056:
057:            /**
058:             *  True if players loop in native code,
059:             *  otherwise false
060:             */
061:            protected static boolean nativeLooping = false;
062:
063:            public final static String TONE_DEVICE_LOCATOR = "device://tone"; //javax.microedition.media.Manager.TONE_DEVICE_LOCATOR;
064:            public final static String MIDI_DEVICE_LOCATOR = "device://midi"; //javax.microedition.media.Manager.MIDI_DEVICE_LOCATOR;
065:            public final static String RADIO_CAPTURE_LOCATOR = "capture://radio";
066:            public final static String AUDIO_CAPTURE_LOCATOR = "capture://audio";
067:            public final static String VIDEO_CAPTURE_LOCATOR = "capture://video";
068:
069:            protected Hashtable properties;
070:
071:            private static Object singletonLock = new Object();
072:
073:            /**
074:             * Constructor for the Configuration object
075:             */
076:            public Configuration() {
077:                handlers = new Hashtable();
078:                processors = new Hashtable();
079:                mimeTypes = new Hashtable();
080:                properties = new Hashtable();
081:            }
082:
083:            /**
084:             *  Gets the supportedContentTypes attribute of the Configuration object
085:             *
086:             * @param  protocol  Description of the Parameter
087:             * @return           The supportedContentTypes value
088:             */
089:            public abstract String[] getSupportedContentTypes(String protocol);
090:
091:            /**
092:             *  Gets the supportedProtocols attribute of the Configuration class
093:             *
094:             * @param  content_types  Description of the Parameter
095:             * @return                The supportedProtocols value
096:             */
097:            public abstract String[] getSupportedProtocols(String content_types);
098:
099:            public abstract String[] getSupportedMediaProcessorInputTypes();
100:
101:            public abstract String[] getSupportedSoundSource3DPlayerTypes();
102:
103:            public abstract String getProperty(String key);
104:
105:            public abstract void setProperty(String key, String value);
106:
107:            /**
108:             * Gets the audio renderer.
109:             *
110:             * @return The audio renderer
111:             */
112:            public abstract PCMAudioOut getAudioRenderer();
113:
114:            /**
115:             * Gets the video renderer.
116:             *
117:             * @return The video renderer
118:             */
119:            public abstract VideoRenderer getVideoRenderer(Player player,
120:                    int sourceWidth, int sourceHeight);
121:
122:            /**
123:             *  Gets the tonePlayer attribute of the Configuration object
124:             *
125:             * @return    The tonePlayer value
126:             */
127:            public abstract TonePlayer getTonePlayer();
128:
129:            /**
130:             * Convert from the name of a file to its corresponding Mime
131:             * type based on the extension.
132:             *
133:             * @param  name  Description of the Parameter
134:             * @return       Description of the Return Value
135:             */
136:            public String ext2Mime(String name) {
137:                int idx = name.lastIndexOf('.');
138:                String ext;
139:                if (idx != -1) {
140:                    ext = name.substring(idx + 1).toLowerCase();
141:                } else {
142:                    ext = name.toLowerCase();
143:                }
144:                return (String) mimeTypes.get(ext);
145:            }
146:
147:            /**
148:             *  Gets the handler attribute of the Configuration object
149:             *
150:             * @param  type  The content type
151:             * @return       The handler value
152:             */
153:            public String getHandler(String type) {
154:                return (String) handlers.get(type);
155:            }
156:
157:            /**
158:             *  Gets the processor attribute of the Configuration object
159:             *
160:             * @param  type  The content type
161:             * @return       The processor value
162:             */
163:            public String getMediaProcessor(String type) {
164:                return (String) processors.get(type);
165:            }
166:
167:            /**
168:             *  Gets Accessor to platform specific Image classes
169:             *  To be defined in derived classes.
170:             *
171:             * @return instance of ImageAccess class
172:             */
173:            public abstract ImageAccess getImageAccessor();
174:
175:            /**
176:             *  Gets the configuration attribute of the Configuration class
177:             *
178:             * @return    The configuration value
179:             */
180:            public static Configuration getConfiguration() {
181:                synchronized (singletonLock) {
182:                    if (config != null)
183:                        return config;
184:
185:                    String className = System
186:                            .getProperty("mmapi-configuration");
187:
188:                    if (className != null) {
189:                        try {
190:                            // ... try and instantiate the configuration class ...
191:                            Class handlerClass = Class.forName(className);
192:                            config = (Configuration) handlerClass.newInstance();
193:                        } catch (Exception e) {
194:                            // return DefaultConfiguration 
195:                            config = new DefaultConfiguration();
196:                        }
197:                    } else {
198:                        config = new DefaultConfiguration();
199:                    }
200:
201:                    return config;
202:                }
203:            }
204:
205:            /**
206:             *  Description of the Method
207:             *
208:             * @return    Description of the Return Value
209:             */
210:            public static boolean nativeLoopMode() {
211:                return nativeLooping;
212:            }
213:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.