public void xr_instanceDetails()
        {
            Console.Out.WriteLine("serialization instanceDetails");
            instanceDetails r  = new instanceDetails();
            XmlSerializer   xr = new XmlSerializer(typeof(instanceDetails));
            StringWriter    sw = new StringWriter();

            xr.Serialize(sw, r);
            System.Console.Out.WriteLine(sw.ToString());
        }
        public static instanceDetails MapInstanceDetails(uddi.apiv2.instanceDetails instanceDetails)
        {
            if (instanceDetails == null)
            {
                return(null);
            }
            instanceDetails r = new instanceDetails();

            r.description   = MapDescription(instanceDetails.description);
            r.instanceParms = instanceDetails.instanceParms;
            r.Items         = MapOverviewDoc(instanceDetails.overviewDoc);
            return(r);
        }
Exemple #3
0
        protected bindingTemplate createWADLBinding(QName serviceQName, String portName, Uri serviceUrl, resources res)
        {
            bindingTemplate bindingTemplate = new bindingTemplate();

            // Set BusinessService Key
            bindingTemplate.serviceKey = (UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));
            List <tModelInstanceInfo> items = new List <tModelInstanceInfo>();

            if (serviceUrl != null)
            {
                // Set AccessPoint
                accessPoint accessPoint = new accessPoint();
                accessPoint.useType  = (AccessPointType.endPoint.ToString());
                accessPoint.Value    = ((serviceUrl.ToString()));
                bindingTemplate.Item = (accessPoint);
                // Set Binding Key
                String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceQName, portName, serviceUrl);
                bindingTemplate.bindingKey = (bindingKey);

                bindingTemplate.description = Common2UDDI.mapdescription(getDescription(res.doc), lang).ToArray();

                // reference wsdl:binding tModel
                tModelInstanceInfo tModelInstanceInfoBinding = new tModelInstanceInfo();
                tModelInstanceInfoBinding.tModelKey = (keyDomainURI + "binding");
                instanceDetails id = new instanceDetails();
                id.instanceParms = portName;
                tModelInstanceInfoBinding.instanceDetails = (id);

                tModelInstanceInfoBinding.description = Common2UDDI.mapdescription("The binding that this endpoint implements. " + bindingTemplate.description[0].Value
                                                                                   + " The instanceParms specifies the port local name.", lang).ToArray();
                items.Add(tModelInstanceInfoBinding);

                tModelInstanceInfo tModelInstanceInfoPortType = new tModelInstanceInfo();
                tModelInstanceInfoPortType.tModelKey   = (keyDomainURI + "rest");
                tModelInstanceInfoPortType.description = Common2UDDI.mapdescription("The wadl:Resource:base implements.", lang).ToArray();
                items.Add(tModelInstanceInfoPortType);
            }
            bindingTemplate.tModelInstanceDetails = items.ToArray();
            return(bindingTemplate);
        }
Exemple #4
0
        /**
         * Compares two non-null instances of TModelInstanceDetails by only
         * comparing the field designated from the constructor. It will also cast or
         * parse TModelInstanceDetails[i].InstanceDetails[k].InstanceParms to the
         * selected data type double, XMLGregorgian or Duration, using that as a
         * basis for comparison. If a parsing error occurs, an exception will be
         * thrown.
         *
         * @param lhs
         * @param rhs
         * @return less than 0 if lhs &lt; rhs, greater than 0 if lhs &gt; rhs.
         * @throws IllegalArgumentException if the tModel key to search for is
         * missing, if either sides are null
         * @throws ArrayIndexOutOfBoundsException if the values were found but could
         * not be compared
         *  throws IllegalArgumentException, NumberFormatException, NullPointerException, ArrayIndexOutOfBoundsException
         */
        public int compare(tModelInstanceInfo[] lhs, tModelInstanceInfo[] rhs)
        {
            if (lhs == null)
            {
                throw new ArgumentNullException("lhs");
            }
            if (rhs == null)
            {
                throw new ArgumentNullException("rhs");
            }
            if (lhs.Length == 0 || rhs.Length == 0)
            {
                throw new ArgumentOutOfRangeException("no data to compare");
            }
            instanceDetails lhsc = null;
            instanceDetails rhsc = null;

            for (int i = 0; i < lhs.Length; i++)
            {
                if (lhs[i].tModelKey != null && lhs[i].tModelKey.Equals(compareField, StringComparison.CurrentCultureIgnoreCase))
                {
                    lhsc = lhs[i].instanceDetails;
                }
            }
            for (int i = 0; i < rhs.Length; i++)
            {
                if (rhs[i].tModelKey != null && rhs[i].tModelKey.Equals(compareField, StringComparison.CurrentCultureIgnoreCase))
                {
                    rhsc = rhs[i].instanceDetails;
                }
            }

            if (lhsc == null)
            {
                throw new ArgumentOutOfRangeException(compareField + " not found for lhs");
            }
            if (rhsc == null)
            {
                throw new ArgumentOutOfRangeException(compareField + " not found for rhs");
            }
            if (lhsc.instanceParms == null)
            {
                throw new ArgumentOutOfRangeException(compareField + " found lhs, but no data");
            }
            if (rhsc.instanceParms == null)
            {
                throw new ArgumentOutOfRangeException(compareField + " found rhs, but no data");
            }
            if (isNumber)
            {
                Double l = Double.Parse(lhsc.instanceParms);
                Double r = Double.Parse(rhsc.instanceParms);
                return(l.CompareTo(r));
            }

            if (isDate)
            {
                DateTime l = XmlConvert.ToDateTime(lhsc.instanceParms);
                DateTime r = XmlConvert.ToDateTime(rhsc.instanceParms);
                int      x = l.CompareTo(r);

                return(x);
            }

            if (isDuration)
            {
                TimeSpan l = XmlConvert.ToTimeSpan(lhsc.instanceParms);
                TimeSpan r = XmlConvert.ToTimeSpan(rhsc.instanceParms);
                int      x = l.CompareTo(r);
                return(x);
            }

            return(0);
        }