Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit 566c9b6

Browse files
author
Joe Bickley
committed
Merge remote-tracking branch 'origin/master'
Conflicts: CacheInitializer/obj/Debug/CacheInitializer.csproj.FileListAbsolute.txt CacheInitializer/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cach e
2 parents 0f20152 + bfd0e79 commit 566c9b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+114
-5753
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,10 @@ $RECYCLE.BIN/
4141
Network Trash Folder
4242
Temporary Items
4343
.apdisk
44+
45+
# Binaries and other generated files
46+
*/bin
47+
*/obj
48+
CacheInitializer.v12.suo
49+
packages
50+
CacheInitializer/readme.txt

.vs/CacheInitializer/v14/.suo

23.5 KB
Binary file not shown.

CacheInitializer/App.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
55
</startup>
66
</configuration>

CacheInitializer/CacheInitializer.csproj

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>CacheInitializer</RootNamespace>
1111
<AssemblyName>CacheInitializer</AssemblyName>
12-
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<TargetFrameworkProfile />
1515
</PropertyGroup>
@@ -34,14 +34,36 @@
3434
</PropertyGroup>
3535
<PropertyGroup />
3636
<ItemGroup>
37+
<Reference Include="Autofac">
38+
<HintPath>..\packages\Autofac.3.5.0\lib\net40\Autofac.dll</HintPath>
39+
</Reference>
40+
<Reference Include="BouncyCastle.CryptoExt">
41+
<HintPath>..\packages\QlikSense.NetSDK.2.2.3.0\lib\net452\BouncyCastle.CryptoExt.dll</HintPath>
42+
</Reference>
3743
<Reference Include="CommandLine">
3844
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
3945
</Reference>
46+
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
49+
</Reference>
4050
<Reference Include="Qlik.Engine">
41-
<HintPath>..\..\_shared\QlikSense.NetSDK.1.1.0\Qlik.Engine.dll</HintPath>
51+
<HintPath>..\packages\QlikSense.NetSDK.2.2.3.0\lib\net452\Qlik.Engine.dll</HintPath>
52+
</Reference>
53+
<Reference Include="Qlik.Engine.Extensions">
54+
<HintPath>..\packages\QlikSense.NetSDK.2.2.3.0\lib\net452\Qlik.Engine.Extensions.dll</HintPath>
55+
</Reference>
56+
<Reference Include="Qlik.Engine.Extensions.WinForms">
57+
<HintPath>..\packages\QlikSense.NetSDK.2.2.3.0\lib\net452\Qlik.Engine.Extensions.WinForms.dll</HintPath>
4258
</Reference>
4359
<Reference Include="Qlik.Sense.Client">
44-
<HintPath>..\..\_shared\QlikSense.NetSDK.1.1.0\Qlik.Sense.Client.dll</HintPath>
60+
<HintPath>..\packages\QlikSense.NetSDK.2.2.3.0\lib\net452\Qlik.Sense.Client.dll</HintPath>
61+
</Reference>
62+
<Reference Include="Qlik.Sense.Communication">
63+
<HintPath>..\packages\QlikSense.NetSDK.2.2.3.0\lib\net452\Qlik.Sense.Communication.dll</HintPath>
64+
</Reference>
65+
<Reference Include="Qlik.Sense.ExtendedFramework">
66+
<HintPath>..\packages\QlikSense.NetSDK.2.2.3.0\lib\net452\Qlik.Sense.ExtendedFramework.dll</HintPath>
4567
</Reference>
4668
<Reference Include="System" />
4769
<Reference Include="System.Core" />
@@ -57,8 +79,12 @@
5779
<Compile Include="Properties\AssemblyInfo.cs" />
5880
</ItemGroup>
5981
<ItemGroup>
60-
<None Include="App.config" />
61-
<None Include="packages.config" />
82+
<None Include="App.config">
83+
<SubType>Designer</SubType>
84+
</None>
85+
<None Include="packages.config">
86+
<SubType>Designer</SubType>
87+
</None>
6288
</ItemGroup>
6389
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
6490
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

