Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Commit

Permalink
JBRULES-412 Web app infrustructure and build system
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.jboss.org/repos/labs/labs/jbossrules/trunk@6120 c60d74c8-e8f6-0310-9e8f-d4a2fc68ab70
  • Loading branch information
michaelneale committed Sep 8, 2006
1 parent 4c19d7b commit 141aabe
Show file tree
Hide file tree
Showing 99 changed files with 3,569 additions and 0 deletions.
24 changes: 24 additions & 0 deletions drools-jbrms/.classpath
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry output="target/test-classes" kind="src" path="src/test/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.8/log4j-1.2.8.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/drools/drools-repository/3.2/drools-repository-3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/xerces/xmlParserAPIs/2.0.2/xmlParserAPIs-2.0.2.jar"/>
<classpathentry kind="var" path="M2_REPO/lucene/lucene/1.4.3/lucene-1.4.3.jar"/>
<classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
<classpathentry kind="var" path="M2_REPO/geronimo-spec/geronimo-spec-jta/1.0-M1/geronimo-spec-jta-1.0-M1.jar"/>
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.6.2/xercesImpl-2.6.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.0/slf4j-log4j12-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/derby/derby/10.1.1.0/derby-10.1.1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/google/gwt-servlet/1.1.10/gwt-servlet-1.1.10.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-core/1.0.1/jackrabbit-core-1.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/jsr170/jcr/1.0/jcr-1.0.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
14 changes: 14 additions & 0 deletions drools-jbrms/.project
@@ -0,0 +1,14 @@
<projectDescription>
<name>drools-brms</name>
<comment/>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
4 changes: 4 additions & 0 deletions drools-jbrms/JBRMS-compile
@@ -0,0 +1,4 @@
#!/bin/sh
APPDIR=`dirname $0`;
GWT_HOME=/home/michael/apps/gwt/gwt-linux-1.1.10;
java -cp "$APPDIR/src/main/java:$GWT_HOME/gwt-user.jar:$GWT_HOME/gwt-dev-linux.jar" com.google.gwt.dev.GWTCompiler -out "$APPDIR/src/main/webapp" "$@" org.drools.brms.JBRMS;
21 changes: 21 additions & 0 deletions drools-jbrms/JBRMS.launch
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.GWTShell"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;drools-brms&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;GWT_HOME/gwt-dev-linux.jar&quot; path=&quot;3&quot; type=&quot;3&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/drools-jbrms/src/main/java&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/drools-jbrms/target/classes&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;GWT_HOME/gwt-user.jar&quot; path=&quot;3&quot; type=&quot;3&quot;/&gt;&#10;"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out www org.drools.brms.JBRMS/JBRMS.html"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="drools-jbrms"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/drools-jbrms"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>
29 changes: 29 additions & 0 deletions drools-jbrms/README.txt
@@ -0,0 +1,29 @@
This covers the instructions on how to build/develop with this module.

It uses maven 2 as the main build system (pom.xml) which will setup the dependencies.
When building into a war, or running unit tests, use

>mvn package

GWT is used to build the UI. This is what the JBRMS-compile shell script is for.
If you take a look at the script, you may need to change the
path to be releveant for you.

Download GWT if you want to mess with the UI.

In eclipse: this also has a eclipse project file setup for you.
You will need to have the M2_REPO variable setup.

You can run all unit tests from here of course. You can also run GWT in
"hosted" mode (unless you are on the mac). To do this, there is a JBRMS-launch configuration
for eclipse (when you select Run>Run from the menu, it should provide a JBRMS run config).
If you are debugging GWT this way, you will need the GWT_HOME variable
set to where you have installed GWT (and if you are on windows, change the jar
to the one for you).

To make a change in GWT - when you are finished debugging, you will need to run
the JBRMS-compile script to refresh the static web content (all the AJAXY shite).



Any questions, contact michael.neale@gmail.com or find me in IRC.
53 changes: 53 additions & 0 deletions drools-jbrms/pom.xml
@@ -0,0 +1,53 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.drools</groupId>
<artifactId>drools-brms</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>Drools :: Business Rule Management System</name>
<url>http://www.jboss.com/products/rules</url>

<repositories>
<repository>
<id>basedir</id>
<url>file://${basedir}/../repository</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

<!-- first the deps for the repo API itself (Jackrabbit based) -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-repository</artifactId>
<version>3.2</version>
</dependency>

<!-- now the deps for the repo web app -->
<dependency>
<groupId>servletapi</groupId>
<artifactId>servletapi</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>google</groupId>
<artifactId>gwt-servlet</artifactId>
<version>1.1.10</version>
</dependency>

</dependencies>


<build>
<finalName>drools-jbrms</finalName>
</build>
</project>
12 changes: 12 additions & 0 deletions drools-jbrms/src/main/java/org/drools/brms/JBRMS.gwt.xml
@@ -0,0 +1,12 @@
<module>

