private static void RegisterEnvironmentDependentTypes(ContainerBuilder builder) { var applicationEnvironment = new ServerConfigurationProvider().Environment; builder.RegisterType <MsSQLNHibernateConfigurationProvider>().As <INHibernateConfigurationProvider>().SingleInstance(); builder.RegisterType <IdentityServiceFake>().As <IIdentityService>().SingleInstance(); builder.RegisterType <UserIdentityProvider>().As <IUserIdentityProvider>().SingleInstance(); builder.RegisterType <SessionService>().As <ISessionService>().SingleInstance(); builder.RegisterType <CookieService>().As <ICookieService>().SingleInstance(); builder.RegisterType <SessionCacheService>().As <ISessionCacheService>().SingleInstance(); builder.RegisterType <EmbeddedResourceReportResourceLocator>().As <IReportResourceLocator>().SingleInstance(); builder.RegisterType <MandantLogoService>().As <IMandantLogoService>().SingleInstance(); builder.RegisterType <ReportTemplatingService>().As <IReportTemplatingService>().SingleInstance(); builder.RegisterType <BenchmarkingDataService>().As <IBenchmarkingDataService>().SingleInstance(); ////SecurityService builder.RegisterType <PermissionService>().As <IPermissionService>().SingleInstance(); builder.RegisterType <AvailabiltyService>().As <IAvailabilityService>().SingleInstance(); builder.RegisterType <CachedIdentityRoleService>().As <IIdentityCacheService>().SingleInstance(); builder.RegisterType <IdentityRoleService>(); switch (applicationEnvironment) { case ApplicationEnvironment.SpecFlow: builder.RegisterType <MsSQLNHibernateConfigurationProvider>().As <INHibernateConfigurationProvider>().SingleInstance(); builder.RegisterType <TestUserIdentityProvider>().As <IUserIdentityProvider>().SingleInstance(); builder.RegisterType <TestSessionService>().As <ISessionService>().SingleInstance(); builder.RegisterType <TestCookieService>().As <ICookieService>().SingleInstance(); builder.RegisterType <TestSessionCacheService>().As <ISessionCacheService>().SingleInstance(); builder.RegisterType <TestPermissionService>().As <IPermissionService>().SingleInstance(); builder.RegisterType <TestMandantLogoService>().As <IMandantLogoService>().SingleInstance(); builder.RegisterType <StubLocalizationService>().As <ILocalizationService>().SingleInstance(); builder.RegisterType <StubReportLocalizationService>().As <IReportLocalizationService>().SingleInstance(); builder.RegisterType <StubEreignisLogService>().As <IEreignisLogService>().SingleInstance(); builder.RegisterType <StubLegendService>().As <ILegendService>().SingleInstance(); builder.RegisterType <StubReportTemplatingService>().As <IReportTemplatingService>().SingleInstance(); builder.RegisterType <TestJahresabschlussGISService>().As <IJahresabschlussGISService>().SingleInstance(); //MapProviders builder.RegisterType <TestListeDerInspektionsroutenMapProvider>().As <IListeDerInspektionsroutenMapProvider>().SingleInstance(); builder.RegisterType <TestStrassenabschnitteListeMapProvider>().As <IStrassenabschnitteListeMapProvider>().SingleInstance(); builder.RegisterType <TestZustandProZustandsabschnittMapProvider>().As <IZustandProZustandsabschnittMapProvider>().SingleInstance(); builder.RegisterType <TestMassnahmenvorschlagProZustandsabschnittMapProvider>().As <IMassnahmenvorschlagProZustandsabschnittMapProvider>().SingleInstance(); builder.RegisterType <TestEineListeVonKoordiniertenMassnahmenMapProvider>().As <IEineListeVonKoordiniertenMassnahmenMapProvider>().SingleInstance(); builder.RegisterType <TestEineListeVonMassnahmenGegliedertNachTeilsystemenMapProvider>().As <IEineListeVonMassnahmenGegliedertNachTeilsystemenMapProvider>().SingleInstance(); break; case ApplicationEnvironment.Development: builder.RegisterType <SourceCodeReportResourceLocator>().As <IReportResourceLocator>().SingleInstance(); //builder.RegisterType<RealTimeCalculatingBenchmarkingDataService>().As<IBenchmarkingDataService>().SingleInstance(); break; default: throw new ArgumentOutOfRangeException("Environment", applicationEnvironment, "Not Supported!"); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void start() throws Throwable public override void Start() { bool useEpoll = _useEpoll && Epoll.Available; ServerConfigurationProvider configurationProvider = useEpoll ? EpollConfigurationProvider.INSTANCE : NioConfigurationProvider.INSTANCE; _bossGroup = configurationProvider.CreateEventLoopGroup(1, _tf); // These threads handle live channels. Each thread has a set of channels it is responsible for, and it will // continuously run a #select() loop to react to new events on these channels. _selectorGroup = configurationProvider.CreateEventLoopGroup(_numSelectorThreads, _tf); // Bootstrap the various ports and protocols we want to handle foreach (KeyValuePair <BoltConnector, ProtocolInitializer> bootstrapEntry in _bootstrappersMap.SetOfKeyValuePairs()) { try { ProtocolInitializer protocolInitializer = bootstrapEntry.Value; BoltConnector boltConnector = bootstrapEntry.Key; ServerBootstrap serverBootstrap = CreateServerBootstrap(configurationProvider, protocolInitializer); ChannelFuture channelFuture = serverBootstrap.bind(protocolInitializer.Address().socketAddress()).sync(); InetSocketAddress localAddress = ( InetSocketAddress )channelFuture.channel().localAddress(); _connectionRegister.register(boltConnector.Key(), localAddress); string host = protocolInitializer.Address().Hostname; int port = localAddress.Port; if (host.Contains(":")) { // IPv6 _log.info("Bolt enabled on [%s]:%s.", host, port); } else { // IPv4 _log.info("Bolt enabled on %s:%s.", host, port); } } catch (Exception e) { // We catch throwable here because netty uses clever tricks to have method signatures that look like they do not // throw checked exceptions, but they actually do. The compiler won't let us catch them explicitly because in theory // they shouldn't be possible, so we have to catch Throwable and do our own checks to grab them throw new PortBindException(bootstrapEntry.Value.address(), e); } } }
public Bitmap FormatLegendForReport(string layerList, EmsgGisReportParameter reportparams, ReportDefintion reportDefinition) { ServerConfigurationProvider serverConfigurationProv = new ServerConfigurationProvider(); string[] layerToShow = layerList.Split(','); //calc legendBitmap Bitmap legendBitmap = new Bitmap(5, 5); legendBitmap.SetResolution(reportDefinition.dpi, reportDefinition.dpi); SizeF legendBitmapSize = CalcAndDrawInfoImage(legendBitmap, layerToShow, reportparams, false, reportDefinition); //create/draw legendBitmap legendBitmapSize.Width += (float)Math.Ceiling(0.05 * reportDefinition.dpi); //add buffer legendBitmap = new Bitmap(Convert.ToInt32(legendBitmapSize.Width), Convert.ToInt32(legendBitmapSize.Height)); legendBitmap.SetResolution(reportDefinition.dpi, reportDefinition.dpi); CalcAndDrawInfoImage(legendBitmap, layerToShow, reportparams, true, reportDefinition); return(legendBitmap); }
private SizeF CalcAndDrawInfoImage(Bitmap infoImage, string[] layers, EmsgGisReportParameter reportparams, bool drawImage, ReportDefintion reportDefinition) { InfoImageHeightAndCurrentPosition currentPosAndSize = new InfoImageHeightAndCurrentPosition(reportDefinition.dpi); ServerConfigurationProvider serverConfigurationProv = new ServerConfigurationProvider(); using (Graphics graphics = Graphics.FromImage(infoImage)) { graphics.SmoothingMode = SmoothingMode.HighQuality; #region setFilterparams currentPosAndSize.IncreaseSizeAndPositionY(DrawString(graphics, localizationService.GetLocalizedLegendLabel("Filterparameter"), currentPosAndSize.GetCurrentPosition(), reportDefinition, 1, drawImage)); currentPosAndSize.IncreaseHeightAndPositionY(SpaceAndOffsets.getSpaceYBetweenHeadline(reportDefinition.dpi)); float valueOffset = 0; if (reportparams != null) { foreach (FilterListPo filterItem in reportparams.Filterparams) { valueOffset = Math.Max(valueOffset, graphics.MeasureString(filterItem.Name, Fontstyles.getDefaultFont()).Width); } foreach (FilterListPo filterItem in reportparams.Filterparams) { Point filterNamePos = new Point(currentPosAndSize.GetCurrentPosition().X, currentPosAndSize.GetCurrentPosition().Y); Point filterValuePos = new Point(currentPosAndSize.GetCurrentPosition().X + Convert.ToInt32(valueOffset), currentPosAndSize.GetCurrentPosition().Y); SizeF filterparamSize = DrawString(graphics, filterItem.Name + ":", filterNamePos, reportDefinition, drawString: drawImage); SizeF filterValueSize = DrawString(graphics, " " + filterItem.Value, filterValuePos, reportDefinition, drawString: drawImage); SizeF lineSize = new SizeF(filterparamSize.Width + filterValueSize.Width, filterparamSize.Height < filterValueSize.Height ? filterValueSize.Height : filterparamSize.Height); currentPosAndSize.IncreaseSizeAndPositionY(lineSize); currentPosAndSize.IncreaseHeightAndPositionY(SpaceAndOffsets.getSpaceYBetweenLayers(reportDefinition.dpi)); } } #endregion Point lineStart = new Point(0, currentPosAndSize.GetCurrentPosition().Y + SpaceAndOffsets.getSpaceYBetweenLegendAndFilter(reportDefinition.dpi) / 2); Point lineEnd = new Point(infoImage.Width - 2, currentPosAndSize.GetCurrentPosition().Y + SpaceAndOffsets.getSpaceYBetweenLegendAndFilter(reportDefinition.dpi) / 2); graphics.DrawLine(new Pen(Color.Black, (int)Math.Ceiling(0.01 * reportDefinition.dpi)), lineStart, lineEnd); currentPosAndSize.IncreaseHeightAndPositionY(SpaceAndOffsets.getSpaceYBetweenLegendAndFilter(reportDefinition.dpi)); #region set legend if (!layers.IsEmpty()) { currentPosAndSize.IncreaseSizeAndPositionY(DrawString(graphics, localizationService.GetLocalizedLegendLabel("Legende"), currentPosAndSize.GetCurrentPosition(), reportDefinition, 1, drawImage)); currentPosAndSize.IncreaseHeightAndPositionY(SpaceAndOffsets.getSpaceYBetweenHeadline(reportDefinition.dpi)); foreach (var layer in layers) { string layername = layer; Tuple <string, string> info; if (this.layerInfo.TryGetValue(layername, out info)) { layername = info.Item2; } currentPosAndSize.IncreaseSizeAndPositionY(DrawString(graphics, layername, currentPosAndSize.GetCurrentPosition(), reportDefinition, 2, drawImage)); Bitmap bm = new Bitmap(this.GetLegendStream(layer, dpi: reportDefinition.dpi, reportParameter: reportparams)); bm.SetResolution(reportDefinition.dpi, reportDefinition.dpi); if (drawImage) { graphics.DrawImage(bm, currentPosAndSize.GetCurrentPosition().X, currentPosAndSize.GetCurrentPosition().Y); } currentPosAndSize.IncreaseSizeAndPositionY(new SizeF(bm.Width, bm.Height)); currentPosAndSize.IncreaseHeightAndPositionY(SpaceAndOffsets.getSpaceYBetweenLayers(reportDefinition.dpi)); } lineStart = new Point(0, currentPosAndSize.GetCurrentPosition().Y + SpaceAndOffsets.getSpaceYBetweenLegendAndFilter(reportDefinition.dpi) / 2); lineEnd = new Point(infoImage.Width - 2, currentPosAndSize.GetCurrentPosition().Y + SpaceAndOffsets.getSpaceYBetweenLegendAndFilter(reportDefinition.dpi) / 2); graphics.DrawLine(new Pen(Color.Black, (int)Math.Ceiling(0.01 * reportDefinition.dpi)), lineStart, lineEnd); currentPosAndSize.IncreaseHeightAndPositionY(SpaceAndOffsets.getSpaceYBetweenLegendAndFilter(reportDefinition.dpi)); currentPosAndSize.IncreaseSizeAndPositionY(DrawString(graphics, localizationService.GetLocalizedLegendLabel("MapReportRedBox"), currentPosAndSize.GetCurrentPosition(), reportDefinition, drawString: drawImage)); //margin: resolutions not in multiple of 300 dpi may cause rounding errors resulting in 1 pixel of the MapReportRedBox text to be cut of, therefore safity margin currentPosAndSize.IncreaseHeightAndPositionY(SpaceAndOffsets.getSpaceYMargin(reportDefinition.dpi)); } #endregion } return(currentPosAndSize.GetInfoImageSize()); }
public ServerMessageFlowManager() { configurationManager = new ServerConfigurationProvider(); }
public string CreateMapRequestString(WMSRestParameter parameter, Guid mandandID) { if (string.IsNullOrEmpty(parameter.FORMAT)) { parameter.FORMAT = "image/jpeg"; } string[] allLayers = (parameter.LAYERS.Replace("show:", "")).Split(','); string layerIdsFromConfig = ""; //iteration für wms request mit mehreren layern foreach (string singleLayer in allLayers) { if (!string.IsNullOrEmpty(singleLayer)) { string id = new ServerConfigurationProvider().GetWMSLayerId(singleLayer); if (parameter.LAYERDEFS != null && parameter.LAYERDEFS.Contains(singleLayer)) { string[] layerIDsWithNearlySameContent = id.Split(','); //zb. Zustandsabschnitt u. zustandsabschnitt_indexIsNull string tempLayerDefs = parameter.LAYERDEFS; //zwischenspeichern parameter.LAYERDEFS = ""; //zurücksetzen d. layerdefs //ACHTUNG funktioniert NICHT bei einer Abfrage mit mehreren ReportLayern wenn gleichzeitig mehrere andere RestLayer abgefragt werden!!! foreach (string tempL in layerIDsWithNearlySameContent) { parameter.LAYERDEFS += tempLayerDefs.Replace(singleLayer, tempL) + ";"; } } //zusammenfassen aller layer die angezeigt werden sollen layerIdsFromConfig += (layerIdsFromConfig != "" ? "," : "") + id; } } //mandantfilter for every layer Dictionary <string, string> cqlFilterDict = new Dictionary <string, string>(); string[] layerIDs = layerIdsFromConfig.Split(',');//list with ids from this layer from config file foreach (string singleLayerId in layerIDs) { cqlFilterDict.Add(singleLayerId, "MANDANT_ID%3D'" + mandandID.ToString() + "'"); } if (parameter.LAYERDEFS != null) { string[] defintions = parameter.LAYERDEFS.Split(';'); foreach (string def in defintions) { if (String.IsNullOrEmpty(def)) { continue; } string layerId = def.Split(':')[0]; string filter = def.Substring(layerId.Length + 1); cqlFilterDict[layerId] += " and " + filter; } } string[] size = parameter.SIZE.Split(','); string width = size[0]; string height = size[1]; string cqlFilter = ""; foreach (string layerId in layerIDs) { if (!String.IsNullOrEmpty(cqlFilter)) { cqlFilter += ";"; } cqlFilter += cqlFilterDict[layerId]; } return(String.Format( "?service=wms&version=1.3&request=GetMap&layers={1}&transparent={2}&format={0}%2F{3}&bbox={4}&width={5}&height={6}&crs={7}&format_options=dpi:{8}&CQL_FILTER={9}", parameter.F, layerIdsFromConfig, parameter.TRANSPARENT, parameter.FORMAT, parameter.BBOX, width, height, parameter.IMAGESR, parameter.DPI, cqlFilter)); }
public StopwatchAttribute() { stopwatch = new Stopwatch(); config = new ServerConfigurationProvider(); }
private ServerBootstrap CreateServerBootstrap(ServerConfigurationProvider configurationProvider, ProtocolInitializer protocolInitializer) { return((new ServerBootstrap()).group(_bossGroup, _selectorGroup).channel(configurationProvider.ChannelClass).option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT).option(ChannelOption.SO_REUSEADDR, true).childOption(ChannelOption.SO_KEEPALIVE, true).childHandler(protocolInitializer.ChannelInitializer())); }