class HmsNodeRateLimiterFilter implements ContainerRequestFilter, ContainerResponseFilter {

    public String extractNodeIdFromURI( String requestURI, EventComponent component )
    {

        if ( requestURI != null && component != null )
        {
            String subStringContainingNodeId = null;

            if ( EventComponent.SWITCH.equals( component ) )
            {
                subStringContainingNodeId = StringUtils.substringAfter( requestURI, "/switches/" );
            }
            else if ( EventComponent.SERVER.equals( component ) )
            {
                subStringContainingNodeId = StringUtils.substringAfter( requestURI, "/host/" );
            }
            else
            {
                logger.debug( "Component not supported while extracting nodeId from Request URI: {} ", requestURI );
                return null;
            }

            if ( subStringContainingNodeId != null && subStringContainingNodeId.length() != 0 )
            {
                return extractNodeId( subStringContainingNodeId );
            }
        }

        return null;
    }

}