diff --git a/.gitignore b/.gitignore
index debd85d97..f27076d72 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,8 +8,15 @@ target
.project
.settings
*.iml
+*.ipr
+*.iws
*.mdxml.bak
*.jresult
*.diff
rebel.xml
.DS_Store
+.vscode
+venv/*
+!venv/bin/
+*.groovy
+libz
\ No newline at end of file
diff --git a/README.md b/README.md
index 2b22ada9e..ad8c2d090 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,10 @@ Cameo MDK is a plugin for [Cameo Systems Modeler](https://www.nomagic.com/produc
# Quickstart
+## User Guide
+
+The latest user documentation can be accessed online: https://mdk.readthedocs.io/en/latest
+
## Prerequisites
* [Cameo Systems Modeler (CSM)](https://www.nomagic.com/products/cameo-systems-modeler) or another No Magic environment bundle that includes the [SysML plugin](https://www.nomagic.com/product-addons/magicdraw-addons/sysml-plugin)
@@ -18,22 +22,20 @@ Cameo MDK is a plugin for [Cameo Systems Modeler](https://www.nomagic.com/produc
1. [Download](https://github.com/Open-MBEE/mdk/releases/latest) the Cameo MDK plugin, e.g. `mdk-*-plugin.zip`.
2. Run CSM. From the main menu, select "Help" > "Resource/Plugin Manager".
- ![Resource/Plugin Manager](doc/images/resource-plugin-manager.png)
+ ![Resource/Plugin Manager](docs/source/images/resource-plugin-manager.png)
3. Click "Import", navigate to the downloaded Cameo MDK plugin, and click "Open".
4. CSM should confirm installation with the following prompt.
- ![MDK Installation Confirmation](doc/images/mdk-installation-confirmation.png)
+ ![MDK Installation Confirmation](docs/images/mdk-installation-confirmation.png)
5. Restart CSM. To check installation, select from the main menu "Help" > "Resource/Plugin Manager" > "Plugins (no cost)" and ensure a row exists for "Model Development Kit" and its status is "Installed" with the correct version.
- ![MDK Installed](doc/images/mdk-installed.png)
+ ![MDK Installed](doc/source/images/mdk-installed.png)
> Cameo MDK can also be installed headlessly by simply unzipping the plugin archive into the directory that CSM is installed in.
-## Usage
-Documentation can be accessed [online](src/main/dist/manual) or offline in CSM from the main menu "Help" > "Other Documentation" > "MDK [...] UserGuide".
# Contributing
diff --git a/build.gradle b/build.gradle
index abf2a3122..a3add4b62 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,6 +4,25 @@ import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import java.util.stream.Collectors
+buildscript {
+ repositories {
+ mavenCentral()
+ maven {
+ url 'https://plugins.gradle.org/m2/'
+ }
+ }
+ dependencies {
+ classpath "io.github.gradle-nexus:publish-plugin:1.0.0"
+ }
+}
+
+plugins {
+ id 'idea'
+ id 'eclipse'
+ id 'java'
+ id 'distribution'
+}
+
String buildProfile = project.getProperties().getOrDefault('buildProfile', 'opensource')
String buildTag = project.getProperties().get('buildTag')
if (buildTag != null && !buildTag.isEmpty() && buildTag != version) {
@@ -44,23 +63,6 @@ else {
String docbookNameVersion = 'docbook-xsl-1.79.1'
String fopNameVersion = 'fop-1.1'
-buildscript {
- repositories {
- mavenCentral()
- maven {
- url 'https://plugins.gradle.org/m2/'
- }
- }
- dependencies {
- classpath "io.github.gradle-nexus:publish-plugin:1.0.0"
- }
-}
-
-apply plugin: 'idea'
-apply plugin: 'eclipse'
-apply plugin: 'java'
-apply plugin: 'distribution'
-
java {
sourceCompatibility = 'VERSION_1_8'
targetCompatibility = 'VERSION_1_8'
@@ -69,22 +71,29 @@ java {
// In this section you declare where to find the dependencies of your project
repositories {
- mavenCentral()
- maven {
- url 'https://repo.gradle.org/gradle/libs-releases-local/'
- }
ivy {
- url 'https://sourceforge.net/projects/docbook/files/docbook-xsl/'
- layout 'pattern', {
- artifact '[revision]/[classifier].[ext]'
+ url "https://sourceforge.net/projects/docbook/files/docbook-xsl/"
+ patternLayout {
+ artifact "[revision]/[classifier].[ext]"
+ }
+ metadataSources {
+ artifact()
}
}
- ivy { //downloading apache fop (version is defined in precompile)
- url 'https://archive.apache.org/dist/xmlgraphics/fop/binaries/'
- //url 'https://mirror.nodesdirect.com/apache/xmlgraphics/fop/binaries/' for newer version
- layout 'pattern', {
- artifact '[classifier].[ext]'
+ ivy { //downloading apache fop (version is defined in preimplementation)
+ url "https://archive.apache.org/dist/xmlgraphics/fop/binaries/"
+ patternLayout {
+ artifact "[classifier].[ext]"
+ }
+ metadataSources {
+ artifact()
}
+
+ //url 'https://mirror.nodesdirect.com/apache/xmlgraphics/fop/binaries/' for newer version
+ }
+ mavenCentral()
+ maven {
+ url 'https://repo.gradle.org/gradle/libs-releases-local/'
}
}
if (profiles['repositories'] != null) {
@@ -96,8 +105,8 @@ if (profiles['repositories'] != null) {
url "${mavenRepo.url}"
if (mavenRepo.credentials == true) {
credentials {
- username project.getProperties().get('artifactoryUsername')
- password project.getProperties().get('artifactoryPassword')
+ username project.getProperties().get('artifactoryUsername').toString()
+ password project.getProperties().get('artifactoryPassword').toString()
}
}
}
@@ -108,96 +117,92 @@ if (profiles['repositories'] != null) {
url "${ivyRepo.url}"
if (ivyRepo.credentials == true) {
credentials {
- username project.getProperties().get('artifactoryUsername')
- password project.getProperties().get('artifactoryPassword')
+ username project.getProperties().get('artifactoryUsername').toString()
+ password project.getProperties().get('artifactoryPassword').toString()
}
}
- layout "${ivyRepo.layout.type}", {
- artifact '' + ivyRepo.layout.pattern
+ patternLayout {
+ artifact "${ivyRepo.layoutPattern}"
+ }
+ metadataSources {
+ artifact()
}
}
}
}
}
-else {
- repositories.ivy {
- url 'http://download1.nomagic.com/'
- layout 'pattern', {
- artifact '/[module][revision]/[classifier].[ext]'
- }
- }
-}
configurations {
- preCompile
+ preImplementation
testPublish
}
// In this section you declare the dependencies for your production and test code
dependencies {
// SLF4J API
- compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'
- // compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21+'
+ implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.2'
+ // implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21+'
// SLF4J-Log4j12
- compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.2'
- // compile group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.21+'
+ implementation group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.2'
+ // implementation group: 'org.slf4j', name: 'slf4j-log4j12', version: '1.7.21+'
// JSoup
- compile group: 'org.jsoup', name: 'jsoup', version: '1.6.1'
- // compile group: 'org.jsoup', name: 'jsoup', version: '1.9.1+'
+ implementation group: 'org.jsoup', name: 'jsoup', version: '1.6.1'
+ // implementation group: 'org.jsoup', name: 'jsoup', version: '1.9.1+'
// JGraphT
- compile group: 'net.sf.jgrapht', name: 'jgrapht', version: '0.8.3'
- // compile group: 'org.jgrapht', name: 'jgrapht', version: '1.0.0+'
+ implementation group: 'net.sf.jgrapht', name: 'jgrapht', version: '0.8.3'
+ // implementation group: 'org.jgrapht', name: 'jgrapht', version: '1.0.0+'
// JSON Simple
- compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
- // compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1+'
+ implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
+ // implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1+'
// SwingX-All
- compile group: 'org.swinglabs.swingx', name: 'swingx-all', version: '1.6.4'
- // compile group: 'org.swinglabs.swingx', name: 'swingx-all', version: '1.6.5+'
+ implementation group: 'org.swinglabs.swingx', name: 'swingx-all', version: '1.6.4'
+ // implementation group: 'org.swinglabs.swingx', name: 'swingx-all', version: '1.6.5+'
// OpenCSV
- compile group: 'net.sf.opencsv', name: 'opencsv', version: '2.3'
- // compile group: 'com.opencsv', name: 'opencsv', version: '3.8+'
+ implementation group: 'net.sf.opencsv', name: 'opencsv', version: '2.3'
+ // implementation group: 'com.opencsv', name: 'opencsv', version: '3.8+'
// ActiveMQ
- compile group: 'org.apache.activemq', name: 'activemq-all', version: '5.9.1'
- // compile group: 'org.apache.activemq', name: 'activemq-all', version: '5.14.0+'
+ implementation group: 'org.apache.activemq', name: 'activemq-all', version: '5.9.1'
+ // implementation group: 'org.apache.activemq', name: 'activemq-all', version: '5.14.0+'
// Jackson
- compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.3'
+ implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.3'
// JSON Patch
- compile group: "com.box", name: "json-patch", version: "1.13"
+ implementation group: "com.box", name: "json-patch", version: "1.13"
// Apache Commons-IO
- compile group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
- //compile group: 'commons-io', name: 'commons-io', version: '2.4'
+ implementation group: 'org.apache.commons', name: 'commons-io', version: '1.3.2'
+ //implementation group: 'commons-io', name: 'commons-io', version: '2.4'
// Apache HTTP
- compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'
- compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.2'
+ implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'
+ implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.5.2'
// Apache Commons CLI
- compile group: 'commons-cli', name: 'commons-cli', version: '1.2'
+ implementation group: 'commons-cli', name: 'commons-cli', version: '1.2'
//OpenMBEE MMS Java Client
- compile group: 'org.openmbee.mms', name: 'mms-java-client', version: '3.4.2'
+ implementation group: 'org.openmbee.mms', name: 'mms-java-client', version: '3.4.2'
- compile group: 'com.beust', name: 'jcommander', version: '1.72'
+ implementation group: 'com.beust', name: 'jcommander', version: '1.72'
// Test Dependencies
- //testCompile 'junit:junit:4.11'
- testCompile group: 'org.gradle', name: 'gradle-core', version: '3.5.1'
- testCompile group: 'org.gradle', name: 'gradle-base-services', version: '3.5.1'
- testCompile group: 'org.gradle', name: 'gradle-messaging', version: '3.5.1'
- testCompile group: 'org.gradle', name: 'gradle-logging', version: '3.5.1'
- testCompile group: 'org.gradle', name: 'gradle-process-services', version: '3.5.1'
- testCompile group: 'org.gradle', name: 'gradle-tooling-api', version: '3.5.1'
+ //testImplementation 'junit:junit:4.11'
+ testImplementation group: 'org.gradle', name: 'gradle-core', version: '6.1.1'
+ testImplementation group: 'org.gradle', name: 'gradle-base-services', version: '6.1.1'
+ testImplementation group: 'org.gradle', name: 'gradle-messaging', version: '6.1.1'
+ testImplementation group: 'org.gradle', name: 'gradle-logging', version: '6.1.1'
+ testImplementation group: 'org.gradle', name: 'gradle-process-services', version: '6.1.1'
+ testImplementation group: 'org.gradle', name: 'gradle-worker-processes', version: '6.1.1'
+ testImplementation group: 'org.gradle', name: 'gradle-tooling-api', version: '6.1.1'
testPublish group: 'org.openmbee.testrail', name: 'testrail-cli', version: '1.1.1'
@@ -207,39 +212,38 @@ dependencies {
def mdDeps = parser.parseText(profiles['nomagicDeps'].toString())
mdDeps.each {
def dep = it
- preCompile group: "${dep.group}", name: "${dep.name}", version: "${dep.version}", classifier: "${dep.classifier != null ? dep.classifier : ''}", ext: "${dep.ext}"
+ preImplementation group: "${dep.group}", name: "${dep.name}", version: "${dep.version}", classifier: "${dep.classifier != null ? dep.classifier : ''}", ext: "${dep.ext}"
}
}
else {
- preCompile group: 'com.nomagic', name: 'demomagicdraw', version: '190sp3', classifier: 'MagicDraw_Demo_190_sp3_no_install', ext: 'zip'
- preCompile group: 'com.nomagic', name: 'sysml', version: '190sp3', classifier: 'SysML_Plugin_190_sp3_bundle', ext: 'zip'
- preCompile group: 'com.nomagic', name: 'cst', version: '190sp3', classifier: 'Cameo_Simulation_Toolkit_Plugin_190_sp3', ext: 'zip'
+ preImplementation group: 'com.nomagic', name: 'demomagicdraw', version: '190sp3', classifier: 'MagicDraw_Demo_190_sp3_no_install', ext: 'zip'
+ preImplementation group: 'com.nomagic', name: 'sysml', version: '190sp3', classifier: 'SysML_Plugin_190_sp3_bundle', ext: 'zip'
+ preImplementation group: 'com.nomagic', name: 'cst', version: '190sp3', classifier: 'Cameo_Simulation_Toolkit_Plugin_190_sp3', ext: 'zip'
}
- preCompile group: 'org.apache.fop', name: 'fop', version: '1.1', classifier: fopNameVersion + '-bin', ext: 'zip'
- preCompile group: 'net.sourceforge.docbook', name: 'docbook-xsl', version: '1.79.1', classifier: docbookNameVersion, ext: 'zip'
+ preImplementation group: 'org.apache.fop', name: 'fop', version: '1.1', classifier: fopNameVersion + '-bin', ext: 'zip'
+ preImplementation group: 'net.sourceforge.docbook', name: 'docbook-xsl', version: '1.79.1', classifier: docbookNameVersion, ext: 'zip'
// This ensures classpath load order to match the MagicDraw provided order and then includes extras needed for non-OpenAPI stuff.
// This was necessary because of the Application class stubbing that was done in the chromium libraries.
- compile files(classpathLibraries.collect { 'build/dependency-cache/extracted/magicdraw/' + it })
- compile fileTree(dir: 'build/dependency-cache/extracted/magicdraw', include: ['lib/**/*.jar', 'plugins/**/*.jar'], exclude: ([classpathLibraries, ['plugins/com.nomagic.collaborator.publisher/**/*.jar', 'plugins/com.nomagic.magicdraw.emfuml2xmi*/**/*.jar', 'plugins/com.nomagic.magicdraw.automaton/lib/engines/**/*.jar', 'plugins/tomsawyer/**/*.jar', 'plugins/com.intercax.syndeia.md/**/*.jar']]).flatten())
- compile fileTree(dir: 'lib', include: ['**/*.jar'])
- if (profiles["compileFiles"] != null) {
- def compileArray = profiles["compileFiles"].toString().split(',')
- compileArray.each {
- compile files(it)
+ implementation files(classpathLibraries.collect { 'build/dependency-cache/extracted/magicdraw/' + it })
+ implementation fileTree(dir: 'build/dependency-cache/extracted/magicdraw', include: ['lib/**/*.jar', 'plugins/**/*.jar'], exclude: ([classpathLibraries, ['plugins/com.nomagic.collaborator.publisher/**/*.jar', 'plugins/com.nomagic.magicdraw.emfuml2xmi*/**/*.jar', 'plugins/com.nomagic.magicdraw.automaton/lib/engines/**/*.jar', 'plugins/tomsawyer/**/*.jar', 'plugins/com.intercax.syndeia.md/**/*.jar']]).flatten())
+ implementation fileTree(dir: 'lib', include: ['**/*.jar'])
+ implementation files("build/dependency-cache/extracted/fop/jars/${fopNameVersion}.jar", 'build/dependency-cache/extracted/fop/jars/xmlgraphics-commons-1.5.jar')
+ if (profiles["implementationFiles"] != null) {
+ def implementationArray = profiles["implementationFiles"].toString().split(',')
+ implementationArray.each {
+ implementation files(it)
}
}
- else {
- compile files('build/dependency-cache/extracted/fop/jars/fop-1.1.jar', 'build/dependency-cache/extracted/fop/jars/xmlgraphics-commons-1.5.jar')
- }
}
task extractDependencies {
- configurations.preCompile.resolvedConfiguration.resolvedArtifacts.each { artifact ->
+ configurations.preImplementation.resolvedConfiguration.resolvedArtifacts.each { artifact ->
inputs.file artifact.file
}
+ outputs.dir 'build/dependency-cache'
doLast {
inputs.files.each { archive ->
if (archive.getName().endsWith(fopNameVersion + '-' + fopNameVersion + '-bin.zip')) {
@@ -344,7 +348,7 @@ task javadocZip(type: Zip, dependsOn: javadoc) {
from javadoc.destinationDir
}
-class PreDist extends DefaultTask {
+abstract class PreDist extends DefaultTask {
String humanVersion
String internalVersion
String groupName
@@ -352,95 +356,107 @@ class PreDist extends DefaultTask {
String descriptor
String docbookVersion
+ @InputDirectory
+ String sourceDist = 'src/main/dist'
+
+ @InputDirectory
+ String sourceDistTemplate = sourceDist + '/template'
+
+ @InputDirectory
+ String extractedCache = 'build/dependency-cache/extracted'
+
+ @OutputDirectory
+ String outputDir = 'build/generated-dist'
+
@TaskAction
void executeTask() {
project.copy {
- from 'src/main/dist'
- exclude 'template'
- from 'src/main/dist/template'
- into 'build/generated-dist'
+ from sourceDist
+ exclude sourceDistTemplate
+ from sourceDistTemplate
+ into outputDir
}
project.copy {
- from project.configurations.compile.resolvedConfiguration.resolvedArtifacts.file
+ from project.configurations.runtimeClasspath.resolvedConfiguration.resolvedArtifacts.file
from 'lib'
from project.jar
- into "build/generated-dist/plugins/${groupName}"
+ into "${outputDir}/plugins/${groupName}"
}
project.copy {
from project.getTasks().getByName('javadocZip')
- into "build/generated-dist/plugins/${groupName}/javadoc"
+ into "${outputDir}/plugins/${groupName}/javadoc"
}
project.copy {
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/fo"
- into "build/generated-dist/plugins/${groupName}/docbook-xsl/fo"
+ from "${extractedCache}/docbook/" + docbookVersion + "/fo"
+ into "${outputDir}/plugins/${groupName}/docbook-xsl/fo"
}
project.copy {
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/common"
- into "build/generated-dist/plugins/${groupName}/docbook-xsl/common"
+ from "${extractedCache}/docbook/" + docbookVersion + "/common"
+ into "${outputDir}/plugins/${groupName}/docbook-xsl/common"
}
project.copy {
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/COPYING"
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/README"
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/RELEASE-NOTES.txt"
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/VERSION.xsl"
- into "build/generated-dist/plugins/${groupName}/docbook-xsl"
+ from "${extractedCache}/docbook/" + docbookVersion + "/COPYING"
+ from "${extractedCache}/docbook/" + docbookVersion + "/README"
+ from "${extractedCache}/docbook/" + docbookVersion + "/RELEASE-NOTES.txt"
+ from "${extractedCache}/docbook/" + docbookVersion + "/VERSION.xsl"
+ into "${outputDir}/plugins/${groupName}/docbook-xsl"
}
project.copy {
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/highlighting/common.xsl"
- into "build/generated-dist/plugins/${groupName}/docbook-xsl/highlighting"
+ from "${extractedCache}/docbook/" + docbookVersion + "/highlighting/common.xsl"
+ into "${outputDir}/plugins/${groupName}/docbook-xsl/highlighting"
}
project.copy {
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/html/chunker.xsl"
- into "build/generated-dist/plugins/${groupName}/docbook-xsl/html"
+ from "${extractedCache}/docbook/" + docbookVersion + "/html/chunker.xsl"
+ into "${outputDir}/plugins/${groupName}/docbook-xsl/html"
}
project.copy {
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/lib/build.xml"
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/lib/lib.xsl"
- into "build/generated-dist/plugins/${groupName}/docbook-xsl/lib"
+ from "${extractedCache}/docbook/" + docbookVersion + "/lib/build.xml"
+ from "${extractedCache}/docbook/" + docbookVersion + "/lib/lib.xsl"
+ into "${outputDir}/plugins/${groupName}/docbook-xsl/lib"
}
project.copy {
- from "build/dependency-cache/extracted/docbook/" + docbookVersion + "/profiling/profile-mode.xsl"
- into "build/generated-dist/plugins/${groupName}/docbook-xsl/profiling"
+ from "${extractedCache}/docbook/" + docbookVersion + "/profiling/profile-mode.xsl"
+ into "${outputDir}/plugins/${groupName}/docbook-xsl/profiling"
}
//including docbook license files in the plugin directory
project.copy {
- from "build/dependency-cache/extracted/fop/license"
- into "build/generated-dist/plugins/${groupName}/license"
+ from "${extractedCache}/fop/license"
+ into "${outputDir}/plugins/${groupName}/license"
}
//including fop jar files in the plugin directory
project.copy {
- from "build/dependency-cache/extracted/fop/jars"
- into "build/generated-dist/plugins/${groupName}"
+ from "${extractedCache}/fop/jars"
+ into "${outputDir}/plugins/${groupName}"
}
- project.fileTree(dir: 'build/generated-dist', include: '**/*${group}*/**').each { file ->
+ project.fileTree(dir: "${outputDir}", include: '**/*${group}*/**').each { file ->
file.renameTo(project.file(file.getAbsolutePath().replace('${group}', "${groupName}")))
}
String pluginLibraries = ''
- project.fileTree(dir: "build/generated-dist/plugins/${groupName}", include: '**/*.jar').each { file ->
+ project.fileTree(dir: "${outputDir}/plugins/${groupName}", include: '**/*.jar').each { file ->
pluginLibraries += '\t\t' + System.lineSeparator()
}
project.copy {
- from 'src/main/dist/template/plugins/${group}/plugin.xml'
+ from "${sourceDistTemplate}/plugins/\${group}/plugin.xml"
filter { String line -> line.replace('', '' + System.lineSeparator() + System.lineSeparator() + pluginLibraries) }
filter { String line -> line.replace('${human.version}', humanVersion) }
filter { String line -> line.replace('${internal.version}', internalVersion) }
- into "build/generated-dist/plugins/${groupName}"
+ into "${outputDir}/plugins/${groupName}"
}
String descriptorFiles = ''
- project.fileTree(dir: 'build/generated-dist').each { file ->
+ project.fileTree(dir: "${outputDir}").each { file ->
String relativePath = file.absolutePath.replace(File.separator, '/').replaceAll(/.*build\/generated-dist\//, '')
descriptorFiles += '\t\t' + System.lineSeparator()
}
project.copy {
- from "src/main/dist/template/data/resourcemanager/${descriptor}"
+ from "${sourceDistTemplate}/data/resourcemanager/${descriptor}"
filter { String line -> line.replace('', '' + System.lineSeparator() + System.lineSeparator() + descriptorFiles) }
filter { String line -> line.replace('${human.version}', humanVersion) }
filter { String line -> line.replace('${internal.version}', internalVersion) }
filter { String line -> line.replace('${build.timestamp}', buildTimestamp) }
- into 'build/generated-dist/data/resourcemanager'
+ into "${outputDir}/data/resourcemanager"
}
}
}
@@ -475,9 +491,17 @@ distZip {
eachFile { file ->
file.setPath(path.substring(path.indexOf("/") + 1, path.length()))
}
+
}
distZip.dependsOn preDist
+distZip.doLast {
+ copy {
+ String publishVersion = version.endsWith('-SNAPSHOT') && buildTag != null && !buildTag.isEmpty() ? version.replace('-SNAPSHOT', '') : version
+ from "build/distributions/mdk-${publishVersion}-*.zip"
+ into 'local-distributions/'
+ }
+}
apply plugin: "maven-publish"
apply plugin: "signing"
@@ -611,7 +635,9 @@ test {
ignoreFailures = true
testLogging.showStandardStreams = true
forkEvery 1
-
+ if (profiles["executablePath"] != null) {
+ executable = profiles["executablePath"]
+ }
workingDir 'build/install'
/**
@@ -646,7 +672,7 @@ test {
fileTree(dir: 'build/generated-dist', include: '**/*.jar').getFiles().stream().map { i -> i.getAbsolutePath() }.collect(Collectors.joining(File.pathSeparator)) + File.pathSeparator +
/*fileTree(dir: 'build/install', include: ['plugins/** /*.jar']).asPath + */
files(classpathLibraries.collect { 'build/install/' + it }).getFiles().stream().map { i -> i.getAbsolutePath() }.collect(Collectors.joining(File.pathSeparator)) + File.pathSeparator +
- configurations.testCompile.resolvedConfiguration.resolvedArtifacts.stream().map { i -> i.getFile().getAbsolutePath() }.collect(Collectors.joining(File.pathSeparator)) + File.pathSeparator +
+ configurations.testRuntimeClasspath.resolvedConfiguration.resolvedArtifacts.stream().map { i -> i.getFile().getAbsolutePath() }.collect(Collectors.joining(File.pathSeparator)) + File.pathSeparator +
testsJar.outputs.files.singleFile, '-DLOCALCONFIG=true', '-DWINCONFIG=true', '-Djsse.enableSNIExtension=true', '-Djava.net.preferIPv4Stack=true', '-Dcom.sun.media.imageio.disableCodecLib=true', '-noverify', '-Dlocal.config.dir.ext=-test', '-splash:data/splash.png', '-Dmd.class.path=$java.class.path', '-Dcom.nomagic.osgi.config.dir=configuration', '-Desi.system.config=data/application.conf', '-Dlogback.configurationFile=data/logback.xml', '-Dsun.locale.formatasdefault=true', '-Dorg.osgi.framework.bundle.parent=ext']
String magicDrawLicense = project.getProperties().get('magicDrawLicense')
if (magicDrawLicense != null && !magicDrawLicense.isEmpty()) {
diff --git a/buildProfiles/opensource.properties b/buildProfiles/opensource.properties
index fbc16658c..5ff07029a 100644
--- a/buildProfiles/opensource.properties
+++ b/buildProfiles/opensource.properties
@@ -1 +1,2 @@
classpathLibraries = "lib/patch.jar,lib/brand.jar,lib/brand_api.jar,lib/md.jar,lib/md_api.jar,lib/md_common.jar,lib/md_common_api.jar,lib/md_common_test.jar,lib/tw_common.jar,lib/tw_common_api.jar,lib/launcher.jar,lib/activation.jar,lib/annotation.jar,lib/batik.jar,lib/bridj-0.7.0.jar,lib/bundles/ch.qos.logback.classic_1.2.3.jar,lib/bundles/ch.qos.logback.core_1.2.3.jar,lib/bundles/cmof_1.4.0.202006020804/cmof14.jar,lib/bundles/cmof_1.4.0.202006020804/tas.jar,lib/bundles/com.esotericsoftware.kryo_2.22.0.201401231130.jar,lib/bundles/com.google.guava_18.0.0.jar,lib/bundles/com.nomagic.annotations_1.0.0/com.nomagic.annotation-1.0.jar,lib/bundles/com.nomagic.ci.binary_17.0.5.v20200602-0758.jar,lib/bundles/com.nomagic.ci.metamodel.project_17.0.5.v20200602-0758.jar,lib/bundles/com.nomagic.ci.persistence.local_17.0.5.v20200602-0758.jar,lib/bundles/com.nomagic.ci.persistence_17.0.5.v20200602-0758.jar,lib/bundles/com.nomagic.ci.services_17.0.5.v20200602-0758.jar,lib/bundles/com.nomagic.ci_17.0.5.v20200602-0758.jar,lib/bundles/com.nomagic.esi.api.messages_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.api_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.client.core_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.common_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.config_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.core.msg_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.emf_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.helper_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.net_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.serializer.akka_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.serializer_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.service.actorsystem_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.services_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.stream_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.esi.supervisor_1.0.0.v20191101-2128.jar,lib/bundles/com.nomagic.magicdraw.ce_18.1.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.core.diagram_18.1.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.core.project.options_18.1.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.core_1.0.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.esi.binary.metamodel_18.1.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.esi.esiproject_18.1.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.esi.uuidmap_18.1.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.foundation_2.0.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.osgi.fragment_1.0.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.security_18.3.0.202006020804.jar,lib/bundles/com.nomagic.magicdraw.uml2_2.5.1.202006020804.jar,lib/bundles/com.nomagic.magicdraw_17.0.5.202006020804.jar,lib/bundles/com.teamdev.jxbrowser.chromium.internal.linux64_6.24.1.jar,lib/bundles/com.teamdev.jxbrowser.chromium.internal.mac_6.24.1.jar,lib/bundles/com.teamdev.jxbrowser.chromium.internal.win32_6.24.1.jar,lib/bundles/com.teamdev.jxbrowser.chromium.internal.win64_6.24.1.jar,lib/bundles/com.teamdev.jxbrowser.chromium_6.24.1.jar,lib/bundles/com.typesafe.akka.actor_2.5.10.jar,lib/bundles/com.typesafe.akka.cluster.tools_2.5.10.jar,lib/bundles/com.typesafe.akka.cluster_2.5.10.jar,lib/bundles/com.typesafe.akka.osgi_2.5.10.jar,lib/bundles/com.typesafe.akka.protobuf_2.5.10.jar,lib/bundles/com.typesafe.akka.remote_2.5.10.jar,lib/bundles/com.typesafe.akka.slf4j_2.5.10.jar,lib/bundles/com.typesafe.akka.stream_2.5.10.jar,lib/bundles/com.typesafe.config_1.3.0.jar,lib/bundles/com.typesafe.sslconfig_0.2.2.jar,lib/bundles/de.schlichtherle.truezip_7.4.3.v20200602-0758/lib/truezip-driver-zip-7.4.3.jar,lib/bundles/de.schlichtherle.truezip_7.4.3.v20200602-0758/lib/truezip-kernel-7.4.3.jar,lib/bundles/gnu.trove_3.0.3/lib/trove-3.0.3.jar,lib/bundles/io.aeron.client_1.7.0.jar,lib/bundles/io.aeron.driver_1.7.0.jar,lib/bundles/io.dropwizard.metrics.core_3.1.2.jar,lib/bundles/io.dropwizard.metrics.graphite_3.1.2.jar,lib/bundles/io.netty.buffer_4.1.21.Final.jar,lib/bundles/io.netty.codec_4.1.21.Final.jar,lib/bundles/io.netty.common_4.1.21.Final.jar,lib/bundles/io.netty.handler_4.1.21.Final.jar,lib/bundles/io.netty.resolver_4.1.21.Final.jar,lib/bundles/javax.jmi_1.0.0.202006020804/javax_jmi-1_0-fr.jar,lib/bundles/io.netty.transport_4.1.21.Final.jar,lib/bundles/joda-time_2.9.1.jar,lib/bundles/lz4-java_1.3.0.jar,lib/bundles/org.agrona_0.9.12.jar,lib/bundles/org.apache.commons.codec_1.9.0.v20170208-1614.jar,lib/bundles/org.apache.commons.collections_3.2.1.jar,lib/bundles/org.apache.commons.compress_1.3.0.jar,lib/bundles/org.apache.commons.io_2.4.0.jar,lib/bundles/org.apache.commons.lang_2.6.0.v201404270220.jar,lib/bundles/org.apache.commons.logging_1.1.1.v201101211721.jar,lib/bundles/org.apache.felix.scr_2.0.10.v20170501-2007.jar,lib/bundles/org.apache.httpcomponents.httpclient_4.5.3.jar,lib/bundles/org.apache.httpcomponents.httpcore_4.4.6.v20170210-0925.jar,lib/bundles/org.apache.log4j_1.2.15.v201005080500.jar,lib/bundles/org.apache.servicemix.bundles.jsr305_2.0.1.1.jar,lib/bundles/org.apiguardian_1.1.0.v20190826-0900.jar,lib/bundles/org.eclipse.core.contenttype_3.6.0.v20170207-1037.jar,lib/bundles/org.eclipse.core.jobs_3.9.2.v20171030-1027.jar,lib/bundles/org.eclipse.core.runtime_3.13.0.v20170207-1030.jar,lib/bundles/org.eclipse.emf.common_2.13.0.v20170609-0707.jar,lib/bundles/org.eclipse.emf.ecore.xmi_2.13.0.v20170609-0707.jar,lib/bundles/org.eclipse.emf.ecore_2.13.0.v20170609-0707.jar,lib/bundles/org.eclipse.equinox.app_1.3.400.v20150715-1528.jar,lib/bundles/org.eclipse.equinox.common_3.9.0.v20170207-1454.jar,lib/bundles/org.eclipse.equinox.ds_1.5.0.v20170307-1429.jar,lib/bundles/org.eclipse.equinox.preferences_3.7.0.v20170126-2132.jar,lib/bundles/org.eclipse.equinox.registry_3.7.0.v20170222-1344.jar,lib/bundles/org.eclipse.osgi.services_3.6.0.v20170228-1906.jar,lib/bundles/org.eclipse.osgi.util_3.4.0.v20170111-1608.jar,lib/bundles/org.eclipse.osgi_3.12.50.v20170928-1321.jar,lib/bundles/org.eclipse.uml2.common_1.5.0.v200905041045.jar,lib/bundles/org.hamcrest.core_1.3.0.v201303031735.jar,lib/bundles/org.jboss.netty_3.10.6.Final.jar,lib/bundles/org.json_1.0.0.255610281323.jar,lib/bundles/org.junit.jupiter.api_5.5.1.v20190826-0900.jar,lib/bundles/org.junit.jupiter.params_5.5.1.v20190826-0900.jar,lib/bundles/org.junit.platform.commons_1.5.1.v20190826-0900.jar,lib/bundles/org.junit_4.12.0.v201504281640/junit.jar,lib/bundles/org.opentest4j_1.2.0.v20190826-0900.jar,lib/bundles/org.reactivestreams.reactive-streams_1.0.2.jar,lib/bundles/org.scala-lang.modules.scala-java8-compat_0.8.0.jar,lib/bundles/org.scala-lang.modules.scala-parser-combinators_1.0.4.jar,lib/bundles/org.scala-lang.scala-library_2.12.4.v20171010-220511-VFINAL-c2a5883.jar,lib/bundles/org.uncommons.maths_1.2.2.201301151508/lib/uncommons-maths-1.2.2a.jar,lib/bundles/slf4j.api_1.7.25.jar,lib/bundles/cmof_1.4.0.201912191136/cmof14.jar,lib/bundles/cmof_1.4.0.201912191136/tas.jar,lib/bundles/com.nomagic.ci.binary_17.0.5.v20191219-1130.jar,lib/bundles/com.nomagic.ci.metamodel.project_17.0.5.v20191219-1130.jar,lib/bundles/com.nomagic.ci.persistence.local_17.0.5.v20191219-1130.jar,lib/bundles/com.nomagic.ci.persistence_17.0.5.v20191219-1130.jar,lib/bundles/com.nomagic.ci.services_17.0.5.v20191219-1130.jar,lib/bundles/com.nomagic.ci_17.0.5.v20191219-1130.jar,lib/bundles/com.nomagic.magicdraw.ce_18.1.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.core.diagram_18.1.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.core.project.options_18.1.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.core_1.0.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.esi.binary.metamodel_18.1.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.esi.esiproject_18.1.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.esi.uuidmap_18.1.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.foundation_2.0.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.osgi.fragment_1.0.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.security_18.3.0.201912191136.jar,lib/bundles/com.nomagic.magicdraw.uml2_2.5.1.201912191136.jar,lib/bundles/com.nomagic.magicdraw_17.0.5.201912191136.jar,lib/bundles/de.schlichtherle.truezip_7.4.3.v20191219-1130/lib/truezip-driver-zip-7.4.3.jar,lib/bundles/de.schlichtherle.truezip_7.4.3.v20191219-1130/lib/truezip-kernel-7.4.3.jar,lib/bundles/javax.jmi_1.0.0.201912191136/javax_jmi-1_0-fr.jar,lib/com.nomagic.osgi.launcher-17.0.5-SNAPSHOT.jar,lib/commons-compress-1.3.jar,lib/commons-httpclient-3.1.jar,lib/commons-logging-1.0.4.jar,lib/concurrent.jar,lib/EccpressoAll.jar,lib/HTMLEditorLight.jar,lib/JUnitParams-1.0.1.jar,lib/ehcache-2.10.1.jar,lib/flexlm.jar,lib/graphics/clibwrapper_jiio.jar,lib/graphics/freehep-base.jar,lib/graphics/freehep-graphics2d.jar,lib/graphics/freehep-graphicsio-emf.jar,lib/graphics/freehep-graphicsio-ps.jar,lib/graphics/freehep-graphicsio.jar,lib/graphics/jai_imageio.jar,lib/gson-2.2.4.jar,lib/hunspell-bridj-1.0.5-SNAPSHOT.jar,lib/javassist.jar,lib/jhall.jar,lib/jide-action.jar,lib/jide-charts.jar,lib/jide-common.jar,lib/jide-components.jar,lib/jide-diff.jar,lib/jide-dock.jar,lib/jide-editor.jar,lib/jide-gantt.jar,lib/jide-grids.jar,lib/jide-shortcut.jar,lib/jimi.jar,lib/jna.jar,lib/jnp-client.jar,lib/jsr250-api-1.0.jar,lib/jsr305.jar,lib/jtidy.jar,lib/lucene-analyzers-common-7.5.0.jar,lib/lucene-core-7.5.0.jar,lib/lucene-misc-7.5.0.jar,lib/poi-3.14-20160307.jar,lib/poi-ooxml-3.14-20160307.jar,lib/poi-ooxml-schemas-3.14-20160307.jar,lib/webservice/axis-config.jar,lib/webservice/axis.jar,lib/webservice/commons-discovery-0.2.jar,lib/webservice/jaxrpc.jar,lib/webservice/mdserviceclient.jar,lib/webservice/rsclient.jar,lib/webservice/wsdl4j-1.5.1.jar,lib/xalan.jar,lib/xmlbeans-2.6.0.jar,lib/y.jar"
+repositories = [{"type": "ivy", "url": "http://download1.nomagic.com/", "layoutPattern": "/[module][revision]/[classifier].[ext]"}]
\ No newline at end of file
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 000000000..5f6ed059a
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,2 @@
+source/_build
+source/generated
\ No newline at end of file
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 000000000..d0c3cbf10
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,20 @@
+# Minimal makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = source
+BUILDDIR = build
+
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
+
+.PHONY: help Makefile
+
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 000000000..6247f7e23
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,35 @@
+@ECHO OFF
+
+pushd %~dp0
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set SOURCEDIR=source
+set BUILDDIR=build
+
+if "%1" == "" goto help
+
+%SPHINXBUILD% >NUL 2>NUL
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+goto end
+
+:help
+%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
+
+:end
+popd
diff --git a/docs/source/api.rst b/docs/source/api.rst
new file mode 100644
index 000000000..3a15a1ad6
--- /dev/null
+++ b/docs/source/api.rst
@@ -0,0 +1,21 @@
+********************
+Developer Resources
+********************
+
+API
+====
+
+The Javadoc for MDK is included in the plugin and can be found in the MagicDraw plugins folder after installation. Note that only the classes found in gov.nasa.jpl.mbee.mdk.api are intended to be used by other plugins/tools and that the rest of the code can change without any notification.
+
+MDK Environment Options
+========================
+
+Options for advanced users to customize certain behaviors or enable MDK functionality are available in MagicDraw's Environment Options.
+- LOG_JSON: Enables logging of MMS request and response information, including sent and received JSON, to the MagicDraw log. To access these settings, navigate to the "Options Menu" -> "Environment" dialog, and select the "MDK" section. Several [DEVELOPER] options are also available, but are generally hidden from users. They are included here for completeness - we strongly recommend they not be modified unless for development purposes as they will likely result in data loss.
+- PERSIST_CHANGELOG: [DEVELOPER] Enables persisting of the changelog in the \_MMSSync\_ package for uneditable model elements. Disabling this option will cause these changelogs to be lost after CSync and may cause loss of model parity.
+- ENABLE_CHANGE_LISTENER: [DEVELOPER] Enables listeners for model changes in MagicDraw and MMS. Disabling this option will cause changes to not be tracked and may cause loss of model parity.
+- ENABLE_COORDINATED_SYNC: [DEVELOPER] Enables Coordinated Sync on Teamwork Cloud project commit. Disabling this option will cause CSync to be skipped on Teamwork Cloud commit and may cause loss of model parity.
+
+
+.. autosummary::
+ :toctree: generated
\ No newline at end of file
diff --git a/docs/source/cameo.rst b/docs/source/cameo.rst
new file mode 100644
index 000000000..2d028de47
--- /dev/null
+++ b/docs/source/cameo.rst
@@ -0,0 +1,13 @@
+################################################
+Cameo Model Development Kit (MDK) User's Guide
+################################################
+
+Model Development Kit (MDK) is a Cameo plugin that syncs models to the MMS, enabling interoperability
+between Cameo and the broader OpenMBEE ecosystem including MMS and View Editor.
+This guide is designed to introduce users to the various features of the Cameo MDK.
+
+.. toctree::
+
+ initialization
+ functions
+ guide
diff --git a/docs/source/conf.py b/docs/source/conf.py
new file mode 100644
index 000000000..7f3f4296c
--- /dev/null
+++ b/docs/source/conf.py
@@ -0,0 +1,36 @@
+# Configuration file for the Sphinx documentation builder.
+
+# -- Project information
+
+project = 'OpenMBEE Model Development Kit'
+copyright = '2022, OpenMBEE Open Source Community'
+author = 'OpenMBEE Open Source Community'
+
+release = '0.1'
+version = '5.1.0'
+
+# -- General configuration
+
+extensions = [
+ 'sphinx.ext.duration',
+ 'sphinx.ext.doctest',
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.autosectionlabel',
+ 'sphinx.ext.autosummary',
+ 'sphinx.ext.intersphinx',
+]
+
+intersphinx_mapping = {
+ 'python': ('https://docs.python.org/3/', None),
+ 'sphinx': ('https://www.sphinx-doc.org/en/master/', None),
+}
+intersphinx_disabled_domains = ['std']
+
+templates_path = ['_templates']
+
+# -- Options for HTML output
+numfig = True
+autosectionlabel_prefix_document = True
+
+# -- Options for EPUB output
+epub_show_urls = 'footnote'
diff --git a/docs/source/docgen.rst b/docs/source/docgen.rst
new file mode 100644
index 000000000..077a956d3
--- /dev/null
+++ b/docs/source/docgen.rst
@@ -0,0 +1,8 @@
+*******************
+DocGen Users Guide
+*******************
+
+Under Construction. For the latest DocGen users guide visit the community MMS at mms.openmbee.org or find the PDF guide located inside the MDK plugin
+under:
+
+``/manual/MDK DocGen UserGuide.pdf``
\ No newline at end of file
diff --git a/docs/source/functions.rst b/docs/source/functions.rst
new file mode 100644
index 000000000..894da525a
--- /dev/null
+++ b/docs/source/functions.rst
@@ -0,0 +1,178 @@
+*************
+Key Concepts
+*************
+The following views are designed to guide the user through using all aspects of the MDK.
+
+Logging in to MMS
+=================
+
+Because many MDK features expect that you are logged in to the MMS, you may be prompted to login to the MMS when a MDK- enabled project is loaded. This login prompt occurs near the end of the load cycle, but will not block MagicDraw from completing the model load. If the login fails or is cancelled, MDK will revert to offline mode. Any changes will be persisted in the model, and you will be unable to receive changes from or send changes to MMS until you successfully log in. Other offline features of MDK are unaffected. You may login at any time by selecting "Login" from the "MMS" menu and submitting your credentials through the dialog box.
+If you commit a MDK-enabled project to Teamwork Cloud (TWC) but are not logged in to MMS, you will be prompted to log in the MMS. This prompt occurs immediately after you submit the commit message, and will block MagicDraw from completing the commit to TWC until it is submitted or cancelled. If this login fails or is cancelled, you will continue to not have access to the online functionality as described above.
+
+MMS Menu
+=========
+
+The following provides an overview of the different operations that are offered through the top MMS menu. For information about the MMS menu that appears when selecting an element, such as a document, refer to Section .
+
+- Login - Trigger a prompt for credentials to be used to log in to the MMS. When logged in, the options that require MMS interaction will be enabled.
+- Logout - Clear your MMS authentication. It will also disable any options that require a connection to the MMS.
+- Generate All Views - Generates all Views in the project. It is functionally equivalent to finding all Views, right clicking, and selecting "MMS" > "Generate View Contents".
+- Validate - Validate elements or project attributes in bulk, such as Views and branches.
+
+MMS Syncing
+============
+
+Syncing with MMS is an automated process that is typically transparent to the user. These views explain how this occurs, cases where manual intervention is required i.e. conflicts, and how to recover from a loss of parity.
+
+Coordinated Syncing
+--------------------
+
+Coordinated Sync ties the MMS synchronization functionality to MagicDraw's Teamwork Cloud (TWC) commit action. When a TWC commit is initiated in MagicDraw, coordinated sync triggers a similar commit to the MMS.
+This minimizes the user interactions required to keep the model up to date on the MMS and ensures that parity is maintained between the TWC model and the MMS model. This also vastly reduces the need for alternative sync methods such as `Manual Syncing`_.
+
+Description
+^^^^^^^^^^^^
+
+While you are editing the model, element changes are collected in memory to be processed on your next save / commit. This includes direct changes to your model, such as new elements or updated documentation, as well as reference changes that can arise from changes to mounted projects. MMS changes by other users, in MagicDraw or View Editor, are also stored in memory to be processed during the sync operation (these changes are not stored in memory if you are not logged in to the MMS).
+When a TWC commit is initiated and a coordinated sync occurs, these two change lists are processed. MMS element changes are updated into the MagicDraw model as possible. After this model update, MagicDraw model changes are committed to the MMS in the background of the TWC commit. Finally, the model save/commit occurs.
+Any conflicts caused by changes to elements in both MagicDraw and MMS introduced by any user on either end will be stored in the model for any user to resolve as desired. They will also be presented to the user in the validation window upon save/commit.
+
+These conflicts will be presented to the user on every save/commit until resolved. The presence of conflicts does not prevent completion of the TWC commit operation.
+
+Usage
+^^^^^^
+
+- On Model Open
+ - Coordinated Sync will prompt the user to log in to MMS. Logging in allows it to listen to messages track changes in real time, and be ready to gather and apply them at the appropriate time.
+ - Cancelling this login, or submitting invalid credentials, will not prevent you from working on the model. It will only prevent you from receiving messages about elements changed in the MMS and prevent you from committing to the MMS until after you log in manually. Changes made to the model will be persisted locally for later commit.
+- On Model Save / TWC Commit
+ - Coordinated Sync will automatically perform model synchronization with MMS, committing MagicDraw elements to MMS or deleting elements no longer present in MagicDraw.
+ - Coordinated Sync will update elements in MagicDraw based on MMS changes if the element can be edited and there is no version conflict between the MagicDraw and MMS versions of the elements.
+ - Elements with pending updates will be presented to the user as a validation violation so that the user can plan to lock them before next commit, if desired. These will be stored in a list in the model for future checking.
+ - Coordinated Sync will not update elements in MagicDraw of MMS that have pending changes on both the MagicDraw and MMS side, as it cannot determine which version of the element is correct.
+ - Elements with these conflicts will be presented to the user as a validation violation for manual resolution. These will be stored in a list in the model for future checking.
+ - Coordinated Sync will also validate all elements in its list of elements whose updates failed due to locks or conflicts, according to the above rules. If an update can be performed, the element will be updated in MagicDraw and removed from the list. Similarly, if the element is equivalent between MagicDraw and MMS, the element will be removed from the list. Any elements that remain out of sync with MMS will be again displayed as a validation violation.
+
+
+Manual Syncing
+----------------
+
+Manual validation is intended to only be used to re-establish parity if it is lost, i.e. by application error, MagicDraw project reversion, etc., but models should generally be synced using Coordinated Syncing. If you have to manually validate, it is best to follow the CRUD rules about order of operations: 1) create 2) update 3) delete.
+
+Manual validation options can be found by right clicking any element and selecting the "MMS" category. The three options are as follows:
+
+- Validate Models: Run validation on the element(s) selected and all those contained by them.
+- Validate Models (specified depth): Run validation on the element(s) selected and elements that are contained by them to the specified depth.
+- Validate Element: Run validation on the element(s) selected.
+
+Resolving Conflicts and Errors
+--------------------------------
+
+During any of the MMS synchronization operations, the MDK checks for conflicts between the MMS and the MagicDraw model. These conflicts may indicate a difference between what is in the current project model and an edit in View Editor, or they may be caused by data being updated on the MMS by a different application.
+Conflicts will appear either in a Validation window, and each one may be interacted with via the context (right-click) menu in order to commit the MagicDraw version or updated from the MMS version. Additional information about the conflict may be available in the context menu as well. Error messages will appear on the Notification window, and may not be interacted with.
+
+Branch Syncing
+----------------
+
+Both TWC and MMS support branching as a part of their version control functionality. MDK syncs branches created in TWC by committing them to MMS. To validate the branches on both sides, select "MMS" from the main menu > "Validate" > "Branches". Validation rule violations will be presented if they are not in sync, and resolutions can be selected by right clicking each violation.
+
+.. note::
+
+ This applies to Teamwork Cloud (TWC) projects, but not local projects as the latter do not have branching.
+
+Feature Guide
+======================
+
+The following views are designed to provide users with information about key MDK features, including explanations of their use and how they affect a modeler on a daily basis.
+
+
+Documents and Views
+--------------------
+
+Documents and Views can be created and modeled in MagicDraw and generated to View Editor.
+
+Documents are a key part of systems engineering; through the practice of Model Based System Engineering (MBSE), documents have also been adapted so that they are able to be generated and produced from a model. Documents consist of Views, which are sections of a document. Both Documents and Views are based on Classes in UML and therefore are treated as elements in the model, with their own associated attributes and formatting metadata.
+
+
+ Implications:
+
+ A SysML model is not required to produce a document; however, the main interface between MagicDraw and View Editor, the web application, is primarily done through the interactive capabilities of documents and views. They are used to provide access to modeling data outside of the model itself.
+ Documents and views are built and configured using Section 2.4.2. More information can be found in the next view. `Open in View Editor`_
+
+Open in View Editor
+^^^^^^^^^^^^^^^^^^^^
+
+You may wish to inspect a view after generating it with the MDK, to confirm that it matches your expectations. The "Open in View Editor" feature allows you to easily open a Document of View on View Editor from its element representation in MagicDraw.
+To use this feature, right-click the element in a diagram, containment, or similar view and select "Open in View Editor" from the context menu. This feature will build a full web link to the selected View by navigating up the view hierarchy to find the Document that contains the View, and then simply open the web link in your default browser.
+If a Document or View is a child of multiple Documents, the feature will instead build a link for each Document and open a new window with a button for each Document. Clicking on one of the Documents listed will open the appropriate web link.
+If a View is not a child of any Documents, the feature will display a message in the Notification Window of MagicDraw and open the View in View Editor without a Document context.
+Use of this feature does not require you to be logged in to MMS, but does require that your model have a MMS server specified in its ModelManagementSystem stereotype.
+
+.. warning::
+ This feature requires model configuration using the `Model` documentation as described in :ref:`initialization:Configuration via JSON (New 5.1.0+)`
+
+.. note::
+ In the event that Java fails in its attempt to open a link in your default browser, a message will appear in the Notification Window of MagicDraw that includes the web address. This can by copied into your web browser to open the page manually.
+
+
+.. figure:: ./images/open-in-view-editor.png
+
+ Open In View Editor
+
+Viewpoints and Viewpoint Methods
+--------------------------------
+
+One of the defining moments for widespread adoption of SysML at JPL was when the community created "DocGen" (see DocGen), a precursor of the MDK plug-in, which gives MBSE practitioners the ability to produce documents from their models. In order to create these documents, the view and viewpoint method was introduced.
+A pattern is a set of rules governing model construction that provide standardization and consistency across models. The method for document creation is one such pattern adopted by the Object Management Group (OMG, the standards body behind SysML) and was incorporated
+into SysML 1.4.
+Viewpoints and Viewpoint Methods can be created in MagicDraw and will result in View Editor. Refer to Section 2.5.1 and Create a Reusable Cover Page for examples of using Documents, Views, Viewpoints, Viewpoint Methods, and Exposing elements.
+
+Viewpoints:
+
+- Can be thought of as the "compiler" for a view.
+- Dictate what will actually be displayed in a view.
+- Uses the viewpoint methods and the exposed elements to produce a view.
+
+Viewpoint Methods:
+
+- Are a set of rules that govern model construction to give standardization and consistency across models.
+- Can be thought of as the "constructor".
+- Consist of activity flows that are specialized to be in charge of building what the view will be.
+- The most common viewpoint method are those that make Tables - they take the exposed elements and iteratively go through them to produce the desired table. More information on how to build such a table can be found here: Section 2.5.1.3. 13
+
+Implications:
+
+Using the model, a user will consistently utilize Viewpoints and Viewpoint Methods to construct documents and views. These documents and views may contain any number of important modeling information, based on what the user desires. The user will then generate these formatted and configured documents and views so that users on View Editor can have access to the model information and data.
+
+.. note::
+ If the viewpoint method diagram is created by methods other than right clicking the viewpoint itself on the view diagram (such as right clicking the viewpoint in the containment tree), an error may occur during document generation regarding a viewpoint method. This error may be resolved by right clicking the error in the notification window > Set Nested Behavior as Viewpoint Method.
+
+ There are two ways to check for this error before view generation:
+
+ - Right click a View > DocGen > Validate View
+ - Any not compliant views will appear in the notification window. Right click error > Set Nested Behavior as Viewpoint Method
+ - Select "MDK" from the top ribbon > Validate > Views
+ - Any not compliant views will appear in the notification window. Right click error > Set Nested Behavior as Viewpoint Method
+
+\_MMSSync\_ Package
+--------------------
+
+The \_MMSSync\_ package is part of a number of sync solutions for the MMS and View Editor. Its purpose is to allow continual collaboration while a project is consistently being updated by multiple users. It does this by capturing changes between the model and the MMS server and persisting them in the model. The idea is that when an element is updated from the server, whoever is using the syncing options will capture the changes and the MDK will try to update the model itself. However, if there is some non-editable content or errors of any sort that would prevent the MDK from automatically updating, these changes will be saved in the \_MMSSync\_ package. Once stored, the changes will be tried to be resolved/updated the next time it is run.
+Although the \_MMSSync\_ package looks like an ordinary Package, users must NOT edit the content. A user may try to unlock the elements in Teamwork Cloud projects, but should not edit the elements themselves. If the user manually modifies this Package or its contents, parity and/or data could be lost.
+
+Usage:
+
+- Every project that is connected to MMS will have an \_MMSSync\_ package.
+- References to all changed (categorized as created, updated, and deleted) elements on both MagicDraw and MMS will be persisted in elements in this package.
+- These changed elements will be analyzed during sync operations to generate the necessary operations to sync the model.
+- Each element in this package will be categorized and timestamped.
+- Each element in this package is automatically managed and deleted by the MDK. No user intervention is required or recommended. See version specific implications for more information.
+- In the case that elements in this package cannot be deleted due to insufficient locks, a second element is created that signifies to sync operations that the first one can be safely ignored as its contents have already been processed.
+
+Holding Bin Package
+--------------------
+
+The "Holding Bin" Package is created for every project. Its purpose is to provide a default place to put elements that were created without an owner specified. This is often the case for Documents and Views that originated in View Editor. Elements in the Holding Bin can be moved to other locations in the project just like other model elements.
+
+.. autosummary::
+ :toctree: generated
\ No newline at end of file
diff --git a/docs/source/guide.rst b/docs/source/guide.rst
new file mode 100644
index 000000000..93cd4a2e9
--- /dev/null
+++ b/docs/source/guide.rst
@@ -0,0 +1,445 @@
+**************
+User's Guide
+**************
+
+The following views are dedicated to guiding users through some of the most commonly used workflows that involve MDK.
+
+Create and Generate Documents
+==============================
+
+The following views focus on foundational training to get any user to be able to interact with the MMS and subsequently View Editor. The goal at the end of these views is for the MDK user to be able to Section 2.5.1.1 , Section 2.5.1.1.1.1 , and Section .
+
+Creating Documents and View's
+------------------------------
+
+In these instructions, the user creates a new (blank) document in MagicDraw using MDK's tools for Documents and
+Views. Committing these new elements is required for proceeding to the next step, Section 2.5.1.1.1, where the user will generate the document so it appears on View Editor.
+
+Setup:
+ Model has been synced to MMS (See :ref:`initialization:Sync Project with MMS` for more information on this process) A new package is created for the purpose of simple organization. Each modeler should follow the modeling practices of his/her project.
+
+1. Create a View Diagram
+ - Right click the package in the containment tree where you would like to create the view diagram > create diagram > select "view diagram" from the MDK section of the diagram list
+ - New diagram is created and is displayed in the middle pane
+
+.. figure:: ./images/create-view-diagram.png
+
+ Menu when creating a new View Diagram
+
+2. Create new Document
+ - Select "Document" from the menu to the bottom left of the diagram in the center pane
+ - Click anywhere in the empty diagram to add the document
+ - Double click on the newly created document or right click > specification to open the document specification
+ - Enter a name in the name section of the specification
+
+.. figure:: ./images/create-new-document.png
+
+ View Diagram when creating a new document
+
+3. Create a View
+ - Select "View" from the menu to the bottom left of the diagram in the center pane
+ - Click anywhere in the empty diagram to add the view
+ - Double click the newly created document or right click > specification to open the view specification ◦ Enter a name in the name section of the specification
+
+4. Create a "Directed Composition" relation from the new Document to the new View
+ - Select "Directed Composition" from the menu on the bottom left of the diagram in the center pane
+ - Click on the document, then click on the view to create a directed composition relationship between them
+ - Relationship should appear between the two elements with a black diamond on the end of the document and an arrow on the end of the view
+
+.. figure:: ./images/create-directed-composition.png
+
+ Creating a directed composition relationship to a new view.
+
+Generate Views and Sync with MMS
+---------------------------------
+
+Generate select documents:
+
+1. Generate Views by right clicking the document (in diagram or containment tree) > MMS > "Generate View Contents" or "Generate View Contents Recursively".
+2. Results of generation appear in a message in the notification window
+3. Navigate to document on view editor
+4. Updated Document and views should be visible
+5. Save changes in MagicDraw
+
+.. figure:: ./images/generate-views-menu.png
+
+ Usage of right-click menu for generating views from a document or view object.
+
+
+Generate all documents in a model:
+
+1. Select "MMS" from the top ribbon >> Generate all Views
+2. Results of generation appear in a message in the notification window
+3. Navigate to the project on View Editor
+4. Updated documents and views should be visible
+5. Save changes in MagicDraw
+
+.. figure:: ./images/generate-views-top.png
+
+ Usage of top MMS menu to generate all views in a model.
+
+
+Creating a Viewpoint and Viewpoint Method
+-------------------------------------------
+
+The following instructions show one of the most basic ways of using viewpoints and viewpoint methods to construct contents of a view.
+For more information about what viewpoints and viewpoint method are, refer to :ref:`functions:viewpoints and viewpoint methods` .
+More detailed information about creating specific viewpoints and methods can be found in the :ref:`docgen:docgen users guide`.
+
+
+1. Create a new View as described in :ref:`guide:Generate Views and Sync with MMS`
+2. Create new View Point by selecting "Viewpoint" from the menu to the lower left of the view diagram and clicking on open space in the diagram. Name the View Point.
+3. Create a "Conforms" relation from the new View to the new View Point.
+ - Select "Conform" relationship from the menu to the lower left of the view diagram.
+ - Click the view, then the view point
+ - Conform relationship is displayed as a white arrow pointing to the view point.
+4. Select a diagram from the containment tree (to insert as an image) and drag it into the view diagram
+5. Create an "Expose" relation from the chosen view to the diagram
+ - Select "Expose" relationship from the menu to the lower left of the view diagram
+ - Click the view, then the diagram
+ - Expose relationship is displayed as a dotted line pointing towards the diagram
+
+ .. figure:: ./images/create-expose-relationship.png
+
+ View Diagram after adding conforms and expose relationships.
+
+6. Right click the "operations" section of the Viewpoint > Create Method > Diagram > "Viewpoint Method Diagram" under the MDK section
+
+.. _method-figure:
+
+.. figure:: ./images/add-viewpoint-method.png
+
+ Usage of right-click menu to add a Viewpoint Method.
+
+
+.. note::
+ If the viewpoint method diagram is created by other methods (such as right clicking the viewpoint in the containment tree), an error may occur during document generation regarding a viewpoint method. This error may be resolved by right clicking the error in the notification window > Set Nested Behavior as Viewpoint Method. There are two ways to check for this error before view generation:
+
+ - Right click a View > DocGen > Validate View
+ - Any not compliant views will appear in the notification window. Right click error > Set Nested Behavior as Viewpoint Method
+ - Select "MDK" from the top ribbon > Validate > Views
+ - Any not compliant views will appear in the notification window. Right click error > Set Nested Behavior as Viewpoint Method
+
+
+Insert Diagram as Image
+------------------------
+
+1. Create a new View in the Document for the table as described in :ref:`guide:Creating Documents and View's`
+2. Create new Viewpoint and Viewpoint Method as described in :ref:`guide:creating a viewpoint and viewpoint method`
+ - Name new Viewpoint
+ - Connect Viewpoint to new View via "Conforms" relationship
+
+3. Start creating the method activity on the viewpoint method diagram
+ - Insert "Initial Node" (from menu to left of diagram, under the Common section)
+ - Insert ”Image" (from menu to left of diagram, under the Templates section)
+ - Insert “Activity Final" (from menu to left of diagram, under the Common section)
+ - Connect activity flow by clicking the element, selecting "Control Flow" from the popup menu (icon is an arrow), and clicking of the subsequent element
+
+.. figure:: ./images/image-viewpoint.png
+
+ Activity diagram showing a Viewpoint Method that will export the image of an exposed diagram to View Editor
+
+4. Commit Changes
+ - From the View Diagram, right click on the document > MMS > “Generate Views Contents Recursively"
+5. Diagram should now be visible on View Editor
+
+.. figure:: ./images/diagram-on-view-editor.png
+
+ Shows what a diagram exported to View Editor might look like.
+
+Create and Generate a Table
+-----------------------------
+
+For more information about what viewpoints and viewpoint method are, refer to :ref:`functions:viewpoints and viewpoint methods` .
+More detailed information about creating specific viewpoints and methods can be found in the :ref:`docgen:docgen users guide`.
+
+1. Create a new View in the Document for the table as described in :ref:`guide:Creating Documents and View's`
+2. Create new Viewpoint and Viewpoint Method as described in :ref:`guide:creating a viewpoint and viewpoint method`
+ - Name new Viewpoint
+ - Connect Viewpoint to new View via "Conforms" relationship
+
+
+3. Drag existing package of blocks onto diagram
+ - Connect package and view via "Expose" relationship 4. Create View Point Method Diagram
+ - Right click the "operations" section of the Viewpoint > Create Method > Diagram > "Viewpoint Method Diagram" under the MDK section (see :numref:`Fig. %s `)
+
+ .. note::
+
+ If the viewpoint method diagram is created by other methods (such as right clicking the viewpoint in the containment tree), an error may occur during document generation regarding a viewpoint method. This error may be resolved by right clicking the error in the notification window > Set Nested Behavior as Viewpoint Method
+
+
+4. Start building the activity - the end result will create a table that has the name of the blocks.
+ - Create “Initial Node” from left menu
+ - Create “CollectOwnedElements” from left menu
+ - Create “FilterByStereotypes” from left menu
+ - Double click FilterByStereotypes or right click > specification
+ - Find “Stereotypes” under StereotypesChoosable > search for "Block" and select Block[Class] Sysml::Blocks
+ - Create “Table Structure” from left menu
+ - Name the table. This name will display in the view
+ - Create “Initial Node” inside the table.
+ - Create “TableAttributeColumn” inside the table.
+ - Name the column. This name will display in the view
+ - Double click TableAttributeColumn or right click > specification
+ - Find “Desired Attribute” > select desired attribute from options (ex. name)
+ - Create “Activity Final” inside the table.
+ - Create “Activity Final” outside the table, in the activity.
+ - Connect all control flows
+
+.. figure:: ./images/rapid-table-viewpoint.png
+
+ Viewpoint Method Activity for generating a simple table.
+
+
+5. From the View Diagram, right click document > MMS > “Generate View Contents Recursively"
+6. Table should be visible in view editor
+
+.. figure:: ./images/example-table.png
+
+ Example of a table that was created in a Viewpoint and exported to View Editor
+
+
+.. note::
+
+ Tables with additional columns may be created by adding more TableAttributeColumn elements into the Table Structure.
+
+Generate Views Locally
+-----------------------
+
+A user can generate Views locally as DocBook XML by right clicking a View > "DocGen" > "Generate Document".
+
+The resulting DocBook XML can then be converted to other file formats, such as PDF, Word document, etc., with third-party tools.
+
+An example of such a tool is Oxygen XML Editor.
+
+Create a Group of Documents
+============================
+
+Groups offer users the ability to better organize projects by allowing Packages to be designated as containers of Documents. Tools that visualize Documents, such as View Editor, would display these Groups in navigation. Documents that are owned by the Group (recursively) would show up under that Group. This is for organizational purposes and applies no semantics.
+
+
+1. Double click a Package that will represent a group or Right click > Specification
+2. Click "Stereotype" in the context menu.
+3. Add "Group" stereotype in the popup menu and click "Apply".
+4. Commit Changes
+
+Create Enumerated Values
+============================
+
+One of the more sophisticated features of View Editor is the option to have values be enumerated values. This means that a user will only be allowed to set an element's value to a specific set of choices. In View Editor, this is shown as a drop down list. This can be extremely useful for elements that are similar in makeup but have different properties and different values.The following instructions demonstrate how to create enumerated values so that they may be seen as drop down lists on View Editor.
+
+**Creating the Enumeration:**
+
+1. Create an "Enumeration" element
+ - Right click on a package that will contain the enumeration > create element > enumeration
+ - Name the enumeration
+
+.. figure:: ./images/create-enumeration.png
+
+ Example of creating an enumeration inside Cameo.
+
+2. Create enumeration literals. Enumeration literals represent the values that the enumeration may hold
+ - Right click on the newly created enumeration > create element > enumeration literal
+ - Name the enumeration literal
+ - Create multiple enumeration literals for each enumeration
+
+.. figure:: ./images/create-enumeration-literal.png
+
+ Menu showing how to create Enumeration Literals.
+
+.. figure:: ./images/created-enumeration-literals.png
+
+ Containment tree after adding Enumeration Literals
+
+**Create a Property Typed by Enumeration:**
+
+1. For each component that will utilize the enumeration, create a part property
+ - Right click component > create element > Part Property
+
+ .. note:: (Optional) Once the part property has been typed by the enumeration, the part may be refactored as a value property and maintains the same functionality
+
+ - Name the value property (preferably the name of the enumeration)
+
+.. figure:: ./images/create-property.png
+
+ Open create element menu showing how to create a part property
+
+2. Open the specification of the value property by double clicking or right click > specification
+ - Select the "default value" field > select the arrow to the right of the field > value specification > delete expression
+
+.. figure:: ./images/set-default-value.png
+
+ Shows clicking the default value and removing the expression
+
+3. Set the "Type" of the value property as the enumeration
+ - Open the specification of the value property by either double clicking or right click > specification
+ - Drag the enumeration from the containment tree to the "Type" field in the specification or browse for the enumeration
+
+4. Under specification, default value may now be specified as any of the enumeration literals
+
+
+**Using Enumerations in a Viewpoint Table**
+
+The following instructions demonstrate how to create enumerated values so that they may be seen as drop down lists in the column of a Table (Section 2.5.1.3) on View Editor
+
+1. Create a new View in the Document for the table as described in :ref:`guide:Creating Documents and View's`
+2. Create new Viewpoint and Viewpoint Method as described in :ref:`guide:creating a viewpoint and viewpoint method`
+ - Name new Viewpoint
+ - Connect Viewpoint to new View via "Conforms" relationship
+
+3. In the viewpoint method diagram, include the following elements:
+ - Initial node
+ - CollectOwnedElements
+ - FilterByStereotypes with stereotypes field set to the element type containing properties with enumerations (ex. block)
+ - Table Structure
+ - Activity Final node
+
+4. Within the Table structure, include the following elements:
+ - Initial node
+ - TableAttributeColumn with desired attribute (ex. name)
+ - TableAttributeColumn with desired attribute set to "value"
+ - Activity Final node
+5. Within the TableAttributeColumn with the attribute set to "value", include the following elements:
+ - Initial node
+ - CollectOwnedElements
+ - FilterByNames with the NameChoosable field set to the name of the part property with enumerated values
+ - Activity Final node
+6. Define control flow between all elements on the diagram.
+
+.. figure:: ./images/enumeration-table.png
+
+ Example Viewpoint Method that will generate a table with an enumeration value.
+
+7. Save changes
+8. Generate document
+ - Right click document > MMS > Generate View Contents Recursively
+9. See that table is generated in View Editor that includes the name of the element and its value (one of the enumeration literals). When the value is edited, the list of enumeration literals is displayed as a dropdown menu.
+
+
+
+Create Togglable Boolean Values
+================================
+
+Another relevant feature of View Editor is the option to have an element's value be Boolean. In View Editor, this is shown as a toggable check box indicating if a value is "True" or "False". This can be extremely useful for all elements that require a quick Boolean answer.
+These instructions demonstrate how to create togglable Boolean values so that they may be seen as check boxes on View Editor. This example builds off of Section 2.5.1.3 for the first table column and Section 2.5.3 for the second table column.
+
+**Create Togglable Boolean:**
+
+1. For each component that will utilize a togglable boolean, create a value property
+ - Right click component > create element > value property
+ - Name the value property
+2. Set the default value of the value property to literal boolean
+ - Double click the value property or right click > specification
+ - In the default value field, select the arrow to the right of the field box > value specification > literal boolean
+ - The default value is now a togglable true/false
+
+
+**Using Enumerations in a Viewpoint Table**
+
+The following instructions demonstrate how to create boolean values in a table so that they may toggled on or off in the column of a Table (Section 2.5.1.3) on View Editor
+
+1. Create a new View in the Document for the table as described in :ref:`guide:Creating Documents and View's`
+2. Create new Viewpoint and Viewpoint Method as described in :ref:`guide:creating a viewpoint and viewpoint method`
+ - Name new Viewpoint
+ - Connect Viewpoint to new View via "Conforms" relationship
+
+3. In the viewpoint method diagram, include the following elements:
+ - Initial node
+ - CollectOwnedElements
+ - FilterByStereotypes with stereotypes field set to the element type containing properties with enumerations (ex. block)
+ - Table Structure
+ - Activity Final node
+
+4. Within the Table structure, include the following elements:
+ - Initial node
+ - TableAttributeColumn with desired attribute (ex. name)
+ - TableAttributeColumn with desired attribute set to "value"
+ - Activity Final node
+5. Within the TableAttributeColumn with the attribute set to "value", include the following elements:
+ - Initial node
+ - CollectOwnedElements
+ - FilterByNames with the NameChoosable field set to the name of the part property with enumerated values
+ - Activity Final node
+6. Define control flow between all elements on the diagram.
+
+.. figure:: ./images/enumeration-table.png
+
+ Example Viewpoint Method that will generate a table with an enumeration value.
+
+7. Save changes
+8. Generate document
+ - Right click document > MMS > Generate View Contents Recursively
+9. See that table is generated in View Editor that includes the name of the element and its value (one of the enumeration literals). When the value is edited, the list of enumeration literals is displayed as a dropdown menu.
+
+.. figure:: ./images/enumeration-table-edit.png
+
+ Resulting table showing the dropdown menu when editing table values in View Editor.
+
+
+Create a Reusable Cover Page
+================================
+
+A user can create a reusable cover page by constructing a ViewPoint with a ViewPoint method. Once the method is made, a user can apply it to any View, and specifically to the Cover Page of a document. See Section 2.4.2 for more information about using them in general and see DocGen for more detailed information.
+This model based cover page will be reflected when generating PDFs as well. See Save As for more information on saving a document (with said cover page) in different forms, including generating a PDF.
+
+The following instructions is an overview about how to create a simple, reusable Cover Page for a document that already exists:
+
+1. Find a Document that already exists (Concise Demo Document )
+2. Open the document's View Diagram by double clicking
+ - If it has/belongs to a View Diagram, double click the Diagram and view in main window
+ - To find the View Diagram, Right Click the Document>>Go To>> Usage in Diagrams ....select the appropriate View Diagram
+ - If it does not have a View Diagram,
+ - Right click the containing package>>Create Diagram>>MDK>>View Diagram
+ - Name the View Diagram
+ - New Diagram should be shown in main window
+ - Drag the Document onto the View Diagram
+3. Set Up Document Cover Page relationships
+
+.. note::
+ Although these instructions are specifically in regards to generating a Document Cover Page, the ViewPoint can be applied to any View and would appear the same.
+
+ - Create a new Viewpoint
+ - While on the View Diagram, drag and drop the "Viewpoint" icon from the tools pane onto the Diagram
+ - Name the new Viewpoint ("Concise Demo Cover Page")
+ - Connect the Document to the new Viewpoint via a "Conforms" relationship
+ - Drag wanted elements that will be used for constructing the Cover Page
+ - Connect Document to said elements via "Expose" relationship
+4. Create View Point Method Diagram
+ - Right click the "operations" section of the Viewpoint > Create Method > Diagram > "Viewpoint Method Diagram" under the MDK section
+
+.. note::
+ If the viewpoint method diagram is created by other methods (such as right clicking the viewpoint in the containment tree), an error may occur during document generation regarding a viewpoint method. This error may be resolved by right clicking the error in the notification window > Set Nested Behavior as Viewpoint Method
+
+5. Create ViewPoint Method Activity
+ - The following activity will create a Cover Page with several presentation elements including: a title, an image, a table of contributors, several paragraphs, and signature lines with badge numbers/names of the "owners", along with some stylistic. Note: in this example, the owners and contributors are the Person blocks exposed to the Document; the viewpoint method would change depending on the context of the model i.e. a user could navigate through the model to find real owners, roles, work packages, etc. if that is what is required.
+ - To keep this User Guide succinct, the activity will only be briefly described below. More information about the used functions can be found in DocGen and later there will be specific documentation about different reusable activities
+
+.. figure:: ./images/cover-page-viewpoint.png
+
+ Concise Demo Cover Page Viewpoint
+
+The Concise Demo Cover Page is an example of a reusable cover page. It creates a cover page that includes the following:
+
+1. A title - "CAE Demo" is displayed at the top of the page and centered, according to the Paragraph function and its internal html
+2. An image - This Paragraph function includes a cross reference to a model element, whose documentation is an image.
+3. A table of contributors - This Table uses the Exposed blocks (in this case, Personnel blocks) to create a table of their Name and Email attributes.
+4. A "legal" paragraph - Similar to the title, this paragraph function creates and formats the written texts.
+5. A logo - See #2, an image
+6. A page break - this is an example of using an embedded reusable activity. In this case, there is an activity that creates a html page break and it is used here instead of creating a new one. This allows for multiple pages to be created as part of the "Cover Page"
+7. A identification paragraph - "Owned by\_", see #1 and #4,
+8. Signature lines with badge numbers/names of the "owners" - this structured query has several aspects:
+ - It's in a separate structured query, not only for clean separation of functions, but also so that it can "loop", meaning that it will repeat the internal functions for as many times as intended. In this case, there are 2 "owners" that are exposed to the VP so it repeats twice.
+ - The first paragraph is simply the html for a line and provides a place for a signature
+ - The second paragraph is constructed of OCL that finds the Owner's badge number and name and concatenates them. This specific combination may not be what is most used for most formal documents, but it demonstrates how someone could use OCL to navigate through the model and get the desired attributes.
+9. Commit to TW
+ - Collaborate>>Commit Changes to Server
+10. Generate the Cover Page
+ - In the View Diagram or in the Containment Tree, Right Click Document>>MMS>>Generate View
+11. See Cover Page on VE
+12. To see how the Cover Page will be appear as a PDF, Generate PDF of View (note: other PDF generation options are in the provided view). Below is how the Cover Page of the Concise Demo Document appears according to the Concise Demo Cover Page above:
+
+.. image:: ./images/cover-page-1.png
+
+.. image:: ./images/cover-page-2.png
+
+.. autosummary::
+ :toctree: generated
\ No newline at end of file
diff --git a/docs/source/images/add-viewpoint-method.png b/docs/source/images/add-viewpoint-method.png
new file mode 100644
index 000000000..76fe970ca
Binary files /dev/null and b/docs/source/images/add-viewpoint-method.png differ
diff --git a/docs/source/images/adding-mms-stereotype.png b/docs/source/images/adding-mms-stereotype.png
new file mode 100644
index 000000000..c937880e7
Binary files /dev/null and b/docs/source/images/adding-mms-stereotype.png differ
diff --git a/docs/source/images/cameo-create-new-project.png b/docs/source/images/cameo-create-new-project.png
new file mode 100644
index 000000000..047861405
Binary files /dev/null and b/docs/source/images/cameo-create-new-project.png differ
diff --git a/docs/source/images/configuration-via-model-properties.png b/docs/source/images/configuration-via-model-properties.png
new file mode 100644
index 000000000..b47fd6dfa
Binary files /dev/null and b/docs/source/images/configuration-via-model-properties.png differ
diff --git a/docs/source/images/cover-page-1.png b/docs/source/images/cover-page-1.png
new file mode 100644
index 000000000..8cd408d0a
Binary files /dev/null and b/docs/source/images/cover-page-1.png differ
diff --git a/docs/source/images/cover-page-2.png b/docs/source/images/cover-page-2.png
new file mode 100644
index 000000000..2abcdbc17
Binary files /dev/null and b/docs/source/images/cover-page-2.png differ
diff --git a/docs/source/images/cover-page-viewpoint.png b/docs/source/images/cover-page-viewpoint.png
new file mode 100644
index 000000000..ad1aac8a2
Binary files /dev/null and b/docs/source/images/cover-page-viewpoint.png differ
diff --git a/docs/source/images/create-directed-composition.png b/docs/source/images/create-directed-composition.png
new file mode 100644
index 000000000..0b39a3194
Binary files /dev/null and b/docs/source/images/create-directed-composition.png differ
diff --git a/docs/source/images/create-enumeration-literal.png b/docs/source/images/create-enumeration-literal.png
new file mode 100644
index 000000000..8d279bde8
Binary files /dev/null and b/docs/source/images/create-enumeration-literal.png differ
diff --git a/docs/source/images/create-enumeration.png b/docs/source/images/create-enumeration.png
new file mode 100644
index 000000000..c3c4ff6b0
Binary files /dev/null and b/docs/source/images/create-enumeration.png differ
diff --git a/docs/source/images/create-expose-relationship.png b/docs/source/images/create-expose-relationship.png
new file mode 100644
index 000000000..0b2f70c11
Binary files /dev/null and b/docs/source/images/create-expose-relationship.png differ
diff --git a/docs/source/images/create-new-document.png b/docs/source/images/create-new-document.png
new file mode 100644
index 000000000..dc3b286e4
Binary files /dev/null and b/docs/source/images/create-new-document.png differ
diff --git a/docs/source/images/create-property.png b/docs/source/images/create-property.png
new file mode 100644
index 000000000..4e51d2526
Binary files /dev/null and b/docs/source/images/create-property.png differ
diff --git a/docs/source/images/create-restricted-value.png b/docs/source/images/create-restricted-value.png
new file mode 100644
index 000000000..152b83c95
Binary files /dev/null and b/docs/source/images/create-restricted-value.png differ
diff --git a/docs/source/images/create-view-diagram.png b/docs/source/images/create-view-diagram.png
new file mode 100644
index 000000000..66bd98d16
Binary files /dev/null and b/docs/source/images/create-view-diagram.png differ
diff --git a/docs/source/images/created-enumeration-literals.png b/docs/source/images/created-enumeration-literals.png
new file mode 100644
index 000000000..7da86f4b5
Binary files /dev/null and b/docs/source/images/created-enumeration-literals.png differ
diff --git a/docs/source/images/creating-value-restrictions.png b/docs/source/images/creating-value-restrictions.png
new file mode 100644
index 000000000..a97b3209d
Binary files /dev/null and b/docs/source/images/creating-value-restrictions.png differ
diff --git a/docs/source/images/diagram-on-view-editor.png b/docs/source/images/diagram-on-view-editor.png
new file mode 100644
index 000000000..c39a2c2a2
Binary files /dev/null and b/docs/source/images/diagram-on-view-editor.png differ
diff --git a/docs/source/images/enumeration-table-edit.png b/docs/source/images/enumeration-table-edit.png
new file mode 100644
index 000000000..7bd371315
Binary files /dev/null and b/docs/source/images/enumeration-table-edit.png differ
diff --git a/docs/source/images/enumeration-table.png b/docs/source/images/enumeration-table.png
new file mode 100644
index 000000000..cd29edd12
Binary files /dev/null and b/docs/source/images/enumeration-table.png differ
diff --git a/docs/source/images/example-table.png b/docs/source/images/example-table.png
new file mode 100644
index 000000000..e0ea82568
Binary files /dev/null and b/docs/source/images/example-table.png differ
diff --git a/docs/source/images/generate-views-menu.png b/docs/source/images/generate-views-menu.png
new file mode 100644
index 000000000..1d67ada09
Binary files /dev/null and b/docs/source/images/generate-views-menu.png differ
diff --git a/docs/source/images/generate-views-top.png b/docs/source/images/generate-views-top.png
new file mode 100644
index 000000000..9473d50b6
Binary files /dev/null and b/docs/source/images/generate-views-top.png differ
diff --git a/docs/source/images/image-viewpoint.png b/docs/source/images/image-viewpoint.png
new file mode 100644
index 000000000..803f2e9f4
Binary files /dev/null and b/docs/source/images/image-viewpoint.png differ
diff --git a/docs/source/images/importing-sysml-extensions.png b/docs/source/images/importing-sysml-extensions.png
new file mode 100644
index 000000000..080f704fc
Binary files /dev/null and b/docs/source/images/importing-sysml-extensions.png differ
diff --git a/docs/source/images/mbee_project_options_enable.png b/docs/source/images/mbee_project_options_enable.png
new file mode 100644
index 000000000..3aa96d947
Binary files /dev/null and b/docs/source/images/mbee_project_options_enable.png differ
diff --git a/doc/images/mdk-installation-confirmation.png b/docs/source/images/mdk-installation-confirmation.png
similarity index 100%
rename from doc/images/mdk-installation-confirmation.png
rename to docs/source/images/mdk-installation-confirmation.png
diff --git a/doc/images/mdk-installed.png b/docs/source/images/mdk-installed.png
similarity index 100%
rename from doc/images/mdk-installed.png
rename to docs/source/images/mdk-installed.png
diff --git a/docs/source/images/open-in-view-editor.png b/docs/source/images/open-in-view-editor.png
new file mode 100644
index 000000000..d22e3b8ad
Binary files /dev/null and b/docs/source/images/open-in-view-editor.png differ
diff --git a/docs/source/images/open-project-options.png b/docs/source/images/open-project-options.png
new file mode 100644
index 000000000..b208bbc9d
Binary files /dev/null and b/docs/source/images/open-project-options.png differ
diff --git a/docs/source/images/rapid-table-viewpoint.png b/docs/source/images/rapid-table-viewpoint.png
new file mode 100644
index 000000000..b7e0ec26d
Binary files /dev/null and b/docs/source/images/rapid-table-viewpoint.png differ
diff --git a/doc/images/resource-plugin-manager.png b/docs/source/images/resource-plugin-manager.png
similarity index 100%
rename from doc/images/resource-plugin-manager.png
rename to docs/source/images/resource-plugin-manager.png
diff --git a/docs/source/images/select-mbee-project-options.png b/docs/source/images/select-mbee-project-options.png
new file mode 100644
index 000000000..180909bb6
Binary files /dev/null and b/docs/source/images/select-mbee-project-options.png differ
diff --git a/docs/source/images/set-default-value.png b/docs/source/images/set-default-value.png
new file mode 100644
index 000000000..c467eaa0e
Binary files /dev/null and b/docs/source/images/set-default-value.png differ
diff --git a/docs/source/index.rst b/docs/source/index.rst
new file mode 100644
index 000000000..e33228f26
--- /dev/null
+++ b/docs/source/index.rst
@@ -0,0 +1,19 @@
+Welcome to OpenMBEE's MDK documentation!
+=========================================
+
+The OpenMBEE **MDK** is a catch-all term for the various integration clients
+which synchronize data from/to their host applications to the broader OpenMBEE Ecosystem.
+
+Currently this site has documentation for:
+
+:doc:`cameo`
+
+
+
+Contents
+--------
+
+.. toctree::
+ :maxdepth: 3
+
+ cameo
diff --git a/docs/source/initialization.rst b/docs/source/initialization.rst
new file mode 100644
index 000000000..d02af6fd5
--- /dev/null
+++ b/docs/source/initialization.rst
@@ -0,0 +1,150 @@
+***************
+Initialization
+***************
+The following sections are designed to guide a user through initializing and configuring a project to enable the full functionality of MDK.
+Actions described below instruct the user to set up a brand new MagicDraw project that is MDK-enabled. An MDK-enabled project means that the
+entire project model will be able to sync with MMS and generate views for use in View Editor.
+
+Create New Project
+==================
+
+First you will need to create (or open and existing) project in Cameo/Magicdraw. To open a new project in Cameo:
+1. Open MagicDraw
+
+#. File > New Project
+#. Select “SysML Project” under the "Systems Engineering" section in the left side of the window
+#. Name the Project
+#. Choose project save location
+#. Select "OK"
+#. See message about System Engineering perspective
+
+ - Perspectives switch the application to the graphical user interface designed for a specific role (such as systems engineer or analyst). Perspective options as well as details about the perspectives may be found by going to the top ribbon Options > Perspectives
+
+.. figure:: ./images/cameo-create-new-project.png
+
+ Create a new SysML project
+
+
+Import MDK Module to Project
+=============================
+
+Once you have a new or existing project open you will need to mount the MDK model library (or Module) to your project.
+To mount the model library:
+
+#. Go to Options>>Project Usages
+#. Select "Use Project"
+#. Select "From predefined location"
+#. Select " /profiles" under paths to used projects
+#. Select “SysML Extensions.mdxml” from the list of projects
+#. Select "Finish"
+#. See message about showing Auxiliary Resources - choose either
+ - Showing Auxiliary resources allows project usages to be seen in the containment tree
+#. Click "OK"
+
+.. figure:: ./images/importing-sysml-extensions.png
+
+ Importing SysML Extensions
+
+
+Enable MBEE Integration
+================================
+As of version 5.1.0 there are two ways to configure your model to connect to the Model Management System
+and View Editor (5.1.0+ only).
+
+
+Configure Model for MMS and View Editor
+========================================
+
+Configuration via Project Options (New 5.1.0+)
+----------------------------------------------
+
+This is the new (preferred) way to configure MDK models. This not only allows you to configure your
+model without the use of the stereotype/tag, it also allows the configuration of the "Open in View Editor"
+menu option when right-clicking on a view.
+
+.. note::
+ Projects previously configured with the <> stereotype will have their settings
+ automatically migrated to Project Options.
+
+#. Click "Options" in the menu bar at the top and select "Project" to open the Project Options Dialog.
+
+
+ .. figure:: ./images/open-project-options.png
+
+ Menu for opening project options
+#. In the dialog box that pops up select "General>MBEE" (For TWC projects you may need to lock them)
+
+
+ .. figure:: ./images/select-mbee-project-options.png
+
+ Where to select MBEE options in Project Options Dialog
+#. To enable MMS and View Editor integration you must first set ``Enable MBEE Integration`` to true
+
+
+ .. figure:: ./images/mbee_project_options_enable.png
+
+ View of the options available for MBEE configuration
+#. Next enter the URL's for MMS and VE in their respective fields (see image above).
+
+.. warning::
+
+ You **must** specify any path (i.e. anything after the ``.extension`` or ``:port``)
+ via the `base path` property for the specific service or it will be ignored.
+
+#. Finally, click ``Okay`` to save your selections.
+
+
+.. warning::
+ If you haven't already mounted ``SysML Extensions`` to your project. MDK will throw a warning and
+ disable MBEE Integration. Add the profile and then re-enable in Project Options
+
+Configuration via Stereotype Tag (pre 5.1.0)
+--------------------------------------------
+First you must apply the Model Management System Stereotype:
+
+#. Right click "Model" package > Specification
+#. If greyed out, Model needs to be locked for teamwork before editing: Right click "Model" package > Lock element for edit
+#. Select “Applied Stereotype” and "..." in the top right corner of the section to browse for stereotype
+#. Search applied stereotypes for “MMS”
+#. Select “Model Management System” stereotype
+#. Select "Apply"
+#. Model specification should now have Model Management System stereotype in its specification
+
+
+.. figure:: ./images/adding-mms-stereotype.png
+
+ Adding MMS Stereotype
+Actions
+#. Open “Model” package specification (double click package or right click package > specification)
+#. Scroll down to MMS section
+#. Enter server name as MMS URL (e.g. https://mms.hostname.com)
+#. Select "Close"
+
+
+
+.. figure:: ./images/configuration-via-model-properties.png
+
+ Specification of Model Properties
+
+Sync Project with MMS
+======================
+
+Follow this procedure to initialize your project on the server.
+
+Add Project to MMS
+--------------------
+
+1. Login to MMS: Select "MMS" tab from top ribbon > Login > enter username and password > ok
+2. Right click “Model” > MMS > Validate Models
+3. Wait for validation window to see error
+4. Right Click error in Validation window > Commit Project and Model. Note: Error will remain visible until validation window is closed
+5. Wait for "Choose MMS Org" dialog to pop up > Select desired Org > ok
+ - New Org may be created by selecting the "New..." option from the bottom of the list and following the prompts
+#. Again, Right click "Model" > MMS > Validate Models
+#. Wait for validation window to see "holding bin missing in client" error
+#. Right click error > update element from MMS (holding bin should now be present in the containment tree)
+#. Save project locally by File > Save Project
+
+
+.. autosummary::
+ :toctree: generated
diff --git a/docs/source/usage.rst b/docs/source/usage.rst
new file mode 100644
index 000000000..924afcf6c
--- /dev/null
+++ b/docs/source/usage.rst
@@ -0,0 +1,34 @@
+Usage
+=====
+
+.. _installation:
+
+Installation
+------------
+
+To use Lumache, first install it using pip:
+
+.. code-block:: console
+
+ (.venv) $ pip install lumache
+
+Creating recipes
+----------------
+
+To retrieve a list of random ingredients,
+you can use the ``lumache.get_random_ingredients()`` function:
+
+.. autofunction:: lumache.get_random_ingredients
+
+The ``kind`` parameter should be either ``"meat"``, ``"fish"``,
+or ``"veggies"``. Otherwise, :py:func:`lumache.get_random_ingredients`
+will raise an exception.
+
+.. autoexception:: lumache.InvalidKindError
+
+For example:
+
+>>> import lumache
+>>> lumache.get_random_ingredients()
+['shells', 'gorgonzola', 'parsley']
+
diff --git a/gradle.properties b/gradle.properties
index 58e779ee4..f2705bea8 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-version=5.0.1
+version=5.1.0
group=org.openmbee.mdk.magic
descriptorFile=MDR_Plugin_Model_Development_Kit_91110_descriptor.xml
magicdDrawGroupName=gov.nasa.jpl.cae.magicdraw.mdk
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 5028f28f8..ee0ddce8b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 000000000..f9f34d74e
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,8 @@
+[build-system]
+requires = ["flit_core >=3.2,<4"]
+build-backend = "flit_core.buildapi"
+
+[project]
+name = "mdk_docs"
+authors = [{name = "OpenMBEE Community", email = "openmbee@gmail.com"}]
+dynamic = ["version", "description"]
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 000000000..e69de29bb
diff --git a/src/main/dist/plugins/gov.nasa.jpl.cae.magicdraw.mdk/mandatory.profiles b/src/main/dist/plugins/gov.nasa.jpl.cae.magicdraw.mdk/mandatory.profiles
new file mode 100644
index 000000000..9d0a00568
--- /dev/null
+++ b/src/main/dist/plugins/gov.nasa.jpl.cae.magicdraw.mdk/mandatory.profiles
@@ -0,0 +1 @@
+SysML Extensions
\ No newline at end of file
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/MDKConfigurator.java b/src/main/java/gov/nasa/jpl/mbee/mdk/MDKConfigurator.java
index d1400be74..3346f5b37 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/MDKConfigurator.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/MDKConfigurator.java
@@ -30,6 +30,7 @@
import gov.nasa.jpl.mbee.mdk.model.actions.RunUserScriptAction;
import gov.nasa.jpl.mbee.mdk.model.actions.RunUserValidationScriptAction;
import gov.nasa.jpl.mbee.mdk.ocl.actions.OclQueryAction;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
import gov.nasa.jpl.mbee.mdk.util.MDUtils;
import gov.nasa.jpl.mbee.mdk.util.TicketUtils;
import gov.nasa.jpl.mbee.mdk.util.Utils;
@@ -207,11 +208,8 @@ else if (StereotypesHelper.hasStereotypeOrDerived(e, DocGenProfile.userScriptSte
if (action == null) {
viewInstances.addAction(new GenerateViewPresentationAction(new LinkedHashSet<>(es), true));
}
-
- String url;
- if (StereotypesHelper.hasStereotype(project.getPrimaryModel(), "ModelManagementSystem")
- && (url = (String) StereotypesHelper.getStereotypePropertyFirst(project.getPrimaryModel(), "ModelManagementSystem", "MMS URL")) != null
- && !url.isEmpty()) {
+
+ if (MDKProjectOptions.getMbeeEnabled(project)) {
ActionsCategory tracingCategory = manager.getCategory("TRACING_CATEGORY");
if (tracingCategory != null) {
action = manager.getActionFor(MMSViewLinkAction.DEFAULT_ID);
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/MDKPlugin.java b/src/main/java/gov/nasa/jpl/mbee/mdk/MDKPlugin.java
index 49a6d3b20..61220b882 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/MDKPlugin.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/MDKPlugin.java
@@ -3,21 +3,11 @@
import com.nomagic.actions.ActionsCategory;
import com.nomagic.actions.ActionsManager;
import com.nomagic.actions.NMAction;
-import com.nomagic.magicdraw.actions.ActionsConfiguratorsManager;
-import com.nomagic.magicdraw.commandline.CommandLineActionManager;
-import com.nomagic.magicdraw.core.Application;
-import com.nomagic.magicdraw.core.options.EnvironmentOptions;
-import com.nomagic.magicdraw.evaluation.EvaluationConfigurator;
+import com.nomagic.magicdraw.core.Project;
+import com.nomagic.magicdraw.core.ProjectUtilities;
import com.nomagic.magicdraw.plugins.Plugin;
-import com.nomagic.magicdraw.plugins.PluginDescriptor;
import com.nomagic.magicdraw.plugins.PluginUtils;
-import com.nomagic.magicdraw.uml.DiagramDescriptor;
-import com.nomagic.magicdraw.uml.DiagramTypeConstants;
-import gov.nasa.jpl.mbee.mdk.cli.AutomatedCommitter;
-import gov.nasa.jpl.mbee.mdk.cli.AutomatedViewGenerator;
-import gov.nasa.jpl.mbee.mdk.mms.sync.status.SyncStatusConfigurator;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
-import gov.nasa.jpl.mbee.mdk.util.MDUtils;
+import com.nomagic.magicdraw.plugins.ResourceDependentPlugin;
import java.io.File;
import java.lang.reflect.Method;
@@ -28,7 +18,7 @@
import java.util.List;
import java.util.Objects;
-public class MDKPlugin extends Plugin {
+public class MDKPlugin extends Plugin implements ResourceDependentPlugin {
public static final String MAIN_TOOLBAR_CATEGORY_NAME = "MDK";
private static MDKPlugin INSTANCE;
@@ -37,10 +27,6 @@ public class MDKPlugin extends Plugin {
public static ClassLoader extensionsClassloader;
public static ActionsManager MAIN_TOOLBAR_ACTIONS_MANAGER;
- public MDKPlugin() {
- super();
- }
-
public static MDKPlugin getInstance() {
if (INSTANCE == null) {
INSTANCE = PluginUtils.getPlugins().stream()
@@ -53,9 +39,16 @@ public static MDKPlugin getInstance() {
return INSTANCE;
}
- @Deprecated
- public static String getVersion() {
- return getInstance().getDescriptor().getVersion();
+ public String getPluginName() {
+ return this.getDescriptor().getName();
+ }
+
+ public String getPluginVersion() {
+ return this.getDescriptor().getVersion();
+ }
+
+ public boolean isPluginRequired(Project var1) {
+ return ProjectUtilities.findAttachedProjectByName(var1, "SysML Extensions.mdzip") != null;
}
public static void updateMainToolbarCategory() {
@@ -82,43 +75,8 @@ public boolean close() {
@Override
public void init() {
- ActionsConfiguratorsManager acm = ActionsConfiguratorsManager.getInstance();
- if (MDUtils.isDeveloperMode()) {
- System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
- System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
- System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "INFO");
- }
- // This somehow allows things to be loaded to evaluate opaque expressions or something.
- EvaluationConfigurator.getInstance().registerBinaryImplementers(this.getClass().getClassLoader());
-
- CommandLineActionManager.getInstance().addAction(new AutomatedViewGenerator());
- CommandLineActionManager.getInstance().addAction(new AutomatedCommitter());
-
- MDKConfigurator mdkConfigurator = new MDKConfigurator();
- acm.addMainMenuConfigurator(mdkConfigurator);
- acm.addContainmentBrowserContextConfigurator(mdkConfigurator);
- acm.addSearchBrowserContextConfigurator(mdkConfigurator);
- acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, mdkConfigurator);
-
- acm.addMainMenuConfigurator(new MMSConfigurator());
- EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader());
-
- acm.addMainToolbarConfigurator(new SyncStatusConfigurator());
-
- DiagramDescriptor viewDiagramDescriptor = Application.getInstance().getDiagramDescriptor(ViewDiagramConfigurator.DIAGRAM_NAME);
- if (viewDiagramDescriptor != null) {
- ActionsConfiguratorsManager actionsConfiguratorsManager = ActionsConfiguratorsManager.getInstance();
- ViewDiagramConfigurator viewDiagramConfigurator = new ViewDiagramConfigurator();
- actionsConfiguratorsManager.addDiagramToolbarConfigurator(ViewDiagramConfigurator.DIAGRAM_NAME, viewDiagramConfigurator);
- actionsConfiguratorsManager.addTargetElementAMConfigurator(ViewDiagramConfigurator.DIAGRAM_NAME, viewDiagramConfigurator);
- }
-
- EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader());
-
- MMSSyncPlugin.getInstance().init();
-
+ (new MDKPluginHelper()).init();
loadExtensionJars();
- configureEnvironmentOptions();
initJavaFX();
}
@@ -127,6 +85,7 @@ public boolean isSupported() {
return true;
}
+
private void loadExtensionJars() {
File extensionDir = new File(getDescriptor().getPluginDirectory(), "extensions");
if (!extensionDir.exists()) {
@@ -155,11 +114,6 @@ private void loadExtensionJars() {
MDKPlugin.class.getClassLoader());
}
- private void configureEnvironmentOptions() {
- EnvironmentOptions mdkOptions = Application.getInstance().getEnvironmentOptions();
- mdkOptions.addGroup(new MDKOptionsGroup());
- }
-
private void initJavaFX() {
try {
Class.forName("javafx.application.Platform");
@@ -185,4 +139,5 @@ private void initJavaFX() {
public static boolean isJavaFXSupported() {
return JAVAFX_SUPPORTED;
}
+
}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/MDKPluginHelper.java b/src/main/java/gov/nasa/jpl/mbee/mdk/MDKPluginHelper.java
new file mode 100644
index 000000000..43257d55f
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/MDKPluginHelper.java
@@ -0,0 +1,74 @@
+package gov.nasa.jpl.mbee.mdk;
+
+import com.nomagic.magicdraw.actions.ActionsConfiguratorsManager;
+import com.nomagic.magicdraw.commandline.CommandLineActionManager;
+import com.nomagic.magicdraw.core.Application;
+import com.nomagic.magicdraw.core.options.EnvironmentOptions;
+import com.nomagic.magicdraw.evaluation.EvaluationConfigurator;
+import com.nomagic.magicdraw.uml.DiagramDescriptor;
+import com.nomagic.magicdraw.uml.DiagramTypeConstants;
+import gov.nasa.jpl.mbee.mdk.cli.AutomatedCommitter;
+import gov.nasa.jpl.mbee.mdk.cli.AutomatedViewGenerator;
+import gov.nasa.jpl.mbee.mdk.mms.sync.status.SyncStatusConfigurator;
+import gov.nasa.jpl.mbee.mdk.options.ConfigureProjectOptions;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.util.MDUtils;
+
+public class MDKPluginHelper {
+
+
+ public MDKPluginHelper() {
+
+ }
+
+ public void init() {
+ (new ConfigureProjectOptions()).configure();
+ configureEnvironmentOptions();
+
+ ActionsConfiguratorsManager acm = ActionsConfiguratorsManager.getInstance();
+ if (MDUtils.isDeveloperMode()) {
+ System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.SimpleLog");
+ System.setProperty("org.apache.commons.logging.simplelog.showdatetime", "true");
+ System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "INFO");
+ }
+ // This somehow allows things to be loaded to evaluate opaque expressions or something.
+ EvaluationConfigurator.getInstance().registerBinaryImplementers(this.getClass().getClassLoader());
+
+
+
+ CommandLineActionManager.getInstance().addAction(new AutomatedViewGenerator());
+ CommandLineActionManager.getInstance().addAction(new AutomatedCommitter());
+
+ MDKConfigurator mdkConfigurator = new MDKConfigurator();
+ acm.addMainMenuConfigurator(mdkConfigurator);
+ acm.addContainmentBrowserContextConfigurator(mdkConfigurator);
+ acm.addSearchBrowserContextConfigurator(mdkConfigurator);
+ acm.addBaseDiagramContextConfigurator(DiagramTypeConstants.UML_ANY_DIAGRAM, mdkConfigurator);
+
+ acm.addMainMenuConfigurator(new MMSConfigurator());
+ EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader());
+
+ acm.addMainToolbarConfigurator(new SyncStatusConfigurator());
+
+ DiagramDescriptor viewDiagramDescriptor = Application.getInstance().getDiagramDescriptor(ViewDiagramConfigurator.DIAGRAM_NAME);
+ if (viewDiagramDescriptor != null) {
+ ActionsConfiguratorsManager actionsConfiguratorsManager = ActionsConfiguratorsManager.getInstance();
+ ViewDiagramConfigurator viewDiagramConfigurator = new ViewDiagramConfigurator();
+ actionsConfiguratorsManager.addDiagramToolbarConfigurator(ViewDiagramConfigurator.DIAGRAM_NAME, viewDiagramConfigurator);
+ actionsConfiguratorsManager.addTargetElementAMConfigurator(ViewDiagramConfigurator.DIAGRAM_NAME, viewDiagramConfigurator);
+ }
+
+ EvaluationConfigurator.getInstance().registerBinaryImplementers(MDKPlugin.class.getClassLoader());
+
+ MMSSyncPlugin.getInstance().init();
+ }
+
+ private void configureEnvironmentOptions() {
+ EnvironmentOptions mdkOptions = Application.getInstance().getEnvironmentOptions();
+ mdkOptions.addGroup(new MDKEnvironmentOptionsGroup());
+ }
+
+
+
+
+}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/MDKProjectOptionsConfigurator.java b/src/main/java/gov/nasa/jpl/mbee/mdk/MDKProjectOptionsConfigurator.java
new file mode 100644
index 000000000..b304ae4ab
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/MDKProjectOptionsConfigurator.java
@@ -0,0 +1,24 @@
+package gov.nasa.jpl.mbee.mdk;
+
+import com.nomagic.magicdraw.core.options.ProjectOptions;
+import com.nomagic.magicdraw.core.options.ProjectOptionsConfigurator;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
+import gov.nasa.jpl.mbee.mdk.options.listener.MDKProjectOptionsChangeListener;
+import gov.nasa.jpl.mbee.mdk.options.listener.MDKProjectPartLoadedListener;
+
+public class MDKProjectOptionsConfigurator implements ProjectOptionsConfigurator {
+
+ public MDKProjectOptionsConfigurator() {
+ }
+
+ public void afterLoad(ProjectOptions projectOptions) {
+
+ }
+
+ public void configure(ProjectOptions projectOptions) {
+ MDKProjectOptions.init(projectOptions);
+ MDKProjectPartLoadedListener.getInstance();
+ MDKProjectOptionsChangeListener.getInstance();
+
+ }
+}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/MMSConfigurator.java b/src/main/java/gov/nasa/jpl/mbee/mdk/MMSConfigurator.java
index 7321539b4..19d555bb5 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/MMSConfigurator.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/MMSConfigurator.java
@@ -9,7 +9,6 @@
import gov.nasa.jpl.mbee.mdk.mms.actions.MMSLoginAction;
import gov.nasa.jpl.mbee.mdk.mms.actions.MMSLogoutAction;
import gov.nasa.jpl.mbee.mdk.mms.actions.ValidateBranchesAction;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
public class MMSConfigurator implements AMConfigurator {
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/actions/MMSViewLinkAction.java b/src/main/java/gov/nasa/jpl/mbee/mdk/actions/MMSViewLinkAction.java
index cc049b88b..3ef929014 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/actions/MMSViewLinkAction.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/actions/MMSViewLinkAction.java
@@ -9,6 +9,7 @@
import com.nomagic.uml2.ext.magicdraw.mdprofiles.Stereotype;
import gov.nasa.jpl.mbee.mdk.api.incubating.convert.Converters;
import gov.nasa.jpl.mbee.mdk.mms.MMSUtils;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
import gov.nasa.jpl.mbee.mdk.ui.ViewEditorLinkForm;
import gov.nasa.jpl.mbee.mdk.util.MDUtils;
import gov.nasa.jpl.mbee.mdk.util.Utils;
@@ -50,20 +51,14 @@ public void actionPerformed(ActionEvent e) {
}
// build url
- URIBuilder uriBase = MMSUtils.getServiceUri(project);
- if (uriBase == null) {
- Application.getInstance().getGUILog().log("[ERROR] Unable to retrieve MMS information from model stereotype. Cancelling view open.");
+ URIBuilder uriBase = MDKProjectOptions.getVeUrl(project);
+ if (uriBase == null)
return;
- }
- //projects/PROJECT-ID_5_17_16_1_31_54_PM_5fc737b6_154bba92ecd_4cc1_cae_tw_jpl_nasa_gov_127_0_0_1/master/documents/_18_5_83a025f_1491339810716_846504_4332/views/_18_5_83a025f_1491339810716_846504_4332
- // include this in the host portion of the uri. not technically correct, but it prevents the # from being converted and breaking things
- uriBase.setHost(uriBase.getHost() + "/alfresco/mmsapp/mms.html#");
- uriBase.setPath("");
- String uriPath;
+ String viewFragment;
try {
- uriPath = "/projects/" + Converters.getIProjectToIdConverter().apply(project.getPrimaryProject()) + "/" + MDUtils.getBranchId(project);
+ viewFragment = "/projects/" + Converters.getIProjectToIdConverter().apply(project.getPrimaryProject()) + "/" + MDUtils.getBranchId(project);
} catch (RuntimeException re) {
re.printStackTrace();
Application.getInstance().getGUILog().log("[ERROR] Unable to get TWC branch. Cancelling view open. Reason: " + re.getMessage());
@@ -118,12 +113,12 @@ public void actionPerformed(ActionEvent e) {
label = "Documents containing " + element.getHumanName() + ":";
for (Element doc : documents) {
if (doc.equals(element)) {
- uriPath += "/documents/" + Converters.getElementToIdConverter().apply(element);
+ viewFragment += "/documents/" + Converters.getElementToIdConverter().apply(element);
}
else {
- uriPath += "/documents/" + Converters.getElementToIdConverter().apply(doc) + "/views/" + Converters.getElementToIdConverter().apply(element);
+ viewFragment += "/documents/" + Converters.getElementToIdConverter().apply(doc) + "/views/" + Converters.getElementToIdConverter().apply(element);
}
- JButton button = new ViewButton(doc.getHumanName(), uriBase.setPath(uriPath).build());
+ JButton button = new ViewButton(doc.getHumanName(), uriBase.setFragment(viewFragment).build());
linkButtons.add(button);
}
}
@@ -138,10 +133,10 @@ public void actionPerformed(ActionEvent e) {
else {
// build single link
if (documents.isEmpty()) {
- uriPath += "/documents/" + Converters.getElementToIdConverter().apply(element) + "/views/" + Converters.getElementToIdConverter().apply(element);
+ viewFragment += "/documents/" + Converters.getElementToIdConverter().apply(element) + "/views/" + Converters.getElementToIdConverter().apply(element);
}
else {
- uriPath += "/documents/" + Converters.getElementToIdConverter().apply(documents.iterator().next()) + "/views/" + Converters.getElementToIdConverter().apply(element);
+ viewFragment += "/documents/" + Converters.getElementToIdConverter().apply(documents.iterator().next()) + "/views/" + Converters.getElementToIdConverter().apply(element);
}
// just open it if possible
if (Desktop.isDesktopSupported()) {
@@ -150,7 +145,7 @@ public void actionPerformed(ActionEvent e) {
Application.getInstance().getGUILog().log("[INFO] " + element.getHumanName()
+ " does not belong to a document hierarchy. Opening view in View Editor without document context.");
}
- Desktop.getDesktop().browse(uriBase.setPath(uriPath).build());
+ Desktop.getDesktop().browse(uriBase.setFragment(viewFragment).build());
} catch (URISyntaxException | IOException e1) {
Application.getInstance().getGUILog().log("[ERROR] An error occurred while opening the View Editor page. Link: " + uriBase.toString());
e1.printStackTrace();
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/api/incubating/MDKConstants.java b/src/main/java/gov/nasa/jpl/mbee/mdk/api/incubating/MDKConstants.java
index 6c2d5fe1a..08b7b25b8 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/api/incubating/MDKConstants.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/api/incubating/MDKConstants.java
@@ -27,7 +27,10 @@ public class MDKConstants {
INSTANCE_ID_KEY = UMLPackage.Literals.INSTANCE_VALUE__INSTANCE.getName() + ID_KEY_SUFFIX,
APPLIED_STEREOTYPE_IDS_KEY = "_appliedStereotypeIds",
DOCUMENTATION_KEY = "documentation",
+ OWNED_COMMENT_IDS_KEY = "ownedCommentIds",
IS_GROUP_KEY = "_isGroup",
+ IS_PROFILE_KEY = "_isProfile",
+ PROJECT_MMS_URL_KEY = "mmsServer",
PROPERTY_PATH_IDS_KEY = "_propertyPathIds",
CONTENTS_KEY = DERIVED_KEY_PREFIX + "contents",
DISPLAYED_ELEMENT_IDS_KEY = DERIVED_KEY_PREFIX + "displayedElement" + IDS_KEY_SUFFIX,
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/cli/AutomatedViewGenerator.java b/src/main/java/gov/nasa/jpl/mbee/mdk/cli/AutomatedViewGenerator.java
index 6a86840e7..276fd9f12 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/cli/AutomatedViewGenerator.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/cli/AutomatedViewGenerator.java
@@ -18,7 +18,7 @@
import gov.nasa.jpl.mbee.mdk.mms.MMSUtils;
import gov.nasa.jpl.mbee.mdk.mms.actions.MMSLoginAction;
import gov.nasa.jpl.mbee.mdk.mms.endpoints.*;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
import gov.nasa.jpl.mbee.mdk.tickets.BasicAuthAcquireTicketProcessor;
import gov.nasa.jpl.mbee.mdk.util.TaskRunner;
import gov.nasa.jpl.mbee.mdk.util.TicketUtils;
@@ -167,9 +167,9 @@ public byte execute(String[] args) {
ticketStore = BasicAuthAcquireTicketProcessor.getCredentialsTicket(mmsUrl, parser.getOptionValue(MMS_USERNAME), parser.getOptionValue(MMS_PASSWORD), null);
reportStatus("Started");
- MDKOptionsGroup.getMDKOptions().setLogJson(parser.hasOption(DEBUG));
+ MDKEnvironmentOptionsGroup.getInstance().setLogJson(parser.hasOption(DEBUG));
if (parser.hasOption(DEBUG)) {
- System.out.println("[DEBUG] JSON will be saved. " + MDKOptionsGroup.getMDKOptions().isLogJson());
+ System.out.println("[DEBUG] JSON will be saved. " + MDKEnvironmentOptionsGroup.getInstance().isLogJson());
}
// login TeamworkCloud, set MMS credentials
@@ -265,12 +265,12 @@ private void loadTeamworkProject() throws IOException, URISyntaxException, Inter
String projectId = parser.getOptionValue(PROJECT_ID);
String refId = parser.getOptionValue(REF_ID);
// we're using a generic request because the uri may differ from typical calls
- HttpRequestBase projectRequest = MMSUtils.prepareEndpointBuilderGenericRequest(MMSProjectEndpoint.builder(), uri, project, MMSUtils.HttpRequestType.GET, null, null)
+ HttpRequestBase projectRequest = MMSUtils.prepareEndpointBuilderGenericRequest(MMSProjectEndpoint.builder(), new URIBuilder(uri), project, MMSUtils.HttpRequestType.GET, null, null)
.addParam(MMSEndpointBuilderConstants.URI_PROJECT_SUFFIX, projectId).build();
MMSUtils.sendMMSRequest(null, projectRequest, null, projectsNode);
if (!refId.equals("master")) {
// we're using a generic request because the uri may differ from typical calls
- HttpRequestBase refRequest = MMSUtils.prepareEndpointBuilderGenericRequest(MMSRefEndpoint.builder(), uri, project, MMSUtils.HttpRequestType.GET, null, null)
+ HttpRequestBase refRequest = MMSUtils.prepareEndpointBuilderGenericRequest(MMSRefEndpoint.builder(), new URIBuilder(uri), project, MMSUtils.HttpRequestType.GET, null, null)
.addParam(MMSEndpointBuilderConstants.URI_PROJECT_SUFFIX, projectId)
.addParam(MMSEndpointBuilderConstants.URI_REF_SUFFIX, refId).build();
MMSUtils.sendMMSRequest(null, refRequest, null, refsNode);
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/emf/EMFExporter.java b/src/main/java/gov/nasa/jpl/mbee/mdk/emf/EMFExporter.java
index 51c5027df..6e484e038 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/emf/EMFExporter.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/emf/EMFExporter.java
@@ -36,6 +36,8 @@
import java.util.*;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
public class EMFExporter implements BiFunction {
@Override
@@ -187,9 +189,9 @@ private enum Processor {
},
Type.PRE
),
- DOCUMENTATION(
+ DOCUMENTATION_PRE(
(element, project, objectNode) -> {
- objectNode.put(MDKConstants.DOCUMENTATION_KEY, ModelHelper.getComment(element));
+ objectNode.put(MDKConstants.DOCUMENTATION_KEY, (String) Utils.getElementAttribute(element, Utils.AvailableAttribute.Documentation));
return objectNode;
},
Type.PRE
@@ -307,6 +309,30 @@ private enum Processor {
return objectNode;
},
Type.POST
+ ),
+ DOCUMENTATION_POST(
+ (element, project, objectNode) -> {
+ if (element != null) {
+ Element docEl = Utils.getDocumentationElement(element);
+ if (docEl != null) {
+ ArrayNode ownedCommentIds = ((ArrayNode) objectNode.get(MDKConstants.OWNED_COMMENT_IDS_KEY));
+ for (int i = 0; i < ownedCommentIds.size(); i++) {
+ if (ownedCommentIds.get(i).asText().equals(getEID(docEl)))
+ ownedCommentIds.remove(i);
+ }
+ if (ownedCommentIds.size() == 0) {
+ objectNode.remove(MDKConstants.OWNED_COMMENT_IDS_KEY);
+ } else {
+ objectNode.replace(MDKConstants.OWNED_COMMENT_IDS_KEY, ownedCommentIds);
+ }
+
+ }
+
+ }
+
+ return objectNode;
+ },
+ Type.POST
);
private TriFunction function;
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/json/JacksonUtils.java b/src/main/java/gov/nasa/jpl/mbee/mdk/json/JacksonUtils.java
index adc99a9fa..9cb2f18aa 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/json/JacksonUtils.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/json/JacksonUtils.java
@@ -8,7 +8,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.node.NullNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
import gov.nasa.jpl.mbee.mdk.util.MDUtils;
import org.apache.commons.lang.math.NumberUtils;
import gov.nasa.jpl.mbee.mdk.api.incubating.MDKConstants;
@@ -30,7 +30,7 @@ public static ObjectMapper getObjectMapper() {
OBJECT_MAPPER_INSTANCE = new ObjectMapper();
if (MDUtils.isDeveloperMode()) {
OBJECT_MAPPER_INSTANCE.configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
- if (MDKOptionsGroup.getMDKOptions().isLogJson()) {
+ if (MDKEnvironmentOptionsGroup.getInstance().isLogJson()) {
OBJECT_MAPPER_INSTANCE.enable(SerializationFeature.INDENT_OUTPUT);
}
}
@@ -117,6 +117,11 @@ public static ObjectNode parseJsonObject(JsonParser jsonParser) throws IOExcepti
return getObjectMapper().readTree(jsonParser);
}
+ public static ObjectNode parseJsonString(String string) throws IOException {
+ JsonParser parser = JacksonUtils.getJsonFactory().createParser(string);
+ return parseJsonObject(parser);
+ }
+
public static Map> parseResponseIntoObjects(File responseFile, String expectedKey) throws IOException {
JsonToken current;
Map> parsedResponseObjects = new HashMap<>();
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/json/TempFileJsonFactory.java b/src/main/java/gov/nasa/jpl/mbee/mdk/json/TempFileJsonFactory.java
index 3e0537ba3..401bb0142 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/json/TempFileJsonFactory.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/json/TempFileJsonFactory.java
@@ -5,12 +5,10 @@
import com.fasterxml.jackson.core.util.JsonParserDelegate;
import com.fasterxml.jackson.databind.MappingJsonFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
-import gov.nasa.jpl.mbee.mdk.json.JacksonUtils;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
import java.io.File;
import java.io.IOException;
-import java.util.Objects;
class TempFileJsonFactory extends MappingJsonFactory {
@@ -42,7 +40,7 @@ public TempFileJsonParser(JsonParser d, File file) {
@Override
public void close() throws IOException {
- if (file != null && (MDKOptionsGroup.getMDKOptions().isLogJson() || !file.delete())) {
+ if (file != null && (MDKEnvironmentOptionsGroup.getInstance().isLogJson() || !file.delete())) {
file.deleteOnExit();
}
super.close();
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/MMSUtils.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/MMSUtils.java
index 4dbf60305..8b35f3cc9 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/MMSUtils.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/MMSUtils.java
@@ -5,14 +5,9 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
import com.nomagic.magicdraw.core.Application;
import com.nomagic.magicdraw.core.Project;
-import com.nomagic.magicdraw.core.ProjectUtilities;
import com.nomagic.task.ProgressStatus;
-import com.nomagic.uml2.ext.jmi.helpers.StereotypesHelper;
-import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
import gov.nasa.jpl.mbee.mdk.MDKPlugin;
import gov.nasa.jpl.mbee.mdk.api.incubating.MDKConstants;
import gov.nasa.jpl.mbee.mdk.api.incubating.convert.Converters;
@@ -20,10 +15,10 @@
import gov.nasa.jpl.mbee.mdk.json.JacksonUtils;
import gov.nasa.jpl.mbee.mdk.mms.actions.MMSLogoutAction;
import gov.nasa.jpl.mbee.mdk.mms.endpoints.*;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
import gov.nasa.jpl.mbee.mdk.util.MDUtils;
import gov.nasa.jpl.mbee.mdk.util.TaskRunner;
-import gov.nasa.jpl.mbee.mdk.util.Utils;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
@@ -33,7 +28,6 @@
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
-import javax.swing.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URISyntaxException;
@@ -49,7 +43,7 @@ public class MMSUtils {
private static final int CHECK_CANCEL_DELAY = 100;
private static final AtomicReference LAST_EXCEPTION = new AtomicReference<>();
- private static final Cache PROFILE_SERVER_CACHE = CacheBuilder.newBuilder().weakKeys().maximumSize(100).expireAfterAccess(10, TimeUnit.MINUTES).build();
+
public enum HttpRequestType {
GET, POST, PUT, DELETE
@@ -139,7 +133,7 @@ public static String validateCredentialsTicket(Project project, String ticket, P
public static File createEntityFile(Class> clazz, ContentType contentType, Collection> nodes, JsonBlobType jsonBlobType) throws IOException {
File requestFile = File.createTempFile(clazz.getSimpleName() + "-" + contentType.getMimeType().replace('/', '-') + "-", null);
- if (MDKOptionsGroup.getMDKOptions().isLogJson()) {
+ if (MDKEnvironmentOptionsGroup.getInstance().isLogJson()) {
System.out.println("[INFO] Request Body: " + requestFile.getPath());
Application.getInstance().getGUILog().log("[INFO] Request Body: " + requestFile.getPath());
}
@@ -260,7 +254,7 @@ public static File sendMMSRequest(Project project, HttpRequestBase request, Prog
CloseableHttpResponse response = httpclient.execute(request);
InputStream inputStream = response.getEntity().getContent()) {
responseCode.set(response.getStatusLine().getStatusCode());
- if (MDKOptionsGroup.getMDKOptions().isLogJson()) {
+ if (MDKEnvironmentOptionsGroup.getInstance().isLogJson()) {
System.out.println("[INFO] MMS Response [" + request.getMethod() + "]: " + responseCode.get() + " " + request.getURI().toString());
}
if (inputStream != null) {
@@ -332,7 +326,7 @@ private static String generateMmsOutput(InputStream inputStream, final File resp
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
- if (MDKOptionsGroup.getMDKOptions().isLogJson()) {
+ if (MDKEnvironmentOptionsGroup.getInstance().isLogJson()) {
System.out.println("[INFO] Response Body: " + responseFile.getPath());
Application.getInstance().getGUILog().log("[INFO] Response Body: " + responseFile.getPath());
}
@@ -370,43 +364,7 @@ else if (responseCode != HttpURLConnection.HTTP_OK && responseCode != HttpURLCon
return !throwServerException;
}
- /**
- * @param project
- * @return
- * @throws IllegalStateException
- */
- public static String getServerUrl(Project project) throws IllegalStateException {
- String urlString;
- if (project == null) {
- throw new IllegalStateException("Project is null.");
- }
- Element primaryModel = project.getPrimaryModel();
- if (primaryModel == null) {
- throw new IllegalStateException("Model is null.");
- }
- if (StereotypesHelper.hasStereotype(primaryModel, "ModelManagementSystem")) {
- urlString = (String) StereotypesHelper.getStereotypePropertyFirst(primaryModel, "ModelManagementSystem", "MMS URL");
- }
- else if (ProjectUtilities.isStandardSystemProfile(project.getPrimaryProject())) {
- urlString = PROFILE_SERVER_CACHE.getIfPresent(project);
- if (urlString == null) {
- urlString = JOptionPane.showInputDialog("Specify server URL for standard profile.", null);
- }
- if (urlString == null || urlString.trim().isEmpty()) {
- return null;
- }
- PROFILE_SERVER_CACHE.put(project, urlString);
- }
- else {
- Utils.showPopupMessage("The root element does not have the ModelManagementSystem stereotype.\nPlease apply it and specify the server information.");
- return null;
- }
- if (urlString == null || urlString.isEmpty()) {
- return null;
- }
- return urlString.trim();
- }
public static String getMmsOrg(Project project)
throws IOException, URISyntaxException, ServerException, GeneralSecurityException {
@@ -428,47 +386,6 @@ public static String getMmsOrg(Project project)
return null;
}
- /**
- * Returns a URIBuilder object with a path = "/alfresco/service". Used as the base for all of the rest of the
- * URIBuilder generating convenience classes.
- *
- * @param project The project to gather the mms url and site name information from
- * @return URIBuilder
- * @throws URISyntaxException
- */
- public static URIBuilder getServiceUri(Project project) {
- return getServiceUri(project, null);
- }
-
- public static URIBuilder getServiceUri(String baseUrl) {
- return getServiceUri(null, baseUrl);
- }
-
- private static URIBuilder getServiceUri(Project project, String baseUrl) {
- String urlString = project == null ? baseUrl : getServerUrl(project);
- if (urlString == null) {
- return null;
- }
-
- // [scheme:][//host][path][?query][#fragment]
-
- URIBuilder uri;
- try {
- uri = new URIBuilder(urlString);
- } catch (URISyntaxException e) {
- Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of MMS URL for project. Reason: " + e.getMessage());
- e.printStackTrace();
- return null;
- }
- String path = Optional.ofNullable(uri.getPath()).orElse("");
- if (path.endsWith("/")) {
- path = path.substring(0, path.length() - 1);
- }
- uri.setPath(path);
- return uri;
-
- }
-
public static MMSEndpoint.Builder prepareEndpointBuilderBasicGet(MMSEndpoint.Builder builder, Project project) {
return prepareEndpointBuilderBasicRequest(builder, project, HttpRequestType.GET, null, null);
}
@@ -490,11 +407,11 @@ public static MMSEndpoint.Builder prepareEndpointBuilderBasicJsonDeleteRequest(M
}
public static MMSEndpoint.Builder prepareEndpointBuilderBasicRequest(MMSEndpoint.Builder builder, Project project, HttpRequestType requestType, ContentType contentType, File file) {
- return prepareEndpointBuilderGenericRequest(builder, MMSUtils.getServerUrl(project), project, requestType, contentType, file);
+ return prepareEndpointBuilderGenericRequest(builder, MDKProjectOptions.getMmsUrl(project), project, requestType, contentType, file);
}
- public static MMSEndpoint.Builder prepareEndpointBuilderGenericRequest(MMSEndpoint.Builder builder, String uri, Project project, HttpRequestType requestType, ContentType contentType, File file) {
- return builder.addParam(MMSEndpointBuilderConstants.URI_BASE_PATH, uri)
+ public static MMSEndpoint.Builder prepareEndpointBuilderGenericRequest(MMSEndpoint.Builder builder, URIBuilder uri, Project project, HttpRequestType requestType, ContentType contentType, File file) {
+ return builder.addUri(uri)
.addParam(MMSEndpointBuilderConstants.HTTP_REQUEST_TYPE, requestType)
.addParam(MMSEndpointBuilderConstants.MAGICDRAW_PROJECT, project)
.addParam(MMSEndpointBuilderConstants.REST_CONTENT_TYPE, contentType)
@@ -503,7 +420,7 @@ public static MMSEndpoint.Builder prepareEndpointBuilderGenericRequest(MMSEndpoi
public static MMSEndpoint.Builder prepareEndpointBuilderEntityRequest(MMSEndpoint.Builder builder, Project project, HttpRequestType requestType, HttpEntity entity) {
return builder.addParam(MMSEndpointBuilderConstants.HTTP_ENTITY, entity)
- .addParam(MMSEndpointBuilderConstants.URI_BASE_PATH, MMSUtils.getServerUrl(project))
+ .addParam(MMSEndpointBuilderConstants.URI_BASE_PATH, MDKProjectOptions.getMmsUrl(project))
.addParam(MMSEndpointBuilderConstants.HTTP_REQUEST_TYPE, requestType)
.addParam(MMSEndpointBuilderConstants.MAGICDRAW_PROJECT, project);
}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/CommitClientElementAction.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/CommitClientElementAction.java
index 3366397ac..04aade71d 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/CommitClientElementAction.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/CommitClientElementAction.java
@@ -28,10 +28,7 @@
import java.net.URISyntaxException;
import java.security.GeneralSecurityException;
import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
+import java.util.*;
/**
* Created by igomes on 9/27/16.
@@ -43,13 +40,15 @@ public class CommitClientElementAction extends RuleViolationAction implements An
private final String elementID;
private final Element element;
private final ObjectNode elementObjectNode;
+ private final ObjectNode serverObjectNode;
private final Project project;
- public CommitClientElementAction(String elementID, Element element, ObjectNode elementObjectNode, Project project) {
+ public CommitClientElementAction(String elementID, Element element, ObjectNode elementObjectNode, ObjectNode serverObjectNode, Project project) {
super(DEFAULT_ID, DEFAULT_ID, null, null);
this.elementID = elementID;
this.element = element;
this.elementObjectNode = elementObjectNode;
+ this.serverObjectNode = serverObjectNode;
this.project = project;
}
@@ -61,8 +60,11 @@ public void execute(Collection annotations) {
for (Annotation annotation : annotations) {
for (NMAction action : annotation.getActions()) {
if (action instanceof CommitClientElementAction) {
+ ObjectNode serverObjectNode = ((CommitClientElementAction) action).getServerObjectNode();
ObjectNode elementObjectNode = ((CommitClientElementAction) action).getElementObjectNode();
if (elementObjectNode != null) {
+ if (serverObjectNode != null && serverObjectNode.get(MDKConstants.CONTENTS_KEY) != null && !serverObjectNode.get(MDKConstants.CONTENTS_KEY).isEmpty())
+ elementObjectNode.set(MDKConstants.CONTENTS_KEY, serverObjectNode.get(MDKConstants.CONTENTS_KEY));
elementsToUpdate.add(elementObjectNode);
}
else if (elementID.startsWith(MDKConstants.HOLDING_BIN_ID_PREFIX)) {
@@ -100,6 +102,10 @@ public ObjectNode getElementObjectNode() {
return elementObjectNode;
}
+ public ObjectNode getServerObjectNode() {
+ return serverObjectNode;
+ }
+
@Override
public void actionPerformed(@CheckForNull ActionEvent actionEvent) {
List elementsToUpdate = new ArrayList<>(1);
@@ -125,10 +131,12 @@ private static void request(List elementsToUpdate, List elem
Application.getInstance().getGUILog().log("[INFO] Queuing request to create/update " + NumberFormat.getInstance().format(elementsToUpdate.size()) + " element" + (elementsToUpdate.size() != 1 ? "s" : "") + " on MMS.");
try {
File file = MMSUtils.createEntityFile(CommitClientElementAction.class, ContentType.APPLICATION_JSON, elementsToUpdate, MMSUtils.JsonBlobType.ELEMENT_JSON);
+ HashMap uriBuilderParams = new HashMap<>();
+ uriBuilderParams.put("overwrite", "true");
HttpRequestBase elementsUpdateCreateRequest = MMSUtils.prepareEndpointBuilderBasicJsonPostRequest(MMSElementsEndpoint.builder(), project, file)
.addParam(MMSEndpointBuilderConstants.URI_PROJECT_SUFFIX, projectId)
.addParam(MMSEndpointBuilderConstants.URI_REF_SUFFIX, refId)
- .addParam("overwrite", "true")
+ .addParam(MMSEndpointBuilderConstants.URI_BUILDER_PARAMETERS, uriBuilderParams)
.build();
TaskRunner.runWithProgressStatus(progressStatus -> {
try {
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/CommitProjectAction.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/CommitProjectAction.java
index 148c19305..e8e4e3ff1 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/CommitProjectAction.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/CommitProjectAction.java
@@ -7,6 +7,7 @@
import com.nomagic.magicdraw.annotation.AnnotationAction;
import com.nomagic.magicdraw.core.Application;
import com.nomagic.magicdraw.core.Project;
+import com.nomagic.magicdraw.core.ProjectUtilities;
import com.nomagic.task.RunnableWithProgress;
import com.nomagic.ui.ProgressStatusRunner;
import gov.nasa.jpl.mbee.mdk.api.incubating.MDKConstants;
@@ -104,6 +105,10 @@ public String commitAction() {
JsonNode name, id;
if ((name = orgNode.get(MDKConstants.NAME_KEY)) != null && name.isTextual() && !name.asText().isEmpty()
&& (id = orgNode.get(MDKConstants.ID_KEY)) != null && id.isTextual() && !id.asText().isEmpty()) {
+ // Only allow Public Orgs for Standard Profiles
+ if (ProjectUtilities.isStandardSystemProfile(project.getPrimaryProject()) && !orgNode.get("public").asBoolean()) {
+ break;
+ }
mmsOrgs.add(new Pair(id.asText(), name.asText()) {
@Override
public String toString() {
@@ -115,6 +120,7 @@ public String toString() {
}
}
mmsOrgs.sort(Comparator.comparing(Pair::toString));
+
mmsOrgs.add(new Pair(NEW_ORG_VALUE, "New...") {
@Override
public String toString() {
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/GeneratePdfAction.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/GeneratePdfAction.java
index 9d582221a..908206065 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/GeneratePdfAction.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/GeneratePdfAction.java
@@ -12,7 +12,7 @@
import gov.nasa.jpl.mbee.mdk.generator.DocumentGenerator;
import gov.nasa.jpl.mbee.mdk.generator.PostProcessor;
import gov.nasa.jpl.mbee.mdk.model.Document;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
import gov.nasa.jpl.mbee.mdk.util.Utils;
import org.apache.commons.lang.exception.ExceptionUtils;
@@ -99,8 +99,8 @@ public void actionPerformed(ActionEvent e) {
}
protected boolean checkForStyleSheetXmlFile() {
Application.getInstance().getGUILog().log("[INFO] The default stylesheet can be set at \"Default Docbook to PDF Stylesheet\" in Options -> Environment -> MDK");
- if (MDKOptionsGroup.getMDKOptions().getDocBookToPDFStyleSheet() != null && !MDKOptionsGroup.getMDKOptions().getDocBookToPDFStyleSheet().trim().isEmpty()) {
- xslDefaultFile = new File(MDKOptionsGroup.getMDKOptions().getDocBookToPDFStyleSheet().trim());
+ if (MDKEnvironmentOptionsGroup.getInstance().getDocBookToPDFStyleSheet() != null && !MDKEnvironmentOptionsGroup.getInstance().getDocBookToPDFStyleSheet().trim().isEmpty()) {
+ xslDefaultFile = new File(MDKEnvironmentOptionsGroup.getInstance().getDocBookToPDFStyleSheet().trim());
}
else {
xslDefaultFile = new File(MDKPlugin.getInstance().getDescriptor().getPluginDirectory(), "docbook-xsl" + File.separator + "fo" + File.separator + "mdk-default.xsl");
@@ -119,7 +119,7 @@ protected boolean checkForStyleSheetXmlFile() {
}
}
else {
- MDKOptionsGroup.getMDKOptions().setDocBookToPDFStyleSheet(xslDefaultFile.getAbsolutePath());
+ MDKEnvironmentOptionsGroup.getInstance().setDocBookToPDFStyleSheet(xslDefaultFile.getAbsolutePath());
}
Application.getInstance().getGUILog().log("[INFO] The stylesheet selected is " + xslDefaultFile.getAbsolutePath());
return true;
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/ValidateBranchesAction.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/ValidateBranchesAction.java
index 656953ba1..41400e40b 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/ValidateBranchesAction.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/actions/ValidateBranchesAction.java
@@ -5,7 +5,6 @@
import com.nomagic.task.RunnableWithProgress;
import com.nomagic.ui.ProgressStatusRunner;
import gov.nasa.jpl.mbee.mdk.mms.validation.BranchValidator;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
import gov.nasa.jpl.mbee.mdk.util.TicketUtils;
import java.awt.event.ActionEvent;
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSEndpoint.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSEndpoint.java
index bdc1f8f55..662599303 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSEndpoint.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSEndpoint.java
@@ -21,7 +21,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import static gov.nasa.jpl.mbee.mdk.mms.MMSUtils.HttpRequestType.*;
@@ -35,6 +34,11 @@ public MMSEndpoint(String baseUri) throws URISyntaxException {
this.baseUri = baseUri;
}
+ public MMSEndpoint(URIBuilder uri) {
+ uriBuilder = uri;
+ this.baseUri = uri.toString();
+ }
+
public void setParameter(String key, String value) {
uriBuilder.setParameter(key, value);
}
@@ -53,6 +57,11 @@ public Builder addParam(String key, Object value) {
return this;
}
+ public Builder addUri(URIBuilder newUri) {
+ uriBuilder = newUri;
+ return this;
+ }
+
private Object getParam(String key) {
return buildParams.get(key);
}
@@ -62,6 +71,11 @@ protected String getStringParam(String key) {
return value instanceof String ? (String) value : "";
}
+ protected URIBuilder getURIParam(String key) {
+ Object value = buildParams.get(key);
+ return value instanceof URIBuilder ? (URIBuilder) value : null;
+ }
+
protected Boolean getBooleanParam(String key) {
Object value = buildParams.get(key);
return value instanceof Boolean ? (Boolean) value : false;
@@ -104,13 +118,21 @@ protected void processUriBuilderParams() {
}
}
- public HttpRequestBase build() throws IOException, URISyntaxException {
+ protected void configureUri() throws URISyntaxException{
if(uriBuilder == null) {
- String baseUri = getStringParam(MMSEndpointBuilderConstants.URI_BASE_PATH);
- if(!baseUri.isEmpty()) {
- uriBuilder = new URIBuilder(baseUri);
+ uriBuilder = getURIParam(MMSEndpointBuilderConstants.URI_BASE_PATH);
+ if (uriBuilder == null){
+ String baseUri = getStringParam(MMSEndpointBuilderConstants.URI_BASE_PATH);
+ if(!baseUri.isEmpty()) {
+ uriBuilder = new URIBuilder(baseUri);
+ }
}
+
}
+ }
+
+ public HttpRequestBase build() throws IOException, URISyntaxException {
+ configureUri();
if(uriBuilder != null) {
prepareUriPath();
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSLoginEndpoint.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSLoginEndpoint.java
index 879d82b69..b989fe612 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSLoginEndpoint.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSLoginEndpoint.java
@@ -35,12 +35,7 @@ public void prepareUriPath() {
@Override
public HttpRequestBase build() throws IOException, URISyntaxException {
- if (uriBuilder == null) {
- String baseUri = getStringParam(MMSEndpointBuilderConstants.URI_BASE_PATH);
- if (!baseUri.isEmpty()) {
- uriBuilder = new URIBuilder(baseUri);
- }
- }
+ configureUri();
if (uriBuilder != null) {
prepareUriPath();
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSTWCLoginEndpoint.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSTWCLoginEndpoint.java
index 5cd5bc5d9..b928e95b3 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSTWCLoginEndpoint.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/endpoints/MMSTWCLoginEndpoint.java
@@ -27,12 +27,7 @@ public void prepareUriPath() {
@Override
public HttpRequestBase build() throws IOException, URISyntaxException {
- if (uriBuilder == null) {
- String baseUri = getStringParam(MMSEndpointBuilderConstants.URI_BASE_PATH);
- if (!baseUri.isEmpty()) {
- uriBuilder = new URIBuilder(baseUri);
- }
- }
+ configureUri();
if (uriBuilder != null) {
prepareUriPath();
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/coordinated/CoordinatedSyncProjectEventListenerAdapter.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/coordinated/CoordinatedSyncProjectEventListenerAdapter.java
index f03a09372..92c5ca704 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/coordinated/CoordinatedSyncProjectEventListenerAdapter.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/coordinated/CoordinatedSyncProjectEventListenerAdapter.java
@@ -11,7 +11,8 @@
import com.nomagic.uml2.ext.jmi.helpers.StereotypesHelper;
import gov.nasa.jpl.mbee.mdk.mms.actions.MMSLoginAction;
import gov.nasa.jpl.mbee.mdk.mms.sync.delta.DeltaSyncRunner;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
import gov.nasa.jpl.mbee.mdk.util.TicketUtils;
import javax.annotation.CheckForNull;
@@ -45,7 +46,7 @@ public void projectPreSaved(Project project, boolean savedInServer) {
return;
}*/
if ((project.isRemote() && !savedInServer)
- || !StereotypesHelper.hasStereotype(project.getPrimaryModel(), "ModelManagementSystem")
+ || !MDKProjectOptions.getMbeeEnabled(project)
|| CoordinatedSyncProjectEventListenerAdapter.getProjectMapping(project).isDisabled()
|| !TicketUtils.isTicketSet(project)) {
// skip csync
@@ -94,7 +95,7 @@ public boolean isReadyForCommit(IProject iProject, @CheckForNull String s) {
if (project == null) {
return true;
}
- if (!StereotypesHelper.hasStereotype(project.getPrimaryModel(), "ModelManagementSystem")) {
+ if (!MDKProjectOptions.getMbeeEnabled(project)) {
return true;
}
if (CoordinatedSyncProjectEventListenerAdapter.getProjectMapping(project).isDisabled()) {
@@ -115,7 +116,7 @@ public static class CoordinatedSyncProjectMapping {
private boolean disabled;
public synchronized boolean isDisabled() {
- return (disabled || !MDKOptionsGroup.getMDKOptions().isCoordinatedSyncEnabled());
+ return (disabled || !MDKEnvironmentOptionsGroup.getInstance().isCoordinatedSyncEnabled());
}
public synchronized void setDisabled(boolean disabled) {
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/delta/DeltaSyncProjectEventListenerAdapter.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/delta/DeltaSyncProjectEventListenerAdapter.java
index e4a4da44a..0d2d5878c 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/delta/DeltaSyncProjectEventListenerAdapter.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/delta/DeltaSyncProjectEventListenerAdapter.java
@@ -8,8 +8,8 @@
import gov.nasa.jpl.mbee.mdk.json.JacksonUtils;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaProjectEventListenerAdapter;
import gov.nasa.jpl.mbee.mdk.mms.sync.local.LocalDeltaTransactionCommitListener;
-import gov.nasa.jpl.mbee.mdk.mms.sync.mms.MMSDeltaProjectEventListenerAdapter;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
import gov.nasa.jpl.mbee.mdk.util.Changelog;
import java.util.HashMap;
@@ -44,11 +44,11 @@ public class DeltaSyncProjectEventListenerAdapter extends ProjectEventListenerAd
@Override
public void projectPreSaved(Project project, boolean savedInServer) {
- boolean save = MDKOptionsGroup.getMDKOptions().isPersistChangelog();
+ boolean save = MDKEnvironmentOptionsGroup.getInstance().isPersistChangelog();
if (!save) {
return;
}
- if (!StereotypesHelper.hasStereotype(project.getPrimaryModel(), "ModelManagementSystem")) {
+ if (!MDKProjectOptions.getMbeeEnabled(project)) {
return;
}
persistChanges(project);
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/delta/DeltaSyncRunner.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/delta/DeltaSyncRunner.java
index 228bf36b7..fcaae87c7 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/delta/DeltaSyncRunner.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/delta/DeltaSyncRunner.java
@@ -322,10 +322,12 @@ else if (shouldUpdate && mmsChange != null) {
if (!postElements.isEmpty()) {
try {
File file = MMSUtils.createEntityFile(this.getClass(), ContentType.APPLICATION_JSON, postElements, MMSUtils.JsonBlobType.ELEMENT_JSON);
+ // HashMap uriBuilderParams = new HashMap<>();
+ // uriBuilderParams.put("overwrite", "true"); // Removing so Overwrite doesnt happen on DeltaSync
HttpRequestBase elementsUpdateCreateRequest = MMSUtils.prepareEndpointBuilderBasicJsonPostRequest(MMSElementsEndpoint.builder(), project, file)
.addParam(MMSEndpointBuilderConstants.URI_PROJECT_SUFFIX, projectId)
.addParam(MMSEndpointBuilderConstants.URI_REF_SUFFIX, refId)
- .addParam("overwrite", "true") // Prevent potential "Not Equivalent" errors due to default merging of element data.
+ // .addParam(MMSEndpointBuilderConstants.URI_BUILDER_PARAMETERS, uriBuilderParams) // Removing so Overwrite doesnt happen on DeltaSync
.build();
TaskRunner.runWithProgressStatus(progressStatus1 -> {
try {
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/local/LocalDeltaTransactionCommitListener.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/local/LocalDeltaTransactionCommitListener.java
index 30124372d..f1703f854 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/local/LocalDeltaTransactionCommitListener.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/local/LocalDeltaTransactionCommitListener.java
@@ -11,7 +11,7 @@
import gov.nasa.jpl.mbee.mdk.api.incubating.MDKConstants;
import gov.nasa.jpl.mbee.mdk.api.incubating.convert.Converters;
import gov.nasa.jpl.mbee.mdk.mms.sync.status.SyncStatusConfigurator;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
import gov.nasa.jpl.mbee.mdk.util.Changelog;
import gov.nasa.jpl.mbee.mdk.util.MDUtils;
@@ -58,7 +58,7 @@ public LocalDeltaTransactionCommitListener(Project project) {
public boolean isDisabled() {
synchronized (this.disabled) {
- return (disabled.get() || !MDKOptionsGroup.getMDKOptions().isChangeListenerEnabled());
+ return (disabled.get() || !MDKEnvironmentOptionsGroup.getInstance().isChangeListenerEnabled());
}
}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/mms/MMSDeltaProjectEventListenerAdapter.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/mms/MMSDeltaProjectEventListenerAdapter.java
index 561dcb56b..514705e9c 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/mms/MMSDeltaProjectEventListenerAdapter.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/sync/mms/MMSDeltaProjectEventListenerAdapter.java
@@ -20,6 +20,7 @@
import gov.nasa.jpl.mbee.mdk.mms.sync.delta.SyncElement;
import gov.nasa.jpl.mbee.mdk.mms.sync.delta.SyncElements;
import gov.nasa.jpl.mbee.mdk.mms.sync.status.SyncStatusConfigurator;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
import gov.nasa.jpl.mbee.mdk.util.*;
import org.apache.http.client.methods.HttpRequestBase;
@@ -49,7 +50,7 @@ public void projectOpened(Project project) {
e.printStackTrace();
}
}, "MMS Fetch", false, TaskRunner.ThreadExecutionStrategy.POOLED, false, (r, ses) -> ses.scheduleAtFixedRate(r, 0, 1, TimeUnit.MINUTES)));
- if (StereotypesHelper.hasStereotype(project.getPrimaryModel(), "ModelManagementSystem")) {
+ if (MDKProjectOptions.getMbeeEnabled(project)) {
MMSLoginAction.loginAction(project);
}
}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/validation/ElementValidator.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/validation/ElementValidator.java
index 11cc21137..f45f988fc 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/validation/ElementValidator.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/validation/ElementValidator.java
@@ -98,7 +98,8 @@ public void run(ProgressStatus progressStatus) {
serverElements = new LinkedList<>();
serverElementMap = new HashMap<>();
} else {
- serverElementMap = serverElements.stream().filter(json -> json.has(MDKConstants.ID_KEY) && json.get(MDKConstants.ID_KEY).isTextual()).collect(Collectors.toMap(json -> json.get(MDKConstants.ID_KEY).asText(), Function.identity()));
+ serverElementMap = serverElements.stream().filter(json -> json.has(MDKConstants.ID_KEY) && json.get(MDKConstants.ID_KEY).isTextual() && !json.get(MDKConstants.ID_KEY).asText().startsWith(MDKConstants.HIDDEN_ID_PREFIX)).collect(Collectors.toMap(json -> json.get(MDKConstants.ID_KEY).asText(), Function.identity()));
+
}
try {
@@ -154,7 +155,7 @@ private void processServerElements(Map> client
for(ObjectNode jsonObject : elementObjects) {
JsonNode idValue = jsonObject.get(MDKConstants.ID_KEY);
- if(idValue != null && idValue.isTextual() && !serverElementMap.containsKey(idValue.asText())) {
+ if(idValue != null && idValue.isTextual() && !idValue.asText().startsWith(MDKConstants.HIDDEN_ID_PREFIX) && !serverElementMap.containsKey(idValue.asText())) {
String id = idValue.asText();
Pair currentClientElement = clientElementMap.get(id);
@@ -233,7 +234,7 @@ public void addElementEquivalenceViolation(Pair clientEleme
}
public void finishViolation(ValidationRuleViolation validationRuleViolation, String id, Pair clientElement, ObjectNode serverElement, JsonNode diff) {
- validationRuleViolation.addAction(new CommitClientElementAction(id, clientElement != null ? clientElement.getKey() : null, clientElement != null ? clientElement.getValue() : null, project));
+ validationRuleViolation.addAction(new CommitClientElementAction(id, clientElement != null ? clientElement.getKey() : null, clientElement != null ? clientElement.getValue() : null, serverElement, project));
validationRuleViolation.addAction(new UpdateClientElementAction(id, clientElement != null ? clientElement.getKey() : null, serverElement, project) {
@Override
protected ValidationRuleViolation getEditableValidationRuleViolation(Element element, ObjectNode objectNode, String sysmlId) {
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/validation/ProjectValidator.java b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/validation/ProjectValidator.java
index 8a51ac238..ac25d740c 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/mms/validation/ProjectValidator.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/mms/validation/ProjectValidator.java
@@ -19,6 +19,7 @@
import gov.nasa.jpl.mbee.mdk.mms.MMSUtils;
import gov.nasa.jpl.mbee.mdk.mms.actions.CommitProjectAction;
import gov.nasa.jpl.mbee.mdk.mms.endpoints.*;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
import gov.nasa.jpl.mbee.mdk.validation.ValidationRule;
import gov.nasa.jpl.mbee.mdk.validation.ValidationRuleViolation;
import gov.nasa.jpl.mbee.mdk.validation.ValidationSuite;
@@ -171,7 +172,9 @@ public void validate() {
public static ObjectNode generateProjectObjectNode(Project project, String orgId) {
- return generateProjectObjectNode(project.getPrimaryProject(), orgId);
+ ObjectNode projectNode = generateProjectObjectNode(project.getPrimaryProject(), orgId);
+ projectNode.put(MDKConstants.PROJECT_MMS_URL_KEY, MDKProjectOptions.getMmsUrl(project).toString());
+ return projectNode;
}
public static ObjectNode generateProjectObjectNode(IProject iProject, String orgId) {
@@ -183,6 +186,9 @@ public static ObjectNode generateProjectObjectNode(IProject iProject, String org
String resourceId = "";
String twcServerUrl = "";
Project project = ProjectUtilities.getProject(iProject);
+ if (ProjectUtilities.isStandardSystemProfile(iProject)) {
+ projectObjectNode.put(MDKConstants.IS_PROFILE_KEY, true);
+ }
if (project != null && project.isRemote()) {
resourceId = ProjectUtilities.getResourceID(iProject.getLocationURI());
twcServerUrl = getTeamworkCloudServer();
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/ConfigureEnvironmentOptions.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/ConfigureEnvironmentOptions.java
new file mode 100644
index 000000000..bef89f81a
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/ConfigureEnvironmentOptions.java
@@ -0,0 +1,12 @@
+package gov.nasa.jpl.mbee.mdk.options;
+
+import com.nomagic.magicdraw.core.Application;
+
+public class ConfigureEnvironmentOptions {
+
+ public ConfigureEnvironmentOptions() {}
+
+ public void configure() {
+ Application.getInstance().getEnvironmentOptions().addGroup(MDKEnvironmentOptionsGroup.getInstance());
+ }
+}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/ConfigureProjectOptions.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/ConfigureProjectOptions.java
new file mode 100644
index 000000000..f2c59eafd
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/ConfigureProjectOptions.java
@@ -0,0 +1,18 @@
+package gov.nasa.jpl.mbee.mdk.options;
+
+import com.nomagic.magicdraw.core.Application;
+import com.nomagic.magicdraw.core.options.ProjectOptions;
+import gov.nasa.jpl.mbee.mdk.MDKProjectOptionsConfigurator;
+import gov.nasa.jpl.mbee.mdk.options.listener.MDKProjectEventListener;
+
+public class ConfigureProjectOptions {
+
+ public ConfigureProjectOptions() {
+ }
+
+ public void configure() {
+ MDKProjectOptionsConfigurator mdkProjectOptionsConfigurator = new MDKProjectOptionsConfigurator();
+ ProjectOptions.addConfigurator(mdkProjectOptionsConfigurator);
+ Application.getInstance().addProjectEventListener(MDKProjectEventListener.getInstance());
+ }
+}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKOptionsGroup.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKEnvironmentOptionsGroup.java
similarity index 90%
rename from src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKOptionsGroup.java
rename to src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKEnvironmentOptionsGroup.java
index 7c97409bd..6f6887fdc 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKOptionsGroup.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKEnvironmentOptionsGroup.java
@@ -12,11 +12,11 @@
import java.util.Arrays;
import java.util.List;
-public class MDKOptionsGroup extends AbstractPropertyOptionsGroup {
+public class MDKEnvironmentOptionsGroup extends AbstractPropertyOptionsGroup {
public static final String ID = "options.mdk";
public static final String GROUP = "GROUP";
- private static MDKOptionsGroup tempInstance = null;
+ private static MDKEnvironmentOptionsGroup INSTANCE;
public static final String LOG_JSON_ID = "LOG_JSON_ID",
PERSIST_CHANGELOG_ID = "PERSIST_CHANGELOG_ID",
@@ -26,19 +26,17 @@ public class MDKOptionsGroup extends AbstractPropertyOptionsGroup {
MMS_AUTHENTICATION_CHAIN = "MMS_AUTHENTICATION_CHAIN",
DOCBOOK_TO_PDF_STYLESHEET = "DOCBOOK_TO_PDF_STYLESHEET";
- public MDKOptionsGroup() {
+ public MDKEnvironmentOptionsGroup() {
super(ID);
}
- public static MDKOptionsGroup getMDKOptions() {
- MDKOptionsGroup group = (MDKOptionsGroup) Application.getInstance().getEnvironmentOptions().getGroup(ID);
- if (group == null) {
- if (tempInstance == null) {
- tempInstance = new MDKOptionsGroup();
- }
- return tempInstance;
+
+
+ public static MDKEnvironmentOptionsGroup getInstance() {
+ if (INSTANCE == null) {
+ INSTANCE = new MDKEnvironmentOptionsGroup();
}
- return group;
+ return INSTANCE;
}
public boolean isLogJson() {
@@ -174,7 +172,7 @@ public void setAuthenticationChain(String value) {
addProperty(property, false);
}
- public static final PropertyResourceProvider PROPERTY_RESOURCE_PROVIDER = (key, property) -> EnvironmentOptionsResources.getString(key);
+ public static final PropertyResourceProvider PROPERTY_RESOURCE_PROVIDER = (key, property) -> MDKEnvironmentOptionsGroupResources.getString(key);
@Override
public void setDefaultValues() {
@@ -192,7 +190,7 @@ public void setDefaultValues() {
@Override
public String getName() {
- return EnvironmentOptionsResources.getString(MDK_OPTIONS_NAME);
+ return MDKEnvironmentOptionsGroupResources.getString(MDK_OPTIONS_NAME);
}
@Override
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/EnvironmentOptionsResources.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKEnvironmentOptionsGroupResources.java
similarity index 68%
rename from src/main/java/gov/nasa/jpl/mbee/mdk/options/EnvironmentOptionsResources.java
rename to src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKEnvironmentOptionsGroupResources.java
index 9f7ba8445..8ced6e6b9 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/options/EnvironmentOptionsResources.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKEnvironmentOptionsGroupResources.java
@@ -2,13 +2,13 @@
import com.nomagic.magicdraw.resources.ResourceManager;
-public class EnvironmentOptionsResources {
+public class MDKEnvironmentOptionsGroupResources {
public static final String BUNDLE_NAME = "gov.nasa.jpl.mbee.mdk.options.EnvironmentOptionsResources";
/**
* Constructs this resource handler.
*/
- private EnvironmentOptionsResources() {
+ private MDKEnvironmentOptionsGroupResources() {
// do nothing.
}
@@ -19,6 +19,6 @@ private EnvironmentOptionsResources() {
* @return translated resource.
*/
public static String getString(String key) {
- return ResourceManager.getStringFor(key, BUNDLE_NAME, EnvironmentOptionsResources.class.getClassLoader());
+ return ResourceManager.getStringFor(key, BUNDLE_NAME, MDKEnvironmentOptionsGroupResources.class.getClassLoader());
}
}
\ No newline at end of file
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKProjectOptions.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKProjectOptions.java
new file mode 100644
index 000000000..feb1367fc
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKProjectOptions.java
@@ -0,0 +1,269 @@
+package gov.nasa.jpl.mbee.mdk.options;
+
+import com.nomagic.magicdraw.core.Application;
+import com.nomagic.magicdraw.core.Project;
+import com.nomagic.magicdraw.core.ProjectUtilities;
+import com.nomagic.magicdraw.core.options.ProjectOptions;
+import com.nomagic.magicdraw.properties.BooleanProperty;
+import com.nomagic.magicdraw.properties.ElementListProperty;
+import com.nomagic.magicdraw.properties.Property;
+import com.nomagic.magicdraw.properties.StringProperty;
+import com.nomagic.uml2.ext.jmi.helpers.StereotypesHelper;
+import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element;
+import org.apache.http.client.utils.URIBuilder;
+
+import javax.swing.*;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+public class MDKProjectOptions {
+
+ public static final String ID = "options.project.mdk";
+ public static final String GROUP = "PROJECT_GENERAL_PROPERTIES";
+ public static final String MMS_HOST_URL="MMS_HOST_URL",
+ MMS_BASE_PATH="MMS_BASE_PATH",
+ VE_HOST_URL="VE_HOST_URL",
+ VE_BASE_PATH="VE_BASE_PATH",
+ MDK_PROJECT_OPTIONS_GROUP= "MDK_PROJECT_OPTIONS_GROUP",
+ ENABLE_OPENMBEE_INTEGRATION = "ENABLE_OPENMBEE_INTEGRATION",
+ MDK_MMS_URL = "MDK_MMS_URL",
+ MDK_VE_URL = "MDK_VE_URL",
+ MDK_MIGRATE_STEREOTYPE = "MDK_MIGRATE_STEREOTYPE";
+
+ public MDKProjectOptions() {
+ }
+
+ public static void init(ProjectOptions var0) {
+ MDKProjectOptions.setOption(var0, ENABLE_OPENMBEE_INTEGRATION, false);
+ MDKProjectOptions.setOption(var0, MMS_HOST_URL, "");
+ MDKProjectOptions.setOption(var0, MMS_BASE_PATH,"");
+ MDKProjectOptions.setOption(var0, VE_HOST_URL,"");
+ MDKProjectOptions.setOption(var0, VE_BASE_PATH,"");
+ MDKProjectOptions.setOption(var0, MDK_MIGRATE_STEREOTYPE, true);
+ }
+
+ public static void setOption(ProjectOptions var0, String projectOption, String newValue) {
+ Property var1 = var0.getProperty(MDKProjectOptions.GROUP, projectOption);
+ if (var1 == null) {
+ StringProperty var2 = new StringProperty(projectOption, newValue);
+ var2.setGroup(MDKProjectOptions.MDK_PROJECT_OPTIONS_GROUP);
+ var2.setResourceProvider(MDKPropertyResourceProvider.getInstance());
+ var0.addProperty(MDKProjectOptions.GROUP, var2);
+ }
+ else if (!var1.getValue().equals(newValue)) {
+ var1.setValue(newValue);
+ }
+ }
+
+ public static void setOption(ProjectOptions var0, String projectOption, boolean newValue) {
+ Property var1 = var0.getProperty(MDKProjectOptions.GROUP, projectOption);
+ if (var1 == null) {
+ BooleanProperty var2 = new BooleanProperty(projectOption, newValue);
+ var2.setGroup(MDKProjectOptions.MDK_PROJECT_OPTIONS_GROUP);
+ var2.setResourceProvider(MDKPropertyResourceProvider.getInstance());
+ var0.addProperty(MDKProjectOptions.GROUP, var2);
+ }
+ else if ((boolean)var1.getValue() != newValue) {
+ var1.setValue(newValue);
+ }
+ }
+
+ public static boolean getMbeeEnabled(Project project) {
+ if (project != null) {
+ Property mmsEnabledProperty = project.getOptions().getProperty("PROJECT_GENERAL_PROPERTIES", ENABLE_OPENMBEE_INTEGRATION);
+ if (mmsEnabledProperty instanceof BooleanProperty) {
+ return ((BooleanProperty) mmsEnabledProperty).getBoolean();
+ }
+ }
+ return false;
+ }
+
+ public static String getMmsHost(Project project) {
+ if (project != null) {
+ Property mmsHostProperty = project.getOptions().getProperty("PROJECT_GENERAL_PROPERTIES", MMS_HOST_URL);
+ if (mmsHostProperty instanceof StringProperty) {
+ return ((StringProperty) mmsHostProperty).getString();
+ }
+ }
+ return null;
+ }
+
+ public static String getMmsBasePath(Project project) {
+ if (project != null) {
+ Property mmsBasePathProperty = project.getOptions().getProperty("PROJECT_GENERAL_PROPERTIES", MMS_BASE_PATH);
+ if (mmsBasePathProperty instanceof StringProperty) {
+ return ((StringProperty) mmsBasePathProperty).getString();
+ }
+ }
+ return null;
+ }
+
+ public static String getVeHost(Project project) {
+ if (project != null) {
+ Property veHostProperty = project.getOptions().getProperty("PROJECT_GENERAL_PROPERTIES", VE_HOST_URL);
+ if (veHostProperty instanceof StringProperty) {
+ return ((StringProperty) veHostProperty).getString();
+ }
+ }
+ return null;
+ }
+
+ public static String getVeBasePath(Project project) {
+ if (project != null) {
+ Property veBasePathProperty = project.getOptions().getProperty("PROJECT_GENERAL_PROPERTIES", VE_BASE_PATH);
+ if (veBasePathProperty instanceof StringProperty) {
+ return ((StringProperty) veBasePathProperty).getString();
+ }
+ }
+ return null;
+ }
+
+ public static URIBuilder getMmsUrl(Project project) {
+ if (project == null) {
+ return null;
+ }
+ URIBuilder uri;
+ if (getMbeeEnabled(project)) {
+ String mmsHostUrl = getMmsHost(project);
+ String mmsBasePath = getMmsBasePath(project);
+ uri = getUriBuilder(mmsHostUrl,mmsBasePath);;
+ if (uri != null) {
+ return uri;
+ }
+ Application.getInstance().getGUILog().log("[ERROR] You must specify MMS URL before enabling MBEE Integration.");
+ setOption(project.getOptions(), ENABLE_OPENMBEE_INTEGRATION, false);
+ return null;
+ } else if (ProjectUtilities.isStandardSystemProfile(project.getPrimaryProject())) {
+ Property var1 = project.getOptions().getInvisibleProperty(MDK_MMS_URL);
+ if (var1 != null) {
+ return getUriBuilder((String)var1.getValue(), null);
+ } else if (project.getOptions().getInvisibleProperty("DISABLE_MMS") == null) {
+ String urlString = JOptionPane.showInputDialog("Specify server URL for standard profile.", null);
+ if (urlString == null || urlString.trim().isEmpty()) {
+ Application.getInstance().getGUILog().log("[WARNING] You must specify an MMS URL for the profile to use MMS");
+ int confirm = JOptionPane.showConfirmDialog(null,"Skip adding MMS Url for this session?", "Skip MMS?", JOptionPane.YES_NO_OPTION);
+ if (confirm == JOptionPane.YES_OPTION) {
+ Property var2 = new BooleanProperty("DISABLE_MMS", true);
+ project.getOptions().addInvisibleProperty(var2);
+ return null;
+ } else {
+ return getMmsUrl(project);
+ }
+ }
+ uri = getUriBuilder(urlString,null);
+ if (uri != null) {
+ return uri;
+ }
+ Application.getInstance().getGUILog().log("[WARNING] Invalid URL Syntax");
+ return getMmsUrl(project);
+ }
+ }
+ Application.getInstance().getGUILog().log("[ERROR] You must enable MBEE Integration before continuing.");
+ return null;
+ }
+
+ public static URIBuilder getVeUrl(Project project) {
+ if (project == null) {
+ return null;
+ }
+ URIBuilder uri;
+ String veHostUrl = getVeHost(project);
+ if (veHostUrl.equals("")) {
+ veHostUrl = getMmsHost(project);
+ }
+ String veBasePath = getVeBasePath(project);
+ uri = getUriBuilder(veHostUrl,veBasePath);
+ if (uri != null) {
+ uri.setFragment("");
+ return uri;
+ }
+ Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of VE URL for project.");
+ return null;
+ }
+
+ public static boolean isMigrationAllowed(Project project) {
+ if (project != null) {
+ Property migrate = project.getOptions().getProperty("PROJECT_GENERAL_PROPERTIES", MDK_MIGRATE_STEREOTYPE);
+ if (migrate instanceof BooleanProperty) {
+ return ((BooleanProperty) migrate).getBoolean();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @description
+ * @param project
+ * @throws IllegalStateException
+ */
+ public static void validate(Project project) throws IllegalStateException {
+ String urlString;
+ URIBuilder uri;
+ if (project == null) {
+ return;
+ }
+ Element primaryModel = project.getPrimaryModel();
+ if (primaryModel == null) {
+ return;
+ }
+ if (StereotypesHelper.hasStereotype(primaryModel, "ModelManagementSystem")) {
+ if (!getMbeeEnabled(project)) {
+ setOption(project.getOptions(), ENABLE_OPENMBEE_INTEGRATION, true);
+ Application.getInstance().getGUILog().log("[INFO] ModelManagementSystem stereotype detected. Automatically migrating and re-enabling MBEE integration");
+ }
+ urlString = (String) StereotypesHelper.getStereotypePropertyFirst(primaryModel, "ModelManagementSystem", "MMS URL");
+ if (urlString != null && !urlString.equals("") && isMigrationAllowed(project)) {
+ uri = getUriBuilder(urlString, null);
+ if (uri == null) {
+ Application.getInstance().getGUILog().log("[ERROR] Unable to migrate MMS URL to project options. Please manually re-enable via Options>Project>General>MBEE");
+ return;
+ }
+ setOption(project.getOptions(), MMS_HOST_URL, uri.getScheme() + "://" + uri.getHost());
+ setOption(project.getOptions(), MMS_BASE_PATH, uri.getPath());
+ int deleteSlot = JOptionPane.showConfirmDialog(null,"MMS URL Migration Complete! The MMS Stereotype is no longer needed, would you like to remove it?", "Migration Complete", JOptionPane.YES_NO_OPTION);
+ if (deleteSlot == JOptionPane.YES_OPTION) {
+ StereotypesHelper.removeStereotypeByString(primaryModel,"ModelManagementSystem");
+ } else if (deleteSlot == JOptionPane.NO_OPTION) {
+ setOption(project.getOptions(), MDK_MIGRATE_STEREOTYPE, false);
+ }
+ }
+ } else if (getMbeeEnabled(project)) {
+ if (ProjectUtilities.findAttachedProjectByName(project,"SysML Extensions") == null) {
+ Application.getInstance().getGUILog().log("[WARNING] SysML Extensions must be mounted before using MBEE Integration.");
+ setOption(project.getOptions(), ENABLE_OPENMBEE_INTEGRATION, false);
+ Application.getInstance().getGUILog().log("[WARNING] Mount SysML Extensions and re-enable MBEE integration before continuing");
+ }
+ }
+ }
+
+ /**
+ * Returns a URIBuilder object with a path. Used as the base for all of the rest of the
+ * URIBuilder generating convenience classes.
+ *
+ * @param urlString: URL for the OpenMBEE Service being requested
+ * @param basePath: base path string for the desired service
+ * @return URIBuilder
+ */
+ public static URIBuilder getUriBuilder(String urlString, String basePath) {
+ URIBuilder uri;
+ try {
+ uri = new URIBuilder(urlString);
+ if (basePath != null)
+ uri.setPath(basePath);
+ } catch (URISyntaxException e) {
+ Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of URL for project. Reason: " + e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+ String path = Optional.ofNullable(uri.getPath()).orElse("");
+ if (path.endsWith("#") || path.endsWith("/")) {
+ path = path.substring(0, path.length() - 1);
+ }
+ uri.setPath(path);
+ return uri;
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKProjectOptionsResources.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKProjectOptionsResources.java
new file mode 100644
index 000000000..fa2f184d3
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKProjectOptionsResources.java
@@ -0,0 +1,33 @@
+package gov.nasa.jpl.mbee.mdk.options;
+
+import com.nomagic.magicdraw.resources.ResourceManager;
+
+import java.text.MessageFormat;
+
+public class MDKProjectOptionsResources {
+ public static final String BUNDLE_NAME = "gov.nasa.jpl.mbee.mdk.options.ProjectOptionsResources";
+
+ /**
+ * Constructs this resource handler.
+ */
+ private MDKProjectOptionsResources() {
+ // do nothing.
+ }
+
+ /**
+ * Gets resource by key.
+ *
+ * @param key key by which to get the resource.
+ * @return translated resource.
+ */
+ public static String getString(String key) {
+ return ResourceManager.getStringFor(key, BUNDLE_NAME, MDKProjectOptionsResources.class.getClassLoader());
+ }
+
+ public static String getStringFor(String var0, String... var1) {
+ String var2 = getString(var0);
+ var2 = var2.replaceAll("'", "''");
+ var2 = MessageFormat.format(var2, (Object[])var1);
+ return var2;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKPropertyResourceProvider.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKPropertyResourceProvider.java
new file mode 100644
index 000000000..134ad4a47
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/MDKPropertyResourceProvider.java
@@ -0,0 +1,24 @@
+package gov.nasa.jpl.mbee.mdk.options;
+
+import com.nomagic.magicdraw.properties.Property;
+import com.nomagic.magicdraw.properties.PropertyResourceProvider;
+
+public class MDKPropertyResourceProvider implements PropertyResourceProvider {
+ private static final String ID = "MDK_PROPERTY_RESOURCE_PROVIDER";
+ private static final MDKPropertyResourceProvider INSTANCE = new MDKPropertyResourceProvider();
+
+ private MDKPropertyResourceProvider() {
+
+ }
+
+ public static MDKPropertyResourceProvider getInstance() {
+ return INSTANCE;
+ }
+
+ public String getString(String string, Property property) {
+ return MDKProjectOptionsResources.getString(string);
+ }
+
+ public String getUniqueID() { return ID; }
+
+}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectEventListener.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectEventListener.java
new file mode 100644
index 000000000..4925832dc
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectEventListener.java
@@ -0,0 +1,50 @@
+package gov.nasa.jpl.mbee.mdk.options.listener;
+
+import com.nomagic.ci.persistence.IProject;
+import com.nomagic.magicdraw.core.Project;
+import com.nomagic.magicdraw.core.ProjectUtilitiesInternal;
+import com.nomagic.magicdraw.core.project.ProjectEventListenerAdapter;
+import com.nomagic.magicdraw.core.project.ProjectPartLoadedListener;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
+
+public class MDKProjectEventListener extends ProjectEventListenerAdapter implements ProjectPartLoadedListener {
+
+ private static MDKProjectEventListener INSTANCE;
+
+ private final MDKProjectPartLoadedListener partLoadedListener;
+ private final MDKProjectOptionsChangeListener projectOptionsChangeListener;
+
+ public MDKProjectEventListener() {
+ this.projectOptionsChangeListener = MDKProjectOptionsChangeListener.getInstance();
+ this.partLoadedListener = MDKProjectPartLoadedListener.getInstance();
+ }
+
+ public static MDKProjectEventListener getInstance() {
+ try {
+ if (INSTANCE == null) {
+ INSTANCE = new MDKProjectEventListener();
+ }
+ } catch (IllegalStateException var0) {
+ throw InstanceNotFound(var0);
+ }
+ return INSTANCE;
+ }
+
+ public void projectOpened(Project var1) {
+ var1.getOptions().addPropertyChangeListener(this.projectOptionsChangeListener);
+ MDKProjectOptions.validate(var1);
+ }
+
+ public void projectPreClosed(Project var1) {
+ var1.getOptions().removePropertyChangeListener(this.projectOptionsChangeListener);
+ }
+
+ public void projectPartLoaded(Project var1, IProject var2) {
+ MDKProjectPartLoadedListener.listenToProjectLoad(ProjectUtilitiesInternal.getRepresentation(var2));
+ }
+
+ private static IllegalStateException InstanceNotFound(IllegalStateException var0) {
+ return var0;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectOptionsChangeListener.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectOptionsChangeListener.java
new file mode 100644
index 000000000..7abaee806
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectOptionsChangeListener.java
@@ -0,0 +1,47 @@
+package gov.nasa.jpl.mbee.mdk.options.listener;
+
+import com.nomagic.magicdraw.core.Application;
+import com.nomagic.magicdraw.core.Project;
+import com.nomagic.magicdraw.core.ProjectUtilities;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+public class MDKProjectOptionsChangeListener implements PropertyChangeListener {
+
+ private static MDKProjectOptionsChangeListener INSTANCE;
+
+ public MDKProjectOptionsChangeListener() {
+ }
+
+ public static MDKProjectOptionsChangeListener getInstance() {
+ try {
+ if (INSTANCE == null) {
+ INSTANCE = new MDKProjectOptionsChangeListener();
+ }
+ } catch (IllegalStateException var0) {
+ throw InstanceNotFound(var0);
+ }
+
+ return INSTANCE;
+ }
+
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(MDKProjectOptions.GROUP)) {
+ Project project = Application.getInstance().getProject();
+
+ if (MDKProjectOptions.getMbeeEnabled(project)) {
+ MDKProjectOptions.validate(project);
+ }
+
+ }
+ }
+
+
+ private static IllegalStateException InstanceNotFound(IllegalStateException var0) {
+ return var0;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectPartLoadedListener.java b/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectPartLoadedListener.java
new file mode 100644
index 000000000..3517018ed
--- /dev/null
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/options/listener/MDKProjectPartLoadedListener.java
@@ -0,0 +1,94 @@
+package gov.nasa.jpl.mbee.mdk.options.listener;
+
+import com.nomagic.magicdraw.core.Application;
+
+import java.beans.PropertyChangeEvent;
+
+public class MDKProjectPartLoadedListener {
+ private static MDKProjectPartLoadedListener INSTANCE;
+
+
+ public MDKProjectPartLoadedListener() {
+ }
+
+ public static MDKProjectPartLoadedListener getInstance() {
+ try {
+ if (INSTANCE == null) {
+ INSTANCE = new MDKProjectPartLoadedListener();
+ }
+ } catch (IllegalStateException var0) {
+ throw InstanceNotFound(var0);
+ }
+
+ return INSTANCE;
+ }
+
+ public void configureEnvironment() {
+ //TODO: hook into environment options if desired
+ }
+
+
+ public static void listenToProjectLoad(String var1) {
+ if ("SysML Extensions.mdxml".equals(var1)) {
+ Application.getInstance().getGUILog().log("Detected SysML Extensions!");
+ }
+ }
+
+// public void propertyChange(PropertyChangeEvent var1) {
+// if (var1.getSource() instanceof Slot) {
+// if (var1.getPropertyName().equals("value")) {
+// StructuralFeature var2 = ((Slot)var1.getSource()).getDefiningFeature();
+// if (var2 instanceof Property && !(var2 instanceof Port)) {
+// sysmla((Property)var2);
+// }
+// }
+// } else if (var1.getSource() instanceof InstanceSpecification) {
+// if (var1.getPropertyName().equals("slot")) {
+// InstanceSpecification var4 = (InstanceSpecification)var1.getSource();
+// this.sysmla(var4);
+// }
+// } else if (var1.getSource() instanceof ValueSpecification) {
+// if (var1.getPropertyName().equals("instance")) {
+// ValueSpecification var5 = (ValueSpecification)var1.getSource();
+// Element var3 = var5.getOwner();
+// if (var3 instanceof Property) {
+// sysmla((Property)var3);
+// }
+// }
+// } else if (var1.getSource() instanceof Classifier && var1.getPropertyName().equals("generalization")) {
+// Classifier var6 = (Classifier)var1.getSource();
+// this.sysmla(var6, (List)null);
+// }
+//
+// }
+//
+// @Override
+// public void registerToProject() {
+// if (sysmld.sysmla()) {
+// EventSupport var1 = this.getProject().getRepository().getEventSupport();
+// Iterator var2 = sysmlb.iterator();
+//
+// while(var2.hasNext()) {
+// String var3 = (String)var2.next();
+// var1.addPropertyChangeListener(this, var3);
+// }
+// }
+//
+// }
+//
+// @Override
+// public void unregisterFromProject() {
+// EventSupport var1 = this.getProject().getRepository().getEventSupport();
+// Iterator var2 = sysmlb.iterator();
+//
+// while(var2.hasNext()) {
+// String var3 = var2.next();
+// var1.removePropertyChangeListener(this, var3);
+// }
+//
+// }
+
+ private static IllegalStateException InstanceNotFound(IllegalStateException var0) {
+ return var0;
+ }
+}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/AbstractAcquireTicketProcessor.java b/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/AbstractAcquireTicketProcessor.java
index 520547fba..abd593e8f 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/AbstractAcquireTicketProcessor.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/AbstractAcquireTicketProcessor.java
@@ -4,6 +4,7 @@
import com.nomagic.magicdraw.core.Project;
import gov.nasa.jpl.mbee.mdk.mms.MMSUtils;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
public abstract class AbstractAcquireTicketProcessor {
private AbstractAcquireTicketProcessor processor;
@@ -13,7 +14,7 @@ public AbstractAcquireTicketProcessor(AbstractAcquireTicketProcessor processor)
}
public boolean acquireMmsTicket(Project project) {
- if (MMSUtils.getServerUrl(project) == null) {
+ if (MDKProjectOptions.getMmsUrl(project) == null) {
Application.getInstance().getGUILog().log("[ERROR] MMS url is not specified. Skipping login.");
return false;
}
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/AcquireTicketChain.java b/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/AcquireTicketChain.java
index 7f6bc9a48..9a8b77543 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/AcquireTicketChain.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/AcquireTicketChain.java
@@ -9,7 +9,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
public class AcquireTicketChain {
AbstractAcquireTicketProcessor chain;
@@ -31,7 +31,7 @@ private AbstractAcquireTicketProcessor recursiveBuildChain(List authChai
}
private void buildChain() {
- List authChain = MDKOptionsGroup.getMDKOptions().getAuthenticationChain();
+ List authChain = MDKEnvironmentOptionsGroup.getInstance().getAuthenticationChain();
try {
chain = recursiveBuildChain(authChain);
} catch (NoSuchMethodException | SecurityException | ClassNotFoundException | InstantiationException
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/BasicAuthAcquireTicketProcessor.java b/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/BasicAuthAcquireTicketProcessor.java
index 67fbbb03d..a18deebaf 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/BasicAuthAcquireTicketProcessor.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/tickets/BasicAuthAcquireTicketProcessor.java
@@ -24,6 +24,7 @@
import com.nomagic.task.ProgressStatus;
import com.nomagic.ui.ProgressStatusRunner;
+import gov.nasa.jpl.mbee.mdk.options.MDKProjectOptions;
import org.apache.http.client.methods.HttpRequestBase;
import gov.nasa.jpl.mbee.mdk.http.ServerException;
@@ -81,7 +82,7 @@ private static String getCredentialsTicket(Project project, String baseUrl, Stri
HttpRequestBase request = null;
if (project != null) {
request = MMSLoginEndpoint.builder()
- .addParam(MMSEndpointBuilderConstants.URI_BASE_PATH, MMSUtils.getServerUrl(project))
+ .addUri(MDKProjectOptions.getMmsUrl(project))
.addParam("username", username).addParam("password", password).build();
} else if (baseUrl != null) {
request = MMSLoginEndpoint.builder().addParam(MMSEndpointBuilderConstants.URI_BASE_PATH, baseUrl)
diff --git a/src/main/java/gov/nasa/jpl/mbee/mdk/util/ScriptRunner.java b/src/main/java/gov/nasa/jpl/mbee/mdk/util/ScriptRunner.java
index 2acae6be5..b54f02f95 100644
--- a/src/main/java/gov/nasa/jpl/mbee/mdk/util/ScriptRunner.java
+++ b/src/main/java/gov/nasa/jpl/mbee/mdk/util/ScriptRunner.java
@@ -12,7 +12,7 @@
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.NamedElement;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property;
import com.nomagic.uml2.ext.magicdraw.mdprofiles.Stereotype;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
import javax.script.*;
import java.io.File;
@@ -77,8 +77,8 @@ public static Object runScriptFromStereotype(Element e, Stereotype s, Map
*
* Instantiated in the implementation ClassLoader and invoked from {@link org.gradle.process.internal.worker.GradleWorkerMain}.
- * See {@link ApplicationClassesInSystemClassLoaderWorkerFactory} for details.
+ * See {@link } for details.
*/
public class MagicDrawClassLoaderWorker implements Callable {
private final DataInputStream configInputStream;
@@ -87,8 +93,12 @@ public Void call() throws Exception {
// Read server address and start connecting
MultiChoiceAddress serverAddress = new MultiChoiceAddressSerializer().read(decoder);
+
MessagingServices messagingServices = new MessagingServices();
- MagicDrawClassLoaderWorker.WorkerServices workerServices = new MagicDrawClassLoaderWorker.WorkerServices(messagingServices);
+ MagicDrawClassLoaderWorker.WorkerServices workerServices = new MagicDrawClassLoaderWorker.WorkerServices();
+ ExecutorFactory executorFactory = new DefaultExecutorFactory();
+
+
WorkerLogEventListener workerLogEventListener = null;
try {
@@ -104,7 +114,9 @@ public Void call() throws Exception {
throw UncheckedException.throwAsUncheckedException(e);
}
- final ObjectConnection connection = messagingServices.get(MessagingClient.class).getConnection(serverAddress);
+ //final ObjectConnection connection = messagingServices.get(MessagingClient.class).getConnection(serverAddress);
+ ConnectCompletion connectCompletion = new TcpOutgoingConnector().connect(serverAddress);
+ final ObjectConnection connection = new MessageHubBackedObjectConnection(executorFactory, connectCompletion);
workerLogEventListener = configureLogging(loggingManager, connection);
if (shouldPublishJvmMemoryInfo) {
configureWorkerJvmMemoryInfoEvents(workerServices, connection);
@@ -121,6 +133,10 @@ public ClassLoader getApplicationClassLoader() {
public ObjectConnection getServerConnection() {
return connection;
}
+
+ public ServiceRegistry getServiceRegistry() {
+ return workerServices;
+ }
});
} finally {
connection.stop();
@@ -129,7 +145,6 @@ public ObjectConnection getServerConnection() {
if (workerLogEventListener != null) {
loggingManager.removeOutputEventListener(workerLogEventListener);
}
- messagingServices.close();
loggingManager.stop();
}
@@ -139,7 +154,8 @@ public ObjectConnection getServerConnection() {
private WorkerLogEventListener configureLogging(LoggingManagerInternal loggingManager, ObjectConnection connection) {
connection.useParameterSerializers(WorkerLoggingSerializer.create());
WorkerLoggingProtocol workerLoggingProtocol = connection.addOutgoing(WorkerLoggingProtocol.class);
- WorkerLogEventListener workerLogEventListener = new WorkerLogEventListener(workerLoggingProtocol);
+ WorkerLogEventListener workerLogEventListener = new WorkerLogEventListener();
+ workerLogEventListener.setWorkerLoggingProtocol(workerLoggingProtocol);
loggingManager.addOutputEventListener(workerLogEventListener);
return workerLogEventListener;
}
diff --git a/src/test/java/gov/nasa/jpl/mbee/mdk/util/UtilsTest.java b/src/test/java/gov/nasa/jpl/mbee/mdk/util/UtilsTest.java
index 613482640..fddddfbd5 100644
--- a/src/test/java/gov/nasa/jpl/mbee/mdk/util/UtilsTest.java
+++ b/src/test/java/gov/nasa/jpl/mbee/mdk/util/UtilsTest.java
@@ -6,12 +6,11 @@
import com.nomagic.magicdraw.tests.MagicDrawTestRunner;
import com.nomagic.magicdraw.uml.BaseElement;
import com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Property;
-import com.nomagic.uml2.ext.magicdraw.components.mdbasiccomponents.Component;
import com.nomagic.uml2.ext.magicdraw.mdprofiles.Stereotype;
import gov.nasa.jpl.mbee.mdk.api.MagicDrawHelper;
import gov.nasa.jpl.mbee.mdk.http.ServerException;
-import gov.nasa.jpl.mbee.mdk.options.MDKOptionsGroup;
+import gov.nasa.jpl.mbee.mdk.options.MDKEnvironmentOptionsGroup;
import org.apache.commons.io.IOUtils;
@@ -45,8 +44,8 @@ public static void setupProject() throws IOException, ServerException, URISyntax
File testProjectFile = File.createTempFile("prj", ".mdzip");
IOUtils.copy(classLoader.getResourceAsStream("CSyncTest.mdzip"), new FileOutputStream(testProjectFile));
- MDKOptionsGroup.getMDKOptions().setDefaultValues();
- MDKOptionsGroup.getMDKOptions().setLogJson(true);
+ MDKEnvironmentOptionsGroup.getInstance().setDefaultValues();
+ MDKEnvironmentOptionsGroup.getInstance().setLogJson(true);
MagicDrawHelper.openProject(testProjectFile);
project = Application.getInstance().getProject();
}
diff --git a/venv/bin/Activate.ps1 b/venv/bin/Activate.ps1
new file mode 100644
index 000000000..2fb3852c3
--- /dev/null
+++ b/venv/bin/Activate.ps1
@@ -0,0 +1,241 @@
+<#
+.Synopsis
+Activate a Python virtual environment for the current PowerShell session.
+
+.Description
+Pushes the python executable for a virtual environment to the front of the
+$Env:PATH environment variable and sets the prompt to signify that you are
+in a Python virtual environment. Makes use of the command line switches as
+well as the `pyvenv.cfg` file values present in the virtual environment.
+
+.Parameter VenvDir
+Path to the directory that contains the virtual environment to activate. The
+default value for this is the parent of the directory that the Activate.ps1
+script is located within.
+
+.Parameter Prompt
+The prompt prefix to display when this virtual environment is activated. By
+default, this prompt is the name of the virtual environment folder (VenvDir)
+surrounded by parentheses and followed by a single space (ie. '(.venv) ').
+
+.Example
+Activate.ps1
+Activates the Python virtual environment that contains the Activate.ps1 script.
+
+.Example
+Activate.ps1 -Verbose
+Activates the Python virtual environment that contains the Activate.ps1 script,
+and shows extra information about the activation as it executes.
+
+.Example
+Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
+Activates the Python virtual environment located in the specified location.
+
+.Example
+Activate.ps1 -Prompt "MyPython"
+Activates the Python virtual environment that contains the Activate.ps1 script,
+and prefixes the current prompt with the specified string (surrounded in
+parentheses) while the virtual environment is active.
+
+.Notes
+On Windows, it may be required to enable this Activate.ps1 script by setting the
+execution policy for the user. You can do this by issuing the following PowerShell
+command:
+
+PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
+
+For more information on Execution Policies:
+https://go.microsoft.com/fwlink/?LinkID=135170
+
+#>
+Param(
+ [Parameter(Mandatory = $false)]
+ [String]
+ $VenvDir,
+ [Parameter(Mandatory = $false)]
+ [String]
+ $Prompt
+)
+
+<# Function declarations --------------------------------------------------- #>
+
+<#
+.Synopsis
+Remove all shell session elements added by the Activate script, including the
+addition of the virtual environment's Python executable from the beginning of
+the PATH variable.
+
+.Parameter NonDestructive
+If present, do not remove this function from the global namespace for the
+session.
+
+#>
+function global:deactivate ([switch]$NonDestructive) {
+ # Revert to original values
+
+ # The prior prompt:
+ if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
+ Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
+ Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
+ }
+
+ # The prior PYTHONHOME:
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
+ Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
+ Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
+ }
+
+ # The prior PATH:
+ if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
+ Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
+ Remove-Item -Path Env:_OLD_VIRTUAL_PATH
+ }
+
+ # Just remove the VIRTUAL_ENV altogether:
+ if (Test-Path -Path Env:VIRTUAL_ENV) {
+ Remove-Item -Path env:VIRTUAL_ENV
+ }
+
+ # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
+ if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
+ Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
+ }
+
+ # Leave deactivate function in the global namespace if requested:
+ if (-not $NonDestructive) {
+ Remove-Item -Path function:deactivate
+ }
+}
+
+<#
+.Description
+Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
+given folder, and returns them in a map.
+
+For each line in the pyvenv.cfg file, if that line can be parsed into exactly
+two strings separated by `=` (with any amount of whitespace surrounding the =)
+then it is considered a `key = value` line. The left hand string is the key,
+the right hand is the value.
+
+If the value starts with a `'` or a `"` then the first and last character is
+stripped from the value before being captured.
+
+.Parameter ConfigDir
+Path to the directory that contains the `pyvenv.cfg` file.
+#>
+function Get-PyVenvConfig(
+ [String]
+ $ConfigDir
+) {
+ Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
+
+ # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
+ $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
+
+ # An empty map will be returned if no config file is found.
+ $pyvenvConfig = @{ }
+
+ if ($pyvenvConfigPath) {
+
+ Write-Verbose "File exists, parse `key = value` lines"
+ $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
+
+ $pyvenvConfigContent | ForEach-Object {
+ $keyval = $PSItem -split "\s*=\s*", 2
+ if ($keyval[0] -and $keyval[1]) {
+ $val = $keyval[1]
+
+ # Remove extraneous quotations around a string value.
+ if ("'""".Contains($val.Substring(0, 1))) {
+ $val = $val.Substring(1, $val.Length - 2)
+ }
+
+ $pyvenvConfig[$keyval[0]] = $val
+ Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
+ }
+ }
+ }
+ return $pyvenvConfig
+}
+
+
+<# Begin Activate script --------------------------------------------------- #>
+
+# Determine the containing directory of this script
+$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
+$VenvExecDir = Get-Item -Path $VenvExecPath
+
+Write-Verbose "Activation script is located in path: '$VenvExecPath'"
+Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
+Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
+
+# Set values required in priority: CmdLine, ConfigFile, Default
+# First, get the location of the virtual environment, it might not be
+# VenvExecDir if specified on the command line.
+if ($VenvDir) {
+ Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
+}
+else {
+ Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
+ $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
+ Write-Verbose "VenvDir=$VenvDir"
+}
+
+# Next, read the `pyvenv.cfg` file to determine any required value such
+# as `prompt`.
+$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
+
+# Next, set the prompt from the command line, or the config file, or
+# just use the name of the virtual environment folder.
+if ($Prompt) {
+ Write-Verbose "Prompt specified as argument, using '$Prompt'"
+}
+else {
+ Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
+ if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
+ Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
+ $Prompt = $pyvenvCfg['prompt'];
+ }
+ else {
+ Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virutal environment)"
+ Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
+ $Prompt = Split-Path -Path $venvDir -Leaf
+ }
+}
+
+Write-Verbose "Prompt = '$Prompt'"
+Write-Verbose "VenvDir='$VenvDir'"
+
+# Deactivate any currently active virtual environment, but leave the
+# deactivate function in place.
+deactivate -nondestructive
+
+# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
+# that there is an activated venv.
+$env:VIRTUAL_ENV = $VenvDir
+
+if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
+
+ Write-Verbose "Setting prompt to '$Prompt'"
+
+ # Set the prompt to include the env name
+ # Make sure _OLD_VIRTUAL_PROMPT is global
+ function global:_OLD_VIRTUAL_PROMPT { "" }
+ Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
+ New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
+
+ function global:prompt {
+ Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
+ _OLD_VIRTUAL_PROMPT
+ }
+}
+
+# Clear PYTHONHOME
+if (Test-Path -Path Env:PYTHONHOME) {
+ Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
+ Remove-Item -Path Env:PYTHONHOME
+}
+
+# Add the venv to the PATH
+Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
+$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
diff --git a/venv/bin/activate b/venv/bin/activate
new file mode 100644
index 000000000..236459a6f
--- /dev/null
+++ b/venv/bin/activate
@@ -0,0 +1,66 @@
+# This file must be used with "source bin/activate" *from bash*
+# you cannot run it directly
+
+deactivate () {
+ # reset old environment variables
+ if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
+ PATH="${_OLD_VIRTUAL_PATH:-}"
+ export PATH
+ unset _OLD_VIRTUAL_PATH
+ fi
+ if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
+ PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
+ export PYTHONHOME
+ unset _OLD_VIRTUAL_PYTHONHOME
+ fi
+
+ # This should detect bash and zsh, which have a hash command that must
+ # be called to get it to forget past commands. Without forgetting
+ # past commands the $PATH changes we made may not be respected
+ if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
+ hash -r 2> /dev/null
+ fi
+
+ if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
+ PS1="${_OLD_VIRTUAL_PS1:-}"
+ export PS1
+ unset _OLD_VIRTUAL_PS1
+ fi
+
+ unset VIRTUAL_ENV
+ if [ ! "${1:-}" = "nondestructive" ] ; then
+ # Self destruct!
+ unset -f deactivate
+ fi
+}
+
+# unset irrelevant variables
+deactivate nondestructive
+
+VIRTUAL_ENV="/Users/cgaley/git/mbee-execubots/mdk/venv"
+export VIRTUAL_ENV
+
+_OLD_VIRTUAL_PATH="$PATH"
+PATH="$VIRTUAL_ENV/bin:$PATH"
+export PATH
+
+# unset PYTHONHOME if set
+# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
+# could use `if (set -u; : $PYTHONHOME) ;` in bash
+if [ -n "${PYTHONHOME:-}" ] ; then
+ _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
+ unset PYTHONHOME
+fi
+
+if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
+ _OLD_VIRTUAL_PS1="${PS1:-}"
+ PS1="(venv) ${PS1:-}"
+ export PS1
+fi
+
+# This should detect bash and zsh, which have a hash command that must
+# be called to get it to forget past commands. Without forgetting
+# past commands the $PATH changes we made may not be respected
+if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
+ hash -r 2> /dev/null
+fi
diff --git a/venv/bin/activate.csh b/venv/bin/activate.csh
new file mode 100644
index 000000000..86fb3c734
--- /dev/null
+++ b/venv/bin/activate.csh
@@ -0,0 +1,25 @@
+# This file must be used with "source bin/activate.csh" *from csh*.
+# You cannot run it directly.
+# Created by Davide Di Blasi .
+# Ported to Python 3.3 venv by Andrew Svetlov
+
+alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate'
+
+# Unset irrelevant variables.
+deactivate nondestructive
+
+setenv VIRTUAL_ENV "/Users/cgaley/git/mbee-execubots/mdk/venv"
+
+set _OLD_VIRTUAL_PATH="$PATH"
+setenv PATH "$VIRTUAL_ENV/bin:$PATH"
+
+
+set _OLD_VIRTUAL_PROMPT="$prompt"
+
+if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
+ set prompt = "(venv) $prompt"
+endif
+
+alias pydoc python -m pydoc
+
+rehash
diff --git a/venv/bin/activate.fish b/venv/bin/activate.fish
new file mode 100644
index 000000000..f442cc3e7
--- /dev/null
+++ b/venv/bin/activate.fish
@@ -0,0 +1,64 @@
+# This file must be used with "source /bin/activate.fish" *from fish*
+# (https://fishshell.com/); you cannot run it directly.
+
+function deactivate -d "Exit virtual environment and return to normal shell environment"
+ # reset old environment variables
+ if test -n "$_OLD_VIRTUAL_PATH"
+ set -gx PATH $_OLD_VIRTUAL_PATH
+ set -e _OLD_VIRTUAL_PATH
+ end
+ if test -n "$_OLD_VIRTUAL_PYTHONHOME"
+ set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
+ set -e _OLD_VIRTUAL_PYTHONHOME
+ end
+
+ if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
+ functions -e fish_prompt
+ set -e _OLD_FISH_PROMPT_OVERRIDE
+ functions -c _old_fish_prompt fish_prompt
+ functions -e _old_fish_prompt
+ end
+
+ set -e VIRTUAL_ENV
+ if test "$argv[1]" != "nondestructive"
+ # Self-destruct!
+ functions -e deactivate
+ end
+end
+
+# Unset irrelevant variables.
+deactivate nondestructive
+
+set -gx VIRTUAL_ENV "/Users/cgaley/git/mbee-execubots/mdk/venv"
+
+set -gx _OLD_VIRTUAL_PATH $PATH
+set -gx PATH "$VIRTUAL_ENV/bin" $PATH
+
+# Unset PYTHONHOME if set.
+if set -q PYTHONHOME
+ set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
+ set -e PYTHONHOME
+end
+
+if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
+ # fish uses a function instead of an env var to generate the prompt.
+
+ # Save the current fish_prompt function as the function _old_fish_prompt.
+ functions -c fish_prompt _old_fish_prompt
+
+ # With the original prompt function renamed, we can override with our own.
+ function fish_prompt
+ # Save the return status of the last command.
+ set -l old_status $status
+
+ # Output the venv prompt; color taken from the blue of the Python logo.
+ printf "%s%s%s" (set_color 4B8BBE) "(venv) " (set_color normal)
+
+ # Restore the return status of the previous command.
+ echo "exit $old_status" | .
+ # Output the original/"old" prompt.
+ _old_fish_prompt
+ end
+
+ set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
+end
diff --git a/venv/bin/pip b/venv/bin/pip
new file mode 100755
index 000000000..15e58e665
--- /dev/null
+++ b/venv/bin/pip
@@ -0,0 +1,8 @@
+#!/Users/cgaley/git/mbee-execubots/mdk/venv/bin/python
+# -*- coding: utf-8 -*-
+import re
+import sys
+from pip._internal.cli.main import main
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/venv/bin/pip3 b/venv/bin/pip3
new file mode 100755
index 000000000..15e58e665
--- /dev/null
+++ b/venv/bin/pip3
@@ -0,0 +1,8 @@
+#!/Users/cgaley/git/mbee-execubots/mdk/venv/bin/python
+# -*- coding: utf-8 -*-
+import re
+import sys
+from pip._internal.cli.main import main
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/venv/bin/pip3.9 b/venv/bin/pip3.9
new file mode 100755
index 000000000..15e58e665
--- /dev/null
+++ b/venv/bin/pip3.9
@@ -0,0 +1,8 @@
+#!/Users/cgaley/git/mbee-execubots/mdk/venv/bin/python
+# -*- coding: utf-8 -*-
+import re
+import sys
+from pip._internal.cli.main import main
+if __name__ == '__main__':
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+ sys.exit(main())
diff --git a/venv/bin/python b/venv/bin/python
new file mode 120000
index 000000000..e616d2696
--- /dev/null
+++ b/venv/bin/python
@@ -0,0 +1 @@
+python3.9
\ No newline at end of file
diff --git a/venv/bin/python3 b/venv/bin/python3
new file mode 120000
index 000000000..e616d2696
--- /dev/null
+++ b/venv/bin/python3
@@ -0,0 +1 @@
+python3.9
\ No newline at end of file
diff --git a/venv/bin/python3.9 b/venv/bin/python3.9
new file mode 120000
index 000000000..d3e6b795f
--- /dev/null
+++ b/venv/bin/python3.9
@@ -0,0 +1 @@
+/usr/local/bin/python3.9
\ No newline at end of file