Skip to content

Commit

Permalink
Initial Commit, version 0.1.5 fully operative
Browse files Browse the repository at this point in the history
  • Loading branch information
carlescm committed Jul 28, 2020
0 parents commit 27e76b5
Show file tree
Hide file tree
Showing 17 changed files with 516 additions and 0 deletions.
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# ThingWorx Concurrency Extension

The aim of this extension it's to provide some workarounds to bugs or bad ThingWorx R&D decisions.

For now, it has a workaround to force update a property value to any point in time,
starting at some TW 8.X version R&D decided to not to allow to write
on current property value an "old" datapoint. If you write on a property (through standard PropertyUpdates services) a datapoint which it's older than current property value, it writes on the ValueStream (if it's logged) but doesn't updates current property thing's state. That approach it's good when receiving old buffered data, but if you want for whatever reason set back the current property value you can't, no way!

## Contents

- [Compatibility](#compatibility)
- [Installation](#installation)
- [Usage](#usage)
- [Build](#build)
- [Author](#author)

## Compatibility

ThingWorx 8.4.9 and above.

## Installation

Import the extension (WorkaroundsExtension.zip) with ThingWorx Composer Import Extension feature, the first time you won't need to restart Tomcat it will be available right-on.

## Usage

You have methods to update property value based on it's baseType

```javascript
"Update"+baseType+"PropertyValue_WorkaroundServices"
```
and also you have a method to update any baseType:

```javascript
UpdatePropertyValue_WorkaroundServices
```
Usage Example:

```javascript
Resources["WorkaroundServices"].UpdatePropertyValue_WorkaroundServices({
thingName: "aThingName",
propertyName: "aPropertyNameOnTheThing",
value: value, // -- Whatever value to set
timestamp: time, // -- The point in time for the given value
quality: quality, // -- Default="GOOD", Quality of the datapoint
deferNotifications: false, // -- Default=false, TW Internal usage,
// We just published the internal parameter
bypassReadOnly: false, // -- Default=false, TW Internal usage,
// to be tested, seems to allow to write to a read only property, nice!
bypassHooksAndBindings: false, // -- Default=false, TW Internal usage,
// We just published the internal parameter
forceOverwriteCurrentValue: true // -- Default=false, This is the new parameter that doesn' allows to write
// with old values current property value, if you pass it to true you will
// be able to force overwrite current property value to any point in time
// Same behaviour of the old good TW.
});
```
## Build

If you need to build it, it's built with ant and java 8 on a MacOS, the scripts are on the repository. Version change it's done by hand and should be automated. It's built with ThingWorx Full Blown library (from the .war itself), not from
ThingWorx SDK, as the internal service used it's not published on the SDK.

## Author

[Carles Coll Madrenas](https://linkedin.com/in/carlescoll)
Binary file added bin/WorkaroundsExtension.jar
Binary file not shown.
Binary file added bin/classes/com/wup/WorkaroundServices.class
Binary file not shown.
116 changes: 116 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="WorkaroundsExtension" basedir="." default="build">

<property name="extension.jar" value="WorkaroundsExtension.jar"/>

<property name="target" value="1.8"/>
<property name="source" value="1.8"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="common" value="common"/>
<property name="ui" value="ui"/>
<property name="lib" value="lib"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="build.dir" value="${basedir}/bin"/>
<property name="config.dir" value="${basedir}/configfiles" />
<property name="ui.dir" value="${basedir}/${ui}" />
<property name="lib.dir" value="${basedir}/${lib}" />
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="zip.dir" value="${basedir}/zip"/>

<!-- ExtensionPackage directory structure props -->
<property name="package.lib.basedir" value="${lib}"/>
<property name="package.ui.basedir" value="${ui}"/>
<!--<property name="package.common.lib.dir" value="${package.lib.basedir}/${common}"/>-->
<property name="package.common.lib.dir" value="${package.lib.basedir}/common"/>
<property name="package.common.ui.dir" value="${package.ui.basedir}/${common}"/>

<!-- Extension file info -->
<property name="zip.file.name" value="${ant.project.name}.zip" />

<tstamp>
<format property="NOW" pattern="yyyy-MM-dd HH:mm:ss" />
</tstamp>

<!-- define the classpath so it picks up the ThingWorx SDK jar relative to this basedir -->
<path id="jar.classpath">
<fileset dir="${lib.dir}" includes="*.jar"/>
<pathelement location="${classes.dir}"/>
</path>

<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${zip.dir}" />
</target>

<target name="init" depends="clean">

<mkdir dir="${build.dir}"/>
<mkdir dir="${classes.dir}"/>

<copy includeemptydirs="false" todir="${classes.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>

</target>

<target name="build-source" depends="init">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="${classes.dir}" source="${source}" target="${target}" includeantruntime="false">
<src path="${src.dir}"/>
<classpath refid="jar.classpath"/>
</javac>
</target>

<target name="build-jars" depends="build-source">
<echo message="building ${extension.jar} to ${build.dir}..."/>

<jar destfile="${build.dir}/${extension.jar}">
<!-- generate MANIFEST inline -->
<manifest>
<attribute name="Built-By" value="${extension.package.vendor}"/>
<attribute name="Build-Date" value="${NOW}"/>
<section name="${extension.package.name}">
<attribute name="Package-Title" value="${extension.package.title}"/>
<attribute name="Package-Version" value="${extension.package.version}"/>
<attribute name="Package-Vendor" value="${extension.package.vendor}"/>
</section>
</manifest>

<fileset dir="${classes.dir}" />
</jar>
</target>

<target name="package-extension" depends="build-jars">
<zip destfile="${zip.dir}/${zip.file.name}">
<!-- ENTITY-Specific JARs: MUST be put in <entity_name> subdir -->
<mappedresources>
<fileset dir="${build.dir}" includes="${extension.jar}" />
<globmapper from="*" to="${package.common.lib.dir}/*"/>
</mappedresources>
<!-- widget directory -->
<zipfileset dir="${config.dir}" includes="metadata.xml" />
</zip>
</target>

<target name="build" depends="package-extension">
<echo message="Building ${ant.project.name} extension package..."/>
</target>

</project>














4 changes: 4 additions & 0 deletions compile_pack_extension.command
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
echo -n -e "\033]0;Packing WorkaroundsSEE\007"
cd "`dirname "$0"`"
ant
#osascript -e 'tell application "Terminal" to close (every window whose name contains "Packing WorkaroundsSEE")' &
35 changes: 35 additions & 0 deletions configfiles/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?><Entities>
<ExtensionPackages>
<ExtensionPackage
name="WorkaroundsExtension"
description="Some tools to workaround ThingWorx limitations introduced by R_D, by fault 'bug' or by wrong design criteria."
vendor=""
packageVersion="0.1.5"
minimumThingWorxVersion="8.4.9">
<JarResources>
<FileResource type="JAR" file="WorkaroundsExtension.jar"/>
</JarResources>
</ExtensionPackage>
</ExtensionPackages>

<Resources>
<Resource name="WorkaroundServices"
description="Some tools to workaround ThingWorx limitations introduced by R_D, by fault 'bug' or by wrong design criteria."
className="com.wup.WorkaroundServices"
aspect.isCreatable="false"
aspect.isExtensible="false">
<JarResources>
<FileResource type="JAR" file="WorkaroundsExtension.jar" description="WiseUp WorkaroundsExtension ThingPackage JAR" />
</JarResources>
<RunTimePermissions>
<Permissions resourceName="*">
<ServiceInvoke>
<Principal isPermitted="true" principalName="Administrators" type="Group" />
<Principal isPermitted="true" principalName="Developers" type="Group" />
<Principal isPermitted="true" principalName="Users" type="Group" />
</ServiceInvoke>
</Permissions>
</RunTimePermissions>
</Resource>
</Resources>
</Entities>
Binary file added lib/custom-rhino-js-5.1.0.jar
Binary file not shown.
Binary file added lib/joda-time-2.9.4.jar
Binary file not shown.
Binary file added lib/logback-classic-1.2.3.jar
Binary file not shown.
Binary file added lib/logback-core-1.2.3.jar
Binary file not shown.
Binary file added lib/slf4j-api-1.7.25.jar
Binary file not shown.
Binary file added lib/thingworx-common-8.4.11-b97.jar
Binary file not shown.
Binary file not shown.
Binary file added lib/thingworx-modules-common-8.4.11-b97.jar
Binary file not shown.
Binary file added lib/thingworx-platform-common-8.4.11-b97.jar
Binary file not shown.
Loading

0 comments on commit 27e76b5

Please sign in to comment.