use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project hedera-services by hashgraph.
the class JKeyUtils method genSampleComplexKey.
/**
* Generates a complex key of given depth with a mix of basic key, threshold key and key list.
*
* @param depth
* of the generated key
* @return generated key
*/
public static Key genSampleComplexKey(final int depth, final Map<String, PrivateKey> pubKey2privKeyMap) {
Key rv;
final int numKeys = 3;
final int threshold = 2;
if (depth == 1) {
rv = genSingleEd25519Key(pubKey2privKeyMap);
// verify the size
final int size = computeNumOfExpandedKeys(rv, 1, new AtomicCounter());
assertEquals(1, size);
} else if (depth == 2) {
final List<Key> keys = new ArrayList<>();
keys.add(genSingleEd25519Key(pubKey2privKeyMap));
keys.add(genSingleECDSASecp256k1Key(pubKey2privKeyMap));
keys.add(genThresholdKeyInstance(numKeys, threshold, pubKey2privKeyMap));
keys.add(genKeyListInstance(numKeys, pubKey2privKeyMap));
rv = genKeyList(keys);
// verify the size
final int size = computeNumOfExpandedKeys(rv, 1, new AtomicCounter());
assertEquals(2 + numKeys * 2, size);
} else {
throw new NotImplementedException("Not implemented yet.");
}
return rv;
}
use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project tiamat by entur.
the class StopPlaceImportHandler method handleStops.
public void handleStops(SiteFrame netexSiteFrame, ImportParams importParams, AtomicInteger stopPlacesCreatedMatchedOrUpdated, SiteFrame responseSiteframe) {
if (publicationDeliveryHelper.hasStops(netexSiteFrame)) {
List<StopPlace> tiamatStops = netexMapper.mapStopsToTiamatModel(netexSiteFrame.getStopPlaces().getStopPlace());
tiamatStops = stopPlaceTypeFilter.filter(tiamatStops, importParams.allowOnlyStopTypes);
if (importParams.ignoreStopTypes != null && !importParams.ignoreStopTypes.isEmpty()) {
tiamatStops = stopPlaceTypeFilter.filter(tiamatStops, importParams.ignoreStopTypes, true);
}
boolean isImportTypeIdMatch = importParams.importType != null && importParams.importType.equals(ImportType.ID_MATCH);
if (!isImportTypeIdMatch) {
logger.info("Running stop place pre steps");
tiamatStops = stopPlacePreSteps.run(tiamatStops);
}
int numberOfStopBeforeFiltering = tiamatStops.size();
logger.info("About to filter {} stops based on topographic references: {}", tiamatStops.size(), importParams.targetTopographicPlaces);
tiamatStops = zoneTopographicPlaceFilter.filterByTopographicPlaceMatch(importParams.targetTopographicPlaces, tiamatStops);
logger.info("Got {} stops (was {}) after filtering by: {}", tiamatStops.size(), numberOfStopBeforeFiltering, importParams.targetTopographicPlaces);
if (importParams.onlyMatchOutsideTopographicPlaces != null && !importParams.onlyMatchOutsideTopographicPlaces.isEmpty()) {
numberOfStopBeforeFiltering = tiamatStops.size();
logger.info("Filtering stops outside given list of topographic places: {}", importParams.onlyMatchOutsideTopographicPlaces);
tiamatStops = zoneTopographicPlaceFilter.filterByTopographicPlaceMatch(importParams.onlyMatchOutsideTopographicPlaces, tiamatStops, true);
logger.info("Got {} stops (was {}) after filtering", tiamatStops.size(), numberOfStopBeforeFiltering);
}
if (!isImportTypeIdMatch) {
logger.info("Running stop place post filter steps");
tiamatStops = stopPlacePostFilterSteps.run(tiamatStops);
}
if (importParams.forceStopType != null) {
logger.info("Forcing stop type to " + importParams.forceStopType);
tiamatStops.forEach(stopPlace -> stopPlace.setStopPlaceType(importParams.forceStopType));
}
Collection<org.rutebanken.netex.model.StopPlace> importedOrMatchedNetexStopPlaces;
logger.info("The import type is: {}", importParams.importType);
if (importParams.importType != null && importParams.importType.equals(ImportType.ID_MATCH)) {
importedOrMatchedNetexStopPlaces = stopPlaceIdMatcher.matchStopPlaces(tiamatStops, stopPlacesCreatedMatchedOrUpdated);
} else {
final Lock lock = hazelcastInstance.getCPSubsystem().getLock(STOP_PLACE_IMPORT_LOCK_KEY);
lock.lock();
try {
if (importParams.importType == null || importParams.importType.equals(ImportType.MERGE)) {
importedOrMatchedNetexStopPlaces = transactionalMergingStopPlacesImporter.importStopPlaces(tiamatStops, stopPlacesCreatedMatchedOrUpdated);
} else if (importParams.importType.equals(ImportType.INITIAL)) {
importedOrMatchedNetexStopPlaces = parallelInitialStopPlaceImporter.importStopPlaces(tiamatStops, stopPlacesCreatedMatchedOrUpdated);
} else if (importParams.importType.equals(ImportType.MATCH)) {
importedOrMatchedNetexStopPlaces = matchingAppendingIdStopPlacesImporter.importStopPlaces(tiamatStops, stopPlacesCreatedMatchedOrUpdated);
} else {
throw new NotImplementedException("Import type " + importParams.importType + " not implemented ");
}
} finally {
lock.unlock();
}
}
// Filter uniques by StopPlace.id#version
Map<String, org.rutebanken.netex.model.StopPlace> uniqueById = new HashMap<>();
importedOrMatchedNetexStopPlaces.stream().forEach(e -> uniqueById.put(e.getId() + "#" + e.getVersion(), e));
importedOrMatchedNetexStopPlaces = uniqueById.values();
logger.info("Imported/matched/updated {} stop places", stopPlacesCreatedMatchedOrUpdated);
tariffZonesFromStopsExporter.resolveTariffZones(importedOrMatchedNetexStopPlaces, responseSiteframe);
if (responseSiteframe.getTariffZones() != null && responseSiteframe.getTariffZones().getTariffZone() != null && responseSiteframe.getTariffZones().getTariffZone().isEmpty()) {
responseSiteframe.setTariffZones(null);
}
if (EXPORT_TOPOGRAPHIC_PLACES_FOR_STOPS) {
List<TopographicPlace> netexTopographicPlaces = topographicPlacesExporter.export(findTopographicPlaceRefsFromStops(tiamatStops));
if (!netexTopographicPlaces.isEmpty()) {
responseSiteframe.withTopographicPlaces(new TopographicPlacesInFrame_RelStructure().withTopographicPlace(netexTopographicPlaces));
}
} else {
clearTopographicPlaceRefs(importedOrMatchedNetexStopPlaces);
}
if (!importedOrMatchedNetexStopPlaces.isEmpty()) {
logger.info("Add {} stops to response site frame", importedOrMatchedNetexStopPlaces.size());
responseSiteframe.withStopPlaces(new StopPlacesInFrame_RelStructure().withStopPlace(importedOrMatchedNetexStopPlaces));
} else {
logger.info("No stops in response");
}
}
}
use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project pulsar-flink by streamnative.
the class PulsarTestBase method getProducer.
public static <T> Producer<T> getProducer(String topic, SchemaType type, Optional<Integer> partition, Class<T> tClass) throws PulsarClientException {
String topicName;
if (partition.isPresent()) {
topicName = topic + PulsarOptions.PARTITION_SUFFIX + partition.get();
} else {
topicName = topic;
}
Producer producer;
PulsarClient client = PulsarClient.builder().serviceUrl(getServiceUrl()).build();
switch(type) {
case BOOLEAN:
producer = client.newProducer(Schema.BOOL).topic(topicName).create();
break;
case BYTES:
producer = client.newProducer(Schema.BYTES).topic(topicName).create();
break;
case LOCAL_DATE:
producer = client.newProducer(Schema.LOCAL_DATE).topic(topicName).create();
break;
case DATE:
producer = client.newProducer(Schema.DATE).topic(topicName).create();
break;
case STRING:
producer = client.newProducer(Schema.STRING).topic(topicName).create();
break;
case TIMESTAMP:
producer = client.newProducer(Schema.TIMESTAMP).topic(topicName).create();
break;
case LOCAL_DATE_TIME:
producer = client.newProducer(Schema.LOCAL_DATE_TIME).topic(topicName).create();
break;
case INT8:
producer = client.newProducer(Schema.INT8).topic(topicName).create();
break;
case DOUBLE:
producer = client.newProducer(Schema.DOUBLE).topic(topicName).create();
break;
case FLOAT:
producer = client.newProducer(Schema.FLOAT).topic(topicName).create();
break;
case INT32:
producer = client.newProducer(Schema.INT32).topic(topicName).create();
break;
case INT16:
producer = client.newProducer(Schema.INT16).topic(topicName).create();
break;
case INT64:
producer = client.newProducer(Schema.INT64).topic(topicName).create();
break;
case AVRO:
SchemaDefinition<Object> schemaDefinition = SchemaDefinition.builder().withPojo(tClass).withJSR310ConversionEnabled(true).build();
producer = client.newProducer(Schema.AVRO(schemaDefinition)).topic(topicName).create();
break;
case JSON:
producer = client.newProducer(Schema.JSON(tClass)).topic(topicName).create();
break;
default:
throw new NotImplementedException("Unsupported type " + type);
}
return producer;
}
use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project opencga by opencb.
the class ProtoFileWriter method open.
@Override
public boolean open() {
if (outputStream == null) {
try {
OutputStream out = new BufferedOutputStream(new FileOutputStream(input.toFile()));
if (StringUtils.equalsIgnoreCase(compression, "gzip") || StringUtils.equalsIgnoreCase(compression, "gz")) {
out = new GzipCompressorOutputStream(out);
} else if (StringUtils.isNotBlank(compression)) {
throw new NotImplementedException("Proto compression not implemented yet: " + compression);
}
outputStream = out;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return true;
}
use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project org.hl7.fhir.core by hapifhir.
the class NarrativeGenerator method renderLeaf.
private void renderLeaf(ResourceWrapper res, BaseWrapper ew, ElementDefinition defn, XhtmlNode x, boolean title, boolean showCodeDetails, Map<String, String> displayHints) throws FHIRException, UnsupportedEncodingException, IOException {
if (ew == null)
return;
Base e = ew.getBase();
if (e instanceof StringType)
x.addText(((StringType) e).getValue());
else if (e instanceof CodeType)
x.addText(((CodeType) e).getValue());
else if (e instanceof IdType)
x.addText(((IdType) e).getValue());
else if (e instanceof Extension)
x.addText("Extensions: Todo");
else if (e instanceof InstantType)
x.addText(((InstantType) e).toHumanDisplay());
else if (e instanceof DateTimeType)
x.addText(((DateTimeType) e).toHumanDisplay());
else if (e instanceof Base64BinaryType)
x.addText(new Base64().encodeAsString(((Base64BinaryType) e).getValue()));
else if (e instanceof org.hl7.fhir.dstu2.model.DateType)
x.addText(((org.hl7.fhir.dstu2.model.DateType) e).toHumanDisplay());
else if (e instanceof Enumeration) {
Object ev = ((Enumeration<?>) e).getValue();
// todo: look up a display name if there is one
x.addText(ev == null ? "" : ev.toString());
} else if (e instanceof BooleanType)
x.addText(((BooleanType) e).getValue().toString());
else if (e instanceof CodeableConcept) {
renderCodeableConcept((CodeableConcept) e, x, showCodeDetails);
} else if (e instanceof Coding) {
renderCoding((Coding) e, x, showCodeDetails);
} else if (e instanceof Annotation) {
renderAnnotation((Annotation) e, x);
} else if (e instanceof Identifier) {
renderIdentifier((Identifier) e, x);
} else if (e instanceof org.hl7.fhir.dstu2.model.IntegerType) {
x.addText(Integer.toString(((org.hl7.fhir.dstu2.model.IntegerType) e).getValue()));
} else if (e instanceof org.hl7.fhir.dstu2.model.DecimalType) {
x.addText(((org.hl7.fhir.dstu2.model.DecimalType) e).getValue().toString());
} else if (e instanceof HumanName) {
renderHumanName((HumanName) e, x);
} else if (e instanceof SampledData) {
renderSampledData((SampledData) e, x);
} else if (e instanceof Address) {
renderAddress((Address) e, x);
} else if (e instanceof ContactPoint) {
renderContactPoint((ContactPoint) e, x);
} else if (e instanceof UriType) {
renderUri((UriType) e, x);
} else if (e instanceof Timing) {
renderTiming((Timing) e, x);
} else if (e instanceof Range) {
renderRange((Range) e, x);
} else if (e instanceof Quantity) {
renderQuantity((Quantity) e, x, showCodeDetails);
} else if (e instanceof Ratio) {
renderQuantity(((Ratio) e).getNumerator(), x, showCodeDetails);
x.addText("/");
renderQuantity(((Ratio) e).getDenominator(), x, showCodeDetails);
} else if (e instanceof Period) {
Period p = (Period) e;
x.addText(!p.hasStart() ? "??" : p.getStartElement().toHumanDisplay());
x.addText(" --> ");
x.addText(!p.hasEnd() ? "(ongoing)" : p.getEndElement().toHumanDisplay());
} else if (e instanceof Reference) {
Reference r = (Reference) e;
XhtmlNode c = x;
ResourceWithReference tr = null;
if (r.hasReferenceElement()) {
tr = resolveReference(res, r.getReference());
if (!r.getReference().startsWith("#")) {
if (tr != null && tr.getReference() != null)
c = x.addTag("a").attribute("href", tr.getReference());
else
c = x.addTag("a").attribute("href", r.getReference());
}
}
// what to display: if text is provided, then that. if the reference was resolved, then show the generated narrative
if (r.hasDisplayElement()) {
c.addText(r.getDisplay());
if (tr != null) {
c.addText(". Generated Summary: ");
generateResourceSummary(c, tr.getResource(), true, r.getReference().startsWith("#"));
}
} else if (tr != null) {
generateResourceSummary(c, tr.getResource(), r.getReference().startsWith("#"), r.getReference().startsWith("#"));
} else {
c.addText(r.getReference());
}
} else if (e instanceof Resource) {
return;
} else if (e instanceof ElementDefinition) {
x.addText("todo-bundle");
} else if (e != null && !(e instanceof Attachment) && !(e instanceof Narrative) && !(e instanceof Meta))
throw new NotImplementedException("type " + e.getClass().getName() + " not handled yet");
}
Aggregations