public void prepare() { final Set<String> locales = new HashSet<String>(); for (final MetaData md : metaDatas) { for (final String pid : md.getPids()) { pids.put(pid, md); } for (final String fpid : md.getFactoryPids()) { factoryPids.put(fpid, md); } final String[] newLocales = md.getLocales(); if (newLocales != null) { for (final String locale : newLocales) { locales.add(locale); } } } this.locales = locales.toArray(new String[locales.size()]); }
@Override public ObjectClassDefinition getObjectClassDefinition(String id, String locale) { MetaData md; md = pids.get(id); if (md == null) { md = factoryPids.get(id); } if (md == null) { final Set<String> allIDs = new TreeSet<String>(); allIDs.addAll(pids.keySet()); allIDs.addAll(factoryPids.keySet()); throw new IllegalArgumentException( "no information available for id " + id + ". Available ids: " + allIDs); } if (locale == null) { locale = Locale.getDefault().toString(); } return md.getOCD(id, locale); }