<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>

<!-- Specify the app entry point class. -->
<!-- <entry-point class='org.drools.brms.client.JBRMS'/> -->
<entry-point class='org.drools.brms.client.JBRMSEntryPoint'/>

<servlet path="/jbrmsService" class="org.drools.brms.server.JBRMSServiceServlet" />

</module>
66 changes: 66 additions & 0 deletions drools-jbrms/src/main/java/org/drools/brms/client/Admin.java
@@ -0,0 +1,66 @@
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.drools.brms.client;

import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.TabPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

/**
* Demonstrates {"@link com.google.gwt.user.client.ui.TabPanel}.
*/
public class Admin extends JBRMSFeature {

public static ComponentInfo init() {
return new ComponentInfo("Admin",
"Administer the repository - security and preferences configuration.") {
public JBRMSFeature createInstance() {
return new Admin();
}

public Image getImage() {
return new Image("images/config.png");
}
};
}

private TabPanel fTabs = new TabPanel();

public Admin() {
fTabs.add(createImage("rembrandt/TheReturnOfTheProdigalSon.jpg"), "Security");
fTabs.add(createImage("rembrandt/TheReturnOfTheProdigalSon.jpg"), "Preferences");
fTabs.selectTab(0);

fTabs.setWidth("100%");
fTabs.setHeight("100%");
setWidget(fTabs);
}

public void onShow() {
}

private Widget createImage(String imageUrl) {
Image image = new Image(imageUrl);
image.setStyleName("ks-images-Image");

VerticalPanel p = new VerticalPanel();
p.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
p.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);
p.add(image);
return p;
}
}
80 changes: 80 additions & 0 deletions drools-jbrms/src/main/java/org/drools/brms/client/Deployment.java
@@ -0,0 +1,80 @@
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.drools.brms.client;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;

/**
* Demonstrates {@link com.google.gwt.user.client.ui.MenuBar} and
* {@link com.google.gwt.user.client.ui.MenuItem}.
*/
public class Deployment extends JBRMSFeature implements Command {

public static ComponentInfo init() {
return new ComponentInfo("Deployment",
"Deploy rulebases to runtime systems.") {
public JBRMSFeature createInstance() {
return new Deployment();
}

public Image getImage() {
return new Image("images/deploy.gif");
}
};
}

private MenuBar menu = new MenuBar();

public Deployment() {
MenuBar subMenu = new MenuBar(true);
subMenu.addItem("<code>Code</code>", true, this);
subMenu.addItem("<strike>Strikethrough</strike>", true, this);
subMenu.addItem("<u>Underlined</u>", true, this);

MenuBar menu0 = new MenuBar(true);
menu0.addItem("<b>Bold</b>", true, this);
menu0.addItem("<i>Italicized</i>", true, this);
menu0.addItem("More &#187;", true, subMenu);
MenuBar menu1 = new MenuBar(true);
menu1.addItem("<font color='#FF0000'><b>Apple</b></font>", true, this);
menu1.addItem("<font color='#FFFF00'><b>Banana</b></font>", true, this);
menu1.addItem("<font color='#FFFFFF'><b>Coconut</b></font>", true, this);
menu1.addItem("<font color='#8B4513'><b>Donut</b></font>", true, this);
MenuBar menu2 = new MenuBar(true);
menu2.addItem("Bling", this);
menu2.addItem("Ginormous", this);
menu2.addItem("<code>w00t!</code>", true, this);

menu.addItem(new MenuItem("Style", menu0));
menu.addItem(new MenuItem("Fruit", menu1));
menu.addItem(new MenuItem("Term", menu2));

menu.setWidth("100%");

setWidget(menu);
}

public void execute() {
Window.alert("Thank you for selecting a menu item.");
}

public void onShow() {
}
}
56 changes: 56 additions & 0 deletions drools-jbrms/src/main/java/org/drools/brms/client/Info.java
@@ -0,0 +1,56 @@
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.drools.brms.client;

import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.Image;



/**
* Introduction page.
*/
public class Info extends JBRMSFeature {

public static ComponentInfo init() {
return new ComponentInfo("Info", "JBoss Rules Managment Console.") {
public JBRMSFeature createInstance() {
return new Info();
}

public Image getImage() {
return new Image("images/drools.gif");
}
};
}

public Info() {

setWidget(new HTML(
"<div class='infoProse'>"
+ "Welcome to the JBoss Rules Management System console."
+ "<p>Currently very much a WIP."
+ "</div>"
+ "<div>"
+ "<img src='images/drools_logo.png'"
+ "</div>"
,
true));
}

public void onShow() {
}
}

0 comments on commit 141aabe

Please sign in to comment.