/** * @param frameWorkId web service framework * @return the unique instance of WebServicesFactory corresponding to the given framework * @throws UnknownFrameWorkException */ public static WebServicesFactory getWebServicesFactory(String frameWorkId) throws UnknownFrameWorkException { if (frameWorkId == null) { frameWorkId = CentralPAPropertyRepository.PA_WEBSERVICES_FRAMEWORK.getValue(); } try { WebServicesFactory wsf = activatedWebServicesFactory.get(frameWorkId); if (wsf != null) { logger.debug("Getting the WebServicesFactory instance from the hashmap"); return wsf; } else { logger.debug("Creating a new WebServicesFactory instance"); Class<?> wsfClazz = WebServicesFrameWorkFactoryRegistry.get(frameWorkId); if (wsfClazz != null) { WebServicesFactory o = (WebServicesFactory) wsfClazz.newInstance(); activatedWebServicesFactory.put(frameWorkId, o); return o; } } } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } throw new UnknownFrameWorkException( "There is no WebServicesFactory defined for the framework: " + frameWorkId); }
/** * Return the default WebServicesFactory * * @return return the web service factory associated to the default framework * @throws UnknownFrameWorkException if the default framework is not known */ public static WebServicesFactory getDefaultWebServicesFactory() throws UnknownFrameWorkException { String frameWork = CentralPAPropertyRepository.PA_WEBSERVICES_FRAMEWORK.getValue(); return getWebServicesFactory(frameWork); }