Artifact artifact = resource.getArtifact( m_type ); String group = artifact.getGroup(); String name = artifact.getName(); try
Type type = resource.getType( m_type ); if( type.getAlias() )
    protected String resolve()    {        if( null == m_feature )        {            final String error = "Missing 'feature' attribute.";            throw new BuildException( error );        }        else        {            log( "Processing feature: " + m_feature, Project.MSG_VERBOSE );        }                String ref = getRef();        Resource resource = getResource( ref );                if( null != m_type && !resource.isa( m_type ) )        {            final String error =               "The feature request for the type ["               + m_type               + "] from the resource ["              + resource               + "] cannot be fullfilled because the resource does not declare "              + "production of the requested type.";            throw new BuildException( error, getLocation() );        }        if( m_feature.equals( "name" ) )        {            return resource.getName();        }        else if( m_feature.equals( "group" ) )        {            return resource.getParent().getResourcePath();        }        else if( m_feature.equals( "version" ) )        {            String version = resource.getVersion();            if( null == version )            {                return "";            }            else            {                return version;            }        }        else if( m_feature.equals( "uri" ) )        {            if( null == m_type )            {                final String error =                   "Type attribute must be supplied in conjuction with the uri attribute.";                throw new BuildException( error, getLocation() );            }            else            {                if( m_alias )                {                    Artifact artifact = resource.getArtifact( m_type );                    String group = artifact.getGroup();                    String name = artifact.getName();                    try                    {                        return "link:" + m_type + ":" + group + "/" + name;                    }                    catch( Exception e )                    {                        final String error =                           "Unable to resolve link uri for resource: " + resource;                        throw new BuildException( error, e, getLocation() );                    }                }                else                {                    Artifact artifact = resource.getArtifact( m_type );                    return artifact.toURI().toString();                }            }        }        else if( m_feature.equals( "spec" ) )        {            String path = resource.getResourcePath();            String version = resource.getVersion();            if( null == version )            {                return path;            }            else            {                return path + "#" + version;            }        }        else if( m_feature.equals( "path" ) )        {            if( null == m_type )            {                final String error =                   "Type attribute must be supplied in conjuction with the uri attribute.";                throw new BuildException( error, getLocation() );            }            else            {                Artifact artifact = resource.getArtifact( m_type );                try                {                    File cached =                       (File) artifact.toURL().getContent( new Class[]{File.class} );                    return cached.getCanonicalPath();                }                catch( Exception e )                {                    final String error =                       "Unable to resolve resource path.";                    throw new BuildException( error, e, getLocation() );                }            }        }        else if( m_feature.equals( "filename" ) )        {            if( null == m_type )            {                final String error =                   "Type attribute must be supplied in conjuction with the filename attribute.";                throw new BuildException( error, getLocation() );            }            return getContext().getLayoutPath( m_type );        }        else        {            return resource.getProperty( m_feature );        }    }