@Test public void shouldReturnNullWhenNoRepositoryConfigurationsSpecified() throws Exception { configFile = new StringRefAddr("configFile", "tck/default/repo-config.json"); Repositories repositories = (Repositories)factory.getObjectInstance(reference, null, null, null); assertThat(repositories, is(nullValue())); }
@Override public Object getObjectInstance( Object obj, final Name name, final Context nameCtx, Hashtable<?, ?> environment ) throws IOException, SAXException, RepositoryException, NamingException { if (!(obj instanceof Reference)) return null; Reference ref = (Reference)obj; RefAddr repositoryName = ref.get(REPOSITORY_NAME); String repoName = repositoryName != null ? repositoryName.getContent().toString() : null; RefAddr configFileRef = ref.get(CONFIG_FILE); String configFile = configFileRef != null ? configFileRef.getContent().toString() : null; RefAddr configFilesRef = ref.get(CONFIG_FILES); Set<String> configFiles = configFilesRef != null ? parseStrings(configFilesRef.getContent().toString()) : null; if (!StringUtil.isBlank(repoName) && !StringUtil.isBlank(configFile)) { return getRepository(configFile, repoName, nameCtx, name); } else if (configFiles != null) { for (String file : configFiles) { getRepository(file, null, nameCtx, name); } return ENGINE; } return null; }
JndiRepositoryFactory implements ObjectFactory { @Override public Object getObjectInstance( Object obj, final Name name, final Context nameCtx, Hashtable<?, ?> environment ) throws IOException, SAXException, RepositoryException, NamingException { if (!(obj instanceof Reference)) return null; Reference ref = (Reference)obj; RefAddr repositoryName = ref.get(REPOSITORY_NAME); String repoName = repositoryName != null ? repositoryName.getContent().toString() : null; RefAddr configFileRef = ref.get(CONFIG_FILE); String configFile = configFileRef != null ? configFileRef.getContent().toString() : null; RefAddr configFilesRef = ref.get(CONFIG_FILES); Set<String> configFiles = configFilesRef != null ? parseStrings(configFilesRef.getContent().toString()) : null; if (!StringUtil.isBlank(repoName) && !StringUtil.isBlank(configFile)) { return getRepository(configFile, repoName, nameCtx, name); } else if (configFiles != null) { for (String file : configFiles) { getRepository(file, null, nameCtx, name); } return ENGINE; } return null; } }
JndiRepositoryFactory implements ObjectFactory { @Override public Object getObjectInstance( Object obj, final Name name, final Context nameCtx, Hashtable<?, ?> environment ) throws IOException, SAXException, RepositoryException, NamingException { if (!(obj instanceof Reference)) return null; Reference ref = (Reference)obj; RefAddr repositoryName = ref.get(REPOSITORY_NAME); String repoName = repositoryName != null ? repositoryName.getContent().toString() : null; RefAddr configFileRef = ref.get(CONFIG_FILE); String configFile = configFileRef != null ? configFileRef.getContent().toString() : null; RefAddr configFilesRef = ref.get(CONFIG_FILES); Set<String> configFiles = configFilesRef != null ? parseStrings(configFilesRef.getContent().toString()) : null; if (!StringUtil.isBlank(repoName) && !StringUtil.isBlank(configFile)) { return getRepository(configFile, repoName, nameCtx, name); } else if (configFiles != null) { for (String file : configFiles) { getRepository(file, null, nameCtx, name); } return ENGINE; } return null; }  }
JndiRepositoryFactory implements ObjectFactory { @Override public Object getObjectInstance( Object obj, final Name name, final Context nameCtx, Hashtable<?, ?> environment ) throws IOException, SAXException, RepositoryException, NamingException { if (!(obj instanceof Reference)) return null; Reference ref = (Reference)obj; RefAddr repositoryName = ref.get(REPOSITORY_NAME); String repoName = repositoryName != null ? repositoryName.getContent().toString() : null; RefAddr configFileRef = ref.get(CONFIG_FILE); String configFile = configFileRef != null ? configFileRef.getContent().toString() : null; RefAddr configFilesRef = ref.get(CONFIG_FILES); Set<String> configFiles = configFilesRef != null ? parseStrings(configFilesRef.getContent().toString()) : null; if (!StringUtil.isBlank(repoName) && !StringUtil.isBlank(configFile)) { return getRepository(configFile, repoName, nameCtx, name); } else if (configFiles != null) { for (String file : configFiles) { getRepository(file, null, nameCtx, name); } return ENGINE; } return null; }  @Override Object getObjectInstance( Object obj,
                                     final Name name,
                                     final Context nameCtx,
                                     Hashtable<?, ?> environment ); }
JndiRepositoryFactory implements ObjectFactory { @Override public Object getObjectInstance( Object obj, final Name name, final Context nameCtx, Hashtable<?, ?> environment ) throws IOException, SAXException, RepositoryException, NamingException { if (!(obj instanceof Reference)) return null; Reference ref = (Reference)obj; RefAddr repositoryName = ref.get(REPOSITORY_NAME); String repoName = repositoryName != null ? repositoryName.getContent().toString() : null; RefAddr configFileRef = ref.get(CONFIG_FILE); String configFile = configFileRef != null ? configFileRef.getContent().toString() : null; RefAddr configFilesRef = ref.get(CONFIG_FILES); Set<String> configFiles = configFilesRef != null ? parseStrings(configFilesRef.getContent().toString()) : null; if (!StringUtil.isBlank(repoName) && !StringUtil.isBlank(configFile)) { return getRepository(configFile, repoName, nameCtx, name); } else if (configFiles != null) { for (String file : configFiles) { getRepository(file, null, nameCtx, name); } return ENGINE; } return null; }  @Override Object getObjectInstance( Object obj,
                                     final Name name,
                                     final Context nameCtx,
                                     Hashtable<?, ?> environment );  }