1 4 package com.inversoft.savant; 5 6 7 import java.io.File ; 8 import java.io.FileInputStream ; 9 import java.io.IOException ; 10 import java.util.MissingResourceException ; 11 import java.util.PropertyResourceBundle ; 12 13 14 22 public abstract class AbstractURLBuilder implements URLBuilder { 23 24 36 protected String makeBaseURLSpec(String defaultDomain, File mapping, 37 Artifact artifact) 38 throws SavantException { 39 String domain = defaultDomain; 40 if (mapping != null && mapping.exists() && mapping.isFile()) { 41 try { 42 FileInputStream fis = new FileInputStream (mapping); 43 PropertyResourceBundle bundle = new PropertyResourceBundle (fis); 44 domain = bundle.getString(artifact.getGroup()); 45 } catch (IOException ioe) { 46 throw new SavantException(ioe); 47 } catch (MissingResourceException mre) { 48 } 50 } else if (mapping != null) { 51 throw new SavantException("Unable to locate mapping file [" + 52 mapping.getAbsolutePath() + "]"); 53 } 54 55 return domain; 56 } 57 } | Popular Tags |