opendap/src/main/java/opendap/dap/DAS.java
private void resolveAlias(Alias alias) throws MalformedAliasException, UnresolvedAliasException
    {

        //Get the crucial stuff out of the Alias
        String name = alias.getClearName();
        String attribute = alias.getAliasedToAttributeFieldAsClearString();

        // Get ready!
        Enumeration e = null;
        currentAlias = alias;

        if (Debug.isSet("DAS")) {
		DAPNode.log.debug("\n\nFound: Alias " + name +
                    "  " + attribute);
	    }

        // Let's go
        // see if we can find an Attribute within that DAS that matches the attribute field
        // in the Alias declartion.

        // The Attribute field MAY NOT be empty.
        if (attribute.equals("")) {
            throw new MalformedAliasException("The attribute 'attribute' in the Alias " +
                    "element must have a value other than an empty string.");
        }


        if (Debug.isSet("DAS")) {
		DAPNode.log.debug("Attribute: `" + attribute + "'");
	    }

        // Tokenize the attribute field.

        Vector aNames = opendap.dap.DDS.tokenizeAliasField(attribute);

        if (Debug.isSet("DAS")) {
	    DAPNode.log.debug("Attribute name tokenized to " + aNames.size() + " elements");
            e = aNames.elements();
            while (e.hasMoreElements()) {
                String aname = (String) e.nextElement();
                DAPNode.log.debug("name: " + aname);
            }
        }


        opendap.dap.Attribute targetAT = null;

        // Absolute paths for attributes names must start with the dot character.
        boolean isAbsolutePath = aNames.get(0).equals(".");

        if (isAbsolutePath) { //Is it an absolute path?

            if (aNames.size() == 1) {
                throw new MalformedAliasException("Aliases must reference an Attribute. " +
                        "An attribute field of dot (.) references the entire " +
                        "DAS, which is not allowed.");
            } else {
                // Dump the dot from the vector of tokens and go try to find
                // the Attribute in the DAS.
                aNames.remove(0);

                targetAT = getAliasAttribute(this, aNames);
            }
        } else {
            throw new MalformedAliasException("In the Alias '" + name + "'" +
                    " the attribute 'attribute' does not begin with the character dot (.). " +
                    "The 'attribute' field must always be an absoulute path name from the " +
                    "top level of the dataset, and thus must always begin with the dot (.) character.");
        }

        alias.setMyAttribute(targetAT);

    }
private void resolveAlias(Alias alias) throws MalformedAliasException, UnresolvedAliasException
    {

        //Get the crucial stuff out of the Alias
        String name = alias.getClearName();
        String attribute = alias.getAliasedToAttributeFieldAsClearString();

        // Get ready!
        Enumeration e = null;
        currentAlias = alias;

        if (Debug.isSet("DAS")) {
		DAPNode.log.debug("\n\nFound: Alias " + name +
                    "  " + attribute);
	    }

        // Let's go
        // see if we can find an Attribute within that DAS that matches the attribute field
        // in the Alias declartion.

        // The Attribute field MAY NOT be empty.
        if (attribute.equals("")) {
            throw new MalformedAliasException("The attribute 'attribute' in the Alias " +
                    "element must have a value other than an empty string.");
        }


        if (Debug.isSet("DAS")) {
		DAPNode.log.debug("Attribute: `" + attribute + "'");
	    }

        // Tokenize the attribute field.

        Vector aNames = opendap.dap.DDS.tokenizeAliasField(attribute);

        if (Debug.isSet("DAS")) {
	    DAPNode.log.debug("Attribute name tokenized to " + aNames.size() + " elements");
            e = aNames.elements();
            while (e.hasMoreElements()) {
                String aname = (String) e.nextElement();
                DAPNode.log.debug("name: " + aname);
            }
        }


        opendap.dap.Attribute targetAT = null;

        // Absolute paths for attributes names must start with the dot character.
        boolean isAbsolutePath = aNames.get(0).equals(".");

        if (isAbsolutePath) { //Is it an absolute path?

            if (aNames.size() == 1) {
                throw new MalformedAliasException("Aliases must reference an Attribute. " +
                        "An attribute field of dot (.) references the entire " +
                        "DAS, which is not allowed.");
            } else {
                // Dump the dot from the vector of tokens and go try to find
                // the Attribute in the DAS.
                aNames.remove(0);

                targetAT = getAliasAttribute(this, aNames);
            }
        } else {
            throw new MalformedAliasException("In the Alias '" + name + "'" +
                    " the attribute 'attribute' does not begin with the character dot (.). " +
                    "The 'attribute' field must always be an absoulute path name from the " +
                    "top level of the dataset, and thus must always begin with the dot (.) character.");
        }

        alias.setMyAttribute(targetAT);

    }
