All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.camel.component.dns.DnsComponent Maven / Gradle / Ivy

There is a newer version: 4.8.1
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel.component.dns;

import java.util.Map;

import org.apache.camel.Endpoint;
import org.apache.camel.spi.annotations.Component;
import org.apache.camel.support.DefaultComponent;

/**
 * This is a component for Camel to run DNS queries, using DNSJava.
 * 

* The DNS components creates endpoints of the form:
* dns:///...
* At this point, the DNS component works with these operations:
*

* dns:///ip
*

* This will return the IP address associated with the domain passed in the header dns.domain. *

*

* dns:///lookup This endpoint accepts three parameters. *

    *
  • dns.name: the lookup name. Usually the domain. Mandatory.
  • *
  • dns.type: the type of the lookup. Should match the values of {@see org.xbill.dns.Type}. Optional.
  • *
  • dns.class: the DNS class of the lookup. Should match the values of {@see org.xbill.dns.DClass}. Optional.
  • *
*

*

*

* dns:///dig This endpoint takes a few parameters, most of them optional : *

    *
  • dns.server: the server in particular for the query. If none is given, the default one specified by the OS will be * used.
  • *
  • dns.query: the query itself. Mandatory.
  • *
  • dns.type: the type of the lookup. Should match the values of {@see org.xbill.dns.Type}. Optional.
  • *
  • dns.class: the DNS class of the lookup. Should match the values of {@see org.xbill.dns.DClass}. Optional.
  • *
*

*

*

*

* dns:///wikipedia This endpoint takes one paramter : *

    *
  • term: the search term on wikipedia
  • *
*

*

*/ @Component("dns") public class DnsComponent extends DefaultComponent { public DnsComponent() { } @Override protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception { DnsType type = DnsType.valueOf(remaining); DnsEndpoint endpoint = new DnsEndpoint(uri, this); endpoint.setDnsType(type); setProperties(endpoint, parameters); return endpoint; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy