roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r516134 - in /incubator/roller/trunk/sandbox/scripting: ./ groovy/ groovy/bin/ groovy/src/ groovy/src/org/apache/roller/util/ src/
Date Thu, 08 Mar 2007 18:33:27 GMT
Author: snoopdave
Date: Thu Mar  8 10:33:23 2007
New Revision: 516134

URL: http://svn.apache.org/viewvc?view=rev&rev=516134
Log:
re-org of scripting sandbox

Added:
    incubator/roller/trunk/sandbox/scripting/groovy/ant.properties
    incubator/roller/trunk/sandbox/scripting/groovy/bin/
    incubator/roller/trunk/sandbox/scripting/groovy/bin/checkuser.gy
    incubator/roller/trunk/sandbox/scripting/groovy/bin/createblog.gy
    incubator/roller/trunk/sandbox/scripting/groovy/bin/createcomment.gy
    incubator/roller/trunk/sandbox/scripting/groovy/bin/createentry.gy
    incubator/roller/trunk/sandbox/scripting/groovy/bin/createuser.gy
    incubator/roller/trunk/sandbox/scripting/groovy/bin/groovy   (with props)
    incubator/roller/trunk/sandbox/scripting/groovy/bin/listusers.gy
    incubator/roller/trunk/sandbox/scripting/groovy/bin/removeuser.gy
    incubator/roller/trunk/sandbox/scripting/groovy/bin/roller-custom.properties
    incubator/roller/trunk/sandbox/scripting/groovy/build.xml
    incubator/roller/trunk/sandbox/scripting/groovy/src/
      - copied from r515811, incubator/roller/trunk/sandbox/scripting/src/
    incubator/roller/trunk/sandbox/scripting/groovy/src/org/apache/roller/util/GroovyRunner.java
      - copied unchanged from r516118, incubator/roller/trunk/sandbox/scripting/src/org/apache/roller/util/GroovyRunner.java
Removed:
    incubator/roller/trunk/sandbox/scripting/ant.properties
    incubator/roller/trunk/sandbox/scripting/build.xml
    incubator/roller/trunk/sandbox/scripting/groovy/checkuser.gy
    incubator/roller/trunk/sandbox/scripting/groovy/createblog.gy
    incubator/roller/trunk/sandbox/scripting/groovy/createcomment.gy
    incubator/roller/trunk/sandbox/scripting/groovy/createentry.gy
    incubator/roller/trunk/sandbox/scripting/groovy/createuser.gy
    incubator/roller/trunk/sandbox/scripting/groovy/listusers.gy
    incubator/roller/trunk/sandbox/scripting/groovy/removeuser.gy
    incubator/roller/trunk/sandbox/scripting/groovy/roller-custom.properties
    incubator/roller/trunk/sandbox/scripting/src/

