Package net.percederberg.mibble.value

Examples of net.percederberg.mibble.value.ObjectIdentifierValue


    /**
     * Initializes this context by creating all default symbols.
     */
    private void initialize() {
        MibSymbol              symbol;
        ObjectIdentifierValue  oid;

        // Add the ccitt symbol
        oid = new ObjectIdentifierValue(CCITT, 0);
        symbol = new MibValueSymbol(new FileLocation(null, -1, -1),
                                    null,
                                    CCITT,
                                    new ObjectIdentifierType(),
                                    oid);
        oid.setSymbol((MibValueSymbol) symbol);
        symbols.put(CCITT, symbol);

        // Add the iso symbol
        oid = new ObjectIdentifierValue(ISO, 1);
        symbol = new MibValueSymbol(new FileLocation(null, -1, -1),
                                    null,
                                    ISO,
                                    new ObjectIdentifierType(),
                                    oid);
        oid.setSymbol((MibValueSymbol) symbol);
        symbols.put(ISO, symbol);

        // Add the joint-iso-ccitt symbol
        oid = new ObjectIdentifierValue(JOINT_ISO_CCITT, 2);
        symbol = new MibValueSymbol(new FileLocation(null, -1, -1),
                                    null,
                                    JOINT_ISO_CCITT,
                                    new ObjectIdentifierType(),
                                    oid);
        oid.setSymbol((MibValueSymbol) symbol);
        symbols.put(JOINT_ISO_CCITT, symbol);
    }
View Full Code Here


     * not print the encapsulating braces.
     *
     * @param obj            the type or value object
     */
    private void printReferenceEntry(Object obj) {
        ObjectIdentifierValue  oid;

        if (obj instanceof SnmpIndex) {
            if (((SnmpIndex) obj).isImplied()) {
                os.print("IMPLIED ");
            }
            printReferenceEntry(((SnmpIndex) obj).getTypeOrValue());
        } else if (obj instanceof ObjectIdentifierValue) {
            oid = (ObjectIdentifierValue) obj;
            if (oid.getSymbol() != null) {
                os.print(oid.getSymbol().getName());
            } else {
                os.print(oid.toAsn1String());
            }
        } else if (obj instanceof StringValue) {
            os.print(getQuote(obj.toString()));
        } else {
            os.print(obj.toString());
View Full Code Here

        Mib                    mib = symbol.getMib();
        MibSymbol              elementSymbol;
        String                 name;
        MibType                type;
        ObjectIdentifierValue  value;

        elementSymbol = mib.getSymbol(element.getName());
        if (elementSymbol == null) {
            if (element.getName() != null) {
                name = pos + " '" + element.getName() + "'";
            } else {
                name = String.valueOf(pos);
            }
            log.addWarning(symbol.getLocation(),
                           "sequence element " + name + " is undefined " +
                           "in MIB, a default symbol will be created");
            name = element.getName();
            if (name == null) {
                name = symbol.getName() + "." + pos;
            }
            type = new SnmpObjectType(element.getType(),
                                      null,
                                      SnmpAccess.READ_ONLY,
                                      SnmpStatus.CURRENT,
                                      "AUTOMATICALLY CREATED SYMBOL",
                                      null,
                                      new ArrayList(),
                                      null);
            value = (ObjectIdentifierValue) symbol.getValue();
            value = new ObjectIdentifierValue(symbol.getLocation(),
                                              value,
                                              element.getName(),
                                              pos);
            elementSymbol = new MibValueSymbol(symbol.getLocation(),
                                               mib,
View Full Code Here

     *
     * @see #addToTree
     */
    private void addSymbol(TreeModel model, MibSymbol symbol) {
        MibValue               value;
        ObjectIdentifierValue  oid;

        if (symbol instanceof MibValueSymbol) {
            value = ((MibValueSymbol) symbol).getValue();
            if (value instanceof ObjectIdentifierValue) {
                oid = (ObjectIdentifierValue) value;
View Full Code Here

     *
     * @return true if the object identifier has a parent, or
     *         false otherwise
     */
    private boolean hasParent(ObjectIdentifierValue oid) {
        ObjectIdentifierValue  parent = oid.getParent();

        return oid.getSymbol() != null
            && oid.getSymbol().getMib() != null
            && parent != null
            && parent.getSymbol() != null
            && parent.getSymbol().getMib() != null
            && parent.getSymbol().getMib().equals(oid.getSymbol().getMib());
    }
View Full Code Here

                    parent = new ValueReference(getLocation(node),
                                                getContext(),
                                                DefaultContext.JOINT_ISO_CCITT);
                } else if (parent instanceof ObjectIdentifierValue) {
                    try {
                        parent = new ObjectIdentifierValue(
                                        getLocation(node),
                                        (ObjectIdentifierValue) parent,
                                        number.getName(),
                                        value);
                    } catch (MibException e) {
                        log.addError(e.getLocation(), e.getMessage());
                        parent = null;
                    }
                } else {
                    parent = new ObjectIdentifierValue(
                                        getLocation(node),
                                        (ValueReference) parent,
                                        number.getName(),
                                        value);
                }
View Full Code Here

     *
     * @throws MibException if an error was encountered during the
     *             initialization
     */
    public void initialize(MibLoaderLog log) throws MibException {
        ObjectIdentifierValue  oid;

        if (type != null) {
            try {
                type = type.initialize(this, log);
            } catch (MibException e) {
                log.addError(e.getLocation(), e.getMessage());
                type = null;
            }
        }
        if (value != null) {
            try {
                value = value.initialize(log, type);
            } catch (MibException e) {
                log.addError(e.getLocation(), e.getMessage());
                value = null;
            }
        }
        if (type != null && value != null && !type.isCompatible(value)) {
            log.addError(getLocation(),
                         "value is not compatible with type");
        }
        if (value instanceof ObjectIdentifierValue) {
            oid = (ObjectIdentifierValue) value;
            if (oid.getSymbol() == null) {
                oid.setSymbol(this);
            }
        }
    }
View Full Code Here

     * @see net.percederberg.mibble.value.ObjectIdentifierValue
     *
     * @since 2.5
     */
    public MibValueSymbol getParent() {
        ObjectIdentifierValue  oid;

        if (value instanceof ObjectIdentifierValue) {
            oid = ((ObjectIdentifierValue) value).getParent();
            if (oid != null) {
                return oid.getSymbol();
            }
        }
        return null;
    }
View Full Code Here

     * @see net.percederberg.mibble.value.ObjectIdentifierValue
     *
     * @since 2.6
     */
    public MibValueSymbol getChild(int index) {
        ObjectIdentifierValue  oid;

        if (value instanceof ObjectIdentifierValue) {
            oid = ((ObjectIdentifierValue) value).getChild(index);
            if (oid != null) {
                return oid.getSymbol();
            }
        }
        return null;
    }
View Full Code Here

     * @see net.percederberg.mibble.value.ObjectIdentifierValue
     *
     * @since 2.6
     */
    public MibValueSymbol[] getChildren() {
        ObjectIdentifierValue  oid;
        MibValueSymbol         children[];

        if (value instanceof ObjectIdentifierValue) {
            oid = (ObjectIdentifierValue) value;
            children = new MibValueSymbol[oid.getChildCount()];
            for (int i = 0; i < oid.getChildCount(); i++) {
                children[i] = oid.getChild(i).getSymbol();
            }
        } else {
            children = new MibValueSymbol[0];
        }
        return children;
View Full Code Here

TOP

Related Classes of net.percederberg.mibble.value.ObjectIdentifierValue

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.