Source Code Cross Referenced for DSpaceObjectManager.java in  » Content-Management-System » dspace » org » dspace » app » xmlui » objectmanager » 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 » Content Management System » dspace » org.dspace.app.xmlui.objectmanager 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DSpaceObjectManager.java
003:         *
004:         * Version: $Revision: 1.1 $
005:         *
006:         * Date: $Date: 2006/03/20 22:39:04 $
007:         *
008:         * Copyright (c) 2002, Hewlett-Packard Company and Massachusetts
009:         * Institute of Technology.  All rights reserved.
010:         *
011:         * Redistribution and use in source and binary forms, with or without
012:         * modification, are permitted provided that the following conditions are
013:         * met:
014:         *
015:         * - Redistributions of source code must retain the above copyright
016:         * notice, this list of conditions and the following disclaimer.
017:         *
018:         * - Redistributions in binary form must reproduce the above copyright
019:         * notice, this list of conditions and the following disclaimer in the
020:         * documentation and/or other materials provided with the distribution.
021:         *
022:         * - Neither the name of the Hewlett-Packard Company nor the name of the
023:         * Massachusetts Institute of Technology nor the names of their
024:         * contributors may be used to endorse or promote products derived from
025:         * this software without specific prior written permission.
026:         *
027:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
028:         * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
029:         * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
030:         * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
031:         * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
032:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
033:         * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
034:         * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
035:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
036:         * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
037:         * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
038:         * DAMAGE.
039:         */
040:
041:        package org.dspace.app.xmlui.objectmanager;
042:
043:        import java.util.ArrayList;
044:        import java.util.HashMap;
045:        import java.util.List;
046:
047:        import org.dspace.app.xmlui.wing.ObjectManager;
048:        import org.dspace.app.xmlui.wing.WingException;
049:        import org.dspace.browse.BrowseItem;
050:        import org.dspace.content.Collection;
051:        import org.dspace.content.Community;
052:        import org.dspace.content.DSpaceObject;
053:        import org.dspace.content.Item;
054:        import org.dspace.core.ConfigurationManager;
055:
056:        /**
057:         * The Wing ObjectManager implemented specificaly for DSpace. This manager 
058:         * is able identify all DSpace items, communities, and collections.
059:         * 
060:         * @author Scott Phillips
061:         */
062:
063:        public class DSpaceObjectManager implements  ObjectManager {
064:
065:            /** List of all managed DSpaceObjects */
066:            private List<DSpaceObject> dsos = new ArrayList<DSpaceObject>();
067:
068:            /**
069:             * Manage the given object, if this manager is unable to manage the object then false must be returned.
070:             * 
071:             * @param object
072:             *            The object to be managed.
073:             * @return The object identifiers
074:             */
075:            public boolean manageObject(Object object) throws WingException {
076:                // First check that the object is of a type we can manage.
077:                if (object instanceof  BrowseItem) {
078:                    dsos.add((BrowseItem) object);
079:                    return true;
080:                } else if (object instanceof  Item) {
081:                    dsos.add((Item) object);
082:                    return true;
083:                } else if (object instanceof  Collection) {
084:                    dsos.add((Collection) object);
085:                    return true;
086:                } else if (object instanceof  Community) {
087:                    dsos.add((Community) object);
088:                    return true;
089:                }
090:
091:                // We are unable to manage this object.
092:                return false;
093:            }
094:
095:            /**
096:             * Return the metadata URL of the supplied object, assuming 
097:             * it's a DSpace item, community or collection.
098:             * 
099:             */
100:            public String getObjectURL(Object object) throws WingException {
101:                if (object instanceof  DSpaceObject) {
102:                    DSpaceObject dso = (DSpaceObject) object;
103:                    String handle = dso.getHandle();
104:
105:                    // If the object has a handle then refrence it by it's handle.
106:                    if (handle != null) {
107:                        return "/metadata/handle/" + handle + "/mets.xml";
108:                    } else {
109:                        // No handle then refrence it by an internal ID.
110:                        if (dso instanceof  Item || dso instanceof  BrowseItem) {
111:                            return "/metadata/internal/item/" + dso.getID()
112:                                    + "/mets.xml";
113:                        } else if (object instanceof  Collection) {
114:                            return "/metadata/internal/collection/"
115:                                    + dso.getID() + "/mets.xml";
116:                        } else if (object instanceof  Community) {
117:                            return "/metadata/internal/community/"
118:                                    + dso.getID() + "/mets.xml";
119:                        }
120:                    }
121:                }
122:
123:                return null;
124:            }
125:
126:            /**
127:             * Return a pretty specific string giving a hint to the theme as to what
128:             * type of DSpace object is being refrenced.
129:             */
130:            public String getObjectType(Object object) throws WingException {
131:                if (object instanceof  Item || object instanceof  BrowseItem) {
132:                    return "DSpace Item";
133:                } else if (object instanceof  Collection) {
134:                    return "DSpace Collection";
135:                } else if (object instanceof  Community) {
136:                    return "DSpace Community";
137:                }
138:
139:                return null;
140:            }
141:
142:            /**
143:             * Return a globably unique identifier for the repository. For dspace, we use the handle prefix.
144:             */
145:            public String getRepositoryIdentifier(Object object)
146:                    throws WingException {
147:                return ConfigurationManager.getProperty("handle.prefix");
148:            }
149:
150:            /**
151:             * Return the metadata URL for this repository.
152:             */
153:            public String getRepositoryURL(Object object) throws WingException {
154:                String handlePrefix = ConfigurationManager
155:                        .getProperty("handel.prefix");
156:                return "/metadata/internal/repository/" + handlePrefix
157:                        + "/mets.xml";
158:            }
159:
160:            /**
161:             * For the DSpace implementation we just return a hash of one entry which contains
162:             * a reference to this repository's metadata.
163:             */
164:            public HashMap<String, String> getAllManagedRepositories()
165:                    throws WingException {
166:                String handlePrefix = ConfigurationManager
167:                        .getProperty("handle.prefix");
168:
169:                HashMap<String, String> allRepositories = new HashMap<String, String>();
170:                allRepositories.put(handlePrefix,
171:                        "/metadata/internal/repository/" + handlePrefix
172:                                + "/mets.xml");
173:
174:                return allRepositories;
175:            }
176:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.