Index: /trunk/Nebulous-Server/Changes
===================================================================
--- /trunk/Nebulous-Server/Changes	(revision 5661)
+++ /trunk/Nebulous-Server/Changes	(revision 5662)
@@ -2,4 +2,6 @@
 
 0.02
+    - add Nebulous::Client->open_create()
+    - change Nebulous::Client->create() to return just a filename
     - [nebclient] add nebOpenCreate()
     - [nebclient] change nebCreate() to return just a filename
Index: /trunk/Nebulous-Server/t/11_client_create.t
===================================================================
--- /trunk/Nebulous-Server/t/11_client_create.t	(revision 5661)
+++ /trunk/Nebulous-Server/t/11_client_create.t	(revision 5662)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 11_client_create.t,v 1.4 2005-06-30 02:35:06 jhoblitt Exp $
+# $Id: 11_client_create.t,v 1.5 2005-12-03 02:26:59 jhoblitt Exp $
 
 use strict;
@@ -28,7 +28,7 @@
     );
 
-    my $fh = $neb->create( "foo" );
+    my $filename = $neb->create( "foo" );
 
-    is( ref $fh, 'GLOB', "good filehandle" );
+    ok( -e $filename, "good filename" );
 }
 
@@ -41,7 +41,7 @@
     );
 
-    my $fh = $neb->create( "foo", 0 );
+    my $filename = $neb->create( "foo", 0 );
 
-    is( ref $fh, 'GLOB', "good filehandle" );
+    ok( -e $filename, "good filename" );
 }
 
@@ -54,7 +54,7 @@
     );
 
-    my $fh = $neb->create( "foo", 0, "node01" );
+    my $filename = $neb->create( "foo", 0, "node01" );
 
-    is( ref $fh, 'GLOB', "good filehandle" );
+    ok( -e $filename, "good filename" );
 }
 
@@ -67,7 +67,7 @@
     );
 
-    my $fh = $neb->create( "foo", 0, "node01", "this is foo" );
+    my $filename = $neb->create( "foo", 0, "node01", "this is foo" );
 
-    is( ref $fh, 'GLOB', "good filehandle" );
+    ok( -e $filename, "good filename" );
 }
 
Index: /trunk/Nebulous-Server/t/11_client_open_create.t
===================================================================
--- /trunk/Nebulous-Server/t/11_client_open_create.t	(revision 5662)
+++ /trunk/Nebulous-Server/t/11_client_open_create.t	(revision 5662)
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 11_client_open_create.t,v 1.1 2005-12-03 02:26:59 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Apache::Test qw( -withtestmore );
+
+plan tests => 7;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Client;
+use Nebulous::Util qw( :standard );
+use Test::Nebulous;
+
+my $hostport = Apache::Test->config->{ 'hostport' };
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    my $fh = $neb->open_create( "foo" );
+
+    is( ref $fh, 'GLOB', "good filehandle" );
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, class
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    my $fh = $neb->open_create( "foo", 0 );
+
+    is( ref $fh, 'GLOB', "good filehandle" );
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, class, volume
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    my $fh = $neb->open_create( "foo", 0, "node01" );
+
+    is( ref $fh, 'GLOB', "good filehandle" );
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, class, volume, comment
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    my $fh = $neb->open_create( "foo", 0, "node01", "this is foo" );
+
+    is( ref $fh, 'GLOB', "good filehandle" );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    $neb->open_create( "foo" );
+    is( $neb->open_create( "foo" ), undef, "object already exists" );
+}
+
+Test::Nebulous->setup;
+
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    $neb->open_create();
+};
+like( $@, qr/2 - 4 were expected/, "no params" );
+
+Test::Nebulous->setup;
+
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    $neb->open_create( 1, 2, 3, 4, 5 );
+};
+like( $@, qr/2 - 4 were expected/, "too many params" );
+
+Test::Nebulous->cleanup;
Index: /trunk/Nebulous/Changes
===================================================================
--- /trunk/Nebulous/Changes	(revision 5661)
+++ /trunk/Nebulous/Changes	(revision 5662)
@@ -2,4 +2,6 @@
 
 0.02
+    - add Nebulous::Client->open_create()
+    - change Nebulous::Client->create() to return just a filename
     - [nebclient] add nebOpenCreate()
     - [nebclient] change nebCreate() to return just a filename
Index: /trunk/Nebulous/lib/Nebulous/Client.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Client.pm	(revision 5661)
+++ /trunk/Nebulous/lib/Nebulous/Client.pm	(revision 5662)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Client.pm,v 1.20 2005-08-31 03:33:24 jhoblitt Exp $
+# $Id: Client.pm,v 1.21 2005-12-03 02:26:59 jhoblitt Exp $
 
 package Nebulous::Client;
@@ -127,4 +127,57 @@
     $log->debug( "server allocated $uri" );
 
