You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/02/20 00:46:04 UTC
svn commit: r509385 - in
/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands:
addpage.groovy removepage.groovy
Author: jdillon
Date: Mon Feb 19 15:46:03 2007
New Revision: 509385
URL: http://svn.apache.org/viewvc?view=rev&rev=509385
Log:
Added 'removepage' command
Added:
geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy (with props)
Modified:
geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy
Modified: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy?view=diff&rev=509385&r1=509384&r2=509385
==============================================================================
--- geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy (original)
+++ geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/addpage.groovy Mon Feb 19 15:46:03 2007
@@ -75,12 +75,12 @@
client.login()
- if (parent) {
- def parentPage = client.getPage(space, parent)
- page.parentId = parentPage.id
- }
-
try {
+ if (parent) {
+ def parentPage = client.getPage(space, parent)
+ page.parentId = parentPage.id
+ }
+
def resultPage = client.storePage(page)
println 'Added page; details:'
Added: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy?view=auto&rev=509385
==============================================================================
--- geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy (added)
+++ geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy Mon Feb 19 15:46:03 2007
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. 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.
+ */
+
+//
+// $Id$
+//
+
+package hokeypokey.commands
+
+import groovy.net.xmlrpc.XMLRPCServerProxy
+
+/**
+ * Do the Hokey Pokey!
+ */
+class removepage extends HokeyPokeyCommand
+{
+ private String space
+ private String title
+ private String parent
+
+ def run(args) {
+ def cli = new CliBuilder(usage : 'hokeypokey removepage [option]*')
+
+ cli.h(longOpt: 'help', 'Print out this message.')
+ cli.s(longOpt: 'space', args: 1, argName: 'name', 'Space name (required)')
+ cli.t(longOpt: 'title', args: 1, argName: 'name', 'Page title (required)')
+
+ def options = cli.parse(args)
+ if (options == null) {
+ println ('Error in processing command line options.')
+ return
+ }
+ if (options.h) { cli.usage(); return }
+ if (options.s) { space = options.s }
+ if (options.t) { title = options.t }
+
+ def arguments = options.arguments()
+ if (arguments.size() != 0) {
+ cli.usage(); return
+ }
+
+ if (!space && !title) {
+ cli.usage(); return
+ }
+
+ println "Removing page '$title' to space '$space'"
+
+ client.login()
+
+ try {
+ def page = client.getPage(space, title)
+ client.removePage(page.id)
+ }
+ finally {
+ client.logout()
+ }
+ }
+}
+
Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/sandbox/hokeypokey/trunk/src/main/groovy/hokeypokey/commands/removepage.groovy
------------------------------------------------------------------------------
svn:mime-type = text/plain