Class Capability

This class represents the base for all capabilities. Capabilities are value objects that can have arbitrary string parameters. They should provide a constructor whose formal parameters corre-spond to the number of parameters. A capability can be associated to a knowledge base and initialized via the method initCapability(). A capability can be finalized and de-associated from a knowledge base via the method finiCapability().

A capability has certain properties, some do exist already when the capability has not yet been associated and some are specific to the association of the capability to a knowledge base. The properties can be retrieved via the method getProperty(). Capabilities govern resources. To access a resource inside a capability the method prepareStream() has to be used. This meth-od will return a decoding stream in case the resource was encoded.

Further the method getDescrModel() and getDescrPlatform() allow retrieving the description properties of this capability. The method might return different properties for different locales. The Jekejeke Prolog implementation of capabilities expects Java properties files at some well-known location. The locations depend on the main root of the Jekejeke Prolog capability, and for the platform properties it also depends on the platform.

package jekpro.tools.call;

import java.util.Locale;
import java.util.Properties;

public abstract class Capability {
public static final String PROP_NEEDS_ACT = "needs_act";
public static final String PROP_ACT_STATUS = "act_status";
public static final String PROP_EXPIRATION_DATE = "expiration_date";
public static final String PROP_BUNDLE_DIR = "bundle_dir";
public static final String PROP_LANGUAGE_CODE = "language_code";
public static final String PROP_INSTALL_CODE = "install_code";
public static final String PROP_LICENSE_CODE = "license_code";
public static final String PROP_SYS_NOTRACE = "sys_notrace";

public int hashCode();
public boolean equals(Object o);

public void initCapability(Interpreter inter)
throws InterpreterMessage, InterpreterException;
public void initCapability(Interpreter inter, boolean prompt)
throws InterpreterMessage, InterpreterException;
public void finiCapability(Knowledgebase know)
throws InterpreterMessage;

public static String[] getProperties();
public Object getProperty(String prop, Lobby lobby);

public InputStream prepareStream(InputStream in, Knowledgebase know)
throws LicenseError, IOException;

public Properties getDescrModel(Locale locale, Lobby lobby);
public Properties getDescrPlatform(Locale locale, Lobby lobby);
}

Comments