use of com.navercorp.pinpoint.hbase.schema.reader.HbaseSchemaParseException in project pinpoint by naver.
the class XmlHbaseSchemaReader method loadChangeSets.
/**
* Loads change sets from the hbase schema xml file at the given path.
*
* @param path path to hbase schema xml file
* @return list of change sets loaded
* @throws HbaseSchemaParseException if there was a problem reading or parsing from the schema xml file
*/
@Override
public List<ChangeSet> loadChangeSets(String path) {
Resource resource = resourceLoader.getResource(path);
XmlParseContext xmlParseContext = new XmlParseContext(resource);
try {
loadChangeSets(xmlParseContext);
} catch (HbaseSchemaParseException e) {
logger.error("Error loading change sets from {}", xmlParseContext.getResource(), e);
throw e;
} catch (Exception e) {
logger.error("Error loading change sets from {}", xmlParseContext.getResource(), e);
throw new HbaseSchemaParseException("Error loading change sets from " + xmlParseContext.getResource(), e);
}
return xmlParseContext.getChangeSets();
}
use of com.navercorp.pinpoint.hbase.schema.reader.HbaseSchemaParseException in project pinpoint by naver.
the class HbaseSchemaManagerRunner method run.
@Override
public void run(ApplicationArguments args) throws Exception {
logger.info("Launched with arguments : {}", Arrays.asList(args.getSourceArgs()));
ProgramCommand programCommand = ProgramCommand.parseArgs(args);
ProgramOptions programOptions = ProgramOptions.parseArgs(args);
HbaseSchemaManagerTask task = taskFactory.create(programCommand, programOptions);
try {
task.run(programCommand.getCommandArgs());
} catch (HbaseSchemaParseException | InvalidHbaseSchemaException e) {
logger.error(Markers.TERMINAL, "{}, cause : {}", e.getMessage(), e.getCause().getMessage());
logger.error(Markers.APP_LOG, "Hbase schema error.", e);
} catch (HbaseSystemException e) {
logger.error(Markers.TERMINAL, "Error accessing hbase : {}", e.getMessage());
logger.error(Markers.APP_LOG, "Hbase error.", e);
} catch (Exception e) {
logger.error(Markers.TERMINAL, "Error running '{}' : {}", programCommand.getCommand(), e.getMessage());
logger.error(Markers.APP_LOG, "Error running '" + programCommand.getCommand() + "'.", e);
}
}
use of com.navercorp.pinpoint.hbase.schema.reader.HbaseSchemaParseException in project pinpoint by naver.
the class XmlHbaseSchemaParser method parseSchema.
XmlHbaseSchemaParseResult parseSchema(InputSource inputSource) {
try {
Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
unmarshaller.setSchema(SCHEMA);
HbaseSchema hbaseSchema = (HbaseSchema) unmarshaller.unmarshal(inputSource);
return mapper.map(hbaseSchema);
} catch (JAXBException e) {
Throwable linkedException = e.getLinkedException();
if (linkedException == null) {
throw new IllegalStateException("JAXB error", e);
}
throw new HbaseSchemaParseException(linkedException.getMessage(), linkedException);
}
}
use of com.navercorp.pinpoint.hbase.schema.reader.HbaseSchemaParseException in project pinpoint by naver.
the class ChangeSetMapper method mapChangeSet.
public ChangeSet mapChangeSet(com.navercorp.pinpoint.hbase.schema.definition.xml.ChangeSet changeSet) {
try {
// no need to close StringWriter
StringWriter stringWriter = new StringWriter();
createMarshaller().marshal(changeSet, stringWriter);
String value = stringWriter.toString();
List<TableChange> tableChangeList = mapTableChanges(changeSet.getModifyTable(), changeSet.getCreateTable());
return new ChangeSet(changeSet.getId(), value, tableChangeList);
} catch (JAXBException e) {
Throwable linkedException = e.getLinkedException();
if (linkedException == null) {
throw new IllegalStateException("JAXB error", e);
}
throw new HbaseSchemaParseException("Error computing md5 for change set id : " + changeSet.getId(), linkedException);
}
}
Aggregations