Working with the Local CMS Processor File

If you want to use your own CMS, you have to get your data from your CMS to the system, and then convert the data to a SAS format.

  1. The following localcmsprocessor.java file is included in the doc folder of the Access Point SDK. You can use the file as a template to create your own file.
    package com.sas.mkt.apigw.sdk.streaming.agent.listener.thirdparty;
    
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    
    import org.slf4j.Logger;
    import org.slf4j.LoggerFactory;
    
    import com.sas.mkt.apigw.sdk.streaming.agent.cms.CMSInterface;
    
    /**
     * @author <userid>
     */
    public class LocalCmsProcessor implements CMSInterface {
       private final static Logger logger = 
          LoggerFactory.getLogger(LocalCmsProcessor.class);
          
       public LocalCmsProcessor () {
          // blank constructor
       }
    
       @Override
       public String getDataFromCMS(String path, String queryParam) {
          String cmsJson = null;
          String urlValue = "http://localhost:8083/content/media";
          
          if(path != null) {
             urlValue +="&path="+path;
          }
          if(queryParam != null) {
             urlValue +="&q="+queryParam;
          }
          try {
             URL url = new URL(urlValue);
             HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
             urlc.setDoOutput(true);
             urlc.setRequestMethod("GET");
             urlc.setAllowUserInteraction(false);
             
             StringBuffer sb = new StringBuffer();
             BufferedReader br = 
                new BufferedReader(new InputStreamReader(urlc.getInputStream()));
             String l = null;
             while ((l=br.readLine())!=null) {
                 sb.append(l);
             }
             br.close();
             cmsJson = sb.toString();
          } catch (MalformedURLException e) {
             // Auto-generated catch block
             e.printStackTrace();
          } catch (IOException e) {
          	// Auto-generated catch block
          	e.printStackTrace();
          }
          return cmsJson;
    	}
       
       @Override
       public String convertDataToSAS360(String json) {
          return json;
       }
    }
  2. For each asset, you should create a SAS format file. The format file is similar to this example):
    id: null,
    path: null,
    name: "bear",
    lastModifiedDate: null,
    action: null,
    originalURL: "<data data-context-url="http://myHost.com:8181/mycms/
      content/bear.html"></data>",
    width: 440,
    height: 400,
    size: 0,
    type: html,
    thumbnailURL: "http://myHost.com:8181/mycms/images/thumbnail/bear.jpg",
    previewURL: "http://myHost.com:8181/mycms/images/preview/bear.jpg",
    folder: false
    
    Note: The example is for an HTML asset, so the type attribute is set to html.

    Set the type attribute to one of these values:

    • html or htm
    • jpeg or jpg
    • png
    • tiff or tif
    • bmp
    • gif
    • wpg
    • svg
    • pcx
    • x-pcx
    • psd
    • dng
  3. Compile the file and add it to the JAR file in the libThirdParty folder in the Access Point SDK.
Last updated: August 11, 2026