|  1 |     | 
   package org.kuali.rice.ksb.api.registry;  | 
  |  2 |     | 
     | 
  |  3 |     | 
   import java.io.Serializable;  | 
  |  4 |     | 
   import java.util.Collection;  | 
  |  5 |     | 
     | 
  |  6 |     | 
   import javax.xml.bind.annotation.XmlAccessType;  | 
  |  7 |     | 
   import javax.xml.bind.annotation.XmlAccessorType;  | 
  |  8 |     | 
   import javax.xml.bind.annotation.XmlAnyElement;  | 
  |  9 |     | 
   import javax.xml.bind.annotation.XmlElement;  | 
  |  10 |     | 
   import javax.xml.bind.annotation.XmlRootElement;  | 
  |  11 |     | 
   import javax.xml.bind.annotation.XmlType;  | 
  |  12 |     | 
     | 
  |  13 |     | 
   import org.kuali.rice.core.api.CoreConstants;  | 
  |  14 |     | 
   import org.kuali.rice.core.api.mo.AbstractDataTransferObject;  | 
  |  15 |     | 
   import org.kuali.rice.core.api.mo.ModelBuilder;  | 
  |  16 |     | 
   import org.w3c.dom.Element;  | 
  |  17 |     | 
     | 
  |  18 |     | 
     | 
  |  19 |     | 
     | 
  |  20 |     | 
     | 
  |  21 |     | 
     | 
  |  22 |     | 
     | 
  |  23 |     | 
     | 
  |  24 |     | 
     | 
  |  25 |     | 
     | 
  |  26 |     | 
     | 
  |  27 |    0 |    @XmlRootElement(name = ServiceEndpoint.Constants.ROOT_ELEMENT_NAME)  | 
  |  28 |     | 
   @XmlAccessorType(XmlAccessType.NONE)  | 
  |  29 |     | 
   @XmlType(name = ServiceEndpoint.Constants.TYPE_NAME, propOrder = { | 
  |  30 |     | 
                   ServiceEndpoint.Elements.INFO,  | 
  |  31 |     | 
                   ServiceEndpoint.Elements.DESCRIPTOR,  | 
  |  32 |     | 
                   CoreConstants.CommonElements.FUTURE_ELEMENTS  | 
  |  33 |     | 
   })  | 
  |  34 |    0 |    public final class ServiceEndpoint extends AbstractDataTransferObject implements ServiceEndpointContract { | 
  |  35 |     | 
     | 
  |  36 |     | 
           private static final long serialVersionUID = -2295962329997871877L;  | 
  |  37 |     | 
         | 
  |  38 |     | 
           @XmlElement(name = Elements.INFO, required = false)  | 
  |  39 |     | 
       private final ServiceInfo info;  | 
  |  40 |     | 
             | 
  |  41 |     | 
       @XmlElement(name = Elements.DESCRIPTOR, required = false)  | 
  |  42 |     | 
       private final ServiceDescriptor descriptor;  | 
  |  43 |     | 
         | 
  |  44 |    0 |        @SuppressWarnings("unused") | 
  |  45 |     | 
       @XmlAnyElement  | 
  |  46 |     | 
       private final Collection<Element> _futureElements = null;  | 
  |  47 |     | 
     | 
  |  48 |     | 
         | 
  |  49 |     | 
     | 
  |  50 |     | 
     | 
  |  51 |    0 |        private ServiceEndpoint() { | 
  |  52 |    0 |            this.info = null;  | 
  |  53 |    0 |                this.descriptor = null;  | 
  |  54 |    0 |        }  | 
  |  55 |     | 
         | 
  |  56 |    0 |        private ServiceEndpoint(Builder builder) { | 
  |  57 |    0 |            this.info = builder.getInfo().build();  | 
  |  58 |    0 |            this.descriptor = builder.getDescriptor().build();  | 
  |  59 |    0 |        }  | 
  |  60 |     | 
         | 
  |  61 |     | 
       @Override  | 
  |  62 |     | 
       public ServiceInfo getInfo() { | 
  |  63 |    0 |            return this.info;  | 
  |  64 |     | 
       }  | 
  |  65 |     | 
         | 
  |  66 |     | 
       @Override  | 
  |  67 |     | 
       public ServiceDescriptor getDescriptor() { | 
  |  68 |    0 |            return this.descriptor;  | 
  |  69 |     | 
       }  | 
  |  70 |     | 
     | 
  |  71 |     | 
         | 
  |  72 |     | 
     | 
  |  73 |     | 
     | 
  |  74 |    0 |        public final static class Builder implements Serializable, ModelBuilder, ServiceEndpointContract { | 
  |  75 |     | 
     | 
  |  76 |     | 
                   private static final long serialVersionUID = -1783718474634197837L;  | 
  |  77 |     | 
     | 
  |  78 |     | 
                   private ServiceInfo.Builder info;  | 
  |  79 |     | 
           private ServiceDescriptor.Builder descriptor;  | 
  |  80 |     | 
     | 
  |  81 |    0 |            private Builder(ServiceInfo.Builder info, ServiceDescriptor.Builder descriptor) { | 
  |  82 |    0 |                setInfo(info);  | 
  |  83 |    0 |                setDescriptor(descriptor);  | 
  |  84 |    0 |            }  | 
  |  85 |     | 
     | 
  |  86 |     | 
           public static Builder create(ServiceInfo.Builder info, ServiceDescriptor.Builder descriptor) { | 
  |  87 |    0 |                return new Builder(info, descriptor);  | 
  |  88 |     | 
           }  | 
  |  89 |     | 
     | 
  |  90 |     | 
           public static Builder create(ServiceEndpointContract contract) { | 
  |  91 |    0 |                if (contract == null) { | 
  |  92 |    0 |                    throw new IllegalArgumentException("contract was null"); | 
  |  93 |     | 
               }  | 
  |  94 |    0 |                Builder builder = create(ServiceInfo.Builder.create(contract.getInfo()), ServiceDescriptor.Builder.create(contract.getDescriptor()));  | 
  |  95 |    0 |                return builder;  | 
  |  96 |     | 
           }  | 
  |  97 |     | 
     | 
  |  98 |     | 
           public ServiceEndpoint build() { | 
  |  99 |    0 |                return new ServiceEndpoint(this);  | 
  |  100 |     | 
           }  | 
  |  101 |     | 
     | 
  |  102 |     | 
           @Override  | 
  |  103 |     | 
           public ServiceInfo.Builder getInfo() { | 
  |  104 |    0 |                return this.info;  | 
  |  105 |     | 
           }  | 
  |  106 |     | 
             | 
  |  107 |     | 
           @Override  | 
  |  108 |     | 
           public ServiceDescriptor.Builder getDescriptor() { | 
  |  109 |    0 |                return this.descriptor;  | 
  |  110 |     | 
           }  | 
  |  111 |     | 
             | 
  |  112 |     | 
           public void setInfo(ServiceInfo.Builder info) { | 
  |  113 |    0 |                if (info == null) { | 
  |  114 |    0 |                        throw new IllegalArgumentException("info was null"); | 
  |  115 |     | 
               }  | 
  |  116 |    0 |                this.info = info;  | 
  |  117 |    0 |            }  | 
  |  118 |     | 
     | 
  |  119 |     | 
           public void setDescriptor(ServiceDescriptor.Builder descriptor) { | 
  |  120 |    0 |                    if (descriptor == null) { | 
  |  121 |    0 |                        throw new IllegalArgumentException("descriptor was null"); | 
  |  122 |     | 
               }  | 
  |  123 |    0 |                this.descriptor = descriptor;  | 
  |  124 |    0 |            }  | 
  |  125 |     | 
             | 
  |  126 |     | 
       }  | 
  |  127 |     | 
     | 
  |  128 |     | 
     | 
  |  129 |     | 
         | 
  |  130 |     | 
     | 
  |  131 |     | 
     | 
  |  132 |    0 |        static class Constants { | 
  |  133 |     | 
     | 
  |  134 |     | 
           final static String ROOT_ELEMENT_NAME = "serviceEndpoint";  | 
  |  135 |     | 
           final static String TYPE_NAME = "ServiceEndpointType";  | 
  |  136 |     | 
     | 
  |  137 |     | 
       }  | 
  |  138 |     | 
     | 
  |  139 |     | 
     | 
  |  140 |     | 
         | 
  |  141 |     | 
     | 
  |  142 |     | 
     | 
  |  143 |    0 |        static class Elements { | 
  |  144 |     | 
     | 
  |  145 |     | 
           final static String INFO = "info";  | 
  |  146 |     | 
           final static String DESCRIPTOR = "descriptor";  | 
  |  147 |     | 
     | 
  |  148 |     | 
       }  | 
  |  149 |     | 
         | 
  |  150 |     | 
   }  |