Added: incubator/roller/trunk/sandbox/scripting/groovy/ant.properties
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/ant.properties?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/ant.properties (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/ant.properties Thu Mar  8 10:33:23 2007
@@ -0,0 +1,2 @@
+rollersrc.dir=/Users/dave/roller_trunk
+groovy.home=/Applications/Java/groovy
\ No newline at end of file

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/checkuser.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/checkuser.gy?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/checkuser.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/checkuser.gy Thu Mar  8 10:33:23 2007
@@ -0,0 +1,32 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+if (args.length < 1) {
+    println "USAGE: groovy checkuser.gy <username>";
+    return;
+}
+
+roller = org.apache.roller.business.RollerFactory.getRoller();
+user = roller.getUserManager().getUserByUserName(args[0]);
+
+if (user == null) {
+    println "User ${username} not found";
+} else {
+    println "User ${user.userName} with id [${user.id}] has roles:";
+    user.getRoles().each({ item -> println "   ${item.getRole()}" });
+}

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/createblog.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/createblog.gy?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/createblog.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/createblog.gy Thu Mar  8 10:33:23
2007
@@ -0,0 +1,55 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+if (args.length < 2) {
+    println "USAGE: groovy createblog.gy <username> <handle>";
+    return;
+}
+
+username =    args[0];
+handle =      args[1];
+
+blogname =    handle;
+description = handle;
+theme =       "basic";
+
+roller = org.apache.roller.business.RollerFactory.getRoller();
+
+user = roller.getUserManager().getUserByUserName(username);
+if (user == null) {
+    println "ERROR: user ${username} not found";
+    System.exit(-1);
+} 
+website = new org.apache.roller.pojos.WebsiteData(
+   handle, 
+   user,
+   blogname,
+   description,
+   user.getEmailAddress(),
+   user.getEmailAddress(),
+   theme,
+   user.getLocale(),
+   user.getTimeZone());
+try {
+   roller.getUserManager().addWebsite(website);
+   roller.flush();
+} catch (Exception e) {
+   e.printStackTrace();
+}
+blog = roller.getUserManager().getWebsiteByHandle(handle);
+println "Created blog ${blog.name} with id ${blog.id}";

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/createcomment.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/createcomment.gy?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/createcomment.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/createcomment.gy Thu Mar  8 10:33:23
2007
@@ -0,0 +1,44 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+handle =  "adminblog";
+name =    "Dave";
+email =   "dave@example.com";
+url =     "http://example.com";
+anchor =  "test_post";
+email =   "test@example.com";
+content = "Testing 1 2 3 <em>Hello World!</em>";
+ 
+roller = org.apache.roller.business.RollerFactory.getRoller();
+
+blog = roller.getUserManager().getWebsiteByHandle(handle);
+entry = roller.getWeblogManager().getWeblogEntryByAnchor(blog, anchor);
+
+println entry
+
+comment = new org.apache.roller.pojos.CommentData();
+comment.setWeblogEntry(entry);
+comment.setName(name);
+comment.setUrl(url);
+comment.setPostTime(new java.sql.Timestamp(new java.util.Date().getTime()));
+comment.setContent(content);
+comment.setNotify(Boolean.FALSE);
+comment.setPending(Boolean.FALSE);
+roller.getWeblogManager().saveComment(comment);
+
+roller.flush();
+

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/createentry.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/createentry.gy?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/createentry.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/createentry.gy Thu Mar  8 10:33:23
2007
@@ -0,0 +1,59 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+if (args.length < 2) {
+    println "USAGE: groovy createblog.gy <username> <handle> <title> <content>
<catpath>";
+    return;
+}
+
+username = args[0];
+handle =   args[1];
+title =    args[2];
+text =     args[3];
+catpath =  args[4];
+ 
+roller = org.apache.roller.business.RollerFactory.getRoller();
+user = roller.getUserManager().getUser(username);
+if (user == null) {
+   println "ERROR: user ${username} not found";
+   return;
+}
+blog = roller.getUserManager().getWebsiteByHandle(handle);
+if (blog == null) {
+   println "ERROR: blog ${handle} not found";
+   return;
+}
+category = roller.getWeblogManager().getWeblogCategoryByPath(blog, null, catpath);
+if (category == null) {
+   println "ERROR: category ${catpath} not found";
+   return;
+}
+
+entry = new org.apache.roller.pojos.WeblogEntryData();
+entry.setWebsite(blog);
+entry.setCreator(user);
+entry.setCategory(category);
+entry.setPubTime(new java.sql.Timestamp(new java.util.Date().getTime()));
+entry.setUpdateTime(new java.sql.Timestamp(new java.util.Date().getTime()));
+entry.setTitle(title);
+entry.setText(text);
+entry.setStatus(org.apache.roller.pojos.WeblogEntryData.PUBLISHED);
+
+roller.getWeblogManager().save(entry);
+roller.flush();
+

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/createuser.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/createuser.gy?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/createuser.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/createuser.gy Thu Mar  8 10:33:23
2007
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+if (args.length < 3) {
+    println "USAGE: groovy createuser.gy <username> <password> <email>";

+    return;
+}
+
+username = args[0];
+password = args[1]
+email    = args[2];
+
+fullName = username;
+locale   = "en_US";
+timeZone = "America/New_York";
+
+user = new org.apache.roller.pojos.UserData();
+user.setUserName(username);
+user.setPassword(password);
+user.setFullName(fullName);
+user.setEmailAddress(email);
+user.setLocale(locale);
+user.setTimeZone(timeZone);
+user.setDateCreated(new java.util.Date());
+
+roller = org.apache.roller.business.RollerFactory.getRoller();
+roller.getUserManager().addUser(user);
+roller.flush();
+
+user = roller.getUserManager().getUserByUserName(username);
+println "Created user ${user.userName} with id ${user.id}";

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/groovy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/groovy?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/groovy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/groovy Thu Mar  8 10:33:23 2007
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# -- ENSURE THESE ARE CORRECT ---
+
+# Directory where Groovy release is installed
+export GROOVY_HOME=/Applications/Java/groovy
+
+# Directory of Roller webapp context
+export WEBAPP_DIR=/Users/dave/src/roller-svn/roller/trunk/build/webapp
+
+# Directory of additional jars
+export JARS_DIR=/Applications/Java/jakarta-tomcat-5.5.9/common/lib
+
+
+# --- SHOULD NOT NEED TO EDIT BELOW THIS LINE ---
+
+RGPATH=${WEBAPP_DIR}/WEB-INF/classes:\
+${GROOVY_HOME}/embeddable/groovy-all-1.0.jar:\
+${GROOVY_HOME}/lib/commons-cli-1.0.jar
+
+for i in "$WEBAPP_DIR"/WEB-INF/lib/*.jar; do
+  RGPATH="$RGPATH":"$i"
+done
+
+for i in "$JARS_DIR"/*.jar; do
+  RGPATH="$RGPATH":"$i"
+done
+
+export RGPATH
+
+# Hack: setting catalina.base=. allows us to save log in ./logs
+java \
+ -Droller.custom.config=roller-custom.properties \
+-Dcatalina.base=. \
+-classpath ${RGPATH} groovy.lang.GroovyShell $1 $2 $3 $4 $5 $6 $7 $8 $9 $10

Propchange: incubator/roller/trunk/sandbox/scripting/groovy/bin/groovy
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/listusers.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/listusers.gy?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/listusers.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/listusers.gy Thu Mar  8 10:33:23 2007
@@ -0,0 +1,28 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+roller = org.apache.roller.business.RollerFactory.getRoller();
+users = roller.getUserManager().getUsers(null, null, null, null, 0, -1);
+
+for (u in users) {
+   println "   User [${u.userName}] has password [${u.password}]";
+   weblogs = roller.getUserManager().getWebsites(u, null, null, null, null, 0, Integer.MAX_VALUE);
+   for (w in weblogs) {
+      println "      Belongs to weblog [${w.handle}]";
+   }
+} 

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/removeuser.gy
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/removeuser.gy?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/removeuser.gy (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/removeuser.gy Thu Mar  8 10:33:23
2007
@@ -0,0 +1,27 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  The ASF licenses this file to You
+* 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.  For additional information regarding
+* copyright in this work, please see the NOTICE file in the top level
+* directory of this distribution.
+*/
+
+username = "scratch";
+
+roller = org.apache.roller.business.RollerFactory.getRoller();
+user = roller.getUserManager().getUserByUserName(username);
+roller.getUserManager().removeUser(user);
+roller.flush();
+
+println "Removed user ${user.userName} with id ${user.id}";
+

Added: incubator/roller/trunk/sandbox/scripting/groovy/bin/roller-custom.properties
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/bin/roller-custom.properties?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/bin/roller-custom.properties (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/bin/roller-custom.properties Thu Mar 
8 10:33:23 2007
@@ -0,0 +1,7 @@
+
+jdbc.driverClass=org.apache.derby.jdbc.ClientDriver
+jdbc.connectionURL=jdbc:derby://localhost:1527/roller-jpa
+jdbc.username=APP 
+jdbc.password=APP 
+
+hibernate.dialect=org.hibernate.dialect.DerbyDialect

Added: incubator/roller/trunk/sandbox/scripting/groovy/build.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/sandbox/scripting/groovy/build.xml?view=auto&rev=516134
==============================================================================
--- incubator/roller/trunk/sandbox/scripting/groovy/build.xml (added)
+++ incubator/roller/trunk/sandbox/scripting/groovy/build.xml Thu Mar  8 10:33:23 2007
@@ -0,0 +1,30 @@
+
+<project name="scripting" default="build" basedir=".">
+    <description>Build scripting tools for Roller</description>   
+
+    <property file="./ant.properties" />
+        
+    <path id="scripting.path">
+        <fileset dir="${rollersrc.dir}/build/webapp/WEB-INF/lib">
+            <include name="roller-business.jar"/>   
+        </fileset>
+        <fileset dir="${groovy.home}/lib">
+            <include name="groovy-1.0.jar"/>
+        </fileset>                      
+    </path>
+    
+    <target name="build">        
+        <mkdir dir="./build/classes" />
+        <javac debug="on" destdir="./build/classes">
+            <src path="./src" />
+            <classpath>
+                <path refid="scripting.path"/>
+            </classpath>
+        </javac>
+    </target>
+    
+    <target name="clean">
+        <delete dir="./build" />
+    </target>
+    
+</project>



Mime
View raw message