Source Code Cross Referenced for DBPrefixMappingImpl.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » db » impl » 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 » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.db.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003:          [See end of file]
004:          $Id: DBPrefixMappingImpl.java,v 1.16 2008/01/02 12:08:24 andy_seaborne Exp $
005:         */
006:
007:        package com.hp.hpl.jena.db.impl;
008:
009:        import java.util.Iterator;
010:        import java.util.Map;
011:
012:        import com.hp.hpl.jena.shared.PrefixMapping;
013:        import com.hp.hpl.jena.shared.impl.PrefixMappingImpl;
014:
015:        /**
016:         *  Implementation of prefix mapping specific to databases.
017:         *  This extends the base implementation, effectively turning it into
018:         *  a write-through cache - each new namespace is written to
019:         *  the database as it is added to the prefix map.
020:         * 
021:         *
022:         @author csayers
023:         @version $Revision: 1.16 $
024:         */
025:        public class DBPrefixMappingImpl extends PrefixMappingImpl {
026:
027:            protected DBPropGraph m_graphProperties = null;
028:
029:            /**
030:             * Constructor for a persistent prefix mapping.
031:             * 
032:             * Each GraphRDB has a set of associated properties
033:             * which are, themselves, represented as triples in
034:             * a system graph.
035:             * 
036:             * The prefix mapping is persisted by converting it
037:             * to triples and storing it along with the other
038:             * properties of the GraphRDB in that system graph.
039:             * 
040:             * @param graphProperties the system properties of a persistent graph.
041:             */
042:            public DBPrefixMappingImpl(DBPropGraph graphProperties) {
043:                super ();
044:                m_graphProperties = graphProperties;
045:
046:                // Populate the prefix map using data from the 
047:                // persistent graph properties
048:                boolean commit = m_graphProperties.begin();
049:                Iterator it = m_graphProperties.getAllPrefixes();
050:                while (it.hasNext()) {
051:                    DBPropPrefix prefix = (DBPropPrefix) it.next();
052:                    super .setNsPrefix(prefix.getValue(), prefix.getURI());
053:                }
054:                m_graphProperties.conditionalCommit(commit);
055:            }
056:
057:            public PrefixMapping removeNsPrefix(String prefix) {
058:                super .removeNsPrefix(prefix);
059:                m_graphProperties.removePrefix(prefix);
060:                return this ;
061:            }
062:
063:            /* (non-Javadoc)
064:             * Override the default implementation so we can catch the write operation
065:             * and update the persistent store.
066:             * @see com.hp.hpl.jena.shared.PrefixMapping#setNsPrefix(java.lang.String, java.lang.String)
067:             */
068:            public PrefixMapping setNsPrefix(String prefix, String uri) {
069:                // this avoids touching the database for existing maplets.
070:                // if (uri.equals( super.getNsPrefixURI( prefix ) )) return this;
071:                // Ordering is important here - we need to add it to the prefixMappingImpl
072:                // first since it checks the validity of the prefix (it will throw
073:                // an exception if there's any problem).
074:                super .setNsPrefix(prefix, uri);
075:
076:                // All went well, so persist the prefix by adding it to the graph properties
077:                // (the addPrefix call will overwrite any existing mapping with the same prefix
078:                // so it matches the behaviour of the prefixMappingImpl).
079:                m_graphProperties.addPrefix(prefix, uri);
080:                return this ;
081:            }
082:
083:            /* (non-Javadoc)
084:             * Override the default implementation so we can catch all write operations
085:             * @see com.hp.hpl.jena.shared.PrefixMapping#setNsPrefixes(com.hp.hpl.jena.shared.PrefixMapping)
086:             */
087:            public PrefixMapping setNsPrefixes(PrefixMapping other) {
088:                return setNsPrefixes(other.getNsPrefixMap());
089:            }
090:
091:            /* (non-Javadoc)
092:             * Override the default implementation so we can catch all write operations
093:             * @see com.hp.hpl.jena.shared.PrefixMapping#setNsPrefixes(java.util.Map)
094:             */
095:            public PrefixMapping setNsPrefixes(Map other) {
096:                checkUnlocked();
097:                Iterator it = other.entrySet().iterator();
098:                while (it.hasNext()) {
099:                    Map.Entry e = (Map.Entry) it.next();
100:                    setNsPrefix((String) e.getKey(), (String) e.getValue());
101:                }
102:                return this ;
103:            }
104:        }
105:
106:        /*
107:         (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
108:         All rights reserved.
109:
110:         Redistribution and use in source and binary forms, with or without
111:         modification, are permitted provided that the following conditions
112:         are met:
113:
114:         1. Redistributions of source code must retain the above copyright
115:         notice, this list of conditions and the following disclaimer.
116:
117:         2. Redistributions in binary form must reproduce the above copyright
118:         notice, this list of conditions and the following disclaimer in the
119:         documentation and/or other materials provided with the distribution.
120:
121:         3. The name of the author may not be used to endorse or promote products
122:         derived from this software without specific prior written permission.
123:
124:         THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
125:         IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
126:         OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
127:         IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
128:         INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
129:         NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
130:         DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
131:         THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
132:         (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
133:         THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
134:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.