Beispiel #1
0
        public static void init()
        {
            if (Environment.GetEnvironmentVariable("debug") != null
                && Environment.GetEnvironmentVariable("debug").Equals("true", StringComparison.CurrentCultureIgnoreCase))
            {
                serialize = true;
            }

            clerkManager = new UDDIClient("resource/uddi.xml");

            transport = clerkManager.getTransport("default");

            security = transport.getUDDISecurityService();
            inquiry = transport.getUDDIInquiryService();
            publish = transport.getUDDIPublishService();
            sub = transport.getUDDISubscriptionService();
            clerk = clerkManager.getClerk("default");
            node = clerk.getUDDINode();
            WebClient c = new WebClient();

            Console.Out.WriteLine("Checking to see if tomcat is running");
            String s = null;
            int count = 100;
            while (s == null && count > 0)
            {
                try
                {
                    s = c.DownloadString("http://localhost:8080/");
                    Console.Out.WriteLine("Tomcat is running");
                    break;
                }
                catch
                { }
                Console.Out.WriteLine("tomcat isn't running yet, waiting...");
                Thread.Sleep(1000);
            }

            if (s == null)
            {
                Console.Out.WriteLine("Unable to confirm if tomcat is running, aborting");
                online = false;
            }
        }
Beispiel #2
0
        /// <summary>
        ///  This calls a jUDDI implementation specific API call and is used to help 
        /// configure internode communication between jUDDI servers. This is NOT 
        /// part of the UDDI specification. Note: this API call should only
        /// be used with secure ports (SSL/TLS)
        /// </summary>
        /// <param name="senderClerk"></param>
        /// <returns></returns>
        public clerk[] saveClerk(UDDIClerk senderClerk)
        {
            clerk[] clerkDetail = null;
            try
            {
                log.debug("Sending Clerk " + senderClerk.getName() + " info to jUDDI " + getUDDINode().getName());
                save_clerk saveClerk = new save_clerk();
                saveClerk.authInfo = (getAuthToken(senderClerk.getUDDINode().getSecurityUrl()));
                saveClerk.clerk = new clerk[] { (getApiClerk()) };
                clerkDetail = getUDDINode().getTransport().getJUDDIApiService(senderClerk.getUDDINode().getJuddiApiUrl()).save_Clerk(saveClerk);
            }
            catch (Exception e)
            {
                log.error("Unable to save clerk " + getName()
                        + " ." + e.Message, e);
            }

            return clerkDetail;
        }
Beispiel #3
0
        private Dictionary<String, UDDIClerk> readClerkConfig(uddi config, Dictionary<String, UDDINode> uddiNodes)
        {
            clientName = config.client.name;
            Dictionary<String, UDDIClerk> clerks = new Dictionary<String, UDDIClerk>();
            if (config.client.clerks != null && config.client.clerks.clerk != null && config.client.clerks.clerk.Length > 0)//.ContainsKey("client.clerks.clerk[@name]"))
            {

                log.debug("clerk names=" + config.client.clerks.clerk.Length);
                for (int i = 0; i < config.client.clerks.clerk.Length; i++)
                {
                    UDDIClerk uddiClerk = new UDDIClerk();
                    uddiClerk.setManagerName(clientName);
                    uddiClerk.setName(config.client.clerks.clerk[i].name);
                    String nodeRef = config.client.clerks.clerk[i].node;
                    if (!uddiNodes.ContainsKey(nodeRef)) throw new ConfigurationErrorsException("Could not find Node with name=" + nodeRef);
                    UDDINode uddiNode = uddiNodes[nodeRef];
                    uddiClerk.setUDDInode(uddiNode);
                    uddiClerk.setPublisher(config.client.clerks.clerk[i].publisher);
                    uddiClerk.setPassword(config.client.clerks.clerk[i].password);
                    uddiClerk.setPasswordEncrypted(config.client.clerks.clerk[i].isPasswordEncrypted);
                    uddiClerk.setCryptoProvider(config.client.clerks.clerk[i].cryptoProvider);

                    String clerkBusinessKey = config.client.clerks.clerk[i].businessKey;
                    String clerkBusinessName = config.client.clerks.clerk[i].businessName;
                    String clerkKeyDomain = config.client.clerks.clerk[i].keyDomain;

                    String[] classes = config.client.clerks.clerk[i].@class;
                    uddiClerk.setClassWithAnnotations(classes);

                    int numberOfWslds = 0;
                    if (config.client.clerks.clerk[i].wsdl != null)
                        numberOfWslds = config.client.clerks.clerk[i].wsdl.Length;// config.getStringArray("client.clerks.clerk(" + i + ").wsdl").Length;
                    if (numberOfWslds > 0)
                    {
                        UDDIClerk.WSDL[] wsdls = new UDDIClerk.WSDL[numberOfWslds];
                        for (int w = 0; w < wsdls.Length; w++)
                        {
                            UDDIClerk.WSDL wsdl = new UDDIClerk.WSDL();
                            String fileName = config.client.clerks.clerk[i].wsdl[w].Value;
                            wsdl.setFileName(null);
                            String businessKey = config.client.clerks.clerk[i].wsdl[w].businessKey;
                            String businessName = config.client.clerks.clerk[i].wsdl[w].businessName;
                            String keyDomain = config.client.clerks.clerk[i].wsdl[w].keyDomain;
                            if (businessKey == null) businessKey = clerkBusinessKey;
                            if (businessKey == null) businessKey = uddiClerk.getUDDINode().getProperties().getString("businessKey");
                            if (businessKey == null)
                            {
                                //use key convention to build the businessKey
                                if (businessName == null) businessName = clerkBusinessName;
                                if (keyDomain == null) keyDomain = clerkKeyDomain;
                                if (keyDomain == null) keyDomain = uddiClerk.getUDDINode().getProperties().getString("keyDomain");
                                if ((businessName == null && !uddiClerk.getUDDINode().getProperties().containsKey("businessName"))
                                    || keyDomain == null && !uddiClerk.getUDDINode().getProperties().containsKey("keyDomain")) throw new ConfigurationErrorsException("Either the wsdl(" + wsdls[w]
                                         + ") or clerk (" + uddiClerk.getName() + ") elements require a businessKey, or businessName & keyDomain attributes");
                                else
                                {
                                    Properties properties = (uddiClerk.getUDDINode().getProperties());
                                    if (businessName != null) properties.setProperty("businessName", businessName);
                                    if (keyDomain != null) properties.setProperty("keyDomain", keyDomain);
                                    businessKey = UDDIKeyConvention.getBusinessKey(properties);
                                }
                            }
                            if (!businessKey.ToLower().StartsWith("uddi:") || !businessKey.Substring(5).Contains(":"))
                            {
                                throw new ConfigurationErrorsException("The businessKey " + businessKey + " does not implement a valid UDDI v3 key format.");
                            }
                            wsdl.setBusinessKey(businessKey);
                            if (keyDomain == null)
                            {
                                keyDomain = businessKey.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1];
                            }
                            wsdl.setKeyDomain(keyDomain);
                            wsdls[w] = wsdl;
                        }
                        uddiClerk.setWsdls(wsdls);
                    }

                    clerks.Add(uddiClerk.getName(), uddiClerk);
                }
            }
            else
                log.warn("No clerks are defined!");
            return clerks;
        }