All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.kth.iss.ug2.Ug2Message Maven / Gradle / Ivy

/*
 * MIT License
 *
 * Copyright (c) 2017 Kungliga Tekniska högskolan
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package se.kth.iss.ug2;

import java.util.List;

import se.kth.iss.ug2server.SessionKey;

public interface Ug2Message {

    public Ug2Message createReplyMsg();

    /**
     * 

* Adds a name-value pair to the message. The message as such is only an * unsorted group of name-value pairs. *

*

* If either the name or the value is null, the pair is silently ignored and * NOT added to the message. *

* * @param name The name tag of the name-value pair added to the message. * @param value The value part of the name-value pair added to the message. * @throws Ug2Exception if the maximum number of parameters would be * exceeded after adding the name-value pair, or if the maximum size would * be exceeded, or if no UTF-8 URLEncoder implementation can be loaded. */ public void addString(String name, String value) throws Ug2Exception; /** *

* Adds a name-value pair to the message. The message as such is only an * unsorted group of name-value pairs. Null values are silently ignored. *

*

* If either the name or the value is null, the pair is silently ignored and * NOT added to the message. *

* * @param name The name tag of the name-value pair added to the message. * @param value The value part of the name-value pair added to the message. * @throws RuntimeException if no UTF-8 URLEncoder implementation can be * loaded. */ public void addStringNoCheck(String name, String value); /** * Gets the value from the value pair as a string. * * @param name the name of the value pair. * @return the value. * @throws Ug2Exception if the value doesn't exist. */ public String readStringMandatory(String name) throws Ug2Exception; /** * Gets the value from the value pair as a string. * * @param name the name of the value. * @return the value or null if it doesn't exist. */ public String readStringNoThrow(String name); /** * Gets the value from the value pair as an int. * * @param name the name of the value. * @return the value or -1 if the value can't be found or if it can't be * interpreted as an integer. */ public int readIntNoThrow(String name); /** * Gets the value from the value pair as an int. * * @param name the name of the value pair. * @return the value. * @throws Ug2Exception if the value doesn't exist or if it can't be * interpreted as an int. */ public int readIntMandatory(String name) throws Ug2Exception; /** * Gets the value from the value pair as a long. * * @param name the name of the value. * @return the value or -1 if the value can't be found or if it can't be * interpreted as a long. */ public long readLongNoThrow(String name); /** * Gets the value from the value pair as a Long. * * @param name the name of the value. * @return the value or null if the value can't be found or if it can't be * interpreted as a Long. */ public Long getLong(String name); /** * Gets the value from the value pair as a String array. * * @param name the name of the value pair. * @return the array. * @throws Ug2Exception if the value pair doesn't exist or the number of * array entries can't be retrieved or the array data can't be Base64 * decoded or if the array data can't be decompressed. */ public String[] readArrayMandatory(String name) throws Ug2Exception; public List readList(String name) throws Ug2Exception; /** * Gets the value from the value pair as a String array. * * @param name the name of the value pair. * @return the array or null if the value pair doesn't exist or the number * of array entries can't be retrieved or the array data can't be Base64 * decoded or if the array data can't be decompressed. */ public String[] readArrayNoThrow(String name); public Ug2ObjectHandle readObjectHandleNoThrow(String base); public Ug2ObjectHandle readObjectHandleMandatory(String base) throws Ug2Exception; public boolean readBool(String name) throws Ug2Exception; public void addTicketInfoArrayNoCheck(Ug2TicketInformation... ticketInfo); public void addTicketInfoNoCheck(Ug2TicketInformation ticketInfo); public void addInt(String name, int value) throws Ug2Exception; public void addLongNoCheck(String name, long value); public void addObjectHandle(Ug2ObjectHandle obj, String tagBase) throws Ug2Exception; /** * Adds an array containing String objects to the msg after converting it to * the internal Ug2Msg format. * * @param array A String array holding the values. * @param name The base part of the tag name that this array will be added * as. * @throws Ug2Exception on errors. */ public void addArray(String[] array, String name) throws Ug2Exception; public void addArrayNoCheck(String[] array, String arrayName); public void addArray(boolean[] array, String arrayName) throws Ug2Exception; public void addChangeLogEntryArray(Ug2ChangeLogEntry... array) throws Ug2Exception; public void addAtomArray(Ug2Atom... array) throws Ug2Exception; public void addBadValueInformationArray(Ug2BadValueInformation[] array, String name) throws Ug2Exception; public void addGroupAdminProfile(Ug2GroupAdminProfile profile) throws Ug2Exception; public Ug2AppData[] readAppDataArray(String name) throws Ug2Exception; public void addAppDataArray(Ug2AppData[] array, String name) throws Ug2Exception; public void addOperationLog(Ug2OperationLogEntry[] log, String name) throws Ug2Exception; public void addAccessTypeArray(Ug2AccessType[] array, String tag) throws Ug2Exception; public void addSessionInfoNoCheck(Ug2SessionInformation info); public void addSessionInfoArrayNoCheck(Ug2SessionInformation... array); public void addSchema(Ug2Schema schema) throws Ug2Exception; public void addValues(String[] objectKthid, int attributeIndex, String[][] valueslist) throws Ug2Exception; public void addLookupValues(String[][] values) throws Ug2Exception; public void addSessionKey(SessionKey currentSessionKey, SessionKey sessionKey); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy