Index: /trunk/Nebulous-Server/Build.PL
===================================================================
--- /trunk/Nebulous-Server/Build.PL	(revision 13268)
+++ /trunk/Nebulous-Server/Build.PL	(revision 13269)
@@ -92,5 +92,5 @@
         'Net::Server::Daemonize'=> '0.05',
         'Sys::Statistics::Linux::DiskUsage' => '0.02',
-
+        'File::ExtAttr'         => '1.03',
     },
     build_requires      => {
Index: /trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 13268)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 13269)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.38 2007-05-04 23:36:46 jhoblitt Exp $
+# $Id: Server.pm,v 1.39 2007-05-05 01:41:29 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -208,11 +208,11 @@
     my $filename = $key;
     # mange '/'s into ':'
-    $key =~ s|/|:|g;
-    my $uri = URI::file->new("$vol_path/$key.$ins_id");
+    $filename =~ s|/|:|g;
+    my $uri = URI::file->new("$vol_path/$filename.$ins_id");
     $log->debug("generated uri $uri");
 
     # TODO add some stuff here to retry if unsucessful
     eval {
-        _create_empty_file($uri->file);
+        _create_empty_file($uri->file, $key);
     };
     if ($@) {
@@ -361,10 +361,13 @@
     }
 
-    my $uri = URI::file->new("$vol_path/$key.$ins_id");
+    my $filename = $key;
+    # mange '/'s into ':'
+    $filename =~ s|/|:|g;
+    my $uri = URI::file->new("$vol_path/$filename.$ins_id");
     $log->debug("generated uri $uri");
 
     # TODO add some stuff here to retry if unsucessful
     eval {
-        _create_empty_file($uri->file);
+        _create_empty_file($uri->file, $key);
     };
     if ($@) {
Index: /trunk/Nebulous-Server/t/03_server_create_object.t
===================================================================
--- /trunk/Nebulous-Server/t/03_server_create_object.t	(revision 13268)
+++ /trunk/Nebulous-Server/t/03_server_create_object.t	(revision 13269)
@@ -3,10 +3,10 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 03_server_create_object.t,v 1.17 2007-05-04 00:43:44 jhoblitt Exp $
+# $Id: 03_server_create_object.t,v 1.18 2007-05-05 01:41:29 jhoblitt Exp $
 
 use strict;
 use warnings FATAL => qw( all );
 
-use Test::More tests => 22;
+use Test::More tests => 28;
 
 use lib qw( ./t ./lib );
@@ -17,4 +17,5 @@
 use Test::URI;
 use URI::Split qw( uri_split );
+use File::ExtAttr qw( getfattr );
 
 my $neb = Nebulous::Server->new(
@@ -33,4 +34,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), 'foo', 'nebulous_key xattr');
 }
 
@@ -44,4 +47,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), '/foo', 'nebulous_key xattr');
 }
 
@@ -55,4 +60,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), '/foo/', 'nebulous_key xattr');
 }
 
@@ -66,4 +73,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), 'foo/', 'nebulous_key xattr');
 }
 
@@ -77,4 +86,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), 'foo/bar', 'nebulous_key xattr');
 }
 
@@ -88,4 +99,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), '/foo/bar', 'nebulous_key xattr');
 }
 
Index: /trunk/Nebulous/Build.PL
===================================================================
--- /trunk/Nebulous/Build.PL	(revision 13268)
+++ /trunk/Nebulous/Build.PL	(revision 13269)
@@ -92,5 +92,5 @@
         'Net::Server::Daemonize'=> '0.05',
         'Sys::Statistics::Linux::DiskUsage' => '0.02',
