| 1 |
# (C) Copyright 2006 Nuxeo SAS <http://nuxeo.com> |
|---|
| 2 |
# |
|---|
| 3 |
# This library is free software; you can redistribute it and/or |
|---|
| 4 |
# modify it under the terms of the GNU Lesser General Public |
|---|
| 5 |
# License as published by the Free Software Foundation; either |
|---|
| 6 |
# version 2.1 of the License, or (at your option) any later version. |
|---|
| 7 |
# |
|---|
| 8 |
# This library is distributed in the hope that it will be useful, |
|---|
| 9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 11 |
# Lesser General Public License for more details. |
|---|
| 12 |
# |
|---|
| 13 |
# You should have received a copy of the GNU Lesser General Public |
|---|
| 14 |
# License along with this library; if not, write to the Free Software |
|---|
| 15 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 16 |
# |
|---|
| 17 |
# $Id$ |
|---|
| 18 |
|
|---|
| 19 |
import Ice |
|---|
| 20 |
Ice.loadSlice('jcr.ice') |
|---|
| 21 |
import jcr |
|---|
| 22 |
import sys |
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
class Client(Ice.Application): |
|---|
| 26 |
def run(self, args): |
|---|
| 27 |
properties = self.communicator().getProperties() |
|---|
| 28 |
refprop = 'JCR.Repository' |
|---|
| 29 |
proxy = properties.getProperty(refprop) |
|---|
| 30 |
if len(proxy) == 0: |
|---|
| 31 |
print args[0] + ": property `" + refprop + "' not set" |
|---|
| 32 |
return False |
|---|
| 33 |
|
|---|
| 34 |
base = self.communicator().stringToProxy(proxy) |
|---|
| 35 |
ctrl = jcr.RepositoryPrx.checkedCast(base) |
|---|
| 36 |
session = ctrl.login('username', 'password', 'default') |
|---|
| 37 |
node = session.getRootNode() |
|---|
| 38 |
|
|---|
| 39 |
# Print root node path |
|---|
| 40 |
print node.getPath() |
|---|
| 41 |
return True |
|---|
| 42 |
|
|---|
| 43 |
app = Client() |
|---|
| 44 |
status = app.main(sys.argv, 'config') |
|---|
| 45 |
|
|---|
| 46 |
sys.exit(status) |
|---|