ReadGTFSSubwayDataProcessor.java
<reponame>tspannhw/FLaNK-MTASure, here is the code to read GTFS subway data for NYC MTA with NiFi:

```
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.ProcessSession;
import org.apache.nifi.processor.Relationship;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ReadGTFSSubwayDataProcessor extends AbstractProcessor {

    private static final Logger logger = LoggerFactory.getLogger(ReadGTFSSubwayDataProcessor.class);

    private static final String REL_SUCCESS = "success";
    private static final String REL_FAILURE = "failure";

    @Override
    public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
        FlowFile flowFile = session.get();
        if (flowFile == null) {
            return;
        }

        try {
            // Read the GTFS data from the flow file
            GTFSData gtfsData = new GTFSData(flowFile);

            // Write the GTFS data to a database
            gtfsData.writeToDatabase(context);

            // Set the relationship to success
            session.transfer(flowFile, REL_SUCCESS);
        } catch (Exception e) {
            logger.error("Error reading GTFS data", e);

            // Set the relationship to failure
            session.transfer(flowFile, REL_FAILURE);
        }
    }

    @Override
    protected void init(final ProcessorInitializationContext context) {
        super.init(context);

        // Register the relationships
        this.addRelationship(REL_SUCCESS);
        this.addRelationship(REL_FAILURE);
    }

    @Override
    public Set<Relationship> getRelationships() {
        return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(REL_SUCCESS, REL_FAILURE)));
    }

}
```

This code will read GTFS subway data for NYC MTA from a flow file and write it to a database. The relationships that are defined in this code are:

* `REL_SUCCESS`: This relationship is used to indicate that the GTFS data was successfully read and written to the database.
* `REL_FAILURE`: This relationship is used to indicate that an error occurred while reading or writing the GTFS data.
