[SNMP4J] Address type and parse method

Rory Marquis roridge at hotmail.com
Tue Nov 7 13:27:08 CET 2006


This is how I have set up my SNMP Manager application, using enum.

/**
     * Enums for the Transfer Protocol.
     * Contains a text value of itself so that the value can change
     * and the enum can stay the same.
     */
    public enum Protocol {
        UDP("udp"), TCP("tcp");
        private final String text;

        /**
         * Creates a new Protocol enum
         * @param sendType is currently the int enum from the PDU
         */
        Protocol(String newText) {
            text = newText;
        }

        /**
         * Gets the SNMP4J PDU type for an enum
         * @return String representing the text value of this enum
         */
        public String getText() {
            return text;
        }

    }


Is there an SNMP4J official Java 5 release yet?

Rory

>
>Message: 1
>Date: Mon, 6 Nov 2006 14:02:31 +0100
>From: Marco.Bresciani at alcatel.it
>Subject: Re: [SNMP4J] Address type and parse method
>To: snmp4j at agentpp.org
>Message-ID:
>	<OF5680908C.8F036AD8-ONC125721E.00476233-C125721E.0047A472 at netfr.alcatel.fr>
>
>Content-Type: text/plain; charset="US-ASCII"
>
>Thank you,
>   why not something like
>
>enum Type { UDP, TCP, IP };
>
>so that it'll begin the step toJava 5?! ;-)
>
>Ing. Marco Bresciani
>
>--
>Alcatel - WTD R&D SW CC
>Via Trento, 30 - 20059 Vimercate (Mi) Italia
>Phone: +39.039.686.5546
>-----BEGIN GEEK CODE BLOCK-----
>Version: 3.12
>GIT d++ s: a C++ UL++ P+ L+++ E-- W++ N o-- K- w-- O- M- V- PS--
>PE-- Y+ PGP++ t+ 5 X+ R+++ tv+ b++ DI++++ D+ G e+++ h! !r !y+
>------END GEEK CODE BLOCK------
>
>
>
>
>Frank Fock <fock at agentpp.com>
>03/11/2006 23.21
>
>         To:     Marco BRESCIANI/IT/ALCATEL at ALCATEL
>         cc:     snmp4j at agentpp.org
>         Subject:        Re: [SNMP4J] Address type and parse method
>
>
>Hello Marco,
>
>Good point. In version 1.8 the following constants will be part
>of GenericAddress:
>
>    /**
>     * Default address type identifier for an UpdAddress.
>     */
>    public static final String TYPE_UDP = "udp";
>    /**
>     * Default address type identifier for a TcpAddress.
>     */
>    public static final String TYPE_TCP = "tcp";
>    /**
>     * Default address type identifier for an IpAddress.
>     */
>    public static final String TYPE_IP  = "ip";
>
>Best regards,
>Frank
>
>Marco.Bresciani at alcatel.it wrote:
> > Hello,
> >   with respect to this description
> >
>http://www.snmp4j.org/doc/org/snmp4j/smi/GenericAddress.html#parse(java.lang.String)
>
> > ... Does an enum or a set of constants exists in order to have a
>reference
> > to allowed types for address?
> >
> > I found the address.properties file checking inside the JAr file and I
>saw
> > the "udp", "tcp" and "ip" Strings but... there is a reference for
> > programmer? Can I use an enum or final static values? It's not very
> > "polite" to write "udp" hard-coded in the code... :-)
> >
> > Thank you.
> >
> > Ing. Marco Bresciani
> >
>
>--
>AGENT++
>http://www.agentpp.com
>http://www.mibexplorer.com
>http://www.mibdesigner.com
>
>
>
>
>
>------------------------------
>
>_______________________________________________
>SNMP4J mailing list
>SNMP4J at agentpp.org
>http://lists.agentpp.org/mailman/listinfo/snmp4j
>
>
>End of SNMP4J Digest, Vol 34, Issue 5
>*************************************

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters! 
http://www.msn.co.uk/newsletters




More information about the SNMP4J mailing list