use of org.apache.commons.lang3.tuple.Triple in project sqlg by pietermartin.
the class TestLoadSchemaViaNotify method testDistributedTopologyListener.
@Test
public void testDistributedTopologyListener() throws Exception {
try (SqlgGraph sqlgGraph1 = SqlgGraph.open(configuration)) {
List<Triple<TopologyInf, String, TopologyChangeAction>> topologyListenerTriple = new ArrayList<>();
TestTopologyChangeListener.TopologyListenerTest topologyListenerTest = new TestTopologyChangeListener.TopologyListenerTest(topologyListenerTriple);
sqlgGraph1.getTopology().registerListener(topologyListenerTest);
Vertex a1 = this.sqlgGraph.addVertex(T.label, "A.A", "name", "asda");
Vertex a2 = this.sqlgGraph.addVertex(T.label, "A.A", "name", "asdasd");
Edge e1 = a1.addEdge("aa", a2);
a1.property("surname", "asdasd");
e1.property("special", "");
Vertex b1 = this.sqlgGraph.addVertex(T.label, "A.B", "name", "asdasd");
Edge e2 = a1.addEdge("aa", b1);
Schema schema = this.sqlgGraph.getTopology().getSchema("A").get();
VertexLabel aVertexLabel = schema.getVertexLabel("A").get();
EdgeLabel edgeLabel = aVertexLabel.getOutEdgeLabel("aa").get();
VertexLabel bVertexLabel = schema.getVertexLabel("B").get();
Index index = aVertexLabel.ensureIndexExists(IndexType.UNIQUE, new ArrayList<>(aVertexLabel.getProperties().values()));
// This adds a schema and 2 indexes and the globalUniqueIndex, so 4 elements in all
GlobalUniqueIndex globalUniqueIndex = schema.ensureGlobalUniqueIndexExist(new HashSet<>(aVertexLabel.getProperties().values()));
this.sqlgGraph.tx().commit();
// allow time for notification to happen
Thread.sleep(1_000);
// we're not getting property notification since we get vertex label notification, these include all properties committed
Assert.assertEquals(9, topologyListenerTriple.size());
Assert.assertEquals(schema, topologyListenerTriple.get(0).getLeft());
Assert.assertEquals("", topologyListenerTriple.get(0).getMiddle());
Assert.assertEquals(TopologyChangeAction.CREATE, topologyListenerTriple.get(0).getRight());
Assert.assertEquals(aVertexLabel, topologyListenerTriple.get(1).getLeft());
Assert.assertEquals("", topologyListenerTriple.get(1).getMiddle());
Assert.assertEquals(TopologyChangeAction.CREATE, topologyListenerTriple.get(1).getRight());
Map<String, PropertyColumn> props = ((VertexLabel) topologyListenerTriple.get(1).getLeft()).getProperties();
Assert.assertTrue(props.containsKey("name"));
Assert.assertTrue(props.containsKey("surname"));
Assert.assertEquals(index, topologyListenerTriple.get(2).getLeft());
Assert.assertEquals("", topologyListenerTriple.get(2).getMiddle());
Assert.assertEquals(TopologyChangeAction.CREATE, topologyListenerTriple.get(2).getRight());
Assert.assertEquals(edgeLabel, topologyListenerTriple.get(3).getLeft());
String s = topologyListenerTriple.get(3).getLeft().toString();
Assert.assertTrue(s.contains(edgeLabel.getSchema().getName()));
props = ((EdgeLabel) topologyListenerTriple.get(3).getLeft()).getProperties();
Assert.assertTrue(props.containsKey("special"));
Assert.assertEquals("", topologyListenerTriple.get(3).getMiddle());
Assert.assertEquals(TopologyChangeAction.CREATE, topologyListenerTriple.get(3).getRight());
Assert.assertEquals(bVertexLabel, topologyListenerTriple.get(4).getLeft());
Assert.assertEquals("", topologyListenerTriple.get(4).getMiddle());
Assert.assertEquals(TopologyChangeAction.CREATE, topologyListenerTriple.get(4).getRight());
Assert.assertEquals(globalUniqueIndex, topologyListenerTriple.get(5).getLeft());
Assert.assertEquals("", topologyListenerTriple.get(5).getMiddle());
Assert.assertEquals(TopologyChangeAction.CREATE, topologyListenerTriple.get(5).getRight());
}
}
use of org.apache.commons.lang3.tuple.Triple in project sqlg by pietermartin.
the class MSSqlServerDialect method drop.
@Override
public List<Triple<SqlgSqlExecutor.DROP_QUERY, String, SchemaTable>> drop(SqlgGraph sqlgGraph, String leafElementsToDelete, Optional<String> edgesToDelete, LinkedList<SchemaTableTree> distinctQueryStack) {
List<Triple<SqlgSqlExecutor.DROP_QUERY, String, SchemaTable>> sqls = new ArrayList<>();
SchemaTableTree last = distinctQueryStack.getLast();
SchemaTableTree lastEdge = null;
// if the leaf elements are vertices then we need to delete its in and out edges.
boolean isVertex = last.getSchemaTable().isVertexTable();
VertexLabel lastVertexLabel = null;
if (isVertex) {
Optional<Schema> schemaOptional = sqlgGraph.getTopology().getSchema(last.getSchemaTable().getSchema());
Preconditions.checkState(schemaOptional.isPresent(), "BUG: %s not found in the topology.", last.getSchemaTable().getSchema());
Schema schema = schemaOptional.get();
Optional<VertexLabel> vertexLabelOptional = schema.getVertexLabel(last.getSchemaTable().withOutPrefix().getTable());
Preconditions.checkState(vertexLabelOptional.isPresent(), "BUG: %s not found in the topology.", last.getSchemaTable().withOutPrefix().getTable());
lastVertexLabel = vertexLabelOptional.get();
}
boolean queryTraversesEdge = isVertex && (distinctQueryStack.size() > 1);
EdgeLabel lastEdgeLabel = null;
if (queryTraversesEdge) {
lastEdge = distinctQueryStack.get(distinctQueryStack.size() - 2);
Optional<Schema> edgeSchema = sqlgGraph.getTopology().getSchema(lastEdge.getSchemaTable().getSchema());
Preconditions.checkState(edgeSchema.isPresent(), "BUG: %s not found in the topology.", lastEdge.getSchemaTable().getSchema());
Optional<EdgeLabel> edgeLabelOptional = edgeSchema.get().getEdgeLabel(lastEdge.getSchemaTable().withOutPrefix().getTable());
Preconditions.checkState(edgeLabelOptional.isPresent(), "BUG: %s not found in the topology.", lastEdge.getSchemaTable().getTable());
lastEdgeLabel = edgeLabelOptional.get();
}
if (isVertex) {
// First delete all edges except for this edge traversed to get to the vertices.
StringBuilder sb;
for (Map.Entry<String, EdgeLabel> edgeLabelEntry : lastVertexLabel.getOutEdgeLabels().entrySet()) {
EdgeLabel edgeLabel = edgeLabelEntry.getValue();
if (lastEdgeLabel == null || !edgeLabel.equals(lastEdgeLabel)) {
// Delete
sb = new StringBuilder();
sb.append("DELETE FROM ");
sb.append(maybeWrapInQoutes(edgeLabel.getSchema().getName()));
sb.append(".");
sb.append(maybeWrapInQoutes(Topology.EDGE_PREFIX + edgeLabel.getName()));
sb.append("\nWHERE ");
sb.append(maybeWrapInQoutes(lastVertexLabel.getSchema().getName() + "." + lastVertexLabel.getName() + Topology.OUT_VERTEX_COLUMN_END));
sb.append(" IN(");
sb.append(leafElementsToDelete);
sb.append(")");
sqls.add(Triple.of(SqlgSqlExecutor.DROP_QUERY.NORMAL, sb.toString(), SchemaTable.of(edgeLabel.getSchema().getName(), Topology.EDGE_PREFIX + edgeLabel.getName())));
}
}
for (Map.Entry<String, EdgeLabel> edgeLabelEntry : lastVertexLabel.getInEdgeLabels().entrySet()) {
EdgeLabel edgeLabel = edgeLabelEntry.getValue();
if (lastEdgeLabel == null || !edgeLabel.equals(lastEdgeLabel)) {
// Delete
sb = new StringBuilder();
sb.append("DELETE FROM ");
sb.append(maybeWrapInQoutes(edgeLabel.getSchema().getName()));
sb.append(".");
sb.append(maybeWrapInQoutes(Topology.EDGE_PREFIX + edgeLabel.getName()));
sb.append("\nWHERE ");
sb.append(maybeWrapInQoutes(lastVertexLabel.getSchema().getName() + "." + lastVertexLabel.getName() + Topology.IN_VERTEX_COLUMN_END));
sb.append(" IN\n\t(");
sb.append(leafElementsToDelete);
sb.append(")");
sqls.add(Triple.of(SqlgSqlExecutor.DROP_QUERY.NORMAL, sb.toString(), SchemaTable.of(edgeLabel.getSchema().getName(), Topology.EDGE_PREFIX + edgeLabel.getName())));
}
}
}
// Need to defer foreign key constraint checks.
if (queryTraversesEdge) {
String edgeTableName = (maybeWrapInQoutes(lastEdge.getSchemaTable().getSchema())) + "." + maybeWrapInQoutes(lastEdge.getSchemaTable().getTable());
sqls.add(Triple.of(SqlgSqlExecutor.DROP_QUERY.ALTER, this.sqlToTurnOffReferentialConstraintCheck(edgeTableName), lastEdge.getSchemaTable()));
}
// Delete the leaf vertices, if there are foreign keys then its been deferred.
StringBuilder sb = new StringBuilder();
sb.append("DELETE FROM ");
sb.append(maybeWrapInQoutes(last.getSchemaTable().getSchema()));
sb.append(".");
sb.append(maybeWrapInQoutes(last.getSchemaTable().getTable()));
sb.append("\nWHERE \"ID\" IN (");
sb.append(leafElementsToDelete);
sb.append(")");
sqls.add(Triple.of(SqlgSqlExecutor.DROP_QUERY.NORMAL, sb.toString(), last.getSchemaTable()));
if (queryTraversesEdge) {
sb = new StringBuilder();
sb.append("DELETE FROM ");
sb.append(maybeWrapInQoutes(lastEdge.getSchemaTable().getSchema()));
sb.append(".");
sb.append(maybeWrapInQoutes(lastEdge.getSchemaTable().getTable()));
sb.append("\nWHERE \"ID\" IN (\n\t");
sb.append(edgesToDelete.get());
sb.append(")");
sqls.add(Triple.of(SqlgSqlExecutor.DROP_QUERY.EDGE, sb.toString(), lastEdge.getSchemaTable()));
}
// Enable the foreign key constraint
if (queryTraversesEdge) {
String edgeTableName = (maybeWrapInQoutes(lastEdge.getSchemaTable().getSchema())) + "." + maybeWrapInQoutes(lastEdge.getSchemaTable().getTable());
sqls.add(Triple.of(SqlgSqlExecutor.DROP_QUERY.ALTER, this.sqlToTurnOnReferentialConstraintCheck(edgeTableName), null));
}
return sqls;
}
use of org.apache.commons.lang3.tuple.Triple in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EntityCollisionInjector method alterEntityMovement.
// Returns false if game should use default collision
@Nullable
public static IntermediateMovementVariableStorage alterEntityMovement(Entity entity, MoverType type, double dx, double dy, double dz) {
final double origDx = dx;
final double origDy = dy;
final double origDz = dz;
final double origPosX = entity.posX;
final double origPosY = entity.posY;
final double origPosZ = entity.posZ;
boolean isLiving = entity instanceof EntityLivingBase;
Vec3d velocity = new Vec3d(dx, dy, dz);
Polygon playerBeforeMove = new Polygon(entity.getEntityBoundingBox());
List<Polygon> colPolys = getCollidingPolygonsAndDoBlockCols(entity, velocity);
PhysicsObject worldBelow = null;
IDraggable draggable = EntityDraggable.getDraggableFromEntity(entity);
final EntityShipMovementData lastTickEntityShipMovementData = draggable.getEntityShipMovementData();
Vector3d total = new Vector3d();
// Used to reset the player position after collision processing, effectively
// using the player to integrate their velocity
double posOffestX = 0;
double posOffestY = 0;
double posOffestZ = 0;
// True IFF the player is on a ladder
boolean isPlayerOnLadder = false;
// region Ladder movement
if (entity instanceof EntityLivingBase) {
final EntityLivingBase base = (EntityLivingBase) entity;
final List<PhysicsObject> collidingShips = ((IHasShipManager) entity.getEntityWorld()).getManager().getPhysObjectsInAABB(base.getEntityBoundingBox());
final Iterable<Triple<PhysicsObject, BlockPos, IBlockState>> ladderCollisions = getLadderCollisions(base, collidingShips);
// For now, just ignore the y component. I may or may not use it later.
final float forward = ((EntityLivingBase) entity).moveForward;
final float strafe = ((EntityLivingBase) entity).moveStrafing;
final double f1 = Math.sin(Math.toRadians(entity.rotationYaw));
final double f2 = Math.cos(Math.toRadians(entity.rotationYaw));
final double intendedXVel = strafe * f2 - forward * f1;
final double intendedYVel = 0;
final double intendedZVel = forward * f2 + strafe * f1;
final Vector3dc originalVelocityDirection = new Vector3d(intendedXVel, intendedYVel, intendedZVel).normalize();
final World world = entity.world;
final Polygon playerPolygon = new Polygon(base.getEntityBoundingBox());
for (final Triple<PhysicsObject, BlockPos, IBlockState> ladderCollision : ladderCollisions) {
final IBlockState ladderState = ladderCollision.getRight();
EnumFacing ladderFacing = null;
// For now, we only support a few blocks
if (ladderState.getPropertyKeys().contains(BlockHorizontal.FACING)) {
ladderFacing = ladderState.getValue(BlockHorizontal.FACING);
}
// We need the EnumFacing of the ladder for the code to work. If we couldn't find it then just give up :/
if (ladderFacing != null) {
final Vector3d ladderNormal = JOML.convertDouble(ladderFacing.getDirectionVec());
final ShipTransform shipTransform = ladderCollision.getLeft().getShipTransform();
// Grow the ladder BB by a small margin (makes the ladder experience better imo)
final AxisAlignedBB ladderBB = ladderCollision.getRight().getBoundingBox(world, ladderCollision.getMiddle()).offset(ladderCollision.getMiddle()).grow(.4);
final Polygon ladderPoly = new Polygon(ladderBB, shipTransform.getSubspaceToGlobal());
// Determine if the player is actually colliding with the ladder
final PhysPolygonCollider collider = new PhysPolygonCollider(playerPolygon, ladderPoly, ladderCollision.getLeft().getShipTransformationManager().normals);
collider.processData();
shipTransform.transformDirection(ladderNormal, TransformType.SUBSPACE_TO_GLOBAL);
// Don't use "floor ladders"
final boolean isLadderFacingDown = ladderNormal.y > .8;
if (isLadderFacingDown) {
continue;
}
// If the ladder is facing up, then let the player use them like monkey bars
final boolean isLadderFacingUp = ladderNormal.y < -.8;
// Whether or not the player is actually colliding with a ladder, since it is close to one we give the player ladder movement.
dx = MathHelper.clamp(dx, -.15, .15);
dz = MathHelper.clamp(dz, -.15, .15);
base.fallDistance = 0;
if (!isLadderFacingUp) {
// Use ladders like normal
if (dy < -.15) {
dy = -.15;
}
final boolean isPlayerGoingTowardsLadder = originalVelocityDirection.dot(ladderNormal) < -.1;
final boolean isPlayerSneakingOnLadder = base.isSneaking() && base instanceof EntityPlayer;
if (isPlayerSneakingOnLadder && dy < 0) {
dy = 0;
}
if (!collider.seperated && isPlayerGoingTowardsLadder) {
dy = .2;
}
} else {
// Use ladders like monkey bars
dy = .2;
}
worldBelow = ladderCollision.getLeft();
isPlayerOnLadder = true;
break;
}
}
}
// endregion
final Vector3dc velVec = new Vector3d(dx, dy, dz);
for (Polygon poly : colPolys) {
if (poly instanceof ShipPolygon) {
ShipPolygon shipPoly = (ShipPolygon) poly;
try {
EntityPolygonCollider fast = new EntityPolygonCollider(playerBeforeMove, shipPoly, shipPoly.normals, velVec.add(total, new Vector3d()));
if (!fast.arePolygonsSeparated()) {
// fastCollisions.add(fast);
worldBelow = shipPoly.shipFrom;
Vector3d response = fast.getCollisions()[fast.getMinDistanceIndex()].getResponse();
// TODO: Add more potential yResponses
double stepSquared = entity.stepHeight * entity.stepHeight;
// Do not do stair stepping if the player is on a ladder.
boolean isStep = isLiving && entity.onGround && !isPlayerOnLadder;
if (response.y >= 0 && VSMath.canStandOnNormal(fast.getCollisionAxes()[fast.getMinDistanceIndex()])) {
Vector3d slowButStopped = new Vector3d(0, -fast.getCollisions()[fast.getMinDistanceIndex()].getCollisionPenetrationDistance() / fast.getCollisionAxes()[fast.getMinDistanceIndex()].y(), 0);
response = slowButStopped;
}
if (isStep) {
EntityLivingBase living = (EntityLivingBase) entity;
if (Math.abs(living.moveForward) > .01 || Math.abs(living.moveStrafing) > .01) {
for (int i = 3; i < 6; i++) {
Vector3d tempResponse = fast.getCollisions()[i].getResponse();
if (tempResponse.y > 0 && VSMath.canStandOnNormal(fast.getCollisions()[i].getCollisionNormal()) && tempResponse.lengthSquared() < stepSquared) {
if (tempResponse.lengthSquared() < .1) {
// Too small to be a real step, let it through
response = tempResponse;
} else {
// System.out.println("Try Stepping!");
AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().offset(tempResponse.x, tempResponse.y, tempResponse.z);
// Don't allow the player to step if the step will put them in another polygon.
boolean collidesWithAnything = false;
{
final AxisAlignedBB newEntityBBShrunk = axisalignedbb.shrink(.15);
final Polygon newEntityBBShrunkPolygon = new Polygon(newEntityBBShrunk);
for (Polygon potentialStepCollision : colPolys) {
if (potentialStepCollision == poly) {
// Don't run this on ourself
continue;
}
if (potentialStepCollision.getEnclosedAABB().intersects(newEntityBBShrunk)) {
// Finer check
ShipPolygon potentialStepCollisionShipPoly = (ShipPolygon) potentialStepCollision;
final EntityPolygonCollider checkIfStepCollidesWithBlock = new EntityPolygonCollider(newEntityBBShrunkPolygon, potentialStepCollisionShipPoly, potentialStepCollisionShipPoly.normals, new Vector3d());
checkIfStepCollidesWithBlock.processData();
if (!checkIfStepCollidesWithBlock.arePolygonsSeparated()) {
collidesWithAnything = true;
break;
}
}
}
}
if (!collidesWithAnything) {
entity.setEntityBoundingBox(axisalignedbb);
// I think this correct, but it may create more problems than it solves
response.zero();
entity.resetPositionToBB();
}
}
}
}
}
}
// total.add(response);
if (Math.abs(response.x) > .01D) {
total.x += response.x;
}
if (Math.abs(response.y) > .01D) {
total.y += response.y;
}
if (Math.abs(response.z) > .01D) {
total.z += response.z;
}
entity.posX += response.x;
entity.posY += response.y;
entity.posZ += response.z;
posOffestX += response.x;
posOffestY += response.y;
posOffestZ += response.z;
AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().offset(response.x, response.y, response.z);
entity.setEntityBoundingBox(axisalignedbb);
entity.resetPositionToBB();
}
} catch (Exception e) {
// Do nothing
}
}
}
AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().offset(-posOffestX, -posOffestY, -posOffestZ);
entity.setEntityBoundingBox(axisalignedbb);
entity.resetPositionToBB();
// We are on the ship that we are riding
if (entity.ridingEntity instanceof EntityMountable) {
final EntityMountable entityMountable = (EntityMountable) entity.ridingEntity;
if (entityMountable.getReferencePosOptional().isPresent()) {
final Optional<PhysicsObject> physicsObjectOptional = ValkyrienUtils.getPhysoManagingBlock(entity.world, entityMountable.getReferencePosOptional().get());
if (physicsObjectOptional.isPresent()) {
worldBelow = physicsObjectOptional.get();
}
}
}
if (worldBelow == null) {
return null;
}
dx += total.x;
dy += total.y;
dz += total.z;
boolean alreadyOnGround = entity.onGround && (dy == origDy) && origDy < 0;
Vector3d original = new Vector3d(origDx, origDy, origDz);
Vector3d newMov = new Vector3d(dx - origDx, dy - origDy, dz - origDz);
entity.collidedHorizontally = original.dot(newMov) < 0;
entity.collidedVertically = isDifSignificant(dy, origDy);
entity.onGround = entity.collidedVertically && origDy < 0 || alreadyOnGround;
entity.collided = entity.collidedHorizontally || entity.collidedVertically;
// entity.resetPositionToBB();
double motionYBefore = entity.motionY;
float oldFallDistance = entity.fallDistance;
Vector3d dxyz = new Vector3d(dx, dy, dz);
;
Vector3d origDxyz = new Vector3d(origDx, origDy, origDz);
Vector3d origPosXyz = new Vector3d(origPosX, origPosY, origPosZ);
return new IntermediateMovementVariableStorage(dxyz, origDxyz, origPosXyz, alreadyOnGround, motionYBefore, oldFallDistance, worldBelow.getShipData());
}
use of org.apache.commons.lang3.tuple.Triple in project GDSC-SMLM by aherbert.
the class BenchmarkFilterAnalysis method readFilterSets.
@Nullable
@SuppressWarnings("unchecked")
private List<FilterSet> readFilterSets() {
if (extraOptions) {
final MultiPathFilter multiFilter = BenchmarkSpotFit.getMultiFilter();
if (multiFilter != null) {
final IDirectFilter f = multiFilter.getFilter();
if (f instanceof DirectFilter) {
final GenericDialog gd = new GenericDialog(TITLE);
gd.addMessage("Use an identical filter to " + BenchmarkSpotFit.TITLE);
gd.enableYesNoCancel();
gd.hideCancelButton();
gd.showDialog();
if (gd.wasOKed()) {
final List<FilterSet> filterSets = new ArrayList<>(1);
final List<Filter> filters = new ArrayList<>(1);
filters.add((DirectFilter) f);
final FilterSet filterSet = new FilterSet(filters);
filterSets.add(filterSet);
resetParametersFromFitting();
createResultsPrefix2();
return filterSets;
}
}
}
}
GUIFilterSettings filterSettings = SettingsManager.readGuiFilterSettings(0);
final String filename = ImageJUtils.getFilename("Filter_File", filterSettings.getFilterSetFilename());
if (filename != null) {
IJ.showStatus("Reading filters ...");
filterSettings = filterSettings.toBuilder().setFilterSetFilename(filename).build();
// Allow the filters to be cached
final Triple<String, Long, List<FilterSet>> filterCache = lastFilterList.get();
if (isSameFile(filename, filterCache)) {
final GenericDialog gd = new GenericDialog(TITLE);
gd.hideCancelButton();
gd.addMessage("The same filter file was selected.");
gd.addCheckbox("Re-use_filters", settings.reUseFilters);
gd.showDialog();
if (!gd.wasCanceled()) {
settings.reUseFilters = gd.getNextBoolean();
if (settings.reUseFilters) {
SettingsManager.writeSettings(filterSettings);
return filterCache.getRight();
}
}
}
final File file = new File(filename);
try (BufferedReader input = new BufferedReader(new UnicodeReader(new FileInputStream(file), null))) {
// Use the instance so we can catch the exception
final Object o = FilterXStreamUtils.getXStreamInstance().fromXML(input);
if (!(o instanceof List<?>)) {
IJ.log("No filter sets defined in the specified file: " + filename);
return null;
}
SettingsManager.writeSettings(filterSettings);
List<FilterSet> filterSets = (List<FilterSet>) o;
if (containsStandardFilters(filterSets)) {
IJ.log("Filter sets must contain 'Direct' filters");
return null;
}
// Check they are not empty lists
final List<FilterSet> filterSets2 = new LinkedList<>();
for (final FilterSet filterSet : filterSets) {
if (filterSet.size() != 0) {
filterSets2.add(filterSet);
} else {
IJ.log("Filter set empty: " + filterSet.getName());
}
}
if (filterSets2.isEmpty()) {
IJ.log("All Filter sets are empty");
return null;
}
// Maintain the same list type
filterSets.clear();
filterSets.addAll(filterSets2);
// Option to enumerate filters
filterSets = expandFilters(filterSets);
// Save for re-use
lastFilterList.set(Triple.of(filename, getLastModified(file), filterSets));
return filterSets;
} catch (final Exception ex) {
IJ.log("Unable to load the filter sets from file: " + ex.getMessage());
} finally {
IJ.showStatus("");
}
}
return null;
}
use of org.apache.commons.lang3.tuple.Triple in project alluxio by Alluxio.
the class AlluxioMasterRestServiceHandler method getWebUIConfiguration.
/**
* Gets Web UI ServerConfiguration page data.
*
* @return the response object
*/
@GET
@Path(WEBUI_CONFIG)
public Response getWebUIConfiguration() {
return RestUtils.call(() -> {
MasterWebUIConfiguration response = new MasterWebUIConfiguration();
response.setWhitelist(mFileSystemMaster.getWhiteList());
TreeSet<Triple<String, String, String>> sortedProperties = new TreeSet<>();
Set<String> alluxioConfExcludes = Sets.newHashSet(PropertyKey.MASTER_WHITELIST.toString());
for (ConfigProperty configProperty : mMetaMaster.getConfiguration(GetConfigurationPOptions.newBuilder().setRawValue(true).build()).toProto().getClusterConfigsList()) {
String confName = configProperty.getName();
if (!alluxioConfExcludes.contains(confName)) {
sortedProperties.add(new ImmutableTriple<>(confName, ConfigurationUtils.valueAsString(configProperty.getValue()), configProperty.getSource()));
}
}
response.setConfiguration(sortedProperties);
return response;
}, ServerConfiguration.global());
}
Aggregations