CacheInitializer/ParamHandler.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
@@ -20,6 +20,10 @@ class Options
2020
HelpText = "App to load")]
2121
public string appname { get; set; }
2222

23+
[Option('p', "appname", Required = false,
24+
HelpText = "Virtual Proxy to use")]
25+
public string virtualProxy { get; set; }
26+
2327
[Option('o', "objects", Required = false, DefaultValue = false,
2428
HelpText = "cycle through all sheets and objects")]
2529
public bool fetchobjects { get; set; }

CacheInitializer/Program.cs

Lines changed: 61 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Threading.Tasks;
@@ -7,17 +7,17 @@
77
using Qlik.Sense.Client;
88

99
// Title: Qlik Sense Cache Initializer
10-
// Date: Feb 2015
11-
// Version: 0.1
12-
// Author: Joe Bickley
10+
// Date: 19.08.2016
11+
// Version: 0.11
12+
// Author: Joe Bickley,Roland Vecera
1313
// Summary: This tool will "warm" the cache of a Qlik Sense server so that when using large apps the users get good performance right away.
1414
// You can use it to load all apps, a single app, and you can get it to just open the app to RAM or cycle through all the objects
1515
// so that it will pre calculate expressions so users get rapid performance. You can also pass in selections too.
16-
// Credits: Thanks to Oysein Kolsrud for helping with the Qlik Sense .net SDK steps
16+
// Credits: Thanks to Øystein Kolsrud for helping with the Qlik Sense .net SDK steps
1717
// Uses the commandline.codeplex.com for processing parameters
1818

1919

20-
// Usage: cacheinitiazer.exe -s https://server.domain.com [-a appname] [-o] [-f fieldname] [-v "value 1,value 2"]
20+
// Usage: cacheinitiazer.exe -s https://server.domain.com [-a appname] [-o] [-f fieldname] [-v "value 1,value 2"] [-p virtualproxyprefix]
2121
// Notes: This projects use the Qlik Sense .net SDK, you must use the right version of the SDK to match the server you are connecting too.
2222
// To swap version simply replace the .net SDK files in the BIN directory of this project, if you dont match them, it wont work!
2323

