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.dataretrieval;
021:
022: import java.util.HashMap;
023:
024: /**
025: * Allow to specify options/parameters for getData request. The list is extensible
026: * based on the information needed for the Data Locator to process the request.
027: */
028:
029: public class DataRetrievalRequest extends HashMap {
030:
031: private static final long serialVersionUID = -374933082062124908L;
032:
033: /**
034: * Key used to define Dialect of data to be retrieved.
035: */
036: public final static String DIALET = "Dialect";
037: /**
038: * Key used to defined Identify of data to be retrieved.
039: */
040: public final static String IDENTIFIER = "Identifier";
041: /**
042: * Key used to define the output format of retrieved data to be returned.
043: */
044: public final static String OUTPUT_FORM = "OutputForm";
045:
046: /**
047: * Returns the Dialect value specified in the request.
048: *
049: * @return a String that has dialect info.
050: */
051:
052: public String getDialect() throws DataRetrievalException {
053: String dialect = (String) (get(DIALET));
054: if (dialect == null || dialect.length() == 0) {
055: throw new DataRetrievalException(
056: "Empty dialect was detected. Dialect must have value.");
057: }
058:
059: return (dialect);
060: }
061:
062: /**
063: * Returns the Identifier value specified in the request.
064: *
065: * @return a String that has Identifier info.
066: */
067:
068: public String getIdentifier() {
069: return (String) (get(IDENTIFIER));
070: }
071:
072: /**
073: * Returns the output format specified in the request.
074: *
075: * @return output format of data retrieved.
076: */
077:
078: public OutputForm getOutputForm() {
079: return (OutputForm) (get(OUTPUT_FORM));
080: }
081:
082: /**
083: * Allow to set the dialect of data to retrieve
084: *
085: * @param dialect - Valid dialect value supported by the Data Locator.
086: * @throws DataRetrievalException
087: */
088:
089: public void putDialect(String dialect)
090: throws DataRetrievalException {
091: if (dialect == null || dialect.length() == 0) {
092: throw new DataRetrievalException(
093: "Empty dialect was detected. Dialect must have value.");
094: }
095: put(DIALET, dialect);
096: }
097:
098: /**
099: * Allow to set the identifier of data to retrieve
100: *
101: * @param identifier - identifier value
102: * @throws DataRetrievalException
103: */
104:
105: public void putIdentifier(String identifier) {
106: put(IDENTIFIER, identifier);
107: }
108:
109: /**
110: * Allow to set the output format of the data retrieved.
111: *
112: * @param form - Valid output format types supported by the Data Locator.
113: * @throws DataRetrievalException
114: */
115:
116: public void putOutputForm(OutputForm form) {
117: put(OUTPUT_FORM, form);
118: }
119:
120: }
|