    protected Layer doInBackground(ProgressMonitor pm) throws Exception {
        try {
            pm.beginTask("Reading shapes", ProgressMonitor.UNKNOWN);
            final ProductSceneView sceneView = context.getAppContext().getSelectedProductSceneView();
            CoordinateReferenceSystem targetCrs = (CoordinateReferenceSystem) context.getLayerContext().getCoordinateReferenceSystem();
            final Geometry clipGeometry = ShapefileUtils.createGeoBoundaryPolygon(sceneView.getRaster());
            File file = new File((String) context.getPropertyValue(ShapefileLayerSource.PROPERTY_NAME_FILE_PATH));
            Object featureCollectionValue = context.getPropertyValue(ShapefileLayerSource.PROPERTY_NAME_FEATURE_COLLECTION);
            FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection;
            if (featureCollectionValue == null) {
                featureCollection = ShapefileUtils.createFeatureCollection(file.toURI().toURL(), targetCrs, clipGeometry);
            } else {
                featureCollection = (FeatureCollection<SimpleFeatureType, SimpleFeature>) featureCollectionValue;
            }
            Style[] styles = getStyles(file, featureCollection);
            Style selectedStyle = getSelectedStyle(styles);
            final LayerType type = LayerType.getLayerType(FeatureLayerType.class.getName());
            final ValueContainer configuration = type.getConfigurationTemplate();
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_FEATURE_COLLECTION_URL, file.toURI().toURL());
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_FEATURE_COLLECTION_CRS, targetCrs);
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_FEATURE_COLLECTION_CLIP_GEOMETRY, clipGeometry);
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_FEATURE_COLLECTION, featureCollection);
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_SLD_STYLE, selectedStyle);
            Layer featureLayer = type.createLayer(sceneView.getLayerContext(), configuration);
            featureLayer.setName(file.getName());
            featureLayer.setVisible(true);
            return featureLayer;
        } finally {
            pm.done();
        }
    }

    protected Layer doInBackground(ProgressMonitor pm) throws Exception {
        try {
            pm.beginTask("Reading shapes", ProgressMonitor.UNKNOWN);
            final ProductSceneView sceneView = context.getAppContext().getSelectedProductSceneView();
            CoordinateReferenceSystem targetCrs = (CoordinateReferenceSystem) context.getLayerContext().getCoordinateReferenceSystem();
            final Geometry clipGeometry = ShapefileUtils.createGeoBoundaryPolygon(sceneView.getRaster());
            File file = new File((String) context.getPropertyValue(ShapefileLayerSource.PROPERTY_NAME_FILE_PATH));
            Object featureCollectionValue = context.getPropertyValue(ShapefileLayerSource.PROPERTY_NAME_FEATURE_COLLECTION);
            FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection;
            if (featureCollectionValue == null) {
                featureCollection = ShapefileUtils.createFeatureCollection(file.toURI().toURL(), targetCrs, clipGeometry);
            } else {
                featureCollection = (FeatureCollection<SimpleFeatureType, SimpleFeature>) featureCollectionValue;
            }
            Style[] styles = getStyles(file, featureCollection);
            Style selectedStyle = getSelectedStyle(styles);
            final LayerType type = LayerType.getLayerType(FeatureLayerType.class.getName());
            final ValueContainer configuration = type.getConfigurationTemplate();
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_FEATURE_COLLECTION_URL, file.toURI().toURL());
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_FEATURE_COLLECTION_CRS, targetCrs);
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_FEATURE_COLLECTION_CLIP_GEOMETRY, clipGeometry);
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_FEATURE_COLLECTION, featureCollection);
            configuration.setValue(FeatureLayerType.PROPERTY_NAME_SLD_STYLE, selectedStyle);
            Layer featureLayer = type.createLayer(sceneView, configuration);
            featureLayer.setName(file.getName());
            featureLayer.setVisible(true);
            return featureLayer;
        } finally {
            pm.done();
        }
    }
