Package jadex.noplatform.services
Class BaseService
- java.lang.Object
-
- jadex.noplatform.services.BaseService
-
- All Implemented Interfaces:
IInternalService,IService
- Direct Known Subclasses:
ClockService,ExecutionService,LibraryService
public abstract class BaseService extends java.lang.Object implements IService, IInternalService
Base implementation for no platform services.
-
-
Field Summary
Fields Modifier and Type Field Description protected IComponentIdentifiercidprotected IServiceIdentifiersid-
Fields inherited from interface jadex.bridge.service.IService
EMPTY_SERVICES
-
-
Constructor Summary
Constructors Constructor Description BaseService(IComponentIdentifier cid, java.lang.Class<?> iface)Create a new base service.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IComponentIdentifiergetComponentId()IFuture<MethodInfo[]>getMethodInfos()Get reflective info about the service methods, args, return types.java.util.Map<java.lang.String,java.lang.Object>getPropertyMap()Get the map of properties (considered as constant).IServiceIdentifiergetServiceId()Get the service identifier.IFuture<java.lang.Object>invokeMethod(java.lang.String methodname, ClassInfo[] argtypes, java.lang.Object[] args, ClassInfo returntype)todo: support also blackbox args (e.g. byte[]) as args could also use classes that are not available.IFuture<java.lang.Boolean>isValid()Test if the service is valid.IFuture<java.lang.Void>setComponentAccess(IInternalAccess access)Sets the access for the component.voidsetServiceIdentifier(IServiceIdentifier sid)Set the service identifier.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jadex.bridge.service.IInternalService
shutdownService, startService
-
-
-
-
Field Detail
-
cid
protected IComponentIdentifier cid
-
sid
protected IServiceIdentifier sid
-
-
Constructor Detail
-
BaseService
public BaseService(IComponentIdentifier cid, java.lang.Class<?> iface)
Create a new base service.
-
-
Method Detail
-
getServiceId
public IServiceIdentifier getServiceId()
Get the service identifier.- Specified by:
getServiceIdin interfaceIService- Returns:
- The service identifier.
-
isValid
public IFuture<java.lang.Boolean> isValid()
Test if the service is valid.
-
getPropertyMap
public java.util.Map<java.lang.String,java.lang.Object> getPropertyMap()
Get the map of properties (considered as constant).- Specified by:
getPropertyMapin interfaceIService- Returns:
- The service property map (if any).
-
invokeMethod
public IFuture<java.lang.Object> invokeMethod(java.lang.String methodname, ClassInfo[] argtypes, java.lang.Object[] args, ClassInfo returntype)
todo: support also blackbox args (e.g. byte[]) as args could also use classes that are not available. Invoke a method reflectively.- Specified by:
invokeMethodin interfaceIService- Parameters:
methodname- The method name.argtypes- The argument types (can be null if method exists only once).args- The arguments.returntype- The future return type if it is a specific future.- Returns:
- The result.
-
getMethodInfos
public IFuture<MethodInfo[]> getMethodInfos()
Get reflective info about the service methods, args, return types.- Specified by:
getMethodInfosin interfaceIService- Returns:
- The method infos.
-
getComponentId
public IComponentIdentifier getComponentId()
- Returns:
- the cid
-
setComponentAccess
public IFuture<java.lang.Void> setComponentAccess(IInternalAccess access)
Description copied from interface:IInternalServiceSets the access for the component.- Specified by:
setComponentAccessin interfaceIInternalService- Parameters:
access- Component access.
-
setServiceIdentifier
public void setServiceIdentifier(IServiceIdentifier sid)
Description copied from interface:IInternalServiceSet the service identifier.- Specified by:
setServiceIdentifierin interfaceIInternalService
-
-