Source Code Cross Referenced for JNDIResultSet.java in  » Portal » Open-Portal » com » sun » portal » search » db » 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 » Portal » Open Portal » com.sun.portal.search.db 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.search.db;
007:
008:        import com.sun.portal.search.rdm.*;
009:        import com.sun.portal.search.soif.*;
010:        import com.sun.portal.search.util.*;
011:
012:        import javax.naming.*;
013:        import javax.naming.directory.*;
014:
015:        import java.util.*;
016:
017:        /**
018:         *
019:         * JNDI search result set implementation using RDMResultSet
020:         *
021:         */
022:        public class JNDIResultSet extends RDMResultSet {
023:
024:            private List hits;
025:
026:            int startHit;
027:            int endHit;
028:            long hitCount;
029:            long docCount;
030:            int resultCount;
031:
032:            /** 
033:             * Creates a new instance of JNDIResultSet 
034:             */
035:            JNDIResultSet(SToken st, RDMDb database, String query,
036:                    RDMTransaction t) {
037:                super (st, database, query, t);
038:            }
039:
040:            /**
041:             * Prepare JNDI Search Results 
042:             */
043:            void setJNDISearchResult(NamingEnumeration ne) throws RDMException {
044:                startHit = 0;
045:                endHit = 0;
046:                hitCount = 0;
047:                resultCount = 0;
048:                docCount = 0;
049:
050:                hits = new ArrayList();
051:                try {
052:                    while (ne.hasMoreElements()) {
053:                        Object o = ne.next();
054:                        hits.add(o);
055:                    }
056:                } catch (Exception e) {
057:                    throw new RDMException(e);
058:                }
059:                int i = hits.size();
060:                if (i > 0) {
061:                    startHit = 1;
062:                    endHit = i;
063:                    hitCount = i;
064:                    resultCount = i;
065:                    docCount = i;
066:                }
067:
068:            }
069:
070:            /**
071:             * Set default attributes 
072:             */
073:            static Set defaultView = new HashSet();
074:            static {
075:                defaultView.add("hl-description");
076:                defaultView.add("hl-title");
077:                defaultView.add("url");
078:                defaultView.add("content-length");
079:            }
080:
081:            /**
082:             * Retrieve Search Results
083:             * @param i Document index
084:             * @param view Attributes
085:             * @param hltags Highlight tags
086:             * @return a SOIF hit, highlighted and filtered by view
087:             */
088:            public SOIF getResult(int i, Set view, String[] hltags) {
089:
090:                SearchResult sr = (SearchResult) hits.get(i);
091:                Attributes sra = sr.getAttributes();
092:                SOIF s = null;
093:
094:                try {
095:                    s = new SOIF("DOCUMENT", sr.getName());
096:                    NamingEnumeration avs = sra.getAll();
097:                    if (avs != null) {
098:                        while (avs.hasMore()) {
099:                            Attribute av = (Attribute) avs.next();
100:                            String name = av.getID();
101:                            NamingEnumeration n = (NamingEnumeration) av
102:                                    .getAll();
103:                            int j = 0;
104:                            while (n.hasMore()) {
105:                                Object o = n.next();
106:                                if (o != null && o instanceof  String) {
107:                                    s.insert(name, (String) o, j++);
108:                                }
109:                            }
110:                        }
111:                    }
112:
113:                    if (view != null && view.contains("score")) {
114:                        s.insert("score", "100");
115:                    }
116:
117:                } catch (NamingException ne) {
118:                    //do nothing
119:                }
120:                return s;
121:            }
122:
123:            /**
124:             * Get hit count
125:             * @return total number of hits for this search
126:             */
127:            public long getHitCount() {
128:                return hitCount;
129:            }
130:
131:            /**
132:             * Get document count
133:             * @return number of docs searched
134:             */
135:            public long getDocCount() {
136:                return hits.size();
137:            }
138:
139:            /**
140:             * Transform the result set to string
141:             * @return tring representation of this result set
142:             */
143:            public java.lang.String toString() {
144:                return super .toString();
145:            }
146:
147:            /**
148:             * Get search result count
149:             * @return current number of hits in this set
150:             */
151:            public int getResultCount() {
152:                return resultCount;
153:            }
154:
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.