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

jadex.bridge.service.IService Maven / Gradle / Ivy

Go to download

Jadex bridge is a base package for kernels and platforms, i.e., it is used by both and provides commonly used interfaces and classes for active components and their management.

There is a newer version: 4.0.267
Show newest version
package jadex.bridge.service;

import java.util.Map;

import jadex.bridge.ClassInfo;
import jadex.bridge.service.annotation.FutureReturnType;
import jadex.bridge.service.annotation.Raw;
import jadex.bridge.service.annotation.Reference;
import jadex.commons.MethodInfo;
import jadex.commons.future.IFuture;


/**
 *  The interface for platform services.
 */
@Reference
public interface IService //extends INFMixedPropertyProvider //extends IRemotable INFPropertyProvider, INFMethodPropertyProvider, 
{
	//-------- constants --------
	
	/** Empty service array. */
	public static final IService[] EMPTY_SERVICES = new IService[0];

	//-------- methods --------

	// IMPORTANT: If name is changed, adapt also in BasicServiceInvocationHandler and in RemoteMethodInvocationHandler!
	/**
	 *  Get the service identifier.
	 *  @return The service identifier.
	 */
	public IServiceIdentifier getServiceId();
	
	/**
	 *  Test if the service is valid.
	 *  @return True, if service can be used.
	 */
	public IFuture isValid();
		
	/**
	 *  Get the map of properties (considered as constant).
	 *  @return The service property map (if any).
	 */
	@Raw
	public Map getPropertyMap();
	
	/**
	 *  todo: support also blackbox args (e.g. byte[]) as args could also use classes that are not available.
	 * 
	 *  Invoke a method reflectively.
	 *  @param methodname The method name.
	 *  @param argtypes The argument types (can be null if method exists only once).
	 *  @param args The arguments.
	 *  @param returntype The future return type if it is a specific future.
	 *  @return The result.
	 */
	public IFuture invokeMethod(String methodname, ClassInfo[] argtypes, Object[] args, @FutureReturnType ClassInfo returntype);
	
	/**
	 *  Get reflective info about the service methods, args, return types.
	 *  @return The method infos.
	 */
	public IFuture getMethodInfos();

//	/**
//	 *  Get an external interface feature.
//	 *  @param type The interface type of the feature.
//	 *  @return The feature.
//	 */
//	public  T getExternalComponentFeature(Class type);
	
	// todo: ?! currently BasicService only has 
//	/**
//	 *  Get the hosting component of the service.
//	 *  @return The component.
//	 */
//	public IFuture getComponent();
}