Finish service initialization.

@throws GeomajasException oops
542293
@PostConstruct
	protected void postConstruct() throws GeomajasException {
		if (null != crsDefinitions) {
			for (CrsInfo crsInfo : crsDefinitions.values()) {
				try {
					CoordinateReferenceSystem crs = CRS.parseWKT(crsInfo.getCrsWkt());
					String code = crsInfo.getKey();
					crsCache.put(code, CrsFactory.getCrs(code, crs));
				} catch (FactoryException e) {
					throw new GeomajasException(e, ExceptionCode.CRS_DECODE_FAILURE_FOR_MAP, crsInfo.getKey());
				}
			}
		}
		if (null != crsTransformDefinitions) {
			for (CrsTransformInfo crsTransformInfo : crsTransformDefinitions.values()) {
				String key = getTransformKey(crsTransformInfo);
				transformCache.put(key, getCrsTransform(key, crsTransformInfo));
			}
		}
		GeometryFactory factory = new GeometryFactory();
		EMPTY_GEOMETRIES.put(Point.class, factory.createPoint((Coordinate) null));
		EMPTY_GEOMETRIES.put(LineString.class, factory.createLineString((Coordinate[]) null));
		EMPTY_GEOMETRIES.put(Polygon.class, factory.createPolygon(null, null));
		EMPTY_GEOMETRIES.put(MultiPoint.class, factory.createMultiPoint((Coordinate[]) null));
		EMPTY_GEOMETRIES.put(MultiLineString.class, factory.createMultiLineString((LineString[]) null)); // cast needed!
		EMPTY_GEOMETRIES.put(MultiPolygon.class, factory.createMultiPolygon((Polygon[]) null)); // cast needed!
		EMPTY_GEOMETRIES.put(Geometry.class, factory.createGeometryCollection(null));
	}
1037618
public void finish() throws IOException {
		int lastBlockSize = (int)(byteCount % blockSize);
		if(lastBlockSize!=0) {
			while(lastBlockSize<blockSize) {
				out.write(padding);
				byteCount++;
				lastBlockSize++;
			}
		}
		out.flush();
	}
186507
private void finish() {
        try {
            GlobalEnablementBuilder globalEnablementBuilder = getBeanManager().getServices().get(GlobalEnablementBuilder.class);
            for (BeanRegistration registration : additionalBeans) {
                processBeanRegistration(registration, globalEnablementBuilder);
            }
            for (ObserverRegistration registration : additionalObservers) {
                processObserverRegistration(registration);
            }
        } catch (Exception e) {
            throw new DefinitionException(e);
        }
    }
1187409
protected void finish() {

        if (m_finishTime != 0) {
            throw new CmsRuntimeException(Messages.get().container(Messages.ERR_PUBLISH_JOB_ALREADY_FINISHED_0));
        }
        m_cms = null;
        m_report = null;
        m_size = m_publishList.size();
        m_publishList = null;
        if (m_publishReport instanceof CmsPublishReport) {
            ((CmsPublishReport)m_publishReport).finish();
        }
        m_threadUUID = null;
        m_finishTime = System.currentTimeMillis();
    }
1139689
@Override
    public void completeInitialization()
                    throws RemoteException
    {
        enterpriseBeanClass = beanMetaData.enterpriseBeanClass;
        localEJBObjectClass = beanMetaData.localImplClass;

        // If a PreDestroy callback exists, then a weak reference cache is used
        // to keep track of instances, so PreDestroy may be called when all
        // references are dropped, or the application is uninstalled. F743-34301.1
        if (beanMetaData.ivInterceptorMetaData != null &&
            beanMetaData.ivInterceptorMetaData.ivPreDestroyInterceptors != null)
        {
            ivWeakCache = WeakManagedBeanCache.instance();
        }
    }
583898
public void endNewElement() {
		if (this.currentFeature != null) {
			if (!hasPassedLocalFilter) {
				hasPassedLocalFilter = false;
				return;
			}

			if (writerContentHandler != null) {
				this.currentFeatureGeoJSON = this.fillCategories(writerContentHandler, this.currentFeatureGeoJSON,
						service);
				this.currentFeatureGeoJSON = this.fillService(writerContentHandler, this.currentFeatureGeoJSON,
						service);

				this.fillEmptyAttributes(writerContentHandler, this.currentFeatureGeoJSON, service);

				this.currentFeatureGeoJSON = writerContentHandler.addPointToFeature(this.currentFeatureGeoJSON,
						writerContentHandler.endPoint(this.currentGeometryGeoJSON, this.service.getSRS(),
								DescribeService.DEFAULT_SRS));
				this.currentFeatureGeoJSON = writerContentHandler.endFeature(this.currentFeatureGeoJSON);
				writerContentHandler.addFeatureToCollection(this.geoJSON, this.currentFeatureGeoJSON);
			}
			this.currentFeature = this.fillCategories(contentHandler, this.currentFeature, service);
			this.currentFeature = this.fillService(contentHandler, this.currentFeature, service);

			this.currentFeature = contentHandler.addPointToFeature(this.currentFeature,
					contentHandler.endPoint(this.currentPoint, this.service.getSRS(), DescribeService.DEFAULT_SRS));
			this.currentFeature = contentHandler.endFeature(this.currentFeature);
			contentHandler.addFeatureToCollection(this.featureCollection, this.currentFeature);
			hasPassedLocalFilter = false;
		}
	}
1157609
public void finish() {
		if (mSuccessful) {
			mDb.setTransactionSuccessful();
		}
		mDb.endTransaction();

		if (mSuccessful) {
			for (OnTransactionCommittedListener listener : mOnTransactionCommittedListeners) {
				listener.onTransactionCommitted();
			}
		}
	}
