org.onebusaway.federations.impl
Class FederatedServiceLibrary

java.lang.Object
  extended by org.onebusaway.federations.impl.FederatedServiceLibrary

public class FederatedServiceLibrary
extends Object

Provides a number of convenience methods for working with FederatedService instances.

Author:
bdferris
See Also:
FederatedService

Constructor Summary
FederatedServiceLibrary()
           
 
Method Summary
static boolean checkAgencyAndCoverageAgainstExisting(Map<FederatedService,Map<String,List<CoordinateBounds>>> byProvider, String agencyId, List<CoordinateBounds> coverage, Class<?> serviceInterface, boolean failHard)
          Given an existing set of FederatedService instances along with their set of agency ids and geographic bounds, examine an additional agency id and coverage area from another service instance and verify that there is no overlap.
static Map<FederatedService,Map<String,List<CoordinateBounds>>> getFederatedServiceAgencyCoverage(List<? extends FederatedService> federatedServiceInstances, Class<? extends FederatedService> federatedServiceInterface)
          Given a list of FederatedService instances federatedServiceInstances that implement a target federatedServiceInterface, query each instance in turn to determine its set of agencies and geographic bounds, verifying that no two distinct federated service instances have overlapping agency ids or geographic bounds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FederatedServiceLibrary

public FederatedServiceLibrary()
Method Detail

getFederatedServiceAgencyCoverage

public static Map<FederatedService,Map<String,List<CoordinateBounds>>> getFederatedServiceAgencyCoverage(List<? extends FederatedService> federatedServiceInstances,
                                                                                                         Class<? extends FederatedService> federatedServiceInterface)
Given a list of FederatedService instances federatedServiceInstances that implement a target federatedServiceInterface, query each instance in turn to determine its set of agencies and geographic bounds, verifying that no two distinct federated service instances have overlapping agency ids or geographic bounds. We construct a map from each service instance to its set of agency ids along with their geographic regions.

Parameters:
federatedServiceInstances -
federatedServiceInterface -
Returns:
a map of service instances along with their agency ids and coverage areas

checkAgencyAndCoverageAgainstExisting

public static boolean checkAgencyAndCoverageAgainstExisting(Map<FederatedService,Map<String,List<CoordinateBounds>>> byProvider,
                                                            String agencyId,
                                                            List<CoordinateBounds> coverage,
                                                            Class<?> serviceInterface,
                                                            boolean failHard)
Given an existing set of FederatedService instances along with their set of agency ids and geographic bounds, examine an additional agency id and coverage area from another service instance and verify that there is no overlap.

Parameters:
byProvider - existing FederatedService instances along with their agency ids and coverage areas
agencyId - a new agency id to check
coverage - the coverage area for that agency
serviceInterface - the target service interface
failHard - throw an exception if overlap is found
Returns:
true if there is no overlap (good), other false (bad)


Copyright © 2011 OneBusAway. All Rights Reserved.