public Collection<ExternalResourceDescriptor> locateExternalResourceName( Trace trace, Collection<Frame> dbFrames) { if (ListUtil.size(dbFrames) <= 0) { return Collections.emptyList(); } List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>(dbFrames.size()); for (Frame dbFrame : dbFrames) { Operation op = dbFrame.getOperation(); String host = op.get("host", String.class); int port = op.getInt("port", (-1)); String dbName = op.get("dbName", String.class); String mongoHash = MD5NameGenerator.getName(dbName + host + port); String color = colorManager.getColor(op); dbDescriptors.add( new ExternalResourceDescriptor( dbFrame, "mongo:" + mongoHash, dbName, ExternalResourceType.DATABASE.name(), MONGODB_VENDOR, host, port, color, false)); } return dbDescriptors; }
public List<ExternalResourceDescriptor> locateExternalResourceName(Trace trace) { Collection<Frame> dbFrames = trace.getLastFramesOfType(TYPE); if ((dbFrames == null) || dbFrames.isEmpty()) { return Collections.emptyList(); } List<ExternalResourceDescriptor> dbDescriptors = new ArrayList<ExternalResourceDescriptor>(dbFrames.size()); for (Frame dbFrame : dbFrames) { Operation op = dbFrame.getOperation(); String host = op.get("host", String.class); Integer portProperty = op.get("port", Integer.class); int port = portProperty == null ? -1 : portProperty.intValue(); String dbName = op.get("dbName", String.class); String redisHash = MD5NameGenerator.getName(dbName + host + port); dbDescriptors.add( new ExternalResourceDescriptor( dbFrame, "redis:" + redisHash, dbName, ExternalResourceType.DATABASE.name(), "Redis", host, port)); } return dbDescriptors; }