public class BasicService extends java.lang.Object implements IInternalService
Modifier and Type | Field and Description |
---|---|
protected static long |
idcnt
The id counter.
|
protected java.lang.Class<?> |
impltype |
protected IInternalAccess |
internalaccess
Internal access to its component.
|
protected IComponentIdentifier |
providerid
The provider id.
|
protected boolean |
shutdowned
The shutdowned state.
|
protected IServiceIdentifier |
sid
The service id.
|
protected boolean |
started
The started state.
|
protected java.lang.Class<?> |
type |
EMPTY_SERVICES
Constructor and Description |
---|
BasicService(IComponentIdentifier providerid,
java.lang.Class<?> type,
java.lang.Class<?> impltype,
java.util.Map<java.lang.String,java.lang.Object> properties)
Create a new service.
|
BasicService(IComponentIdentifier providerid,
java.lang.Class<?> type,
java.util.Map<java.lang.String,java.lang.Object> properties)
Create a new service.
|
Modifier and Type | Method and Description |
---|---|
static IServiceIdentifier |
createServiceIdentifier(IComponentIdentifier providerid,
java.lang.String servicename,
java.lang.Class<?> servicetype,
java.lang.Class<?> serviceimpl,
IResourceIdentifier rid,
java.lang.String scope)
Create a new service identifier.
|
void |
createServiceIdentifier(java.lang.String name,
java.lang.Class<?> implclazz,
IResourceIdentifier rid,
java.lang.Class<?> type,
java.lang.String scope)
Set the service identifier.
|
boolean |
equals(java.lang.Object obj)
Check if the service is equal.
|
static java.lang.String |
generateServiceName(java.lang.Class<?> service)
Generate a unique name.
|
java.lang.Class<?> |
getInterfaceType()
Get the interface type.
|
IInternalAccess |
getInternalAccess()
Get the internal access.
|
static long |
getMethodTimeout(java.lang.Class<?>[] interfaces,
java.lang.reflect.Method method,
boolean remote)
Get the default timeout for a method.
|
java.util.Map<java.lang.String,java.lang.Object> |
getPropertyMap()
Get a service property.
|
IComponentIdentifier |
getProviderId()
Get the providerid.
|
IServiceIdentifier |
getServiceIdentifier()
Get the service id.
|
int |
hashCode()
Get the hashcode.
|
protected IFuture<java.lang.Void> |
initNFProperties()
Init the non-functional properties (todo: move to other location?)
|
IFuture<java.lang.Boolean> |
isValid()
Test if the service is valid.
|
IFuture<java.lang.Void> |
setComponentAccess(IInternalAccess access)
Sets the access for the component.
|
void |
setPropertyMap(java.util.Map<java.lang.String,java.lang.Object> properties)
Set the properties.
|
IFuture<java.lang.Void> |
shutdownService()
Shutdown the service.
|
IFuture<java.lang.Void> |
startService()
Start the service.
|
java.lang.String |
toString()
Get a string representation.
|
protected static long idcnt
protected IInternalAccess internalaccess
protected boolean started
protected boolean shutdowned
protected IServiceIdentifier sid
protected IComponentIdentifier providerid
protected java.lang.Class<?> type
protected java.lang.Class<?> impltype
public BasicService(IComponentIdentifier providerid, java.lang.Class<?> type, java.util.Map<java.lang.String,java.lang.Object> properties)
public BasicService(IComponentIdentifier providerid, java.lang.Class<?> type, java.lang.Class<?> impltype, java.util.Map<java.lang.String,java.lang.Object> properties)
public IFuture<java.lang.Boolean> isValid()
public void createServiceIdentifier(java.lang.String name, java.lang.Class<?> implclazz, IResourceIdentifier rid, java.lang.Class<?> type, java.lang.String scope)
createServiceIdentifier
in interface IInternalService
public IServiceIdentifier getServiceIdentifier()
getServiceIdentifier
in interface IService
public IComponentIdentifier getProviderId()
public IFuture<java.lang.Void> setComponentAccess(IInternalAccess access)
setComponentAccess
in interface IInternalService
access
- Component access.protected IFuture<java.lang.Void> initNFProperties()
public java.util.Map<java.lang.String,java.lang.Object> getPropertyMap()
getPropertyMap
in interface IService
public void setPropertyMap(java.util.Map<java.lang.String,java.lang.Object> properties)
properties
- The properties to set.public IFuture<java.lang.Void> startService()
startService
in interface IInternalService
public IFuture<java.lang.Void> shutdownService()
shutdownService
in interface IInternalService
public static java.lang.String generateServiceName(java.lang.Class<?> service)
The
- calling service class.public static IServiceIdentifier createServiceIdentifier(IComponentIdentifier providerid, java.lang.String servicename, java.lang.Class<?> servicetype, java.lang.Class<?> serviceimpl, IResourceIdentifier rid, java.lang.String scope)
providerid
- The provider id.servicename
- The service name.public IInternalAccess getInternalAccess()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- Object of comparison.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static long getMethodTimeout(java.lang.Class<?>[] interfaces, java.lang.reflect.Method method, boolean remote)
public java.lang.Class<?> getInterfaceType()