Index: /trunk/Nebulous-Server/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 5489)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server.pm	(revision 5490)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
+# $Id: Server.pm,v 1.13 2005-11-09 01:31:07 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -17,8 +17,4 @@
 use Log::Log4perl;
 use Params::Validate qw( validate_pos SCALAR );
-
-my %class = (
-    raw => 1,
-);
 
 my $log;
@@ -99,6 +95,25 @@
 
     # check that the comment isn't too long
+    # check that the volume requested is valid
+
     # check that the class requested is valid
-    # check that the volume requested is valid
+    if ( $class ) {
+        my $class_id;
+        eval {
+            my $query = $db->prepare_cached( $sql->get_class ); 
+            $query->execute( $class );
+            ( $class_id ) = $query->fetchrow_array;
+
+            $query->finish;
+        };
+        if ( $@ ) {
+            $db->rollback;
+            $log->logdie( "database error: $@" );
+        }
+
+        unless ( $class_id ) {
+            $log->logdie( "Invalid class ID: $class" );
+        }
+    }
 
     my $uri;
Index: /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
===================================================================
--- /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 5489)
+++ /trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm	(revision 5490)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.13 2005-11-09 00:59:20 jhoblitt Exp $
+# $Id: SQL.pm,v 1.14 2005-11-09 01:31:07 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -123,4 +123,9 @@
         INSERT INTO volume (name, uri)
         VALUES (?, ?)
+    },
+    get_class => qq{
+        SELECT class_id, priority, comment
+        FROM class
+        WHERE class_id = ?
     },
 );
Index: /trunk/Nebulous-Server/t/03_server_create_object.t
===================================================================
--- /trunk/Nebulous-Server/t/03_server_create_object.t	(revision 5489)
+++ /trunk/Nebulous-Server/t/03_server_create_object.t	(revision 5490)
@@ -3,10 +3,10 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 03_server_create_object.t,v 1.5 2005-08-25 01:40:04 jhoblitt Exp $
+# $Id: 03_server_create_object.t,v 1.6 2005-11-09 01:31:07 jhoblitt Exp $
 
 use strict;
 use warnings FATAL => qw( all );
 
-use Test::More tests => 11;
+use Test::More tests => 13;
 
 use lib qw( ./t ./lib );
@@ -74,4 +74,19 @@
 Test::Nebulous->setup;
 
+{
+    my $uri = $neb->create_object( "foo", 1 );
+
+    ok( -e _get_file_path( $uri ), "class exists" );
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object( "foo", 99 );
+};
+like( $@, qr/Invalid class/, "class doesn't exists" );
+
+Test::Nebulous->setup;
+
 eval {
     $neb->create_object();
Index: /trunk/Nebulous/lib/Nebulous/Server.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Server.pm	(revision 5489)
+++ /trunk/Nebulous/lib/Nebulous/Server.pm	(revision 5490)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: Server.pm,v 1.12 2005-11-09 00:48:24 jhoblitt Exp $
+# $Id: Server.pm,v 1.13 2005-11-09 01:31:07 jhoblitt Exp $
 
 package Nebulous::Server;
@@ -17,8 +17,4 @@
 use Log::Log4perl;
 use Params::Validate qw( validate_pos SCALAR );
-
-my %class = (
-    raw => 1,
-);
 
 my $log;
@@ -99,6 +95,25 @@
 
     # check that the comment isn't too long
+    # check that the volume requested is valid
+
     # check that the class requested is valid
-    # check that the volume requested is valid
+    if ( $class ) {
+        my $class_id;
+        eval {
+            my $query = $db->prepare_cached( $sql->get_class ); 
+            $query->execute( $class );
+            ( $class_id ) = $query->fetchrow_array;
+
+            $query->finish;
+        };
+        if ( $@ ) {
+            $db->rollback;
+            $log->logdie( "database error: $@" );
+        }
+
+        unless ( $class_id ) {
+            $log->logdie( "Invalid class ID: $class" );
+        }
+    }
 
     my $uri;
Index: /trunk/Nebulous/lib/Nebulous/Server/SQL.pm
===================================================================
--- /trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 5489)
+++ /trunk/Nebulous/lib/Nebulous/Server/SQL.pm	(revision 5490)
@@ -1,5 +1,5 @@
 # Copyright (c) 2004  Joshua Hoblitt
 #
-# $Id: SQL.pm,v 1.13 2005-11-09 00:59:20 jhoblitt Exp $
+# $Id: SQL.pm,v 1.14 2005-11-09 01:31:07 jhoblitt Exp $
 
 package Nebulous::Server::SQL;
@@ -123,4 +123,9 @@
         INSERT INTO volume (name, uri)
         VALUES (?, ?)
+    },
+    get_class => qq{
+        SELECT class_id, priority, comment
+        FROM class
+        WHERE class_id = ?
     },
 );
Index: /trunk/Nebulous/t/03_server_create_object.t
===================================================================
--- /trunk/Nebulous/t/03_server_create_object.t	(revision 5489)
+++ /trunk/Nebulous/t/03_server_create_object.t	(revision 5490)
@@ -3,10 +3,10 @@
 # Copryight (C) 2004-2005  Joshua Hoblitt
 #
-# $Id: 03_server_create_object.t,v 1.5 2005-08-25 01:40:04 jhoblitt Exp $
+# $Id: 03_server_create_object.t,v 1.6 2005-11-09 01:31:07 jhoblitt Exp $
 
 use strict;
 use warnings FATAL => qw( all );
 
-use Test::More tests => 11;
+use Test::More tests => 13;
 
 use lib qw( ./t ./lib );
@@ -74,4 +74,19 @@
 Test::Nebulous->setup;
 
+{
+    my $uri = $neb->create_object( "foo", 1 );
+
+    ok( -e _get_file_path( $uri ), "class exists" );
+}
+
+Test::Nebulous->setup;
+
+eval {
+    $neb->create_object( "foo", 99 );
+};
+like( $@, qr/Invalid class/, "class doesn't exists" );
+
+Test::Nebulous->setup;
+
 eval {
     $neb->create_object();
Index: /trunk/Nebulous/t/Test/Nebulous.pm
===================================================================
--- /trunk/Nebulous/t/Test/Nebulous.pm	(revision 5489)
+++ /trunk/Nebulous/t/Test/Nebulous.pm	(revision 5490)
@@ -1,5 +1,5 @@
 # Copyright (C) 2004  Joshua Hoblitt
 #
-# $Id: Nebulous.pm,v 1.6 2005-08-27 03:39:06 jhoblitt Exp $
+# $Id: Nebulous.pm,v 1.7 2005-11-09 01:31:07 jhoblitt Exp $
 
 package Test::Nebulous;
@@ -39,4 +39,7 @@
     $dbh->do( qq{ INSERT INTO volume VALUES (1,'node01',?) }, undef, 'file:' . $dir1 );
     $dbh->do( qq{ INSERT INTO volume VALUES (2,'node02',?) }, undef, 'file:' . $dir2 );
+
+    $dbh->do( qq{ INSERT INTO class VALUES (1, 0, "regular data") } );
+    $dbh->do( qq{ INSERT INTO class VALUES (2, 1, "special data") } );
 }
 
