private VelocityContext initVelocityContext() {
    VelocityContext context = new VelocityContext();
    context.put("username",
        new ParameterResolver() {
          @Override
          protected String getValue() {
            return viewContext.getUsername();
          }
        });
    context.put("viewName",
        new ParameterResolver() {
          @Override
          protected String getValue() {
            return viewContext.getViewName();
          }
        });
    context.put("instanceName",
        new ParameterResolver() {
          @Override
          protected String getValue() {
            return viewContext.getInstanceName();
          }
        });
    context.put("loggedinUser",
            new ParameterResolver() {
              @Override
              protected String getValue() {
                return viewContext.getLoggedinUser();
              }
            });
    return context;
  }
Instantiate and initialize context for parameters processing using Velocity.

@return initialized context instance
ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java