Coverage Report - org.mule.transport.jdbc.JdbcEndpointURIBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
JdbcEndpointURIBuilder
0%
0/13
0%
0/12
5
 
 1  
 /*
 2  
  * $Id: JdbcEndpointURIBuilder.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.transport.jdbc;
 12  
 
 13  
 import org.mule.api.endpoint.MalformedEndpointException;
 14  
 import org.mule.endpoint.AbstractEndpointURIBuilder;
 15  
 
 16  
 import java.net.URI;
 17  
 import java.util.Properties;
 18  
 
 19  
 /**
 20  
  * Parses a JDBC style endpoint to a MuleEndpointURI
 21  
  */
 22  0
 public class JdbcEndpointURIBuilder extends AbstractEndpointURIBuilder
 23  
 {
 24  
 
 25  
     protected void setEndpoint(URI uri, Properties props) throws MalformedEndpointException
 26  
     {
 27  0
         if (uri.getHost() != null && !"localhost".equals(uri.getHost()))
 28  
         {
 29  0
             endpointName = uri.getHost();
 30  
         }
 31  0
         int i = uri.getPath().indexOf("/", 1);
 32  0
         if (i > 0)
 33  
         {
 34  0
             endpointName = uri.getPath().substring(1, i);
 35  0
             address = uri.getPath().substring(i + 1);
 36  
         }
 37  0
         else if (uri.getPath() != null && uri.getPath().length() != 0)
 38  
         {
 39  0
             address = uri.getPath().substring(1);
 40  
         }
 41  
         else
 42  
         {
 43  0
             address = uri.getAuthority();
 44  
         }
 45  
         // JDBC endpoints can just have a param string, hence te address is left
 46  
         // null, but the address
 47  
         // should always be a non-null value
 48  0
         if (address == null)
 49  
         {
 50  0
             address = uri.getScheme();
 51  
         }
 52  0
     }
 53  
 }