@@ -27,73 +27,78 @@ namespace CacheInitializer
2727
class Program
2828
{
2929

30-
static void Main(string[] args)
30+
static void Main(string[] args)
3131
{
3232

3333
//////Setup
34-
Options options = new Options();
35-
Uri serverURL;
36-
string appname;
37-
bool openSheets;
38-
QlikSelection mySelection = null;
34+
Options options = new Options();
35+
Uri serverURL;
36+
string appname;
37+
bool openSheets;
38+
string virtualProxy;
39+
QlikSelection mySelection = null;
3940

4041
//// process the parameters using the https://commandline.codeplex.com/
41-
if (CommandLine.Parser.Default.ParseArguments(args, options))
42-
{
43-
serverURL = new Uri(options.server);
44-
appname = options.appname;
45-
openSheets = options.fetchobjects;
46-
if(options.selectionfield != null)
47-
{
48-
mySelection = new QlikSelection();
49-
mySelection.fieldname = options.selectionfield;
50-
mySelection.fieldvalues = options.selectionvalues.Split(',');
51-
}
52-
//TODO need to validate the params ideally
53-
}
54-
else
42+
if (CommandLine.Parser.Default.ParseArguments(args, options))
43+
{
44+
serverURL = new Uri(options.server);
45+
appname = options.appname;
46+
virtualProxy = !string.IsNullOrEmpty(options.virtualProxy) ? options.virtualProxy : "" ;
47+
openSheets = options.fetchobjects;
48+
if (options.selectionfield != null)
5549
{
56-
throw new Exception("Check parameters are correct");
50+
mySelection = new QlikSelection();
51+
mySelection.fieldname = options.selectionfield;
52+
mySelection.fieldvalues = options.selectionvalues.Split(',');
5753
}
54+
//TODO need to validate the params ideally
55+
}
56+
else
57+
{
58+
throw new Exception("Check parameters are correct");
59+
}
5860

5961

6062
////connect to the server (using windows credentials
61-
QlikConnection.Timeout = Int32.MaxValue;
62-
var d = DateTime.Now;
63-
ILocation remoteQlikSenseLocation = Qlik.Engine.Location.FromUri(serverURL);
64-
bool isHTTPs = false;
65-
if (serverURL.Scheme == Uri.UriSchemeHttps) isHTTPs = true;
66-
remoteQlikSenseLocation.AsNtlmUserViaProxy(isHTTPs);
63+
QlikConnection.Timeout = Int32.MaxValue;
64+
var d = DateTime.Now;
65+
ILocation remoteQlikSenseLocation = Qlik.Engine.Location.FromUri(serverURL);
66+
if (virtualProxy.Length > 0)
67+
{
68+
remoteQlikSenseLocation.VirtualProxyPath = virtualProxy;
69+
}
70+
bool isHTTPs = false;
71+
if (serverURL.Scheme == Uri.UriSchemeHttps) isHTTPs = true;
72+
remoteQlikSenseLocation.AsNtlmUserViaProxy(isHTTPs,null,false);
6773

6874

6975
////Start to cache the apps
70-
if (appname != null)
71-
{
72-
//Open up and cache one app
73-
IAppIdentifier appidentifier = remoteQlikSenseLocation.AppWithNameOrDefault(appname);
76+
if (appname != null)
77+
{
78+
//Open up and cache one app
79+
IAppIdentifier appidentifier = remoteQlikSenseLocation.AppWithNameOrDefault(appname);
7480

75-
LoadCache(remoteQlikSenseLocation, appidentifier, openSheets, mySelection);
76-
}
77-
else
78-
{
79-
//Get all apps, open them up and cache them
80-
remoteQlikSenseLocation.GetAppIdentifiers().ToList().ForEach(id => LoadCache(remoteQlikSenseLocation, id, openSheets, null));
81-
}
81+
LoadCache(remoteQlikSenseLocation, appidentifier, openSheets, mySelection);
82+
}
83+
else
84+
{
85+
//Get all apps, open them up and cache them
86+
remoteQlikSenseLocation.GetAppIdentifiers().ToList().ForEach(id => LoadCache(remoteQlikSenseLocation, id, openSheets, null));
87+
}
8288

8389
////Wrap it up
84-
var dt = DateTime.Now - d;
85-
Print("Cache initialization complete. Total time: {0}", dt.ToString());
90+
var dt = DateTime.Now - d;
91+
Print("Cache initialization complete. Total time: {0}", dt.ToString());
8692

87-
Console.ReadKey();
8893

8994
}
9095

91-
static void LoadCache(ILocation location, IAppIdentifier id, bool opensheets, QlikSelection Selections)
96+
static void LoadCache(ILocation location, IAppIdentifier id, bool opensheets, QlikSelection Selections)
9297
{
9398
//open up the app
94-
Print("{0}: Opening app", id.AppName);
95-
IApp app = location.App(id);
96-
Print("{0}: App open", id.AppName);
99+
Print("{0}: Opening app", id.AppName);
100+
IApp app = location.App(id);
101+
Print("{0}: App open", id.AppName);
97102

98103
//see if we are going to open the sheets too
99104
if (opensheets)
@@ -162,10 +167,10 @@ private static void Print(string txt, params object[] os)
162167

163168
}
164169

165-
class QlikSelection
166-
{
167-
public string fieldname { get; set; }
168-
public string[] fieldvalues { get; set;}
169-
}
170+
class QlikSelection
171+
{
172+
public string fieldname { get; set; }
173+
public string[] fieldvalues { get; set; }
174+
}
170175

171176
}
-199 KB
Binary file not shown.
-1.44 MB
Binary file not shown.
-12 KB
Binary file not shown.

CacheInitializer/bin/Debug/CacheInitializer.exe.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)