use of org.apache.qpid.server.store.ConfiguredObjectRecordConverter in project qpid-broker-j by apache.
the class AbstractVirtualHostNode method getInitialRecords.
protected final ConfiguredObjectRecord[] getInitialRecords() throws IOException {
ConfiguredObjectRecordConverter converter = new ConfiguredObjectRecordConverter(getModel());
Collection<ConfiguredObjectRecord> records = new ArrayList<>(converter.readFromJson(VirtualHost.class, this, getInitialConfigReader()));
if (!records.isEmpty()) {
ConfiguredObjectRecord vhostRecord = null;
for (ConfiguredObjectRecord record : records) {
if (record.getType().equals(VirtualHost.class.getSimpleName())) {
vhostRecord = record;
break;
}
}
if (vhostRecord != null) {
records.remove(vhostRecord);
vhostRecord = enrichInitialVirtualHostRootRecord(vhostRecord);
records.add(vhostRecord);
} else {
// this should be impossible as the converter should always generate a parent record
throw new IllegalConfigurationException("Somehow the initial configuration has records but " + "not a VirtualHost. This must be a coding error in Qpid");
}
addStandardExchangesIfNecessary(records, vhostRecord);
enrichWithAuditInformation(records);
}
return records.toArray(new ConfiguredObjectRecord[records.size()]);
}
use of org.apache.qpid.server.store.ConfiguredObjectRecordConverter in project qpid-broker-j by apache.
the class AbstractSystemConfig method convertToConfigurationRecords.
private ConfiguredObjectRecord[] convertToConfigurationRecords(final String initialConfigurationLocation) throws IOException {
ConfiguredObjectRecordConverter converter = new ConfiguredObjectRecordConverter(getModel());
Reader reader;
try {
URL url = new URL(initialConfigurationLocation);
reader = new InputStreamReader(url.openStream());
} catch (MalformedURLException e) {
reader = new FileReader(initialConfigurationLocation);
}
try {
Collection<ConfiguredObjectRecord> records = converter.readFromJson(null, this, reader);
return records.toArray(new ConfiguredObjectRecord[records.size()]);
} finally {
reader.close();
}
}
Aggregations