Custom Resource
com\esri\adf\sample\resource\MyCustomTocFunctionality.java
/* Copyright 2010 ESRI
* 
* All rights reserved under the copyright laws of the United States
* and applicable international laws, treaties, and conventions.
* 
* You may freely redistribute and use this sample code, with or
* without modification, provided you include the original copyright
* notice and use restrictions.
* 
* See the use restrictions.
* 
*/
package com.esri.adf.sample.resource;

import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.esri.adf.web.data.GISResource;
import com.esri.adf.web.data.TocFunctionality;
import com.esri.adf.web.data.TocNode;

public class MyCustomTocFunctionality implements TocFunctionality, Serializable {
  private static final long serialVersionUID = 1L;

  private static Logger logger = Logger.getLogger(MyCustomTocFunctionality.class.getName());

  private MyCustomResource resource = null;

  public void initFunctionality(GISResource resource) {
    logger.log(Level.FINE, "MyCustomTocFunctionality.initFunctionality(" + resource + ")");
    if (resource == null) {
      throw new ADFMyCustomException("Resource is null");
    }
    if (!(resource instanceof MyCustomResource)) {
      throw new ADFMyCustomException("Resource is not a instance of MyCustomResource");
    }
    this.resource = (MyCustomResource) resource;

  }

  public void destroyFunctionality() {
  }

  public void createTocHierarchy(TocNode parentNode) {
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("MyCustomTocFunctionality.createTocHierarchy(" + parentNode + ")");
    }
  }

  public MyCustomResource getResource() {
    return this.resource;
  }
}