GSLayerEncoder layerEncoder = null;
if (VERSION.getVersion(GS_VERSION).compareTo(VERSION.UNRECOGNIZED) > 0) {
layerEncoder = new GSLayerEncoder();
} else if (VERSION.getVersion(GS_VERSION).compareTo(VERSION.UNRECOGNIZED) == 0) {
layerEncoder = new GSLayerEncoder21();
}
layerEncoder.setEnabled(true);
layerEncoder.setQueryable(true);
layerEncoder.setAdvertised(true);