+    my $filename;
+    eval {
+        $filename = _get_file_path( $uri );
+    };
+    $log->logdie( $@ ) if $@;
+
+    $log->debug( "local filename is $filename" );
+
+    $log->debug( "leaving" );
+
+    return $filename;
+}
+
+sub open_create {
+    my $self = shift;
+
+    my ( $key, @params ) = validate_pos( @_,
+        {
+            type        => SCALAR,
+        },
+        {
+            type        => SCALAR,
+            callbacks   => {
+                'is + integer' => sub { $_[0] =~ /^\d+$/ },
+            },
+            default     => 0,
+        },
+        {
+            type        => SCALAR,
+            optional    => 1,
+        },
+        {
+            type        => SCALAR,
+            optional    => 1,
+        },
+    );
+
+    $log->debug( "entered - @_" );
+
+    # how should already existing files be handled?
+
+    my $response = $self->{ 'server' }->create_object( $key, @params );
+    if ( $response->fault ) {
+        $log->error( $response->faultcode, " - ", $response->faultstring );
+        $log->debug( "leaving" );
+
+        return undef;
+    }
+
+    my $uri = $response->result;
+
+    $log->debug( "server allocated $uri" );
+
     my $fh;
     eval {
@@ -497,5 +550,5 @@
     );
 
-    $log->debug( "entered - @_" );
+#    $log->debug( "entered - @_" );
 
     my $fh      = $self->open( $key, 'read' );
@@ -507,5 +560,5 @@
     }
 
-    my $new_fh  = $self->create( $new_key );
+    my $new_fh  = $self->open_create( $new_key );
     unless ( $new_fh ) {
         $log->debug( "can not open object" );
Index: /trunk/Nebulous/t/11_client_create.t
===================================================================
--- /trunk/Nebulous/t/11_client_create.t	(revision 5661)
+++ /trunk/Nebulous/t/11_client_create.t	(revision 5662)
@@ -3,5 +3,5 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 11_client_create.t,v 1.4 2005-06-30 02:35:06 jhoblitt Exp $
+# $Id: 11_client_create.t,v 1.5 2005-12-03 02:26:59 jhoblitt Exp $
 
 use strict;
@@ -28,7 +28,7 @@
     );
 
-    my $fh = $neb->create( "foo" );
+    my $filename = $neb->create( "foo" );
 
-    is( ref $fh, 'GLOB', "good filehandle" );
+    ok( -e $filename, "good filename" );
 }
 
@@ -41,7 +41,7 @@
     );
 
-    my $fh = $neb->create( "foo", 0 );
+    my $filename = $neb->create( "foo", 0 );
 
-    is( ref $fh, 'GLOB', "good filehandle" );
+    ok( -e $filename, "good filename" );
 }
 
@@ -54,7 +54,7 @@
     );
 
-    my $fh = $neb->create( "foo", 0, "node01" );
+    my $filename = $neb->create( "foo", 0, "node01" );
 
-    is( ref $fh, 'GLOB', "good filehandle" );
+    ok( -e $filename, "good filename" );
 }
 
@@ -67,7 +67,7 @@
     );
 
-    my $fh = $neb->create( "foo", 0, "node01", "this is foo" );
+    my $filename = $neb->create( "foo", 0, "node01", "this is foo" );
 
-    is( ref $fh, 'GLOB', "good filehandle" );
+    ok( -e $filename, "good filename" );
 }
 
Index: /trunk/Nebulous/t/11_client_open_create.t
===================================================================
--- /trunk/Nebulous/t/11_client_open_create.t	(revision 5662)
+++ /trunk/Nebulous/t/11_client_open_create.t	(revision 5662)
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 11_client_open_create.t,v 1.1 2005-12-03 02:26:59 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Apache::Test qw( -withtestmore );
+
+plan tests => 7;
+
+use lib qw( ./t ./lib );
+
+use Nebulous::Client;
+use Nebulous::Util qw( :standard );
+use Test::Nebulous;
+
+my $hostport = Apache::Test->config->{ 'hostport' };
+
+Test::Nebulous->setup;
+
+{
+    # key
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    my $fh = $neb->open_create( "foo" );
+
+    is( ref $fh, 'GLOB', "good filehandle" );
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, class
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    my $fh = $neb->open_create( "foo", 0 );
+
+    is( ref $fh, 'GLOB', "good filehandle" );
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, class, volume
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    my $fh = $neb->open_create( "foo", 0, "node01" );
+
+    is( ref $fh, 'GLOB', "good filehandle" );
+}
+
+Test::Nebulous->setup;
+
+{
+    # key, class, volume, comment
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    my $fh = $neb->open_create( "foo", 0, "node01", "this is foo" );
+
+    is( ref $fh, 'GLOB', "good filehandle" );
+}
+
+Test::Nebulous->setup;
+
+{
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    $neb->open_create( "foo" );
+    is( $neb->open_create( "foo" ), undef, "object already exists" );
+}
+
+Test::Nebulous->setup;
+
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    $neb->open_create();
+};
+like( $@, qr/2 - 4 were expected/, "no params" );
+
+Test::Nebulous->setup;
+
+eval {
+    my $neb = Nebulous::Client->new(
+        proxy => "http://$hostport/nebulous",
+    );
+
+    $neb->open_create( 1, 2, 3, 4, 5 );
+};
+like( $@, qr/2 - 4 were expected/, "too many params" );
+
+Test::Nebulous->cleanup;
