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


001:        /*
002:         * Copyright 2001 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.rdmgr;
007:
008:        import com.sun.portal.search.util.*;
009:        import com.sun.portal.search.soif.*;
010:        import com.sun.portal.search.rdm.*;
011:        import com.sun.portal.log.common.PortalLogger;
012:
013:        import java.io.*;
014:        import java.util.*;
015:        import java.util.logging.Logger;
016:        import java.util.logging.Level;
017:
018:        /**
019:         * Alias - Map aliases to SOIF-attribute names for rdmgr
020:         *
021:         * <pre> alias.conf files looks like (left is real attribute name, right are aliases):
022:         *   Classification	Classification-Id CategoryTerm Category
023:         */
024:        public class Alias {
025:
026:            // XXX this should be part of the schema
027:
028:            Map a2p = new HashMap();
029:
030:            /** read alias map from Schema into PBlock. */
031:            public Alias(RDMSchema schema) throws Exception {
032:                int i, j, n, nmv = 0;
033:                String attr;
034:                String alias_str = null;
035:                n = schema.getNumEntriesInt();
036:                for (i = 0; i < n; i++) {
037:                    if ((attr = schema.getSOIFAttribute(i)) != null
038:                            && (alias_str = schema.getAliases(i)) != null) {
039:                        String[] aliases = String2Array.string2Array(alias_str,
040:                                ',', true);
041:                        for (int k = 0; k < aliases.length; ++k)
042:                            a2p.put(aliases[k], attr);
043:                    }
044:                }
045:            }
046:
047:            public int size() {
048:                return a2p.size();
049:            }
050:
051:            /** This modifies the SOIF by renaming aliased attributes to their cnames */
052:            // XXX should be handled by indexer code and should not modify the SOIF
053:            public int map_soif(SOIF s) {
054:                int n = 0;
055:                if (a2p == null)
056:                    return n;
057:                Set aliases = a2p.entrySet();
058:                for (Iterator i = aliases.iterator(); i.hasNext();) {
059:                    Map.Entry me = (Map.Entry) i.next();
060:                    String alias = (String) me.getKey();
061:                    if (s.contains(alias)) {
062:                        String cname = (String) me.getValue();
063:                        SearchLogger.getLogger().log(Level.FINER,
064:                                "PSSH_CSPSRDMR0045",
065:                                new Object[] { alias, cname });
066:                        s.rename(alias, cname);
067:                        ++n;
068:                    }
069:                }
070:                return n;
071:            }
072:
073:            public String toString() {
074:                Set es = a2p.entrySet();
075:                String res = "";
076:                for (Iterator i = es.iterator(); i.hasNext();) {
077:                    Map.Entry me = (Map.Entry) i.next();
078:                    res = res + me.getKey() + " -> " + me.getValue() + "\n";
079:                }
080:                return res;
081:            }
082:
083:            /* stuff below is legacy - remove asap */
084:
085:            /** read alias map from file into PBlock. */
086:            public Alias(String aliasfile) throws Exception {
087:                BufferedReader r = new BufferedReader(new FileReader(aliasfile));
088:                String line;
089:                while ((line = r.readLine()) != null) {
090:                    if (line.length() == 0 || line.charAt(0) == '#')
091:                        continue; // skip blank lines and comments
092:
093:                    line = line.toLowerCase();
094:
095:                    if (parse(line) == -1) {
096:                        SearchLogger.getLogger().log(Level.WARNING,
097:                                "PSSH_CSPSRDMR0046", line);
098:                        continue;
099:                    }
100:                }
101:            }
102:
103:            /** copy - create pb_param for each alias name. */
104:            protected int copy(Map pb, String alias, String parent,
105:                    boolean unique) {
106:                if (unique && pb.containsKey(alias)) {
107:                    SearchLogger.getLogger().log(Level.WARNING,
108:                            "PSSH_CSPSRDMR0047", alias);
109:                    return -1;
110:                }
111:                pb.put(alias, parent);
112:                return 0;
113:            }
114:
115:            /** parse - processes one line from alias file. */
116:            protected int parse(String line) {
117:                String cname, alias;
118:                StringTokenizer st = new StringTokenizer(line);
119:                if ((cname = st.nextToken()) != null) {
120:                    while (st.hasMoreTokens()) {
121:                        alias = st.nextToken();
122:                        if (copy(a2p, alias, cname, true) == -1)
123:                            return -1;
124:                        SearchLogger.getLogger().log(Level.FINE,
125:                                "PSSH_CSPSRDMR0048",
126:                                new Object[] { alias, cname });
127:                    }
128:                }
129:                return 0;
130:            }
131:
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.