// URI used for session, policy, and agent configuration notices
 private void initNotificationURI() {
   if (isActive()) {
     String url = AgentConfiguration.getClientNotificationURL();
     String notificationURI = null;
     if ((url == null) || (url.trim().length() == 0)) {
       url = null;
     }
     if (url != null) {
       try {
         URL notificationURL = new URL(url);
         notificationURI = notificationURL.getPath();
       } catch (MalformedURLException ex) {
         logError(
             "NotificationTaskHandler.initNotificationURI:"
                 + " Invalid Agent Centralized Configuration"
                 + " Notification URL specified: "
                 + url,
             ex);
       }
     }
     if (notificationURI != null) {
       setNotificationURI(notificationURI);
       if (isLogMessageEnabled()) {
         logMessage(
             "NotificationTaskHandler.initNotificationURI:"
                 + "Notifications URI => "
                 + _notificationURI);
       }
     } else {
       logError(
           "NotificationTaskHandler.initNotificationURI:"
               + "Notification URI not set, so disabled due to errors");
       // since no valid url, ensure flags set to false
       setSessionNotificationEnabledFlag(false);
       setPolicyNotificationEnabledFlag(false);
     }
   } else {
     if (isLogMessageEnabled()) {
       logMessage(
           "NotificationTaskHandler.initNotificationURI:" + " Notifications are not enabled");
     }
   }
 }
 private void initSessionNotificationEnabledFlag() {
   boolean flag = AgentConfiguration.isSessionNotificationEnabled();
   setSessionNotificationEnabledFlag(flag);
 }
 private void initPolicyNotificationEnabledFlag() {
   boolean flag = AgentConfiguration.isPolicyNotificationEnabled();
   setPolicyNotificationEnabledFlag(flag);
 }
示例#4
0
  private synchronized void initializeFilter(HttpServletRequest request) throws AgentException {
    if (!isInitialized()) {
      ISystemAccess sysAccess = AmFilterManager.getSystemAccess();
      if (sysAccess != null) {
        String applicationName = null;
        String contextPath = request.getContextPath();

        if (contextPath.trim().length() == 0 || contextPath.trim().equals("/")) {
          applicationName = AgentConfiguration.DEFAULT_WEB_APPLICATION_NAME;
        } else {
          applicationName = contextPath.substring(1);
        }

        setApplicationName(applicationName);

        Map modeMap =
            sysAccess.getConfigurationMap(IFilterConfigurationConstants.CONFIG_FILTER_MODE);
        String modeString = (String) modeMap.get(applicationName);
        AmFilterMode suggestedMode = null;
        if (modeString != null && modeString.trim().length() >= 0) {
          suggestedMode = AmFilterMode.get(modeString);
          if (suggestedMode == null) {
            sysAccess.logWarning(
                "AmAgentFilter: Unknown filter mode for "
                    + applicationName
                    + ". Using configured mode");
          }
          sysAccess.logMessage(
              "AmAgentFilter: mode specified for: "
                  + applicationName
                  + " is: "
                  + modeString
                  + ", instance: "
                  + suggestedMode);
        } else {
          sysAccess.logMessage("AmAgentFilter: no mode specified for " + applicationName);
        }

        AmFilterMode actualMode = verifyFilterMode(suggestedMode, getGlobalFilterMode(sysAccess));

        sysAccess.logMessage(
            "AmAgentFilter: Filter mode for "
                + applicationName
                + " set to: "
                + ((actualMode == null) ? "Configured" : actualMode.toString()));

        setFilterMode(actualMode);

        boolean wsEnabled =
            sysAccess.getConfigurationBoolean(
                IFilterConfigurationConstants.CONFIG_WEBSERVICE_ENABLE_FLAG,
                IFilterConfigurationConstants.DEFAULT_WEBSERVICE_ENABLE_FLAG);
        if (wsEnabled) {
          IWebServiceResponseProcessor wsResponseProcessor = null;
          String wsResponseProcessorImpl =
              sysAccess.getConfiguration(
                  IFilterConfigurationConstants.CONFIG_WEBSERVICE_RESPONSEPROCESSOR_IMPL,
                  AgentConfiguration.getServiceResolver()
                      .getDefaultWebServiceResponseProcessorImpl());
          if (wsResponseProcessorImpl != null && wsResponseProcessorImpl.trim().length() > 0) {
            sysAccess.logMessage(
                "AmAgentFilter: web service response processor=" + wsResponseProcessorImpl);
            try {
              wsResponseProcessor =
                  (IWebServiceResponseProcessor)
                      Class.forName(wsResponseProcessorImpl).newInstance();
            } catch (Exception e) {
              sysAccess.logError(
                  "AmAgentFilter: not able to instantiate " + wsResponseProcessorImpl);
            }

            setWsResponseProcessor(wsResponseProcessor);

          } else {
            throw new AgentException("No WebServiceAuthenticator found");
          }
        }
        markInitialized();
      } else {
        throw new AgentException("AmAgentFilter: Unable to obtain system access");
      }
    }
  }