Ejemplo n.º 1
0
        /**
         * Constructs the bindingKey based on the bindingKeyFormat specified in the properties. When no
         * bindingKeyFormat is specific the default format of uddi:${keyDomain}:${nodeName}-${serviceName}-{portName} is used.
         *
         * @param properties
         * @param serviceName
         * @param portName
         * @return the bindingKey
         */

        public static String getBindingKey(Properties properties, QName serviceName, String portName, Uri bindingUrl)
        {
            Properties tempProperties = new Properties();

            tempProperties.putAll(properties);
            tempProperties.put("serviceName", serviceName.getLocalPart());
            tempProperties.put("portName", portName);
            int port = bindingUrl.Port;

            if (port < 0)
            {
                if ("http".Equals(bindingUrl.Scheme, StringComparison.CurrentCultureIgnoreCase))
                {
                    port = 80;
                }
                else if ("https".Equals(bindingUrl.Scheme))
                {
                    port = 443;
                }
            }
            if (!tempProperties.containsKey("serverPort"))
            {
                tempProperties.put("serverPort", port.ToString());
            }

            //Constructing the binding Key
            String keyFormat  = properties.getProperty(Property.BINDING_KEY_FORMAT, DEFAULT_BINDING_KEY_FORMAT);
            String bindingKey = TokenResolver.replaceTokens(keyFormat, tempProperties).ToLower();

            return(bindingKey);
        }
Ejemplo n.º 2
0
        private Dictionary <String, UDDINode> readNodeConfig(uddi config, Properties properties)
        {
            //String[] names = config.getStringArray("client.nodes.node.name");
            Dictionary <String, UDDINode> nodes = new Dictionary <String, UDDINode>();

            log.debug("node count=" + config.client.nodes.Length);

            for (int i = 0; i < config.client.nodes.Length; i++)
            {
                UDDINode uddiNode = new UDDINode();

                uddiNode.setClientName(config.client.nodes[i].name);
                uddiNode.setProperties(config.client.nodes[i].properties);
                uddiNode.setHomeJUDDI(config.client.nodes[i].isHomeJUDDI);
                uddiNode.setName(config.client.nodes[i].name);
                uddiNode.setClientName(config.client.nodes[i].name);
                uddiNode.setDescription(config.client.nodes[i].description);
                uddiNode.setProxyTransport(config.client.nodes[i].proxyTransport);

                uddiNode.setInquiryUrl(TokenResolver.replaceTokens(config.client.nodes[i].inquiryUrl, config.client.nodes[i].properties));
                uddiNode.setPublishUrl(TokenResolver.replaceTokens(config.client.nodes[i].publishUrl, config.client.nodes[i].properties));
                uddiNode.setCustodyTransferUrl(TokenResolver.replaceTokens(config.client.nodes[i].custodyTransferUrl, config.client.nodes[i].properties));
                uddiNode.setSecurityUrl(TokenResolver.replaceTokens(config.client.nodes[i].securityUrl, config.client.nodes[i].properties));
                uddiNode.setSubscriptionUrl(TokenResolver.replaceTokens(config.client.nodes[i].subscriptionUrl, config.client.nodes[i].properties));
                uddiNode.setSubscriptionListenerUrl(TokenResolver.replaceTokens(config.client.nodes[i].subscriptionListenerUrl, config.client.nodes[i].properties));
                uddiNode.setJuddiApiUrl(TokenResolver.replaceTokens(config.client.nodes[i].juddiApiUrl, config.client.nodes[i].properties));
                uddiNode.setFactoryInitial(config.client.nodes[i].factoryInitial);
                uddiNode.setFactoryURLPkgs(config.client.nodes[i].factoryURLPkgs);
                uddiNode.setFactoryNamingProvider(config.client.nodes[i].factoryNamingProvider);
                nodes.Add(uddiNode.getName(), uddiNode);
            }
            return(nodes);
        }
