Source Code Cross Referenced for IIOMetadata.java in  » Apache-Harmony-Java-SE » javax-package » javax » imageio » metadata » 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 » Apache Harmony Java SE » javax package » javax.imageio.metadata 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:        package javax.imageio.metadata;
018:
019:        import java.util.ArrayList;
020:
021:        import org.apache.harmony.x.imageio.metadata.IIOMetadataUtils;
022:        import org.w3c.dom.Node;
023:
024:        public abstract class IIOMetadata {
025:
026:            protected boolean standardFormatSupported;
027:            protected String nativeMetadataFormatName;
028:            protected String nativeMetadataFormatClassName;
029:            protected String[] extraMetadataFormatNames;
030:            protected String[] extraMetadataFormatClassNames;
031:            protected IIOMetadataController defaultController;
032:            protected IIOMetadataController controller;
033:
034:            protected IIOMetadata() {
035:            }
036:
037:            protected IIOMetadata(boolean standardMetadataFormatSupported,
038:                    String nativeMetadataFormatName,
039:                    String nativeMetadataFormatClassName,
040:                    String[] extraMetadataFormatNames,
041:                    String[] extraMetadataFormatClassNames) {
042:                standardFormatSupported = standardMetadataFormatSupported;
043:                this .nativeMetadataFormatName = nativeMetadataFormatName;
044:                this .nativeMetadataFormatClassName = nativeMetadataFormatClassName;
045:                if (extraMetadataFormatNames == null) {
046:                    if (extraMetadataFormatClassNames != null) {
047:                        throw new IllegalArgumentException(
048:                                "extraMetadataFormatNames == null && extraMetadataFormatClassNames != null!");
049:                    }
050:                } else {
051:                    if (extraMetadataFormatClassNames == null) {
052:                        throw new IllegalArgumentException(
053:                                "extraMetadataFormatNames != null && extraMetadataFormatClassNames == null!");
054:                    }
055:                    if (extraMetadataFormatNames.length == 0) {
056:                        throw new IllegalArgumentException(
057:                                "extraMetadataFormatNames.length == 0!");
058:                    }
059:                    if (extraMetadataFormatClassNames.length != extraMetadataFormatNames.length) {
060:                        throw new IllegalArgumentException(
061:                                "extraMetadataFormatClassNames.length != extraMetadataFormatNames.length!");
062:                    }
063:                    this .extraMetadataFormatNames = extraMetadataFormatNames
064:                            .clone();
065:                    this .extraMetadataFormatClassNames = extraMetadataFormatClassNames
066:                            .clone();
067:                }
068:            }
069:
070:            public abstract Node getAsTree(String formatName);
071:
072:            public abstract boolean isReadOnly();
073:
074:            public abstract void mergeTree(String formatName, Node root)
075:                    throws IIOInvalidTreeException;
076:
077:            public abstract void reset();
078:
079:            public IIOMetadataController getController() {
080:                return controller;
081:            }
082:
083:            public boolean hasController() {
084:                return getController() != null;
085:            }
086:
087:            public boolean activateController() {
088:                if (!hasController()) {
089:                    throw new IllegalStateException("hasController() == false!");
090:                }
091:                return getController().activate(this );
092:            }
093:
094:            public IIOMetadataController getDefaultController() {
095:                return defaultController;
096:            }
097:
098:            public String[] getExtraMetadataFormatNames() {
099:                return extraMetadataFormatNames == null ? null
100:                        : extraMetadataFormatNames.clone();
101:            }
102:
103:            public IIOMetadataFormat getMetadataFormat(String formatName) {
104:                return IIOMetadataUtils
105:                        .instantiateMetadataFormat(formatName,
106:                                standardFormatSupported,
107:                                nativeMetadataFormatName,
108:                                nativeMetadataFormatClassName,
109:                                extraMetadataFormatNames,
110:                                extraMetadataFormatClassNames);
111:            }
112:
113:            public String getNativeMetadataFormatName() {
114:                return nativeMetadataFormatName;
115:            }
116:
117:            public boolean isStandardMetadataFormatSupported() {
118:                return standardFormatSupported;
119:            }
120:
121:            public String[] getMetadataFormatNames() {
122:                ArrayList<String> res = new ArrayList<String>();
123:
124:                String nativeMetadataFormatName = getNativeMetadataFormatName();
125:                boolean standardFormatSupported = isStandardMetadataFormatSupported();
126:                String extraMetadataFormatNames[] = getExtraMetadataFormatNames();
127:
128:                if (standardFormatSupported) {
129:                    res.add(IIOMetadataFormatImpl.standardMetadataFormatName);
130:                }
131:                if (nativeMetadataFormatName != null) {
132:                    res.add(nativeMetadataFormatName);
133:                }
134:                if (extraMetadataFormatNames != null) {
135:                    for (String extraMetadataFormatName : extraMetadataFormatNames) {
136:                        res.add(extraMetadataFormatName);
137:                    }
138:                }
139:
140:                return res.size() > 0 ? res.toArray(new String[0]) : null;
141:            }
142:
143:            protected IIOMetadataNode getStandardChromaNode() {
144:                return null;
145:            }
146:
147:            protected IIOMetadataNode getStandardCompressionNode() {
148:                return null;
149:            }
150:
151:            protected IIOMetadataNode getStandardDataNode() {
152:                return null;
153:            }
154:
155:            protected IIOMetadataNode getStandardDimensionNode() {
156:                return null;
157:            }
158:
159:            protected IIOMetadataNode getStandardDocumentNode() {
160:                return null;
161:            }
162:
163:            protected IIOMetadataNode getStandardTextNode() {
164:                return null;
165:            }
166:
167:            protected IIOMetadataNode getStandardTileNode() {
168:                return null;
169:            }
170:
171:            protected IIOMetadataNode getStandardTransparencyNode() {
172:                return null;
173:            }
174:
175:            protected final IIOMetadataNode getStandardTree() {
176:                // Create root node
177:                IIOMetadataNode root = new IIOMetadataNode(
178:                        IIOMetadataFormatImpl.standardMetadataFormatName);
179:
180:                Node node;
181:                if ((node = getStandardChromaNode()) != null) {
182:                    root.appendChild(node);
183:                }
184:                if ((node = getStandardCompressionNode()) != null) {
185:                    root.appendChild(node);
186:                }
187:                if ((node = getStandardDataNode()) != null) {
188:                    root.appendChild(node);
189:                }
190:                if ((node = getStandardDimensionNode()) != null) {
191:                    root.appendChild(node);
192:                }
193:                if ((node = getStandardDocumentNode()) != null) {
194:                    root.appendChild(node);
195:                }
196:                if ((node = getStandardTextNode()) != null) {
197:                    root.appendChild(node);
198:                }
199:                if ((node = getStandardTileNode()) != null) {
200:                    root.appendChild(node);
201:                }
202:                if ((node = getStandardTransparencyNode()) != null) {
203:                    root.appendChild(node);
204:                }
205:
206:                return root;
207:            }
208:
209:            public void setController(IIOMetadataController controller) {
210:                this .controller = controller;
211:            }
212:
213:            public void setFromTree(String formatName, Node root)
214:                    throws IIOInvalidTreeException {
215:                reset();
216:                mergeTree(formatName, root);
217:            }
218:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.