<commit_before>TodoMVC Services - Java EE 6
=====

An example of services to act as a backend for distributed TodoMVC services, written in Java EE 6 using JBoss AS 7.1.1.Final.

Has been tested in JBoss 7.1.1.Final in OS X 10.7.4.

### Service

If the webapp is deployed in a local JBoss instance, it's RESTful service URL is:
http://localhost:8080/todomvc-services-javaee6/todos

It implements the following:
* Get all records & can optionally filter with ?owner=some_value
* Get/push/put/delete a single record

Currently, it is setup to circumvent same origin policy using a CORSFilter based on this [this example][cors], but specifies Access-Control-Allow-Headers as "x-requested-with". If using this for non-public/authenticated use, you can remove the cors package and the filter+filter-mapping from its web.xml.

### Model

Example collection (note: owner is optional):

    [{"id":1,"title":"this is a test","completed":false,"owner":"guest"},{"id":2,"title":"this is a test","completed":false,"owner":"guest"}]

### Database

Assuming using JBoss 7.1.1.Final, it stores values in the default H2 in-memory database with jndi name: java:jboss/datasources/ExampleDS. The JNDI name, etc. can be changed in src/main/java/resources/META-INF/persistence.xml.

### Setup

* Install Java (if necessary).
* Install [Maven 3][mvn]
* Install [JBoss AS 7.1.1][jbossas]

### Start JBoss

In a separate terminal window, do:

    cd jboss-as-7.1.1.Final/bin
    ./standalone.sh

It might help to add an administrative user to be able to check that the war deployed, etc. In a separate terminal window, do:

    cd jboss-as-7.1.1.Final/bin
    ./add-user.sh

### Build

    mvn clean install

### Deploy

    cp target/todomvc-services-javaee6.war jboss-as-7.1.1.Final/standalone/deployments/

### Testing

For those with *nix, can test via curl with:

    ./test.sh

(Currently, that test script requires visual validation, and isn't removing all tasks it creates, due to an issue with the test script that I've not had time to fix.)

### License

Copyright (c) 2012 <NAME>, released under the [MIT license][lic].

[cors]: http://padcom13.blogspot.com/2011/09/cors-filter-for-java-applications.html
[mvn]: http://maven.apache.org/download.html
[jbossas]: http://www.jboss.org/jbossas/downloads/
[lic]: http://github.com/garysweaver/todomvc-services-javaee6/blob/master/LICENSE<commit_msg>added link to TodoMVC<commit_after>TodoMVC Services - Java EE 6
=====

An example of services to act as a backend for distributed [TodoMVC][todomvc] implementations, written in Java EE 6 using JBoss AS 7.1.1.Final.

Has been tested in JBoss 7.1.1.Final in OS X 10.7.4.

### Service

If the webapp is deployed in a local JBoss instance, it's RESTful service URL is:
http://localhost:8080/todomvc-services-javaee6/todos

It implements the following:
* Get all records & can optionally filter with ?owner=some_value
* Get/push/put/delete a single record

Currently, it is setup to circumvent same origin policy using a CORSFilter based on this [this example][cors], but specifies Access-Control-Allow-Headers as "x-requested-with". If using this for non-public/authenticated use, you can remove the cors package and the filter+filter-mapping from its web.xml.

### Model

Example collection (note: owner is optional):

    [{"id":1,"title":"this is a test","completed":false,"owner":"guest"},{"id":2,"title":"this is a test","completed":false,"owner":"guest"}]

### Database

Assuming using JBoss 7.1.1.Final, it stores values in the default H2 in-memory database with jndi name: java:jboss/datasources/ExampleDS. The JNDI name, etc. can be changed in src/main/java/resources/META-INF/persistence.xml.

### Setup

* Install Java (if necessary).
* Install [Maven 3][mvn]
* Install [JBoss AS 7.1.1][jbossas]

### Start JBoss

In a separate terminal window, do:

    cd jboss-as-7.1.1.Final/bin
    ./standalone.sh

It might help to add an administrative user to be able to check that the war deployed, etc. In a separate terminal window, do:

    cd jboss-as-7.1.1.Final/bin
    ./add-user.sh

### Build

    mvn clean install

### Deploy

    cp target/todomvc-services-javaee6.war jboss-as-7.1.1.Final/standalone/deployments/

### Testing

For those with *nix, can test via curl with:

    ./test.sh

(Currently, that test script requires visual validation, and isn't removing all tasks it creates, due to an issue with the test script that I've not had time to fix.)

### License

Copyright (c) 2012 <NAME>, released under the [MIT license][lic].

[todomvc]: https://github.com/addyosmani/todomvc
[cors]: http://padcom13.blogspot.com/2011/09/cors-filter-for-java-applications.html
[mvn]: http://maven.apache.org/download.html
[jbossas]: http://www.jboss.org/jbossas/downloads/
[lic]: http://github.com/garysweaver/todomvc-services-javaee6/blob/master/LICENSE
{'fraction_non_alphanumeric': 0.12052925366962994, 'fraction_numerical': 0.02067397146991937, 'mean_word_length': 4.130434782608695, 'pattern_counts': {'":': 16, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '583945', 'n_tokens_mistral': 1669, 'n_tokens_neox': 1542, 'n_words': 538}