Ejemplo n.º 3
0
        public static String getSubscriptionKey(Properties properties)
        {
            String keyFormat       = properties.getProperty(Property.SUBSCRIPTION_KEY_FORMAT, DEFAULT_SUBSCRIPTION_KEY_FORMAT);
            String subscriptionKey = TokenResolver.replaceTokens(keyFormat, properties).ToLower();

            return(subscriptionKey);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructs the serviceKey based on the bindingKeyFormat specified in the properties. When no
        /// businessKeyFormat is specific the default format of uddi:${keyDomain}:${businessName} is used. The businessName
        /// property needs to be set properties.
        /// </summary>
        /// <param name="properties"></param>
        /// <returns></returns>
        public static String getBusinessKey(Properties properties)
        {
            String businessKey = properties.getProperty(Property.BUSINESS_KEY);

            if (businessKey == null)
            {
                String keyFormat = properties.getProperty(Property.BUSINESS_KEY_FORMAT, DEFAULT_BUSINESS_KEY_FORMAT);
                businessKey = TokenResolver.replaceTokens(keyFormat, properties).ToLower();
            }
            return(businessKey);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructs the serviceKey based on the serviceKeyFormat specified in the properties. When no
        ///serviceKeyFormat is specific the default format of uddi:${keyDomain}:${serviceName} is used.
        /// </summary>
        /// <param name="properties"></param>
        /// <param name="serviceName"></param>
        /// <returns></returns>
        public static String getServiceKey(Properties properties, String serviceName)
        {
            Properties tempProperties = new Properties();

            tempProperties.putAll(properties);
            tempProperties.put("serviceName", serviceName);
            //Constructing the serviceKey
            String keyFormat  = tempProperties.getProperty(Property.SERVICE_KEY_FORMAT, DEFAULT_SERVICE_KEY_FORMAT);
            String serviceKey = TokenResolver.replaceTokens(keyFormat, tempProperties).ToLower();

            return(serviceKey);
        }
Ejemplo n.º 6
0
        public businessService readServiceAnnotations(String classWithAnnotations, Properties properties)
        {
            Type t = Type.GetType(classWithAnnotations, false, true);

            if (t != null)
            {
                businessService service = new businessService();
                object[]        attrib  = t.GetCustomAttributes(typeof(UDDIService), true);

                object[] ws = t.GetCustomAttributes(typeof(System.Web.Services.WebServiceBindingAttribute), true);
                WebServiceBindingAttribute webServiceAnnotation = null;
                if (ws != null && ws.Length > 0)
                {
                    webServiceAnnotation = ((WebServiceBindingAttribute[])ws)[0];
                }
                if (attrib != null && attrib.Length > 0)
                {
                    UDDIService[] bits        = attrib as UDDIService[];
                    UDDIService   uddiService = bits[0];
                    name          n           = new name();
                    n.lang = uddiService.lang;
                    service.businessKey = (TokenResolver.replaceTokens(uddiService.businessKey, properties));
                    service.serviceKey  = (TokenResolver.replaceTokens(uddiService.serviceKey, properties));
                    if (!"".Equals(uddiService.serviceName, StringComparison.CurrentCultureIgnoreCase))
                    {
                        n.Value = (TokenResolver.replaceTokens(uddiService.serviceName, properties));
                    }
                    else if (webServiceAnnotation != null && !"".Equals(webServiceAnnotation.Name))
                    {
                        n.Value = (webServiceAnnotation.Name);
                    }
                    else
                    {
                        n.Value = (classWithAnnotations);
                    }
                    service.name = new name[] { n };
                    description d = new description();
                    d.lang              = (uddiService.lang);
                    d.Value             = (TokenResolver.replaceTokens(uddiService.description, properties));
                    service.description = new description[] { d };

                    //categoryBag on the service
                    if (!"".Equals(uddiService.categoryBag))
                    {
                        categoryBag categoryBag = parseCategoryBag(uddiService.categoryBag);
                        service.categoryBag = (categoryBag);
                    }

                    //bindingTemplate on service
                    bindingTemplate bindingTemplate = parseServiceBinding(classWithAnnotations, uddiService.lang, webServiceAnnotation, properties);
                    if (bindingTemplate != null)
                    {
                        bindingTemplate.serviceKey = (service.serviceKey);
                        if (service.bindingTemplates == null)
                        {
                            service.bindingTemplates = new bindingTemplate[] { bindingTemplate };
                        }
                        else
                        {
                            List <bindingTemplate> l = new List <bindingTemplate>();
                            l.AddRange(service.bindingTemplates);
                            l.Add(bindingTemplate);
                            service.bindingTemplates = l.ToArray();
                        }
                    }

                    return(service);
                }
                else
                {
                    log.error("Missing UDDIService annotation in class " + classWithAnnotations);
                }
            }
            log.error("Unable to load type " + classWithAnnotations);
            return(null);
        }
Ejemplo n.º 7
0
        private bindingTemplate parseServiceBinding(string classWithAnnotations, string lang, WebServiceBindingAttribute webServiceAnnotation, Properties properties)
        {
            bindingTemplate    bindingTemplate = null;
            Type               t = Type.GetType(classWithAnnotations, false, false);
            UDDIServiceBinding uddiServiceBinding = null;

            object[] attrib = t.GetCustomAttributes(typeof(UDDIServiceBinding), true);
            if (attrib != null && attrib.Length > 0)
            {
                uddiServiceBinding = attrib[0] as UDDIServiceBinding;
            }

            //= (UDDIServiceBinding) classWithAnnotations.getAnnotation(UDDIServiceBinding.class);
            //binding
            if (uddiServiceBinding != null)
            {
                bindingTemplate = new bindingTemplate();

                bindingTemplate.bindingKey = (TokenResolver.replaceTokens(uddiServiceBinding.bindingKey, properties));

                String bindingLang = (lang);
                if (uddiServiceBinding.lang != null)
                {
                    bindingLang = TokenResolver.replaceTokens(uddiServiceBinding.lang, properties);
                }
                description bindingDescription = new description();
                bindingDescription.lang     = (bindingLang);
                bindingDescription.Value    = (TokenResolver.replaceTokens(uddiServiceBinding.description, properties));
                bindingTemplate.description = new description[] { (bindingDescription) };

                accessPoint accessPoint = new accessPoint();
                accessPoint.useType = (AccessPointType.wsdlDeployment.ToString());
                if (!"".Equals(uddiServiceBinding.accessPointType))
                {
                    accessPoint.useType = (uddiServiceBinding.accessPointType);
                }
                if (!"".Equals(uddiServiceBinding.accessPoint))
                {
                    String endPoint = uddiServiceBinding.accessPoint;
                    endPoint = TokenResolver.replaceTokens(endPoint, properties);
                    log.debug("AccessPoint EndPoint=" + endPoint);
                    accessPoint.Value = (endPoint);
                }
                else if (webServiceAnnotation != null && webServiceAnnotation.Location != null)
                {
                    accessPoint.Value = (webServiceAnnotation.Location);
                }
                bindingTemplate.Item = (accessPoint);

                //tModelKeys on the binding
                if (!"".Equals(uddiServiceBinding.tModelKeys))
                {
                    String[] tModelKeys = uddiServiceBinding.tModelKeys.Split(',');
                    foreach (String tModelKey in tModelKeys)
                    {
                        tModelInstanceInfo instanceInfo = new tModelInstanceInfo();
                        instanceInfo.tModelKey = (tModelKey);
                        if (bindingTemplate.tModelInstanceDetails == null)
                        {
                            bindingTemplate.tModelInstanceDetails = (new tModelInstanceInfo[] { instanceInfo });
                        }
                        List <tModelInstanceInfo> l = new List <tModelInstanceInfo>();
                        l.AddRange(bindingTemplate.tModelInstanceDetails);
                        l.Add(instanceInfo);
                        bindingTemplate.tModelInstanceDetails = l.ToArray();
                    }
                }
                //categoryBag on the binding
                if (!"".Equals(uddiServiceBinding.categoryBag))
                {
                    categoryBag categoryBag = parseCategoryBag(uddiServiceBinding.categoryBag);
                    bindingTemplate.categoryBag = (categoryBag);
                }
            }
            else
            {
                log.error("Missing UDDIServiceBinding annotation in class " + classWithAnnotations);
            }
            return(bindingTemplate);
        }