Package javax.jmdns.impl

Examples of javax.jmdns.impl.DNSRecord$Address


          }
          List addressList = bp.getAddress();
          addressList.clear();
          if (addressType!=null) {
            for (int i=0;i<addressType.length;i++) {
              Address address=bp.newAddress();
              address.setType(addressType[i]);
              address.setStreet1(addressStreet[i]);
              address.setCityOrLocality(addressCity[i]);
              address.setStateOrProvince(addressState[i]);
              address.setZipOrPostalCode(addressZip[i]);
              address.setEffectiveDate(toDate("EffectiveDate",addressEffective[i]));
              addressList.add(address);
            }
            bp.setAddress(addressList);
          }
          List phoneList = bp.getPhone();
View Full Code Here


    /**
     * Create an instance of {@link Address }
     *
     */
    public Address createAddress() {
        return new Address();
    }
View Full Code Here

            }
            // Now, we remove them.
            long now = System.currentTimeMillis();
            for (Iterator i = list.iterator(); i.hasNext();)
            {
                DNSRecord c = (DNSRecord) i.next();
                if (c.isExpired(now))
                {
                    this.jmDNSImpl.updateRecord(now, c);
                    this.jmDNSImpl.getCache().remove(c);
                }
            }
View Full Code Here

            }
            // Now, we remove them.
            long now = System.currentTimeMillis();
            for (Iterator i = list.iterator(); i.hasNext();)
            {
                DNSRecord c = (DNSRecord) i.next();
                if (c.isExpired(now))
                {
                    this.jmDNSImpl.updateRecord(now, c);
                    this.jmDNSImpl.getCache().remove(c);
                }
            }
View Full Code Here

                            if (type == DNSConstants.TYPE_ANY || type == DNSConstants.TYPE_SRV)
                            { // I ama not sure of why there is a special case here [PJYF Oct 15 2004]
                                if (this.jmDNSImpl.getLocalHost().getName().equalsIgnoreCase(q.getName()))
                                {
                                    // type = DNSConstants.TYPE_A;
                                    DNSRecord answer = this.jmDNSImpl.getLocalHost().getDNS4AddressRecord();
                                    if (answer != null)
                                    {
                                        answers.add(answer);
                                    }
                                    answer = this.jmDNSImpl.getLocalHost().getDNS6AddressRecord();
                                    if (answer != null)
                                    {
                                        answers.add(answer);
                                    }
                                    type = DNSConstants.TYPE_IGNORE;
                                }
                                else
                                {
                                    if (this.jmDNSImpl.getServiceTypes().containsKey(q.getName().toLowerCase()))
                                    {
                                        type = DNSConstants.TYPE_PTR;
                                    }
                                }
                            }

                            switch (type)
                            {
                                case DNSConstants.TYPE_A:
                                    {
                                        // Answer a query for a domain name
                                        //out = addAnswer( in, addr, port, out, host );
                                        DNSRecord answer = this.jmDNSImpl.getLocalHost().getDNS4AddressRecord();
                                        if (answer != null)
                                        {
                                            answers.add(answer);
                                        }
                                        break;
                                    }
                                case DNSConstants.TYPE_AAAA:
                                    {
                                        // Answer a query for a domain name
                                        DNSRecord answer = this.jmDNSImpl.getLocalHost().getDNS6AddressRecord();
                                        if (answer != null)
                                        {
                                            answers.add(answer);
                                        }
                                        break;
                                    }
                                case DNSConstants.TYPE_PTR:
                                    {
                                        // Answer a query for services of a given type

                                        // find matching services
                                        for (Iterator serviceIterator = this.jmDNSImpl.getServices().values().iterator(); serviceIterator.hasNext();)
                                        {
                                            ServiceInfoImpl info = (ServiceInfoImpl) serviceIterator.next();
                                            if (info.getState() == DNSState.ANNOUNCED)
                                            {
                                                if (q.getName().equalsIgnoreCase(info.getType()))
                                                {
                                                    DNSRecord answer = this.jmDNSImpl.getLocalHost().getDNS4AddressRecord();
                                                    if (answer != null)
                                                    {
                                                        answers.add(answer);
                                                    }
                                                    answer = this.jmDNSImpl.getLocalHost().getDNS6AddressRecord();
                                                    if (answer != null)
                                                    {
                                                        answers.add(answer);
                                                    }
                                                    answers.add(new DNSRecord.Pointer(info.getType(), DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, info.getQualifiedName()));
                                                    answers.add(new DNSRecord.Service(info.getQualifiedName(), DNSConstants.TYPE_SRV, DNSConstants.CLASS_IN | DNSConstants.CLASS_UNIQUE, DNSConstants.DNS_TTL,
                                                            info.getPriority(), info.getWeight(), info.getPort(), this.jmDNSImpl.getLocalHost().getName()));
                                                    answers.add(new DNSRecord.Text(info.getQualifiedName(), DNSConstants.TYPE_TXT, DNSConstants.CLASS_IN | DNSConstants.CLASS_UNIQUE, DNSConstants.DNS_TTL,
                                                            info.getText()));
                                                }
                                            }
                                        }
                                        if (q.getName().equalsIgnoreCase("_services" + DNSConstants.DNS_META_QUERY + "local."))
                                        {
                                            for (Iterator serviceTypeIterator = this.jmDNSImpl.getServiceTypes().values().iterator(); serviceTypeIterator.hasNext();)
                                            {
                                                answers.add(new DNSRecord.Pointer("_services" + DNSConstants.DNS_META_QUERY + "local.", DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, (String) serviceTypeIterator.next()));
                                            }
                                        }
                                        break;
                                    }
                                case DNSConstants.TYPE_SRV:
                                case DNSConstants.TYPE_ANY:
                                case DNSConstants.TYPE_TXT:
                                    {
                                        ServiceInfoImpl info = (ServiceInfoImpl) this.jmDNSImpl.getServices().get(q.getName().toLowerCase());
                                        if (info != null && info.getState() == DNSState.ANNOUNCED)
                                        {
                                            DNSRecord answer = this.jmDNSImpl.getLocalHost().getDNS4AddressRecord();
                                            if (answer != null)
                                            {
                                                answers.add(answer);
                                            }
                                            answer = this.jmDNSImpl.getLocalHost().getDNS6AddressRecord();
                                            if (answer != null)
                                            {
                                                answers.add(answer);
                                            }
                                            answers.add(new DNSRecord.Pointer(info.getType(), DNSConstants.TYPE_PTR, DNSConstants.CLASS_IN, DNSConstants.DNS_TTL, info.getQualifiedName()));
                                            answers.add(new DNSRecord.Service(info.getQualifiedName(), DNSConstants.TYPE_SRV, DNSConstants.CLASS_IN | DNSConstants.CLASS_UNIQUE, DNSConstants.DNS_TTL,
                                                    info.getPriority(), info.getWeight(), info.getPort(), this.jmDNSImpl.getLocalHost().getName()));
                                            answers.add(new DNSRecord.Text(info.getQualifiedName(), DNSConstants.TYPE_TXT, DNSConstants.CLASS_IN | DNSConstants.CLASS_UNIQUE, DNSConstants.DNS_TTL, info.getText()));
                                        }
                                        break;
                                    }
                                default :
                                    {
                                        //System.out.println("JmDNSResponder.unhandled query:"+q);
                                        break;
                                    }
                            }
                        }
                    }


                    // remove known answers, if the ttl is at least half of
                    // the correct value. (See Draft Cheshire chapter 7.1.).
                    for (Iterator i = in.getAnswers().iterator(); i.hasNext();)
                    {
                        DNSRecord knownAnswer = (DNSRecord) i.next();
                        if (knownAnswer.getTtl() > DNSConstants.DNS_TTL / 2 && answers.remove(knownAnswer))
                        {
//                            logger.log(Level.FINER, "JmDNS Responder Known Answer Removed");
                        }
                    }
