Personal tools

Ace:SetupAndSample

From Adapt

Revision as of 14:24, 11 September 2008 by Toaster (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ACE

Using GlassFish (v2):

Installation:

Follow the installation directions on the download page. A setup script has to be run—unpacking the jar file won't work. Add the glassfish/bin directory to your path. A default domain, named domain1, is added by the installation program. Delete it:

asadmin delete-domain domain1

and create an ace domain:

asadmin create-domain --adminport 4848 ace

Specify what the admin user name and password will be for the domain and the master password for the whole server.

Start the domain:

asadmin start-domain ace

Verify http://localhost:8080 and http://localhost:4848

Create the mysql database:

create database ace_ims; grant all on ace_ims.* to 'ace'@'localhost' identified by 'bodleian; grant all on ace_ims.* to 'ace'@'localhost.localdomain' identified by 'bodleian';

Copy the mysql JDBC driver to the glassfish/lib directory and restart the server:

asadmin stop-domain ace asadmin start-domain ace

Create the connection pool and JDBC resource using the administration interface or via the command line. For the admin interface on port 4848, go to:

Resources -> JDBC -> Connection Pools

Select “New” and enter the following:

Name: ace-ims-mysql Resource Type: javax.sql.ConnectionPoolDataSource Database Vendor: mysql

On the next page, change URL and url to: jdbc:mysql://localhost:3306/ace_ims

and enter in the User and Password properties. Save, select the newly added pool from the list, and ping it to make sure it worked correctly.

Now add a JDBC Resource:

Resources -> JDBC -> JDBC Resources

JNDI Name: jdbc/ace-ims Pool name: ace-ims-mysql

Deploy the ace-ims.ear file: asadmin deploy ace-ims.ear

(If it errors with “invalid user or password”, issue an asadmin login)

Log files, by default, are placed in /tmp. Check ace-ims.system.log for an “Online” log entry.

Code overview:

ace-common:

edu.umiacs.ace.digest: Registering security providers and generating message digests are done using this package and not by using the standard Java API. This allows the application to control which digest algorithms and providers it acknowledges (as opposed to whatever the runtime system is configured to run with) and to setup algorithm precedence without tweaking the Java runtime configuration files.

Get an instance of a DigestFactory via DigestFactory.getInstance().

edu.umiacs.ace.digest.debug: A DigestProvider has two “message digests” useful in debugging. The StaticMessageDigest always returns a digest value of 1. AdditionMessageDigest starts with a value of zero and any update to the digest simply adds that to the current value of the digest. Used to test the functions of the Merkle Tree (in a tree with the following leafs: 1, 2, 3, 4: the root value should be 10).

edu.umiacs.ace.exception: Base exception for all ACE exceptions that includes a Status Code that indicates the type of error.

edu.umiacs.ace.hashtree: For building Merkle trees. Create an instance of a HashTreeBuilder to add leafs and then call build() to create a hash tree. Use link() to link in a hash value from the previous summary hash round into this tree. This tree supports nodes having two or more children, so the ordinal position of each node is important when generating proofs--”left” and “right” isn't sufficient. If a tree level doesn't have the exact number of nodes needed for the tree, extra nodes are balanced out so that while most nodes have two children, some may have three. For example, if the first level has 10 nodes, the next level has 5 and is placed in a 3-2 distribution. Since the tree supports multiple children, it also supports a variable tree order which may or may not be useful. The unit tests for the hash tree perform a lot of tests to make sure the generated trees and proofs are correct.

edu.umiacs.ace.hashtree.util: Utilties for pretty printing trees and proofs.

edu.umiacs.ace.util: Various utilities specific to ACE.

Ace-server: Exceptions common to both the IMS and AM and a few utilities only needed by the server code. ServiceLocator will be explained below.

Ace-ims: After realizing that managing persistence contexts manually is a major headache, I went back to using EJBs only to simplify working with the database. The ace-ims project is an enterprise project that consists of two sub-projects: ace-ims-ejb which contains the EJBs and ace-ims-war which contains the web tier code. Deploying the ace-ims enterprise object deploys both sub-projects.

Ace-ims-ejb: This contains the database entity objects and the objects used to perform CRUD and other operations on the database as Session Beans. Each session bean ends with the word “Bean” per Netbeans conventions (e.g., TokenClassBean). All of these session beans are stateless and should contain the @Stateless annotation.