
com.vii.brillien.kernel.axiom.transport.Communication Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2012 Imre Fazekas.
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the Brillien nor the names of its
* terms and concepts may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package com.vii.brillien.kernel.axiom.transport;
import com.vii.brillien.kernel.BrillienException;
import com.vii.brillien.kernel.axiom.sso.Session;
import java.util.Map;
/**
* Data representation of an abstract Communication.
*/
public interface Communication {
/**
* According to the specification of Powerobject model, these constants defines the basic types of communication.
*/
final int TYPE_UNDEFINED = -1;
final int TYPE_UNKOWN = 0;
final int TYPE_GET = 1;
final int TYPE_AGET = 2;
final int TYPE_SET = 3;
final int TYPE_DELEGATED_SET = 4;
final int TYPE_RESULT = 5;
final int TYPE_ERROR = 6;
final String DEFAULT_FLOW_ID = "Unknown";
/**
* Gets the id of the given Communication
*/
String getId();
/**
* Sets the id of the given Communication
*/
void setId(String id);
/**
* Gets the type of the given Communication
*/
Integer getMessageType();
/**
* Sets the type of the given Communication
*/
void setMessageType(Integer messageType);
/**
* Gets the sender of the given Communication
*/
String getSender();
/**
* Sets the sender of the given Communication
*/
void setSender(String sender);
/**
* Gets the recipient of the given Communication
*/
String getRecipient();
/**
* Sets the recipient of the given Communication
*/
void setRecipient(String recipient);
/**
* Gets the id of the Flow where the given Communication appears in
*/
String getFlowID();
/**
* Sets the id of the Flow where the given Communication appears in
*/
void setFlowID(String flowID);
/**
* Gets the session of the given Communication
*/
Session getSession();
/**
* Sets the session of the given Communication
*/
void setSession(Session session);
/**
* Gets the api_key of the given Communication
*/
String getApiKey();
/**
* Sets the api_key of the given Communication
*/
void setApiKey(String apiKey);
/**
* Gets the api version of the sender service to be called
* Optional attribute
*/
String getSenderApiVersion();
/**
* Sets the api version of the sender service to be called
* Optional attribute
*/
void setSenderApiVersion(String apiVersion);
/**
* Gets the api version of the sender service to be called
* Optional attribute
*/
String getRecipientApiVersion();
/**
* Sets the api version of the sender service to be called
* Optional attribute
*/
void setRecipientApiVersion(String apiVersion);
/**
* Gets the subject of the given Communication
*/
String getSubject();
/**
* Sets the subject of the given Communication
*/
void setSubject(String subject);
/**
* Gets the recipient of the returning communication when this will be answered
*/
String getRedirectEntityName();
/**
* Sets the recipient of the returning communication when this will be answered
*/
void setRedirectEntityName(String redirectEntityName);
/**
* Gets the subject of the returning communication when this will be answered
*/
String getRedirectMessage();
/**
* Sets the subject of the returning communication when this will be answered
*/
void setRedirectMessage(String redirectMessage);
/**
* Gets the creation time of the given Communication
*/
Long getRequestTime();
/**
* Sets the creation time of the given Communication
*/
void setRequestTime(Long requestTime);
/**
* Gets the creation time of the given Communication if it is a response
*/
Long getResponseTime();
/**
* Sets the creation time of the given Communication if it is a response
*/
void setResponseTime(Long responseTime);
/**
* Retrieves the parameters of the given communication
*/
Map getParameters();
/**
* Sets the id of the given Communication
*/
void setParameters(Map parameters);
/**
* Gets the extension of the given Communication
*/
Map getExtension();
/**
* Sets the extension of the given Communication
*/
void setExtension(Map extension);
/**
* Maps the parameters of the given communication according to the give type mappings
*/
Map acquireParameters(Map types) throws BrillienException;
/**
* Gets the response object if this communication represents a respond to previous one
*/
T getResponse();
/**
* Sets the response object if this communication represents a respond to previous one
*/
void setResponse(Object response);
/**
* Maps the response object according to the given type mapping
*/
T acquireResponse(Class type) throws BrillienException;
/**
* Maps the response object according to the given type mapping
*/
T acquireResponse(Class type, Map typeHint) throws BrillienException;
/**
* Maps the response object according to the given type mapping
*/
T acquireResponse(Map typeHint) throws BrillienException;
/**
* Maps the response object according to the given type mapping
*/
T acquireResponse(String typeHint, Class hintClass) throws BrillienException;
/**
* Maps the response object according to the given type mapping
*/
T acquireResponse(Class type, String typeHint, Class hintClass) throws BrillienException;
/**
* Gets the type of a source ommunication which this communication represents a respond to
*/
Integer getOriginalType();
/**
* Sets the type of a source ommunication which this communication represents a respond to
*/
void setOriginalType(Integer originalType);
/**
* Gets the id of a source ommunication which this communication represents a respond to
*/
String getOriginalId();
/**
* Sets the id of a source ommunication which this communication represents a respond to
*/
void setOriginalId(String id);
/**
* Gets the value of an error if this is a communication about an error
*/
Integer getErrorCode() ;
/**
* Sets the code of an error if this is a communication about an error
*/
void setErrorCode(Integer errorCode);
/**
* Gets the value of an error if this is a communication about an error
*/
Object getErrorValue();
/**
* Sets the value of an error if this is a communication about an error
*/
void setErrorValue(Object errorValue);
/**
* Tells whether this Communication is an error message or not
*/
boolean isErrorCommunication();
boolean isAnswerTo(Communication msg);
/**
* Application or chanel specific extension can be added to a communication
*/
void addExtension(String key, Object value);
/**
* Tells whether the given excension exists
*/
boolean hasExcension(String key);
/**
* Retrieves application or chanel specific extension
*/
T getExtension(String key);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy