1 Reply Latest reply: Dec 21, 2006 3:19 PM by 207512 RSS

    Configuring the JavaScript Filter i SES 10.1.3.1.0

    132543
      Hello

      I configured JavaScriptFilter it's very fine. Below are sample script.
      But I have one problem - where are documentation to functions which I can use inside the scripts.

      Please help

      Best regards
      Tomasz Haase

      Sample script:

      function filter(events)
      {
      for ( i=0; i<events.length; i++ )
      {
      id = events.getTagId();
           if (id == '95001C0001800000') {
                events[i].setTagId('0000000000000001');
           }
      java.lang.System.out.println("Id:"+id );
      }
      return events;
      }
        • 1. Re: Configuring the JavaScript Filter i SES 10.1.3.1.0
          207512
          For 10.1.3.0, I believe there are two well known objects/api:
          - filter (which points to the current filter)
          - context (which points to the filter context)

          context is just a shorthand, since you could get context from cally filter.getContext().

          The methods exposed to a file is in the class SimpleFilter.

          The methods exposed to a context is in the class EdgeExtensionContext.

          This is in the javadoc, and dev guide I think, but here is the snippet:
          /**
          * Returns the configuration parameter information for the edge extension object.
          * @param paramName the name of the parameter. Can not be null!
          * @return the configuration parameter information for the edge extension object. Or null if not found!
          */
          public ConfigParameter getParameter(String paramName);

          /**
          * Return the attribute object bound for the given attribute name.
          * @param attributeName The attribute name. Can not be null!
          * @return The attribute object found that's bound for the given attribute name. Or null if not found!
          */
          public Object getAttribute(String attributeName);

          /**
          * Binds the attribute object to the given attribute name.
          * @param attributeName The name of the attribute. It can not be null.
          * @param attribute The attribute object.
          * <p><font color="red">
          * Note: If either the attributeName or the attribute is null, this method call is a no-op!.
          * </font></p>
          */
          public void setAttribute(String attributeName, Object attribute);

          /**
          * Return the extension context for the extension with the given type and given extension name.
          * @param extName The extension name. It can not be null.
          * @param extType The extension type. The valid values can be found from oracle.edge.common.EdgeExtension.
          * @see oracle.edge.common.EdgeExtension
          * @return The extension context for the extension with the given type and name.
          */
          public EdgeExtensionContext getContext(String extName, int extType);

          /**
          * Return the name of the extension instance. For example, for devices/filters, this is the
          * identifier string assigned to the device/filter during configuration. This can be used for
          * dispatching event from the extension.
          * @return the name of the extension instance.
          */
          public String getName();

          /**
          * Return the version of the extension instance. For example, for devices/filters, this is the
          * version string assigned to the device/filter during configuration.
          *
          * @return the name of the extension instance.
          */
          public String getVersion();

          /**
          * Return the description of the extension instance.
          *
          * @return the name of the extension instance.
          */
          public String getDescription();

          /**
          * Return the name for the current edge server running the extension object.
          * @return the name for the edge server owning the extensin object.
          */
          public String getEdgeServerName();

          /**
          * Return the site name for the current edge server running the extension object.
          * @return the site name for the current edge server running the extension object.
          */
          public String getSiteName();

          /**
          * Dispatch the given event. This method allows the extension instance to request
          * an event being dispatched from its implementation. An extension instance, for example,
          * can request an event to be sent if it's encountered an error condition, for example.
          * @param e The event to be dispatched.
          */
          //public void dispatchEvent(Event e) throws EventDispatchException;

          /**
          * Log an error message to the log for edge server.
          * @param msg the error message.
          */
          public void logError(String msg);

          /**
          * Log an error message and exception stack trace to the log for edge server.
          *
          * @param msg the error message.
          * @param t the exception/error.
          */
          public void logError(String msg, Throwable t);

          /**
          * Log a notification(debugging, e.g.) message to the log for edge server.
          * <p>
          * <font color="red">Note, the log level has to be set to "notify" to view this error in the log.</font>
          * </p>
          * @param msg the notification message.
          */
          public void logNotification(String msg);

          /**
          * Log a warning message to the log for edge server.
          * <p>
          * <font color="red">Note, the log level has to be set to "notify" or "warning" to view this error in the log.</font>
          * </p>
          * @param msg the warning message.
          */
          public void logWarning(String msg);

               /**
               * Log a debug message to the log for edge server with level.
               * <p>
               * <font color="red">Note, the log level has to be set to "notify" or "warning" to view this error in the log.</font>
               * </p>
               * @param msg the warning message.
               */
               public void log(int level, String msg);

          /**
          * Return the path to the directory where edge_home is located at.
          * @return the edge home path
          */
          public String getEdgeHomePath();