Source Code Cross Referenced for ParameterIncludeImpl.java in  » Web-Services-AXIS2 » kernal » org » apache » axis2 » description » 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 » Web Services AXIS2 » kernal » org.apache.axis2.description 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:
020:        package org.apache.axis2.description;
021:
022:        import org.apache.axiom.om.OMAttribute;
023:        import org.apache.axiom.om.OMElement;
024:        import org.apache.axis2.AxisFault;
025:        import org.apache.axis2.deployment.DeploymentConstants;
026:        import org.apache.axis2.util.ObjectStateUtils;
027:        import org.apache.commons.logging.Log;
028:        import org.apache.commons.logging.LogFactory;
029:
030:        import javax.xml.namespace.QName;
031:        import java.io.Externalizable;
032:        import java.io.IOException;
033:        import java.io.ObjectInput;
034:        import java.io.ObjectOutput;
035:        import java.util.ArrayList;
036:        import java.util.Collection;
037:        import java.util.HashMap;
038:        import java.util.Iterator;
039:
040:        /**
041:         * Class ParameterIncludeImpl
042:         */
043:        public class ParameterIncludeImpl implements  ParameterInclude,
044:                Externalizable {
045:
046:            /*
047:             * setup for logging
048:             */
049:            private static final Log log = LogFactory
050:                    .getLog(ParameterIncludeImpl.class);
051:
052:            private static final String myClassName = "ParameterIncludeImpl";
053:
054:            /**
055:             * @serial The serialization version ID tracks the version of the class.
056:             * If a class definition changes, then the serialization/externalization
057:             * of the class is affected. If a change to the class is made which is
058:             * not compatible with the serialization/externalization of the class,
059:             * then the serialization version ID should be updated.
060:             * Refer to the "serialVer" utility to compute a serialization
061:             * version ID.
062:             */
063:            private static final long serialVersionUID = 8153736719090126891L;
064:
065:            /**
066:             * @serial Tracks the revision level of a class to identify changes to the
067:             * class definition that are compatible to serialization/externalization.
068:             * If a class definition changes, then the serialization/externalization
069:             * of the class is affected.
070:             * Refer to the writeExternal() and readExternal() methods.
071:             */
072:            // supported revision levels, add a new level to manage compatible changes
073:            private static final int REVISION_1 = 1;
074:            // current revision level of this object
075:            private static final int revisionID = REVISION_1;
076:
077:            /**
078:             * Field parmeters
079:             */
080:            protected final HashMap parameters;
081:
082:            /**
083:             * Constructor ParameterIncludeImpl.
084:             */
085:            public ParameterIncludeImpl() {
086:                parameters = new HashMap();
087:            }
088:
089:            /**
090:             * Method addParameter
091:             *
092:             * @param param
093:             */
094:            public void addParameter(Parameter param) {
095:                if (param != null) {
096:                    parameters.put(param.getName(), param);
097:                }
098:            }
099:
100:            public void removeParameter(Parameter param) throws AxisFault {
101:                parameters.remove(param.getName());
102:            }
103:
104:            /**
105:             * Since at runtime it parameters may be modified
106:             * to get the original state this method can be used
107:             *
108:             * @param parameters <code>OMElement</code>
109:             * @throws AxisFault
110:             */
111:            public void deserializeParameters(OMElement parameters)
112:                    throws AxisFault {
113:                Iterator iterator = parameters.getChildrenWithName(new QName(
114:                        DeploymentConstants.TAG_PARAMETER));
115:
116:                while (iterator.hasNext()) {
117:
118:                    // this is to check whether some one has locked the parmeter at the top level
119:                    OMElement parameterElement = (OMElement) iterator.next();
120:                    Parameter parameter = new Parameter();
121:
122:                    // setting parameterElement
123:                    parameter.setParameterElement(parameterElement);
124:
125:                    // setting parameter Name
126:                    OMAttribute paraName = parameterElement
127:                            .getAttribute(new QName(
128:                                    DeploymentConstants.ATTRIBUTE_NAME));
129:
130:                    parameter.setName(paraName.getAttributeValue());
131:
132:                    // setting parameter Value (the child element of the parameter)
133:                    OMElement paraValue = parameterElement.getFirstElement();
134:
135:                    if (paraValue != null) {
136:                        parameter.setValue(parameterElement);
137:                        parameter.setParameterType(Parameter.OM_PARAMETER);
138:                    } else {
139:                        String paratextValue = parameterElement.getText();
140:
141:                        parameter.setValue(paratextValue);
142:                        parameter.setParameterType(Parameter.TEXT_PARAMETER);
143:                    }
144:
145:                    // setting locking attribute
146:                    OMAttribute paraLocked = parameterElement
147:                            .getAttribute(new QName(
148:                                    DeploymentConstants.ATTRIBUTE_LOCKED));
149:
150:                    if (paraLocked != null) {
151:                        String lockedValue = paraLocked.getAttributeValue();
152:
153:                        if ("true".equals(lockedValue)) {
154:                            parameter.setLocked(true);
155:                        } else {
156:                            parameter.setLocked(false);
157:                        }
158:                    }
159:
160:                    addParameter(parameter);
161:                }
162:            }
163:
164:            /**
165:             * Method getParameter.
166:             *
167:             * @param name
168:             * @return Returns parameter.
169:             */
170:            public Parameter getParameter(String name) {
171:                return (Parameter) parameters.get(name);
172:            }
173:
174:            public ArrayList getParameters() {
175:                Collection col = parameters.values();
176:                ArrayList para_list = new ArrayList();
177:
178:                for (Iterator iterator = col.iterator(); iterator.hasNext();) {
179:                    Parameter parameter = (Parameter) iterator.next();
180:
181:                    para_list.add(parameter);
182:                }
183:
184:                return para_list;
185:            }
186:
187:            // to check whether the parameter is locked at any level
188:            public boolean isParameterLocked(String parameterName) {
189:                return false;
190:            }
191:
192:            /* ===============================================================
193:             * Externalizable support 
194:             * ===============================================================
195:             */
196:
197:            /**
198:             * Save the contents of this object.
199:             * <p/>
200:             * NOTE: Transient fields and static fields are not saved.
201:             * Also, objects that represent "static" data are
202:             * not saved, except for enough information to be
203:             * able to find matching objects when the message
204:             * context is re-constituted.
205:             *
206:             * @param out The stream to write the object contents to
207:             * @throws IOException
208:             */
209:            public void writeExternal(ObjectOutput out) throws IOException {
210:                // write out contents of this object
211:
212:                //---------------------------------------------------------
213:                // in order to handle future changes to the message 
214:                // context definition, be sure to maintain the 
215:                // object level identifiers
216:                //---------------------------------------------------------
217:                // serialization version ID
218:                out.writeLong(serialVersionUID);
219:
220:                // revision ID
221:                out.writeInt(revisionID);
222:
223:                //---------------------------------------------------------
224:                // collection of parameters
225:                //---------------------------------------------------------
226:                ObjectStateUtils.writeHashMap(out, parameters,
227:                        "ParameterIncludeImpl.parameters");
228:
229:            }
230:
231:            /**
232:             * Restore the contents of the object that was previously saved.
233:             * <p/>
234:             * NOTE: The field data must read back in the same order and type
235:             * as it was written.  Some data will need to be validated when
236:             * resurrected.
237:             *
238:             * @param in The stream to read the object contents from
239:             * @throws IOException
240:             * @throws ClassNotFoundException
241:             */
242:            public void readExternal(ObjectInput in) throws IOException,
243:                    ClassNotFoundException {
244:                // trace point
245:                if (log.isTraceEnabled()) {
246:                    log
247:                            .trace(myClassName
248:                                    + ":readExternal():  BEGIN  bytes available in stream ["
249:                                    + in.available() + "]  ");
250:                }
251:
252:                // serialization version ID
253:                long suid = in.readLong();
254:
255:                // revision ID
256:                int revID = in.readInt();
257:
258:                // make sure the object data is in a version we can handle
259:                if (suid != serialVersionUID) {
260:                    throw new ClassNotFoundException(
261:                            ObjectStateUtils.UNSUPPORTED_SUID);
262:                }
263:
264:                // make sure the object data is in a revision level we can handle
265:                if (revID != REVISION_1) {
266:                    throw new ClassNotFoundException(
267:                            ObjectStateUtils.UNSUPPORTED_REVID);
268:                }
269:
270:                //---------------------------------------------------------
271:                // collection of parameters
272:                //---------------------------------------------------------
273:
274:                HashMap tmp = ObjectStateUtils.readHashMap(in,
275:                        "ParameterIncludeImpl.parameters");
276:
277:                if (tmp != null) {
278:                    if (parameters != null) {
279:                        parameters.putAll(tmp);
280:                    } else {
281:                        if (log.isTraceEnabled()) {
282:                            log
283:                                    .trace(myClassName
284:                                            + ":readExternal():  WARNING: parameters doesnot have a defined HashMap ");
285:                        }
286:                    }
287:                }
288:
289:                //---------------------------------------------------------
290:                // done
291:                //---------------------------------------------------------
292:
293:            }
294:
295:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.