EJB bootstrap of Clojure script invoking Java service creation
diff --git a/jpars.script.clojure/.settings/oracle.eclipse.tools.webtier.ui.prefs b/jpars.script.clojure/.settings/oracle.eclipse.tools.webtier.ui.prefs
index b0107e5..ce0f81f 100644
--- a/jpars.script.clojure/.settings/oracle.eclipse.tools.webtier.ui.prefs
+++ b/jpars.script.clojure/.settings/oracle.eclipse.tools.webtier.ui.prefs
@@ -1,3 +1,18 @@
+//_hiddenCategory_\:http\://java.sun.com/jsf/core=false
+//_hiddenCategory_\:http\://java.sun.com/jsf/html=false
+//_hiddenCategory_\:http\://java.sun.com/jsp/jstl/core=false
+//_hiddenCategory_\:http\://java.sun.com/jsp/jstl/fmt=false
+//_hiddenCategory_\:http\://java.sun.com/jsp/jstl/sql=false
+//_hiddenCategory_\:http\://java.sun.com/jsp/jstl/xml=false
+//_hiddenCategory_\:http\://java.sun.com/jstl/core=false
+//_hiddenCategory_\:http\://java.sun.com/jstl/core_rt=false
+//_hiddenCategory_\:http\://java.sun.com/jstl/fmt=false
+//_hiddenCategory_\:http\://java.sun.com/jstl/fmt_rt=false
+//_hiddenCategory_\:http\://java.sun.com/jstl/sql=false
+//_hiddenCategory_\:http\://java.sun.com/jstl/sql_rt=false
+//_hiddenCategory_\:http\://java.sun.com/jstl/xml=false
+//_hiddenCategory_\:http\://java.sun.com/jstl/xml_rt=false
+//_hiddenCategory_\:http\://mojarra.dev.java.net/mojarra_ext=true
_hiddenCategory_\:HTML=false
_hiddenCategory_\:ManagedBeans=false
_hiddenCategory_\:PageVariables=false
diff --git a/jpars.script.clojure/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/jpars.script.clojure/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
new file mode 100644
index 0000000..cc81385
--- /dev/null
+++ b/jpars.script.clojure/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
@@ -0,0 +1,7 @@
+<root>
+ <facet id="jst.jaxrs">
+ <node name="libprov">
+ <attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
+ </node>
+ </facet>
+</root>
diff --git a/jpars.script.clojure/.settings/org.eclipse.wst.common.project.facet.core.xml b/jpars.script.clojure/.settings/org.eclipse.wst.common.project.facet.core.xml
index d74c55e..4c37a74 100644
--- a/jpars.script.clojure/.settings/org.eclipse.wst.common.project.facet.core.xml
+++ b/jpars.script.clojure/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -4,4 +4,5 @@
<installed facet="java" version="1.5"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
+ <installed facet="jst.jaxrs" version="1.1"/>
</faceted-project>
diff --git a/jpars.script.clojure/pom.xml b/jpars.script.clojure/pom.xml
index 0921084..635e01c 100644
--- a/jpars.script.clojure/pom.xml
+++ b/jpars.script.clojure/pom.xml
@@ -37,7 +37,6 @@
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpars</artifactId>
<version>2.4.2-SNAPSHOT</version>
- <scope>provided</scope>
</dependency>
<dependency>
@@ -47,11 +46,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.9.1.0</version>
- </dependency>
<dependency>
diff --git a/jpars.script.clojure/src/main/java/example/ApplicationInitialize.java b/jpars.script.clojure/src/main/java/example/ApplicationInitialize.java
new file mode 100644
index 0000000..430241a
--- /dev/null
+++ b/jpars.script.clojure/src/main/java/example/ApplicationInitialize.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
+ * which accompanies this distribution.
+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * dclarke - initial
+ ******************************************************************************/
+package example;
+
+import java.io.IOException;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+
+import clojure.lang.RT;
+import clojure.lang.Var;
+
+@Startup
+@Singleton
+public class ApplicationInitialize {
+
+ /**
+ *
+ */
+ @PostConstruct
+ public void init() {
+ // Load the Clojure script -- as a side effect this initializes the
+ // runtime.
+ try {
+ RT.loadResourceScript("example/application.clj");
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ Object result = RT.var("example", "createService").invoke("test");
+
+ System.out.println("ApplicationInitialize::" + result);
+ }
+}
diff --git a/jpars.script.clojure/src/main/java/example/CreateDataService.java b/jpars.script.clojure/src/main/java/example/CreateDataService.java
index dd414d5..458ee77 100644
--- a/jpars.script.clojure/src/main/java/example/CreateDataService.java
+++ b/jpars.script.clojure/src/main/java/example/CreateDataService.java
@@ -69,7 +69,7 @@
// Ensure the persistence.xml provided data source are ignored for Java
// SE testing
- props.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, "");
+ props.put(PersistenceUnitProperties.NON_JTA_DATASOURCE, "java:app/env/TLDS");
props.put(PersistenceUnitProperties.JTA_DATASOURCE, "");
if (createTables) {
@@ -77,12 +77,6 @@
props.put(PersistenceUnitProperties.DDL_GENERATION_MODE, PersistenceUnitProperties.DDL_DATABASE_GENERATION);
}
- // Configure the use of embedded derby for the tests allowing system
- // properties of the same name to override
- props.put(PersistenceUnitProperties.JDBC_DRIVER, "org.apache.derby.jdbc.EmbeddedDriver");
- props.put(PersistenceUnitProperties.JDBC_URL, "jdbc:derby:target/derby/dynamic-api;create=true");
- props.put(PersistenceUnitProperties.JDBC_USER, "app");
- props.put(PersistenceUnitProperties.JDBC_PASSWORD, "app");
props.put(PersistenceUnitProperties.CLASSLOADER, dcl);
props.put(PersistenceUnitProperties.WEAVING, "static");
props.put(PersistenceUnitProperties.LOGGING_LEVEL, SessionLog.FINE_LABEL);
diff --git a/jpars.script.clojure/src/main/java/example/DataService.java b/jpars.script.clojure/src/main/java/example/DataService.java
index d54634b..e21b771 100644
--- a/jpars.script.clojure/src/main/java/example/DataService.java
+++ b/jpars.script.clojure/src/main/java/example/DataService.java
@@ -1,8 +1,3 @@
-package example;
-
-import java.io.IOException;
-
-import clojure.lang.RT;
/*******************************************************************************
* Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
@@ -15,6 +10,11 @@
* Contributors:
* dclarke - initial
******************************************************************************/
+package example;
+
+import java.io.IOException;
+
+import clojure.lang.RT;
import clojure.lang.Var;
public class DataService {
diff --git a/jpars.script.clojure/src/main/java/example/application.clj b/jpars.script.clojure/src/main/java/example/application.clj
new file mode 100644
index 0000000..1010213
--- /dev/null
+++ b/jpars.script.clojure/src/main/java/example/application.clj
@@ -0,0 +1,8 @@
+; example.clj
+(ns example)
+
+(defn createService [name]
+ (example.CreateDataService/setup)
+ (str "Create: " name)
+)
+
diff --git a/jpars.script.clojure/src/main/java/example/data-services.clj b/jpars.script.clojure/src/main/java/example/data-services.clj
index a4419bd..d057c56 100644
--- a/jpars.script.clojure/src/main/java/example/data-services.clj
+++ b/jpars.script.clojure/src/main/java/example/data-services.clj
@@ -1,15 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * dclarke - initial
- ******************************************************************************/
; data-services.clj
(ns toplink)
diff --git a/jpars.script.clojure/src/main/java/example/example.clj b/jpars.script.clojure/src/main/java/example/example.clj
deleted file mode 100644
index f0c93b5..0000000
--- a/jpars.script.clojure/src/main/java/example/example.clj
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved.
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
- * which accompanies this distribution.
- * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
- * and the Eclipse Distribution License is available at
- * http://www.eclipse.org/org/documents/edl-v10.php.
- *
- * Contributors:
- * dclarke - initial
- ******************************************************************************/
-; example.clj
-(ns example)
-
-(defn createService []
- (str "Create: " name)
-)
-
diff --git a/jpars.script.clojure/src/main/webapp/index.jsp b/jpars.script.clojure/src/main/webapp/index.jsp
index 6740b66..6001077 100644
--- a/jpars.script.clojure/src/main/webapp/index.jsp
+++ b/jpars.script.clojure/src/main/webapp/index.jsp
@@ -1,6 +1,5 @@
<html>
<body>
<h2>EclipseLink JPA-RS: Clojure Scripting</h2>
-<h3><%=example.DataService.create()%></h3>
</body>
</html>