You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by bh...@apache.org on 2011/10/28 01:20:49 UTC

svn commit: r1190083 [3/5] - in /shindig/branches/php_namespace_refactoring/php/src/apache: ./ shindig/ shindig/common/ shindig/common/sample/ shindig/gadgets/ shindig/gadgets/oauth/ shindig/gadgets/render/ shindig/gadgets/rewrite/ shindig/gadgets/samp...

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ConsumerKeyAndSecret.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ConsumerKeyAndSecret.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ConsumerKeyAndSecret.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ConsumerKeyAndSecret.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,45 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class ConsumerKeyAndSecret {
+  private $consumerKey;
+  private $consumerSecret;
+  private $keyType;
+
+  public function __construct($key, $secret, $type) {
+    $this->consumerKey = $key;
+    $this->consumerSecret = $secret;
+    $this->keyType = $type;
+  }
+
+  public function getConsumerKey() {
+    return $this->consumerKey;
+  }
+
+  public function getConsumerSecret() {
+    return $this->consumerSecret;
+  }
+
+  public function getKeyType() {
+    return $this->keyType;
+  }
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ConsumerKeyAndSecret.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Endpoint.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Endpoint.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Endpoint.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Endpoint.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,53 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Description of an OAuth request token or access token URL.
+ */
+class EndPoint {
+  /**
+   * @var string
+   */
+  public $url;
+
+  /**
+   * @var string
+   */
+  public $method;
+
+  /**
+   * @var string
+   */
+  public $location;
+
+  /**
+   *
+   * @param string $url
+   * @param string $method
+   * @param string $location
+   */
+  public function __construct($url, $method, $location) {
+    $this->url = $url;
+    $this->method = $method;
+    $this->location = $location;
+  }
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Endpoint.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetInfo.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetInfo.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetInfo.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetInfo.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,67 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class GadgetInfo {
+  /**
+   *
+   * @var string
+   */
+  private $serviceName;
+
+  /**
+   *
+   * @var ProviderInfo
+   */
+  private $providerInfo;
+
+  /**
+   *
+   * @return string
+   */
+  public function getServiceName() {
+    return $this->serviceName;
+  }
+
+  /**
+   *
+   * @param string $serviceName
+   */
+  public function setServiceName($serviceName) {
+    $this->serviceName = $serviceName;
+  }
+
+  /**
+   *
+   * @return ProviderInfo
+   */
+  public function getProviderInfo() {
+    return $this->providerInfo;
+  }
+
+  /**
+   *
+   * @param ProviderInfo $providerInfo
+   */
+  public function setProviderInfo(ProviderInfo $providerInfo) {
+    $this->providerInfo = $providerInfo;
+  }
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetInfo.php
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetOAuthTokenStore.php (from r1186470, shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetOAuthTokenStore.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetOAuthTokenStore.php&p1=shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php&r1=1186470&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/GadgetOAuthTokenStore.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/GadgetOAuthTokenStore.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,8 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+use apache\shindig\gadgets\GadgetException;
+use apache\shindig\gadgets\GadgetSpec;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,9 +22,6 @@
  * under the License.
  */
 
-class OAuthStoreException extends GadgetException {
-}
-
 /**
  * Higher-level interface that allows callers to store and retrieve
  * OAuth-related data directly from {@code GadgetSpec}s, {@code GadgetContext}s,
@@ -86,11 +87,11 @@ class GadgetOAuthTokenStore {
   public function storeTokenKeyAndSecret($tokenKey, $tokenInfo) {
     $getGadgetUri = $tokenKey->getGadgetUri();
     if (empty($getGadgetUri)) {
-      throw new Exception("found empty gadget URI in TokenKey");
+      throw new \Exception("found empty gadget URI in TokenKey");
     }
     $getUserId = $tokenKey->getUserId();
     if (empty($getUserId)) {
-      throw new Exception("found empty userId in TokenKey");
+      throw new \Exception("found empty userId in TokenKey");
     }
     $this->store->setTokenAndSecret($tokenKey, $tokenInfo);
   }
@@ -168,11 +169,11 @@ class GadgetOAuthTokenStore {
           $httpMethod = OAuthStoreVars::$HttpMethod['POST'];
           break;
       }
-    
+
       switch ($service->getRequestUrl()->location) {
         case OAuthStoreVars::$OAuthParamLocation['URI_QUERY']:
         case OAuthStoreVars::$OAuthParamLocation['POST_BODY']:
-        case OAUthStoreVars::$OAuthParamLocation['AUTH_HEADER']:
+        case OAuthStoreVars::$OAuthParamLocation['AUTH_HEADER']:
           $paramLocation = $service->getRequestUrl()->location;
           break;
         default:
@@ -214,50 +215,3 @@ class GadgetOAuthTokenStore {
     return ($param == null) ? null : trim($param);
   }
 }
-
-class GadgetInfo {
-  /**
-   *
-   * @var string
-   */
-  private $serviceName;
-
-  /**
-   *
-   * @var ProviderInfo
-   */
-  private $providerInfo;
-
-  /**
-   *
-   * @return string
-   */
-  public function getServiceName() {
-    return $this->serviceName;
-  }
-
-  /**
-   *
-   * @param string $serviceName
-   */
-  public function setServiceName($serviceName) {
-    $this->serviceName = $serviceName;
-  }
-
-  /**
-   *
-   * @return ProviderInfo
-   */
-  public function getProviderInfo() {
-    return $this->providerInfo;
-  }
-
-  /**
-   *
-   * @param ProviderInfo $providerInfo
-   */
-  public function setProviderInfo(ProviderInfo $providerInfo) {
-    $this->providerInfo = $providerInfo;
-  }
-}
-

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Location.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Location.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Location.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Location.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,31 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Location for OAuth parameters in requests to an OAuth request token,
+ * access token, or resource URL.  (Lowercase to match gadget spec schema)
+ */
+class Location {
+  public static $header = "auth-header";
+  public static $url = "url-query";
+  public static $body = "post-body";
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Location.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Method.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Method.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Method.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Method.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,29 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Method to use for requests to an OAuth request token or access token URL.
+ */
+class Method {
+  public static $GET = "GET";
+  public static $POST = "POST";
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/Method.php
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuth2Fetcher.php (from r1186470, shindig/trunk/php/src/gadgets/oauth/OAuth2Fetcher.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuth2Fetcher.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuth2Fetcher.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuth2Fetcher.php&r1=1186470&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuth2Fetcher.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuth2Fetcher.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,11 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+use apache\shindig\common\ShindigOAuthProtocolException;
+use apache\shindig\gadgets\GadgetException;
+use apache\shindig\common\RemoteContentRequest;
+use apache\shindig\common\Config;
+use apache\shindig\common\ShindigOAuth;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -20,7 +27,7 @@
 
 
 /**
- * Implements the OAuth 2.0 dance for gadgets.
+ * implements \the OAuth 2.0 dance for gadgets.
  *
  *
  * This class is not thread-safe; create a new one for each request that
@@ -95,7 +102,7 @@ class OAuth2Fetcher extends OAuthFetcher
       // Track metadata on the response
       $this->addResponseMetadata($content);
       return $content;
-    } catch (Exception $e) {
+    } catch (\Exception $e) {
       throw new GadgetException("INTERNAL SERVER ERROR: " . $e);
     }
   }
@@ -165,7 +172,7 @@ class OAuth2Fetcher extends OAuthFetcher
       }
       
       $accessor->accessToken = $responseObject['access_token'];
-    } catch (Exception $e) {
+    } catch (\Exception $e) {
       // It's unfortunate the OAuth libraries throw a generic Exception.
       throw new GadgetException("INTERNAL SERVER ERROR: " . $e);
     }

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthAccessor.php (from r1186446, shindig/trunk/php/src/gadgets/oauth/OAuthAccessor.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthAccessor.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthAccessor.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthAccessor.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthAccessor.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthAccessor.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,8 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+use apache\shindig\common\ShindigOAuthRequest;
+use apache\shindig\common\ShindigOAuth;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -29,7 +33,7 @@ class OAuthAccessor {
    *
    * @param OAuthConsumer $consumer 
    */
-  public function __construct(OAuthConsumer $consumer) {
+  public function __construct(\OAuthConsumer $consumer) {
     $this->consumer = $consumer;
     $this->requestToken = null;
     $this->accessToken = null;
@@ -70,15 +74,15 @@ class OAuthAccessor {
         }
       }
     }
-    $token = new OAuthToken($this->accessToken, $this->tokenSecret);
+    $token = new \OAuthToken($this->accessToken, $this->tokenSecret);
     $message = ShindigOAuthRequest::from_consumer_and_token($this->consumer, $token, $method, $url, $parameters);
     $signatureMethod = null;
     if ($parameters[ShindigOAuth::$OAUTH_SIGNATURE_METHOD] == ShindigOAuth::$RSA_SHA1) {
-      $signatureMethod = new OAuthSignatureMethod_RSA_SHA1();
+      $signatureMethod = new \OAuthSignatureMethod_RSA_SHA1();
     } else if ($parameters[ShindigOAuth::$OAUTH_SIGNATURE_METHOD] == ShindigOAuth::$HMAC_SHA1) {
-      $signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
+      $signatureMethod = new \OAuthSignatureMethod_HMAC_SHA1();
     } else { //PLAINTEXT
-      $signatureMethod = new OAuthSignatureMethod_PLAINTEXT();
+      $signatureMethod = new \OAuthSignatureMethod_PLAINTEXT();
     }
     $message->sign_request($signatureMethod, $this->consumer, $token);
     return $message;

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthCallbackState.php (from r1186446, shindig/trunk/php/src/gadgets/oauth/OAuthCallbackState.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthCallbackState.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthCallbackState.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthCallbackState.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthCallbackState.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthCallbackState.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,7 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+use apache\shindig\common\BlobCrypterException;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthError.php (from r1186446, shindig/trunk/php/src/gadgets/oauth/OAuthError.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthError.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthError.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthError.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthError.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthError.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,6 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthFetcher.php (from r1186470, shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthFetcher.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthFetcher.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php&r1=1186470&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthFetcher.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthFetcher.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,16 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+use apache\shindig\common\RemoteContentRequest;
+use apache\shindig\gadgets\GadgetException;
+use apache\shindig\common\ShindigOAuthProtocolException;
+use apache\shindig\common\RemoteContentFetcher;
+use apache\shindig\common\ShindigOAuth;
+use apache\shindig\common\ShindigOAuthUtil;
+use apache\shindig\common\Config;
+use apache\shindig\common\ShindigOAuthRequest;
+use apache\shindig\common\BlobCrypterException;
+use apache\shindig\common\SecurityToken;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -19,10 +31,8 @@
  */
 
 // For TokenInfo
-require_once 'src/gadgets/oauth/OAuthStore.php';
-
 /**
- * Implements the OAuth dance (http://oauth.net/core/1.0/) for gadgets.
+ * implements \the OAuth dance (http://oauth.net/core/1.0/) for gadgets.
  *
  * Reading the example in the appendix to the OAuth spec will be helpful to
  * those reading this code.
@@ -165,7 +175,7 @@ class OAuthFetcher extends RemoteContent
    * @param Exception $e
    * @return RemoteContentRequest
    */
-  protected function buildErrorResponse(Exception $e) {
+  protected function buildErrorResponse(\Exception $e) {
     if ($this->error == null) {
       $this->error = OAuthError::$UNKNOWN_PROBLEM;
     }
@@ -217,7 +227,7 @@ class OAuthFetcher extends RemoteContent
 
   /**
    *
-   * @return TokenKey 
+   * @return TokenKey
    */
   protected function buildTokenKey() {
     $tokenKey = new TokenKey();
@@ -244,7 +254,7 @@ class OAuthFetcher extends RemoteContent
   	$this->realRequest = $request;
     try {
       $this->lookupOAuthMetadata();
-    } catch (Exception $e) {
+    } catch (\Exception $e) {
       $this->error = OAuthError::$BAD_OAUTH_CONFIGURATION;
       return $this->buildErrorResponse($e);
     }
@@ -342,7 +352,7 @@ class OAuthFetcher extends RemoteContent
           ShindigOAuth::$OAUTH_TOKEN_SECRET));
       $accessor->requestToken = $reply->get_parameter(ShindigOAuth::$OAUTH_TOKEN);
       $accessor->tokenSecret = $reply->get_parameter(ShindigOAuth::$OAUTH_TOKEN_SECRET);
-    } catch (Exception $e) {
+    } catch (\Exception $e) {
       // It's unfortunate the OAuth libraries throw a generic Exception.
       throw new GadgetException($e);
     }
@@ -356,7 +366,7 @@ class OAuthFetcher extends RemoteContent
    */
   protected function newRequestMessageMethod($method, $url, $params) {
     if (! isset($params)) {
-      throw new Exception("params was null in " . "newRequestMessage " . "Use newRequesMessage if you don't have a params to pass");
+      throw new \Exception("params was null in " . "newRequestMessage " . "Use newRequesMessage if you don't have a params to pass");
     }
     switch ($this->accessorInfo->getSignatureType()) {
       case ShindigOAuth::$RSA_SHA1:
@@ -545,7 +555,7 @@ class OAuthFetcher extends RemoteContent
   }
 
   /**
-   * Implements section 6.3 of the OAuth spec.
+   * implements \section 6.3 of the OAuth spec.
    *
    * @param RemoteContentRequest $request
    * @throws GadgetException
@@ -575,7 +585,7 @@ class OAuthFetcher extends RemoteContent
           ShindigOAuth::$OAUTH_TOKEN_SECRET));
       $accessor->accessToken = $reply->get_parameter(ShindigOAuth::$OAUTH_TOKEN);
       $accessor->tokenSecret = $reply->get_parameter(ShindigOAuth::$OAUTH_TOKEN_SECRET);
-    } catch (Exception $e) {
+    } catch (\Exception $e) {
       // It's unfortunate the OAuth libraries throw a generic Exception.
       throw new GadgetException("INTERNAL SERVER ERROR: " . $e);
     }
@@ -672,7 +682,7 @@ class OAuthFetcher extends RemoteContent
       // Track metadata on the response
       $this->addResponseMetadata($content);
       return $content;
-    } catch (Exception $e) {
+    } catch (\Exception $e) {
       throw new GadgetException("INTERNAL SERVER ERROR: " . $e);
     }
   }
@@ -773,7 +783,7 @@ class OAuthFetcher extends RemoteContent
 
   /**
    *
-   * @param RemoteContentRequest $response 
+   * @param RemoteContentRequest $response
    */
   protected static function setStrictNoCache(RemoteContentRequest $response) {
     $response->setResponseHeader('Pragma', 'no-cache');

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthFetcherFactory.php (from r1186470, shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthFetcherFactory.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthFetcherFactory.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php&r1=1186470&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthFetcherFactory.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthFetcherFactory.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,12 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+use apache\shindig\common\sample\BasicBlobCrypter;
+use apache\shindig\gadgets\sample\BasicGadgetSpecFactory;
+use apache\shindig\common\Config;
+use apache\shindig\common\RemoteContentRequest;
+use apache\shindig\common\RemoteContentFetcher;
+use apache\shindig\common\SecurityToken;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -47,7 +55,7 @@ class OAuthFetcherFactory {
     } elseif (isset($fetcher)) {
       $this->OAuthFetcherFactoryInit($fetcher);
     } else {
-      throw new Exception('Wrong number of parameters in the OAuthFetcherFactory constuct');
+      throw new \Exception('Wrong number of parameters in the OAuthFetcherFactory constuct');
     }
   }
 
@@ -67,7 +75,7 @@ class OAuthFetcherFactory {
       $basicStore = new $gadgetOAuthTokenStore(new $OAuthStore, $specFactory);
       $basicStore->initFromConfigFile($fetcher);
       $this->tokenStore = $basicStore;
-    } catch (Exeption $e) {}
+    } catch (\Exeption $e) {}
   }
 
   /**
@@ -101,6 +109,6 @@ class OAuthFetcherFactory {
         return new OAuth2Fetcher($this->tokenStore, $this->oauthCrypter, $fetcher, $token, $params);
         break;
     }
-    throw new Exception('invalid oauth authType ' . $authType);
+    throw new \Exception('invalid oauth authType ' . $authType);
   }
 }

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthRequestParams.php (from r1186446, shindig/trunk/php/src/gadgets/oauth/OAuthRequestParams.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthRequestParams.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthRequestParams.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthRequestParams.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthRequestParams.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthRequestParams.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,6 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthService.php (from r1186470, shindig/trunk/php/src/gadgets/oauth/OAuthService.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthService.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthService.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthService.php&r1=1186470&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthService.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthService.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,6 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -55,7 +57,7 @@ class OAuthService {
    * @param DOMElement $service
    * @throws SpecParserException
    */
-  public function __construct(DOMElement $service) {
+  public function __construct(\DOMElement $service) {
     $this->name = (string)$service->getAttribute('name');
     $elements = $service->getElementsByTagName('*');
     foreach ($elements as $element) {
@@ -149,58 +151,3 @@ class OAuthService {
     return $this->accessUrl;
   }
 }
-
-/**
- * Method to use for requests to an OAuth request token or access token URL.
- */
-class Method {
-  public static $GET = "GET";
-  public static $POST = "POST";
-}
-
-/**
- * Location for OAuth parameters in requests to an OAuth request token,
- * access token, or resource URL.  (Lowercase to match gadget spec schema)
- */
-class Location {
-  public static $header = "auth-header";
-  public static $url = "url-query";
-  public static $body = "post-body";
-}
-
-/**
- * Description of an OAuth request token or access token URL.
- */
-class EndPoint {
-  /**
-   * @var string
-   */
-  public $url;
-
-  /**
-   * @var string
-   */
-  public $method;
-
-  /**
-   * @var string
-   */
-  public $location;
-
-  /**
-   *
-   * @param string $url
-   * @param string $method
-   * @param string $location
-   */
-  public function __construct($url, $method, $location) {
-    $this->url = $url;
-    $this->method = $method;
-    $this->location = $location;
-  }
-}
-
-class SpecParserException extends Exception
-{
-
-}
\ No newline at end of file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthServiceProvider.php (from r1186446, shindig/trunk/php/src/gadgets/oauth/OAuthServiceProvider.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthServiceProvider.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthServiceProvider.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthServiceProvider.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthServiceProvider.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthServiceProvider.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,6 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthSpec.php (from r1186446, shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthSpec.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthSpec.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthSpec.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthSpec.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,6 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStore.php (from r1186446, shindig/trunk/php/src/gadgets/oauth/OAuthStore.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStore.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStore.php&p1=shindig/trunk/php/src/gadgets/oauth/OAuthStore.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/oauth/OAuthStore.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStore.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,6 @@
 <?php
+namespace apache\shindig\gadgets\oauth;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -52,229 +54,3 @@ interface OAuthStore {
   public function getOAuthAccessorProviderKey(ProviderKey $providerKey, ProviderInfo $provInfo);
 
 }
-
-class OAuthStoreVars {
-  public static $HttpMethod = array('GET' => 'GET', 'POST' => 'POST');
-  public static $SignatureType = array('HMAC_SHA1' => 'HMAC_SHA1', 'RSA_SHA1' => 'RSA_SHA1',
-      'PLAINTEXT' => 'PLAINTEXT');
-  public static $KeyType = array('HMAC_SYMMETRIC' => 'HMAC_SYMMETRIC', 'RSA_PRIVATE' => 'RSA_PRIVATE');
-  public static $OAuthParamLocation = array('AUTH_HEADER' => 'auth-header', 'POST_BODY' => 'post-body',
-      'URI_QUERY' => 'uri-query');
-}
-
-class AccesorInfo {
-  /**
-   * @var OAuthAccessor
-   */
-  public $accessor;
-  public $httpMethod;
-  public $signatureType;
-  public $paramLocation;
-
-  public function getParamLocation() {
-    return $this->paramLocation;
-  }
-
-  public function setParamLocation($paramLocation) {
-    $this->paramLocation = $paramLocation;
-  }
-
-  /**
-   * @return OAuthAccessor
-   */
-  public function getAccessor() {
-    return $this->accessor;
-  }
-
-  public function setAccessor($accessor) {
-    $this->accessor = $accessor;
-  }
-
-  public function getHttpMethod() {
-    return $this->httpMethod;
-  }
-
-  public function setHttpMethod($httpMethod) {
-    $this->httpMethod = $httpMethod;
-  }
-
-  public function getSignatureType() {
-    return $this->signatureType;
-  }
-
-  public function setSignatureType($signatureType) {
-    $this->signatureType = $signatureType;
-  }
-}
-
-class ConsumerKeyAndSecret {
-  private $consumerKey;
-  private $consumerSecret;
-  private $keyType;
-
-  public function ConsumerKeyAndSecret($key, $secret, $type) {
-    $this->consumerKey = $key;
-    $this->consumerSecret = $secret;
-    $this->keyType = $type;
-  }
-
-  public function getConsumerKey() {
-    return $this->consumerKey;
-  }
-
-  public function getConsumerSecret() {
-    return $this->consumerSecret;
-  }
-
-  public function getKeyType() {
-    return $this->keyType;
-  }
-}
-
-class ProviderKey {
-  private $gadgetUri;
-  private $serviceName;
-
-  public function getGadgetUri() {
-    return $this->gadgetUri;
-  }
-
-  public function setGadgetUri($gadgetUri) {
-    $this->gadgetUri = $gadgetUri;
-  }
-
-  public function getServiceName() {
-    return $this->serviceName;
-  }
-
-  public function setServiceName($serviceName) {
-    $this->serviceName = $serviceName;
-  }
-}
-
-class ProviderInfo {
-  private $provider;
-  private $httpMethod;
-  private $signatureType;
-  private $paramLocation;
-
-  // this can be null if we have not negotiated a consumer key and secret
-  // yet with the provider, or if we decided that we want to use a global
-  // public key
-  private $keyAndSecret;
-
-  public function getParamLocation() {
-    return $this->paramLocation;
-  }
-
-  public function setParamLocation($paramLocation) {
-    $this->paramLocation = $paramLocation;
-  }
-
-  public function getKeyAndSecret() {
-    return $this->keyAndSecret;
-  }
-
-  public function setKeyAndSecret($keyAndSecret) {
-    $this->keyAndSecret = $keyAndSecret;
-  }
-
-  public function getProvider() {
-    return $this->provider;
-  }
-
-  public function setProvider(OAuthServiceProvider $provider) {
-    $this->provider = $provider;
-  }
-
-  public function getHttpMethod() {
-    return $this->httpMethod;
-  }
-
-  public function setHttpMethod($httpMethod) {
-    $this->httpMethod = $httpMethod;
-  }
-
-  public function getSignatureType() {
-    return $this->signatureType;
-  }
-
-  public function setSignatureType($signatureType) {
-    $this->signatureType = $signatureType;
-  }
-}
-
-class TokenKey {
-  private $userId;
-  private $gadgetUri;
-  private $moduleId;
-  private $tokenName;
-  private $serviceName;
-  private $appId;
-
-  public function getAppId() {
-    return $this->appId;
-  }
-
-  public function setAppId($appId) {
-    $this->appId = $appId;
-  }
-
-  public function getUserId() {
-    return $this->userId;
-  }
-
-  public function setUserId($userId) {
-    $this->userId = $userId;
-  }
-
-  public function getGadgetUri() {
-    return $this->gadgetUri;
-  }
-
-  public function setGadgetUri($gadgetUri) {
-    $this->gadgetUri = $gadgetUri;
-  }
-
-  public function getModuleId() {
-    return $this->moduleId;
-  }
-
-  public function setModuleId($moduleId) {
-    $this->moduleId = $moduleId;
-  }
-
-  public function getTokenName() {
-    return $this->tokenName;
-  }
-
-  public function setTokenName($tokenName) {
-    $this->tokenName = $tokenName;
-  }
-
-  public function getServiceName() {
-    return $this->serviceName;
-  }
-
-  public function setServiceName($serviceName) {
-    $this->serviceName = $serviceName;
-  }
-}
-
-class TokenInfo {
-  private $accessToken;
-  private $tokenSecret;
-
-  public function __construct($token, $secret) {
-    $this->accessToken = $token;
-    $this->tokenSecret = $secret;
-  }
-
-  public function getAccessToken() {
-    return $this->accessToken;
-  }
-
-  public function getTokenSecret() {
-    return $this->tokenSecret;
-  }
-}

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreException.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreException.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreException.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreException.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,24 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class OAuthStoreException extends GadgetException {
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreException.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreVars.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreVars.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreVars.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreVars.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,30 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class OAuthStoreVars {
+  public static $HttpMethod = array('GET' => 'GET', 'POST' => 'POST');
+  public static $SignatureType = array('HMAC_SHA1' => 'HMAC_SHA1', 'RSA_SHA1' => 'RSA_SHA1',
+      'PLAINTEXT' => 'PLAINTEXT');
+  public static $KeyType = array('HMAC_SYMMETRIC' => 'HMAC_SYMMETRIC', 'RSA_PRIVATE' => 'RSA_PRIVATE');
+  public static $OAuthParamLocation = array('AUTH_HEADER' => 'auth-header', 'POST_BODY' => 'post-body',
+      'URI_QUERY' => 'uri-query');
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/OAuthStoreVars.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderInfo.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderInfo.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderInfo.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderInfo.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,73 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class ProviderInfo {
+  private $provider;
+  private $httpMethod;
+  private $signatureType;
+  private $paramLocation;
+
+  // this can be null if we have not negotiated a consumer key and secret
+  // yet with the provider, or if we decided that we want to use a global
+  // public key
+  private $keyAndSecret;
+
+  public function getParamLocation() {
+    return $this->paramLocation;
+  }
+
+  public function setParamLocation($paramLocation) {
+    $this->paramLocation = $paramLocation;
+  }
+
+  public function getKeyAndSecret() {
+    return $this->keyAndSecret;
+  }
+
+  public function setKeyAndSecret($keyAndSecret) {
+    $this->keyAndSecret = $keyAndSecret;
+  }
+
+  public function getProvider() {
+    return $this->provider;
+  }
+
+  public function setProvider(OAuthServiceProvider $provider) {
+    $this->provider = $provider;
+  }
+
+  public function getHttpMethod() {
+    return $this->httpMethod;
+  }
+
+  public function setHttpMethod($httpMethod) {
+    $this->httpMethod = $httpMethod;
+  }
+
+  public function getSignatureType() {
+    return $this->signatureType;
+  }
+
+  public function setSignatureType($signatureType) {
+    $this->signatureType = $signatureType;
+  }
+}
\ No newline at end of file

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderInfo.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderKey.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderKey.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderKey.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderKey.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,42 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class ProviderKey {
+  private $gadgetUri;
+  private $serviceName;
+
+  public function getGadgetUri() {
+    return $this->gadgetUri;
+  }
+
+  public function setGadgetUri($gadgetUri) {
+    $this->gadgetUri = $gadgetUri;
+  }
+
+  public function getServiceName() {
+    return $this->serviceName;
+  }
+
+  public function setServiceName($serviceName) {
+    $this->serviceName = $serviceName;
+  }
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/ProviderKey.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/SpecParserException.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/SpecParserException.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/SpecParserException.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/SpecParserException.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,26 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class SpecParserException extends \Exception
+{
+
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/SpecParserException.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenInfo.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenInfo.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenInfo.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenInfo.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,39 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class TokenInfo {
+  private $accessToken;
+  private $tokenSecret;
+
+  public function __construct($token, $secret) {
+    $this->accessToken = $token;
+    $this->tokenSecret = $secret;
+  }
+
+  public function getAccessToken() {
+    return $this->accessToken;
+  }
+
+  public function getTokenSecret() {
+    return $this->tokenSecret;
+  }
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenInfo.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenKey.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenKey.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenKey.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenKey.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,78 @@
+<?php
+namespace apache\shindig\gadgets\oauth;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class TokenKey {
+  private $userId;
+  private $gadgetUri;
+  private $moduleId;
+  private $tokenName;
+  private $serviceName;
+  private $appId;
+
+  public function getAppId() {
+    return $this->appId;
+  }
+
+  public function setAppId($appId) {
+    $this->appId = $appId;
+  }
+
+  public function getUserId() {
+    return $this->userId;
+  }
+
+  public function setUserId($userId) {
+    $this->userId = $userId;
+  }
+
+  public function getGadgetUri() {
+    return $this->gadgetUri;
+  }
+
+  public function setGadgetUri($gadgetUri) {
+    $this->gadgetUri = $gadgetUri;
+  }
+
+  public function getModuleId() {
+    return $this->moduleId;
+  }
+
+  public function setModuleId($moduleId) {
+    $this->moduleId = $moduleId;
+  }
+
+  public function getTokenName() {
+    return $this->tokenName;
+  }
+
+  public function setTokenName($tokenName) {
+    $this->tokenName = $tokenName;
+  }
+
+  public function getServiceName() {
+    return $this->serviceName;
+  }
+
+  public function setServiceName($serviceName) {
+    $this->serviceName = $serviceName;
+  }
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/oauth/TokenKey.php
------------------------------------------------------------------------------
    svn:keywords = Id

Added: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/EmptyClass.php
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/EmptyClass.php?rev=1190083&view=auto
==============================================================================
--- shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/EmptyClass.php (added)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/EmptyClass.php Thu Oct 27 23:20:41 2011
@@ -0,0 +1,24 @@
+<?php
+namespace apache\shindig\gadgets\render;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+class EmptyClass {
+}

Propchange: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/EmptyClass.php
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetBaseRenderer.php (from r1186446, shindig/trunk/php/src/gadgets/render/GadgetBaseRenderer.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetBaseRenderer.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetBaseRenderer.php&p1=shindig/trunk/php/src/gadgets/render/GadgetBaseRenderer.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/render/GadgetBaseRenderer.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetBaseRenderer.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,14 @@
 <?php
+namespace apache\shindig\gadgets\render;
+use apache\shindig\gadgets\templates\TemplateLibrary;
+use apache\shindig\gadgets\templates\ExpressionException;
+use apache\shindig\gadgets\templates\TemplateParser;
+use apache\shindig\gadgets\rewrite\GadgetRewriter;
+use apache\shindig\gadgets\templates\DataPipelining;
+use apache\shindig\common\XmlError;
+use apache\shindig\common\Config;
+use apache\shindig\gadgets\Gadget;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,11 +28,6 @@
  * under the License.
  */
 
-require_once 'src/gadgets/templates/DataPipelining.php';
-
-class EmptyClass {
-}
-
 /**
  * Base class which both the href and html renderer inherit from. This containers all the general
  * functions to deal with rewriting, templates, script insertion, etc
@@ -119,8 +124,6 @@ abstract class GadgetBaseRenderer extend
     $templateLibrary = false;
     if (count($osTemplates[0])) {
       // only load the template parser if there's any templates in the gadget content
-      require_once 'src/gadgets/templates/TemplateParser.php';
-      require_once 'src/gadgets/templates/TemplateLibrary.php';
       $templateLibrary = new TemplateLibrary($this->gadget->gadgetContext);
       if ($this->gadget->gadgetSpec->templatesRequireLibraries) {
         foreach ($this->gadget->gadgetSpec->templatesRequireLibraries as $library) {
@@ -182,7 +185,7 @@ abstract class GadgetBaseRenderer extend
     //TODO check with the java implementation guys if they do a caching strategy here (same as with data-pipelining),
     // would result in a much higher render performance..
     libxml_use_internal_errors(true);
-    $this->doc = new DOMDocument(null, 'utf-8');
+    $this->doc = new \DOMDocument(null, 'utf-8');
     $this->doc->preserveWhiteSpace = true;
     $this->doc->formatOutput = false;
     $this->doc->strictErrorChecking = false;
@@ -217,7 +220,7 @@ abstract class GadgetBaseRenderer extend
    */
   private function renderTemplate($template, TemplateLibrary $templateLibrary) {
     libxml_use_internal_errors(true);
-    $this->doc = new DOMDocument(null, 'utf-8');
+    $this->doc = new \DOMDocument(null, 'utf-8');
     $this->doc->preserveWhiteSpace = true;
     $this->doc->formatOutput = false;
     $this->doc->strictErrorChecking = false;
@@ -253,7 +256,7 @@ abstract class GadgetBaseRenderer extend
         $parser = new TemplateParser();
         $parser->process($childNode, $this->dataContext, $templateLibrary);
         // unwrap the output, ie we only want the script block's content and not the main <script></script> node
-        $output = new DOMDocument(null, 'utf-8');
+        $output = new \DOMDocument(null, 'utf-8');
         foreach ($childNode->childNodes as $node) {
           $outNode = $output->importNode($node, true);
           $outNode = $output->appendChild($outNode);
@@ -301,7 +304,7 @@ abstract class GadgetBaseRenderer extend
    * @param DOMElement $node
    * @param DOMDocument $doc
    */
-  public function addBodyTags(DOMElement &$node, DOMDocument &$doc) {
+  public function addBodyTags(\DOMElement &$node, \DOMDocument &$doc) {
     $script = $this->getBodyScript();
     $scriptNode = $doc->createElement('script');
     $scriptNode->setAttribute('type', 'text/javascript');
@@ -382,7 +385,7 @@ abstract class GadgetBaseRenderer extend
    * @param DOMElement $node
    * @param DOMDocument $doc
    */
-  public function addHeadTags(DOMElement &$node, DOMDocument &$doc) {
+  public function addHeadTags(\DOMElement &$node, \DOMDocument &$doc) {
     // Inject our configured gadget document style
     $styleNode = $doc->createElement('style');
     $styleNode->setAttribute('type', 'text/css');
@@ -407,7 +410,7 @@ abstract class GadgetBaseRenderer extend
    * Retrieve the forced javascript libraries (if any), using either the &libs= from the query
    * or if that's empty, from the config
    *
-   * @return array contains the names of forced external javascript libs. 
+   * @return array contains the names of forced external javascript libs.
    */
   private function getForcedJsLibs() {
     $forcedJsLibs = $this->context->getForcedJsLibs();
@@ -441,7 +444,7 @@ abstract class GadgetBaseRenderer extend
     $containerConfig = $this->context->getContainerConfig();
     $gadgetConfig = array();
     $featureConfig = $containerConfig->getConfig($container, 'gadgets.features');
-    
+
     // TODO some day we should parse the forcedLibs too, and include their config selectivly as well.
     // For now we just include everything.
     $features = array_merge($externFeatures, $inlineFeatures);
@@ -450,7 +453,7 @@ abstract class GadgetBaseRenderer extend
         $gadgetConfig[$feature] = $featureConfig[$feature];
       }
     }
-    
+
     // Add gadgets.util support. This is calculated dynamically based on request inputs.
     // See java/org/apache/shindig/gadgets/render/RenderingContentRewriter.java for reference.
     $requires = array();
@@ -458,7 +461,7 @@ abstract class GadgetBaseRenderer extend
       $requires[$feature] = new EmptyClass();
     }
     $gadgetConfig['core.util'] = $requires;
-    
+
     // following are some quick-fixes for osml and osapi.
     if (isset($gadgetConfig['osml'])) {
       unset($gadgetConfig['osml']);

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetHrefRenderer.php (from r1186446, shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetHrefRenderer.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetHrefRenderer.php&p1=shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/render/GadgetHrefRenderer.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetHrefRenderer.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,12 @@
 <?php
+namespace apache\shindig\gadgets\render;
+use apache\shindig\common\RemoteContentRequest;
+use apache\shindig\gadgets\SigningFetcherFactory;
+use apache\shindig\common\sample\BasicRemoteContent;
+use apache\shindig\common\Config;
+use apache\shindig\gadgets\templates\DataPipelining;
+use apache\shindig\gadgets\Gadget;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -39,8 +47,6 @@
  * <os:HttpRequest href="http://developersite.com/api?ids=${PagedFriends.ids}"/>
  */
 
-require_once 'GadgetBaseRenderer.php';
-
 class GadgetHrefRenderer extends GadgetBaseRenderer {
 
   /**
@@ -130,7 +136,7 @@ class GadgetHrefRenderer extends GadgetB
   private function buildHref($view, $authz, $gadget) {
     $href = RemoteContentRequest::transformRelativeUrl($gadget->substitutions->substituteUri(null, $view['href']), $this->context->getUrl());
     if (empty($href)) {
-      throw new Exception("Invalid empty href in the gadget view");
+      throw new \Exception("Invalid empty href in the gadget view");
     } // add the required country and lang param to the URL
     $lang = isset($_GET['lang']) ? $_GET['lang'] : 'en';
     $country = isset($_GET['country']) ? $_GET['country'] : 'US';

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetHtmlRenderer.php (from r1186470, shindig/trunk/php/src/gadgets/render/GadgetHtmlRenderer.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetHtmlRenderer.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetHtmlRenderer.php&p1=shindig/trunk/php/src/gadgets/render/GadgetHtmlRenderer.php&r1=1186470&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/render/GadgetHtmlRenderer.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetHtmlRenderer.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,9 @@
 <?php
+namespace apache\shindig\gadgets\render;
+use apache\shindig\common\OpenSocialVersion;
+use apache\shindig\common\Config;
+use apache\shindig\gadgets\Gadget;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,8 +23,6 @@
  * under the License.
  */
 
-require 'GadgetBaseRenderer.php';
-
 /**
  * Renders a Gadget's Content type="html" view, inlining the content, feature javascript and javascript initialization
  * into the gadget's content. Most of the logic is performed with in the shared GadgetBaseRender class

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetRenderer.php (from r1186446, shindig/trunk/php/src/gadgets/render/GadgetRenderer.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetRenderer.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetRenderer.php&p1=shindig/trunk/php/src/gadgets/render/GadgetRenderer.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/render/GadgetRenderer.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetRenderer.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,10 @@
 <?php
+namespace apache\shindig\gadgets\render;
+use apache\shindig\common\Cache;
+use apache\shindig\common\Config;
+use apache\shindig\gadgets\GadgetContext;
+use apache\shindig\gadgets\Gadget;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -30,7 +36,7 @@ abstract class GadgetRenderer {
 
   /**
    *
-   * @param GadgetContext $context 
+   * @param GadgetContext $context
    */
   public function __construct(GadgetContext $context) {
     $this->context = $context;

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetUrlRenderer.php (from r1186446, shindig/trunk/php/src/gadgets/render/GadgetUrlRenderer.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetUrlRenderer.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetUrlRenderer.php&p1=shindig/trunk/php/src/gadgets/render/GadgetUrlRenderer.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/render/GadgetUrlRenderer.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/render/GadgetUrlRenderer.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,10 @@
 <?php
+namespace apache\shindig\gadgets\render;
+use apache\shindig\gadgets\SigningFetcherFactory;
+use apache\shindig\common\ShindigRsaSha1SignatureMethod;
+use apache\shindig\common\Config;
+use apache\shindig\gadgets\Gadget;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -89,9 +95,9 @@ class GadgetUrlRenderer extends GadgetRe
       $redirURI .= '&opensocial_app_id=' . urlencode($token->getAppId());
       $redirURI .= '&opensocial_instance_id=' . urlencode($token->getModuleId());
 
-      $consumer = new OAuthConsumer(NULL, NULL, NULL);
+      $consumer = new \OAuthConsumer(NULL, NULL, NULL);
       $signatureMethod = new ShindigRsaSha1SignatureMethod($signingFetcherFactory->getPrivateKey(), null);
-      $req_req = OAuthRequest::from_consumer_and_token($consumer, NULL, 'GET', $redirURI);
+      $req_req = \OAuthRequest::from_consumer_and_token($consumer, NULL, 'GET', $redirURI);
       $req_req->sign_request($signatureMethod, $consumer, NULL);
       $redirURI = $req_req->to_url();
 

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/ContentRewriter.php (from r1186446, shindig/trunk/php/src/gadgets/rewrite/ContentRewriter.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/ContentRewriter.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/ContentRewriter.php&p1=shindig/trunk/php/src/gadgets/rewrite/ContentRewriter.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/rewrite/ContentRewriter.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/ContentRewriter.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,9 @@
 <?php
+namespace apache\shindig\gadgets\rewrite;
+use apache\shindig\common\Config;
+use apache\shindig\common\sample\BasicSecurityToken;
+use apache\shindig\gadgets\GadgetContext;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -19,7 +24,7 @@
  */
 
 /**
- * Implements the Content-Rewrite feature which rewrites all image, css and script
+ * implements \the Content-Rewrite feature which rewrites all image, css and script
  * links to their proxied versions, which can be quite a latency improvement, and
  * save the gadget dev's server from melting down
  *
@@ -27,7 +32,7 @@
 class ContentRewriter extends DomRewriter {
   private $rewrite;
   private $baseUrl;
-  
+
   /**
    *
    * @var array
@@ -37,7 +42,7 @@ class ContentRewriter extends DomRewrite
   /**
    *
    * @param GadgetContext $context
-   * @param Gadget $gadget 
+   * @param Gadget $gadget
    */
   public function __construct(GadgetContext $context, Gadget &$gadget) {
     parent::__construct($context, $gadget);
@@ -114,7 +119,7 @@ class ContentRewriter extends DomRewrite
    *
    * @param DOMElement $node
    */
-  public function rewriteImage(DOMElement &$node) {
+  public function rewriteImage(\DOMElement &$node) {
     if (($src = $node->getAttribute('src')) != null && $this->includedUrl($src)) {
       $node->setAttribute('src', $this->getProxyUrl($src));
     }
@@ -126,7 +131,7 @@ class ContentRewriter extends DomRewrite
    *
    * @param DOMElement $node
    */
-  public function rewriteStyle(DOMElement &$node) {
+  public function rewriteStyle(\DOMElement &$node) {
     $node->nodeValue = $this->rewriteCSS($node->nodeValue);
   }
 
@@ -168,7 +173,7 @@ class ContentRewriter extends DomRewrite
    *
    * @param DOMElement $node
    */
-  public function rewriteScript(DOMElement &$node) {
+  public function rewriteScript(\DOMElement &$node) {
     if (($src = $node->getAttribute('src')) != null && $this->includedUrl($src)) {
       // make sure not to rewrite our forcedJsLibs src tag, else things break
       if (strpos($src, '/gadgets/js') === false) {
@@ -182,7 +187,7 @@ class ContentRewriter extends DomRewrite
    *
    * @param DOMElement $node
    */
-  public function rewriteStyleLink(DOMElement &$node) {
+  public function rewriteStyleLink(\DOMElement &$node) {
     if (($src = $node->getAttribute('href')) != null && $this->includedUrl($src)) {
       $node->setAttribute('href', $this->getProxyUrl($src));
     }

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/DomRewriter.php (from r1186446, shindig/trunk/php/src/gadgets/rewrite/DomRewriter.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/DomRewriter.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/DomRewriter.php&p1=shindig/trunk/php/src/gadgets/rewrite/DomRewriter.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/rewrite/DomRewriter.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/DomRewriter.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,7 @@
 <?php
+namespace apache\shindig\gadgets\rewrite;
+use apache\shindig\gadgets\GadgetContext;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/GadgetRewriter.php (from r1186446, shindig/trunk/php/src/gadgets/rewrite/GadgetRewriter.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/GadgetRewriter.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/GadgetRewriter.php&p1=shindig/trunk/php/src/gadgets/rewrite/GadgetRewriter.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/rewrite/GadgetRewriter.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/GadgetRewriter.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,9 @@
 <?php
+namespace apache\shindig\gadgets\rewrite;
+use apache\shindig\common\Config;
+use apache\shindig\gadgets\GadgetContext;
+use apache\shindig\gadgets\Gadget;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -56,13 +61,11 @@ class GadgetRewriter {
   public function rewrite($content, Gadget &$gadget, $checkDocument = false) {
     // Check to see if the gadget requested rewriting, or if rewriting is forced in the configuration
     if (is_array($gadget->gadgetSpec->rewrite) || Config::get('rewrite_by_default')) {
-      require_once "src/gadgets/rewrite/ContentRewriter.php";
       $contentRewriter = new ContentRewriter($this->context, $gadget);
       $contentRewriter->register($this);
     }
     // Are we configured to sanitize certain views? (if so the config should be an array of view names to sanitize, iaw: array('profile', 'home'))
     if (is_array(Config::get('sanitize_views'))) {
-      require_once "src/gadgets/rewrite/SanitizeRewriter.php";
       $sanitizeRewriter = new SanitizeRewriter($this->context, $gadget);
       $sanitizeRewriter->register($this);
     }
@@ -71,7 +74,7 @@ class GadgetRewriter {
       return $content;
     } else {
       libxml_use_internal_errors(true);
-      $this->doc = new DOMDocument(null, 'utf-8');
+      $this->doc = new \DOMDocument(null, 'utf-8');
       $this->doc->preserveWhiteSpace = true;
       $this->doc->formatOutput = false;
       $this->doc->strictErrorChecking = false;
@@ -145,7 +148,7 @@ class GadgetRewriter {
    *
    * @param DOMNodeList $nodes
    */
-  private function parseNodes(DOMNodeList &$nodes) {
+  private function parseNodes(\DOMNodeList &$nodes) {
     foreach ($nodes as $node) {
       $tagName = strtolower($node->tagName);
       foreach ($this->domObservers as $observer) {

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/SanitizeRewriter.php (from r1186446, shindig/trunk/php/src/gadgets/rewrite/SanitizeRewriter.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/SanitizeRewriter.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/SanitizeRewriter.php&p1=shindig/trunk/php/src/gadgets/rewrite/SanitizeRewriter.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/rewrite/SanitizeRewriter.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/rewrite/SanitizeRewriter.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,7 @@
 <?php
+namespace apache\shindig\gadgets\rewrite;
+use apache\shindig\common\Config;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -45,7 +48,7 @@ class SanitizeRewriter extends DomRewrit
    *
    * @param DOMElement $node
    */
-  public function rewriteScript(DOMElement &$node) {
+  public function rewriteScript(\DOMElement &$node) {
     if (!empty($node->nodeValue)) {
       $node->nodeValue = '';
     }

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/sample/BasicGadgetBlacklist.php (from r1186446, shindig/trunk/php/src/gadgets/sample/BasicGadgetBlacklist.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/sample/BasicGadgetBlacklist.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/sample/BasicGadgetBlacklist.php&p1=shindig/trunk/php/src/gadgets/sample/BasicGadgetBlacklist.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/sample/BasicGadgetBlacklist.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/sample/BasicGadgetBlacklist.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,9 @@
 <?php
+namespace apache\shindig\gadgets\sample;
+use apache\shindig\common\Config;
+use apache\shindig\common\File;
+use apache\shindig\gadgets\GadgetBlacklist;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/sample/BasicGadgetSpecFactory.php (from r1186446, shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/sample/BasicGadgetSpecFactory.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/sample/BasicGadgetSpecFactory.php&p1=shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/sample/BasicGadgetSpecFactory.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/sample/BasicGadgetSpecFactory.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,10 @@
 <?php
+namespace apache\shindig\gadgets\sample;
+use apache\shindig\common\RemoteContentRequest;
+use apache\shindig\common\sample\BasicRemoteContent;
+use apache\shindig\common\Config;
+use apache\shindig\gadgets\GadgetContext;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/CertServlet.php (from r1186446, shindig/trunk/php/src/gadgets/servlet/CertServlet.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/CertServlet.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/CertServlet.php&p1=shindig/trunk/php/src/gadgets/servlet/CertServlet.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/servlet/CertServlet.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/CertServlet.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,8 @@
 <?php
+namespace apache\shindig\gadgets\servlet;
+use apache\shindig\common\HttpServlet;
+use apache\shindig\common\Config;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,8 +22,6 @@
  * under the License.
  */
 
-require 'src/common/HttpServlet.php';
-
 /**
  * This class serves the public certificate, quick and dirty hack to make the certificate publicly accessible
  * this combined with the hard coded location in SigningFetcherFactory.php : http://{host}/{prefix}/public.crt
@@ -34,7 +36,7 @@ class CertServlet extends HttpServlet {
   public function doGet() {
     $file = Config::get('public_key_file');
     if (! file_exists($file) || ! is_readable($file)) {
-      throw new Exception("Invalid public key location ($file), check config and file permissions");
+      throw new \Exception("Invalid public key location ($file), check config and file permissions");
     }
     $this->setLastModified(filemtime($file));
     readfile($file);

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/ContentFilesServlet.php (from r1186446, shindig/trunk/php/src/gadgets/servlet/ContentFilesServlet.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/ContentFilesServlet.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/ContentFilesServlet.php&p1=shindig/trunk/php/src/gadgets/servlet/ContentFilesServlet.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/servlet/ContentFilesServlet.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/ContentFilesServlet.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,7 @@
 <?php
+namespace apache\shindig\gadgets\servlet;
+use apache\shindig\common\Config;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/FilesServlet.php (from r1186446, shindig/trunk/php/src/gadgets/servlet/FilesServlet.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/FilesServlet.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/FilesServlet.php&p1=shindig/trunk/php/src/gadgets/servlet/FilesServlet.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/servlet/FilesServlet.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/FilesServlet.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,8 @@
 <?php
+namespace apache\shindig\gadgets\servlet;
+use apache\shindig\common\HttpServlet;
+use apache\shindig\common\Config;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,8 +22,6 @@
  * under the License.
  */
 
-require 'src/common/HttpServlet.php';
-
 /**
  * This class serves files from the shindig_root/javascript directory, it was created
  * so that the shindig examples and javascript files would work out of the box with

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/GadgetRenderingServlet.php (from r1186446, shindig/trunk/php/src/gadgets/servlet/GadgetRenderingServlet.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/GadgetRenderingServlet.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/GadgetRenderingServlet.php&p1=shindig/trunk/php/src/gadgets/servlet/GadgetRenderingServlet.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/servlet/GadgetRenderingServlet.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/GadgetRenderingServlet.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,10 @@
 <?php
+namespace apache\shindig\gadgets\servlet;
+use apache\shindig\gadgets\GadgetException;
+use apache\shindig\common\HttpServlet;
+use apache\shindig\common\Config;
+use apache\shindig\gadgets\Gadget;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,26 +24,6 @@
  * under the License.
  */
 
-require_once 'src/common/HttpServlet.php';
-require_once 'src/common/SecurityTokenDecoder.php';
-require_once 'src/common/SecurityToken.php';
-require_once 'src/common/BlobCrypter.php';
-require_once 'src/common/RemoteContentRequest.php';
-require_once 'src/common/RemoteContent.php';
-require_once 'src/common/Cache.php';
-require_once 'src/common/RemoteContentFetcher.php';
-require_once 'src/gadgets/GadgetSpecParser.php';
-require_once 'src/gadgets/GadgetBlacklist.php';
-require_once 'src/gadgets/sample/BasicGadgetBlacklist.php';
-require_once 'src/gadgets/GadgetContext.php';
-require_once 'src/gadgets/GadgetFactory.php';
-require_once 'src/gadgets/GadgetSpec.php';
-require_once 'src/gadgets/Gadget.php';
-require_once 'src/gadgets/GadgetException.php';
-require_once 'src/gadgets/render/GadgetRenderer.php';
-require_once 'src/gadgets/rewrite/GadgetRewriter.php';
-require_once 'src/gadgets/rewrite/DomRewriter.php';
-
 class GadgetRenderingServlet extends HttpServlet {
   /**
    *
@@ -59,7 +45,7 @@ class GadgetRenderingServlet extends Htt
       $gadgetSigner = new $gadgetSigner();
       try {
         $token = $this->context->extractAndValidateToken($gadgetSigner);
-      } catch (Exception $e) {
+      } catch (\Exception $e) {
         // no token given, this is a fatal error if 'render_token_required' is set to true
         if (Config::get('render_token_required')) {
           $this->showError($e);
@@ -72,7 +58,7 @@ class GadgetRenderingServlet extends Htt
       $gadget = $gadgetSpecFactory->createGadget();
       $this->setCachingHeaders();
       $this->renderGadget($gadget);
-    } catch (Exception $e) {
+    } catch (\Exception $e) {
       $this->showError($e);
     }
   }

Copied: shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/JsServlet.php (from r1186446, shindig/trunk/php/src/gadgets/servlet/JsServlet.php)
URL: http://svn.apache.org/viewvc/shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/JsServlet.php?p2=shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/JsServlet.php&p1=shindig/trunk/php/src/gadgets/servlet/JsServlet.php&r1=1186446&r2=1190083&rev=1190083&view=diff
==============================================================================
--- shindig/trunk/php/src/gadgets/servlet/JsServlet.php (original)
+++ shindig/branches/php_namespace_refactoring/php/src/apache/shindig/gadgets/servlet/JsServlet.php Thu Oct 27 23:20:41 2011
@@ -1,4 +1,9 @@
 <?php
+namespace apache\shindig\gadgets\servlet;
+use apache\shindig\gadgets\GadgetFeatureRegistry;
+use apache\shindig\common\HttpServlet;
+use apache\shindig\common\Config;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -18,10 +23,6 @@
  * under the License.
  */
 
-require 'src/common/HttpServlet.php';
-require 'src/gadgets/GadgetContext.php';
-require 'src/gadgets/GadgetFeatureRegistry.php';
-
 /**
  * This event handler deals with the /js/core:caja:etc.js request which content type=url gadgets can use
  * to retrieve our features javascript code, or used to make the most frequently used part of the feature