Implementing a Data Change Notification Filter

Write and deploy preprocess and postprocess DCN filters to Unwired Server.

When specifying filters, add a dcn_filter parameter to the base URL, and to the parameters specified in the DCN request section. The dcn_filter parameter specifies the fully qualified name of the filter class, which must be in a valid CLASSPATH location so Unwired Server can locate it using its fully qualified name. If the filter class is in an Unwired Platform root folder, it is automatically propagated across a cluster.

JSON requires colons to define the object structure, but since colons have a special function in HTTP URLs, use the tilda character "~" instead of colons ":" when implementing the DCN filter, so the JSON dcn_request string can be passed as an HTTP GET or POST parameter:
dcn_request={"pkg"~“TestPackage",
	"messages"~[{"id"~"1","mbo"~"Department","op"~"~upsert",
	"cols"~{"DepartmentID"~"3333",
          "DepartmentName"~“My Department",
		     "DepartmentHeadID"~"501"}}]}

The dcn_request is in a format that is specific to the back end. The filter class can preprocess to the JSON format expected by Unwired Server.

  1. Write the filter. For example:
    import java.util.map;
    import com.onepage.fw.uwp.shared.uwp.UWPLogger;
    import com.sybase.sup.dcn.DCNFilter;
    
    public class CustomDCNFilter implements DCNFilter
    {
      String preprocess(String blobDCNRequest, Map<String,String> headers) {
    	 	String result = blobDCNRequest.replace(‘~’,’:’);
    	 	return result;
      }
    
      String postprocess(String jsonDCNResult, Map<String,String> responseHeaders) {
    	 	String result = jsonDCNResult.replace(‘:’,’~’);
    	 	return result;
      }
    	
    	public static void main( String[] args ) { }
    }
    
  2. Shut down Unwired Server and deploy the DCN filter:
    1. Package your DCN filter class in a JAR file.
    2. Copy the JAR file to Sybase\UnwiredPlatform_installation_directory\Servers\UnwiredServer\lib.
      Note: The JAR file will not be propagated automatically across cluster nodes. You must stop the node to which you want to propagate the JAR file, then copy the JAR file manually.
  3. Restart Unwired Server.