View Full Code Here

        assertEquals( "Wrong array size", 4, root.size() );

        // note that the array is in popped order (rather than pushed)

        Address add = root.get( 0 );
        Address addressOne = add;
        assertEquals( "(1) Street attribute", "New Street", addressOne.getStreet() );
        assertEquals( "(1) City attribute", "Las Vegas", addressOne.getCity() );
        assertEquals( "(1) State attribute", "Nevada", addressOne.getState() );

        add = root.get( 1 );
        Address addressTwo = add;
        assertEquals( "(2) Street attribute", "Old Street", addressTwo.getStreet() );
        assertEquals( "(2) City attribute", "Portland", addressTwo.getCity() );
        assertEquals( "(2) State attribute", "Oregon", addressTwo.getState() );

        add = root.get( 2 );
        Address addressThree = add;
        assertEquals( "(3) Street attribute", "4th Street", addressThree.getStreet() );
        assertEquals( "(3) City attribute", "Dayton", addressThree.getCity() );
        assertEquals( "(3) State attribute", "US", addressThree.getState() );

        add = root.get( 3 );
        Address addressFour = add;
        assertEquals( "(4) Street attribute", "6th Street", addressFour.getStreet() );
        assertEquals( "(4) City attribute", "Cleveland", addressFour.getCity() );
        assertEquals( "(4) State attribute", "Ohio", addressFour.getState() );
    }
