// this is a worker dispatch, process it
// determine worker type
final String workerName = upfs.getMethodNodeId();
if (workerName == null) {
throw new PortalException("Unable to determine worker type for name '" + workerName + "', uPFile='" + upfs.getUPFile() + "'.");
}
final String dispatchClassName = workerProperties.getProperty(workerName);
if (dispatchClassName == null) {
throw new PortalException("Unable to find processing class for the worker type '" + workerName + "'. Please check worker.properties");
}
// try to instantiate a worker class
try {
final ClassLoader carClassLoader = this.carResources.getClassLoader();
final Class<? extends IWorkerRequestProcessor> dispatcherClass = (Class<IWorkerRequestProcessor>)carClassLoader.loadClass(dispatchClassName);
final IWorkerRequestProcessor wrp = dispatcherClass.newInstance();
// invoke processor
try {
final PortalControlStructures portalControlStructures = new PortalControlStructures(req, res, cm, uPreferencesManager);
wrp.processWorkerDispatch(portalControlStructures);
}
catch (PortalException pe) {
throw pe;
}
catch (RuntimeException re) {
throw new PortalException(re);
}
}
catch (ClassNotFoundException cnfe) {
throw new PortalException("Unable to find processing class '" + dispatchClassName + "' for the worker type '" + workerName + "'. Please check worker.properties", cnfe);
}
catch (InstantiationException ie) {
throw new PortalException("Unable to instantiate processing class '" + dispatchClassName + "' for the worker type '" + workerName + "'. Please check worker.properties", ie);
}
catch (IllegalAccessException iae) {
throw new PortalException("Unable to access processing class '" + dispatchClassName + "' for the worker type '" + workerName + "'. Please check worker.properties", iae);
}
return true;
}