@Test public void testService() { assertThat(registry.getService("Calculator", "calculator").getQualifiedName(), is(Calculator.kDescriptor.getQualifiedName())); try { registry.getService("gurba.dot.Calculator"); fail("no exception"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Invalid identifier: \"gurba.dot.Calculator\"")); } try { registry.getService("Calculator"); fail("no exception"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("Requesting global service name without package: \"Calculator\"")); } try { registry.getService("gurba.Calculator"); fail("no exception"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("No such program \"gurba\" known for service \"Calculator\"")); } try { registry.getService("Calculator", "gurba"); fail("no exception"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("No such program \"gurba\" known for service \"Calculator\"")); } try { registry.getService("calculator.Gurba"); fail("no exception"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("No such service \"Gurba\" in program \"calculator\"")); } try { registry.getService("Gurba", "calculator"); fail("no exception"); } catch (IllegalArgumentException e) { assertThat(e.getMessage(), is("No such service \"Gurba\" in program \"calculator\"")); } }
@Nonnull @Override public PService getService(String serviceName, String programContext) { return handle(serviceName, programContext,true, r -> r.getService(serviceName, programContext)); }
ProgramRegistry implements TypeRegistry { @Nonnull @Override public PService getService(String serviceName, String programContext) { return handle(serviceName, programContext,true, r -> r.getService(serviceName, programContext)); } }
ProgramRegistry implements TypeRegistry { @Nonnull @Override public PService getService(String serviceName, String programContext) { return handle(serviceName, programContext,true, r -> r.getService(serviceName, programContext)); } ProgramRegistry(); }
ProgramRegistry implements TypeRegistry { @Nonnull @Override public PService getService(String serviceName, String programContext) { return handle(serviceName, programContext,true, r -> r.getService(serviceName, programContext)); } ProgramRegistry(); @Nonnull ProgramTypeRegistry registryForPath(String path); @Nonnull Collection<ProgramTypeRegistry> getLoadedRegistries(); boolean containsProgramPath(String path); void putProgram(String path, CProgram program); void putProgramType(String path, ProgramType program); @Nonnull @Override T getDeclaredType(@Nonnull String typeName,
                                                                @Nonnull String programContext); @Nullable @Override T getConstantValue(@Nonnull String constReference, @Nonnull String programContext); @Nonnull @Override PService getService(String serviceName, String programContext); @Nonnull @Override PDescriptorProvider getProvider(String typeName, String programContext, Map<String, String> annotations); @Nonnull @Override PServiceProvider getServiceProvider(String serviceName, String programContext); }
ProgramRegistry implements TypeRegistry { @Nonnull @Override public PService getService(String serviceName, String programContext) { return handle(serviceName, programContext,true, r -> r.getService(serviceName, programContext)); } ProgramRegistry(); @Nonnull ProgramTypeRegistry registryForPath(String path); @Nonnull Collection<ProgramTypeRegistry> getLoadedRegistries(); boolean containsProgramPath(String path); void putProgram(String path, CProgram program); void putProgramType(String path, ProgramType program); @Nonnull @Override T getDeclaredType(@Nonnull String typeName,
                                                                @Nonnull String programContext); @Nullable @Override T getConstantValue(@Nonnull String constReference, @Nonnull String programContext); @Nonnull @Override PService getService(String serviceName, String programContext); @Nonnull @Override PDescriptorProvider getProvider(String typeName, String programContext, Map<String, String> annotations); @Nonnull @Override PServiceProvider getServiceProvider(String serviceName, String programContext);  }