*/
public String createAlgorithm(String sessionID, String servicePID,
Vector dataModelIDs, Hashtable dictionary) {
AlgorithmFactory factory = getAlgorithmFactory(servicePID);
AlgorithmRegistry algReg = (AlgorithmRegistry) algRegistry.getService();
MetaTypeProviderRegistry mtpReg = (MetaTypeProviderRegistry) mtpRegistry.getService();
DataModelRegistry dmReg = (DataModelRegistry) dmRegistry.getService();
String algID = "-1";
if (factory != null && algReg != null && mtpReg != null && dmReg != null) {
Data[] dm = dmReg.getDataModels(dataModelIDs);
CIShellContext ciContext = null;
synchronized (sidToContextMap) {
ciContext = (CIShellContext) sidToContextMap.get(sessionID);
if (ciContext == null) {
ciContext = new RemoteCIShellContext(bContext, sessionID);
sidToContextMap.put(sessionID, ciContext);
}
}
//TODO: should parse the given hashtable since values may need to
//be changed to different types (Vector->String[], etc...)
Algorithm alg = factory.createAlgorithm(dm, dictionary, ciContext);
if (alg != null) {
algID = algReg.registerAlgorithm(alg);
}
}
return algID;
}