@ Override public PDPDomain getPDPDomain ( String pdpDomainName ) throws IOException { SortedSet < String > domainRanges = null ; if ( serializedCache != null ) { if ( serializedCache . containsKey ( pdpDomainName ) ) { domainRanges = serializedCache . get ( pdpDomainName ) ; } } boolean shouldRequestDomainRanges = checkDomainRanges ( domainRanges ) ; try { if ( shouldRequestDomainRanges ) { URL u = new URL ( server + "getPDPDomain?pdpId=" + pdpDomainName ) ; logger . info ( "Fetching {}" , u ) ; InputStream response = URLConnectionTools . getInputStream ( u ) ; String xml = JFatCatClient . convertStreamToString ( response ) ; domainRanges = XMLUtil . getDomainRangesFromXML ( xml ) ; if ( domainRanges != null ) cache ( pdpDomainName , domainRanges ) ; } } catch ( MalformedURLException e ) { logger . error ( "Problem generating PDP request URL for " + pdpDomainName , e ) ; throw new IllegalArgumentException ( "Invalid PDP name: " + pdpDomainName , e ) ; } String pdbId = null ; List < ResidueRange > ranges = new ArrayList < ResidueRange > ( ) ; for ( String domainRange : domainRanges ) { SubstructureIdentifier strucId = new SubstructureIdentifier ( domainRange ) ; if ( pdbId == null ) { pdbId = strucId . getPdbId ( ) ; } else if ( ! pdbId . equals ( strucId . getPdbId ( ) ) ) { // should never happen with correct server implementation throw new RuntimeException ( "Don't know how to take the union of domains from multiple PDB IDs." ) ; } ranges . addAll ( strucId . getResidueRanges ( ) ) ; } return new PDPDomain ( pdpDomainName , ranges ) ; }
Get a StructureIdentifier representing the specified PDP domain .