
com.vii.brillien.kernel.axiom.atomic.PresenceManager Maven / Gradle / Ivy
/*
* 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.atomic;
import com.vii.brillien.kernel.BrillienException;
import com.vii.brillien.kernel.axiom.scheduling.CronPattern;
import com.vii.brillien.kernel.axiom.transport.Communication;
import com.vii.brillien.kernel.axiom.transport.Mediator;
import java.lang.reflect.Method;
import java.util.Collection;
import java.util.Map;
import java.util.logging.Level;
/**
* Instantiation manager interface, factory-like interface according the environment of the component like: used libraries, component version, transaction management, instance management type, etc.
* A Presence type (class) is managed by this object to create/build/stop/destruct instances.
*/
public interface PresenceManager extends Unit
{
/**
* Initializes the PresenceManager with the given class instance, reads the annotations of the presence type
* @param PresenceClass presence class instance
*/
void initPresenceManager( String presenceName, Class
PresenceClass, String apiVersion ) throws BrillienException;
/**
* Getter method to request the Class definition of a specific Presence type
*/
Class
getPresenceClass();
/**
* Retrieves the version of the given presence
*/
String getPresenceApiVersion();
/**
* Retrieves the service methods of the presence type managed by this manager
* @return
*/
Collection getServiceMethods();
/**
* Retrieves the parameters with their Java types of the service methods of the presence type managed by this manager
*/
Map> getServiceTypedParameters( );
/**
* Dynamically registers new service provided by a given presence
*/
void addPresenceService(String service, Map parameters);
/**
* Retrieves the parameters of the service methods of the presence type managed by this manager
*/
Map> getServiceParameters( );
/**
* Getter method to request the prefix for generating FlowIDs
*/
String getFlowIDPrefix();
/**
* Getter method for a new instance of the Presence type specifying the caller
*/
P getInstance( Presence caller ) throws BrillienException;
/**
* Getter method for a new instance of the Presence type specifying the ID of the flow
*/
P getInstance( String flowID ) throws BrillienException ;
/**
* Getter method for a new instance of the Presence type specifying the caller
*/
P getInstance( Presence caller, String name ) throws BrillienException;
/**
* Getter method for a new instance of the Presence type specifying the ID of the flow
*/
P getInstance( String flowID, String name ) throws BrillienException ;
/**
* The Presence instance managed by this PresenceManager will be retrieved
* @param presence presence to be retrieved
*/
void retrieveReference(P presence) throws BrillienException;
/**
* All given Presence instances managed by this PresenceManager will be retrieved
* @param presences presences to be retrieved
*/
void retrieveReferences(Iterable presences) throws BrillienException;
/**
* Getter method for the classloader assigned to this PresenceManager
*/
ClassLoader getClassLoader( );
/**
* Sets classloader to be assigned to this PresenceManager
*/
void setClassLoader(ClassLoader classLoader);
/**
* Getter method to get the instance creation method to follow regarding this Presence type.
* One of the following will be returned:
* RESIDENT, Sparkle, CONSONANT
* @return instance creation type ID
*/
int getManagementType();
/**
* Tells whether the services of this class is protected by the SSO if present
*/
boolean isSSOProtected();
/**
* Tells whether the services of this class is protected by the API_KEY if present
*/
boolean isApiKeyProtected();
/**
* Retrieves the timeUnit value of the given Presence type. Measured in milliseconds.
*/
long getPresenceTimeMeasure();
/**
* Sets the timeUnit value of the the given Presence type, read from the nnnotation of the type. Measured in milliseconds.
*/
void setPresenceTimeMeasure(long timeMeasure);
/**
* Retrieces the date pattern of the the given Presence type for callable activity scheduling
*/
String getPresenceDatePattern();
/**
* Sets the date pattern of the the given Presence type for callable activity scheduling
*/
void setPresenceDatePattern(String datePattern);
/**
* Gets the CronPattern instance made from datePattern string
*/
CronPattern getPresenceCronPattern();
/**
* Sets the CronPattern instance made from datePattern string
*/
void setPresenceCronPattern(CronPattern cronPattern);
/**
* Gets the periodicity flag of the given Presence type
*/
boolean isPresencePeriodical();
/**
* Sets the periodicity flag of the given Presence type
*/
void setPresencePeriodical(boolean presencePeriodical);
/**
* Gets the timout for message processing. Every incoming message which has been sent before (currentTimeMillis-expiration) is considered as expired amd will be ignored.
*/
long getMessageExpiration();
/**
* Sets the timout for message processing. Every incoming message which has been sent before (currentTimeMillis-expiration) is considered as expired amd will be ignored.
*/
void setMessageExpiration(long messageExpiration);
/**
* Tells whether the presences managed by this presencemanager reject all messages without an associated handler to it
*/
boolean isStrait();
/**
* Sets if the presences managed by this presencemanager reject all messages without an associated handler to it
*/
void setStrait(boolean strait);
/**
* Getter method for log type of the specific Presence type
*/
int getLogType();
/**
* Setter method for log type of the specific Presence type
* @param logType log type
*/
void setLogType(int logType);
/**
* Getter method for log level of the specific Presence type
*/
Level getLogLevel();
/**
* Setter method for log level of the specific Presence type
* @param logLevel log level
*/
void setLogLevel(String logLevel);
/**
* Getter method for getting input parameters
* @return parametersMap parameters' hashmap read from the presence config file
*/
Map getParameters();
/**
* Setter method for adding input Parameters for every given Presence creation
* @param parameters parameters' hashmap read from the presence config file
*/
void setParameters(Map parameters);
/**
* Sets custom SSO presence
*/
void setSSOPresenceName(String ssoPresenceName);
/**
* Presences let the PresenceManager to know about the messages sent through this method
*/
void markMessageToSend(C shared, C message);
void setPresenceBoard(PresenceBoard board);
PresenceBoard getPresenceBoard();
/**
* Retrieves a mediator representing the transport layer
*/
Mediator getMediator();
}