1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/chat/client-android/nbactions.xml Fri Apr 22 05:56:47 2016 +0200
1.3 @@ -0,0 +1,67 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<!--
1.6 +
1.7 + The MIT License (MIT)
1.8 +
1.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.10 +
1.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
1.12 + of this software and associated documentation files (the "Software"), to deal
1.13 + in the Software without restriction, including without limitation the rights
1.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1.15 + copies of the Software, and to permit persons to whom the Software is
1.16 + furnished to do so, subject to the following conditions:
1.17 +
1.18 + The above copyright notice and this permission notice shall be included in
1.19 + all copies or substantial portions of the Software.
1.20 +
1.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1.27 + THE SOFTWARE.
1.28 +
1.29 +-->
1.30 +<actions>
1.31 + <action>
1.32 + <actionName>run</actionName>
1.33 + <goals>
1.34 + <goal>clean</goal>
1.35 + <goal>package</goal>
1.36 + <goal>android:deploy</goal>
1.37 + <goal>android:run</goal>
1.38 + </goals>
1.39 + <properties>
1.40 + <skipTests>true</skipTests>
1.41 + </properties>
1.42 + </action>
1.43 + <action>
1.44 + <actionName>debug</actionName>
1.45 + <goals>
1.46 + <goal>clean</goal>
1.47 + <goal>package</goal>
1.48 + <goal>android:deploy</goal>
1.49 + <goal>android:run</goal>
1.50 + </goals>
1.51 + <properties>
1.52 + <skipTests>true</skipTests>
1.53 + <android.run.debug>${jpda.attach.port}</android.run.debug>
1.54 + <jpda.attach>true</jpda.attach>
1.55 + </properties>
1.56 + </action>
1.57 + <action>
1.58 + <actionName>CUSTOM-android-run</actionName>
1.59 + <displayName>Run in Android</displayName>
1.60 + <goals>
1.61 + <goal>clean</goal>
1.62 + <goal>package</goal>
1.63 + <goal>android:deploy</goal>
1.64 + <goal>android:run</goal>
1.65 + </goals>
1.66 + <properties>
1.67 + <skipTests>true</skipTests>
1.68 + </properties>
1.69 + </action>
1.70 +</actions>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/chat/client-android/pom.xml Fri Apr 22 05:56:47 2016 +0200
2.3 @@ -0,0 +1,204 @@
2.4 +<?xml version="1.0"?>
2.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2.6 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2.7 + <modelVersion>4.0.0</modelVersion>
2.8 +
2.9 + <parent>
2.10 + <groupId>org.apidesign.demo</groupId>
2.11 + <artifactId>chat-pom</artifactId>
2.12 + <version>1.0-SNAPSHOT</version>
2.13 + </parent>
2.14 +
2.15 + <groupId>org.apidesign.demo</groupId>
2.16 + <artifactId>chat-android</artifactId>
2.17 + <version>1.0-SNAPSHOT</version>
2.18 + <packaging>apk</packaging>
2.19 +
2.20 + <name>chat Client for Android</name>
2.21 +
2.22 + <properties>
2.23 + <platform.version>4.1.1.4</platform.version>
2.24 + <android.plugin.version>4.2.0</android.plugin.version>
2.25 + <android.platform.version>19</android.platform.version>
2.26 + <debug>false</debug>
2.27 + </properties>
2.28 + <build>
2.29 + <plugins>
2.30 + <plugin>
2.31 + <groupId>org.netbeans.html</groupId>
2.32 + <artifactId>html4j-maven-plugin</artifactId>
2.33 + <version>${net.java.html.version}</version>
2.34 + <executions>
2.35 + <execution>
2.36 + <id>js-classes</id>
2.37 + <goals>
2.38 + <goal>process-js-annotations</goal>
2.39 + </goals>
2.40 + </execution>
2.41 + </executions>
2.42 + </plugin>
2.43 + <plugin>
2.44 + <groupId>org.apache.maven.plugins</groupId>
2.45 + <artifactId>maven-compiler-plugin</artifactId>
2.46 + <version>2.3.2</version>
2.47 + <configuration>
2.48 + <source>1.7</source>
2.49 + <target>1.7</target>
2.50 + </configuration>
2.51 + </plugin>
2.52 + <plugin>
2.53 + <groupId>org.apache.maven.plugins</groupId>
2.54 + <artifactId>maven-jar-plugin</artifactId>
2.55 + <version>2.4</version>
2.56 + </plugin>
2.57 + <plugin>
2.58 + <groupId>org.apache.maven.plugins</groupId>
2.59 + <artifactId>maven-dependency-plugin</artifactId>
2.60 + <version>2.9</version>
2.61 + <executions>
2.62 + <execution>
2.63 + <id>unpack</id>
2.64 + <phase>process-resources</phase>
2.65 + <goals>
2.66 + <goal>unpack-dependencies</goal>
2.67 + </goals>
2.68 + </execution>
2.69 + </executions>
2.70 + <configuration>
2.71 + <type>zip</type>
2.72 + <classifier>webpages</classifier>
2.73 + <overWrite>true</overWrite>
2.74 + <outputDirectory>target/generated-sources/combined-assets/pages</outputDirectory>
2.75 + <includes>*/**</includes>
2.76 + </configuration>
2.77 + </plugin>
2.78 + <plugin>
2.79 + <groupId>com.filmon.maven</groupId>
2.80 + <artifactId>image-maven-plugin</artifactId>
2.81 + <version>1.1</version>
2.82 + <executions>
2.83 + <execution>
2.84 + <phase>initialize</phase>
2.85 + <goals>
2.86 + <goal>scale</goal>
2.87 + </goals>
2.88 + <configuration>
2.89 + <outputDirectory>target/res</outputDirectory>
2.90 + <images>
2.91 + <image>
2.92 + <source>src/main/icons/launcher.png</source>
2.93 + <destination>drawable-hdpi/ic_launcher.png</destination>
2.94 + <width>72</width>
2.95 + </image>
2.96 + <image>
2.97 + <source>src/main/icons/launcher.png</source>
2.98 + <destination>drawable-mdpi/ic_launcher.png</destination>
2.99 + <width>48</width>
2.100 + </image>
2.101 + <image>
2.102 + <source>src/main/icons/launcher.png</source>
2.103 + <destination>drawable-xhdpi/ic_launcher.png</destination>
2.104 + <width>96</width>
2.105 + </image>
2.106 + <image>
2.107 + <source>src/main/icons/launcher.png</source>
2.108 + <destination>drawable-xxhdpi/ic_launcher.png</destination>
2.109 + <width>144</width>
2.110 + </image>
2.111 + </images>
2.112 + </configuration>
2.113 + </execution>
2.114 + </executions>
2.115 + </plugin>
2.116 + <plugin>
2.117 + <groupId>com.simpligility.maven.plugins</groupId>
2.118 + <artifactId>android-maven-plugin</artifactId>
2.119 + <version>${android.plugin.version}</version>
2.120 + <extensions>true</extensions>
2.121 + <configuration>
2.122 + <apkDebug>${debug}</apkDebug>
2.123 + <resourceDirectory>target/res</resourceDirectory>
2.124 + <sdk>
2.125 + <platform>${android.platform.version}</platform>
2.126 + </sdk>
2.127 + <apk>
2.128 + <metaIncludes>
2.129 + <metaInclude>services/org.netbeans.**</metaInclude>
2.130 + </metaIncludes>
2.131 + </apk>
2.132 + <extractDuplicates>true</extractDuplicates>
2.133 + </configuration>
2.134 + <executions>
2.135 + <execution>
2.136 + <id>apk</id>
2.137 + <goals>
2.138 + <goal>apk</goal>
2.139 + <goal>dex</goal>
2.140 + </goals>
2.141 + </execution>
2.142 + </executions>
2.143 + </plugin>
2.144 + </plugins>
2.145 + </build>
2.146 + <dependencies>
2.147 + <dependency>
2.148 + <groupId>org.apidesign.demo</groupId>
2.149 + <artifactId>chat</artifactId>
2.150 + <version>${project.version}</version>
2.151 + <exclusions>
2.152 + <exclusion>
2.153 + <groupId>org.netbeans.html</groupId>
2.154 + <artifactId>net.java.html.boot.fx</artifactId>
2.155 + </exclusion>
2.156 + </exclusions>
2.157 + </dependency>
2.158 + <dependency>
2.159 + <groupId>com.google.android</groupId>
2.160 + <artifactId>android</artifactId>
2.161 + <version>${platform.version}</version>
2.162 + <scope>provided</scope>
2.163 + </dependency>
2.164 + <dependency>
2.165 + <groupId>com.dukescript.presenters</groupId>
2.166 + <artifactId>android</artifactId>
2.167 + <version>0.9.1</version>
2.168 + <type>jar</type>
2.169 + <exclusions>
2.170 + <exclusion>
2.171 + <groupId>org.netbeans.html</groupId>
2.172 + <artifactId>net.java.html.boot</artifactId>
2.173 + </exclusion>
2.174 + <exclusion>
2.175 + <groupId>org.netbeans.html</groupId>
2.176 + <artifactId>net.java.html.sound</artifactId>
2.177 + </exclusion>
2.178 + </exclusions>
2.179 + </dependency>
2.180 + <dependency>
2.181 + <groupId>org.netbeans.html</groupId>
2.182 + <artifactId>ko4j</artifactId>
2.183 + <version>${net.java.html.version}</version>
2.184 + </dependency>
2.185 + <dependency>
2.186 + <groupId>org.netbeans.html</groupId>
2.187 + <artifactId>net.java.html.boot</artifactId>
2.188 + <version>${net.java.html.version}</version>
2.189 + </dependency>
2.190 + <dependency>
2.191 + <groupId>org.netbeans.html</groupId>
2.192 + <artifactId>net.java.html.sound</artifactId>
2.193 + <version>${net.java.html.version}</version>
2.194 + </dependency>
2.195 + <dependency>
2.196 + <groupId>org.netbeans.html</groupId>
2.197 + <artifactId>ko-ws-tyrus</artifactId>
2.198 + <version>${net.java.html.version}</version>
2.199 + <exclusions>
2.200 + <exclusion>
2.201 + <artifactId>org.json-osgi</artifactId>
2.202 + <groupId>de.twentyeleven.skysail</groupId>
2.203 + </exclusion>
2.204 + </exclusions>
2.205 + </dependency>
2.206 + </dependencies>
2.207 +</project>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/chat/client-android/src/main/AndroidManifest.xml Fri Apr 22 05:56:47 2016 +0200
3.3 @@ -0,0 +1,59 @@
3.4 +<?xml version="1.0" encoding="utf-8"?>
3.5 +<!--
3.6 +
3.7 + The MIT License (MIT)
3.8 +
3.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
3.10 +
3.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
3.12 + of this software and associated documentation files (the "Software"), to deal
3.13 + in the Software without restriction, including without limitation the rights
3.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3.15 + copies of the Software, and to permit persons to whom the Software is
3.16 + furnished to do so, subject to the following conditions:
3.17 +
3.18 + The above copyright notice and this permission notice shall be included in
3.19 + all copies or substantial portions of the Software.
3.20 +
3.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3.27 + THE SOFTWARE.
3.28 +
3.29 +-->
3.30 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3.31 + package="org.apidesign.demo.chat"
3.32 + android:versionCode="1"
3.33 + android:versionName="1.0-SNAPSHOT" >
3.34 +
3.35 + <uses-sdk
3.36 + android:minSdkVersion="8"
3.37 + android:targetSdkVersion="16" />
3.38 +
3.39 + <application
3.40 + android:allowBackup="true"
3.41 + android:icon="@drawable/ic_launcher"
3.42 + android:label="chat"
3.43 + android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">
3.44 + <activity android:name="com.dukescript.presenters.Android"
3.45 + android:configChanges="orientation|screenSize">
3.46 + <intent-filter>
3.47 + <action android:name="android.intent.action.MAIN" />
3.48 + <category android:name="android.intent.category.LAUNCHER" />
3.49 + </intent-filter>
3.50 + </activity>
3.51 +
3.52 + <!-- Configuration section. Defines:
3.53 + - the HTML page to load on start
3.54 + - the class that contains the main initialization method
3.55 + - name of the initialization method in the given class
3.56 + -->
3.57 + <meta-data android:name="loadPage" android:value="file:///android_asset/pages/index.html" />
3.58 + <meta-data android:name="loadClass" android:value="org.apidesign.demo.chat.AndroidMain" />
3.59 + <meta-data android:name="invoke" android:value="main" />
3.60 + </application>
3.61 + <uses-permission android:name="android.permission.INTERNET" />
3.62 +</manifest>
4.1 Binary file chat/client-android/src/main/icons/launcher.png has changed
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/chat/client-android/src/main/java/org/apidesign/demo/chat/AndroidMain.java Fri Apr 22 05:56:47 2016 +0200
5.3 @@ -0,0 +1,33 @@
5.4 +/**
5.5 + * The MIT License (MIT)
5.6 + *
5.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5.8 + *
5.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
5.10 + * of this software and associated documentation files (the "Software"), to deal
5.11 + * in the Software without restriction, including without limitation the rights
5.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5.13 + * copies of the Software, and to permit persons to whom the Software is
5.14 + * furnished to do so, subject to the following conditions:
5.15 + *
5.16 + * The above copyright notice and this permission notice shall be included in
5.17 + * all copies or substantial portions of the Software.
5.18 + *
5.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5.25 + * THE SOFTWARE.
5.26 + */
5.27 +package org.apidesign.demo.chat;
5.28 +
5.29 +public class AndroidMain {
5.30 + private AndroidMain() {
5.31 + }
5.32 +
5.33 + public static void main(String... args) throws Exception {
5.34 + ChatClient.onPageLoad();
5.35 + }
5.36 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/chat/client-ios/nbactions.xml Fri Apr 22 05:56:47 2016 +0200
6.3 @@ -0,0 +1,93 @@
6.4 +<?xml version="1.0" encoding="UTF-8"?>
6.5 +<!--
6.6 +
6.7 + The MIT License (MIT)
6.8 +
6.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
6.10 +
6.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
6.12 + of this software and associated documentation files (the "Software"), to deal
6.13 + in the Software without restriction, including without limitation the rights
6.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6.15 + copies of the Software, and to permit persons to whom the Software is
6.16 + furnished to do so, subject to the following conditions:
6.17 +
6.18 + The above copyright notice and this permission notice shall be included in
6.19 + all copies or substantial portions of the Software.
6.20 +
6.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
6.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
6.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
6.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
6.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
6.27 + THE SOFTWARE.
6.28 +
6.29 +-->
6.30 +<actions>
6.31 + <action>
6.32 + <actionName>run</actionName>
6.33 + <goals>
6.34 + <goal>package</goal>
6.35 + <goal>robovm:ipad-sim</goal>
6.36 + </goals>
6.37 + <properties>
6.38 + <skipTests>true</skipTests>
6.39 + </properties>
6.40 + </action>
6.41 + <action>
6.42 + <actionName>debug</actionName>
6.43 + <goals>
6.44 + <goal>package</goal>
6.45 + <goal>robovm:ipad-sim</goal>
6.46 + </goals>
6.47 + <properties>
6.48 + <skipTests>true</skipTests>
6.49 + <robovm.debug>clientmode</robovm.debug>
6.50 + <robovm.debugPort>${jpda.address}</robovm.debugPort>
6.51 + <jpda.listen>true</jpda.listen>
6.52 + </properties>
6.53 + </action>
6.54 + <action>
6.55 + <actionName>CUSTOM-ipad-sim</actionName>
6.56 + <displayName>Run in iPad Simulator</displayName>
6.57 + <goals>
6.58 + <goal>package</goal>
6.59 + <goal>robovm:ipad-sim</goal>
6.60 + </goals>
6.61 + <properties>
6.62 + <skipTests>true</skipTests>
6.63 + </properties>
6.64 + </action>
6.65 + <action>
6.66 + <actionName>CUSTOM-iphone-sim</actionName>
6.67 + <displayName>Run in iPhone Simulator</displayName>
6.68 + <goals>
6.69 + <goal>package</goal>
6.70 + <goal>robovm:iphone-sim</goal>
6.71 + </goals>
6.72 + <properties>
6.73 + <skipTests>true</skipTests>
6.74 + </properties>
6.75 + </action>
6.76 + <action>
6.77 + <actionName>CUSTOM-ios-device</actionName>
6.78 + <displayName>Run on iOS Device</displayName>
6.79 + <goals>
6.80 + <goal>package</goal>
6.81 + <goal>robovm:ios-device</goal>
6.82 + </goals>
6.83 + <properties>
6.84 + <skipTests>true</skipTests>
6.85 + </properties>
6.86 + </action>
6.87 + <action>
6.88 + <actionName>CUSTOM-create-ipa</actionName>
6.89 + <displayName>Create iOS Package Archive</displayName>
6.90 + <goals>
6.91 + <goal>clean</goal>
6.92 + <goal>package</goal>
6.93 + <goal>robovm:create-ipa</goal>
6.94 + </goals>
6.95 + </action>
6.96 +</actions>
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/chat/client-ios/pom.xml Fri Apr 22 05:56:47 2016 +0200
7.3 @@ -0,0 +1,256 @@
7.4 +<?xml version="1.0"?>
7.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7.6 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
7.7 + <modelVersion>4.0.0</modelVersion>
7.8 +
7.9 + <parent>
7.10 + <groupId>org.apidesign.demo</groupId>
7.11 + <artifactId>chat-pom</artifactId>
7.12 + <version>1.0-SNAPSHOT</version>
7.13 + </parent>
7.14 +
7.15 + <groupId>org.apidesign.demo</groupId>
7.16 + <artifactId>chat-ios</artifactId>
7.17 + <version>1.0-SNAPSHOT</version>
7.18 + <packaging>jar</packaging>
7.19 +
7.20 + <name>chat Client for iOS</name>
7.21 +
7.22 + <properties>
7.23 + <project.mainclass>org.apidesign.demo.chat.iOSMain</project.mainclass>
7.24 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
7.25 + <robovm.version>1.6.0</robovm.version>
7.26 + </properties>
7.27 + <build>
7.28 + <plugins>
7.29 + <plugin>
7.30 + <groupId>org.netbeans.html</groupId>
7.31 + <artifactId>html4j-maven-plugin</artifactId>
7.32 + <version>${net.java.html.version}</version>
7.33 + <executions>
7.34 + <execution>
7.35 + <id>js-classes</id>
7.36 + <goals>
7.37 + <goal>process-js-annotations</goal>
7.38 + </goals>
7.39 + </execution>
7.40 + </executions>
7.41 + </plugin>
7.42 + <plugin>
7.43 + <groupId>org.apache.maven.plugins</groupId>
7.44 + <artifactId>maven-compiler-plugin</artifactId>
7.45 + <version>2.3.2</version>
7.46 + <configuration>
7.47 + <source>1.7</source>
7.48 + <target>1.7</target>
7.49 + </configuration>
7.50 + </plugin>
7.51 + <plugin>
7.52 + <groupId>org.apache.maven.plugins</groupId>
7.53 + <artifactId>maven-jar-plugin</artifactId>
7.54 + <version>2.4</version>
7.55 + </plugin>
7.56 + <plugin>
7.57 + <groupId>org.apache.maven.plugins</groupId>
7.58 + <artifactId>maven-dependency-plugin</artifactId>
7.59 + <version>2.9</version>
7.60 + <executions>
7.61 + <execution>
7.62 + <id>unpack</id>
7.63 + <phase>process-resources</phase>
7.64 + <goals>
7.65 + <goal>unpack-dependencies</goal>
7.66 + </goals>
7.67 + </execution>
7.68 + </executions>
7.69 + <configuration>
7.70 + <type>zip</type>
7.71 + <classifier>webpages</classifier>
7.72 + <overWrite>true</overWrite>
7.73 + <outputDirectory>target/web/pages</outputDirectory>
7.74 + <includes>*/**</includes>
7.75 + </configuration>
7.76 + </plugin>
7.77 + <plugin>
7.78 + <groupId>com.filmon.maven</groupId>
7.79 + <artifactId>image-maven-plugin</artifactId>
7.80 + <version>1.2.1</version>
7.81 + <executions>
7.82 + <execution>
7.83 + <goals>
7.84 + <goal>scale</goal>
7.85 + <goal>crop</goal>
7.86 + </goals>
7.87 + <configuration>
7.88 + <outputDirectory>target/images</outputDirectory>
7.89 + <images>
7.90 + <image>
7.91 + <source>src/main/icons/launcher.png</source>
7.92 + <destination>Icon.png</destination>
7.93 + <width>57</width>
7.94 + </image>
7.95 + <image>
7.96 + <source>src/main/icons/launcher.png</source>
7.97 + <destination>Icon@2.png</destination>
7.98 + <width>114</width>
7.99 + </image>
7.100 + <image>
7.101 + <source>src/main/icons/launcher.png</source>
7.102 + <destination>Icon-60.png</destination>
7.103 + <width>60</width>
7.104 + </image>
7.105 + <image>
7.106 + <source>src/main/icons/launcher.png</source>
7.107 + <destination>Icon-60@2.png</destination>
7.108 + <width>120</width>
7.109 + </image>
7.110 + <image>
7.111 + <source>src/main/icons/launcher.png</source>
7.112 + <destination>Icon-72.png</destination>
7.113 + <width>72</width>
7.114 + </image>
7.115 + <image>
7.116 + <source>src/main/icons/launcher.png</source>
7.117 + <destination>Icon-76.png</destination>
7.118 + <width>76</width>
7.119 + </image>
7.120 + <image>
7.121 + <source>src/main/icons/launcher.png</source>
7.122 + <destination>Default@2x.png</destination>
7.123 + <width>240</width>
7.124 + <cropWidth>640</cropWidth>
7.125 + <cropHeight>960</cropHeight>
7.126 + <color>white</color>
7.127 + </image>
7.128 + <image>
7.129 + <source>src/main/icons/launcher.png</source>
7.130 + <destination>Default-568h@2x.png</destination>
7.131 + <width>240</width>
7.132 + <cropWidth>640</cropWidth>
7.133 + <cropHeight>1136</cropHeight>
7.134 + <color>white</color>
7.135 + </image>
7.136 + <image>
7.137 + <source>src/main/icons/launcher.png</source>
7.138 + <destination>Default.png</destination>
7.139 + <width>120</width>
7.140 + <cropWidth>320</cropWidth>
7.141 + <cropHeight>480</cropHeight>
7.142 + <color>white</color>
7.143 + </image>
7.144 + <image>
7.145 + <source>src/main/icons/launcher.png</source>
7.146 + <destination>Default@2x-Landscape.png</destination>
7.147 + <width>240</width>
7.148 + <cropWidth>960</cropWidth>
7.149 + <cropHeight>640</cropHeight>
7.150 + <color>white</color>
7.151 + </image>
7.152 + <image>
7.153 + <source>src/main/icons/launcher.png</source>
7.154 + <destination>Default-568h@2x-Landscape.png</destination>
7.155 + <width>240</width>
7.156 + <cropWidth>1136</cropWidth>
7.157 + <cropHeight>640</cropHeight>
7.158 + <color>white</color>
7.159 + </image>
7.160 + <image>
7.161 + <source>src/main/icons/launcher.png</source>
7.162 + <destination>Default-Landscape.png</destination>
7.163 + <width>120</width>
7.164 + <cropWidth>480</cropWidth>
7.165 + <cropHeight>320</cropHeight>
7.166 + <color>white</color>
7.167 + </image>
7.168 + </images>
7.169 + </configuration>
7.170 + </execution>
7.171 + </executions>
7.172 + </plugin>
7.173 + <plugin>
7.174 + <groupId>org.robovm</groupId>
7.175 + <artifactId>robovm-maven-plugin</artifactId>
7.176 + <version>${robovm.version}</version>
7.177 + <configuration>
7.178 + <config>
7.179 + <mainClass>${project.mainclass}</mainClass>
7.180 + <forceLinkClasses>
7.181 + <pattern>java.util.logging.ConsoleHandler</pattern>
7.182 + <pattern>java.util.logging.SimpleFormatter</pattern>
7.183 + </forceLinkClasses>
7.184 + <executableName>chat</executableName>
7.185 + <resources>
7.186 + <resource>target/web/pages/</resource>
7.187 + <resource>
7.188 + <targetPath>/</targetPath>
7.189 + <directory>target/images/</directory>
7.190 + <includes>
7.191 + <include>*.png</include>
7.192 + </includes>
7.193 + </resource>
7.194 + </resources>
7.195 + <os>ios</os>
7.196 + </config>
7.197 + <includeJFX>false</includeJFX>
7.198 + </configuration>
7.199 + <!--
7.200 + <executions>
7.201 + <execution>
7.202 + <phase>package</phase>
7.203 + <goals>
7.204 + <goal>create-ipa</goal>
7.205 + </goals>
7.206 + </execution>
7.207 + </executions>
7.208 + -->
7.209 + </plugin>
7.210 + </plugins>
7.211 + </build>
7.212 + <dependencies>
7.213 + <dependency>
7.214 + <groupId>org.apidesign.demo</groupId>
7.215 + <artifactId>chat</artifactId>
7.216 + <version>${project.version}</version>
7.217 + <exclusions>
7.218 + <exclusion>
7.219 + <groupId>org.netbeans.html</groupId>
7.220 + <artifactId>net.java.html.boot.fx</artifactId>
7.221 + </exclusion>
7.222 + </exclusions>
7.223 + </dependency>
7.224 + <dependency>
7.225 + <groupId>com.dukescript.presenters</groupId>
7.226 + <artifactId>ios</artifactId>
7.227 + <version>0.9.1</version>
7.228 + <scope>runtime</scope>
7.229 + <exclusions>
7.230 + <exclusion>
7.231 + <groupId>org.netbeans.html</groupId>
7.232 + <artifactId>net.java.html.geo</artifactId>
7.233 + </exclusion>
7.234 + <exclusion>
7.235 + <groupId>org.netbeans.html</groupId>
7.236 + <artifactId>net.java.html.boot</artifactId>
7.237 + </exclusion>
7.238 + </exclusions>
7.239 + </dependency>
7.240 + <dependency>
7.241 + <groupId>org.netbeans.html</groupId>
7.242 + <artifactId>net.java.html.geo</artifactId>
7.243 + <version>${net.java.html.version}</version>
7.244 + <scope>runtime</scope>
7.245 + </dependency>
7.246 + <dependency>
7.247 + <groupId>org.robovm</groupId>
7.248 + <artifactId>robovm-cocoatouch</artifactId>
7.249 + <version>${robovm.version}</version>
7.250 + <type>jar</type>
7.251 + </dependency>
7.252 + <dependency>
7.253 + <groupId>org.robovm</groupId>
7.254 + <artifactId>robovm-rt</artifactId>
7.255 + <version>${robovm.version}</version>
7.256 + <type>jar</type>
7.257 + </dependency>
7.258 + </dependencies>
7.259 +</project>
8.1 Binary file chat/client-ios/src/main/icons/launcher.png has changed
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/chat/client-ios/src/main/java/org/apidesign/demo/chat/iOSMain.java Fri Apr 22 05:56:47 2016 +0200
9.3 @@ -0,0 +1,32 @@
9.4 +/**
9.5 + * The MIT License (MIT)
9.6 + *
9.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
9.8 + *
9.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
9.10 + * of this software and associated documentation files (the "Software"), to deal
9.11 + * in the Software without restriction, including without limitation the rights
9.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9.13 + * copies of the Software, and to permit persons to whom the Software is
9.14 + * furnished to do so, subject to the following conditions:
9.15 + *
9.16 + * The above copyright notice and this permission notice shall be included in
9.17 + * all copies or substantial portions of the Software.
9.18 + *
9.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
9.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
9.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
9.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
9.25 + * THE SOFTWARE.
9.26 + */
9.27 +package org.apidesign.demo.chat;
9.28 +
9.29 +final class iOSMain {
9.30 + public static void main(String... args) throws Exception {
9.31 + Main.main(args);
9.32 + }
9.33 +}
9.34 +
9.35 +
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/chat/client-netbeans/nbactions.xml Fri Apr 22 05:56:47 2016 +0200
10.3 @@ -0,0 +1,74 @@
10.4 +<?xml version="1.0" encoding="UTF-8"?>
10.5 +<!--
10.6 +
10.7 + The MIT License (MIT)
10.8 +
10.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
10.10 +
10.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
10.12 + of this software and associated documentation files (the "Software"), to deal
10.13 + in the Software without restriction, including without limitation the rights
10.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10.15 + copies of the Software, and to permit persons to whom the Software is
10.16 + furnished to do so, subject to the following conditions:
10.17 +
10.18 + The above copyright notice and this permission notice shall be included in
10.19 + all copies or substantial portions of the Software.
10.20 +
10.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
10.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
10.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
10.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
10.27 + THE SOFTWARE.
10.28 +
10.29 +-->
10.30 +<actions>
10.31 + <action>
10.32 + <actionName>run</actionName>
10.33 + <goals>
10.34 + <goal>package</goal>
10.35 + <goal>nbm:cluster</goal>
10.36 + <goal>nbm:run-platform</goal>
10.37 + </goals>
10.38 + <properties>
10.39 + <skipTests>true</skipTests>
10.40 + </properties>
10.41 + </action>
10.42 + <action>
10.43 + <actionName>debug</actionName>
10.44 + <goals>
10.45 + <goal>package</goal>
10.46 + <goal>nbm:cluster</goal>
10.47 + <goal>nbm:run-platform</goal>
10.48 + </goals>
10.49 + <properties>
10.50 + <skipTests>true</skipTests>
10.51 + <jpda.listen>true</jpda.listen>
10.52 + <netbeans.run.params.debug>-J-Xdebug -J-Xrunjdwp:transport=dt_socket,suspend=n,server=n,address=${jpda.address}</netbeans.run.params.debug>
10.53 + <firebug.lite>true</firebug.lite>
10.54 + </properties>
10.55 + </action>
10.56 + <action>
10.57 + <actionName>CUSTOM-nbrwsr-run</actionName>
10.58 + <displayName>Run in NetBeans</displayName>
10.59 + <goals>
10.60 + <goal>clean</goal>
10.61 + <goal>package</goal>
10.62 + <goal>nbm:cluster</goal>
10.63 + <goal>nbm:run-ide</goal>
10.64 + </goals>
10.65 + <properties>
10.66 + <skipTests>true</skipTests>
10.67 + </properties>
10.68 + </action>
10.69 + <action>
10.70 + <actionName>CUSTOM-nbrwsr-nbm</actionName>
10.71 + <displayName>Build NetBeans NBM file</displayName>
10.72 + <goals>
10.73 + <goal>clean</goal>
10.74 + <goal>install</goal>
10.75 + </goals>
10.76 + </action>
10.77 +</actions>
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/chat/client-netbeans/pom.xml Fri Apr 22 05:56:47 2016 +0200
11.3 @@ -0,0 +1,221 @@
11.4 +<?xml version="1.0"?>
11.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11.6 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
11.7 + <modelVersion>4.0.0</modelVersion>
11.8 +
11.9 + <parent>
11.10 + <groupId>org.apidesign.demo</groupId>
11.11 + <artifactId>chat-pom</artifactId>
11.12 + <version>1.0-SNAPSHOT</version>
11.13 + </parent>
11.14 +
11.15 + <groupId>org.apidesign.demo</groupId>
11.16 + <artifactId>chat-nb</artifactId>
11.17 + <version>1.0-SNAPSHOT</version>
11.18 + <packaging>nbm-application</packaging>
11.19 +
11.20 + <name>chat Client for NetBeans</name>
11.21 +
11.22 + <properties>
11.23 + <netbeans.version>RELEASE81</netbeans.version>
11.24 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
11.25 + <project.mainclass>org.apidesign.demo.chat.NbMain</project.mainclass>
11.26 + </properties>
11.27 + <repositories>
11.28 + <repository>
11.29 + <id>netbeans</id>
11.30 + <name>NetBeans</name>
11.31 + <url>http://bits.netbeans.org/maven2/</url>
11.32 + </repository>
11.33 + <repository>
11.34 + <id>dev</id>
11.35 + <name>NetBeans</name>
11.36 + <url>http://bits.netbeans.org/nexus/content/repositories/snapshots/</url>
11.37 + <snapshots>
11.38 + <enabled>true</enabled>
11.39 + </snapshots>
11.40 + </repository>
11.41 + </repositories>
11.42 + <build>
11.43 + <plugins>
11.44 + <plugin>
11.45 + <groupId>org.netbeans.html</groupId>
11.46 + <artifactId>html4j-maven-plugin</artifactId>
11.47 + <version>${net.java.html.version}</version>
11.48 + <executions>
11.49 + <execution>
11.50 + <id>js-classes</id>
11.51 + <goals>
11.52 + <goal>process-js-annotations</goal>
11.53 + </goals>
11.54 + </execution>
11.55 + </executions>
11.56 + </plugin>
11.57 + <plugin>
11.58 + <groupId>org.apache.maven.plugins</groupId>
11.59 + <artifactId>maven-compiler-plugin</artifactId>
11.60 + <version>3.3</version>
11.61 + <executions>
11.62 + <execution>
11.63 + <id>default-compile</id>
11.64 + <phase>process-sources</phase>
11.65 + <goals>
11.66 + <goal>compile</goal>
11.67 + </goals>
11.68 + </execution>
11.69 + </executions>
11.70 + <configuration>
11.71 + <source>1.7</source>
11.72 + <target>1.7</target>
11.73 + </configuration>
11.74 + </plugin>
11.75 + <plugin>
11.76 + <groupId>org.apache.maven.plugins</groupId>
11.77 + <artifactId>maven-jar-plugin</artifactId>
11.78 + <version>2.4</version>
11.79 + <executions>
11.80 + <execution>
11.81 + <id>jar</id>
11.82 + <goals>
11.83 + <goal>jar</goal>
11.84 + </goals>
11.85 + <phase>prepare-package</phase>
11.86 + </execution>
11.87 + </executions>
11.88 + <configuration>
11.89 + <!-- to have the jar plugin pickup the nbm generated manifest -->
11.90 + <useDefaultManifestFile>true</useDefaultManifestFile>
11.91 + </configuration>
11.92 + </plugin>
11.93 + <plugin>
11.94 + <groupId>org.apache.maven.plugins</groupId>
11.95 + <artifactId>maven-dependency-plugin</artifactId>
11.96 + <version>2.9</version>
11.97 + <executions>
11.98 + <execution>
11.99 + <id>unpack</id>
11.100 + <phase>generate-sources</phase>
11.101 + <goals>
11.102 + <goal>unpack</goal>
11.103 + </goals>
11.104 + </execution>
11.105 + </executions>
11.106 + <configuration>
11.107 + <artifactItems>
11.108 + <artifactItem>
11.109 + <groupId>org.apidesign.demo</groupId>
11.110 + <artifactId>chat</artifactId>
11.111 + <version>${project.version}</version>
11.112 + <type>zip</type>
11.113 + <classifier>webpages</classifier>
11.114 + <overWrite>true</overWrite>
11.115 + <outputDirectory>${project.build.directory}/classes/org/apidesign/demo/chat</outputDirectory>
11.116 + </artifactItem>
11.117 + </artifactItems>
11.118 + </configuration>
11.119 + </plugin>
11.120 + <plugin>
11.121 + <groupId>org.codehaus.mojo</groupId>
11.122 + <artifactId>nbm-maven-plugin</artifactId>
11.123 + <version>3.14.1</version>
11.124 + <extensions>true</extensions>
11.125 + <executions>
11.126 + <execution>
11.127 + <id>default-manifest</id>
11.128 + <phase>process-classes</phase>
11.129 + <goals>
11.130 + <goal>manifest</goal>
11.131 + </goals>
11.132 + <configuration>
11.133 + <useOSGiDependencies>true</useOSGiDependencies>
11.134 + <brandingToken>chat</brandingToken>
11.135 + <cluster>chat</cluster>
11.136 + <verifyIntegrity>false</verifyIntegrity>
11.137 + </configuration>
11.138 + </execution>
11.139 + <execution>
11.140 + <id>default-nbm</id>
11.141 + <phase>package</phase>
11.142 + <goals>
11.143 + <goal>nbm</goal>
11.144 + </goals>
11.145 + <configuration>
11.146 + <useOSGiDependencies>true</useOSGiDependencies>
11.147 + <cluster>extra</cluster>
11.148 + <verifyIntegrity>false</verifyIntegrity>
11.149 + </configuration>
11.150 + </execution>
11.151 + </executions>
11.152 + <configuration>
11.153 + <useOSGiDependencies>true</useOSGiDependencies>
11.154 + <brandingToken>netbeans</brandingToken>
11.155 + <cluster>chat</cluster>
11.156 + <verifyIntegrity>false</verifyIntegrity>
11.157 + <nbmBuildDir>${project.build.directory}</nbmBuildDir>
11.158 + </configuration>
11.159 + </plugin>
11.160 + <plugin>
11.161 + <groupId>com.filmon.maven</groupId>
11.162 + <artifactId>image-maven-plugin</artifactId>
11.163 + <version>1.1</version>
11.164 + <executions>
11.165 + <execution>
11.166 + <goals>
11.167 + <goal>scale</goal>
11.168 + </goals>
11.169 + <configuration>
11.170 + <outputDirectory>target/classes/org/apidesign/demo/chat</outputDirectory>
11.171 + <images>
11.172 + <image>
11.173 + <source>src/main/icons/launcher.png</source>
11.174 + <destination>icon.png</destination>
11.175 + <width>16</width>
11.176 + </image>
11.177 + <image>
11.178 + <source>src/main/icons/launcher.png</source>
11.179 + <destination>icon24.png</destination>
11.180 + <width>24</width>
11.181 + </image>
11.182 + </images>
11.183 + </configuration>
11.184 + </execution>
11.185 + </executions>
11.186 + </plugin>
11.187 + </plugins>
11.188 + </build>
11.189 + <dependencies>
11.190 + <dependency>
11.191 + <groupId>org.apidesign.demo</groupId>
11.192 + <artifactId>chat</artifactId>
11.193 + <version>${project.version}</version>
11.194 + <exclusions>
11.195 + <exclusion>
11.196 + <groupId>org.netbeans.html</groupId>
11.197 + <artifactId>net.java.html.boot.fx</artifactId>
11.198 + </exclusion>
11.199 + </exclusions>
11.200 + </dependency>
11.201 + <dependency>
11.202 + <groupId>org.netbeans.html</groupId>
11.203 + <artifactId>net.java.html.boot</artifactId>
11.204 + <version>${net.java.html.version}</version>
11.205 + </dependency>
11.206 + <dependency>
11.207 + <groupId>org.netbeans.html</groupId>
11.208 + <artifactId>net.java.html.boot.fx</artifactId>
11.209 + <version>${net.java.html.version}</version>
11.210 + <scope>runtime</scope>
11.211 + </dependency>
11.212 + <dependency>
11.213 + <groupId>org.netbeans.api</groupId>
11.214 + <artifactId>org-netbeans-api-htmlui</artifactId>
11.215 + <version>${netbeans.version}</version>
11.216 + </dependency>
11.217 + <dependency>
11.218 + <groupId>org.netbeans.cluster</groupId>
11.219 + <artifactId>platform</artifactId>
11.220 + <version>${netbeans.version}</version>
11.221 + <type>pom</type>
11.222 + </dependency>
11.223 + </dependencies>
11.224 +</project>
12.1 Binary file chat/client-netbeans/src/main/icons/launcher.png has changed
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/chat/client-netbeans/src/main/java/org/apidesign/demo/chat/NbMain.java Fri Apr 22 05:56:47 2016 +0200
13.3 @@ -0,0 +1,51 @@
13.4 +/**
13.5 + * The MIT License (MIT)
13.6 + *
13.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
13.8 + *
13.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
13.10 + * of this software and associated documentation files (the "Software"), to deal
13.11 + * in the Software without restriction, including without limitation the rights
13.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13.13 + * copies of the Software, and to permit persons to whom the Software is
13.14 + * furnished to do so, subject to the following conditions:
13.15 + *
13.16 + * The above copyright notice and this permission notice shall be included in
13.17 + * all copies or substantial portions of the Software.
13.18 + *
13.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
13.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
13.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
13.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
13.25 + * THE SOFTWARE.
13.26 + */
13.27 +package org.apidesign.demo.chat;
13.28 +
13.29 +import org.netbeans.api.htmlui.OpenHTMLRegistration;
13.30 +import org.openide.awt.ActionID;
13.31 +import org.openide.awt.ActionReference;
13.32 +import org.openide.awt.ActionReferences;
13.33 +
13.34 +public class NbMain {
13.35 + private NbMain() {
13.36 + }
13.37 +
13.38 + @ActionID(
13.39 + category = "Games",
13.40 + id = "org.apidesign.demo.chat.OpenPage"
13.41 + )
13.42 + @OpenHTMLRegistration(
13.43 + url="index.html",
13.44 + displayName = "Open Your Page",
13.45 + iconBase = "org/apidesign/demo/chat/icon.png"
13.46 + )
13.47 + @ActionReferences({
13.48 + @ActionReference(path = "Menu/Window"),
13.49 + @ActionReference(path = "Toolbars/Games")
13.50 + })
13.51 + public static void onPageLoad() throws Exception {
13.52 + Main.onPageLoad();
13.53 + }
13.54 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/chat/client-web/nbactions.xml Fri Apr 22 05:56:47 2016 +0200
14.3 @@ -0,0 +1,76 @@
14.4 +<?xml version="1.0" encoding="UTF-8"?>
14.5 +<!--
14.6 +
14.7 + The MIT License (MIT)
14.8 +
14.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
14.10 +
14.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
14.12 + of this software and associated documentation files (the "Software"), to deal
14.13 + in the Software without restriction, including without limitation the rights
14.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14.15 + copies of the Software, and to permit persons to whom the Software is
14.16 + furnished to do so, subject to the following conditions:
14.17 +
14.18 + The above copyright notice and this permission notice shall be included in
14.19 + all copies or substantial portions of the Software.
14.20 +
14.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
14.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
14.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
14.27 + THE SOFTWARE.
14.28 +
14.29 +-->
14.30 +<actions>
14.31 + <action>
14.32 + <actionName>run</actionName>
14.33 + <packagings>
14.34 + <packaging>jar</packaging>
14.35 + </packagings>
14.36 + <goals>
14.37 + <goal>package</goal>
14.38 + <goal>bck2brwsr:show</goal>
14.39 + </goals>
14.40 + <properties>
14.41 + <skipTests>true</skipTests>
14.42 + </properties>
14.43 + </action>
14.44 + <action>
14.45 + <actionName>debug</actionName>
14.46 + <packagings>
14.47 + <packaging>jar</packaging>
14.48 + </packagings>
14.49 + <goals>
14.50 + <goal>package</goal>
14.51 + <goal>bck2brwsr:show</goal>
14.52 + </goals>
14.53 + <properties>
14.54 + <skipTests>true</skipTests>
14.55 + <bck2brwsr.obfuscationlevel>NONE</bck2brwsr.obfuscationlevel>
14.56 + <jpda.listen>maven</jpda.listen>
14.57 + </properties>
14.58 + </action>
14.59 + <action>
14.60 + <actionName>CUSTOM-bck2brwsr-show</actionName>
14.61 + <displayName>Run in a Browser</displayName>
14.62 + <goals>
14.63 + <goal>package</goal>
14.64 + <goal>bck2brwsr:show</goal>
14.65 + </goals>
14.66 + <properties>
14.67 + <skipTests>true</skipTests>
14.68 + <bck2brwsr.obfuscationlevel>NONE</bck2brwsr.obfuscationlevel>
14.69 + </properties>
14.70 + </action>
14.71 + <action>
14.72 + <actionName>CUSTOM-bck2brwsr-web</actionName>
14.73 + <displayName>Package for website</displayName>
14.74 + <goals>
14.75 + <goal>clean</goal>
14.76 + <goal>package</goal>
14.77 + </goals>
14.78 + </action>
14.79 +</actions>
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/chat/client-web/pom.xml Fri Apr 22 05:56:47 2016 +0200
15.3 @@ -0,0 +1,189 @@
15.4 +<?xml version="1.0"?>
15.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15.6 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
15.7 + <modelVersion>4.0.0</modelVersion>
15.8 +
15.9 + <parent>
15.10 + <groupId>org.apidesign.demo</groupId>
15.11 + <artifactId>chat-pom</artifactId>
15.12 + <version>1.0-SNAPSHOT</version>
15.13 + </parent>
15.14 +
15.15 + <groupId>org.apidesign.demo</groupId>
15.16 + <artifactId>chat-web</artifactId>
15.17 + <version>1.0-SNAPSHOT</version>
15.18 + <packaging>jar</packaging>
15.19 +
15.20 + <name>chat Client for Web</name>
15.21 +
15.22 + <properties>
15.23 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
15.24 + <project.mainclass>org.apidesign.demo.chat.BrowserMain</project.mainclass>
15.25 + <browser.bootstrap>initialize bck2brwsr -->
15.26 +<script type="text/javascript" src="bck2brwsr.js"></script>
15.27 +<script>
15.28 + var vm = bck2brwsr('chat.js');
15.29 + var c = vm.loadClass('org.apidesign.demo.chat.BrowserMain');
15.30 + c.invoke('main');
15.31 +</script>
15.32 +<!-- end of initialization </browser.bootstrap>
15.33 + </properties>
15.34 + <build>
15.35 + <plugins>
15.36 + <plugin>
15.37 + <groupId>org.netbeans.html</groupId>
15.38 + <artifactId>html4j-maven-plugin</artifactId>
15.39 + <version>${net.java.html.version}</version>
15.40 + <executions>
15.41 + <execution>
15.42 + <id>js-classes</id>
15.43 + <goals>
15.44 + <goal>process-js-annotations</goal>
15.45 + </goals>
15.46 + </execution>
15.47 + </executions>
15.48 + </plugin>
15.49 + <plugin>
15.50 + <groupId>org.apache.maven.plugins</groupId>
15.51 + <artifactId>maven-compiler-plugin</artifactId>
15.52 + <version>2.3.2</version>
15.53 + <configuration>
15.54 + <source>1.7</source>
15.55 + <target>1.7</target>
15.56 + <compilerArguments>
15.57 + <bootclasspath>netbeans.ignore.jdk.bootclasspath</bootclasspath>
15.58 + </compilerArguments>
15.59 + </configuration>
15.60 + </plugin>
15.61 + <plugin>
15.62 + <groupId>org.apache.maven.plugins</groupId>
15.63 + <artifactId>maven-jar-plugin</artifactId>
15.64 + <version>2.4</version>
15.65 + <configuration>
15.66 + <archive>
15.67 + <manifest>
15.68 + <mainClass>${project.mainclass}</mainClass>
15.69 + <addClasspath>true</addClasspath>
15.70 + <classpathPrefix>lib/</classpathPrefix>
15.71 + <useUniqueVersions>false</useUniqueVersions>
15.72 + </manifest>
15.73 + </archive>
15.74 + </configuration>
15.75 + </plugin>
15.76 + <plugin>
15.77 + <groupId>org.apidesign.bck2brwsr</groupId>
15.78 + <artifactId>bck2brwsr-maven-plugin</artifactId>
15.79 + <version>${bck2brwsr.version}</version>
15.80 + <executions>
15.81 + <execution>
15.82 + <goals>
15.83 + <goal>brwsr</goal>
15.84 + <goal>aot</goal>
15.85 + </goals>
15.86 + </execution>
15.87 + </executions>
15.88 + <configuration>
15.89 + <obfuscation>${bck2brwsr.obfuscationlevel}</obfuscation>
15.90 + <directory>${project.build.directory}/${project.build.finalName}-bck2brwsr/public_html/</directory>
15.91 + <startpage>index.html</startpage>
15.92 + <classPathPrefix>lib</classPathPrefix>
15.93 + <mainJavaScript>${project.build.directory}/chat.js</mainJavaScript>
15.94 + <exports>
15.95 + <export>${project.mainclass}</export>
15.96 + </exports>
15.97 + </configuration>
15.98 + </plugin>
15.99 + <plugin>
15.100 + <artifactId>maven-assembly-plugin</artifactId>
15.101 + <version>2.4</version>
15.102 + <executions>
15.103 + <execution>
15.104 + <id>distro-assembly</id>
15.105 + <phase>package</phase>
15.106 + <goals>
15.107 + <goal>single</goal>
15.108 + </goals>
15.109 + <configuration>
15.110 + <descriptors>
15.111 + <descriptor>src/main/assembly/bck2brwsr.xml</descriptor>
15.112 + </descriptors>
15.113 + </configuration>
15.114 + </execution>
15.115 + </executions>
15.116 + </plugin>
15.117 + <plugin>
15.118 + <groupId>org.apache.maven.plugins</groupId>
15.119 + <artifactId>maven-dependency-plugin</artifactId>
15.120 + <version>2.9</version>
15.121 + <executions>
15.122 + <execution>
15.123 + <id>unpack</id>
15.124 + <phase>process-resources</phase>
15.125 + <goals>
15.126 + <goal>unpack-dependencies</goal>
15.127 + </goals>
15.128 + </execution>
15.129 + </executions>
15.130 + <configuration>
15.131 + <type>zip</type>
15.132 + <classifier>webpages</classifier>
15.133 + <overWrite>true</overWrite>
15.134 + <outputDirectory>target/web/pages</outputDirectory>
15.135 + <includes>*/**</includes>
15.136 + </configuration>
15.137 + </plugin>
15.138 + </plugins>
15.139 + </build>
15.140 + <dependencies>
15.141 + <dependency>
15.142 + <groupId>org.apidesign.demo</groupId>
15.143 + <artifactId>chat</artifactId>
15.144 + <version>${project.version}</version>
15.145 + <exclusions>
15.146 + <exclusion>
15.147 + <groupId>org.netbeans.html</groupId>
15.148 + <artifactId>net.java.html.boot.fx</artifactId>
15.149 + </exclusion>
15.150 + </exclusions>
15.151 + </dependency>
15.152 + <dependency>
15.153 + <groupId>org.apidesign.bck2brwsr</groupId>
15.154 + <artifactId>emul</artifactId>
15.155 + <version>${bck2brwsr.version}</version>
15.156 + <classifier>rt</classifier>
15.157 + </dependency>
15.158 + <dependency>
15.159 + <groupId>org.netbeans.html</groupId>
15.160 + <artifactId>net.java.html.boot</artifactId>
15.161 + <version>${net.java.html.version}</version>
15.162 + <exclusions>
15.163 + <exclusion>
15.164 + <artifactId>asm</artifactId>
15.165 + <groupId>org.ow2.asm</groupId>
15.166 + </exclusion>
15.167 + </exclusions>
15.168 + </dependency>
15.169 + <dependency>
15.170 + <groupId>org.apidesign.bck2brwsr</groupId>
15.171 + <artifactId>emul</artifactId>
15.172 + <version>${bck2brwsr.version}</version>
15.173 + <classifier>bck2brwsr</classifier>
15.174 + <scope>provided</scope>
15.175 + </dependency>
15.176 + <dependency>
15.177 + <groupId>org.apidesign.demo</groupId>
15.178 + <artifactId>chat-js</artifactId>
15.179 + <version>${project.version}</version>
15.180 + <classifier>bck2brwsr</classifier>
15.181 + <scope>provided</scope>
15.182 + <type>jar</type>
15.183 + </dependency>
15.184 + <dependency>
15.185 + <groupId>org.apidesign.bck2brwsr</groupId>
15.186 + <artifactId>ko-bck2brwsr</artifactId>
15.187 + <version>${bck2brwsr.version}</version>
15.188 + <classifier>bck2brwsr</classifier>
15.189 + <scope>provided</scope>
15.190 + </dependency>
15.191 + </dependencies>
15.192 +</project>
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/chat/client-web/src/main/assembly/bck2brwsr.xml Fri Apr 22 05:56:47 2016 +0200
16.3 @@ -0,0 +1,61 @@
16.4 +<?xml version="1.0"?>
16.5 +<!--
16.6 +
16.7 + The MIT License (MIT)
16.8 +
16.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
16.10 +
16.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
16.12 + of this software and associated documentation files (the "Software"), to deal
16.13 + in the Software without restriction, including without limitation the rights
16.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16.15 + copies of the Software, and to permit persons to whom the Software is
16.16 + furnished to do so, subject to the following conditions:
16.17 +
16.18 + The above copyright notice and this permission notice shall be included in
16.19 + all copies or substantial portions of the Software.
16.20 +
16.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16.27 + THE SOFTWARE.
16.28 +
16.29 +-->
16.30 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16.31 + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
16.32 +
16.33 + <id>bck2brwsr</id>
16.34 + <formats>
16.35 + <format>zip</format>
16.36 + <format>dir</format>
16.37 + </formats>
16.38 + <baseDirectory>public_html</baseDirectory>
16.39 + <fileSets>
16.40 + <fileSet>
16.41 + <directory>target/web/pages</directory>
16.42 + <outputDirectory>/</outputDirectory>
16.43 + <excludes>
16.44 + <exclude>index.html</exclude>
16.45 + </excludes>
16.46 + </fileSet>
16.47 + <fileSet>
16.48 + <directory>target/web/pages</directory>
16.49 + <outputDirectory>/</outputDirectory>
16.50 + <filtered>true</filtered>
16.51 + <includes>
16.52 + <include>index.html</include>
16.53 + </includes>
16.54 + </fileSet>
16.55 + <fileSet>
16.56 + <directory>${project.build.directory}</directory>
16.57 + <outputDirectory>/</outputDirectory>
16.58 + <includes>
16.59 + <include>*.js</include>
16.60 + <include>lib/*.js</include>
16.61 + </includes>
16.62 + </fileSet>
16.63 + </fileSets>
16.64 +</assembly>
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/chat/client-web/src/main/java/org/apidesign/demo/chat/BrowserMain.java Fri Apr 22 05:56:47 2016 +0200
17.3 @@ -0,0 +1,33 @@
17.4 +/**
17.5 + * The MIT License (MIT)
17.6 + *
17.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
17.8 + *
17.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
17.10 + * of this software and associated documentation files (the "Software"), to deal
17.11 + * in the Software without restriction, including without limitation the rights
17.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17.13 + * copies of the Software, and to permit persons to whom the Software is
17.14 + * furnished to do so, subject to the following conditions:
17.15 + *
17.16 + * The above copyright notice and this permission notice shall be included in
17.17 + * all copies or substantial portions of the Software.
17.18 + *
17.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
17.25 + * THE SOFTWARE.
17.26 + */
17.27 +package org.apidesign.demo.chat;
17.28 +
17.29 +public class BrowserMain {
17.30 + private BrowserMain() {
17.31 + }
17.32 +
17.33 + public static void main(String... args) throws Exception {
17.34 + Main.onPageLoad();
17.35 + }
17.36 +}
18.1 --- a/chat/client/bck2brwsr-assembly.xml Thu Aug 14 07:51:33 2014 +0200
18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
18.3 @@ -1,67 +0,0 @@
18.4 -<?xml version="1.0"?>
18.5 -<!--
18.6 -
18.7 - The MIT License (MIT)
18.8 -
18.9 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
18.10 -
18.11 - Permission is hereby granted, free of charge, to any person obtaining a copy
18.12 - of this software and associated documentation files (the "Software"), to deal
18.13 - in the Software without restriction, including without limitation the rights
18.14 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18.15 - copies of the Software, and to permit persons to whom the Software is
18.16 - furnished to do so, subject to the following conditions:
18.17 -
18.18 - The above copyright notice and this permission notice shall be included in
18.19 - all copies or substantial portions of the Software.
18.20 -
18.21 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18.22 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18.23 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18.24 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18.25 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18.26 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
18.27 - THE SOFTWARE.
18.28 -
18.29 --->
18.30 -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18.31 - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
18.32 -
18.33 - <id>bck2brwsr</id>
18.34 - <formats>
18.35 - <format>zip</format>
18.36 - </formats>
18.37 - <baseDirectory>client</baseDirectory>
18.38 - <dependencySets>
18.39 - <dependencySet>
18.40 - <useProjectArtifact>false</useProjectArtifact>
18.41 - <scope>runtime</scope>
18.42 - <outputDirectory>lib</outputDirectory>
18.43 - <includes>
18.44 - <include>*:jar</include>
18.45 - <include>*:rt</include>
18.46 - </includes>
18.47 - </dependencySet>
18.48 - <dependencySet>
18.49 - <useProjectArtifact>false</useProjectArtifact>
18.50 - <scope>provided</scope>
18.51 - <includes>
18.52 - <include>*:js</include>
18.53 - </includes>
18.54 - <unpack>true</unpack>
18.55 - <outputDirectory>/</outputDirectory>
18.56 - </dependencySet>
18.57 - </dependencySets>
18.58 - <files>
18.59 - <file>
18.60 - <source>${project.build.directory}/${project.build.finalName}.jar</source>
18.61 - <outputDirectory>/</outputDirectory>
18.62 - </file>
18.63 - <file>
18.64 - <source>${project.build.directory}/classes/org/apidesign/html/chatserver/client/chat.html</source>
18.65 - <outputDirectory>/</outputDirectory>
18.66 - <destName>index.html</destName>
18.67 - </file>
18.68 - </files>
18.69 -
18.70 -</assembly>
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/chat/client/nbactions.xml Fri Apr 22 05:56:47 2016 +0200
19.3 @@ -0,0 +1,57 @@
19.4 +<?xml version="1.0" encoding="UTF-8"?>
19.5 +<!--
19.6 +
19.7 + The MIT License (MIT)
19.8 +
19.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
19.10 +
19.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
19.12 + of this software and associated documentation files (the "Software"), to deal
19.13 + in the Software without restriction, including without limitation the rights
19.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19.15 + copies of the Software, and to permit persons to whom the Software is
19.16 + furnished to do so, subject to the following conditions:
19.17 +
19.18 + The above copyright notice and this permission notice shall be included in
19.19 + all copies or substantial portions of the Software.
19.20 +
19.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19.27 + THE SOFTWARE.
19.28 +
19.29 +-->
19.30 +<actions>
19.31 + <action>
19.32 + <actionName>run</actionName>
19.33 + <goals>
19.34 + <goal>process-classes</goal>
19.35 + <goal>exec:exec</goal>
19.36 + </goals>
19.37 + </action>
19.38 + <action>
19.39 + <actionName>debug</actionName>
19.40 + <goals>
19.41 + <goal>process-classes</goal>
19.42 + <goal>exec:exec</goal>
19.43 + </goals>
19.44 + <properties>
19.45 + <jpda.listen>true</jpda.listen>
19.46 + <exec.debug.arg>-Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address}</exec.debug.arg>
19.47 + </properties>
19.48 + </action>
19.49 + <action>
19.50 + <actionName>CUSTOM-Build Desktop App</actionName>
19.51 + <displayName>Build Desktop App</displayName>
19.52 + <goals>
19.53 + <goal>clean</goal>
19.54 + <goal>package</goal>
19.55 + </goals>
19.56 + <activatedProfiles>
19.57 + <activatedProfile>desktop</activatedProfile>
19.58 + </activatedProfiles>
19.59 + </action>
19.60 +</actions>
20.1 --- a/chat/client/pom.xml Thu Aug 14 07:51:33 2014 +0200
20.2 +++ b/chat/client/pom.xml Fri Apr 22 05:56:47 2016 +0200
20.3 @@ -1,135 +1,220 @@
20.4 -<?xml version="1.0" encoding="UTF-8"?>
20.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20.6 +<?xml version="1.0"?>
20.7 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20.8 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20.9 <modelVersion>4.0.0</modelVersion>
20.10 +
20.11 <parent>
20.12 - <artifactId>chat-demo</artifactId>
20.13 - <groupId>org.apidesign.html</groupId>
20.14 - <version>1.0-SNAPSHOT</version>
20.15 + <groupId>org.apidesign.demo</groupId>
20.16 + <artifactId>chat-pom</artifactId>
20.17 + <version>1.0-SNAPSHOT</version>
20.18 </parent>
20.19
20.20 - <groupId>org.apidesign.html.demo</groupId>
20.21 - <artifactId>chat-client</artifactId>
20.22 + <groupId>org.apidesign.demo</groupId>
20.23 + <artifactId>chat</artifactId>
20.24 <version>1.0-SNAPSHOT</version>
20.25 - <packaging>jar</packaging>
20.26 + <packaging>bundle</packaging>
20.27
20.28 - <name>Chat Client Bck2Brwsr</name>
20.29 -
20.30 - <repositories>
20.31 - <repository>
20.32 - <id>java.net</id>
20.33 - <name>Java.net</name>
20.34 - <url>https://maven.java.net/content/repositories/releases/</url>
20.35 - <snapshots>
20.36 - </snapshots>
20.37 - </repository>
20.38 - <repository>
20.39 - <id>netbeans</id>
20.40 - <name>NetBeans</name>
20.41 - <url>http://bits.netbeans.org/maven2/</url>
20.42 - </repository>
20.43 - </repositories>
20.44 - <pluginRepositories>
20.45 - <pluginRepository>
20.46 - <id>java.net</id>
20.47 - <name>Java.net</name>
20.48 - <url>https://maven.java.net/content/repositories/releases/</url>
20.49 - <snapshots>
20.50 - </snapshots>
20.51 - </pluginRepository>
20.52 - </pluginRepositories>
20.53 + <name>chat General Client Code</name>
20.54
20.55 <properties>
20.56 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20.57 + <netbeans.compile.on.save>all</netbeans.compile.on.save>
20.58 + <project.mainclass>org.apidesign.demo.chat.Main</project.mainclass>
20.59 + <exec.java.bin>${java.home}/bin/java</exec.java.bin>
20.60 + <exec.debug.arg>-Ddebug=false</exec.debug.arg>
20.61 </properties>
20.62 <build>
20.63 <plugins>
20.64 - <plugin>
20.65 - <groupId>org.apache.maven.plugins</groupId>
20.66 - <artifactId>maven-jar-plugin</artifactId>
20.67 - <version>2.4</version>
20.68 - <configuration>
20.69 - <archive>
20.70 - <manifest>
20.71 - <addClasspath>true</addClasspath>
20.72 - <classpathPrefix>lib/</classpathPrefix>
20.73 - </manifest>
20.74 - </archive>
20.75 - </configuration>
20.76 - </plugin>
20.77 - <plugin>
20.78 - <artifactId>maven-assembly-plugin</artifactId>
20.79 - <version>2.4</version>
20.80 - <executions>
20.81 - <execution>
20.82 - <id>distro-assembly</id>
20.83 - <phase>package</phase>
20.84 - <goals>
20.85 - <goal>single</goal>
20.86 - </goals>
20.87 - <configuration>
20.88 - <descriptors>
20.89 - <descriptor>bck2brwsr-assembly.xml</descriptor>
20.90 - </descriptors>
20.91 - </configuration>
20.92 - </execution>
20.93 - </executions>
20.94 - </plugin>
20.95 + <plugin>
20.96 + <groupId>org.apache.felix</groupId>
20.97 + <artifactId>maven-bundle-plugin</artifactId>
20.98 + <version>2.4.0</version>
20.99 + <extensions>true</extensions>
20.100 + <configuration>
20.101 + <instructions>
20.102 + <Export-Package>org.apidesign.demo.chat</Export-Package>
20.103 + <Bundle-SymbolicName>org.apidesign.demo.chat</Bundle-SymbolicName>
20.104 + </instructions>
20.105 + </configuration>
20.106 + </plugin>
20.107 + <plugin>
20.108 + <groupId>org.apache.maven.plugins</groupId>
20.109 + <artifactId>maven-compiler-plugin</artifactId>
20.110 + <version>2.3.2</version>
20.111 + <configuration>
20.112 + <source>1.7</source>
20.113 + <target>1.7</target>
20.114 + </configuration>
20.115 + </plugin>
20.116 + <plugin>
20.117 + <groupId>org.apache.maven.plugins</groupId>
20.118 + <artifactId>maven-jar-plugin</artifactId>
20.119 + <version>2.4</version>
20.120 + <configuration>
20.121 + <archive>
20.122 + <manifest>
20.123 + <mainClass>${project.mainclass}</mainClass>
20.124 + <addClasspath>true</addClasspath>
20.125 + <classpathPrefix>lib/</classpathPrefix>
20.126 + <useUniqueVersions>false</useUniqueVersions>
20.127 + </manifest>
20.128 + </archive>
20.129 + </configuration>
20.130 + </plugin>
20.131 + <plugin>
20.132 + <groupId>org.codehaus.mojo</groupId>
20.133 + <artifactId>exec-maven-plugin</artifactId>
20.134 + <version>1.2.1</version>
20.135 + <configuration>
20.136 + <executable>${exec.java.bin}</executable>
20.137 + <classpathScope>test</classpathScope>
20.138 + <arguments>
20.139 + <argument>-classpath</argument>
20.140 + <classpath/>
20.141 + <argument>-javaagent:${project.build.directory}/springloaded.jar</argument>
20.142 + <argument>-noverify</argument>
20.143 + <argument>-Dbrowser.rootdir=${basedir}/src/main/webapp/</argument>
20.144 + <argument>-Dnetbeans.inspect.port=${netbeans.inspect.port}</argument>
20.145 + <argument>${exec.debug.arg}</argument>
20.146 + <argument>${project.mainclass}</argument>
20.147 + </arguments>
20.148 + </configuration>
20.149 + </plugin>
20.150 + <plugin>
20.151 + <groupId>org.apache.maven.plugins</groupId>
20.152 + <artifactId>maven-dependency-plugin</artifactId>
20.153 + <version>2.10</version>
20.154 + <executions>
20.155 + <execution>
20.156 + <id>copy</id>
20.157 + <phase>package</phase>
20.158 + <goals>
20.159 + <goal>copy</goal>
20.160 + </goals>
20.161 + <configuration>
20.162 + <artifactItems>
20.163 + <artifactItem>
20.164 + <groupId>org.springframework</groupId>
20.165 + <artifactId>springloaded</artifactId>
20.166 + <version>1.2.3.RELEASE</version>
20.167 + <type>jar</type>
20.168 + <overWrite>false</overWrite>
20.169 + <destFileName>springloaded.jar</destFileName>
20.170 + </artifactItem>
20.171 + </artifactItems>
20.172 + <outputDirectory>${project.build.directory}</outputDirectory>
20.173 + </configuration>
20.174 + </execution>
20.175 + </executions>
20.176 + </plugin>
20.177 + <plugin>
20.178 + <artifactId>maven-assembly-plugin</artifactId>
20.179 + <version>2.4</version>
20.180 + <executions>
20.181 + <execution>
20.182 + <id>web-pages</id>
20.183 + <phase>package</phase>
20.184 + <goals>
20.185 + <goal>single</goal>
20.186 + </goals>
20.187 + <configuration>
20.188 + <descriptors>
20.189 + <descriptor>src/main/assembly/webpages.xml</descriptor>
20.190 + </descriptors>
20.191 + </configuration>
20.192 + </execution>
20.193 + </executions>
20.194 + </plugin>
20.195 </plugins>
20.196 </build>
20.197 -
20.198 <dependencies>
20.199 <dependency>
20.200 - <groupId>org.netbeans.html</groupId>
20.201 - <artifactId>net.java.html.json</artifactId>
20.202 - <version>${net.java.html.version}</version>
20.203 - <type>jar</type>
20.204 + <groupId>org.apidesign.demo</groupId>
20.205 + <artifactId>chat-js</artifactId>
20.206 + <version>${project.version}</version>
20.207 </dependency>
20.208 <dependency>
20.209 - <groupId>${project.groupId}</groupId>
20.210 - <artifactId>chat-model</artifactId>
20.211 - <version>${project.version}</version>
20.212 + <groupId>org.apidesign.demo</groupId>
20.213 + <artifactId>chat-shared</artifactId>
20.214 + <version>${project.version}</version>
20.215 + </dependency>
20.216 + <dependency>
20.217 + <groupId>org.netbeans.html</groupId>
20.218 + <artifactId>net.java.html</artifactId>
20.219 + <version>${net.java.html.version}</version>
20.220 + </dependency>
20.221 + <dependency>
20.222 + <groupId>org.netbeans.html</groupId>
20.223 + <artifactId>net.java.html.json</artifactId>
20.224 + <version>${net.java.html.version}</version>
20.225 + </dependency>
20.226 + <dependency>
20.227 + <groupId>org.netbeans.html</groupId>
20.228 + <artifactId>net.java.html.boot</artifactId>
20.229 + <version>${net.java.html.version}</version>
20.230 + </dependency>
20.231 + <dependency>
20.232 + <groupId>org.netbeans.html</groupId>
20.233 + <artifactId>net.java.html.sound</artifactId>
20.234 + <version>${net.java.html.version}</version>
20.235 + </dependency>
20.236 + <dependency>
20.237 + <groupId>org.netbeans.html</groupId>
20.238 + <artifactId>ko4j</artifactId>
20.239 + <version>${net.java.html.version}</version>
20.240 + <scope>runtime</scope>
20.241 </dependency>
20.242 <dependency>
20.243 <groupId>org.testng</groupId>
20.244 <artifactId>testng</artifactId>
20.245 - <version>6.8</version>
20.246 + <scope>test</scope>
20.247 + </dependency>
20.248 + <dependency>
20.249 + <groupId>org.netbeans.html</groupId>
20.250 + <artifactId>net.java.html.boot.script</artifactId>
20.251 + <version>${net.java.html.version}</version>
20.252 <scope>test</scope>
20.253 <type>jar</type>
20.254 </dependency>
20.255 <dependency>
20.256 - <groupId>org.apidesign.bck2brwsr</groupId>
20.257 - <artifactId>emul</artifactId>
20.258 - <version>${bck2brwsr.version}</version>
20.259 - <classifier>rt</classifier>
20.260 - <scope>runtime</scope>
20.261 - </dependency>
20.262 - <dependency>
20.263 - <groupId>org.apidesign.bck2brwsr</groupId>
20.264 - <artifactId>vm4brwsr</artifactId>
20.265 - <version>${bck2brwsr.version}</version>
20.266 - <type>zip</type>
20.267 - <classifier>js</classifier>
20.268 + <groupId>org.netbeans.html</groupId>
20.269 + <artifactId>net.java.html.boot.fx</artifactId>
20.270 + <version>${net.java.html.version}</version>
20.271 <scope>provided</scope>
20.272 </dependency>
20.273 - <dependency>
20.274 - <groupId>org.apidesign.bck2brwsr</groupId>
20.275 - <artifactId>ko-bck2brwsr</artifactId>
20.276 - <version>${bck2brwsr.version}</version>
20.277 - <scope>runtime</scope>
20.278 - </dependency>
20.279 - <dependency>
20.280 - <artifactId>ko4j</artifactId>
20.281 - <groupId>org.netbeans.html</groupId>
20.282 - <type>jar</type>
20.283 - <version>${net.java.html.version}</version>
20.284 - <scope>runtime</scope>
20.285 - </dependency>
20.286 - <dependency>
20.287 - <artifactId>net.java.html.boot</artifactId>
20.288 - <groupId>org.netbeans.html</groupId>
20.289 - <type>jar</type>
20.290 - <version>${net.java.html.version}</version>
20.291 - <scope>runtime</scope>
20.292 - </dependency>
20.293 </dependencies>
20.294 + <profiles>
20.295 + <profile>
20.296 + <id>desktop</id>
20.297 + <dependencies>
20.298 + <dependency>
20.299 + <groupId>org.netbeans.html</groupId>
20.300 + <artifactId>net.java.html.boot.fx</artifactId>
20.301 + <version>${net.java.html.version}</version>
20.302 + <scope>runtime</scope>
20.303 + </dependency>
20.304 + </dependencies>
20.305 + <build>
20.306 + <plugins>
20.307 + <plugin>
20.308 + <artifactId>maven-assembly-plugin</artifactId>
20.309 + <version>2.4</version>
20.310 + <executions>
20.311 + <execution>
20.312 + <id>distro-assembly</id>
20.313 + <phase>package</phase>
20.314 + <goals>
20.315 + <goal>single</goal>
20.316 + </goals>
20.317 + <configuration>
20.318 + <descriptors>
20.319 + <descriptor>src/main/assembly/javafx.xml</descriptor>
20.320 + </descriptors>
20.321 + </configuration>
20.322 + </execution>
20.323 + </executions>
20.324 + </plugin>
20.325 + </plugins>
20.326 + </build>
20.327 + </profile>
20.328 + </profiles>
20.329 </project>
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/chat/client/src/main/assembly/javafx.xml Fri Apr 22 05:56:47 2016 +0200
21.3 @@ -0,0 +1,57 @@
21.4 +<?xml version="1.0"?>
21.5 +<!--
21.6 +
21.7 + The MIT License (MIT)
21.8 +
21.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
21.10 +
21.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
21.12 + of this software and associated documentation files (the "Software"), to deal
21.13 + in the Software without restriction, including without limitation the rights
21.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21.15 + copies of the Software, and to permit persons to whom the Software is
21.16 + furnished to do so, subject to the following conditions:
21.17 +
21.18 + The above copyright notice and this permission notice shall be included in
21.19 + all copies or substantial portions of the Software.
21.20 +
21.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21.27 + THE SOFTWARE.
21.28 +
21.29 +-->
21.30 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21.31 + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
21.32 +
21.33 + <id>javafx</id>
21.34 + <formats>
21.35 + <format>zip</format>
21.36 + </formats>
21.37 + <baseDirectory>${project.build.finalName}-app</baseDirectory>
21.38 + <dependencySets>
21.39 + <dependencySet>
21.40 + <useProjectArtifact>false</useProjectArtifact>
21.41 + <scope>runtime</scope>
21.42 + <outputDirectory>lib</outputDirectory>
21.43 + </dependencySet>
21.44 + </dependencySets>
21.45 + <files>
21.46 + <file>
21.47 + <source>${project.build.directory}/${project.build.finalName}.jar</source>
21.48 + <outputDirectory>/</outputDirectory>
21.49 + </file>
21.50 + </files>
21.51 + <fileSets>
21.52 + <fileSet>
21.53 + <directory>src/main/webapp/</directory>
21.54 + <outputDirectory>/</outputDirectory>
21.55 + <includes>
21.56 + <include>pages/**</include>
21.57 + </includes>
21.58 + </fileSet>
21.59 + </fileSets>
21.60 +</assembly>
21.61 \ No newline at end of file
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
22.2 +++ b/chat/client/src/main/assembly/webpages.xml Fri Apr 22 05:56:47 2016 +0200
22.3 @@ -0,0 +1,42 @@
22.4 +<?xml version="1.0"?>
22.5 +<!--
22.6 +
22.7 + The MIT License (MIT)
22.8 +
22.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
22.10 +
22.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
22.12 + of this software and associated documentation files (the "Software"), to deal
22.13 + in the Software without restriction, including without limitation the rights
22.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22.15 + copies of the Software, and to permit persons to whom the Software is
22.16 + furnished to do so, subject to the following conditions:
22.17 +
22.18 + The above copyright notice and this permission notice shall be included in
22.19 + all copies or substantial portions of the Software.
22.20 +
22.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22.27 + THE SOFTWARE.
22.28 +
22.29 +-->
22.30 +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22.31 + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
22.32 +
22.33 + <id>webpages</id>
22.34 + <formats>
22.35 + <format>zip</format>
22.36 + </formats>
22.37 + <baseDirectory>/</baseDirectory>
22.38 + <fileSets>
22.39 + <fileSet>
22.40 + <directory>src/main/webapp/pages</directory>
22.41 + <outputDirectory>/</outputDirectory>
22.42 + <filtered>false</filtered>
22.43 + </fileSet>
22.44 + </fileSets>
22.45 +</assembly>
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/chat/client/src/main/java/org/apidesign/demo/chat/ChatClient.java Fri Apr 22 05:56:47 2016 +0200
23.3 @@ -0,0 +1,107 @@
23.4 +/**
23.5 + * The MIT License (MIT)
23.6 + *
23.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
23.8 + *
23.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
23.10 + * of this software and associated documentation files (the "Software"), to deal
23.11 + * in the Software without restriction, including without limitation the rights
23.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23.13 + * copies of the Software, and to permit persons to whom the Software is
23.14 + * furnished to do so, subject to the following conditions:
23.15 + *
23.16 + * The above copyright notice and this permission notice shall be included in
23.17 + * all copies or substantial portions of the Software.
23.18 + *
23.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23.25 + * THE SOFTWARE.
23.26 + */
23.27 +package org.apidesign.demo.chat;
23.28 +
23.29 +import net.java.html.json.ComputedProperty;
23.30 +import net.java.html.json.Function;
23.31 +import net.java.html.json.Model;
23.32 +import net.java.html.json.OnReceive;
23.33 +import net.java.html.json.Property;
23.34 +import org.apidesign.demo.chat.shared.Message;
23.35 +import org.apidesign.demo.chat.shared.Query;
23.36 +
23.37 +/**
23.38 + *
23.39 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
23.40 + */
23.41 +@Model(className = "ChatModel", targetId = "", properties = {
23.42 + @Property(name = "user", type = String.class),
23.43 + @Property(name = "comment", type = String.class),
23.44 + @Property(name = "url", type = String.class),
23.45 + @Property(name = "msgs", type = Message.class, array = true)
23.46 +})
23.47 +class ChatClient {
23.48 + @ComputedProperty
23.49 + static boolean sendEnabled(String user, String comment) {
23.50 + boolean res = user != null && comment != null && !user.isEmpty() && !comment.isEmpty();
23.51 + return res;
23.52 + }
23.53 +
23.54 + @Function
23.55 + static void submit(ChatModel m) {
23.56 + if (!sendEnabled(m.getUser(), m.getComment())) {
23.57 + return;
23.58 + }
23.59 + Message msg = new Message();
23.60 + msg.setUser(m.getUser());
23.61 + msg.setComment(m.getComment());
23.62 + m.postComment(m.getUrl(), msg);
23.63 + }
23.64 +
23.65 + static void cantChat(ChatModel model, Exception err) {
23.66 + model.getMsgs().add(new Message("System", err.getMessage(), 0));
23.67 + }
23.68 +
23.69 +
23.70 + @OnReceive(url = "{url}/chat", method = "POST", data = Message.class, onError = "cantChat")
23.71 + static void postComment(ChatModel m, Message addedMessage) {
23.72 + if (addedMessage.getComment().equals(m.getComment())) {
23.73 + m.setComment("");
23.74 + }
23.75 + }
23.76 +
23.77 + @OnReceive(url = "{url}/chat?since=0")
23.78 + static void initialRead(ChatModel m, Query q) {
23.79 + m.getMsgs().clear();
23.80 + m.getMsgs().addAll(q.getMessages());
23.81 + moreMessages(m);
23.82 + }
23.83 +
23.84 + @OnReceive(url = "{url}/chat?since={since}")
23.85 + static void updateMsgs(ChatModel m, Query q) {
23.86 + m.getMsgs().addAll(q.getMessages());
23.87 + moreMessages(m);
23.88 + }
23.89 +
23.90 + private static void moreMessages(ChatModel m) {
23.91 + long now = 0;
23.92 + for (Message msg : m.getMsgs()) {
23.93 + if (now < msg.getSince()) {
23.94 + now = msg.getSince();
23.95 + }
23.96 + }
23.97 + m.updateMsgs(m.getUrl(), "" + (now + 1));
23.98 + }
23.99 +
23.100 + public static void onPageLoad() {
23.101 + ChatModel chm = new ChatModel();
23.102 + chm.setUrl("http://localhost:8080");
23.103 + Message m = new Message();
23.104 + m.setComment("Waiting for messages from the server...");
23.105 + m.setUser("system");
23.106 + chm.getMsgs().add(m);
23.107 + chm.applyBindings();
23.108 + chm.initialRead(chm.getUrl());
23.109 + }
23.110 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/chat/client/src/main/java/org/apidesign/demo/chat/Main.java Fri Apr 22 05:56:47 2016 +0200
24.3 @@ -0,0 +1,48 @@
24.4 +/**
24.5 + * The MIT License (MIT)
24.6 + *
24.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
24.8 + *
24.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
24.10 + * of this software and associated documentation files (the "Software"), to deal
24.11 + * in the Software without restriction, including without limitation the rights
24.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24.13 + * copies of the Software, and to permit persons to whom the Software is
24.14 + * furnished to do so, subject to the following conditions:
24.15 + *
24.16 + * The above copyright notice and this permission notice shall be included in
24.17 + * all copies or substantial portions of the Software.
24.18 + *
24.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24.25 + * THE SOFTWARE.
24.26 + */
24.27 +package org.apidesign.demo.chat;
24.28 +
24.29 +import net.java.html.boot.BrowserBuilder;
24.30 +
24.31 +public final class Main {
24.32 + private Main() {
24.33 + }
24.34 +
24.35 + public static void main(String... args) throws Exception {
24.36 + BrowserBuilder.newBrowser().
24.37 + loadPage("pages/index.html").
24.38 + loadClass(Main.class).
24.39 + invoke("onPageLoad", args).
24.40 + showAndWait();
24.41 + System.exit(0);
24.42 + }
24.43 +
24.44 + /**
24.45 + * Called when the page is ready.
24.46 + */
24.47 + public static void onPageLoad() throws Exception {
24.48 + ChatClient.onPageLoad();
24.49 + }
24.50 +
24.51 +}
25.1 --- a/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java Thu Aug 14 07:51:33 2014 +0200
25.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
25.3 @@ -1,90 +0,0 @@
25.4 -/**
25.5 - * The MIT License (MIT)
25.6 - *
25.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
25.8 - *
25.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
25.10 - * of this software and associated documentation files (the "Software"), to deal
25.11 - * in the Software without restriction, including without limitation the rights
25.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25.13 - * copies of the Software, and to permit persons to whom the Software is
25.14 - * furnished to do so, subject to the following conditions:
25.15 - *
25.16 - * The above copyright notice and this permission notice shall be included in
25.17 - * all copies or substantial portions of the Software.
25.18 - *
25.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25.25 - * THE SOFTWARE.
25.26 - */
25.27 -package org.apidesign.html.chatserver.client;
25.28 -
25.29 -import net.java.html.json.ComputedProperty;
25.30 -import net.java.html.json.Function;
25.31 -import net.java.html.json.Model;
25.32 -import net.java.html.json.OnReceive;
25.33 -import net.java.html.json.Property;
25.34 -import org.apidesign.html.chatserver.model.Message;
25.35 -import org.apidesign.html.chatserver.model.Query;
25.36 -
25.37 -/**
25.38 - *
25.39 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
25.40 - */
25.41 -@Model(className = "ChatModel", properties = {
25.42 - @Property(name = "user", type = String.class),
25.43 - @Property(name = "comment", type = String.class),
25.44 - @Property(name = "msgs", type = Message.class, array = true)
25.45 -})
25.46 -class ChatClient {
25.47 - @ComputedProperty
25.48 - static boolean sendEnabled(String user, String comment) {
25.49 - boolean res = user != null && comment != null && !user.isEmpty() && !comment.isEmpty();
25.50 - return res;
25.51 - }
25.52 -
25.53 - @Function
25.54 - static void submit(ChatModel m) {
25.55 - if (!sendEnabled(m.getUser(), m.getComment())) {
25.56 - return;
25.57 - }
25.58 - Message msg = new Message();
25.59 - msg.setUser(m.getUser());
25.60 - msg.setComment(m.getComment());
25.61 - m.postComment(msg);
25.62 - }
25.63 -
25.64 - @OnReceive(url = "/chat", method = "POST", data = Message.class)
25.65 - static void postComment(ChatModel m, Message addedMessage) {
25.66 - if (addedMessage.getComment().equals(m.getComment())) {
25.67 - m.setComment("");
25.68 - }
25.69 - }
25.70 -
25.71 - @OnReceive(url = "/chat?since=0")
25.72 - static void initialRead(ChatModel m, Query q) {
25.73 - m.getMsgs().clear();
25.74 - m.getMsgs().addAll(q.getMessages());
25.75 - moreMessages(m);
25.76 - }
25.77 -
25.78 - @OnReceive(url = "/chat?since={since}")
25.79 - static void updateMsgs(ChatModel m, Query q) {
25.80 - m.getMsgs().addAll(q.getMessages());
25.81 - moreMessages(m);
25.82 - }
25.83 -
25.84 - private static void moreMessages(ChatModel m) {
25.85 - long now = 0;
25.86 - for (Message msg : m.getMsgs()) {
25.87 - if (now < msg.getSince()) {
25.88 - now = msg.getSince();
25.89 - }
25.90 - }
25.91 - m.updateMsgs("" + (now + 1));
25.92 - }
25.93 -}
26.1 --- a/chat/client/src/main/java/org/apidesign/html/chatserver/client/Main.java Thu Aug 14 07:51:33 2014 +0200
26.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
26.3 @@ -1,45 +0,0 @@
26.4 -/**
26.5 - * The MIT License (MIT)
26.6 - *
26.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
26.8 - *
26.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
26.10 - * of this software and associated documentation files (the "Software"), to deal
26.11 - * in the Software without restriction, including without limitation the rights
26.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26.13 - * copies of the Software, and to permit persons to whom the Software is
26.14 - * furnished to do so, subject to the following conditions:
26.15 - *
26.16 - * The above copyright notice and this permission notice shall be included in
26.17 - * all copies or substantial portions of the Software.
26.18 - *
26.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26.25 - * THE SOFTWARE.
26.26 - */
26.27 -package org.apidesign.html.chatserver.client;
26.28 -
26.29 -import org.apidesign.html.chatserver.model.Message;
26.30 -
26.31 -/**
26.32 - *
26.33 - * @author Jaroslav Tulach <jtulach@netbeans.org>
26.34 - */
26.35 -public class Main {
26.36 - private Main() {
26.37 - }
26.38 -
26.39 - static {
26.40 - ChatModel chm = new ChatModel();
26.41 - Message m = new Message();
26.42 - m.setComment("Waiting for messages from the server...");
26.43 - m.setUser("system");
26.44 - chm.getMsgs().add(m);
26.45 - chm.applyBindings();
26.46 - chm.initialRead();
26.47 - }
26.48 -}
27.1 --- a/chat/client/src/main/resources/org/apidesign/html/chatserver/client/chat.html Thu Aug 14 07:51:33 2014 +0200
27.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
27.3 @@ -1,54 +0,0 @@
27.4 -<!--
27.5 -
27.6 - The MIT License (MIT)
27.7 -
27.8 - Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
27.9 -
27.10 - Permission is hereby granted, free of charge, to any person obtaining a copy
27.11 - of this software and associated documentation files (the "Software"), to deal
27.12 - in the Software without restriction, including without limitation the rights
27.13 - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
27.14 - copies of the Software, and to permit persons to whom the Software is
27.15 - furnished to do so, subject to the following conditions:
27.16 -
27.17 - The above copyright notice and this permission notice shall be included in
27.18 - all copies or substantial portions of the Software.
27.19 -
27.20 - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27.21 - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27.22 - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27.23 - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27.24 - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27.25 - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27.26 - THE SOFTWARE.
27.27 -
27.28 --->
27.29 -<!DOCTYPE html>
27.30 -<html>
27.31 - <head>
27.32 - <title>Chat via Jersey Server</title>
27.33 - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
27.34 - </head>
27.35 - <body>
27.36 - <div>Username:</div>
27.37 - <input data-bind="value: user, valueUpdate: 'afterkeydown'"/>
27.38 - <div>Message:</div>
27.39 - <input data-bind="value: comment, valueUpdate: 'afterkeydown'"/>
27.40 - <button data-bind="enable: sendEnabled, click: submit">Send</button>
27.41 -
27.42 - <ul data-bind="foreach: msgs">
27.43 - <li>
27.44 - <b data-bind="text: user"></b>@<em data-bind="text: at"></em>
27.45 - :
27.46 - <span data-bind="text: comment"></span>
27.47 - </li>
27.48 - </ul>
27.49 -
27.50 - <script src="bck2brwsr.js"></script>
27.51 - <script type="text/javascript">
27.52 - var vm = bck2brwsr('chat-client-1.0-SNAPSHOT.jar');
27.53 - vm.loadClass('org.apidesign.html.chatserver.client.Main');
27.54 - </script>
27.55 -
27.56 - </body>
27.57 -</html>
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
28.2 +++ b/chat/client/src/main/webapp/pages/index.html Fri Apr 22 05:56:47 2016 +0200
28.3 @@ -0,0 +1,49 @@
28.4 +<!--
28.5 +
28.6 + The MIT License (MIT)
28.7 +
28.8 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
28.9 +
28.10 + Permission is hereby granted, free of charge, to any person obtaining a copy
28.11 + of this software and associated documentation files (the "Software"), to deal
28.12 + in the Software without restriction, including without limitation the rights
28.13 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28.14 + copies of the Software, and to permit persons to whom the Software is
28.15 + furnished to do so, subject to the following conditions:
28.16 +
28.17 + The above copyright notice and this permission notice shall be included in
28.18 + all copies or substantial portions of the Software.
28.19 +
28.20 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28.21 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28.22 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28.23 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28.24 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28.25 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28.26 + THE SOFTWARE.
28.27 +
28.28 +-->
28.29 +<!DOCTYPE html>
28.30 +<html>
28.31 + <head>
28.32 + <title>Chat via Jersey Server</title>
28.33 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
28.34 + </head>
28.35 + <body>
28.36 + <div>Username:</div>
28.37 + <input data-bind="value: user, valueUpdate: 'afterkeydown'"/>
28.38 + <div>Message:</div>
28.39 + <input data-bind="value: comment, valueUpdate: 'afterkeydown'"/>
28.40 + <button data-bind="enable: sendEnabled, click: submit">Send</button>
28.41 +
28.42 + <ul data-bind="foreach: msgs">
28.43 + <li>
28.44 + <b data-bind="text: user"></b>@<em data-bind="text: at"></em>
28.45 + :
28.46 + <span data-bind="text: comment"></span>
28.47 + </li>
28.48 + </ul>
28.49 +
28.50 +<!-- ${browser.bootstrap} -->
28.51 + </body>
28.52 +</html>
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
29.2 +++ b/chat/client/src/test/java/org/apidesign/demo/chat/ChatClientTest.java Fri Apr 22 05:56:47 2016 +0200
29.3 @@ -0,0 +1,50 @@
29.4 +/**
29.5 + * The MIT License (MIT)
29.6 + *
29.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
29.8 + *
29.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
29.10 + * of this software and associated documentation files (the "Software"), to deal
29.11 + * in the Software without restriction, including without limitation the rights
29.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29.13 + * copies of the Software, and to permit persons to whom the Software is
29.14 + * furnished to do so, subject to the following conditions:
29.15 + *
29.16 + * The above copyright notice and this permission notice shall be included in
29.17 + * all copies or substantial portions of the Software.
29.18 + *
29.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29.25 + * THE SOFTWARE.
29.26 + */
29.27 +package org.apidesign.demo.chat;
29.28 +
29.29 +import static org.testng.Assert.*;
29.30 +import org.testng.annotations.Test;
29.31 +
29.32 +/**
29.33 + *
29.34 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
29.35 + */
29.36 +public class ChatClientTest {
29.37 + public ChatClientTest() {
29.38 + }
29.39 +
29.40 + @Test public void hasSendEnabled() {
29.41 + ChatModel m = new ChatModel();
29.42 + assertFalse(m.isSendEnabled(), "By default disabled");
29.43 + m.setComment("some msg");
29.44 + m.setUser("by me");
29.45 + assertTrue(m.isSendEnabled(), "Now it is enabled");
29.46 + m.setUser(null);
29.47 + assertFalse(m.isSendEnabled(), "No user means disabled");
29.48 + m.setUser("by him");
29.49 + assertTrue(m.isSendEnabled(), "Again enabled");
29.50 + m.setComment("");
29.51 + assertFalse(m.isSendEnabled(), "Empty text means disabled");
29.52 + }
29.53 +}
30.1 --- a/chat/client/src/test/java/org/apidesign/html/chatserver/client/ChatClientTest.java Thu Aug 14 07:51:33 2014 +0200
30.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
30.3 @@ -1,50 +0,0 @@
30.4 -/**
30.5 - * The MIT License (MIT)
30.6 - *
30.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
30.8 - *
30.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
30.10 - * of this software and associated documentation files (the "Software"), to deal
30.11 - * in the Software without restriction, including without limitation the rights
30.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
30.13 - * copies of the Software, and to permit persons to whom the Software is
30.14 - * furnished to do so, subject to the following conditions:
30.15 - *
30.16 - * The above copyright notice and this permission notice shall be included in
30.17 - * all copies or substantial portions of the Software.
30.18 - *
30.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30.25 - * THE SOFTWARE.
30.26 - */
30.27 -package org.apidesign.html.chatserver.client;
30.28 -
30.29 -import static org.testng.Assert.*;
30.30 -import org.testng.annotations.Test;
30.31 -
30.32 -/**
30.33 - *
30.34 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
30.35 - */
30.36 -public class ChatClientTest {
30.37 - public ChatClientTest() {
30.38 - }
30.39 -
30.40 - @Test public void hasSendEnabled() {
30.41 - ChatModel m = new ChatModel();
30.42 - assertFalse(m.isSendEnabled(), "By default disabled");
30.43 - m.setComment("some msg");
30.44 - m.setUser("by me");
30.45 - assertTrue(m.isSendEnabled(), "Now it is enabled");
30.46 - m.setUser(null);
30.47 - assertFalse(m.isSendEnabled(), "No user means disabled");
30.48 - m.setUser("by him");
30.49 - assertTrue(m.isSendEnabled(), "Again enabled");
30.50 - m.setComment("");
30.51 - assertFalse(m.isSendEnabled(), "Empty text means disabled");
30.52 - }
30.53 -}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
31.2 +++ b/chat/js/pom.xml Fri Apr 22 05:56:47 2016 +0200
31.3 @@ -0,0 +1,92 @@
31.4 +<?xml version="1.0" encoding="UTF-8"?>
31.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
31.6 + <modelVersion>4.0.0</modelVersion>
31.7 + <parent>
31.8 + <groupId>org.apidesign.demo</groupId>
31.9 + <artifactId>chat-pom</artifactId>
31.10 + <version>1.0-SNAPSHOT</version>
31.11 + </parent>
31.12 +
31.13 + <groupId>org.apidesign.demo</groupId>
31.14 + <artifactId>chat-js</artifactId>
31.15 + <version>1.0-SNAPSHOT</version>
31.16 + <packaging>bundle</packaging>
31.17 +
31.18 + <name>chat JavaScript Libraries</name>
31.19 +
31.20 + <properties>
31.21 + <netbeans.compile.on.save>none</netbeans.compile.on.save>
31.22 + </properties>
31.23 + <build>
31.24 + <plugins>
31.25 + <plugin>
31.26 + <groupId>org.apache.felix</groupId>
31.27 + <artifactId>maven-bundle-plugin</artifactId>
31.28 + <version>2.4.0</version>
31.29 + <extensions>true</extensions>
31.30 + <configuration>
31.31 + <instructions>
31.32 + <Export-Package>org.apidesign.demo.chat.js</Export-Package>
31.33 + <Bundle-SymbolicName>org.apidesign.demo.chat.js</Bundle-SymbolicName>
31.34 + </instructions>
31.35 + </configuration>
31.36 + </plugin>
31.37 + <plugin>
31.38 + <groupId>org.netbeans.html</groupId>
31.39 + <artifactId>html4j-maven-plugin</artifactId>
31.40 + <version>${net.java.html.version}</version>
31.41 + <executions>
31.42 + <execution>
31.43 + <id>js-classes</id>
31.44 + <goals>
31.45 + <goal>process-js-annotations</goal>
31.46 + </goals>
31.47 + </execution>
31.48 + </executions>
31.49 + </plugin>
31.50 + <plugin>
31.51 + <groupId>org.apache.maven.plugins</groupId>
31.52 + <artifactId>maven-compiler-plugin</artifactId>
31.53 + <version>2.3.2</version>
31.54 + <configuration>
31.55 + <source>1.7</source>
31.56 + <target>1.7</target>
31.57 + </configuration>
31.58 + </plugin>
31.59 + <plugin>
31.60 + <groupId>org.apidesign.bck2brwsr</groupId>
31.61 + <artifactId>bck2brwsr-maven-plugin</artifactId>
31.62 + <version>0.16</version>
31.63 + <executions>
31.64 + <execution>
31.65 + <goals>
31.66 + <goal>library</goal>
31.67 + </goals>
31.68 + </execution>
31.69 + </executions>
31.70 + <configuration>
31.71 + <obfuscation>NONE</obfuscation>
31.72 + </configuration>
31.73 + </plugin>
31.74 + </plugins>
31.75 + </build>
31.76 + <dependencies>
31.77 + <dependency>
31.78 + <groupId>org.netbeans.html</groupId>
31.79 + <artifactId>net.java.html.boot</artifactId>
31.80 + <version>${net.java.html.version}</version>
31.81 + </dependency>
31.82 + <dependency>
31.83 + <groupId>org.testng</groupId>
31.84 + <artifactId>testng</artifactId>
31.85 + <scope>test</scope>
31.86 + </dependency>
31.87 + <dependency>
31.88 + <groupId>org.netbeans.html</groupId>
31.89 + <artifactId>net.java.html.boot.script</artifactId>
31.90 + <version>${net.java.html.version}</version>
31.91 + <scope>test</scope>
31.92 + <type>jar</type>
31.93 + </dependency>
31.94 + </dependencies>
31.95 +</project>
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
32.2 +++ b/chat/js/src/main/java/org/apidesign/demo/chat/js/Dialogs.java Fri Apr 22 05:56:47 2016 +0200
32.3 @@ -0,0 +1,45 @@
32.4 +/**
32.5 + * The MIT License (MIT)
32.6 + *
32.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
32.8 + *
32.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
32.10 + * of this software and associated documentation files (the "Software"), to deal
32.11 + * in the Software without restriction, including without limitation the rights
32.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32.13 + * copies of the Software, and to permit persons to whom the Software is
32.14 + * furnished to do so, subject to the following conditions:
32.15 + *
32.16 + * The above copyright notice and this permission notice shall be included in
32.17 + * all copies or substantial portions of the Software.
32.18 + *
32.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
32.25 + * THE SOFTWARE.
32.26 + */
32.27 +package org.apidesign.demo.chat.js;
32.28 +
32.29 +public final class Dialogs {
32.30 + private Dialogs() {
32.31 + }
32.32 +
32.33 + /** Shows confirmation dialog to the user.
32.34 + *
32.35 + * @param msg the message
32.36 + * @param callback called back when the use accepts (can be null)
32.37 + * @return true or false
32.38 + */
32.39 + @net.java.html.js.JavaScriptBody(
32.40 + args = { "msg", "callback" },
32.41 + javacall = true,
32.42 + body =
32.43 + "var ret = confirm(msg);" +
32.44 + "if (ret && callback) callback.@java.lang.Runnable::run()();" +
32.45 + "return ret;"
32.46 + )
32.47 + public static native boolean confirm(String msg, Runnable callback);
32.48 +}
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
33.2 +++ b/chat/js/src/test/java/org/apidesign/demo/chat/js/JsInteractionTest.java Fri Apr 22 05:56:47 2016 +0200
33.3 @@ -0,0 +1,64 @@
33.4 +/**
33.5 + * The MIT License (MIT)
33.6 + *
33.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
33.8 + *
33.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
33.10 + * of this software and associated documentation files (the "Software"), to deal
33.11 + * in the Software without restriction, including without limitation the rights
33.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33.13 + * copies of the Software, and to permit persons to whom the Software is
33.14 + * furnished to do so, subject to the following conditions:
33.15 + *
33.16 + * The above copyright notice and this permission notice shall be included in
33.17 + * all copies or substantial portions of the Software.
33.18 + *
33.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33.25 + * THE SOFTWARE.
33.26 + */
33.27 +package org.apidesign.demo.chat.js;
33.28 +
33.29 +import java.io.Closeable;
33.30 +import net.java.html.boot.script.Scripts;
33.31 +import org.netbeans.html.boot.spi.Fn;
33.32 +import static org.testng.Assert.assertEquals;
33.33 +import org.testng.annotations.AfterMethod;
33.34 +import org.testng.annotations.BeforeMethod;
33.35 +import org.testng.annotations.Test;
33.36 +
33.37 +/** Tests for behavior of @JavaScriptBody methods. Set your JavaScript
33.38 + * environment up (for example define <code>alert</code> or use some
33.39 + * emulation library like <em>env.js</em>), register script presenter
33.40 + * and then you can call methods that deal with JavaScript in your tests.
33.41 + */
33.42 +public class JsInteractionTest {
33.43 + private Closeable jsEngine;
33.44 + @BeforeMethod public void initializeJSEngine() throws Exception {
33.45 + jsEngine = Fn.activate(Scripts.createPresenter());
33.46 + }
33.47 +
33.48 + @AfterMethod public void shutdownJSEngine() throws Exception {
33.49 + jsEngine.close();
33.50 + }
33.51 +
33.52 + @Test public void testCallbackFromJavaScript() throws Exception {
33.53 + class R implements Runnable {
33.54 + int called;
33.55 +
33.56 + @Override
33.57 + public void run() {
33.58 + called++;
33.59 + }
33.60 + }
33.61 + R callback = new R();
33.62 +
33.63 + Dialogs.confirm("Hello", callback);
33.64 +
33.65 + assertEquals(callback.called, 1, "One immediate callback");
33.66 + }
33.67 + }
34.1 --- a/chat/model/pom.xml Thu Aug 14 07:51:33 2014 +0200
34.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
34.3 @@ -1,32 +0,0 @@
34.4 -<?xml version="1.0"?>
34.5 -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
34.6 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
34.7 - <modelVersion>4.0.0</modelVersion>
34.8 - <parent>
34.9 - <groupId>org.apidesign.html</groupId>
34.10 - <artifactId>chat-demo</artifactId>
34.11 - <version>1.0-SNAPSHOT</version>
34.12 - </parent>
34.13 - <groupId>org.apidesign.html.demo</groupId>
34.14 - <artifactId>chat-model</artifactId>
34.15 - <version>1.0-SNAPSHOT</version>
34.16 - <name>Shared Model of a Message</name>
34.17 - <url>http://maven.apache.org</url>
34.18 - <properties>
34.19 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
34.20 - </properties>
34.21 - <dependencies>
34.22 - <dependency>
34.23 - <groupId>org.netbeans.html</groupId>
34.24 - <artifactId>net.java.html.json</artifactId>
34.25 - <version>${net.java.html.version}</version>
34.26 - <type>jar</type>
34.27 - </dependency>
34.28 - <dependency>
34.29 - <groupId>org.testng</groupId>
34.30 - <artifactId>testng</artifactId>
34.31 - <version>6.5.2</version>
34.32 - <scope>test</scope>
34.33 - </dependency>
34.34 - </dependencies>
34.35 -</project>
35.1 --- a/chat/model/src/main/java/org/apidesign/html/chatserver/model/MessageImpl.java Thu Aug 14 07:51:33 2014 +0200
35.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
35.3 @@ -1,59 +0,0 @@
35.4 -/**
35.5 - * The MIT License (MIT)
35.6 - *
35.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
35.8 - *
35.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
35.10 - * of this software and associated documentation files (the "Software"), to deal
35.11 - * in the Software without restriction, including without limitation the rights
35.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35.13 - * copies of the Software, and to permit persons to whom the Software is
35.14 - * furnished to do so, subject to the following conditions:
35.15 - *
35.16 - * The above copyright notice and this permission notice shall be included in
35.17 - * all copies or substantial portions of the Software.
35.18 - *
35.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
35.25 - * THE SOFTWARE.
35.26 - */
35.27 -package org.apidesign.html.chatserver.model;
35.28 -
35.29 -import net.java.html.json.ComputedProperty;
35.30 -import net.java.html.json.Model;
35.31 -import net.java.html.json.Property;
35.32 -
35.33 -/** Generic model of communication between browser and a chat server.
35.34 - * The same code is then used on the server, on the client and even in unit
35.35 - * tests.
35.36 - *
35.37 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
35.38 - */
35.39 -@Model(className = "Message", properties = {
35.40 - @Property(name = "user", type = String.class),
35.41 - @Property(name = "comment", type = String.class),
35.42 - @Property(name = "since", type = long.class)
35.43 -})
35.44 -class MessageImpl {
35.45 - @ComputedProperty static String at(long since) {
35.46 - long delta = since / 1000;
35.47 - if (delta <= 0) {
35.48 - return "Boot-time";
35.49 - }
35.50 - if (delta < 60) {
35.51 - return delta + "s";
35.52 - }
35.53 - delta /= 60;
35.54 - return delta + "min";
35.55 - }
35.56 -
35.57 - @Model(className = "Query", properties = {
35.58 - @Property(name = "messages", type = Message.class, array = true)
35.59 - })
35.60 - class QryMsgs {
35.61 - }
35.62 -}
36.1 --- a/chat/model/src/test/java/org/apidesign/html/chatserver/model/MessageImplTest.java Thu Aug 14 07:51:33 2014 +0200
36.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
36.3 @@ -1,45 +0,0 @@
36.4 -/**
36.5 - * The MIT License (MIT)
36.6 - *
36.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
36.8 - *
36.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
36.10 - * of this software and associated documentation files (the "Software"), to deal
36.11 - * in the Software without restriction, including without limitation the rights
36.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36.13 - * copies of the Software, and to permit persons to whom the Software is
36.14 - * furnished to do so, subject to the following conditions:
36.15 - *
36.16 - * The above copyright notice and this permission notice shall be included in
36.17 - * all copies or substantial portions of the Software.
36.18 - *
36.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
36.25 - * THE SOFTWARE.
36.26 - */
36.27 -package org.apidesign.html.chatserver.model;
36.28 -
36.29 -import static org.testng.Assert.*;
36.30 -import org.testng.annotations.Test;
36.31 -
36.32 -/**
36.33 - *
36.34 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
36.35 - */
36.36 -public class MessageImplTest {
36.37 -
36.38 - @Test public void properlyConvertedToSeconds() {
36.39 - Message msg = new Message();
36.40 - msg.setSince(5143);
36.41 - assertEquals(msg.getAt(), "5s");
36.42 - }
36.43 - @Test public void properlyConvertedToMinutes() {
36.44 - Message msg = new Message();
36.45 - msg.setSince(63564);
36.46 - assertEquals(msg.getAt(), "1min");
36.47 - }
36.48 -}
36.49 \ No newline at end of file
37.1 --- a/chat/pom.xml Thu Aug 14 07:51:33 2014 +0200
37.2 +++ b/chat/pom.xml Fri Apr 22 05:56:47 2016 +0200
37.3 @@ -1,38 +1,68 @@
37.4 -<?xml version="1.0" encoding="UTF-8"?>
37.5 -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
37.6 - <modelVersion>4.0.0</modelVersion>
37.7 +<?xml version="1.0"?>
37.8 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
37.9 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
37.10 + <modelVersion>4.0.0</modelVersion>
37.11 +
37.12 + <groupId>org.apidesign.demo</groupId>
37.13 + <artifactId>chat-pom</artifactId>
37.14 + <version>1.0-SNAPSHOT</version>
37.15 <parent>
37.16 - <artifactId>demo</artifactId>
37.17 - <groupId>org.apidesign.html</groupId>
37.18 - <version>1.0-SNAPSHOT</version>
37.19 + <artifactId>demo</artifactId>
37.20 + <groupId>org.apidesign.html</groupId>
37.21 + <version>1.0-SNAPSHOT</version>
37.22 </parent>
37.23 - <groupId>org.apidesign.html</groupId>
37.24 - <artifactId>chat-demo</artifactId>
37.25 - <version>1.0-SNAPSHOT</version>
37.26 <packaging>pom</packaging>
37.27 - <name>Chat Server with Jersey and Bck2Brwsr</name>
37.28 - <properties>
37.29 - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
37.30 - <bck2brwsr.obfuscationlevel>MINIMAL</bck2brwsr.obfuscationlevel>
37.31 - </properties>
37.32 - <modules>
37.33 - <module>model</module>
37.34 - <module>client</module>
37.35 - <module>server</module>
37.36 - </modules>
37.37 - <build>
37.38 - <pluginManagement>
37.39 - <plugins>
37.40 - <plugin>
37.41 - <groupId>org.apache.maven.plugins</groupId>
37.42 - <artifactId>maven-compiler-plugin</artifactId>
37.43 - <version>2.3.2</version>
37.44 - <configuration>
37.45 - <source>1.7</source>
37.46 - <target>1.7</target>
37.47 - </configuration>
37.48 - </plugin>
37.49 - </plugins>
37.50 - </pluginManagement>
37.51 - </build>
37.52 -</project>
37.53 \ No newline at end of file
37.54 +
37.55 + <name>chat</name>
37.56 +
37.57 + <modules>
37.58 + <module>shared</module>
37.59 + <module>client</module>
37.60 + <module>client-web</module>
37.61 + <module>client-android</module>
37.62 + <module>client-ios</module>
37.63 + <module>server</module>
37.64 + <module>js</module>
37.65 + </modules>
37.66 + <properties>
37.67 + <net.java.html.version>1.3</net.java.html.version>
37.68 + <bck2brwsr.version>0.16</bck2brwsr.version>
37.69 + <bck2brwsr.obfuscationlevel>FULL</bck2brwsr.obfuscationlevel>
37.70 + <jersey.version>2.13</jersey.version>
37.71 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
37.72 + </properties>
37.73 + <dependencyManagement>
37.74 + <dependencies>
37.75 + <dependency>
37.76 + <groupId>org.testng</groupId>
37.77 + <artifactId>testng</artifactId>
37.78 + <scope>test</scope>
37.79 + <version>6.8.8</version>
37.80 + </dependency>
37.81 + </dependencies>
37.82 + </dependencyManagement>
37.83 + <build>
37.84 + <plugins>
37.85 + <!--
37.86 + <plugin>
37.87 + <groupId>org.apache.maven.plugins</groupId>
37.88 + <artifactId>maven-enforcer-plugin</artifactId>
37.89 + <version>1.3.1</version>
37.90 + <executions>
37.91 + <execution>
37.92 + <id>enforce-versions</id>
37.93 + <goals>
37.94 + <goal>enforce</goal>
37.95 + </goals>
37.96 + <configuration>
37.97 + <rules>
37.98 + <DependencyConvergence/>
37.99 + </rules>
37.100 + </configuration>
37.101 + </execution>
37.102 + </executions>
37.103 + </plugin>
37.104 + -->
37.105 + </plugins>
37.106 + </build>
37.107 +</project>
38.1 --- a/chat/server/nbactions.xml Thu Aug 14 07:51:33 2014 +0200
38.2 +++ b/chat/server/nbactions.xml Fri Apr 22 05:56:47 2016 +0200
38.3 @@ -32,4 +32,14 @@
38.4 <goal>exec:java</goal>
38.5 </goals>
38.6 </action>
38.7 + <action>
38.8 + <actionName>debug</actionName>
38.9 + <goals>
38.10 + <goal>process-classes</goal>
38.11 + <goal>exec:java</goal>
38.12 + </goals>
38.13 + <properties>
38.14 + <jpda.listen>maven</jpda.listen>
38.15 + </properties>
38.16 + </action>
38.17 </actions>
39.1 --- a/chat/server/pom.xml Thu Aug 14 07:51:33 2014 +0200
39.2 +++ b/chat/server/pom.xml Fri Apr 22 05:56:47 2016 +0200
39.3 @@ -1,130 +1,99 @@
39.4 -<?xml version="1.0"?>
39.5 -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
39.6 - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
39.7 - <modelVersion>4.0.0</modelVersion>
39.8 - <parent>
39.9 - <groupId>org.apidesign.html</groupId>
39.10 - <artifactId>chat-demo</artifactId>
39.11 - <version>1.0-SNAPSHOT</version>
39.12 - </parent>
39.13 - <groupId>org.apidesign.html.demo</groupId>
39.14 - <artifactId>chat-server</artifactId>
39.15 - <version>1.0-SNAPSHOT</version>
39.16 - <name>Chat Server Using @Model</name>
39.17 - <url>http://maven.apache.org</url>
39.18 - <build>
39.19 - <plugins>
39.20 +<?xml version="1.0" encoding="UTF-8"?>
39.21 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
39.22 + <modelVersion>4.0.0</modelVersion>
39.23 + <parent>
39.24 + <groupId>org.apidesign.demo</groupId>
39.25 + <artifactId>chat-pom</artifactId>
39.26 + <version>1.0-SNAPSHOT</version>
39.27 + </parent>
39.28 + <artifactId>chat-server</artifactId>
39.29 + <packaging>jar</packaging>
39.30 + <name>chat Jersey based Server</name>
39.31 + <properties>
39.32 + <maven.compiler.source>1.7</maven.compiler.source>
39.33 + <maven.compiler.target>1.7</maven.compiler.target>
39.34 + </properties>
39.35 + <dependencies>
39.36 + <dependency>
39.37 + <groupId>org.netbeans.html</groupId>
39.38 + <artifactId>net.java.html.json</artifactId>
39.39 + <version>${net.java.html.version}</version>
39.40 + <type>jar</type>
39.41 + </dependency>
39.42 + <dependency>
39.43 + <groupId>org.glassfish.jersey.media</groupId>
39.44 + <artifactId>html-json</artifactId>
39.45 + <version>${jersey.version}</version>
39.46 + <scope>runtime</scope>
39.47 + <exclusions>
39.48 + <!-- use explicitly specified versions -->
39.49 + <exclusion>
39.50 + <groupId>org.netbeans.html</groupId>
39.51 + <artifactId>net.java.html.json</artifactId>
39.52 + </exclusion>
39.53 + <exclusion>
39.54 + <groupId>org.netbeans.html</groupId>
39.55 + <artifactId>ko-ws-tyrus</artifactId>
39.56 + </exclusion>
39.57 + </exclusions>
39.58 + </dependency>
39.59 + <dependency>
39.60 + <groupId>org.testng</groupId>
39.61 + <artifactId>testng</artifactId>
39.62 + <scope>test</scope>
39.63 + </dependency>
39.64 + <dependency>
39.65 + <groupId>org.glassfish.jersey.connectors</groupId>
39.66 + <artifactId>jersey-grizzly-connector</artifactId>
39.67 + <version>${jersey.version}</version>
39.68 + </dependency>
39.69 + <dependency>
39.70 + <groupId>org.glassfish.jersey.containers</groupId>
39.71 + <artifactId>jersey-container-grizzly2-http</artifactId>
39.72 + <version>${jersey.version}</version>
39.73 + <type>jar</type>
39.74 + </dependency>
39.75 + <dependency>
39.76 + <groupId>org.glassfish.jersey.core</groupId>
39.77 + <artifactId>jersey-common</artifactId>
39.78 + <version>${jersey.version}</version>
39.79 + <scope>runtime</scope>
39.80 + </dependency>
39.81 + <dependency>
39.82 + <artifactId>ko-ws-tyrus</artifactId>
39.83 + <groupId>org.netbeans.html</groupId>
39.84 + <type>jar</type>
39.85 + <version>${net.java.html.version}</version>
39.86 + <scope>runtime</scope>
39.87 + <exclusions>
39.88 + <!-- use explicitly specified versions -->
39.89 + <exclusion>
39.90 + <groupId>org.glassfish.grizzly</groupId>
39.91 + <artifactId>grizzly-framework</artifactId>
39.92 + </exclusion>
39.93 + <exclusion>
39.94 + <groupId>org.glassfish.grizzly</groupId>
39.95 + <artifactId>grizzly-http-server</artifactId>
39.96 + </exclusion>
39.97 + </exclusions>
39.98 + </dependency>
39.99 + <dependency>
39.100 + <groupId>org.apidesign.demo</groupId>
39.101 + <artifactId>chat-shared</artifactId>
39.102 + <version>${project.version}</version>
39.103 + <type>jar</type>
39.104 + </dependency>
39.105 + </dependencies>
39.106 + <build>
39.107 + <plugins>
39.108 <plugin>
39.109 <groupId>org.codehaus.mojo</groupId>
39.110 <artifactId>exec-maven-plugin</artifactId>
39.111 <version>1.2.1</version>
39.112 <configuration>
39.113 - <mainClass>org.apidesign.bck2brwsr.demo.chatserver.impl.Main</mainClass>
39.114 + <mainClass>org.apidesign.demo.chat.server.Main</mainClass>
39.115 </configuration>
39.116 - </plugin>
39.117 - <plugin>
39.118 - <groupId>org.apache.maven.plugins</groupId>
39.119 - <artifactId>maven-compiler-plugin</artifactId>
39.120 - <version>2.3.2</version>
39.121 - <configuration>
39.122 - <source>1.7</source>
39.123 - <target>1.7</target>
39.124 - </configuration>
39.125 - </plugin>
39.126 - <plugin>
39.127 - <groupId>org.apache.maven.plugins</groupId>
39.128 - <artifactId>maven-dependency-plugin</artifactId>
39.129 - <version>2.7</version>
39.130 - <executions>
39.131 - <execution>
39.132 - <phase>process-resources</phase>
39.133 - <id>unpack-client-code</id>
39.134 - <goals>
39.135 - <goal>unpack</goal>
39.136 - </goals>
39.137 - <configuration>
39.138 - <artifactItems>
39.139 - <artifactItem>
39.140 - <groupId>org.apidesign.html.demo</groupId>
39.141 - <artifactId>chat-client</artifactId>
39.142 - <version>1.0-SNAPSHOT</version>
39.143 - <type>zip</type>
39.144 - <classifier>bck2brwsr</classifier>
39.145 - </artifactItem>
39.146 - </artifactItems>
39.147 - <outputDirectory>${project.build.directory}/classes/org/apidesign/bck2brwsr/demo/chatserver/impl/</outputDirectory>
39.148 - </configuration>
39.149 - </execution>
39.150 - </executions>
39.151 -
39.152 - </plugin>
39.153 - </plugins>
39.154 - </build>
39.155 - <dependencies>
39.156 - <dependency>
39.157 - <groupId>org.netbeans.html</groupId>
39.158 - <artifactId>net.java.html.json</artifactId>
39.159 - <version>${net.java.html.version}</version>
39.160 - <type>jar</type>
39.161 - </dependency>
39.162 - <dependency>
39.163 - <groupId>org.glassfish.jersey.media</groupId>
39.164 - <artifactId>html-json</artifactId>
39.165 - <version>2.6</version>
39.166 - <scope>runtime</scope>
39.167 - </dependency>
39.168 - <dependency>
39.169 - <groupId>org.testng</groupId>
39.170 - <artifactId>testng</artifactId>
39.171 - <version>6.5.2</version>
39.172 - <scope>test</scope>
39.173 - </dependency>
39.174 - <dependency>
39.175 - <groupId>org.glassfish.jersey.connectors</groupId>
39.176 - <artifactId>jersey-grizzly-connector</artifactId>
39.177 - <version>2.4.1</version>
39.178 - </dependency>
39.179 - <dependency>
39.180 - <groupId>org.glassfish.jersey.containers</groupId>
39.181 - <artifactId>jersey-container-grizzly2-http</artifactId>
39.182 - <version>2.6</version>
39.183 - <type>jar</type>
39.184 - </dependency>
39.185 - <dependency>
39.186 - <groupId>org.glassfish.grizzly</groupId>
39.187 - <artifactId>grizzly-http-server</artifactId>
39.188 - <version>2.3.8</version>
39.189 - </dependency>
39.190 - <dependency>
39.191 - <groupId>org.apidesign.html.demo</groupId>
39.192 - <artifactId>chat-model</artifactId>
39.193 - <version>1.0-SNAPSHOT</version>
39.194 - <type>jar</type>
39.195 - </dependency>
39.196 - <dependency>
39.197 - <artifactId>javax.ws.rs-api</artifactId>
39.198 - <groupId>javax.ws.rs</groupId>
39.199 - <type>jar</type>
39.200 - <version>2.0</version>
39.201 - </dependency>
39.202 - <dependency>
39.203 - <groupId>org.glassfish.jersey.core</groupId>
39.204 - <artifactId>jersey-common</artifactId>
39.205 - <version>2.6</version>
39.206 - <scope>runtime</scope>
39.207 - </dependency>
39.208 - <dependency>
39.209 - <groupId>org.glassfish.grizzly</groupId>
39.210 - <artifactId>grizzly-framework</artifactId>
39.211 - <version>2.3.8</version>
39.212 - <scope>runtime</scope>
39.213 - </dependency>
39.214 - <dependency>
39.215 - <artifactId>ko-ws-tyrus</artifactId>
39.216 - <groupId>org.netbeans.html</groupId>
39.217 - <type>jar</type>
39.218 - <version>${net.java.html.version}</version>
39.219 - <scope>runtime</scope>
39.220 - </dependency>
39.221 - </dependencies>
39.222 -</project>
39.223 + </plugin>
39.224 + </plugins>
39.225 + </build>
39.226 +</project>
39.227 \ No newline at end of file
40.1 --- a/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/ChatServerResource.java Thu Aug 14 07:51:33 2014 +0200
40.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
40.3 @@ -1,103 +0,0 @@
40.4 -/**
40.5 - * The MIT License (MIT)
40.6 - *
40.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
40.8 - *
40.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
40.10 - * of this software and associated documentation files (the "Software"), to deal
40.11 - * in the Software without restriction, including without limitation the rights
40.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40.13 - * copies of the Software, and to permit persons to whom the Software is
40.14 - * furnished to do so, subject to the following conditions:
40.15 - *
40.16 - * The above copyright notice and this permission notice shall be included in
40.17 - * all copies or substantial portions of the Software.
40.18 - *
40.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
40.25 - * THE SOFTWARE.
40.26 - */
40.27 -package org.apidesign.bck2brwsr.demo.chatserver.impl;
40.28 -
40.29 -import java.util.ArrayList;
40.30 -import java.util.IdentityHashMap;
40.31 -import java.util.List;
40.32 -import java.util.Map;
40.33 -import java.util.logging.Logger;
40.34 -import javax.inject.Singleton;
40.35 -import javax.ws.rs.Consumes;
40.36 -import javax.ws.rs.DefaultValue;
40.37 -import javax.ws.rs.GET;
40.38 -import javax.ws.rs.POST;
40.39 -import javax.ws.rs.Path;
40.40 -import javax.ws.rs.Produces;
40.41 -import javax.ws.rs.QueryParam;
40.42 -import javax.ws.rs.container.AsyncResponse;
40.43 -import javax.ws.rs.container.Suspended;
40.44 -import javax.ws.rs.core.MediaType;
40.45 -import org.apidesign.html.chatserver.model.Message;
40.46 -import org.apidesign.html.chatserver.model.Query;
40.47 -
40.48 -/** Server side of the chat application.*/
40.49 -@Path("/chat/") @Singleton
40.50 -public final class ChatServerResource {
40.51 - private static final Logger LOG = Logger.getLogger(ChatServerResource.class.getName());
40.52 - private static final long started = System.currentTimeMillis() - 10;
40.53 -
40.54 - private List<Message> msgs = new ArrayList<>();
40.55 - {
40.56 - Message welcome = new Message();
40.57 - welcome.setUser("system");
40.58 - welcome.setComment("Welcome and enjoy!");
40.59 - welcome.setSince(10);
40.60 - msgs.add(welcome);
40.61 - }
40.62 -
40.63 - private final Map<AsyncResponse, Long> awaiting = new IdentityHashMap<>();
40.64 -
40.65 - @Produces(MediaType.APPLICATION_JSON)
40.66 - @GET public synchronized void getResources(
40.67 - @QueryParam("since") @DefaultValue("0") long since,
40.68 - @Suspended AsyncResponse ar
40.69 - ) {
40.70 - Query q = new Query();
40.71 - for (Message m : msgs) {
40.72 - if (m.getSince()>= since) {
40.73 - q.getMessages().add(m);
40.74 - }
40.75 - }
40.76 - if (!q.getMessages().isEmpty()) {
40.77 - ar.resume(q);
40.78 - } else {
40.79 - awaiting.put(ar, since);
40.80 - }
40.81 - }
40.82 -
40.83 - private void handleAwaiting(long newest) {
40.84 - assert Thread.holdsLock(this);
40.85 - AGAIN: for (;;) {
40.86 - for (Map.Entry<AsyncResponse, Long> entry : awaiting.entrySet()) {
40.87 - AsyncResponse ar = entry.getKey();
40.88 - Long since = entry.getValue();
40.89 - if (since <= newest) {
40.90 - awaiting.remove(ar);
40.91 - getResources(since, ar);
40.92 - continue AGAIN;
40.93 - }
40.94 - }
40.95 - return;
40.96 - }
40.97 - }
40.98 -
40.99 - @POST @Consumes(value = MediaType.APPLICATION_JSON)
40.100 - public synchronized Message publish(Message msg) {
40.101 - msg.setSince(System.currentTimeMillis() - started);
40.102 - msgs.add(msg);
40.103 - handleAwaiting(msg.getSince());
40.104 - return msg;
40.105 - }
40.106 -}
41.1 --- a/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/ClientPagesResource.java Thu Aug 14 07:51:33 2014 +0200
41.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
41.3 @@ -1,45 +0,0 @@
41.4 -/**
41.5 - * The MIT License (MIT)
41.6 - *
41.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
41.8 - *
41.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
41.10 - * of this software and associated documentation files (the "Software"), to deal
41.11 - * in the Software without restriction, including without limitation the rights
41.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41.13 - * copies of the Software, and to permit persons to whom the Software is
41.14 - * furnished to do so, subject to the following conditions:
41.15 - *
41.16 - * The above copyright notice and this permission notice shall be included in
41.17 - * all copies or substantial portions of the Software.
41.18 - *
41.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
41.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
41.25 - * THE SOFTWARE.
41.26 - */
41.27 -package org.apidesign.bck2brwsr.demo.chatserver.impl;
41.28 -
41.29 -import java.io.InputStream;
41.30 -import javax.ws.rs.GET;
41.31 -import javax.ws.rs.Path;
41.32 -import javax.ws.rs.PathParam;
41.33 -
41.34 -/**
41.35 - *
41.36 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
41.37 - */
41.38 -@Path("/")
41.39 -public final class ClientPagesResource {
41.40 - @GET public InputStream indexHtml() {
41.41 - return clientData("index.html");
41.42 - }
41.43 -
41.44 - @GET @Path("{resource:.*}")
41.45 - public InputStream clientData(@PathParam("resource") String res) {
41.46 - return ClientPagesResource.class.getResourceAsStream("client/" + res);
41.47 - }
41.48 -}
42.1 --- a/chat/server/src/main/java/org/apidesign/bck2brwsr/demo/chatserver/impl/Main.java Thu Aug 14 07:51:33 2014 +0200
42.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
42.3 @@ -1,56 +0,0 @@
42.4 -/**
42.5 - * The MIT License (MIT)
42.6 - *
42.7 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
42.8 - *
42.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
42.10 - * of this software and associated documentation files (the "Software"), to deal
42.11 - * in the Software without restriction, including without limitation the rights
42.12 - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
42.13 - * copies of the Software, and to permit persons to whom the Software is
42.14 - * furnished to do so, subject to the following conditions:
42.15 - *
42.16 - * The above copyright notice and this permission notice shall be included in
42.17 - * all copies or substantial portions of the Software.
42.18 - *
42.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42.24 - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
42.25 - * THE SOFTWARE.
42.26 - */
42.27 -package org.apidesign.bck2brwsr.demo.chatserver.impl;
42.28 -
42.29 -import java.awt.Desktop;
42.30 -import java.io.IOException;
42.31 -import java.net.URI;
42.32 -import org.glassfish.grizzly.http.server.HttpServer;
42.33 -import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
42.34 -import org.glassfish.jersey.server.ResourceConfig;
42.35 -
42.36 -/** Starts chat server based on Jersey.
42.37 - *
42.38 - * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
42.39 - */
42.40 -final class Main {
42.41 - public static void main(String... args) throws Exception {
42.42 - ResourceConfig rc = new ResourceConfig(
42.43 - ChatServerResource.class, ClientPagesResource.class
42.44 - );
42.45 - URI u = new URI("http://localhost:8080/");
42.46 - HttpServer server = GrizzlyHttpServerFactory.createHttpServer(u, rc);
42.47 - System.err.println("Server running at " + u);
42.48 - try {
42.49 - System.err.println("Launching browser");
42.50 - Desktop.getDesktop().browse(u);
42.51 - } catch (IOException ex) {
42.52 - System.err.println("Launching failed: " + ex.getMessage());
42.53 - }
42.54 - System.err.println("Press Enter to shutdown the server");
42.55 - System.in.read();
42.56 - server.stop();
42.57 - }
42.58 -
42.59 -}
43.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
43.2 +++ b/chat/server/src/main/java/org/apidesign/demo/chat/server/ChatServerResource.java Fri Apr 22 05:56:47 2016 +0200
43.3 @@ -0,0 +1,103 @@
43.4 +/**
43.5 + * The MIT License (MIT)
43.6 + *
43.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
43.8 + *
43.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
43.10 + * of this software and associated documentation files (the "Software"), to deal
43.11 + * in the Software without restriction, including without limitation the rights
43.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43.13 + * copies of the Software, and to permit persons to whom the Software is
43.14 + * furnished to do so, subject to the following conditions:
43.15 + *
43.16 + * The above copyright notice and this permission notice shall be included in
43.17 + * all copies or substantial portions of the Software.
43.18 + *
43.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
43.25 + * THE SOFTWARE.
43.26 + */
43.27 +package org.apidesign.demo.chat.server;
43.28 +
43.29 +import java.util.ArrayList;
43.30 +import java.util.IdentityHashMap;
43.31 +import java.util.List;
43.32 +import java.util.Map;
43.33 +import java.util.logging.Logger;
43.34 +import javax.inject.Singleton;
43.35 +import javax.ws.rs.Consumes;
43.36 +import javax.ws.rs.DefaultValue;
43.37 +import javax.ws.rs.GET;
43.38 +import javax.ws.rs.POST;
43.39 +import javax.ws.rs.Path;
43.40 +import javax.ws.rs.Produces;
43.41 +import javax.ws.rs.QueryParam;
43.42 +import javax.ws.rs.container.AsyncResponse;
43.43 +import javax.ws.rs.container.Suspended;
43.44 +import javax.ws.rs.core.MediaType;
43.45 +import org.apidesign.demo.chat.shared.Message;
43.46 +import org.apidesign.demo.chat.shared.Query;
43.47 +
43.48 +/** Server side of the chat application.*/
43.49 +@Path("/chat/") @Singleton
43.50 +public final class ChatServerResource {
43.51 + private static final Logger LOG = Logger.getLogger(ChatServerResource.class.getName());
43.52 + private static final long started = System.currentTimeMillis() - 10;
43.53 +
43.54 + private List<Message> msgs = new ArrayList<>();
43.55 + {
43.56 + Message welcome = new Message();
43.57 + welcome.setUser("system");
43.58 + welcome.setComment("Welcome and enjoy!");
43.59 + welcome.setSince(10);
43.60 + msgs.add(welcome);
43.61 + }
43.62 +
43.63 + private final Map<AsyncResponse, Long> awaiting = new IdentityHashMap<>();
43.64 +
43.65 + @Produces(MediaType.APPLICATION_JSON)
43.66 + @GET public synchronized void getResources(
43.67 + @QueryParam("since") @DefaultValue("0") long since,
43.68 + @Suspended AsyncResponse ar
43.69 + ) {
43.70 + Query q = new Query();
43.71 + for (Message m : msgs) {
43.72 + if (m.getSince()>= since) {
43.73 + q.getMessages().add(m);
43.74 + }
43.75 + }
43.76 + if (!q.getMessages().isEmpty()) {
43.77 + ar.resume(q);
43.78 + } else {
43.79 + awaiting.put(ar, since);
43.80 + }
43.81 + }
43.82 +
43.83 + private void handleAwaiting(long newest) {
43.84 + assert Thread.holdsLock(this);
43.85 + AGAIN: for (;;) {
43.86 + for (Map.Entry<AsyncResponse, Long> entry : awaiting.entrySet()) {
43.87 + AsyncResponse ar = entry.getKey();
43.88 + Long since = entry.getValue();
43.89 + if (since <= newest) {
43.90 + awaiting.remove(ar);
43.91 + getResources(since, ar);
43.92 + continue AGAIN;
43.93 + }
43.94 + }
43.95 + return;
43.96 + }
43.97 + }
43.98 +
43.99 + @POST @Consumes(value = MediaType.APPLICATION_JSON)
43.100 + public synchronized Message publish(Message msg) {
43.101 + msg.setSince(System.currentTimeMillis() - started);
43.102 + msgs.add(msg);
43.103 + handleAwaiting(msg.getSince());
43.104 + return msg;
43.105 + }
43.106 +}
44.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
44.2 +++ b/chat/server/src/main/java/org/apidesign/demo/chat/server/Main.java Fri Apr 22 05:56:47 2016 +0200
44.3 @@ -0,0 +1,79 @@
44.4 +/**
44.5 + * The MIT License (MIT)
44.6 + *
44.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
44.8 + *
44.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
44.10 + * of this software and associated documentation files (the "Software"), to deal
44.11 + * in the Software without restriction, including without limitation the rights
44.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
44.13 + * copies of the Software, and to permit persons to whom the Software is
44.14 + * furnished to do so, subject to the following conditions:
44.15 + *
44.16 + * The above copyright notice and this permission notice shall be included in
44.17 + * all copies or substantial portions of the Software.
44.18 + *
44.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
44.25 + * THE SOFTWARE.
44.26 + */
44.27 +package org.apidesign.demo.chat.server;
44.28 +
44.29 +import java.io.IOException;
44.30 +import java.net.Inet4Address;
44.31 +import java.net.InterfaceAddress;
44.32 +import java.net.NetworkInterface;
44.33 +import java.net.URI;
44.34 +import java.util.Enumeration;
44.35 +import javax.ws.rs.container.ContainerRequestContext;
44.36 +import javax.ws.rs.container.ContainerResponseContext;
44.37 +import javax.ws.rs.container.ContainerResponseFilter;
44.38 +import org.glassfish.grizzly.http.server.HttpServer;
44.39 +import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
44.40 +import org.glassfish.jersey.server.ResourceConfig;
44.41 +
44.42 +/** Starts REST server based on Jersey.
44.43 + */
44.44 +final class Main implements ContainerResponseFilter {
44.45 + public static void main(String... args) throws Exception {
44.46 + ResourceConfig rc = new ResourceConfig(
44.47 + ChatServerResource.class, Main.class
44.48 + );
44.49 + URI u = new URI("http://0.0.0.0:8080/");
44.50 + HttpServer server = GrizzlyHttpServerFactory.createHttpServer(u, rc);
44.51 + System.err.println("Server running on following IP addresses:");
44.52 + dumpIPs();
44.53 + System.err.println("Press Enter to shutdown the server");
44.54 + System.in.read();
44.55 + server.stop();
44.56 + }
44.57 +
44.58 + @Override
44.59 + public void filter(
44.60 + ContainerRequestContext requestContext,
44.61 + ContainerResponseContext r
44.62 + ) throws IOException {
44.63 + r.getHeaders().add("Access-Control-Allow-Origin", "*");
44.64 + r.getHeaders().add("Access-Control-Allow-Credentials", "true");
44.65 + r.getHeaders().add("Access-Control-Allow-Headers", "Content-Type");
44.66 + r.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
44.67 + }
44.68 +
44.69 + private static void dumpIPs() throws Exception {
44.70 + Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
44.71 + while (en.hasMoreElements()) {
44.72 + NetworkInterface n = en.nextElement();
44.73 + if (n.isUp()) {
44.74 + for (InterfaceAddress i : n.getInterfaceAddresses()) {
44.75 + if (i.getAddress() instanceof Inet4Address) {
44.76 + System.err.println(n.getName() + ": " + i.getAddress());
44.77 + }
44.78 + }
44.79 + }
44.80 + }
44.81 + }
44.82 +}
45.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
45.2 +++ b/chat/shared/pom.xml Fri Apr 22 05:56:47 2016 +0200
45.3 @@ -0,0 +1,45 @@
45.4 +<?xml version="1.0" encoding="UTF-8"?>
45.5 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
45.6 + <modelVersion>4.0.0</modelVersion>
45.7 + <parent>
45.8 + <groupId>org.apidesign.demo</groupId>
45.9 + <artifactId>chat-pom</artifactId>
45.10 + <version>1.0-SNAPSHOT</version>
45.11 + </parent>
45.12 + <artifactId>chat-shared</artifactId>
45.13 + <packaging>bundle</packaging>
45.14 + <name>chat Shared Client Server Data Structures</name>
45.15 + <dependencies>
45.16 + <dependency>
45.17 + <groupId>org.netbeans.html</groupId>
45.18 + <artifactId>net.java.html.json</artifactId>
45.19 + <version>${net.java.html.version}</version>
45.20 + <type>jar</type>
45.21 + </dependency>
45.22 + <dependency>
45.23 + <groupId>org.testng</groupId>
45.24 + <artifactId>testng</artifactId>
45.25 + <scope>test</scope>
45.26 + </dependency>
45.27 + </dependencies>
45.28 + <properties>
45.29 + <maven.compiler.source>1.7</maven.compiler.source>
45.30 + <maven.compiler.target>1.7</maven.compiler.target>
45.31 + </properties>
45.32 + <build>
45.33 + <plugins>
45.34 + <plugin>
45.35 + <groupId>org.apache.felix</groupId>
45.36 + <artifactId>maven-bundle-plugin</artifactId>
45.37 + <version>2.4.0</version>
45.38 + <extensions>true</extensions>
45.39 + <configuration>
45.40 + <instructions>
45.41 + <Export-Package>org.apidesign.demo.chat.shared</Export-Package>
45.42 + <Bundle-SymbolicName>org.apidesign.demo.chat.shared</Bundle-SymbolicName>
45.43 + </instructions>
45.44 + </configuration>
45.45 + </plugin>
45.46 + </plugins>
45.47 + </build>
45.48 +</project>
45.49 \ No newline at end of file
46.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
46.2 +++ b/chat/shared/src/main/java/org/apidesign/demo/chat/shared/MessageImpl.java Fri Apr 22 05:56:47 2016 +0200
46.3 @@ -0,0 +1,59 @@
46.4 +/**
46.5 + * The MIT License (MIT)
46.6 + *
46.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
46.8 + *
46.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
46.10 + * of this software and associated documentation files (the "Software"), to deal
46.11 + * in the Software without restriction, including without limitation the rights
46.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46.13 + * copies of the Software, and to permit persons to whom the Software is
46.14 + * furnished to do so, subject to the following conditions:
46.15 + *
46.16 + * The above copyright notice and this permission notice shall be included in
46.17 + * all copies or substantial portions of the Software.
46.18 + *
46.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
46.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
46.25 + * THE SOFTWARE.
46.26 + */
46.27 +package org.apidesign.demo.chat.shared;
46.28 +
46.29 +import net.java.html.json.ComputedProperty;
46.30 +import net.java.html.json.Model;
46.31 +import net.java.html.json.Property;
46.32 +
46.33 +/** Generic model of communication between browser and a chat server.
46.34 + * The same code is then used on the server, on the client and even in unit
46.35 + * tests.
46.36 + *
46.37 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
46.38 + */
46.39 +@Model(className = "Message", properties = {
46.40 + @Property(name = "user", type = String.class),
46.41 + @Property(name = "comment", type = String.class),
46.42 + @Property(name = "since", type = long.class)
46.43 +})
46.44 +class MessageImpl {
46.45 + @ComputedProperty static String at(long since) {
46.46 + long delta = since / 1000;
46.47 + if (delta <= 0) {
46.48 + return "Boot-time";
46.49 + }
46.50 + if (delta < 60) {
46.51 + return delta + "s";
46.52 + }
46.53 + delta /= 60;
46.54 + return delta + "min";
46.55 + }
46.56 +
46.57 + @Model(className = "Query", properties = {
46.58 + @Property(name = "messages", type = Message.class, array = true)
46.59 + })
46.60 + class QryMsgs {
46.61 + }
46.62 +}
47.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
47.2 +++ b/chat/shared/src/test/java/org/apidesign/demo/chat/shared/MessageImplTest.java Fri Apr 22 05:56:47 2016 +0200
47.3 @@ -0,0 +1,45 @@
47.4 +/**
47.5 + * The MIT License (MIT)
47.6 + *
47.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
47.8 + *
47.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
47.10 + * of this software and associated documentation files (the "Software"), to deal
47.11 + * in the Software without restriction, including without limitation the rights
47.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
47.13 + * copies of the Software, and to permit persons to whom the Software is
47.14 + * furnished to do so, subject to the following conditions:
47.15 + *
47.16 + * The above copyright notice and this permission notice shall be included in
47.17 + * all copies or substantial portions of the Software.
47.18 + *
47.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
47.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
47.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
47.25 + * THE SOFTWARE.
47.26 + */
47.27 +package org.apidesign.demo.chat.shared;
47.28 +
47.29 +import static org.testng.Assert.*;
47.30 +import org.testng.annotations.Test;
47.31 +
47.32 +/**
47.33 + *
47.34 + * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
47.35 + */
47.36 +public class MessageImplTest {
47.37 +
47.38 + @Test public void properlyConvertedToSeconds() {
47.39 + Message msg = new Message();
47.40 + msg.setSince(5143);
47.41 + assertEquals(msg.getAt(), "5s");
47.42 + }
47.43 + @Test public void properlyConvertedToMinutes() {
47.44 + Message msg = new Message();
47.45 + msg.setSince(63564);
47.46 + assertEquals(msg.getAt(), "1min");
47.47 + }
47.48 +}
47.49 \ No newline at end of file
48.1 --- a/minesweeper/Info.plist.xml Thu Aug 14 07:51:33 2014 +0200
48.2 +++ b/minesweeper/Info.plist.xml Fri Apr 22 05:56:47 2016 +0200
48.3 @@ -1,4 +1,29 @@
48.4 <?xml version="1.0" encoding="UTF-8"?>
48.5 +<!--
48.6 +
48.7 + The MIT License (MIT)
48.8 +
48.9 + Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
48.10 +
48.11 + Permission is hereby granted, free of charge, to any person obtaining a copy
48.12 + of this software and associated documentation files (the "Software"), to deal
48.13 + in the Software without restriction, including without limitation the rights
48.14 + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48.15 + copies of the Software, and to permit persons to whom the Software is
48.16 + furnished to do so, subject to the following conditions:
48.17 +
48.18 + The above copyright notice and this permission notice shall be included in
48.19 + all copies or substantial portions of the Software.
48.20 +
48.21 + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48.22 + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48.23 + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
48.24 + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
48.25 + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48.26 + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
48.27 + THE SOFTWARE.
48.28 +
48.29 +-->
48.30 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
48.31 <plist version="1.0">
48.32 <dict>
49.1 --- a/pom.xml Thu Aug 14 07:51:33 2014 +0200
49.2 +++ b/pom.xml Fri Apr 22 05:56:47 2016 +0200
49.3 @@ -83,5 +83,14 @@
49.4 </configuration>
49.5 </plugin>
49.6 </plugins>
49.7 + <pluginManagement>
49.8 + <plugins>
49.9 + <plugin>
49.10 + <groupId>org.apache.maven.plugins</groupId>
49.11 + <artifactId>maven-compiler-plugin</artifactId>
49.12 + <version>2.5.1</version>
49.13 + </plugin>
49.14 + </plugins>
49.15 + </pluginManagement>
49.16 </build>
49.17 </project>