+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.simantics.db.procore.server.environment</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
+++ /dev/null
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: ProCore Database Server Environment Checking Utilities
-Bundle-SymbolicName: org.simantics.db.procore.server.environment
-Bundle-Version: 1.1.0.qualifier
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.simantics.db.procore.server.environment,
- org.simantics.db.procore.server.environment.windows
-Bundle-Vendor: Semantum Oy
-Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0"
-Bundle-NativeCode: msijni.dll;
- processor=x86; osname=win32,
- msijni64.dll;
- processor=x86_64; osname=win32,
- *
-Automatic-Module-Name: org.simantics.db.procore.server.environment
+++ /dev/null
-###############################################################################
-# Copyright (c) 2007, 2010 Association for Decentralized Information Management
-# in Industry THTH ry.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# VTT Technical Research Centre of Finland - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- msijni.dll,\
- msijni64.dll,\
- VC90.2008.SP1.KB2467174.redist.x64.exe,\
- VC90.2008.SP1.KB2467174.redist.x86.exe
-src.includes = native/
+++ /dev/null
-@rem ***************************************************************************
-@rem Copyright (c) 2007, 2010 Association for Decentralized Information Management
-@rem in Industry THTH ry.
-@rem All rights reserved. This program and the accompanying materials
-@rem are made available under the terms of the Eclipse Public License v1.0
-@rem which accompanies this distribution, and is available at
-@rem http://www.eclipse.org/legal/epl-v10.html
-@rem
-@rem Contributors:
-@rem VTT Technical Research Centre of Finland - initial API and implementation
-@rem ***************************************************************************
-gcc -mno-cygwin "-I%JAVA_HOME%/include" "-I%JAVA_HOME%/include/win32" -Wl,--add-stdcall-alias -shared -o ../msijni.dll msijni.c
+++ /dev/null
-#!/bin/sh
-
-# ***************************************************************************
-# Copyright (c) 2007, 2010 Association for Decentralized Information Management
-# in Industry THTH ry.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# VTT Technical Research Centre of Finland - initial API and implementation
-# ***************************************************************************
-
-gcc "-I%JAVA_HOME%/include" "-I%JAVA_HOME%/include/win32" -Wl,--add-stdcall-alias -shared -o ../msijni.dll msijni.c
+++ /dev/null
-@rem ***************************************************************************
-@rem Copyright (c) 2007, 2010 Association for Decentralized Information Management
-@rem in Industry THTH ry.
-@rem All rights reserved. This program and the accompanying materials
-@rem are made available under the terms of the Eclipse Public License v1.0
-@rem which accompanies this distribution, and is available at
-@rem http://www.eclipse.org/legal/epl-v10.html
-@rem
-@rem Contributors:
-@rem VTT Technical Research Centre of Finland - initial API and implementation
-@rem ***************************************************************************
-cl /O2 /Oi /GL "-I%JAVA_HOME%/include" "-I%JAVA_HOME%/include/win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "MSIJNI_EXPORTS" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /LD /FD /Gy /W3 /nologo /c /Zi /TC /errorReport:prompt /Fomsijni.obj msijni.c
-link /OUT:"..\src\msijni64.dll" /DLL /MACHINE:X64 Msi.lib msijni.obj
+++ /dev/null
-@rem ***************************************************************************
-@rem Copyright (c) 2007, 2010 Association for Decentralized Information Management
-@rem in Industry THTH ry.
-@rem All rights reserved. This program and the accompanying materials
-@rem are made available under the terms of the Eclipse Public License v1.0
-@rem which accompanies this distribution, and is available at
-@rem http://www.eclipse.org/legal/epl-v10.html
-@rem
-@rem Contributors:
-@rem VTT Technical Research Centre of Finland - initial API and implementation
-@rem ***************************************************************************
-cl /O2 /Oi /GL "-I%JAVA_HOME%/include" "-I%JAVA_HOME%/include/win32" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "MSIJNI_EXPORTS" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /LD /FD /Gy /W3 /nologo /c /Zi /TC /errorReport:prompt /Fomsijni.obj msijni.c
-link /OUT:"..\src\msijni.dll" /DLL /MACHINE:X86 Msi.lib msijni.obj
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#include <Msi.h>
-#include "jni.h"
-
-JNIEXPORT jint JNICALL Java_org_simantics_db_procore_server_environment_windows_Msi_MsiQueryProductState0(
- JNIEnv* env, jclass clazz, jstring productCode
-) {
- int result;
- const jchar* lpProductCode;
-
- lpProductCode = (*env)->GetStringChars(env, productCode, NULL);
- if (lpProductCode == 0)
- return 0;
-
- result = MsiQueryProductState((LPCTSTR) lpProductCode);
-
- (*env)->ReleaseStringChars(env, productCode, lpProductCode);
-
- return (jint) result;
-}
+++ /dev/null
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msijni", "msijni.vcproj", "{2C249AD2-A0AE-4A88-8DCD-71F96133690E}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {2C249AD2-A0AE-4A88-8DCD-71F96133690E}.Debug|Win32.ActiveCfg = Debug|Win32
- {2C249AD2-A0AE-4A88-8DCD-71F96133690E}.Debug|Win32.Build.0 = Debug|Win32
- {2C249AD2-A0AE-4A88-8DCD-71F96133690E}.Debug|x64.ActiveCfg = Debug|x64
- {2C249AD2-A0AE-4A88-8DCD-71F96133690E}.Debug|x64.Build.0 = Debug|x64
- {2C249AD2-A0AE-4A88-8DCD-71F96133690E}.Release|Win32.ActiveCfg = Release|Win32
- {2C249AD2-A0AE-4A88-8DCD-71F96133690E}.Release|Win32.Build.0 = Release|Win32
- {2C249AD2-A0AE-4A88-8DCD-71F96133690E}.Release|x64.ActiveCfg = Release|x64
- {2C249AD2-A0AE-4A88-8DCD-71F96133690E}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="9,00"
- Name="msijni"
- ProjectGUID="{2C249AD2-A0AE-4A88-8DCD-71F96133690E}"
- RootNamespace="msijni"
- Keyword="Win32Proj"
- TargetFrameworkVersion="196613"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- <Platform
- Name="x64"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="C:\Program Files\Java\jdk1.6.0_20\include;C:\Program Files\Java\jdk1.6.0_20\include\win32"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MSIJNI_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="4"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="Msi.lib"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy "$(TargetPath)" "..\..\src\msijni.dll""
- />
- </Configuration>
- <Configuration
- Name="Debug|x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="C:\Program Files\Java\jdk1.6.0_20\include;C:\Program Files\Java\jdk1.6.0_20\include\win32"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MSIJNI_EXPORTS"
- MinimalRebuild="true"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="2"
- GenerateDebugInformation="true"
- SubSystem="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy "$(TargetPath)" "..\..\src\msijni64.dll""
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="C:\Program Files\Java\jdk1.6.0_20\include;C:\Program Files\Java\jdk1.6.0_20\include\win32"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MSIJNI_EXPORTS"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="Msi.lib"
- LinkIncremental="1"
- AdditionalLibraryDirectories=""
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy "$(TargetPath)" "..\..\src\msijni.dll""
- />
- </Configuration>
- <Configuration
- Name="Release|x64"
- OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
- IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
- ConfigurationType="2"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- TargetEnvironment="3"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="2"
- EnableIntrinsicFunctions="true"
- AdditionalIncludeDirectories="C:\Program Files\Java\jdk1.6.0_20\include;C:\Program Files\Java\jdk1.6.0_20\include\win32"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MSIJNI_EXPORTS"
- RuntimeLibrary="2"
- EnableFunctionLevelLinking="true"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- DebugInformationFormat="3"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- LinkIncremental="1"
- GenerateDebugInformation="true"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="17"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy "$(TargetPath)" "..\..\src\msijni64.dll""
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
- >
- <File
- RelativePath="..\msijni.c"
- >
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
- >
- </Filter>
- <Filter
- Name="Resource Files"
- Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
- UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
- >
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment;
-
-/**
- * @author Tuukka Lehtonen
- */
-public enum ARCHType {
- PPC, PPC_64, SPARC, X86, X86_64, UNKNOWN
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment;
-
-
-/**
- * @author Tuukka Lehtonen
- */
-public final class ExecutionEnvironment {
-
- public final OSType os;
- public final ARCHType arch;
-
- private ExecutionEnvironment(OSType os, ARCHType arch) {
- this.os = os;
- this.arch = arch;
- }
-
- public static ExecutionEnvironment calculate() {
- return new ExecutionEnvironment(calculateOS(), calculateArch());
- }
-
- public static ARCHType calculateArch() {
- String osArch = System.getProperty("os.arch", "");
- osArch = osArch.toLowerCase();
- if (osArch.equals("i386") || osArch.equals("i586") || osArch.equals("i686") || osArch.equals("x86"))
- return ARCHType.X86;
- if (osArch.startsWith("amd64") || osArch.startsWith("x86_64"))
- return ARCHType.X86_64;
- if (osArch.equals("ppc"))
- return ARCHType.PPC;
- if (osArch.startsWith("ppc"))
- return ARCHType.PPC_64;
- if (osArch.startsWith("sparc"))
- return ARCHType.SPARC;
- return ARCHType.UNKNOWN;
- }
-
- public static OSType calculateOS() {
- String osName = System.getProperty("os.name", "");
- osName = osName.toLowerCase();
- if (osName.startsWith("mac os x"))
- return OSType.APPLE;
- if (osName.startsWith("windows"))
- return OSType.WINDOWS;
- if (osName.startsWith("linux"))
- return OSType.LINUX;
- if (osName.startsWith("sun"))
- return OSType.SUN;
- return OSType.UNKNOWN;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment;
-
-import java.util.List;
-
-import org.simantics.db.procore.server.environment.windows.Product;
-
-
-/**
- * @author Tuukka Lehtonen
- */
-public class ExecutionEnvironmentException extends Exception {
-
- private static final long serialVersionUID = -4189715696439554271L;
-
- public List<Product> requiredProducts;
-
- public ExecutionEnvironmentException(List<Product> requiredProducts) {
- super();
- this.requiredProducts = requiredProducts;
- }
-
- public ExecutionEnvironmentException(String message, List<Product> requiredProducts) {
- super(message);
- this.requiredProducts = requiredProducts;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment;
-
-import java.util.List;
-
-import org.simantics.db.procore.server.environment.windows.Product;
-
-
-/**
- * @author Tuukka Lehtonen
- */
-public class InstallException extends Exception {
-
- private static final long serialVersionUID = -4189715696439554271L;
-
- public List<Product> products;
-
- public InstallException(List<Product> products) {
- super();
- this.products = products;
- }
-
- public InstallException(String message, List<Product> products) {
- super(message);
- this.products = products;
- }
-
- public InstallException(Throwable cause, List<Product> products) {
- super(cause);
- this.products = products;
- }
-
- public InstallException(String message, Throwable cause, List<Product> products) {
- super(message, cause);
- this.products = products;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment;
-
-/**
- * @author Tuukka Lehtonen
- */
-public enum OSType {
- APPLE, LINUX, SUN, WINDOWS, UNKNOWN
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment;
-
-import java.util.List;
-
-import org.simantics.db.procore.server.environment.windows.Product;
-
-
-/**
- * @author Tuukka Lehtonen
- */
-public class RebootRequiredException extends InstallException {
-
- private static final long serialVersionUID = -4189715696439554271L;
-
- public RebootRequiredException(List<Product> success) {
- super(success);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.simantics.db.procore.server.environment.windows.Msi;
-import org.simantics.db.procore.server.environment.windows.Product;
-import org.simantics.db.procore.server.environment.windows.ProductCodes;
-
-/**
- * @author Tuukka Lehtonen
- */
-public final class ServerEnvironment {
-
- // http://msdn.microsoft.com/en-us/library/aa368542(v=vs.85).aspx
- private static final int ERROR_SUCCESS = 0;
- private static final int ERROR_SUCCESS_REBOOT_REQUIRED = 3010;
-
- /**
- * Checks whether the current running environment has all the necessary
- * components installed to run the ProCore database server.
- *
- * @throws ExecutionEnvironmentException if dependencies for running the
- * database server are not met
- */
- public static void ensureServerDependenciesMet() throws ExecutionEnvironmentException {
- ExecutionEnvironment env = ExecutionEnvironment.calculate();
- switch (env.os) {
- case WINDOWS: {
- switch (env.arch) {
- case X86:
- Msi.checkOneOfProductsInstalled(ProductCodes.VISUAL_CPP_2008_SP1_REDIST_X86_KB2467174);
- break;
- case X86_64:
- Msi.checkProductsInstalled(ProductCodes.VISUAL_CPP_2008_SP1_REDIST_X86_KB2467174, ProductCodes.VISUAL_CPP_2008_SP1_REDIST_X64_KB2467174);
- break;
- }
- break;
- }
- }
- }
-
- /**
- * Checks whether the current running environment has all the necessary
- * components installed to run the ProCore database server.
- *
- * @throws ExecutionEnvironmentException if dependencies for running the
- * database server are not met
- */
- public static void tryInstallDependencies(IProgressMonitor monitor) throws InstallException {
- ExecutionEnvironment env = ExecutionEnvironment.calculate();
- switch (env.os) {
- case WINDOWS: {
- switch (env.arch) {
- case X86:
- runInstaller(monitor, ProductCodes.VISUAL_CPP_2008_SP1_REDIST_X86_KB2467174, "VC90.2008.SP1.KB2467174.redist.x86.exe");
- break;
- case X86_64:
- runInstaller(monitor, ProductCodes.VISUAL_CPP_2008_SP1_REDIST_X86_KB2467174, "VC90.2008.SP1.KB2467174.redist.x86.exe");
- runInstaller(monitor, ProductCodes.VISUAL_CPP_2008_SP1_REDIST_X64_KB2467174, "VC90.2008.SP1.KB2467174.redist.x64.exe");
- break;
- }
- break;
- }
- }
- }
-
- private static void runInstaller(IProgressMonitor monitor, Product product, String installerPath) throws InstallException {
- try {
- URL url = FileLocator.find(new URL("platform:/plugin/org.simantics.db.procore.server.environment/" + installerPath));
- URL fileUrl = FileLocator.toFileURL(url);
- final File file = new File(fileUrl.getFile());
- System.out.println(file);
-
- Process installer = new ProcessBuilder("cmd.exe", "/C", file.toString(), "/qb").start();
- while (true) {
- try {
- int exitValue = installer.exitValue();
- //System.out.println("installation done, exit code: " + exitValue);
- switch (exitValue) {
- case ERROR_SUCCESS:
- return;
- case ERROR_SUCCESS_REBOOT_REQUIRED:
- throw new RebootRequiredException(Arrays.asList(product));
- }
- throw new InstallException("Installation of " + product.getDescription() + " failed with error code " + exitValue, Arrays.asList(product));
- } catch (IllegalThreadStateException e) {
-// if (monitor.isCanceled()) {
-// installer.destroy();
-// }
- // Not done yet.
- try {
- //System.out.println("sleeping");
- Thread.sleep(250);
- } catch (InterruptedException ie) {
- }
- }
- }
- } catch (IOException e) {
- throw new InstallException(e, Arrays.asList(product));
- }
- }
-
- // -------------------------------------------------------------------------
-
- public static void main(String[] args) {
- try {
- ensureServerDependenciesMet();
- } catch (ExecutionEnvironmentException e) {
- e.printStackTrace();
- }
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment.windows;
-
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.Arrays;
-
-import org.simantics.db.procore.server.environment.ExecutionEnvironment;
-import org.simantics.db.procore.server.environment.ExecutionEnvironmentException;
-
-/**
- * Provides Java access to Windows Msi API functions:
- * <ul>
- * <li>{@link #MsiQueryProductState(String)} (see <a
- * href="http://msdn.microsoft.com/en-us/library/aa370363(VS.85).aspx">MSDN</a>)</li>
- * </ul>
- *
- * @author Tuukka Lehtonen
- */
-public class Msi {
-
- public static void checkOneOfProductsInstalled(Product... products) throws ExecutionEnvironmentException {
- StringBuilder sb = new StringBuilder();
- sb.append("None of the following products are installed properly:\n");
- for (Product product : products) {
- ProductState state = Msi.MsiQueryProductState(product.getCode());
- switch (state) {
- case DEFAULT:
- // One of the listed products is installed OK.
- return;
- default:
- sb.append("\t" + product);
- sb.append(" - MsiQueryProductState returned ");
- sb.append(state);
- sb.append("\n");
- }
- }
- throw new ExecutionEnvironmentException("Cannot run ProCore database server in this environment due to the following problems:\n" + sb.toString(), Arrays.asList(products));
- }
-
- public static void checkProductsInstalled(Product... products) throws ExecutionEnvironmentException {
- StringBuilder sb = new StringBuilder();
- for (Product product : products) {
- ProductState state = Msi.MsiQueryProductState(product.getCode());
- switch (state) {
- case DEFAULT:
- // Installed OK
- continue;
- default:
- sb.append("\tProduct " + product + " is not installed properly, MsiQueryProductState returned " + state);
- sb.append("\n");
- }
- }
- if (sb.length() > 0) {
- // Something is not installed right, throw exception
- throw new ExecutionEnvironmentException("Cannot run ProCore database server in this environment due to the following problems:\n" + sb.toString(), Arrays.asList(products));
- }
- }
-
- // -------------------------------------------------------------------------
-
- public static ProductState MsiQueryProductState(String productCode) {
- int result = MsiQueryProductState0(productCode);
- return ProductState.of(result);
- }
-
- private static native int MsiQueryProductState0(String productCode);
-
- // -------------------------------------------------------------------------
-
- private static final String DLL_NAME = "msijni.dll";
- private static final String DLL_NAME_64 = "msijni64.dll";
-
- static {
- initialize();
- }
-
- private static void initialize() {
- ExecutionEnvironment env = ExecutionEnvironment.calculate();
- String libName = null;
- switch (env.arch) {
- case X86:
- libName = DLL_NAME;
- break;
- case X86_64:
- libName = DLL_NAME_64;
- break;
- default:
- return;
- }
-
- URL libURL = Msi.class.getResource("/" + libName);
- if (libURL != null) {
- try {
- if ("file".equals(libURL.getProtocol())) {
- File path = new File(URLDecoder.decode(libURL.getPath(), "UTF-8"));
- initialize(path);
- } else {
- File libFile = extractLib(libURL, libName);
- initialize(libFile);
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
-
- private static void initialize(File path) {
- //System.out.println("load msijni: " + path);
- System.load(path.toString());
- }
-
- /**
- * Extracts the specified source file in the specified bundle into the
- * specified local directory.
- *
- * @param url the source URL to stream the resource from
- * @param targetFile the target file to write the resource to
- * @param deleteOnExit <code>true</code> to use {@link File#deleteOnExit()}
- * on the resulting file. Note that this does not guarantee that the
- * file is deleted when the JVM exits
- * @return the resulting file
- * @throws FileNotFoundException
- */
- private static File copyResource(URL url, File targetFile) throws IOException, FileNotFoundException {
- FileOutputStream os = null;
- InputStream is = null;
- try {
- if (targetFile.exists())
- targetFile.delete();
-
- is = url.openStream();
- int read;
- byte [] buffer = new byte [16384];
- os = new FileOutputStream (targetFile);
- while ((read = is.read (buffer)) != -1) {
- os.write(buffer, 0, read);
- }
- os.close ();
- is.close ();
-
- return targetFile;
- } finally {
- uncheckedClose(os);
- uncheckedClose(is);
- }
- }
-
-
- private static void uncheckedClose(Closeable closeable) {
- try {
- if (closeable != null)
- closeable.close();
- } catch (IOException e) {
- //ignore
- }
- }
-
- private static File extractLib(URL libURL, String libName) throws FileNotFoundException, IOException {
- String tmpDirStr = System.getProperty("java.io.tmpdir");
- if (tmpDirStr == null)
- throw new NullPointerException("java.io.tmpdir property is null");
- File tmpDir = new File(tmpDirStr);
- File libFile = new File(tmpDir, libName);
-
- if (libFile.exists()) {
- if (libFile.isFile()) {
- try {
- byte[] origSum = computeSum(libURL);
- byte[] targetSum = computeSum(libFile);
- if (Arrays.equals(origSum, targetSum))
- return libFile;
- } catch (NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- return copyResource(libURL, libFile);
- }
-
- public static byte[] computeSum(InputStream in) throws IOException {
- if (in == null)
- throw new IllegalArgumentException("Input cannot be null!");
-
- try {
- MessageDigest md = MessageDigest.getInstance("MD5");
- byte[] data = new byte[64 * 1024];
-
- while (true) {
- int read = in.read(data);
- if (read == -1) {
- return md.digest();
- }
- md.update(data, 0, read);
- }
- } catch (NoSuchAlgorithmException e) {
- // Should not be possible for MD5
- throw new IOException(e);
- }
- }
-
- public static byte[] computeSum(File f) throws IOException, NoSuchAlgorithmException {
- InputStream in = null;
- try {
- in = new FileInputStream(f);
- return computeSum(in);
- } finally {
- if (in != null)
- in.close();
- }
- }
-
- public static byte[] computeSum(URL url) throws IOException, NoSuchAlgorithmException {
- InputStream in = null;
- try {
- in = url.openStream();
- return computeSum(in);
- } finally {
- if (in != null)
- in.close();
- }
- }
-
-}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment.windows;
-
-/**
- * @author Tuukka Lehtonen
- */
-public class Product {
-
- private final String code;
- private final String description;
-
- public Product(String code, String description) {
- this.code = code;
- this.description = description;
- }
-
- public String getCode() {
- return code;
- }
-
- public String getDescription() {
- return description;
- }
-
- @Override
- public String toString() {
- return description + " - " + code;
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment.windows;
-
-/**
- * @author Tuukka Lehtonen
- */
-public final class ProductCodes {
-
-// // Visual C++ 2008 runtime files
-//
-// // Visual C++ 2008 Redistributable Package (x86)
-// // {FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}
-// public static final Product VISUAL_CPP_2008_REDIST_X86 = new Product("{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4}",
-// "Visual C++ 2008 Redistributable Package (x86)");
-//
-// // Visual C++ 2008 Redistributable Package (x64)
-// // {350AA351-21FA-3270-8B7A-835434E766AD}
-// public static final Product VISUAL_CPP_2008_REDIST_X64 = new Product("{350AA351-21FA-3270-8B7A-835434E766AD}",
-// "Visual C++ 2008 Redistributable Package (x64)");
-//
-// // Visual C++ 2008 Redistributable Package (ia64)
-// // {2B547B43-DB50-3139-9EBE-37D419E0F5FA}
-// public static final Product VISUAL_CPP_2008_REDIST_IA64 = new Product("{2B547B43-DB50-3139-9EBE-37D419E0F5FA}",
-// "Visual C++ 2008 Redistributable Package (ia64)");
-
- // Visual C++ 2008 SP1 runtime files
-
- // THIS ONE IS CURRENTLY USED BY ProCore
-
- // Visual C++ 2008 SP1 Redistributable Package (x86)
- // {9A25302D-30C0-39D9-BD6F-21E6EC160475}
- // Date Published: 9/16/2008
- // 9.0.30729.17
- // http://www.microsoft.com/downloads/en/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en
- public static final Product VISUAL_CPP_2008_SP1_REDIST_X86 = new Product("{9A25302D-30C0-39D9-BD6F-21E6EC160475}",
- "Visual C++ 2008 SP1 Redistributable Package (x86) (v9.0.30729.17)");
-
- // Visual C++ 2008 SP1 Redistributable Package (x86) KB2467174
- // {86CE85E6-DBAC-3FFD-B977-E4B79F83C909}
- // Date Published: 4/12/2011
- // 9.0.30729.5570
- // http://support.microsoft.com/kb/2467174
- // http://www.microsoft.com/downloads/en/details.aspx?familyid=05ce856d-8128-408b-96fa-5e1f57b097d8&displaylang=en
- public static final Product VISUAL_CPP_2008_SP1_REDIST_X86_KB2467174 = new Product("{86CE85E6-DBAC-3FFD-B977-E4B79F83C909}",
- "Microsoft Visual C++ 2008 Redistributable - KB2467174 - x86 9.0.30729.5570");
-
- // Visual C++ 2008 SP1 Redistributable Package (x64)
- // {8220EEFE-38CD-377E-8595-13398D740ACE}
- // Date Published: 8/9/2008
- // 9.0.30729.17
- // http://www.microsoft.com/downloads/en/details.aspx?familyid=BA9257CA-337F-4B40-8C14-157CFDFFEE4E&displaylang=en
- public static final Product VISUAL_CPP_2008_SP1_REDIST_X64 = new Product("{8220EEFE-38CD-377E-8595-13398D740ACE}",
- "Visual C++ 2008 SP1 Redistributable Package (x64) (v9.0.30729.17)");
-
- // Visual C++ 2008 SP1 Redistributable Package (x64) KB2467174
- // {8338783A-0968-3B85-AFC7-BAAE0A63DC50}
- // Date Published: 4/12/2011
- // 9.0.30729.5570
- // http://support.microsoft.com/kb/2467174
- // http://www.microsoft.com/downloads/en/details.aspx?familyid=05ce856d-8128-408b-96fa-5e1f57b097d8&displaylang=en
- public static final Product VISUAL_CPP_2008_SP1_REDIST_X64_KB2467174 = new Product("{8338783A-0968-3B85-AFC7-BAAE0A63DC50}",
- "Microsoft Visual C++ 2008 Redistributable - KB2467174 - x64 9.0.30729.5570");
-
-// // Visual C++ 2008 SP1 Redistributable Package (ia64)
-// // {5827ECE1-AEB0-328E-B813-6FC68622C1F9}
-// // Date Published: 8/9/2008
-// // 9.0.30729.17
-// // http://www.microsoft.com/downloads/en/details.aspx?FamilyID=DCC211E6-AB82-41D6-8DEC-C79937393FE8&displaylang=en
-// public static final Product VISUAL_CPP_2008_SP1_REDIST_IA64 = new Product("{5827ECE1-AEB0-328E-B813-6FC68622C1F9}",
-// "Visual C++ 2008 SP1 Redistributable Package (ia64) (v9.0.30729.17)");
-
- // Visual C++ 2010 runtime files
-
- // Visual C++ 2010 Redistributable Package (x86)
- // {196BB40D-1578-3D01-B289-BEFC77A11A1E}
- public static final Product VISUAL_CPP_2010_REDIST_X86 = new Product("{196BB40D-1578-3D01-B289-BEFC77A11A1E}",
- "Visual C++ 2010 Redistributable Package (x86)");
-
- // Visual C++ 2010 Redistributable Package (x64)
- // {DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}
- public static final Product VISUAL_CPP_2010_REDIST_X64 = new Product("{DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}",
- "Visual C++ 2010 Redistributable Package (x64)");
-
- // Visual C++ 2010 Redistributable Package (ia64)
- // {C1A35166-4301-38E9-BA67-02823AD72A1B}
- public static final Product VISUAL_CPP_2010_REDIST_IA64 = new Product("{C1A35166-4301-38E9-BA67-02823AD72A1B}",
- "Visual C++ 2010 Redistributable Package (ia64)");
-
- // Visual C++ 2010 SP1 runtime files
-
- // Visual C++ 2010 SP1 Redistributable Package (x86)
- // {F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}
- public static final Product VISUAL_CPP_2010_SP1_REDIST_X86 = new Product("{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}",
- "Visual C++ 2010 SP1 Redistributable Package (x86)");
-
- // Visual C++ 2010 SP1 Redistributable Package (x64)
- // {1D8E6291-B0D5-35EC-8441-6616F567A0F7}
- public static final Product VISUAL_CPP_2010_SP1_REDIST_X64 = new Product("{1D8E6291-B0D5-35EC-8441-6616F567A0F7}",
- "Visual C++ 2010 SP1 Redistributable Package (x64)");
-
- // Visual C++ 2010 SP1 Redistributable Package (ia64)
- // {88C73C1C-2DE5-3B01-AFB8-B46EF4AB41CD}
- public static final Product VISUAL_CPP_2010_SP1_REDIST_IA64 = new Product("{88C73C1C-2DE5-3B01-AFB8-B46EF4AB41CD}",
- "Visual C++ 2010 SP1 Redistributable Package (ia64)");
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2010 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * VTT Technical Research Centre of Finland - initial API and implementation
- *******************************************************************************/
-package org.simantics.db.procore.server.environment.windows;
-
-/**
- * The possible return values of Win32 API call MsiQueryProductState enumerated.
- *
- * @author Tuukka Lehtonen
- */
-public enum ProductState {
-
- /**
- * An invalid parameter was passed to the function.
- */
- INVALIDARG(-2),
-
- /**
- * The product is not advertised or installed.
- */
- UNKNOWN(-1),
-
- /**
- * Indicates invocation of {@link Msi#MsiQueryProductState(String)} failed.
- */
- FAILED(0),
-
- /**
- * The product is advertised but not installed.
- */
- ADVERTISED(1),
-
- /**
- * The product is installed for a different user.
- */
- ABSENT(2),
-
- /**
- * The product is installed for a different user.
- */
- DEFAULT(5);
-
- int code;
-
- ProductState(int code) {
- this.code = code;
- }
-
- public static ProductState of(int code) {
- switch (code) {
- case -2: return INVALIDARG;
- case -1: return UNKNOWN;
- case 0: return FAILED;
- case 1: return ADVERTISED;
- case 2: return ABSENT;
- case 5: return DEFAULT;
- default: throw new IllegalArgumentException("unrecognized product install state return code: " + code);
- }
- }
-
- @Override
- public String toString() {
- return name() + "(" + code + ")";
- }
-
-}
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .,\
- win32.x86/,\
- win32.x86_64/,\
- linux.x86_64/
+ .
\ No newline at end of file
+++ /dev/null
-package org.simantics.db.testing.common;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.eclipse.core.runtime.Platform;
-import org.simantics.db.Driver;
-import org.simantics.db.Driver.Management;
-import org.simantics.db.Manager;
-import org.simantics.db.ServerI;
-import org.simantics.db.Session;
-import org.simantics.db.SessionManager;
-import org.simantics.db.SessionReference;
-import org.simantics.db.exception.DatabaseException;
-
-import fi.vtt.simantics.procore.ProCoreServerReference;
-import fi.vtt.simantics.procore.ProCoreSessionReference;
-import fi.vtt.simantics.procore.SessionManagerSource;
-
-/**
- * ProCore specific test handler.
- *
- */
-public class TestHandler {
-// private final TestSettings testSettings;
- private final Driver driver;
- private final File dbFolder;
- TestHandler(TestSettings testSettings, String dbFolderName) throws DatabaseException {
-// this.testSettings = testSettings;
- driver = Manager.getDriver("procore");
- if (null == dbFolderName)
- dbFolder = Platform.getLocation().append("db").toFile();
- else
- dbFolder = new File(dbFolderName);
- }
- void initNew() throws DatabaseException {
- Management m = getManagement();
- if (m.exist())
- m.delete();
- m.create();
- }
- void initIfNeccessary() throws DatabaseException {
- Management m = getManagement();
- if (!m.exist())
- m.create();
- }
- public Session getSession() throws DatabaseException {
- // Note that we normally user authentication agent for user identification.
- Properties props = new Properties();
- props.setProperty("user", "Default User");
- props.setProperty("password", "");
- return driver.getSession(dbFolder.getAbsolutePath(), props);
- }
- public ServerI getServer() throws DatabaseException {
- return driver.getServer(dbFolder.getAbsolutePath(), null);
- }
- public Management getManagement() throws DatabaseException {
- return driver.getManagement(dbFolder.getAbsolutePath(), null);
- }
- public Session regSession(long sessionId) throws DatabaseException, IOException {
- SessionManager sm = SessionManagerSource.getSessionManager();
- ProCoreServerReference ser = new ProCoreServerReference(dbFolder.toPath());
- SessionReference ses = new ProCoreSessionReference(ser, sessionId);
- return sm.createSession(ses, null);
- }
-
-}
\ No newline at end of file
*******************************************************************************/
package org.simantics.project.management;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
import org.simantics.db.DatabaseUserAgent;
import org.simantics.db.Driver;
driver.setDatabaseUserAgent(address, agent);
return new ServerManager(driver);
}
- /**
- * Create a server manager in OSGi platform.
- *
- * @return
- * @throws IOException
- * @throws ClassNotFoundException
- * @throws RuntimeException unexpected problem with OSGi environment
- */
- public static ServerManager createOSGI() throws IOException, RuntimeException {
- try {
- ClassLoader cl = ServerManager.class.getClassLoader();
-
- // Object bundle = Platform.getBundle("org.simantics.db.build");
- Class<?> Platform_class = cl.loadClass("org.eclipse.core.runtime.Platform");
- Method Platform_getBundle = Platform_class.getMethod("getBundle", String.class);
- Object bundle = Platform_getBundle.invoke(null, "org.simantics.db.build");
- if (bundle==null) throw new RuntimeException("Bundle org.simantics.db.build not found.");
-
- // URL db_build_url = bundle.getEntry("/");
- Class<?> Bundle_class = cl.loadClass("org.osgi.framework.Bundle");
- Method Bundle_getEntry = Bundle_class.getMethod("getEntry", String.class);
- URL db_build_url = (URL) Bundle_getEntry.invoke(bundle, "/");
-
- // URL db_build_file_url = FileLocator.toFileURL( db_build_url );
- Class<?> FileLocator_class = cl.loadClass("org.eclipse.core.runtime.FileLocator");
- Method FileLocator_toFileURL = FileLocator_class.getMethod("toFileURL", URL.class);
- URL db_build_file_url = (URL) FileLocator_toFileURL.invoke(null, db_build_url);
-
- @SuppressWarnings("unused")
- String buildFile = URLDecoder.decode(db_build_file_url.getPath(), "UTF-8");
-
-// File db_build_file = new File( buildFile );
- //return new ServerManager( db_build_file );
- throw new RuntimeException("ServerManager.createOSGI not implemented.");
- } catch( ClassNotFoundException e ) {
- throw new RuntimeException(e);
- } catch (SecurityException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e.getCause());
- }
- }
-
- /**
- * Create a server manager in an POJO environment.
- *
- * @return
- * @throws IOException
- */
- public static ServerManager createPOJO() throws IOException {
- String tempPath = System.getenv("tmp");
- if (tempPath==null) tempPath = "c:/temp/";
- File driverDir = new File(tempPath+"/core_drivers");
- if (!driverDir.exists()) {
- System.out.println("Extracting Core drivers to "+driverDir);
- driverDir.mkdirs();
- ServerManagerFactory.extractDrivers(driverDir);
- } else {
- System.out.println("Loading Core drivers from "+driverDir);
- }
- //return new ServerManager(driverDir);
- throw new RuntimeException("ServerManager.createPOJO not implemented.");
- }
-
- public static ServerManager createPOJO(File driverDir) throws IOException {
- //return new ServerManager(driverDir);
- throw new RuntimeException("ServerManager.createPOJO not implemented.");
- }
-
- static ServerManager cached;
-
- public static boolean isOSGi() {
- try {
- ServerManager.class.getClassLoader().loadClass("org.osgi.framework.Bundle");
- return true;
- } catch (ClassNotFoundException e) {
- return false;
- }
- }
-
- public synchronized static ServerManager getServerManager() {
- if (cached!=null) return cached;
- try {
- try {
- return createOSGI();
- } catch(RuntimeException e) {
- return createPOJO();
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
-
- /**
- * Extracts drivers files to a location.
- *
- * @param path location where to extract application files
- * @throws IOException
- */
- public static void extractDrivers(File path)
- throws IOException
- {
- // Extract org.simantics.db.build.zip to workspace
- InputStream is = ServerManager.class.getResource("org.simantics.db.build.zip").openStream();
- try {
- extractZip(is, path);
- } finally {
- is.close();
- }
- }
-
- /**
- * Extract a zip file into a directory
- *
- * @param zipInput
- * @param dst directory
- * @throws IOException
- */
- private static void extractZip(InputStream zipInput, File dst) throws IOException {
- byte[] buf = new byte[8192];
- ZipInputStream zis = new ZipInputStream(zipInput);
- ZipEntry entry;
-
- entry = zis.getNextEntry();
- while (entry != null) {
- // for each entry to be extracted
- String name = entry.getName();
- LOGGER.debug("Extracting "+name);
- File file = new File(dst, name);
-
- if (entry.isDirectory())
- {
- if ( !file.exists() ) file.mkdirs();
- } else {
- File parent = file.getParentFile();
- if (!parent.exists()) parent.mkdirs();
- if (!file.exists()) file.createNewFile();
-
- FileOutputStream fileoutputstream = new FileOutputStream(file);
- try {
- int n = 0;
- while ((n = zis.read(buf, 0, buf.length)) > -1)
- fileoutputstream.write(buf, 0, n);
- } finally {
- fileoutputstream.close();
- }
- }
-
- zis.closeEntry();
- entry = zis.getNextEntry();
- }// while
-
- zis.close();
- }
-
-
-}
+}
\ No newline at end of file
+++ /dev/null
-# Journal options.
-# If 0 then write journal. (default)
-# If 1 then write journal with additional debug information.
-# If 2 then do not write journal.
-journal_reportFileMode=1
-
-# Log file.
-common_logFile=../server.log
-
-# Log levels.
-#common_logLevels=trace
-#common_logLevels=debug
-#common_logLevels=info
-#common_logLevels=warning
-
-# Log packages.
-#common_logPackages=main
-#common_logPackages=session
-#common_logPackages=memory
-#common_logPackages=transaction
-#common_logPackages=extension
-#common_logPackages=utility
-#common_logPackages=test
-#common_logPackages=value
-#common_logPackages=revision
-#common_logPackages=graph
-#common_logPackages=page
org.simantics.layer0;bundle-version="1.0.0",
org.simantics.graph.db;bundle-version="1.0.0",
org.simantics.editors;bundle-version="1.0.0",
- org.simantics.db.procore.server.environment;bundle-version="1.1.0",
org.simantics;bundle-version="1.0.0";visibility:=reexport,
org.simantics.workbench.ontology;bundle-version="1.0.0",
org.simantics.workbench.search;bundle-version="1.5.0",
org.simantics.simulation.ui;bundle-version="1.1.0";visibility:=reexport,
org.simantics.scenegraph.profile;bundle-version="1.0.0";visibility:=reexport,
org.simantics.browsing.ui.model;bundle-version="1.0.0";visibility:=reexport,
- org.simantics.db.procore.ui,
org.eclipse.ui.workbench,
org.eclipse.e4.ui.workbench;bundle-version="1.3.0",
org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100.v20150407-1430",
import org.simantics.application.arguments.SimanticsArguments;
import org.simantics.db.common.Indexing;
import org.simantics.db.indexing.DatabaseIndexing;
-import org.simantics.db.procore.server.environment.RebootRequiredException;
-import org.simantics.db.procore.server.environment.windows.Product;
import org.simantics.project.IProject;
import org.simantics.project.ProjectKeys;
import org.simantics.ui.SimanticsUI;
return false;
} catch (Exception e) {
log.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
-
- Throwable cause = e.getCause();
- if (cause instanceof RebootRequiredException) {
- RebootRequiredException rre = (RebootRequiredException) cause;
- StringBuilder msg = new StringBuilder();
- msg.append("The application must be restarted after installing the following products:\n");
- for (Product product : rre.products)
- msg.append("\t" + product + "\n");
- msg.append("\nThe application will now close.");
- MessageDialog.openInformation(null, "Restart Required", msg.toString());
- } else {
- new ShowError("Platform Startup Failed", "Simantics Platform startup failed:\n\n" + e.getMessage(), e, true);
- }
+ new ShowError("Platform Startup Failed", "Simantics Platform startup failed:\n\n" + e.getMessage(), e, true);
return false;
}
org.simantics.db.layer0;bundle-version="1.1.0";visibility:=reexport,
org.simantics.db.management;bundle-version="1.1.0";visibility:=reexport,
org.simantics.project;bundle-version="1.0.1";visibility:=reexport,
- org.simantics.db.procore.server.environment;bundle-version="1.1.0",
org.simantics.graph.db;bundle-version="1.1.5",
org.eclipse.equinox.p2.metadata;bundle-version="2.0.0",
org.apache.log4j;bundle-version="1.2.15",
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2013 Association for Decentralized Information Management
- * in Industry THTH ry.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Semantum Oy - initial API and implementation
- *******************************************************************************/
-package org.simantics.internal;
-
-import java.io.File;
-import java.util.Properties;
-import java.util.UUID;
-
-import org.eclipse.core.runtime.IProduct;
-import org.eclipse.core.runtime.Platform;
-import org.simantics.db.ServerEx;
-import org.simantics.db.Session;
-import org.simantics.db.exception.DatabaseException;
-import org.simantics.db.service.LifecycleSupport;
-import org.simantics.db.service.XSupport;
-import org.simantics.project.management.ServerManager;
-import org.simantics.project.management.ServerManagerFactory;
-
-/**
- * An as-simple-as-possible utility class for starting a Simantics database
- * instance and opening a connection ({@link Session}) to it.
- *
- * <p>
- * To get up and running, simply invoke:
- * <pre>
- * SessionUtil util = new SessionUtil("my-client-id");
- * try {
- * File workspaceLocation = ...;
- * Session session = util.openSession(workspaceLocation);
- * // do something with the database session
- * } finally {
- * util.close();
- * }
- * </pre>
- *
- * <p>
- * This class is a provisional utility, pending for public inclusion.
- *
- * @author Tuukka Lehtonen
- * @see Session
- */
-public class SessionUtil {
-
- private String clientId;
- @SuppressWarnings("unused")
- private File workspace;
-
- private ServerManager serverManager;
- private ServerEx server;
- private Session session;
-
- public static String getApplicationClientId() {
- IProduct product = Platform.getProduct();
- if(product == null) return "noProduct";
- String application = product.getApplication();
- return application != null ? application : UUID.randomUUID().toString();
- }
-
- public SessionUtil() {
- this(UUID.randomUUID().toString());
- }
-
- public SessionUtil(String clientId) {
- serverManager = ServerManagerFactory.getServerManager();
- this.clientId = clientId;
- }
-
- public void close() throws DatabaseException {
- if (session != null) {
- session.getService(LifecycleSupport.class).close();
- }
- serverManager.close();
- }
-
-// public Session open(File workspace) throws IOException, DatabaseException {
-// File dbDir = new File(workspace, "db");
-// if (!dbDir.exists() || !dbDir.isDirectory())
-// throw new FileNotFoundException("database directory " + dbDir + " not found");
-// server = serverManager.getServer(dbDir);
-// server.start(null);
-// session = openSession(server, dbDir);
-// this.workspace = workspace;
-// return session;
-// }
-
- private Session openSession(ServerEx server, File dbDir) throws DatabaseException {
- Properties info = new Properties(ServerManager.DEFAULT);
- session = server.createSession(info);
- session.getService(XSupport.class).setServiceMode(true, true);
- return session;
- }
-
-}
<module>org.simantics.db.layer0</module>
<module>org.simantics.db.management</module>
<module>org.simantics.db.procore</module>
- <module>org.simantics.db.procore.server.environment</module>
<module>org.simantics.db.procore.ui</module>
<module>org.simantics.db.server</module>
<module>org.simantics.db.services</module>
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.simantics.db.server"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
<plugin
id="org.simantics.acorn"
download-size="0"
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.simantics.db.procore.server.environment"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
<plugin
id="org.simantics.workbench"
download-size="0"