@Test public void convert_count_unknown() throws Exception { ProcessProfile profile = profile( KEY_COMPONENT, DummyProcess.class.getName()); try { RetryableProcessProfile.convert(profile); fail(); } catch (IllegalArgumentException e) { } }
public static RetryableProcessProfile convert(ProcessProfile profile) throws IOException { if (profile == null) { throw new IllegalArgumentException("profile must not be null"); } int retryCount = extractInt(profile, KEY_RETRY_COUNT, 1); long retryInterval = extractLong(profile, KEY_RETRY_INTERVAL, DEFAULT_RETRY_INTERVAL); String componentName = profile.getName() + '-' + KEY_COMPONENT; String componentClassName = extract(profile, KEY_COMPONENT, false); Class<? extends ProcessProvider> componentClass; try { Class<?> aClass = Class.forName(componentClassName, false, profile.getContext().getClassLoader()); componentClass = aClass.asSubclass(ProcessProvider.class); } catch (Exception e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw new IllegalArgumentException(MessageFormat.format( "Failed to create component process provider for \"{0}\": {1}", profile.getName(), componentClassName), e); } Map<String, String> conf = profile.getConfiguration(); Map<String, String> componentConf = PropertiesUtil.createPrefixMap(conf, PREFIX_COMPONENT); ProcessProfile componentProfile = new ProcessProfile( componentName, componentClass, profile.getContext(), componentConf); ProcessProvider component; try { component = componentProfile.createProvider(); } catch (IOException e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw e; } return new RetryableProcessProfile(component, retryCount, retryInterval); }
RetryableProcessProfile { public static RetryableProcessProfile convert(ProcessProfile profile) throws IOException { if (profile == null) { throw new IllegalArgumentException("profile must not be null"); } int retryCount = extractInt(profile, KEY_RETRY_COUNT, 1); long retryInterval = extractLong(profile, KEY_RETRY_INTERVAL, DEFAULT_RETRY_INTERVAL); String componentName = profile.getName() + '-' + KEY_COMPONENT; String componentClassName = extract(profile, KEY_COMPONENT, false); Class<? extends ProcessProvider> componentClass; try { Class<?> aClass = Class.forName(componentClassName, false, profile.getContext().getClassLoader()); componentClass = aClass.asSubclass(ProcessProvider.class); } catch (Exception e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw new IllegalArgumentException(MessageFormat.format( "Failed to create component process provider for \"{0}\": {1}", profile.getName(), componentClassName), e); } Map<String, String> conf = profile.getConfiguration(); Map<String, String> componentConf = PropertiesUtil.createPrefixMap(conf, PREFIX_COMPONENT); ProcessProfile componentProfile = new ProcessProfile( componentName, componentClass, profile.getContext(), componentConf); ProcessProvider component; try { component = componentProfile.createProvider(); } catch (IOException e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw e; } return new RetryableProcessProfile(component, retryCount, retryInterval); } }
RetryableProcessProfile { public static RetryableProcessProfile convert(ProcessProfile profile) throws IOException { if (profile == null) { throw new IllegalArgumentException("profile must not be null"); } int retryCount = extractInt(profile, KEY_RETRY_COUNT, 1); long retryInterval = extractLong(profile, KEY_RETRY_INTERVAL, DEFAULT_RETRY_INTERVAL); String componentName = profile.getName() + '-' + KEY_COMPONENT; String componentClassName = extract(profile, KEY_COMPONENT, false); Class<? extends ProcessProvider> componentClass; try { Class<?> aClass = Class.forName(componentClassName, false, profile.getContext().getClassLoader()); componentClass = aClass.asSubclass(ProcessProvider.class); } catch (Exception e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw new IllegalArgumentException(MessageFormat.format( "Failed to create component process provider for \"{0}\": {1}", profile.getName(), componentClassName), e); } Map<String, String> conf = profile.getConfiguration(); Map<String, String> componentConf = PropertiesUtil.createPrefixMap(conf, PREFIX_COMPONENT); ProcessProfile componentProfile = new ProcessProfile( componentName, componentClass, profile.getContext(), componentConf); ProcessProvider component; try { component = componentProfile.createProvider(); } catch (IOException e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw e; } return new RetryableProcessProfile(component, retryCount, retryInterval); } RetryableProcessProfile(ProcessProvider component, int retryCount);  RetryableProcessProfile(ProcessProvider component, int retryCount, long retryInterval); }
RetryableProcessProfile { public static RetryableProcessProfile convert(ProcessProfile profile) throws IOException { if (profile == null) { throw new IllegalArgumentException("profile must not be null"); } int retryCount = extractInt(profile, KEY_RETRY_COUNT, 1); long retryInterval = extractLong(profile, KEY_RETRY_INTERVAL, DEFAULT_RETRY_INTERVAL); String componentName = profile.getName() + '-' + KEY_COMPONENT; String componentClassName = extract(profile, KEY_COMPONENT, false); Class<? extends ProcessProvider> componentClass; try { Class<?> aClass = Class.forName(componentClassName, false, profile.getContext().getClassLoader()); componentClass = aClass.asSubclass(ProcessProvider.class); } catch (Exception e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw new IllegalArgumentException(MessageFormat.format( "Failed to create component process provider for \"{0}\": {1}", profile.getName(), componentClassName), e); } Map<String, String> conf = profile.getConfiguration(); Map<String, String> componentConf = PropertiesUtil.createPrefixMap(conf, PREFIX_COMPONENT); ProcessProfile componentProfile = new ProcessProfile( componentName, componentClass, profile.getContext(), componentConf); ProcessProvider component; try { component = componentProfile.createProvider(); } catch (IOException e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw e; } return new RetryableProcessProfile(component, retryCount, retryInterval); } RetryableProcessProfile(ProcessProvider component, int retryCount);  RetryableProcessProfile(ProcessProvider component, int retryCount, long retryInterval); static RetryableProcessProfile convert(ProcessProfile profile); ProcessProvider getComponent(); int getRetryCount(); long getRetryInterval(); }
RetryableProcessProfile { public static RetryableProcessProfile convert(ProcessProfile profile) throws IOException { if (profile == null) { throw new IllegalArgumentException("profile must not be null"); } int retryCount = extractInt(profile, KEY_RETRY_COUNT, 1); long retryInterval = extractLong(profile, KEY_RETRY_INTERVAL, DEFAULT_RETRY_INTERVAL); String componentName = profile.getName() + '-' + KEY_COMPONENT; String componentClassName = extract(profile, KEY_COMPONENT, false); Class<? extends ProcessProvider> componentClass; try { Class<?> aClass = Class.forName(componentClassName, false, profile.getContext().getClassLoader()); componentClass = aClass.asSubclass(ProcessProvider.class); } catch (Exception e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw new IllegalArgumentException(MessageFormat.format( "Failed to create component process provider for \"{0}\": {1}", profile.getName(), componentClassName), e); } Map<String, String> conf = profile.getConfiguration(); Map<String, String> componentConf = PropertiesUtil.createPrefixMap(conf, PREFIX_COMPONENT); ProcessProfile componentProfile = new ProcessProfile( componentName, componentClass, profile.getContext(), componentConf); ProcessProvider component; try { component = componentProfile.createProvider(); } catch (IOException e) { WGLOG.error(e, "E00001", profile.getName(), KEY_COMPONENT, componentClassName); throw e; } return new RetryableProcessProfile(component, retryCount, retryInterval); } RetryableProcessProfile(ProcessProvider component, int retryCount);  RetryableProcessProfile(ProcessProvider component, int retryCount, long retryInterval); static RetryableProcessProfile convert(ProcessProfile profile); ProcessProvider getComponent(); int getRetryCount(); long getRetryInterval(); static final String KEY_RETRY_COUNT; static final String KEY_RETRY_INTERVAL; static final long DEFAULT_RETRY_INTERVAL; static final String KEY_COMPONENT; static final String PREFIX_COMPONENT; }