-
+        'File::ExtAttr'         => '1.03',
     },
     build_requires      => {
Index: /trunk/Nebulous/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Server.pm	(revision 13268)
+++ /trunk/Nebulous/lib/Nebulous/Server.pm	(revision 13269)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.38 2007-05-04 23:36:46 jhoblitt Exp $
+# $Id: Server.pm,v 1.39 2007-05-05 01:41:29 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -208,11 +208,11 @@
     my $filename = $key;
     # mange '/'s into ':'
-    $key =~ s|/|:|g;
-    my $uri = URI::file->new("$vol_path/$key.$ins_id");
+    $filename =~ s|/|:|g;
+    my $uri = URI::file->new("$vol_path/$filename.$ins_id");
     $log->debug("generated uri $uri");
 
     # TODO add some stuff here to retry if unsucessful
     eval {
-        _create_empty_file($uri->file);
+        _create_empty_file($uri->file, $key);
     };
     if ($@) {
@@ -361,10 +361,13 @@
     }
 
-    my $uri = URI::file->new("$vol_path/$key.$ins_id");
+    my $filename = $key;
+    # mange '/'s into ':'
+    $filename =~ s|/|:|g;
+    my $uri = URI::file->new("$vol_path/$filename.$ins_id");
     $log->debug("generated uri $uri");
 
     # TODO add some stuff here to retry if unsucessful
     eval {
-        _create_empty_file($uri->file);
+        _create_empty_file($uri->file, $key);
     };
     if ($@) {
Index: /trunk/Nebulous/lib/Nebulous/Util.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Util.pm	(revision 13268)
+++ /trunk/Nebulous/lib/Nebulous/Util.pm	(revision 13269)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Util.pm,v 1.4 2007-04-23 20:45:08 jhoblitt Exp $
+# $Id: Util.pm,v 1.5 2007-05-05 01:41:29 jhoblitt Exp $
 
 package Nebulous::Util;
@@ -12,7 +12,8 @@
 use base qw( Exporter );
 
+use File::ExtAttr qw( setfattr );
 use Log::Log4perl qw( :levels );
+use URI::file;
 use URI;
-use URI::file;
 
 my @symbols = qw(
@@ -79,24 +80,23 @@
 }
 
-sub _create_empty_file {
-    my $path = shift;
+sub _create_empty_file
+{
+    my ($path, $key) = @_;
 
     # perl's open() can't do an O_CREAT | O_EXCL
-    if ( -e $path ) {
-        die "file $path already exists";
-    }
+    die "file $path already exists" if (-e $path);
 
     my $fh;
-    unless ( open( $fh, '>', $path ) ) {
-        die "can not open $path: $!";
-    } 
+    die "can not open $path: $!"
+        unless (open($fh, '>', $path));
 
-    unless ( close( $fh ) ) {
-        die "can not close $path: $!";
-    }
+    die "can not close $path: $!"
+        unless (close($fh));
 
-    unless ( chmod 0664, $path ) {
-        die "can not chmod $path: $!";
-    }
+    die "can not chmod $path: $!"
+        unless (chmod 0664, $path);
+
+    die "can not set xattr on $path: $!"
+        unless (setfattr($path, 'nebulous_key', $key));
 
     return $path;
Index: /trunk/Nebulous/t/03_server_create_object.t
===================================================================
--- /trunk/Nebulous/t/03_server_create_object.t	(revision 13268)
+++ /trunk/Nebulous/t/03_server_create_object.t	(revision 13269)
@@ -3,10 +3,10 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 03_server_create_object.t,v 1.17 2007-05-04 00:43:44 jhoblitt Exp $
+# $Id: 03_server_create_object.t,v 1.18 2007-05-05 01:41:29 jhoblitt Exp $
 
 use strict;
 use warnings FATAL => qw( all );
 
-use Test::More tests => 22;
+use Test::More tests => 28;
 
 use lib qw( ./t ./lib );
@@ -17,4 +17,5 @@
 use Test::URI;
 use URI::Split qw( uri_split );
+use File::ExtAttr qw( getfattr );
 
 my $neb = Nebulous::Server->new(
@@ -33,4 +34,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), 'foo', 'nebulous_key xattr');
 }
 
@@ -44,4 +47,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), '/foo', 'nebulous_key xattr');
 }
 
@@ -55,4 +60,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), '/foo/', 'nebulous_key xattr');
 }
 
@@ -66,4 +73,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), 'foo/', 'nebulous_key xattr');
 }
 
@@ -77,4 +86,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), 'foo/bar', 'nebulous_key xattr');
 }
 
@@ -88,4 +99,6 @@
     ok(-e $path, "file exists");
     uri_scheme_ok($uri, 'file');
+
+    is(getfattr($path, 'nebulous_key'), '/foo/bar', 'nebulous_key xattr');
 }
 