View Full Code Here

 
    /**
     * Get UDDI Address given JAXR Postal Address
     */
  public static Address getAddress(PostalAddress postalAddress) throws JAXRException {
    Address address = objectFactory.createAddress();

    AddressLine[] addarr = new AddressLine[6];

        String stnum = postalAddress.getStreetNumber();
        String st = postalAddress.getStreet();
        String city = postalAddress.getCity();
        String country = postalAddress.getCountry();
        String code = postalAddress.getPostalCode();
        String state = postalAddress.getStateOrProvince();

    AddressLine stnumAL = objectFactory.createAddressLine();
        stnumAL.setKeyName("STREET_NUMBER");
    if (stnum != null) {
        stnumAL.setKeyValue(stnum);
    }

    AddressLine stAL = objectFactory.createAddressLine();
        stAL.setKeyName("STREET");
    if (st != null) {
        stAL.setKeyValue(st);
    }

    AddressLine cityAL = objectFactory.createAddressLine();
        cityAL.setKeyName("CITY");
    if (city != null) {
        cityAL.setKeyValue(city);
    }

    AddressLine countryAL = objectFactory.createAddressLine();
        countryAL.setKeyName("COUNTRY");
    if (country != null) {
        countryAL.setKeyValue(country);
    }

    AddressLine codeAL = objectFactory.createAddressLine();
        codeAL.setKeyName("POSTALCODE");
    if (code != null) {
        codeAL.setKeyValue(code);
    }

    AddressLine stateAL = objectFactory.createAddressLine();
        stateAL.setKeyName("STATE");
    if (state != null) {
        stateAL.setKeyValue(state);
    }

    // Add the AddressLine to vector
    addarr[0] = stnumAL;
    addarr[1] = stAL;
    addarr[2] = cityAL;
    addarr[3] = countryAL;
    addarr[4] = codeAL;
    addarr[5] = stateAL;

    address.getAddressLine().addAll(Arrays.asList(addarr));

        return address;
    }
View Full Code Here

 
    /**
     * Get UDDI Address given JAXR Postal Address
     */
  public static Address getAddress(PostalAddress postalAddress) throws JAXRException {
    Address address = objectFactory.createAddress();

    AddressLine[] addarr = new AddressLine[6];

        String stnum = postalAddress.getStreetNumber();
        String st = postalAddress.getStreet();
        String city = postalAddress.getCity();
        String country = postalAddress.getCountry();
        String code = postalAddress.getPostalCode();
        String state = postalAddress.getStateOrProvince();

    AddressLine stnumAL = objectFactory.createAddressLine();
        stnumAL.setKeyName("STREET_NUMBER");
    if (stnum != null) {
        stnumAL.setKeyValue(stnum);
    }

    AddressLine stAL = objectFactory.createAddressLine();
        stAL.setKeyName("STREET");
    if (st != null) {
        stAL.setKeyValue(st);
    }

    AddressLine cityAL = objectFactory.createAddressLine();
        cityAL.setKeyName("CITY");
    if (city != null) {
        cityAL.setKeyValue(city);
    }

    AddressLine countryAL = objectFactory.createAddressLine();
        countryAL.setKeyName("COUNTRY");
    if (country != null) {
        countryAL.setKeyValue(country);
    }

    AddressLine codeAL = objectFactory.createAddressLine();
        codeAL.setKeyName("POSTALCODE");
    if (code != null) {
        codeAL.setKeyValue(code);
    }

    AddressLine stateAL = objectFactory.createAddressLine();
        stateAL.setKeyName("STATE");
    if (state != null) {
        stateAL.setKeyValue(state);
    }

    // Add the AddressLine to vector
    addarr[0] = stnumAL;
    addarr[1] = stAL;
    addarr[2] = cityAL;
    addarr[3] = countryAL;
    addarr[4] = codeAL;
    addarr[5] = stateAL;

    address.getAddressLine().addAll(Arrays.asList(addarr));

        return address;
    }
View Full Code Here

                List<Address> r = new ArrayList<Address>();
                if (address == null) {
                        return r;
                }
                for (int i = 0; i < address.size(); i++) {
                        Address x = new Address();
                        x.setSortCode(address.get(i).getSortCode());
                        x.setTModelKey(address.get(i).getTModelKey());
                        x.setUseType(address.get(i).getUseType());
                        x.getAddressLine().addAll(MapAddressLine(address.get(i).getAddressLine()));
                        r.add(x);
                }
                return r;
        }
View Full Code Here

    addressLineThree.setKeyName("zip");
    addressLineThree.setKeyValue("zip");
    addressLineThree.setValue(data.getZip(5));
   
    //One address for the contact. Can be more but only one here.
    Address address = new Address();
    address.setLang("en");
    address.setSortCode("1");
    address.setTModelKey("uddi:tmodelKey:address");
    address.setUseType("HQ");
    address.getAddressLine().add(addressLineOne);
    address.getAddressLine().add(addressLineTwo);
    address.getAddressLine().add(addressLineThree);
   
    //Contacts phone number details
    Phone phone = new Phone();
    phone.setUseType("Hotline");
    phone.setValue(data.getUSPhoneNumber());
View Full Code Here

TOP

Related Classes of javax.jmdns.impl.DNSRecord$Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.