diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php
index 5a07c55..2eaabf2 100644
--- a/core/lib/Drupal/Core/CoreBundle.php
+++ b/core/lib/Drupal/Core/CoreBundle.php
@@ -54,6 +54,8 @@ public function build(ContainerBuilder $container) {
       ->setFactoryMethod('getConnection')
       ->addArgument('slave');
     $container->register('typed_data', 'Drupal\Core\TypedData\TypedDataManager');
+    $container->register('constraint', 'Drupal\Core\Validation\Constraint\ConstraintManager');
+    
     // Add the user's storage for temporary, non-cache data.
     $container->register('lock', 'Drupal\Core\Lock\DatabaseLockBackend');
     $container->register('user.tempstore', 'Drupal\user\TempStoreFactory')
diff --git a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
index bd89a92..015d167 100644
--- a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
+++ b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php
@@ -21,6 +21,39 @@
 class AnnotatedClassDiscovery implements DiscoveryInterface {
 
   /**
+   * @var array $custom_location
+   *
+   *   key: namespace of you class.
+   *   value is an array containing:
+   *     dir: the directory to scan.
+   *     class_base: namespace of you class.
+   */
+  protected $custom_location = array();
+
+  /**
+   * Sets the custom location(s) to scan.
+   *
+   * @param array $custom_locations
+   *
+   *   key: namespace of you class.
+   *   value is an array containing:
+   *     dir: the directory to scan.
+   *     class_base: namespace of you class.
+   */
+  public function setCustomLocation(array $custom_locations) {
+    $this->custom_location = $custom_locations;
+  }
+
+  /**
+   * Gets the custom locations.
+   *
+   * @return array
+   */
+  public function getCustomLocation() {
+    return $this->custom_location;
+  }
+
+  /**
    * Constructs an AnnotatedClassDiscovery object.
    */
   function __construct($owner, $type) {
@@ -49,33 +82,42 @@ public function getDefinitions() {
     AnnotationRegistry::registerAutoloadNamespace('Drupal\Core\Annotation', array(DRUPAL_ROOT . '/core/lib'));
     // Get all PSR-0 namespaces.
     $namespaces = drupal_classloader()->getNamespaces();
-    foreach ($namespaces as $ns => $namespace_dirs) {
-
+    // Rewrite all directories.
+    foreach ($namespaces as $ns => &$namespace_dirs) {
       // OS-Safe directory separators.
       $ns = str_replace('\\', DIRECTORY_SEPARATOR, $ns);
+      // Check for the pre-determined directory structure to find plugins.
+      $prefix = implode(DIRECTORY_SEPARATOR, array(
+        $ns,
+        'Plugin',
+        $this->owner,
+        $this->type
+      ));
+      foreach ($namespace_dirs as &$dir) {
+        $dir = array(
+          'dir' => $dir .= DIRECTORY_SEPARATOR . $prefix,
+          'class_base' => str_replace(
+            DIRECTORY_SEPARATOR,
+            '\\',
+            $prefix
+          ),
+        );
+      }
+    }
+    // Merge in the custom locations.
+    if (!empty($this->custom_location)) {
+      $namespaces += $this->custom_location;
+    }
 
-      foreach ($namespace_dirs as $dir) {
-        // Check for the pre-determined directory structure to find plugins.
-        $prefix = implode(DIRECTORY_SEPARATOR, array(
-          $ns,
-          'Plugin',
-          $this->owner,
-          $this->type
-        ));
-        $dir .= DIRECTORY_SEPARATOR . $prefix;
-
-        // If the directory structure exists, look for classes.
+    foreach ($namespaces as $ns => $namespace_dirs) {
+      foreach ($namespace_dirs as $dir_info) {
+        $dir = $dir_info['dir'];
         if (file_exists($dir)) {
           $directories = new DirectoryIterator($dir);
           foreach ($directories as $fileinfo) {
             // @todo Once core requires 5.3.6, use $fileinfo->getExtension().
             if (pathinfo($fileinfo->getFilename(), PATHINFO_EXTENSION) == 'php') {
-              $class = str_replace(
-                DIRECTORY_SEPARATOR,
-                '\\',
-                $prefix . DIRECTORY_SEPARATOR . $fileinfo->getBasename('.php')
-              );
-
+              $class = $dir_info['class_base'] . '\\' . $fileinfo->getBasename('.php');
               // The filename is already known, so there is no need to find the
               // file. However, StaticReflectionParser needs a finder, so use a
               // mock version.
diff --git a/core/lib/Drupal/Core/Validation/Constraint/ConstraintBundle.php b/core/lib/Drupal/Core/Validation/Constraint/ConstraintBundle.php
new file mode 100644
index 0000000..ddd04a1
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Constraint/ConstraintBundle.php
@@ -0,0 +1,25 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\ConstraintBundle.
+ */
+
+namespace Drupal\Core\Validation\Constraint;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+/**
+ * Constraint dependency injection container.
+ */
+class ConstraintBundle extends Bundle {
+
+  /**
+   * Overrides Symfony\Component\HttpKernel\Bundle\Bundle::build().
+   */
+  public function build(ContainerBuilder $container) {
+    // Register the ConstraintManager class with the dependency injection container.
+    $container->register('plugin.manager.constraint', 'Drupal\Core\Validation\Constraint\ConstraintManager');
+  }
+}
diff --git a/core/lib/Drupal/Core/Validation/Constraint/ConstraintFactory.php b/core/lib/Drupal/Core/Validation/Constraint/ConstraintFactory.php
new file mode 100644
index 0000000..083b152
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Constraint/ConstraintFactory.php
@@ -0,0 +1,35 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Validation\Constraint\ConstraintFactory.
+ */
+
+namespace Drupal\Core\Validation\Constraint;
+
+use Drupal\Component\Plugin\Factory\DefaultFactory;
+use Drupal\Component\Plugin\Exception\PluginException;
+
+/**
+ * A factory for constraint objects.
+ *
+ */
+class ConstraintFactory extends DefaultFactory {
+
+  /**
+   * Implements Drupal\Component\Plugin\Factory\FactoryInterface::createInstance().
+   *
+   * @param string $plugin_id
+   *   The id of a plugin, i.e. the data type.
+   * @param array $configuration
+   *   The plugin configuration, i.e. the data definition.
+   *
+   * @return Drupal\Core\TypedData\TypedDataInterface
+   */
+  public function createInstance($plugin_id, array $configuration) {
+    $definition = $this->discovery->getDefinition($plugin_id);
+    $plugin_class = $definition['class'];
+    dpm($plugin_class);
+    return new $plugin_class();
+  }
+}
diff --git a/core/lib/Drupal/Core/Validation/Constraint/ConstraintInterface.php b/core/lib/Drupal/Core/Validation/Constraint/ConstraintInterface.php
new file mode 100644
index 0000000..5a793bb
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Constraint/ConstraintInterface.php
@@ -0,0 +1,26 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Validation\Constraint\ConstraintInterface.
+ */
+
+namespace Drupal\Core\Validation\Constraint;
+
+/**
+ * Interface for constraints.
+ *
+ */
+interface ConstraintInterface {
+
+  /**
+   * Validate a constraint.
+   * 
+   * @param $value
+   *   Value to validate.
+   *
+   * @return boolean
+   *   TRUE if the value is valid, FALSE otherwise.
+   */
+  public function validate($value);
+}
diff --git a/core/lib/Drupal/Core/Validation/Constraint/ConstraintManager.php b/core/lib/Drupal/Core/Validation/Constraint/ConstraintManager.php
new file mode 100644
index 0000000..80a3493
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Constraint/ConstraintManager.php
@@ -0,0 +1,42 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Validation\Constraint\ConstraintManager.
+ */
+
+namespace Drupal\Core\Validation\Constraint;
+
+use Drupal\Component\Plugin\PluginManagerBase;
+use Drupal\Core\Plugin\Discovery\AnnotatedClassDiscovery;
+
+/**
+ * Constraint plugin manager.
+ */
+class ConstraintManager extends PluginManagerBase {
+  /**
+   * Overrides Drupal\Component\Plugin\PluginManagerBase::__construct().
+   */
+  public function __construct() {
+    $this->discovery = new AnnotatedClassDiscovery('Validation', 'Constraint');
+    $this->discovery->setCustomLocation(array(
+      'Drupal\Core\Validation\Constraint' => array(array(
+        'dir' => drupal_realpath('core/lib/Drupal/Core/Validation/Constraint'),
+        'class_base' => 'Drupal\Core\Validation\Constraint',
+      )),
+    ));
+    $this->factory = new ConstraintFactory($this->discovery);
+  }
+
+  /**
+   * Implements Drupal\Component\Plugin\PluginManagerInterface::createInstance().
+   *
+   * @param string $plugin_id
+   *   The id of a plugin, i.e. the data type.
+   *
+   * @return Drupal\Core\TypedData\TypedDataInterface
+   */
+  public function createInstance($plugin_id, array $configuration = array()) {
+    return $this->factory->createInstance($plugin_id, $configuration);
+  }
+}
diff --git a/core/lib/Drupal/Core/Validation/Constraint/NotNullConstraint.php b/core/lib/Drupal/Core/Validation/Constraint/NotNullConstraint.php
new file mode 100644
index 0000000..ca80b83
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Constraint/NotNullConstraint.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Validation\Constraint\NotNullConstraint.
+ */
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+namespace Drupal\Core\Validation\Constraint;
+
+/**
+ * Check if a value is not NULL.
+ *
+ * @Plugin(
+ *   id = "notnull",
+ *   label = @Translation("NotNull")
+ * )
+ */
+class NotNullConstraint implements ConstraintInterface {
+
+  /**
+   * Validate a constraint.
+   *
+   * @return boolean
+   *   TRUE if the value is not NULL, FALSE if the value is NULL.
+   */
+  public function validate($value) {
+     return !is_null($value); 
+  }
+}
\ No newline at end of file
diff --git a/core/lib/Drupal/Core/Validation/Constraint/RequiredConstraint.php b/core/lib/Drupal/Core/Validation/Constraint/RequiredConstraint.php
new file mode 100644
index 0000000..b10d39a
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Constraint/RequiredConstraint.php
@@ -0,0 +1,32 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Validation\Constraint\RequiredConstraint.
+ */
+
+use Drupal\Core\Annotation\Plugin;
+use Drupal\Core\Annotation\Translation;
+
+namespace Drupal\Core\Validation\Constraint;
+
+/**
+ * Check if a value is given.
+ *
+ * @Plugin(
+ *   id = "required",
+ *   label = @Translation("Required")
+ * )
+ */
+class RequiredConstraint implements ConstraintInterface {
+
+  /**
+   * Validate a constraint.
+   *
+   * @return boolean
+   *   TRUE if there's a value, FALSE if the value is empty.
+   */
+  public function validate($value) {
+     return !empty($value);
+  }
+}
\ No newline at end of file
diff --git a/core/lib/Drupal/Core/Validation/Constraint/test.php b/core/lib/Drupal/Core/Validation/Constraint/test.php
new file mode 100644
index 0000000..9993787
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Constraint/test.php
@@ -0,0 +1,14 @@
+<?php 
+
+try{
+$x = drupal_container()->get('constraint');
+dpm($x);
+$y = $x->createInstance('notnull', array());
+dpm($y);
+dpm($y->validate(1), 'validate 1');
+dpm($y->validate(0), 'validate 0');
+dpm($y->validate(NULL), 'validate NULL');
+
+} catch (\Exception $e) {
+  dpm( $e, 'ooops');
+}
diff --git a/core/lib/Drupal/Core/Validation/Validator/ValidatorInterface.php b/core/lib/Drupal/Core/Validation/Validator/ValidatorInterface.php
new file mode 100644
index 0000000..c3ef05f
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Validator/ValidatorInterface.php
@@ -0,0 +1,23 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Validation\Validator\ValidatorInterface.
+ */
+
+namespace Drupal\Core\Validation\Validator;
+
+/**
+ * Interface for validators.
+ *
+ */
+interface ValidatorInterface {
+  
+  /**
+   * Validate.
+   *
+   * @return array
+   *   Array of violations.
+   */
+  public function validate();
+}
diff --git a/core/lib/Drupal/Core/Validation/Violation/ViolationInterface.php b/core/lib/Drupal/Core/Validation/Violation/ViolationInterface.php
new file mode 100644
index 0000000..cc080e1
--- /dev/null
+++ b/core/lib/Drupal/Core/Validation/Violation/ViolationInterface.php
@@ -0,0 +1,31 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\Core\Validation\Violation\ViolationInterface.
+ */
+
+namespace Drupal\Core\Validation\Violation;
+
+/**
+ * Interface for violations.
+ *
+ */
+interface ViolationInterface {
+  
+  /**
+   * Get the error message.
+   *
+   * @return string
+   *   Error message.
+   */
+  public function getMessage();
+  
+  /**
+   * Get the constraint.
+   *
+   * @return Drupal\Core\Constraint\ConstraintInterface
+   *   The constraint.
+   */
+  public function getConstraint();
+}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Validation/ValidationConstraintTest.php b/core/modules/system/lib/Drupal/system/Tests/Validation/ValidationConstraintTest.php
new file mode 100644
index 0000000..aab29e9
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/Validation/ValidationConstraintTest.php
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\system\Tests\Validation\ValidationConstraintTest.
+*/
+
+namespace Drupal\system\Tests\Validation;
+
+use Drupal\simpletest\UnitTestBase;
+use Drupal\Core\Validation\Constraint;
+
+/**
+ * Tests the Drupal\Core\Validation\Constraint class.
+ */
+class ValidationConstraintTest extends UnitTestBase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'ValidationConstraintTest',
+      'description' => "Test constraint.",
+      'group' => 'Validation',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp();
+  }
+
+  /**
+   * Tests NotNullConstraint.
+   */
+  public function testNotNullConstraint() {
+    $constraint = new Constraint\NotNullConstraint();
+    $this->assertTrue($constraint->validate(1));
+    $this->assertTrue($constraint->validate(0));
+    $this->assertFalse($constraint->validate(NULL));
+  }
+  
+  /**
+   * Tests RequiredConstraint.
+   */
+  public function testRequiredConstraint() {
+    $constraint = new Constraint\RequiredConstraint();
+    $this->assertTrue($constraint->validate('a value'));
+    $this->assertTrue($constraint->validate(array('a')));
+    $this->assertFalse($constraint->validate(NULL));
+    $this->assertFalse($constraint->validate(FALSE));
+    $this->assertFalse($constraint->validate(''));
+  }
+}