1364909
@Override
    public void initialize(Integer pollingPeriodMs) {
        if (timer == null) {
            timer = new Timer();
            TimerTask task = new TimerTask() {
                /* (non-Javadoc)
                 * @see java.util.TimerTask#run()
                 */
                @Override
                public void run() {
                    try {
                        log.info("Launching periodic finalization...");
                        snapshotManager.finalizeSnapshots();
                        restoreManager.finalizeRestores();
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
            };

            if (pollingPeriodMs == null || pollingPeriodMs < 1) {
                pollingPeriodMs = DEFAULT_POLLING_PERIOD_MS;
            }

            timer.schedule(task, new Date(), pollingPeriodMs);
            log.info("Finalization scheduled to run every "
                     + pollingPeriodMs + " milliseconds.");
        }
    }
648942
public void finishMapJson(final Object... objs) {
        this.contentType = this.jsonContentType;
        if (this.recycleListener != null) this.output = objs;
        finish(request.getJsonConvert().convertMapTo(getBodyBufferSupplier(), objs));
    }
1129061
@PostConstruct
	protected void postConstruct() throws GeomajasException {
		if (null == baseTmsUrl) {
			throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "baseTmsUrl");
		}

		// Make sure we have a base URL we can work with:
		if ((baseTmsUrl.startsWith("http://") || baseTmsUrl.startsWith("https://")) && !baseTmsUrl.endsWith("/")) {
			baseTmsUrl += "/";
		}

		// Make sure there is a correct RasterLayerInfo object:
		if (layerInfo == null || layerInfo == UNUSABLE_LAYER_INFO) {
			try {
				tileMap = configurationService.getCapabilities(this);
				version = tileMap.getVersion();
				extension = tileMap.getTileFormat().getExtension();
				layerInfo = configurationService.asLayerInfo(tileMap);
				usable = true;
			} catch (TmsLayerException e) {
				// a layer needs an info object to keep the DtoConfigurationPostProcessor happy !
				layerInfo = UNUSABLE_LAYER_INFO;
				usable = false;
				log.warn("The layer could not be correctly initialized: " + getId(), e);
			}
		} else if (extension == null) {
			throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "extension");
		}

		if (layerInfo != null) {
			// Finally prepare some often needed values:
			state = new TileServiceState(geoService, layerInfo);
			// when proxying the real url will be resolved later on, just use a simple one for now
			boolean proxying = useCache || useProxy || null != authentication;
			if (tileMap != null && !proxying) {
				urlBuilder = new TileMapUrlBuilder(tileMap);
			} else {
				urlBuilder = new SimpleTmsUrlBuilder(extension);
			}
		}
	}
1002110
public void reset() {
        methodMap.clear();
        postBindMap.clear();
        postUnBindMap.clear();
        cellInitedMap.clear();
        cellFlareIdMap.clear();
        mvResolver.reset();
    }
630837
public static void end()
    {
        ServiceContext context = (ServiceContext) _localContext.get();

        if (context != null && --context._count == 0) {
            context._request = null;
            context._response = null;

            context._headers.clear();

            _localContext.set(null);
        }
    }
108476
@Override protected synchronized void done() {
        // dispose of canvas frames on the Event Dispatcher Thread...
        if (monitorWindows != null) {
            for (int i = 0; i < monitorWindows.length; i++) {
                if (monitorWindows[i] != null) {
                    monitorWindows[i].dispose();
                    monitorWindows[i] = null;
                }
            }
        }
        if (projectorFrame != null) {
            projectorFrame.dispose();
            projectorFrame = null;
            projectorConverter = null;
        }

        // force release of native memory
        System.gc();
        Pointer.deallocateReferences();
    }
1080377
public synchronized final void initialize() throws RepositoryException {
        if (!initialized) {
            try {
                doInitialize();
                initialized = true;
            } catch (RuntimeException e) {
                throw new RepositoryException(e);
            }
        }
    }
983797
public void postConstruct(GeoService geoService, DtoConverterService converterService) throws GeomajasException {
		if (null == layerInfo) {
			layerInfo = new RasterLayerInfo();
		}
		layerInfo.setCrs(TiledRasterLayerService.MERCATOR);
		crs = geoService.getCrs2(TiledRasterLayerService.MERCATOR);
		layerInfo.setTileWidth(tileSize);
		layerInfo.setTileHeight(tileSize);
		Bbox bbox = new Bbox(-TiledRasterLayerService.HALF_EQUATOR_IN_METERS,
				-TiledRasterLayerService.HALF_EQUATOR_IN_METERS, TiledRasterLayerService.EQUATOR_IN_METERS,
				TiledRasterLayerService.EQUATOR_IN_METERS);
		layerInfo.setMaxExtent(bbox);
		maxBounds = converterService.toInternal(bbox);

		resolutions = new double[maxZoomLevel + 1];
		double powerOfTwo = 1;
		for (int zoomLevel = 0; zoomLevel <= maxZoomLevel; zoomLevel++) {
			double resolution = (TiledRasterLayerService.EQUATOR_IN_METERS) / (tileSize * powerOfTwo);
			resolutions[zoomLevel] = resolution;
			powerOfTwo *= 2;
		}
	}
638625
@SuppressWarnings("unchecked")
    public void finish(final Object obj) {
        finish(request.getJsonConvert(), (Type) null, obj);
    }
150594
public void finishJson(final Object... objs) {
        this.contentType = this.jsonContentType;
        if (this.recycleListener != null) this.output = objs;
        finish(request.getJsonConvert().convertTo(getBodyBufferSupplier(), objs));
    }