Source Code Cross Referenced for RDMHeader.java in  » Portal » Open-Portal » com » sun » portal » search » rdm » 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.rdm 
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.rdm;
007:
008:        import com.sun.portal.search.soif.*;
009:        import com.sun.portal.search.rdm.*;
010:        import java.util.*;
011:
012:        /**
013:         *  RDM Header Object
014:         *
015:         *  <pre>Valid SOIF Attribute names for @RDMHEADER objects:
016:         *	RDM-Version					REQUIRED
017:         *	RDM-Type					REQUIRED
018:         *	Catalog-Service-ID				RECOMMENDED
019:         *	RDM-Query-Language				REQUIRED if a request
020:         *	RDM-Response-Interpret				OPTIONAL if a response
021:         *	RDM-Error-Message				OPTIONAL if a response
022:         *	RDM-Error-Number				OPTIONAL if a response
023:         */
024:        public class RDMHeader {
025:
026:            SOIF soif;
027:
028:            /** parse a header out of a SOIF stream */
029:            public RDMHeader(SOIFInputStream ss) throws Exception {
030:                this ();
031:                SOIF s = ss.readSOIF();
032:
033:                // Look for a valid RDMHeader
034:                if (s == null
035:                        || !s.getSchemaName()
036:                                .equalsIgnoreCase(RDM.A_SN_RDM_HDR))
037:                    throw new Exception("Invalid header");
038:
039:                // Look for valid msgtype
040:                String type;
041:                if ((type = s.getValue(RDM.A_RDM_TYPE)) == null)
042:                    type = RDM.RDM_MSGTYPE_UNKNOWN;
043:
044:                soif = s;
045:
046:                // Validate header
047:                String vers = getVersion();
048:                if (getType() == RDM.RDM_MSGTYPE_UNKNOWN
049:                        || (vers != null && !vers.equalsIgnoreCase("1.0"))) {
050:                    throw new Exception("Invalid header");
051:                }
052:            }
053:
054:            /** create a request header */
055:            public RDMHeader(String rdmtype, String csid, String ql, String ri) {
056:                this (rdmtype);
057:                if (csid != null)
058:                    setCSID(csid);
059:                // for request header
060:                if (ql != null)
061:                    setQueryLanguage(ql);
062:                // for response header
063:                if (ri != null)
064:                    setResponseInterpret(ri);
065:            }
066:
067:            /** create a generic header */
068:            public RDMHeader(String rdmtype) {
069:                soif = new SOIF(RDM.A_SN_RDM_HDR, null);
070:                setType(rdmtype);
071:                setVersion("1.0");
072:            }
073:
074:            /** create an empty header */
075:            public RDMHeader() {
076:                soif = new SOIF(RDM.A_SN_RDM_HDR, null);
077:                setVersion("1.0");
078:            }
079:
080:            /** Macros for accessing @RDMHEADER values
081:             *  Use prototype: char *RDMHeader_GetXXX(RDMHeader *h).
082:             */
083:            public final String getType() {
084:                return soif.getValue(RDM.A_RDM_TYPE);
085:            }
086:
087:            public final String getVersion() {
088:                return soif.getValue(RDM.A_RDM_VERSION);
089:            }
090:
091:            public final String getQueryLanguage() {
092:                return soif.getValue(RDM.A_RDM_QL);
093:            }
094:
095:            public final String getCSID() {
096:                return soif.getValue(RDM.A_RDM_CSID);
097:            }
098:
099:            public final String getResponseInterpret() {
100:                return soif.getValue(RDM.A_RDM_RESP);
101:            }
102:
103:            public final String getErrorMessage() {
104:                return soif.getValue(RDM.A_RDM_EMSG);
105:            }
106:
107:            public final String getErrorNumber() {
108:                return soif.getValue(RDM.A_RDM_ERR);
109:            }
110:
111:            public final String getAccessToken() {
112:                return soif.getValue(RDM.A_RDM_ACCESS_TOKEN);
113:            }
114:
115:            public final String getUser() {
116:                return soif.getValue(RDM.A_RDM_USER);
117:            }
118:
119:            public final String getPassword() {
120:                return soif.getValue(RDM.A_RDM_PASSWORD);
121:            }
122:
123:            public final String getParam(String name) {
124:                return soif.getValue(name);
125:            }
126:
127:            public final SOIF getSOIF() {
128:                return soif;
129:            }
130:
131:            /** Macros for defining @RDMHEADER values
132:             *  Use prototype: int RDMHeader_SetXXX(RDMHeader *h, char *newvalue).
133:             */
134:            public final void setType(String s) { /* NOTE: Use (RDMHeader *, RDMType new) */
135:                soif.replace(RDM.A_RDM_TYPE, s);
136:            }
137:
138:            public final void setVersion(String s) {
139:                soif.replace(RDM.A_RDM_VERSION, s);
140:            }
141:
142:            public final void setQueryLanguage(String s) {
143:                soif.replace(RDM.A_RDM_QL, s);
144:            }
145:
146:            public final void setCSID(String s) {
147:                soif.replace(RDM.A_RDM_CSID, s);
148:            }
149:
150:            public final void setResponseInterpret(String s) {
151:                soif.replace(RDM.A_RDM_RESP, s);
152:            }
153:
154:            public final void setErrorMessage(String s) {
155:                soif.replace(RDM.A_RDM_EMSG, s);
156:            }
157:
158:            public final void setErrorNumber(String s) {
159:                soif.replace(RDM.A_RDM_ERR, s);
160:            }
161:
162:            public final void setAccessToken(String s) {
163:                soif.replace(RDM.A_RDM_ACCESS_TOKEN, s);
164:            }
165:
166:            public final void setUser(String s) {
167:                soif.replace(RDM.A_RDM_USER, s);
168:            }
169:
170:            public final void setPassword(String s) {
171:                soif.replace(RDM.A_RDM_PASSWORD, s);
172:            }
173:
174:            public final void setParam(String name, String value) {
175:                soif.replace(name, value);
176:            }
177:
178:            /** debug only - does not construct correct soif */
179:            public String toString() {
180:                String res = "";
181:                if (soif != null)
182:                    res += soif;
183:                return res;
184:            }
185:
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.