Clover coverage report - JBind Project
Coverage timestamp: Fr Mai 28 2004 11:17:36 CEST
file stats: LOC: 67   Methods: 9
NCLOC: 41   Classes: 1
This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
SourceJob.java 50% 84,6% 88,9% 83,3%
 1   
 /*
 2   
  * JBind
 3   
  *
 4   
  * Copyright (c) by Stefan Wachter. All rights reserved.
 5   
  *
 6   
  * Usage, modification, and redistribution is subject to license terms that are
 7   
  * available at 'http://www.jbind.org'. The JBind license is like the
 8   
  * 'Apache Software License V 1.1'.
 9   
  */
 10   
 package org.jbind.xml.schema.reader;
 11   
 
 12   
 import java.net.MalformedURLException;
 13   
 import java.net.URL;
 14   
 
 15   
 import org.jbind.xml.msg.IConstraintViolations;
 16   
 import org.jbind.xml.msg.XmlException;
 17   
 import org.jbind.xml.msg.XmlMessages;
 18   
 import org.jbind.xml.schema.instantiation.IJobRefs;
 19   
 import org.jbind.xml.schema.instantiation.ISchemaElement;
 20   
 import org.jbind.xml.schema.instantiation.ISourceJobHelper;
 21   
 
 22   
 public abstract class SourceJob extends Job {
 23   
 
 24   
   private ISchemaElement mySchemaElement = null;
 25   
 
 26  46
   public SourceJob(ISourceJobHelper aHelper, ISchemaElement aSchemaElement) {
 27  46
     super(aHelper);
 28  46
     mySchemaElement = aSchemaElement;
 29   
   }
 30   
 
 31  48
   protected ISchemaElement getSchemaElement() {
 32  48
     return mySchemaElement;
 33   
   }
 34   
 
 35  152
   public IInstantiator getInstantiator() {
 36  152
     return getParent().getInstantiator();
 37   
   }
 38   
 
 39  40
   protected URL getUrl() throws XmlException {
 40  40
     String schemaLocation = ((ISourceJobHelper)getHelper()).getSchemaLocation();
 41  40
     if (null == schemaLocation) {
 42  0
       return null;
 43   
     }
 44  40
     URL res = null;
 45  40
     URL baseUrl = ((ISchemaJob)getParent()).getUrl();
 46  40
     try {
 47   
       // Resolve the schemaLocation relative to the baseUrl
 48  40
       res = new URL(baseUrl, schemaLocation);
 49   
       // The following lines do not work correctly in case of jar files!
 50   
 //      File baseFile = new File(baseUrl.getFile());
 51   
 //      File schemaFile = new File(baseFile.getParent(), schemaLocation);
 52   
 //      res = new URL(baseUrl.getProtocol(), baseUrl.getHost(), baseUrl.getPort(), schemaFile.toURL().getFile());
 53   
     } catch (MalformedURLException e) {
 54  0
       throw new XmlException(XmlMessages.invalidSchemaLocation(baseUrl, schemaLocation, getHelper()));
 55   
     }
 56  40
     return res;
 57   
   }
 58   
 
 59  46
   public void collectRefsForCreation(IJobRefs aJobRefs) {}
 60  90
   public void collectRefsForCompletion(IJobRefs aJobRefs) {}
 61  0
   public void collectRefsForValidation(IJobRefs aJobRefs) {}
 62   
 
 63  45
   public void doExecuteCompletion(IConstraintViolations aViolations) {}
 64  45
   public void doExecuteValidation(IConstraintViolations aViolations) {}
 65   
 
 66   
 }
 67