private void resolveAlias ( Alias alias ) throws MalformedAliasException , UnresolvedAliasException { //Get the crucial stuff out of the Alias
 String name = alias . getClearName ( ) ; String attribute = alias . getAliasedToAttributeFieldAsClearString ( ) ; // Get ready!
 Enumeration e = null ; currentAlias = alias ; if ( Debug . isSet ( "DAS" ) ) { DAPNode . log . debug ( "\n\nFound: Alias " + name + "  " + attribute ) ; } // Let's go
 // see if we can find an Attribute within that DAS that matches the attribute field
 // in the Alias declartion.
 // The Attribute field MAY NOT be empty.
 if ( attribute . equals ( "" ) ) { throw new MalformedAliasException ( "The attribute 'attribute' in the Alias " + "element must have a value other than an empty string." ) ; } if ( Debug . isSet ( "DAS" ) ) { DAPNode . log . debug ( "Attribute: `" + attribute + "'" ) ; } // Tokenize the attribute field.
 Vector aNames = opendap . dap . DDS . tokenizeAliasField ( attribute ) ; if ( Debug . isSet ( "DAS" ) ) { DAPNode . log . debug ( "Attribute name tokenized to " + aNames . size ( ) + " elements" ) ; e = aNames . elements ( ) ; while ( e . hasMoreElements ( ) ) { String aname = ( String ) e . nextElement ( ) ; DAPNode . log . debug ( "name: " + aname ) ; } } opendap . dap . Attribute targetAT = null ; // Absolute paths for attributes names must start with the dot character.
 boolean isAbsolutePath = aNames . get ( 0 ) . equals ( "." ) ; if ( isAbsolutePath ) { //Is it an absolute path?
 if ( aNames . size ( ) == 1 ) { throw new MalformedAliasException ( "Aliases must reference an Attribute. " + "An attribute field of dot (.) references the entire " + "DAS, which is not allowed." ) ; } else { // Dump the dot from the vector of tokens and go try to find
 // the Attribute in the DAS.
 aNames . remove ( 0 ) ; targetAT = getAliasAttribute ( this , aNames ) ; } } else { throw new MalformedAliasException ( "In the Alias '" + name + "'" + " the attribute 'attribute' does not begin with the character dot (.). " + "The 'attribute' field must always be an absoulute path name from the " + "top level of the dataset, and thus must always begin with the dot (.) character." ) ; } alias . setMyAttribute ( targetAT ) ; }
This method attempts to resolve the past Alias to a specific Attribute in the DDS.
It does this by:
<ul>
<li>1) Tokenizing the Alias's variable and attribute fields (see <code>Alias</code>) </li>
<li>2) Evaluating the tokenized fields to determine if the Alias is defined in terms
of a relative or absolute path </li>
<li>3) Searching the DAS or the currentAT (depending on results
of 2) for the target Attribute </li>
<li>4) Setting the Aliases intrnal reference to it's Attribute
</ul>
<p/>
If an Attribute matching the definition of the Alias cannot be located,
an Exception is thrown

@param alias The <code>Alias</code> which needs to be resolved
This method attempts to resolve the past Alias to a specific Attribute in the DDS . It does this by : <ul > <li > 1 ) Tokenizing the Alias s variable and attribute fields ( see <code > Alias< / code > ) < / li > <li > 2 ) Evaluating the tokenized fields to determine if the Alias is defined in terms of a relative or absolute path < / li > <li > 3 ) Searching the DAS or the currentAT ( depending on results of 2 ) for the target Attribute < / li > <li > 4 ) Setting the Aliases intrnal reference to it s Attribute < / ul > <p / > If an Attribute matching the definition of the Alias cannot be located an Exception is thrown