Custom Resource
com\esri\adf\sample\resource\MyCustomResource.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 com.esri.adf.web.data.GISResource;
import com.esri.adf.web.data.WebContext;
import com.esri.adf.web.data.geometry.WebSpatialReference;

public class MyCustomResource extends GISResource {
  private static final long serialVersionUID = 1L;

  public static final String ALIAS = "MyCustomResource";

  private String generatedAlias = null;

  protected WebSpatialReference spatialReference = null;

  @Override
  public void init(WebContext wcontext) {
    generatedAlias = ALIAS;
    if (this.spatialReference != null) {
      this.defaultSpatialReference = this.spatialReference;
    }
    super.init(wcontext);
  }

  @Override
  public String getAlias() {
    return this.alias != null ? alias : generatedAlias;
  }

  public void setDefaultSpatialReference(WebSpatialReference spatialReference) {
    this.spatialReference = spatialReference;
    if (this.spatialReference != null) {
      this.defaultSpatialReference = this.spatialReference;
    }
  }
}