This project has retired. For details please refer to its Attic page.
Coverage Report
Coverage Report - org.apache.ws.scout.registry.infomodel.ServiceBindingImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ServiceBindingImpl
47%
19/40
16%
1/6
1.467
 
 1  
 /*
 2  
  * Copyright 2001-2004 The Apache Software Foundation.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *      http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.apache.ws.scout.registry.infomodel;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Collection;
 20  
 import java.util.Iterator;
 21  
 
 22  
 import javax.xml.registry.InvalidRequestException;
 23  
 import javax.xml.registry.JAXRException;
 24  
 import javax.xml.registry.LifeCycleManager;
 25  
 import javax.xml.registry.UnexpectedObjectException;
 26  
 import javax.xml.registry.infomodel.InternationalString;
 27  
 import javax.xml.registry.infomodel.Service;
 28  
 import javax.xml.registry.infomodel.ServiceBinding;
 29  
 import javax.xml.registry.infomodel.SpecificationLink;
 30  
 
 31  
 /**
 32  
  * Implements JAXR Interface.
 33  
  * For futher details, look into the JAXR API Javadoc.
 34  
  *
 35  
  * @author Anil Saldhana  <anil@apache.org>
 36  
  */
 37  
 public class ServiceBindingImpl extends RegistryObjectImpl implements ServiceBinding
 38  
 {
 39  64
     private Collection<SpecificationLink> links = new ArrayList<SpecificationLink>();
 40  64
     private String accessuri = null;
 41  64
     private Service service = null;
 42  64
     private ServiceBinding targetbinding = null;
 43  64
     private boolean validateuri = false;
 44  
 
 45  
     public ServiceBindingImpl(LifeCycleManager lifeCycleManager)
 46  
     {
 47  64
         super(lifeCycleManager);
 48  64
     }
 49  
 
 50  
     public ServiceBindingImpl(LifeCycleManager lifeCycleManager, InternationalString n)
 51  
     {
 52  0
         super(lifeCycleManager, n);
 53  0
     }
 54  
 
 55  
     public void addSpecificationLink(SpecificationLink sl) throws JAXRException
 56  
     {
 57  6
         links.add(sl);
 58  6
         ((SpecificationLinkImpl)sl).setServiceBinding(this);
 59  6
     }
 60  
 
 61  
     public void addSpecificationLinks(Collection col) throws JAXRException
 62  
     {
 63  
         try
 64  
         {
 65  0
             Iterator iter = col.iterator();
 66  0
             while(iter.hasNext())
 67  
             {
 68  0
                addSpecificationLink((SpecificationLink)iter.next());
 69  
             }
 70  0
         } catch (ClassCastException e)
 71  
         {
 72  0
             throw new UnexpectedObjectException();
 73  0
         }
 74  0
     }
 75  
 
 76  
     public String getAccessURI() throws JAXRException
 77  
     {
 78  26
         return accessuri;
 79  
     }
 80  
 
 81  
     public Service getService() throws JAXRException
 82  
     {
 83  16
         return service;
 84  
     }
 85  
 
 86  
     public Collection getSpecificationLinks() throws JAXRException
 87  
     {
 88  16
         return links;
 89  
     }
 90  
 
 91  
     public ServiceBinding getTargetBinding() throws JAXRException
 92  
     {
 93  16
         return targetbinding;
 94  
     }
 95  
 
 96  
     public void removeSpecificationLink(SpecificationLink link) throws JAXRException
 97  
     {
 98  0
         links.remove(link);
 99  0
     }
 100  
 
 101  
     public void removeSpecificationLinks(Collection col) throws JAXRException
 102  
     {
 103  0
         links.removeAll(col);
 104  0
     }
 105  
 
 106  
     public void setAccessURI(String s) throws JAXRException
 107  
     {
 108  60
         if(targetbinding != null)
 109  0
         throw new InvalidRequestException("There is already a Target Binding defined");
 110  60
         accessuri = s;
 111  60
     }
 112  
 
 113  
     public void setTargetBinding(ServiceBinding sb) throws JAXRException
 114  
     {
 115  0
         if(accessuri != null)
 116  0
                 throw new InvalidRequestException("There is already an Access URI defined");
 117  
 
 118  0
         targetbinding = sb;
 119  0
     }
 120  
 
 121  
     public boolean getValidateURI() throws JAXRException
 122  
     {
 123  0
         return validateuri;
 124  
     }
 125  
 
 126  
     public void setValidateURI(boolean b) throws JAXRException
 127  
     {
 128  0
         validateuri = b;
 129  0
     }
 130  
 
 131  
     //Specific API
 132  
     public void setService(Service s)
 133  
     {
 134  110
         service =s;
 135  110
     }
 136  
 }