Added reponse handling for xsd static file rendering III

Extra extension tests (for RS-KEY)

Change-Id: I0a9c18363947784b25c7164ded14c96a8e66a37f
This commit is contained in:
Ziad Sawalha 2011-08-14 16:59:17 -05:00
parent 4c574955a7
commit fad4c276de
50 changed files with 332 additions and 7568 deletions

View File

@ -78,8 +78,9 @@ def Main():
parser.error('No object type specified for first argument')
object_type = args[0]
if object_type in ['user', 'tenant', 'role', 'service' , 'endpointTemplates', 'token',
'endpoint', 'credentials']:
if object_type in ['user', 'tenant', 'role', 'service',
'endpointTemplates', 'token',
'endpoint', 'credentials']:
pass
else:
parser.error('%s is not a supported object type' % object_type)
@ -395,10 +396,12 @@ def Main():
object = db_models.Service()
object.id = object_id
db_api.SERVICE.create(object)
print "SUCCESS: Service %s created successfully." % object.id
print "SUCCESS: Service %s created successfully." % \
object.id
return
except Exception as exc:
raise Exception("Failed to create Service %s" % (object_id,), sys.exc_info())
raise Exception("Failed to create Service %s" % \
(object_id,), sys.exc_info())
elif command == "list":
try:
objects = db_api.SERVICE.get_all()
@ -411,7 +414,8 @@ def Main():
for row in objects:
print row.id
except Exception, e:
raise Exception("Error getting all services", sys.exc_info())
raise Exception("Error getting all services",
sys.exc_info())
elif object_type == "credentials":
if command == "add":
if len(args) < 6:
@ -429,8 +433,8 @@ def Main():
print "SUCCESS: Credentials %s created." % result.id
return
except Exception as exc:
raise Exception("Failed to create credentials %s" % (object_id,),
sys.exc_info())
raise Exception("Failed to create credentials %s" % \
(object_id,), sys.exc_info())
# Command not handled
print ("ERROR: %s %s not yet supported" % (object_type, command))

View File

@ -66,6 +66,7 @@ pipeline =
pipeline =
urlrewritefilter
legacy_auth
RS-KEY-extension
service_api
[app:service_api]
@ -79,3 +80,6 @@ paste.filter_factory = keystone.middleware.url:filter_factory
[filter:legacy_auth]
paste.filter_factory = keystone.frontends.legacy_token_auth:filter_factory
[filter:RS-KEY-extension]
paste.filter_factory = keystone.contrib.extensions.rskey.frontend:filter_factory

View File

@ -77,7 +77,6 @@ class EchoApp(object):
if 'HTTP_X_ROLE' in self.envr:
print ' Roles :', self.envr['HTTP_X_ROLE']
accept = self.envr.get("HTTP_ACCEPT", "application/json")
if accept == "application/xml":
return self.toXML()

View File

@ -1,64 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--*******************************************************-->
<!-- Import Common XML Entities -->
<!-- -->
<!-- You can resolve the entites with xmllint -->
<!-- -->
<!-- xmllint -noent identity-RAX.wadl -->
<!--*******************************************************-->
<!DOCTYPE application [<!ENTITY % common SYSTEM "common.ent">
%common;]>
<application xmlns="http://wadl.dev.java.net/2009/02"
xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
xmlns:capi="http://docs.openstack.org/common/api/v2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://docs.openstack.org/identity/api/v2.0 xsd/api.xsd
http://docs.openstack.org/common/api/v1.0 xsd/api-common.xsd
http://wadl.dev.java.net/2009/02 http://www.w3.org/Submission/wadl/wadl.xsd
">
<grammars>
<include href="xsd/api.xsd"/>
<include href="xsd/api-common.xsd"/>
</grammars>
<!--*******************************************************-->
<!-- All Resoruces -->
<!--*******************************************************-->
<!-- We should use SSL in production -->
<resources base="http://localhost:5000">
<resource id="version" type="#VersionDetails" path="v2.0/">
<resource id="tokens" path="tokens">
<method href="#authenticate"/>
</resource>
</resource>
</resources>
<!--*******************************************************-->
<!-- All Methods -->
<!--*******************************************************-->
<!-- Token Operations -->
<method name="POST" id="authenticate">
<request>
<representation mediaType="application/xml" element="identity:RAX-apikeyCredentials"/>
<representation mediaType="application/json"/>
</request>
<response status="200 203">
<representation mediaType="application/xml" element="identity:authenticateResponse"/>
<representation mediaType="application/json"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:userDisabled"/>
<representation mediaType="application/json"/>
</response>
&commonFaults;
&getFaults;
</method>
</application>

View File

@ -1,639 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- (C) 2011 OpenStack LLC., All Rights Reserved -->
<application xmlns="http://wadl.dev.java.net/2009/02"
xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
xmlns:capi="http://docs.openstack.org/common/api/v2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://docs.openstack.org/identity/api/v2.0 xsd/api.xsd
http://docs.openstack.org/common/api/v1.0 xsd/api-common.xsd
http://wadl.dev.java.net/2009/02 http://www.w3.org/Submission/wadl/wadl.xsd
">
<grammars>
<include href="xsd/api.xsd"/>
<include href="xsd/api-common.xsd"/>
</grammars>
<!--*******************************************************-->
<!-- All Resoruces -->
<!--*******************************************************-->
<!-- We should use SSL in production -->
<resources base="http://localhost:5000">
<resource id="version" type="#VersionDetails" path="v2.0/">
<resource id="extensions" type="#ExtensionList" path="extensions">
<resource id="extension" path="{alias}">
<param name="alias" style="template" type="xsd:string"/>
<method href="#getExtension"/>
</resource>
</resource>
<resource id="tokens" path="tokens">
<method href="#revokeToken"/>
</resource>
<resource id="tenants" path="tenants">
<param name="X-Auth-Token" style="header" type="xsd:string" required="true"/>
<method href="#listTenants"/>
<method href="#createTenant"/>
<resource id="tenantId" path="{tenantId}">
<param name="tenantId" style="template" type="xsd:string"/>
<method href="#updateTenant"/>
<method href="#deleteTenant"/>
</resource>
</resource>
<resource id="users" path="users">
<param name="X-Auth-Token" style="header" type="xsd:string" required="true"/>
<method href="#listUsers"/>
<method href="#createUser"/>
<resource id="userId" path="{userId}">
<param name="X-Auth-Token" style="header" type="xsd:string" required="true"/>
<param name="userId" style="template" type="xsd:string"/>
<method href="#updateUser"/>
<method href="#deleteUser"/>
<resource id="enabled" path="enabled">
<method href="#setUserEnabled"/>
</resource>
<resource id="password" path="password">
<method href="#setUserPassword"/>
</resource>
<resource id="tenant" path="tenant">
<method href="#setUserTenant"/>
</resource>
<resource id="userRoles" path="roles">
<method href="#listRoles"/>
<method href="#addRole"/>
<resource id="role" path="{roleId}">
<param name="roleId" style="template" type="xsd:int"/>
<method href="#getRole"/>
<method href="#deleteRole"/>
</resource>
</resource>
</resource>
</resource>
</resource>
<resource id="roles" path="roles">
<param name="X-Auth-Token" style="header" type="xsd:string" required="true"/>
<method href="#listRoles"/>
<method href="#addRole"/>
<resource id="roleId" path="{roleId}">
<param name="X-Auth-Token" style="header" type="xsd:string" required="true"/>
<param name="roleId" style="template" type="xsd:int"/>
<method href="#getRole"/>
<method href="#deleteRole"/>
</resource>
</resource>
</resources>
<!--*******************************************************-->
<!-- Resource Types -->
<!--*******************************************************-->
<!--*******************************************************-->
<!-- All Methods -->
<!--*******************************************************-->
<!-- Token Operations -->
<method name="DELETE" id="revokeToken">
<response status="204"/>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<!-- Tenant Operations -->
<method name="GET" id="listTenants">
<request>
<param name="marker" style="query" required="false" type="xsd:string"/>
<param name="limit" style="query" required="false" type="xsd:int"/>
</request>
<response status="200 203">
<representation mediaType="application/xml" element="identity:tenants"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="POST" id="createTenant">
<request>
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</request>
<response status="201">
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="409">
<representation mediaType="application/xml" element="identity:tenantConflict"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="401 403 400 409 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="HEAD" id="checkTenant">
<response status="200 203">
</response>
<response status="401">
</response>
<response status="403">
</response>
<response status="400">
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="POST" id="updateTenant">
<request>
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="401 403 404 400 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="DELETE" id="deleteTenant">
<response status="204"/>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<!--User Operations-->
<method name="GET" id="listUsers">
<request>
<param name="marker" style="query" required="false" type="xsd:string"/>
<param name="limit" style="query" required="false" type="xsd:int"/>
</request>
<response status="200 203">
<representation mediaType="application/xml" element="identity:users"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="POST" id="createUser">
<request>
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</request>
<response status="201">
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="409">
<representation mediaType="application/xml" element="identity:tenantConflict"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="401 403 400 409 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="HEAD" id="checkUser">
<response status="200 203">
<representation mediaType="application/xml" element="identity:user"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="POST" id="updateUser">
<request>
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="401 403 404 400 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="DELETE" id="deleteUser">
<response status="204"/>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="PUT" id="setUserEnabled">
<request>
<representation mediaType="application/xml" element="identity:user">
<param name="user" style="plain" path="/" type="identity:UserWithOnlyEnabled"/>
</representation>
<representation mediaType="application/json"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="401 403 404 400 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="PUT" id="setUserPassword">
<request>
<representation mediaType="application/xml" element="identity:user">
<param name="user" style="plain" path="/" type="identity:UserWithOnlyPassword"/>
</representation>
<representation mediaType="application/json"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="401 403 404 400 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="PUT" id="setUserTenant">
<request>
<representation mediaType="application/xml" element="identity:user">
<param name="user" style="plain" path="/" type="identity:UserWithOnlyTenant"/>
</representation>
<representation mediaType="application/json"/>
</request>
<response status="200">
<representation mediaType="application/xml" element="identity:tenant"/>
<representation mediaType="application/json"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="401 403 404 400 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<!--Roles-->
<method name="GET" id="listRoles">
<request>
<param name="serviceId" style="query" required="false" type="xsd:string"/>
</request>
<response status="200 203">
<representation mediaType="application/xml" element="identity:roles"/>
<representation mediaType="application/json"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="GET" id="getRole">
<response status="200 203">
<representation mediaType="application/xml" element="identity:role"/>
<representation mediaType="application/json"/>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:authFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="PUT" id="addRole">
<request>
<representation mediaType="application/xml" element="identity:role"/>
<representation mediaType="application/json"/>
</request>
<response status="201">
<representation mediaType="application/xml" element="identity:role">
<param name="Location" type="xsd:anyURI" style="header"/>
</representation>
<representation mediaType="application/json">
<param name="Location" type="xsd:anyURI" style="header"/>
</representation>
</response>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:identityFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
<method name="DELETE" id="deleteRole">
<response status="204"/>
<response status="400">
<representation mediaType="application/xml" element="identity:badRequest"/>
</response>
<response status="401">
<representation mediaType="application/xml" element="identity:unauthorized"/>
</response>
<response status="403">
<representation mediaType="application/xml" element="identity:forbidden"/>
</response>
<response status="404">
<representation mediaType="application/xml" element="identity:itemNotFound"/>
</response>
<response status="500">
<representation mediaType="application/xml" element="identity:authFault"/>
</response>
<response status="503">
<representation mediaType="application/xml" element="identity:serviceUnavailable"/>
</response>
<response status="400 401 403 404 500 503">
<representation mediaType="application/json"/>
</response>
</method>
</application>

File diff suppressed because it is too large Load Diff

View File

@ -1,337 +0,0 @@
if (! this.sh_languages) {
this.sh_languages = {};
}
sh_languages['java'] = [
[
[
/\b(?:import|package)\b/g,
'sh_preproc',
-1
],
[
/\/\/\//g,
'sh_comment',
1
],
[
/\/\//g,
'sh_comment',
7
],
[
/\/\*\*/g,
'sh_comment',
8
],
[
/\/\*/g,
'sh_comment',
9
],
[
/\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,
'sh_number',
-1
],
[
/"/g,
'sh_string',
10
],
[
/'/g,
'sh_string',
11
],
[
/(\b(?:class|interface))([ \t]+)([$A-Za-z0-9_]+)/g,
['sh_keyword', 'sh_normal', 'sh_classname'],
-1
],
[
/\b(?:abstract|assert|break|case|catch|class|const|continue|default|do|else|extends|false|final|finally|for|goto|if|implements|instanceof|interface|native|new|null|private|protected|public|return|static|strictfp|super|switch|synchronized|throw|throws|true|this|transient|try|volatile|while)\b/g,
'sh_keyword',
-1
],
[
/\b(?:int|byte|boolean|char|long|float|double|short|void)\b/g,
'sh_type',
-1
],
[
/~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,
'sh_symbol',
-1
],
[
/\{|\}/g,
'sh_cbracket',
-1
],
[
/(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,
'sh_function',
-1
],
[
/([A-Za-z](?:[^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]|[_])*)((?:<.*>)?)(\s+(?=[*&]*[A-Za-z][^`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\s]*\s*[`~!@#$%&*()_=+{}|;:",<.>\/?'\\[\]\^\-\[\]]+))/g,
['sh_usertype', 'sh_usertype', 'sh_normal'],
-1
]
],
[
[
/$/g,
null,
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/<\?xml/g,
'sh_preproc',
2,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
4,
1
],
[
/<!--/g,
'sh_comment',
5
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
6,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
'sh_keyword',
6,
1
],
[
/@[A-Za-z]+/g,
'sh_type',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/\?>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/\\(?:\\|")/g,
null,
-1
],
[
/"/g,
'sh_string',
-2
]
],
[
[
/>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/-->/g,
'sh_comment',
-2
],
[
/<!--/g,
'sh_comment',
5
]
],
[
[
/(?:\/)?>/g,
'sh_keyword',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/$/g,
null,
-2
]
],
[
[
/\*\//g,
'sh_comment',
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/<\?xml/g,
'sh_preproc',
2,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
4,
1
],
[
/<!--/g,
'sh_comment',
5
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
6,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
'sh_keyword',
6,
1
],
[
/@[A-Za-z]+/g,
'sh_type',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/\*\//g,
'sh_comment',
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/"/g,
'sh_string',
-2
],
[
/\\./g,
'sh_specialchar',
-1
]
],
[
[
/'/g,
'sh_string',
-2
],
[
/\\./g,
'sh_specialchar',
-1
]
]
];

View File

@ -1,347 +0,0 @@
if (! this.sh_languages) {
this.sh_languages = {};
}
sh_languages['javascript'] = [
[
[
/\/\/\//g,
'sh_comment',
1
],
[
/\/\//g,
'sh_comment',
7
],
[
/\/\*\*/g,
'sh_comment',
8
],
[
/\/\*/g,
'sh_comment',
9
],
[
/\b(?:abstract|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|false|final|finally|for|function|goto|if|implements|in|instanceof|interface|native|new|null|private|protected|prototype|public|return|static|super|switch|synchronized|throw|throws|this|transient|true|try|typeof|var|volatile|while|with)\b/g,
'sh_keyword',
-1
],
[
/(\+\+|--|\)|\])(\s*)(\/=?(?![*\/]))/g,
['sh_symbol', 'sh_normal', 'sh_symbol'],
-1
],
[
/(0x[A-Fa-f0-9]+|(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?)(\s*)(\/(?![*\/]))/g,
['sh_number', 'sh_normal', 'sh_symbol'],
-1
],
[
/([A-Za-z$_][A-Za-z0-9$_]*\s*)(\/=?(?![*\/]))/g,
['sh_normal', 'sh_symbol'],
-1
],
[
/\/(?:\\.|[^*\\\/])(?:\\.|[^\\\/])*\/[gim]*/g,
'sh_regexp',
-1
],
[
/\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,
'sh_number',
-1
],
[
/"/g,
'sh_string',
10
],
[
/'/g,
'sh_string',
11
],
[
/~|!|%|\^|\*|\(|\)|-|\+|=|\[|\]|\\|:|;|,|\.|\/|\?|&|<|>|\|/g,
'sh_symbol',
-1
],
[
/\{|\}/g,
'sh_cbracket',
-1
],
[
/\b(?:Math|Infinity|NaN|undefined|arguments)\b/g,
'sh_predef_var',
-1
],
[
/\b(?:Array|Boolean|Date|Error|EvalError|Function|Number|Object|RangeError|ReferenceError|RegExp|String|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt)\b/g,
'sh_predef_func',
-1
],
[
/(?:[A-Za-z]|_)[A-Za-z0-9_]*(?=[ \t]*\()/g,
'sh_function',
-1
]
],
[
[
/$/g,
null,
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/<\?xml/g,
'sh_preproc',
2,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
4,
1
],
[
/<!--/g,
'sh_comment',
5
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
6,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
'sh_keyword',
6,
1
],
[
/@[A-Za-z]+/g,
'sh_type',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/\?>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/\\(?:\\|")/g,
null,
-1
],
[
/"/g,
'sh_string',
-2
]
],
[
[
/>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/-->/g,
'sh_comment',
-2
],
[
/<!--/g,
'sh_comment',
5
]
],
[
[
/(?:\/)?>/g,
'sh_keyword',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
3
]
],
[
[
/$/g,
null,
-2
]
],
[
[
/\*\//g,
'sh_comment',
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/<\?xml/g,
'sh_preproc',
2,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
4,
1
],
[
/<!--/g,
'sh_comment',
5
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
6,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z][A-Za-z0-9]*/g,
'sh_keyword',
6,
1
],
[
/@[A-Za-z]+/g,
'sh_type',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/\*\//g,
'sh_comment',
-2
],
[
/(?:<?)[A-Za-z0-9_\.\/\-_~]+@[A-Za-z0-9_\.\/\-_~]+(?:>?)|(?:<?)[A-Za-z0-9_]+:\/\/[A-Za-z0-9_\.\/\-_~]+(?:>?)/g,
'sh_url',
-1
],
[
/(?:TODO|FIXME|BUG)(?:[:]?)/g,
'sh_todo',
-1
]
],
[
[
/"/g,
'sh_string',
-2
],
[
/\\./g,
'sh_specialchar',
-1
]
],
[
[
/'/g,
'sh_string',
-2
],
[
/\\./g,
'sh_specialchar',
-1
]
]
];

View File

@ -1,538 +0,0 @@
/*
SHJS - Syntax Highlighting in JavaScript
Copyright (C) 2007, 2008 gnombat@users.sourceforge.net
License: http://shjs.sourceforge.net/doc/gplv3.html
*/
if (! this.sh_languages) {
this.sh_languages = {};
}
var sh_requests = {};
function sh_isEmailAddress(url) {
if (/^mailto:/.test(url)) {
return false;
}
return url.indexOf('@') !== -1;
}
function sh_setHref(tags, numTags, inputString) {
var url = inputString.substring(tags[numTags - 2].pos, tags[numTags - 1].pos);
if (url.length >= 2 && url.charAt(0) === '<' && url.charAt(url.length - 1) === '>') {
url = url.substr(1, url.length - 2);
}
if (sh_isEmailAddress(url)) {
url = 'mailto:' + url;
}
tags[numTags - 2].node.href = url;
}
/*
Konqueror has a bug where the regular expression /$/g will not match at the end
of a line more than once:
var regex = /$/g;
var match;
var line = '1234567890';
regex.lastIndex = 10;
match = regex.exec(line);
var line2 = 'abcde';
regex.lastIndex = 5;
match = regex.exec(line2); // fails
*/
function sh_konquerorExec(s) {
var result = [''];
result.index = s.length;
result.input = s;
return result;
}
/**
Highlights all elements containing source code in a text string. The return
value is an array of objects, each representing an HTML start or end tag. Each
object has a property named pos, which is an integer representing the text
offset of the tag. Every start tag also has a property named node, which is the
DOM element started by the tag. End tags do not have this property.
@param inputString a text string
@param language a language definition object
@return an array of tag objects
*/
function sh_highlightString(inputString, language) {
if (/Konqueror/.test(navigator.userAgent)) {
if (! language.konquered) {
for (var s = 0; s < language.length; s++) {
for (var p = 0; p < language[s].length; p++) {
var r = language[s][p][0];
if (r.source === '$') {
r.exec = sh_konquerorExec;
}
}
}
language.konquered = true;
}
}
var a = document.createElement('a');
var span = document.createElement('span');
// the result
var tags = [];
var numTags = 0;
// each element is a pattern object from language
var patternStack = [];
// the current position within inputString
var pos = 0;
// the name of the current style, or null if there is no current style
var currentStyle = null;
var output = function(s, style) {
var length = s.length;
// this is more than just an optimization - we don't want to output empty <span></span> elements
if (length === 0) {
return;
}
if (! style) {
var stackLength = patternStack.length;
if (stackLength !== 0) {
var pattern = patternStack[stackLength - 1];
// check whether this is a state or an environment
if (! pattern[3]) {
// it's not a state - it's an environment; use the style for this environment
style = pattern[1];
}
}
}
if (currentStyle !== style) {
if (currentStyle) {
tags[numTags++] = {pos: pos};
if (currentStyle === 'sh_url') {
sh_setHref(tags, numTags, inputString);
}
}
if (style) {
var clone;
if (style === 'sh_url') {
clone = a.cloneNode(false);
}
else {
clone = span.cloneNode(false);
}
clone.className = style;
tags[numTags++] = {node: clone, pos: pos};
}
}
pos += length;
currentStyle = style;
};
var endOfLinePattern = /\r\n|\r|\n/g;
endOfLinePattern.lastIndex = 0;
var inputStringLength = inputString.length;
while (pos < inputStringLength) {
var start = pos;
var end;
var startOfNextLine;
var endOfLineMatch = endOfLinePattern.exec(inputString);
if (endOfLineMatch === null) {
end = inputStringLength;
startOfNextLine = inputStringLength;
}
else {
end = endOfLineMatch.index;
startOfNextLine = endOfLinePattern.lastIndex;
}
var line = inputString.substring(start, end);
var matchCache = [];
for (;;) {
var posWithinLine = pos - start;
var stateIndex;
var stackLength = patternStack.length;
if (stackLength === 0) {
stateIndex = 0;
}
else {
// get the next state
stateIndex = patternStack[stackLength - 1][2];
}
var state = language[stateIndex];
var numPatterns = state.length;
var mc = matchCache[stateIndex];
if (! mc) {
mc = matchCache[stateIndex] = [];
}
var bestMatch = null;
var bestPatternIndex = -1;
for (var i = 0; i < numPatterns; i++) {
var match;
if (i < mc.length && (mc[i] === null || posWithinLine <= mc[i].index)) {
match = mc[i];
}
else {
var regex = state[i][0];
regex.lastIndex = posWithinLine;
match = regex.exec(line);
mc[i] = match;
}
if (match !== null && (bestMatch === null || match.index < bestMatch.index)) {
bestMatch = match;
bestPatternIndex = i;
if (match.index === posWithinLine) {
break;
}
}
}
if (bestMatch === null) {
output(line.substring(posWithinLine), null);
break;
}
else {
// got a match
if (bestMatch.index > posWithinLine) {
output(line.substring(posWithinLine, bestMatch.index), null);
}
var pattern = state[bestPatternIndex];
var newStyle = pattern[1];
var matchedString;
if (newStyle instanceof Array) {
for (var subexpression = 0; subexpression < newStyle.length; subexpression++) {
matchedString = bestMatch[subexpression + 1];
output(matchedString, newStyle[subexpression]);
}
}
else {
matchedString = bestMatch[0];
output(matchedString, newStyle);
}
switch (pattern[2]) {
case -1:
// do nothing
break;
case -2:
// exit
patternStack.pop();
break;
case -3:
// exitall
patternStack.length = 0;
break;
default:
// this was the start of a delimited pattern or a state/environment
patternStack.push(pattern);
break;
}
}
}
// end of the line
if (currentStyle) {
tags[numTags++] = {pos: pos};
if (currentStyle === 'sh_url') {
sh_setHref(tags, numTags, inputString);
}
currentStyle = null;
}
pos = startOfNextLine;
}
return tags;
}
////////////////////////////////////////////////////////////////////////////////
// DOM-dependent functions
function sh_getClasses(element) {
var result = [];
var htmlClass = element.className;
if (htmlClass && htmlClass.length > 0) {
var htmlClasses = htmlClass.split(' ');
for (var i = 0; i < htmlClasses.length; i++) {
if (htmlClasses[i].length > 0) {
result.push(htmlClasses[i]);
}
}
}
return result;
}
function sh_addClass(element, name) {
var htmlClasses = sh_getClasses(element);
for (var i = 0; i < htmlClasses.length; i++) {
if (name.toLowerCase() === htmlClasses[i].toLowerCase()) {
return;
}
}
htmlClasses.push(name);
element.className = htmlClasses.join(' ');
}
/**
Extracts the tags from an HTML DOM NodeList.
@param nodeList a DOM NodeList
@param result an object with text, tags and pos properties
*/
function sh_extractTagsFromNodeList(nodeList, result) {
var length = nodeList.length;
for (var i = 0; i < length; i++) {
var node = nodeList.item(i);
switch (node.nodeType) {
case 1:
if (node.nodeName.toLowerCase() === 'br') {
var terminator;
if (/MSIE/.test(navigator.userAgent)) {
terminator = '\r';
}
else {
terminator = '\n';
}
result.text.push(terminator);
result.pos++;
}
else {
result.tags.push({node: node.cloneNode(false), pos: result.pos});
sh_extractTagsFromNodeList(node.childNodes, result);
result.tags.push({pos: result.pos});
}
break;
case 3:
case 4:
result.text.push(node.data);
result.pos += node.length;
break;
}
}
}
/**
Extracts the tags from the text of an HTML element. The extracted tags will be
returned as an array of tag objects. See sh_highlightString for the format of
the tag objects.
@param element a DOM element
@param tags an empty array; the extracted tag objects will be returned in it
@return the text of the element
@see sh_highlightString
*/
function sh_extractTags(element, tags) {
var result = {};
result.text = [];
result.tags = tags;
result.pos = 0;
sh_extractTagsFromNodeList(element.childNodes, result);
return result.text.join('');
}
/**
Merges the original tags from an element with the tags produced by highlighting.
@param originalTags an array containing the original tags
@param highlightTags an array containing the highlighting tags - these must not overlap
@result an array containing the merged tags
*/
function sh_mergeTags(originalTags, highlightTags) {
var numOriginalTags = originalTags.length;
if (numOriginalTags === 0) {
return highlightTags;
}
var numHighlightTags = highlightTags.length;
if (numHighlightTags === 0) {
return originalTags;
}
var result = [];
var originalIndex = 0;
var highlightIndex = 0;
while (originalIndex < numOriginalTags && highlightIndex < numHighlightTags) {
var originalTag = originalTags[originalIndex];
var highlightTag = highlightTags[highlightIndex];
if (originalTag.pos <= highlightTag.pos) {
result.push(originalTag);
originalIndex++;
}
else {
result.push(highlightTag);
if (highlightTags[highlightIndex + 1].pos <= originalTag.pos) {
highlightIndex++;
result.push(highlightTags[highlightIndex]);
highlightIndex++;
}
else {
// new end tag
result.push({pos: originalTag.pos});
// new start tag
highlightTags[highlightIndex] = {node: highlightTag.node.cloneNode(false), pos: originalTag.pos};
}
}
}
while (originalIndex < numOriginalTags) {
result.push(originalTags[originalIndex]);
originalIndex++;
}
while (highlightIndex < numHighlightTags) {
result.push(highlightTags[highlightIndex]);
highlightIndex++;
}
return result;
}
/**
Inserts tags into text.
@param tags an array of tag objects
@param text a string representing the text
@return a DOM DocumentFragment representing the resulting HTML
*/
function sh_insertTags(tags, text) {
var doc = document;
var result = document.createDocumentFragment();
var tagIndex = 0;
var numTags = tags.length;
var textPos = 0;
var textLength = text.length;
var currentNode = result;
// output one tag or text node every iteration
while (textPos < textLength || tagIndex < numTags) {
var tag;
var tagPos;
if (tagIndex < numTags) {
tag = tags[tagIndex];
tagPos = tag.pos;
}
else {
tagPos = textLength;
}
if (tagPos <= textPos) {
// output the tag
if (tag.node) {
// start tag
var newNode = tag.node;
currentNode.appendChild(newNode);
currentNode = newNode;
}
else {
// end tag
currentNode = currentNode.parentNode;
}
tagIndex++;
}
else {
// output text
currentNode.appendChild(doc.createTextNode(text.substring(textPos, tagPos)));
textPos = tagPos;
}
}
return result;
}
/**
Highlights an element containing source code. Upon completion of this function,
the element will have been placed in the "sh_sourceCode" class.
@param element a DOM <pre> element containing the source code to be highlighted
@param language a language definition object
*/
function sh_highlightElement(element, language) {
sh_addClass(element, 'sh_sourceCode');
var originalTags = [];
var inputString = sh_extractTags(element, originalTags);
var highlightTags = sh_highlightString(inputString, language);
var tags = sh_mergeTags(originalTags, highlightTags);
var documentFragment = sh_insertTags(tags, inputString);
while (element.hasChildNodes()) {
element.removeChild(element.firstChild);
}
element.appendChild(documentFragment);
}
function sh_getXMLHttpRequest() {
if (window.ActiveXObject) {
return new ActiveXObject('Msxml2.XMLHTTP');
}
else if (window.XMLHttpRequest) {
return new XMLHttpRequest();
}
throw 'No XMLHttpRequest implementation available';
}
function sh_load(language, element, prefix, suffix) {
if (language in sh_requests) {
sh_requests[language].push(element);
return;
}
sh_requests[language] = [element];
var request = sh_getXMLHttpRequest();
var url = prefix + 'sh_' + language + suffix;
request.open('GET', url, true);
request.onreadystatechange = function () {
if (request.readyState === 4) {
try {
if (! request.status || request.status === 200) {
eval(request.responseText);
var elements = sh_requests[language];
for (var i = 0; i < elements.length; i++) {
sh_highlightElement(elements[i], sh_languages[language]);
}
}
else {
throw 'HTTP error: status ' + request.status;
}
}
finally {
request = null;
}
}
};
request.send(null);
}
/**
Highlights all elements containing source code on the current page. Elements
containing source code must be "pre" elements with a "class" attribute of
"sh_LANGUAGE", where LANGUAGE is a valid language identifier; e.g., "sh_java"
identifies the element as containing "java" language source code.
*/
function sh_highlightDocument(prefix, suffix) {
var nodeList = document.getElementsByTagName('pre');
for (var i = 0; i < nodeList.length; i++) {
var element = nodeList.item(i);
var htmlClasses = sh_getClasses(element);
for (var j = 0; j < htmlClasses.length; j++) {
var htmlClass = htmlClasses[j].toLowerCase();
if (htmlClass === 'sh_sourcecode') {
continue;
}
if (htmlClass.substr(0, 3) === 'sh_') {
var language = htmlClass.substring(3);
if (language in sh_languages) {
sh_highlightElement(element, sh_languages[language]);
}
else if (typeof(prefix) === 'string' && typeof(suffix) === 'string') {
sh_load(language, element, prefix, suffix);
}
else {
throw 'Found <pre> element with class="' + htmlClass + '", but no such language exists';
}
break;
}
}
}
}

View File

@ -1,115 +0,0 @@
if (! this.sh_languages) {
this.sh_languages = {};
}
sh_languages['xml'] = [
[
[
/<\?xml/g,
'sh_preproc',
1,
1
],
[
/<!DOCTYPE/g,
'sh_preproc',
3,
1
],
[
/<!--/g,
'sh_comment',
4
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)(?:\/)?>/g,
'sh_keyword',
-1
],
[
/<(?:\/)?[A-Za-z](?:[A-Za-z0-9_:.-]*)/g,
'sh_keyword',
5,
1
],
[
/&(?:[A-Za-z0-9]+);/g,
'sh_preproc',
-1
]
],
[
[
/\?>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
2
]
],
[
[
/\\(?:\\|")/g,
null,
-1
],
[
/"/g,
'sh_string',
-2
]
],
[
[
/>/g,
'sh_preproc',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
2
]
],
[
[
/-->/g,
'sh_comment',
-2
],
[
/<!--/g,
'sh_comment',
4
]
],
[
[
/(?:\/)?>/g,
'sh_keyword',
-2
],
[
/([^=" \t>]+)([ \t]*)(=?)/g,
['sh_type', 'sh_normal', 'sh_symbol'],
-1
],
[
/"/g,
'sh_string',
2
]
]
];

View File

@ -1,184 +0,0 @@
/**
controller.js
(C) 2009 Rackspace Hosting, All Rights Reserved
This file definas a single object in global scope:
trc.schema.controller
The controller object is responsible for displaying a menu that
allows users to view schema source and jump to various definitions
in the schema.
**/
//
// Initialization code...
//
(function()
{
//
// Make sure dependecies are defined in the global scope, throw
// an error if they are not.
//
if ((!window.trc) ||
(!trc.util))
{
throw new Error("Require trc/util.js to be loaded.");
}
//
// We use YUI to build our controller menu make sure we have the
// proper dependecies loaded, call init when we do...
//
function InitController()
{
trc.schema.controller._init();
}
trc.util.yui.loadYUIDeps (["menu"], InitController);
})();
if (!trc.schema)
{
trc.schema = new Object();
}
trc.schema.controller = {
//
// Internal and external links by type:
//
// type --> array of links
//
// possible types include: import, include, element,
// attribute, complextype, simpleType
//
// each link contains the following properties:
// name : the name of the link
// href : the link itself
// title : a description of the link
links : new Object(),
//
// A single link that points to the schema index document.
//
index : null,
//
// Our initialization function
//
_init : function() {
//
// Load the menu...
//
var controllerDiv = document.getElementById("Controller");
var mainMenu = this._menuMarkup("mainmenu");
for (var linkType in this.links)
{
var subItem = this._menuItemMarkup(mainMenu, linkType, "#", null);
var subMenu = this._menuMarkup (linkType+"_subMenu");
var items = this.links[linkType];
for (var i=0;i<items.length;i++)
{
this._menuItemMarkup (subMenu,
items[i].name,
items[i].href,
items[i].title);
}
subItem.item.appendChild (subMenu.main);
}
//
// Toggle view source menu
//
this._menuItemMarkup (mainMenu, "toggle src view",
"javascript:trc.schema.sampleManager.toggleSrcView()", null);
//
// Index schema document
//
if (this.index != null)
{
this._menuItemMarkup (mainMenu, this.index.name,
this.index.href, this.index.title);
}
controllerDiv.appendChild (mainMenu.main);
var oMenu = new YAHOO.widget.Menu("mainmenu", {position: "static"});
oMenu.render();
oMenu.show();
},
//
// Builds menu markup returns the associated divs in the
// properties main, body, header, footer, and list
//
_menuMarkup : function(id /*Id for main part*/)
{
//
// Build our menu div...
//
var mainDiv = document.createElement("div");
var headerDiv = document.createElement("div");
var bodyDiv = document.createElement("div");
var footerDiv = document.createElement("div");
var listDiv = document.createElement("ul");
mainDiv.setAttribute ("id", id);
trc.util.dom.setClassName (mainDiv, "yuimenu");
trc.util.dom.setClassName (headerDiv, "hd");
trc.util.dom.setClassName (bodyDiv, "bd");
trc.util.dom.setClassName (footerDiv, "ft");
mainDiv.appendChild (headerDiv);
mainDiv.appendChild (bodyDiv);
mainDiv.appendChild (footerDiv);
bodyDiv.appendChild (listDiv);
return {
main : mainDiv,
body : bodyDiv,
header : headerDiv,
footer : footerDiv,
list : listDiv
};
},
//
// Adds a menu item to existing markup.
//
_menuItemMarkup : function (menu, /*Markup returned from _menuMarkup*/
name, /* String, menu item name */
href, /* String, menu item href */
title /* String, title (tool tip)*/
)
{
var listItem = document.createElement ("li");
var link = document.createElement ("a");
trc.util.dom.setClassName (listItem, "yuimenuitem");
trc.util.dom.setClassName (link, "yuimenuitemlabel");
link.setAttribute ("href", href);
if (title != null)
{
link.setAttribute ("title", title);
}
link.appendChild (document.createTextNode(name));
listItem.appendChild (link);
menu.list.appendChild(listItem);
return {
item : listItem,
anchor : link
};
}
};

View File

@ -1,137 +0,0 @@
/**
layoutManager.js
(C) 2009 Rackspace Hosting, All Rights Reserved
This file contains code that adjusts the layout of a schema
document after a dom has been loaded. It does not modify the
global scope.
**/
(function()
{
//
// Make sure dependecies are defined in the global scope, throw
// an error if they are not.
//
if ((!window.trc) ||
(!trc.util))
{
throw new Error("Require trc/util.js to be loaded.");
}
//
// This function should be called when the DOM is loaded so we
// can get to work adjusting things.
//
function InitLayoutManager()
{
layoutManager._init();
}
trc.util.browser.addInitFunction (InitLayoutManager);
var layoutManager={
//
// Initialization function...
//
_init : function()
{
this._adjustMain();
this._adjustSubElements();
},
//
// Applies appropriate styles to body and other main content
// tags.
//
_adjustMain : function()
{
//
// Change the class name for the correct YUI skin name.
//
var bodyTags = document.getElementsByTagName("body");
if (bodyTags.length == 0)
{
throw new Error ("Couldn't find body element, bad DOM?");
}
else
{
trc.util.dom.setClassName(bodyTags[0], "yui-skin-sam");
}
//
// Setout the layout...
//
var docDiv = document.getElementById("doc");
var mainDiv = document.getElementById("Main");
trc.util.dom.setClassName (docDiv, "yui-t1");
docDiv.setAttribute ("id", "doc3");
mainDiv.setAttribute ("id", "yui-main");
//
// Old IE browser hacks...
//
switch (trc.util.browser.detectIEVersion())
{
//
// IE 6 does not support fixed positioning. The
// following is a little hack to get it to work.
//
//
case 6:
var controllerDiv = document.getElementById("Controller");
controllerDiv.style.position="absolute";
window.setInterval((function(){
/* avoid leak by constantly querying for the
* controller. */
var ctrlDiv = document.getElementById("Controller");
ctrlDiv.style.top = document.documentElement.scrollTop+10;
}), 1000);
break;
//
// The controler doesn't work **at all** in IE 7
// don't even show it.
//
case 7:
var controllerDiv = document.getElementById("Controller");
controllerDiv.style.display = "none";
break;
}
},
//
// Adds appropriate classes for subElements...
//
_adjustSubElements : function()
{
var divs = document.getElementsByTagName("div");
for (var i=0;i<divs.length;i++)
{
var currentClass = divs[i].getAttribute ("class");
var newClassName = currentClass;
switch (currentClass)
{
case "SubItem" :
newClassName += " yui-gd";
break;
case "SubItemProps" :
newClassName += " yui-gd first";
break;
case "SubName" :
newClassName += " yui-u first";
break;
case "SubAttributes" :
case "SubDocumentation" :
newClassName += " yui-u";
break;
}
if (currentClass != newClassName)
{
trc.util.dom.setClassName (divs[i], newClassName);
}
}
}
};
})();

View File

@ -1,342 +0,0 @@
/**
schemaManager.js:
(C) 2009 Rackspace Hosting, All Rights Reserved
This file defines a single object in global scope:
trc.schema.sampleManager
The object is responsible for loading, formatting, and displaying
samples in schema files. It expects trc.util to be defined which is
provided in trc/util.js.
Code highlighting is provided by SHJS
(http://shjs.sourceforge.net/). It should also be loaded before
this code is initialized.
All methods/properties prepended with an underscore (_) are meant
for internal use.
**/
//
// Initialization code...
//
(function()
{
//
// Make sure dependecies are defined in the global scope, throw
// an error if they are not.
//
if ((!window.trc) ||
(!trc.util))
{
throw new Error("Require trc/util.js to be loaded.");
}
//
// Make sure syntax highlighter scripts are loaded, if not then
// load them.
//
if (!window.sh_highlightDocument)
{
trc.util.dom.addStyle ("../style/shjs/sh_darkblue.css");
trc.util.dom.addScript ("../js/shjs/sh_main.js");
trc.util.dom.addScript ("../js/shjs/sh_xml.js");
trc.util.dom.addScript ("../js/shjs/sh_javascript.js");
trc.util.dom.addScript ("../js/shjs/sh_java.js");
}
function InitSchemaSampleManager()
{
trc.schema.sampleManager._init();
}
trc.util.browser.addInitFunction(InitSchemaSampleManager);
})();
//
// Define trc.schema.sampleManager...
//
if (!trc.schema)
{
trc.schema = new Object();
}
trc.schema.sampleManager = {
//
// All sample data in an associative array:
//
// Select Element ID -> Array of sample ids.
//
samples : new Object(),
//
// An array of code data..
//
// Code data is defined as an object with the following
// properties:
//
// type: The mimetype of the code...href: The location of the code
// or null if it's inline
//
// id: The id of the pre that contains the code.
//
// The initial object is the source code for the current document.
//
codes : new Array({
id : "SrcContentCode",
type : "application/xml",
href : (function() {
var ret = location.href;
if (location.hash && (location.hash.length != 0))
{
ret = ret.replace (location.hash, "");
}
return ret;
})()
}),
//
// Sets up the manager, begins the loading process...
//
_init : function() {
//
// Setup an array to hold data items to load, this is used by
// the loadSample method.
//
this._toLoad = new Array();
for (var i=0;i<this.codes.length;i++)
{
if ((this.codes[i] != null) &&
(this.codes[i].href != null))
{
this._toLoad.push (this.codes[i]);
}
}
//
// Loads the code text
//
this._loadCode();
},
//
// Loads the next sample in the toLoad array.
//
_loadCode : function() {
if (this._toLoad.length == 0)
{
//
// All samples have been loaded, fire the loadComplete
// method.
//
this._loadComplete();
return;
}
var codeData = this._toLoad.pop();
var request = trc.util.net.getHTTPRequest();
var manager = this;
request.onreadystatechange = function() {
if (request.readyState == 4 /* Ready */) {
if (request.status == 200 /* OKAY */) {
manager._setCodeText (codeData, request.responseText);
}
else
{
manager._setCodeText (codeData, "Could not load sample ("+request.status+") "+request.responseText);
}
manager._loadCode();
}
};
request.open ("GET", codeData.href);
request.send(null);
},
//
// Called after all samples are loaded into the DOM.
//
_loadComplete : function()
{
//
// Normalize all code samples..
//
this._normalizeCodeText(1, 1, 5);
//
// Perform syntax highlighting...
//
sh_highlightDocument();
//
// All samples are initially hidden, show the selected
// samples...
//
for (var optionID in this.samples)
{
this.showSample(optionID);
}
//
// We've adjusted the document, we need to setup the view so
// that we're still pointing to the hash target.
//
if (window.location.hash &&
(window.location.hash.length != 0))
{
window.location.href = window.location.hash;
}
},
//
// Sets code text replacing any text already existing there.
//
_setCodeText : function ( codeData /* Info of the code to set (code object) */,
code /* Code text to set (string) */)
{
//
// Preprocess the txt if nessesary...
//
var ieVersion = trc.util.browser.detectIEVersion();
if ((ieVersion > -1) &&
(ieVersion < 8))
{
code = trc.util.text.unix2dos (code);
}
var pre = document.getElementById(codeData.id);
var preNodes = pre.childNodes;
//
// Remove placeholder data...
//
while (preNodes.length != 0)
{
pre.removeChild (preNodes[0]);
}
//
// Set the correct class type...
//
switch (codeData.type)
{
/*
Javascript mimetypes
*/
case 'application/json':
case 'application/javascript':
case 'application/x-javascript':
case 'application/ecmascript':
case 'text/ecmascript':
case 'text/javascript':
trc.util.dom.setClassName (pre, "sh_javascript");
break;
/*
Not real mimetypes but this is what we'll use for Java.
*/
case 'application/java':
case 'text/java':
trc.util.dom.setClassName (pre, "sh_java");
break;
default:
trc.util.dom.setClassName (pre, "sh_xml");
break;
}
//
// Add new code...
//
pre.appendChild (document.createTextNode (code));
},
//
// Retrives source code text
//
_getCodeText : function (codeData /* Info for the code to get*/)
{
var pre = document.getElementById(codeData.id);
pre.normalize();
//
// Should be a single text node after pre...
//
return pre.firstChild.nodeValue;
},
//
// Normalizes text by ensuring that top, bottom, right indent
// levels are equal for all samples.
//
_normalizeCodeText : function (top, /* integer, top indent in lines */
bottom, /* integer, bottom indent in lines */
right /* integer, right indent in spaces */
)
{
for (var i=0;i<this.codes.length;i++)
{
if (this.codes[i] != null)
{
var code = this._getCodeText (this.codes[i]);
code = trc.util.text.setIndent (code, top, bottom, right);
this._setCodeText (this.codes[i], code);
}
}
},
//
// This event handler shows the appropriate sample given an ID
// to the select element.
//
showSample : function (selectID) /* ID of the Select element */
{
//
// Get the selected value
//
var selected = document.getElementById(selectID);
var selectedValue = selected.options[selected.selectedIndex].value;
var samples = this.samples[selectID];
//
// Undisplay old samples, display selected ones.
//
for (var i=0;i<samples.length;i++)
{
if (samples[i] != null)
{
var sample = document.getElementById (samples[i]);
if (samples[i] == selectedValue)
{
sample.style.display = "block";
}
else
{
sample.style.display = "none";
}
}
}
},
//
// Toggles the current source view. If the source is displayed it
// undisplays it and vice versa.
//
toggleSrcView : function()
{
var content = document.getElementById ("Content");
var src = document.getElementById ("SrcContent");
if (content.style.display != "none")
{
content.style.display = "none";
src.style.display = "block";
}
else
{
content.style.display = "block";
src.style.display = "none";
}
}
};

View File

@ -1,564 +0,0 @@
/**
util.js:
(C) 2009 Rackspace Hosting, All Rights Reserved
This file defines a single object in global scope:
trc.util
The util object contains internal objects which contain useful
utility properties and methods.
trc.util.browser: contains methods for browser detection.
trc.util.dom: contains methods for manipulating the DOM.
trc.util.text: contains methods and properties useful when working
with plain text.
trc.util.net: contains methods for creating HTTP requests.
trc.util.yui : contains methods for working with the YUI toolkit.
All methods/properties prepended with an underscore (_) are meant
for internal use.
**/
//
// Define TRC
//
if (!window.trc)
{
trc= new Object();
}
trc.util = new Object();
trc.util.browser = {
//
// Returns the current version of IE, or -1 if it's not an IE
// browser. This is one of the recomended ways of detecting IE
// see:
//
// http://msdn.microsoft.com/en-us/library/ms537509%28VS.85%29.aspx
//
detectIEVersion : function() {
var rv = -1; // Return value assumes failure.
if (navigator.appName == 'Microsoft Internet Explorer')
{
var ua = navigator.userAgent;
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
rv = parseFloat( RegExp.$1 );
}
return rv;
},
//
// A list of functions to execute on init.
//
_initFuns : new Array(),
//
// Has the init function event been set?
//
_initFunSet: false,
//
// Function called when the DOM has loaded. It launches all init
// functions.
//
_onInit : function()
{
//
// Sort by order...
//
this._initFuns.sort(function(a, b){ return a.order - b.order; });
for (var i=0;i<this._initFuns.length;i++)
{
this._initFuns[i]();
}
},
//
// Adds a function that should be executed when the dom is
// loaded.
//
addInitFunction : function(init, /*Function to call after dom
* is loaded*/
order /* An optional it specifing
* order. The bigger the int the
* later it will run. Default is
* 1.*/
) {
if (arguments.length < 2)
{
init.order = 1;
}
else
{
init.order = order;
}
this._initFuns.push (init);
if (!this._initFunSet)
{
var butil = this;
function initFun()
{
return (function(){ butil._onInit(); });
}
//
// Try event listeners, attachEvent and if that fails use
// window.onload...
//
if (window.addEventListener)
{
window.addEventListener("load", initFun(), false);
} else if (window.attachEvent)
{
window.attachEvent ("onload", initFun());
} else
{
window.onload = initFun();
}
this._initFunSet = true;
}
}
};
trc.util.dom = {
//
// Adds a new script tag to the current DOM.
//
addScript : function (src /* Script href */)
{
var scriptElement = document.createElement ("script");
scriptElement.setAttribute ("type", "text/javascript");
scriptElement.setAttribute ("src", src);
this.addToHead (scriptElement);
},
//
// Adds a new stylesheet to the current DOM.
//
addStyle : function (src /* Stylesheet href */)
{
var linkElement = document.createElement ("link");
linkElement.setAttribute ("rel", "stylesheet");
linkElement.setAttribute ("type", "text/css");
linkElement.setAttribute ("href", src);
this.addToHead (linkElement);
},
//
// Adds a DOM node to the HTTP head element. The element is
// always added as the last child an error is thrown if the
// head element can't be found.
//
addToHead : function (node /* A DOM node */)
{
var headArray = document.getElementsByTagName("head");
if (headArray.length == 0)
{
throw new Error("Couldn't find head element, bad DOM?");
}
else
{
headArray[0].appendChild (node);
}
},
//
// Dum utility function for setting the class name of an
// element. Eventually we'll move completely to XHTML, but
// this will never work in IE 6, so for now we need this
// method for setting the class name.
//
setClassName : function (element, /* DOM Element*/
name /* Class name to use */
)
{
var ieVersion = trc.util.browser.detectIEVersion();
if ((ieVersion > -1) &&
(ieVersion < 7))
{
element.className = name;
}
else
{
element.setAttribute ("class",name);
}
}
};
trc.util.text = {
//
// Useful RegExps
//
blank : new RegExp ("^\\s*$"), /* A blank string */
indent : new RegExp ("^\\s+"), /* Line indent */
lines : new RegExp ("$","m"), /* All lines */
linechars : new RegExp ("(\n|\r)"), /* EOL line characters */
tabs : new RegExp ("\t","g"), /* All tabs */
//
// We need this because microsoft browsers before IE 7, connot
// display pre-formatted text correctly win unix style line
// endings.
//
unix2dos : function(txt /* String */) {
//if already DOS...
if (txt.search(/\r\n/) != -1)
{
return txt;
}
return txt.replace (/\n/g, "\r\n");
},
//
// Useful to normalize text.
//
dos2unix : function(txt /* String */) {
//if already unix...
if (txt.search(/\r\n/) == -1)
{
return txt;
}
return txt.replace(/\r/g, "");
},
//
// Create a string with a character repeated x times.
//
repString : function (length, /* integer, size of the string to create */
ch /* string, The character to set the string to */
)
{
var ret = new String();
for (var i=0;i<length;i++) {ret=ret.concat(ch);}
return ret;
},
//
// Replace tabs in a text with strings.
//
replaceTabs : function (txt, /* String to modify */
length /* integer, tab length in spaces */
)
{
var tabs = this.repString(length, " ");
return txt.replace (this.tabs, tabs);
},
//
// Given multi-line text returns Adjust top and bottom indent
// (in lines) and right indent (in spaces)
//
setIndent : function (txt, /* String */
top, /* integer, top indent in lines */
bottom, /* integer, bottom indent in lines */
right /* integer, right indent in spaces */
)
{
//
// Can't indent an empty string..
//
if (txt.length == 0)
{
return txt;
}
//
// If not 0, bottom will be off by one...
//
if (bottom != 0)
{
bottom++;
}
var head=this.repString (top, "\n");
var tail=this.repString (bottom, "\n");
var marg=this.repString (right, " ");
var ntxt = this.dos2unix(txt);
var ntxt = this.replaceTabs (ntxt, 8);
var lines = ntxt.split (this.lines);
var origIndent=Number.MAX_VALUE;
var origIndentStr;
//
// Look up indent.
//
for (var i=0;i<lines.length;i++)
{
//
// Remove EOL characters...
//
lines[i] = lines[i].replace (this.linechars, "");
//
// Ignore blank lines
//
if (lines[i].match(this.blank) != null)
{
continue;
}
//
// Detect the indent if any...
//
var result = lines[i].match(this.indent);
if (result == null)
{
origIndent = 0;
origIndentStr = "";
}
else if (result[0].length < origIndent)
{
origIndent = result[0].length;
origIndentStr = result[0];
}
}
//
// This implys all line are blank...can't indent.
//
if (origIndent == Number.MAX_VALUE)
{
return txt;
}
if (origIndent != 0)
{
var regExStr = "^";
for (var i=0;i<origIndent;i++)
{
regExStr=regExStr.concat("\\s");
}
var indent = new RegExp(regExStr);
for (var i=0;i<lines.length;i++)
{
lines[i] = lines[i].replace(indent,marg);
}
}
else
{
for (var i=0;i<lines.length;i++)
{
lines[i] = marg.concat (lines[i]);
}
}
//
// Remove top...
//
while (lines.length != 0)
{
if (lines[0].match(this.blank))
{
lines.shift();
}
else
{
break;
}
}
//
// Remove bottom...
//
while (lines.length != 0)
{
if (lines[lines.length-1].match(this.blank))
{
lines.pop();
}
else
{
break;
}
}
var indented = lines.join("\n");
indented=head.concat(indented, tail);
return indented;
}
};
trc.util.net = {
//
// A list of possible factories for creating an XMLHTTPRequest
//
_HTTPReqFactories :
[
function() { return new XMLHttpRequest(); },
function() { return new ActiveXObject("Msxml2.XMLHTTP"); },
function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
],
//
// A cached XMLHTTPRequest factory that we know works in this
// browser
//
_HTTPReqFactory : null,
//
// Provides a way of getting an HTTPRequest object in a
// platform independent manner
//
getHTTPRequest : function()
{
//
// Use cache if available..
//
if (this._HTTPReqFactory != null) return this._HTTPReqFactory();
//
// Search for a factory..
//
for (var i=0; i< this._HTTPReqFactories.length; i++)
{
try {
var factory = this._HTTPReqFactories[i];
var request = factory();
if (request != null)
{
this._HTTPReqFactory = factory;
return request;
}
} catch (e) {
continue;
}
}
//
// Looks like we don't have support for XMLHttpRequest...
//
this._HTTPReqFactory = function() {throw new Error("XMLHttpRequest not supported");}
this._HTTPReqFactory();
return;
}
};
//
// Init code for trc.util.yui...
//
(function()
{
//
// Menu make sure we have the YUI loader as it's used by our
// init function to load YUI components.
//
if (!window.YAHOO)
{
//
// We are currently using YUI on YAHOO!'s servers we may
// want to change this.
//
var YUI_BASE="http://yui.yahooapis.com/2.7.0/";
trc.util.dom.addScript (YUI_BASE+"build/yuiloader/yuiloader-min.js");
}
function InitYUIUtil()
{
trc.util.yui._init();
}
trc.util.browser.addInitFunction (InitYUIUtil);
})();
trc.util.yui = {
//
// A list of dependecies to be passed to the YUI loader. This is
// essentially a hash set: dep->dep.
//
_deps : new Object(),
//
// An array of callback functions, these should be called when all
// dependecies are loaded.
//
_callbacks : new Array(),
//
// The init function simply calls the YUI loader...
//
_init : function() {
var yuiUtil = this;
//
// It takes safari a while to load the YUI Loader if it hasn't
// loaded yet keep trying at 1/4 second intervals
//
if (!window.YAHOO)
{
window.setTimeout (function() {
yuiUtil._init();
}, 250);
return;
}
//
// Collect requirements...
//
var required = new Array();
for (var req in this._deps)
{
required.push (req);
}
//
// Load YUI dependecies...
//
var loader = new YAHOO.util.YUILoader({
require: required,
loadOptional: true,
filter: "RAW",
onSuccess: function() {
yuiUtil._depsLoaded();
},
timeout: 10000,
combine: true
});
loader.insert();
},
//
// Called after all dependecies have been loaded
//
_depsLoaded : function() {
//
// Dependecies are loaded let everyone know.
//
for (var i=0;i<this._callbacks.length;i++)
{
this._callbacks[i]();
}
},
//
// Request that one or more YUI dependecies are loaded.
//
loadYUIDeps : function (deps, /*An array of dep strings */
callback /*A function to call when deps are loaded*/
)
{
for (var i=0;i<deps.length;i++)
{
this._deps[deps[i]] = deps[i];
}
if (callback != null)
{
this._callbacks.push (callback);
}
}
};

View File

@ -1,20 +1,5 @@
{
"extensions": {
"values": [{
"name": "Rackspace API Key Authentication",
"namespace": "http://docs.rackspacecloud.com/identity/api/ext/key/v1.0",
"alias": "RS-KEY",
"updated": "2011-08-14T13:25:27-06:00",
"description": "Rackspace extensions to Keystone v2.0 API enabling API Key authentication.",
"links": [{
"rel": "describedby",
"type": "application/pdf",
"href": "http://docs.rackspacecloud.com/identity/api/ext/identity-key-20111111.pdf"
},{
"rel": "describedby",
"type": "application/vnd.sun.wadl+xml",
"href": "http://docs.rackspacecloud.com/identity/api/ext/identity-RS-KEY.wadl"
}]
}]
"values": []
}
}

View File

@ -2,16 +2,4 @@
<extensions xmlns="http://docs.openstack.org/common/api/v2.0"
xmlns:atom="http://www.w3.org/2005/Atom">
<extension
name="Rackspace" namespace="http://docs.rackspace.com/identity/api/ext/rpe/v1.0" alias="RS-KEY"
updated="2011-08-14T13:25:27-06:00">
<description>
Rackspace extensions to Keystone v2.0 API
enabling API Key authentication.
</description>
<atom:link rel="describedby" type="application/pdf"
href="http://docs.rackspacecloud.com/identity/api/ext/identity-RS-KEY-20110814.pdf"/>
<atom:link rel="describedby" type="application/vnd.sun.wadl+xml"
href="http://docs.rackspacecloud.com/identity/api/ext/identity-RS-KEY.wadl"/>
</extension>
</extensions>

View File

@ -1,82 +0,0 @@
/*
* (C) 2009 Rackspace Hosting, All Rights Reserved.
*/
body, div, dl, dt, dd, ul, ol, li, h2, h3,
h4, h5, h6, pre, code, form, fieldset, legend,
input, button, textarea, p, blockquote, th, td {
text-align: left;
}
h1 {
font-size: 350%;
margin-bottom: 10px;
}
#Content {
border: 1px solid;
padding: 0px 40px 40px;
margin-left: 155px;
}
#SrcContent {
padding: 0px 40px 40px;
display: none;
margin-left: 155px;
}
#Controller {
position: fixed;
width: 145px;
left: 10px;
top: 10px;
}
.Sample {
display: none;
}
.EnumValue{
padding: 10px 0px;
}
.EnumDoc{
padding: 10px 10px 10px 0px;
}
.ExternHref{
padding-top: 5px;
}
.ExternDoc{
padding-right: 10px;
}
pre {
overflow: auto;
}
td {
padding: 0px 0px 0px 10px;
width: 50%;
font-size: 90%;
}
table {
width: 100%;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:link {
color: #000090;
}
a:visited {
color: #000090;
}

View File

@ -1,151 +0,0 @@
pre.sh_sourceCode {
background-color: #eeeeee;
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #8080c0;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #ff00ff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #ff8000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_number {
color: #800080;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #0080c0;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #ff0080;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #004466;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #ff0080;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #0080c0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #ff00ff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #a68500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #0080c0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #bb7977;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #a68500;
font-weight: normal;
font-style: normal;
}

View File

@ -1,151 +0,0 @@
pre.sh_sourceCode {
background-color: #000040;
color: #C7C7C7;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #60ff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #ffa500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #80a0ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_number {
color: #42cad9;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #ff80ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #d8e91b;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #d8e91b;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #26e0e7;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #ffa500;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #26e0e7;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #ffff60;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #ffa0a0;
font-weight: normal;
font-style: normal;
}

View File

@ -1,139 +0,0 @@
pre.sh_sourceCode {
background-color: #ffffff;
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #208920;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #ac2020;
font-weight: normal;
font-style: italic;
}
pre.sh_sourceCode .sh_number {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #0000ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #0000ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #9c20ee;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #bd8d8b;
font-weight: normal;
font-style: normal;
}

View File

@ -1,151 +0,0 @@
pre.sh_sourceCode {
background-color: #000044;
color: #dd00ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #f1157c;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #82d66d;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #bfbfbf;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_number {
color: #8ee119;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #00bb00;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #e7ee5c;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #ff06cd;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #e7ee5c;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #7aec27;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #82d66d;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #7aec27;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #ffffff;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #ffffff;
font-weight: normal;
font-style: normal;
}

View File

@ -1,151 +0,0 @@
pre.sh_sourceCode {
background-color: #000000;
color: #ffffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #00c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #0000ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #808080;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_number {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #00ff00;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #ff0000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #ff22b9;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #ff0000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #0000c0;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #0000ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #00ffff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #0000c0;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #c0c000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #00ffff;
font-weight: normal;
font-style: normal;
}

View File

@ -1,145 +0,0 @@
pre.sh_sourceCode {
background-color: #ffffff;
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #666666;
font-weight: normal;
font-style: italic;
}
pre.sh_sourceCode .sh_number {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_symbol {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_cbracket {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #000000;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #000000;
font-weight: normal;
font-style: normal;
}

View File

@ -1,66 +0,0 @@
pre.sh_sourceCode {
background-color: white;
color: black;
font-style: normal;
font-weight: normal;
}
pre.sh_sourceCode .sh_keyword { color: blue; font-weight: bold; } /* language keywords */
pre.sh_sourceCode .sh_type { color: darkgreen; } /* basic types */
pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
pre.sh_sourceCode .sh_specialchar { color: pink; font-family: monospace; } /* e.g., \n, \t, \\ */
pre.sh_sourceCode .sh_comment { color: brown; font-style: italic; } /* comments */
pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
pre.sh_sourceCode .sh_preproc { color: darkblue; font-weight: bold; } /* e.g., #include, import */
pre.sh_sourceCode .sh_symbol { color: darkred; } /* e.g., <, >, + */
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: cyan; } /* TODO and FIXME */
/* Predefined variables and functions (for instance glsl) */
pre.sh_sourceCode .sh_predef_var { color: darkblue; }
pre.sh_sourceCode .sh_predef_func { color: darkblue; font-weight: bold; }
/* for OOP */
pre.sh_sourceCode .sh_classname { color: teal; }
/* line numbers (not yet implemented) */
pre.sh_sourceCode .sh_linenum { color: black; font-family: monospace; }
/* Internet related */
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
/* for ChangeLog and Log files */
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: darkblue; font-weight: bold; }
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: darkgreen; }
/* for Prolog, Perl... */
pre.sh_sourceCode .sh_variable { color: darkgreen; }
/* for LaTeX */
pre.sh_sourceCode .sh_italics { color: darkgreen; font-style: italic; }
pre.sh_sourceCode .sh_bold { color: darkgreen; font-weight: bold; }
pre.sh_sourceCode .sh_underline { color: darkgreen; text-decoration: underline; }
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
pre.sh_sourceCode .sh_argument { color: darkgreen; }
pre.sh_sourceCode .sh_optionalargument { color: purple; }
pre.sh_sourceCode .sh_math { color: orange; }
pre.sh_sourceCode .sh_bibtex { color: blue; }
/* for diffs */
pre.sh_sourceCode .sh_oldfile { color: orange; }
pre.sh_sourceCode .sh_newfile { color: darkgreen; }
pre.sh_sourceCode .sh_difflines { color: blue; }
/* for css */
pre.sh_sourceCode .sh_selector { color: purple; }
pre.sh_sourceCode .sh_property { color: blue; }
pre.sh_sourceCode .sh_value { color: darkgreen; font-style: italic; }
/* other */
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
pre.sh_sourceCode .sh_paren { color: red; }
pre.sh_sourceCode .sh_attribute { color: darkgreen; }

View File

@ -1,139 +0,0 @@
pre.sh_sourceCode {
background-color: #ffffff;
color: #696969;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_keyword {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_type {
color: #696969;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_string {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_regexp {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_specialchar {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_comment {
color: #1326a2;
font-weight: normal;
font-style: italic;
}
pre.sh_sourceCode .sh_number {
color: #bb00ff;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_preproc {
color: #470000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_function {
color: #000000;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_url {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_date {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_time {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_file {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_ip {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_name {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_variable {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_oldfile {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_newfile {
color: #008800;
font-weight: normal;
font-style: normal;
}
pre.sh_sourceCode .sh_difflines {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_selector {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_property {
color: #696969;
font-weight: bold;
font-style: normal;
}
pre.sh_sourceCode .sh_value {
color: #008800;
font-weight: normal;
font-style: normal;
}

View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsdxt="http://docs.rackspacecloud.com/xsd-ext/v1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
targetNamespace="http://docs.openstack.org/identity/api/v2.0"
>
<!--Include schema we are extending -->
<include schemaLocation="credentials.xsd"/>
<!-- Elements -->
<element name="apikeyCredentials" type="identity:RAX-APIKeyCredentials"/>
<!-- Complex Types -->
<complexType name="RAX-APIKeyCredentials">
<complexContent>
<extension base="identity:CredentialType">
<attribute name="APIKey" type="xsd:string" use="required" ></attribute>
</extension>
</complexContent>
</complexType>
</schema>

View File

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsdxt="http://docs.rackspacecloud.com/xsd-ext/v1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
targetNamespace="http://docs.openstack.org/identity/api/v2.0"
>
<!--Include schema we are extending -->
<include schemaLocation="user.xsd"/>
<include schemaLocation="roles.xsd"/>
<include schemaLocation="token.xsd"/>
<!-- Elements -->
<!-- Complex Types -->
<complexType name="RAX-UserForAuthData">
<complexContent>
<extension base="identity:UserForAuthenticateResponse">
<sequence>
<element name="groups" type="identity:Groups" />
</sequence>
</extension>
</complexContent>
</complexType>
<complexType name="Groups">
<sequence>
<element name="group" type="identity:Group" maxOccurs="100"/>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<anyAttribute namespace="##other" processContents="lax"/>
</complexType>
<complexType name="Group">
<attribute name="id" type="xsd:string" use="required"/>
<attribute name="tenantId" type="xsd:string" use="optional"/>
<anyAttribute namespace="##other" processContents="lax"/>
</complexType>
</schema>

View File

@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<schema
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsdxt="http://docs.rackspacecloud.com/xsd-ext/v1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
targetNamespace="http://docs.openstack.org/identity/api/v2.0"
>
<!--Include schema we are extending -->
<include schemaLocation="user.xsd"/>
<!-- Elements -->
<!-- Complex Types -->
<complexType name="UserWithOnlyEnabled">
<complexContent>
<restriction base="identity:User">
<attribute name="id" type="xsd:ID" use="prohibited"/>
<attribute name="defaultTenantId" type="xsd:string" use="prohibited"/>
<attribute name="email" type="xsd:string" use="prohibited"/>
<attribute name="enabled" type="xsd:boolean" use="required"/>
</restriction>
</complexContent>
</complexType>
<complexType name="UserWithOnlyPassword">
<complexContent>
<restriction base="identity:User">
<attribute name="id" type="xsd:ID" use="prohibited"/>
<attribute name="defaultTenantId" type="xsd:string" use="prohibited"/>
<attribute name="email" type="xsd:string" use="prohibited"/>
<attribute name="enabled" type="xsd:boolean" use="prohibited"/>
</restriction>
</complexContent>
</complexType>
<complexType name="UserWithOnlyTenant">
<complexContent>
<restriction base="identity:User">
<attribute name="id" type="xsd:ID" use="prohibited"/>
<attribute name="email" type="xsd:string" use="prohibited"/>
<attribute name="enabled" type="xsd:boolean" use="prohibited"/>
<attribute name="defaultTenantId" type="xsd:string" use="required"/>
</restriction>
</complexContent>
</complexType>
</schema>

View File

@ -1,69 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../xslt/schema.xslt"?>
<!-- (C) 2010 Rackspace Hosting, All Rights Reserved -->
<schema
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:identity="http://docs.openstack.org/identity/api/v2.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
xmlns:xsdxt="http://docs.rackspacecloud.com/xsd-ext/v1.0"
xmlns:atom="http://www.w3.org/2005/Atom"
targetNamespace="http://docs.openstack.org/identity/api/v2.0"
>
<!-- Import ATOM specific schema definitions -->
<import vc:minVersion="1.1" namespace="http://www.w3.org/2005/Atom"
schemaLocation="atom/atom.xsd" />
<!-- Elements -->
<element name="passwordCredentials" type="identity:PasswordCredentials"/>
<element name="credentials" type="identity:CredentialList" >
<annotation>
<xsd:documentation
xml:lang="EN"
xmlns="http://www.w3.org/2001/XMLSchema">
<p>
A list of credentials.
</p>
</xsd:documentation>
</annotation>
</element>
<!-- Complex Types -->
<complexType name="Credential" abstract="true">
<attribute name="id" type="xsd:ID" use="optional"/>
<anyAttribute namespace="##other" processContents="lax"/>
</complexType>
<complexType name="CredentialType" abstract="true">
<anyAttribute namespace="##other" processContents="lax"/>
</complexType>
<complexType name="PasswordCredentials">
<complexContent>
<extension base="identity:CredentialType">
<sequence>
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<attribute name="password" type="xsd:string" use="required" />
<attribute name="username" type="xsd:string" use="optional" />
<attribute name="tenantId" type="xsd:string" use="optional" />
<anyAttribute namespace="##other" processContents="lax"/>
</extension>
</complexContent>
</complexType>
<complexType name="CredentialList">
<sequence>
<element name="credential" type="identity:Credential" minOccurs="0" maxOccurs="unbounded"/>
<!-- TODO(Ziad): resolve conflict <element vc:minVersion="1.1" ref="atom:link" minOccurs="0" maxOccurs="unbounded" />-->
<any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
</sequence>
<anyAttribute namespace="##other" processContents="lax"/>
</complexType>
</schema>

File diff suppressed because it is too large Load Diff

View File

View File

View File

@ -0,0 +1,16 @@
{
"name": "Rackspace API Key Authentication",
"namespace": "http://docs.rackspacecloud.com/identity/api/ext/key/v1.0",
"alias": "RS-KEY",
"updated": "2011-08-14T13:25:27-06:00",
"description": "Rackspace extensions to Keystone v2.0 API enabling API Key authentication.",
"links": [{
"rel": "describedby",
"type": "application/pdf",
"href": "http://docs.rackspacecloud.com/identity/api/ext/identity-key-20111111.pdf"
},{
"rel": "describedby",
"type": "application/vnd.sun.wadl+xml",
"href": "http://docs.rackspacecloud.com/identity/api/ext/identity-RS-KEY.wadl"
}]
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<extension xmlns="http://docs.openstack.org/common/api/v2.0"
xmlns:atom="http://www.w3.org/2005/Atom"
name="Rackspace" namespace="http://docs.rackspace.com/identity/api/ext/rpe/v1.0" alias="RS-KEY"
updated="2011-08-14T13:25:27-06:00">
<description>
Rackspace extensions to Keystone v2.0 API
enabling API Key authentication.
</description>
<atom:link rel="describedby" type="application/pdf"
href="http://docs.rackspacecloud.com/identity/api/ext/identity-RS-KEY-20110814.pdf"/>
<atom:link rel="describedby" type="application/vnd.sun.wadl+xml"
href="http://docs.rackspacecloud.com/identity/api/ext/identity-RS-KEY.wadl"/>
</extension>

View File

@ -0,0 +1,102 @@
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2010-2011 OpenStack, LLC.
#
# Licensed 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.
"""
RACKSPACE API KEY EXTENSION
This WSGI component
- detects calls with extensions in them.
- processes the necessary components
"""
import os
import sys
import json
from lxml import etree
from webob.exc import Request, Response
import keystone.utils as utils
EXTENSION_ALIAS = "RS-KEY"
class FrontEndFilter(object):
"""API Key Middleware that handles authentication with API Key"""
def __init__(self, app, conf):
""" Common initialization code """
print "Starting the %s extension" % EXTENSION_ALIAS
self.conf = conf
self.app = app
def __call__(self, env, start_response):
""" Handle incoming request. Transform. And send downstream. """
request = Request(env)
if request.path == "/extensions":
if env['KEYSTONE_API_VERSION'] == '2.0':
request = Request(env)
response = request.get_response(self.app)
if response.status_int == 200:
if response.content_type == 'application/json':
#load json for this extension from file
thisextension = open(os.path.join(
os.path.dirname(__file__),
"extension.json")).read()
thisextensionjson = json.loads(thisextension)
#load json in response
body = json.loads(response.body)
extensionsarray = body["extensions"]["values"]
#add this extension and return the response
extensionsarray.append(thisextensionjson)
newresp = Response(
content_type='application/json',
body=json.dumps(body))
return newresp(env, start_response)
elif response.content_type == 'application/xml':
#load xml for this extension from file
thisextensionxml = etree.parse(os.path.join(
os.path.dirname(__file__),
"extension.xml")).getroot()
#load xml being returned in response
body = etree.fromstring(response.body)
#add this extension and return the response
body.append(thisextensionxml)
newresp = Response(
content_type='application/xml',
body=etree.tostring(body))
return newresp(env, start_response)
# return the response
return response(env, start_response)
#default action, bypass
return self.app(env, start_response)
def filter_factory(global_conf, **local_conf):
"""Returns a WSGI filter app for use with paste.deploy."""
conf = global_conf.copy()
conf.update(local_conf)
def ext_filter(app):
"""Closure to return"""
return FrontEndFilter(app, conf)
return ext_filter

View File

@ -30,6 +30,5 @@ class ExtensionsController(wsgi.Controller):
resp_file = "%s.json" % path
mime_type = "application/json"
print resp_file
return template.static_file(resp, req, resp_file,
root=utils.get_app_root(), mimetype=mime_type)

View File

@ -30,11 +30,12 @@ class StaticFilesController(wsgi.Controller):
@utils.wrap_error
def get_pdf_contract(self, req, pdf, root="content/"):
resp = Response()
return template.static_file(resp, req, root + pdf,
filepath = root + pdf
return template.static_file(resp, req, filepath,
root=utils.get_app_root(), mimetype="application/pdf")
@utils.wrap_error
def get_wadl_contract(self, req, wadl, root="content/"):
def get_wadl_contract(self, req, wadl, root):
resp = Response()
return template.static_file(resp, req, root + wadl,
root=utils.get_app_root(), mimetype="application/vnd.sun.wadl+xml")
@ -52,7 +53,21 @@ class StaticFilesController(wsgi.Controller):
root=utils.get_app_root(), mimetype="application/xml")
@utils.wrap_error
def get_static_file(self, req, path, file, mimetype, root="content/"):
def get_static_file(self, req, path, file, mimetype=None, root="content/"):
resp = Response()
return template.static_file(resp, req, path + file,
if mimetype == None:
if utils.is_xml_response(req):
mimetype = "application/xml"
elif utils.is_json_response(req):
mimetype = "application/json"
if mimetype == "application/xml":
resp_file = "%s%s%s.xml" % (root, path, file)
elif mimetype == "application/json":
resp_file = "%s%s%s.json" % (root, path, file)
else:
resp_file = root + path + file
return template.static_file(resp, req, resp_file,
root=utils.get_app_root(), mimetype=mimetype)

View File

@ -200,86 +200,25 @@ class AdminApi(wsgi.Router):
mapper.connect("/xslt/{file:.*}",
controller=static_files_controller,
action="get_static_file",
root="content/admin/", path="xslt/",
mimetype="application/xml",
root="content/common/", path="xslt/",
mimetype="application/xslt",
conditions=dict(method=["GET"]))
mapper.connect("/js/{file:.*}",
controller=static_files_controller,
action="get_static_file",
root="content/admin/", path="js/",
mimetype="application/text",
root="content/common/", path="js/",
mimetype="application/javascript",
conditions=dict(method=["GET"]))
mapper.connect("/style/{file:.*}",
controller=static_files_controller,
action="get_static_file",
root="content/admin/", path="/style/",
root="content/common/", path="style/",
mimetype="application/css",
conditions=dict(method=["GET"]))
mapper.connect("/samples/{file:.*}",
controller=static_files_controller,
action="get_static_file",
root="content/admin/", path="samples/",
mimetype="application/text",
conditions=dict(method=["GET"]))
mapper.connect("/xslt/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/xslt/", mimetype="application/xml",
conditions=dict(method=["GET"]))
mapper.connect("/js/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/js/", mimetype="application/text",
conditions=dict(method=["GET"]))
mapper.connect("/style/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/style/", mimetype="application/css",
conditions=dict(method=["GET"]))
mapper.connect("/samples/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/samples/", mimetype="application/text",
conditions=dict(method=["GET"]))
mapper.connect("/xslt/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/xslt/", mimetype="application/xml",
conditions=dict(method=["GET"]))
mapper.connect("/js/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/js/", mimetype="application/text",
conditions=dict(method=["GET"]))
mapper.connect("/style/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/style/", mimetype="application/css",
conditions=dict(method=["GET"]))
mapper.connect("/samples/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/samples/", mimetype="application/text",
conditions=dict(method=["GET"]))
mapper.connect("/xslt/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/xslt/", mimetype="application/xml",
conditions=dict(method=["GET"]))
mapper.connect("/js/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/js/", mimetype="application/text",
conditions=dict(method=["GET"]))
mapper.connect("/style/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/style/", mimetype="application/css",
conditions=dict(method=["GET"]))
mapper.connect("/samples/{file:.*}",
controller=static_files_controller,
action="get_static_file",
path="/content/samples/", mimetype="application/text",
root="content/common/", path="samples/",
conditions=dict(method=["GET"]))
# Services Controller

View File

@ -76,10 +76,30 @@ class ServiceApi(wsgi.Router):
root="content/service/", wadl="identity.wadl",
conditions=dict(method=["GET"]))
mapper.connect("/common.ent",
controller=static_files_controller,
action="get_wadl_contract", wadl="common.ent",
conditions=dict(method=["GET"]))
mapper.connect("/xsd/{xsd}",
controller=static_files_controller,
action="get_wadl_contract",
wadl="common.ent", root="content/common/",
conditions=dict(method=["GET"]))
mapper.connect("/xslt/{file:.*}",
controller=static_files_controller,
action="get_static_file", path="common/xslt/",
mimetype="application/xslt",
conditions=dict(method=["GET"]))
mapper.connect("/style/{file:.*}",
controller=static_files_controller,
action="get_static_file", path="common/style/",
mimetype="application/css",
conditions=dict(method=["GET"]))
mapper.connect("/js/{file:.*}",
controller=static_files_controller,
action="get_static_file", path="common/js/",
mimetype="application/javascript",
conditions=dict(method=["GET"]))
mapper.connect("/samples/{file:.*}",
controller=static_files_controller,
action="get_static_file", path="common/samples/",
conditions=dict(method=["GET"]))
mapper.connect("/xsd/{xsd:.*}",
controller=static_files_controller,
action="get_xsd_contract", root="content/service/",
conditions=dict(method=["GET"]))

View File

@ -33,8 +33,9 @@ pipeline =
[pipeline:keystone-legacy-auth]
pipeline =
urlrewritefilter
legacy_auth
urlrewritefilter
legacy_auth
RS-KEY-extension
service_api
[app:service_api]
@ -47,4 +48,7 @@ paste.app_factory = keystone.server:admin_app_factory
paste.filter_factory = keystone.middleware.url:filter_factory
[filter:legacy_auth]
paste.filter_factory = keystone.frontends.legacy_token_auth:filter_factory
paste.filter_factory = keystone.frontends.legacy_token_auth:filter_factory
[filter:RS-KEY-extension]
paste.filter_factory = keystone.contrib.extensions.rskey.frontend:filter_factory

View File

@ -32,8 +32,9 @@ pipeline =
[pipeline:keystone-legacy-auth]
pipeline =
urlrewritefilter
legacy_auth
urlrewritefilter
legacy_auth
RS-KEY-extension
service_api
[app:service_api]
@ -46,4 +47,7 @@ paste.app_factory = keystone.server:admin_app_factory
paste.filter_factory = keystone.middleware.url:filter_factory
[filter:legacy_auth]
paste.filter_factory = keystone.frontends.legacy_token_auth:filter_factory
paste.filter_factory = keystone.frontends.legacy_token_auth:filter_factory
[filter:RS-KEY-extension]
paste.filter_factory = keystone.contrib.extensions.rskey.frontend:filter_factory

View File

@ -27,8 +27,9 @@ pipeline =
[pipeline:keystone-legacy-auth]
pipeline =
urlrewritefilter
legacy_auth
urlrewritefilter
legacy_auth
RS-KEY-extension
service_api
[app:service_api]
@ -41,4 +42,7 @@ paste.app_factory = keystone.server:admin_app_factory
paste.filter_factory = keystone.middleware.url:filter_factory
[filter:legacy_auth]
paste.filter_factory = keystone.frontends.legacy_token_auth:filter_factory
paste.filter_factory = keystone.frontends.legacy_token_auth:filter_factory
[filter:RS-KEY-extension]
paste.filter_factory = keystone.contrib.extensions.rskey.frontend:filter_factory

View File

@ -0,0 +1,29 @@
import unittest
from common import KeystoneTestCase
class TestExtensions(KeystoneTestCase):
def test_extensions_json(self):
r = self.service_request(path='/extensions.json',
assert_status=200)
self.assertTrue('json' in r.getheader('Content-Type'))
content = r.json
self.assertIsNotNone(content['extensions'])
self.assertIsNotNone(content['extensions']['values'])
found = False
for value in content['extensions']['values']:
if value['alias'] == 'RS-KEY':
found = True
break
self.assertTrue(found)
def test_extensions_xml(self):
r = self.service_request(path='/extensions.xml')
self.assertTrue('xml' in r.getheader('Content-Type'))
content = r.xml
extension = content.find("*[@alias='RS-KEY']")
self.assertIsNotNone(extension)
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,26 @@
import unittest
from common import KeystoneTestCase
class TestExtensions(KeystoneTestCase):
def test_extensions_json(self):
r = self.service_request(path='/extensions.json')
self.assertTrue('json' in r.getheader('Content-Type'))
def test_extensions_xml(self):
r = self.service_request(path='/extensions.xml')
self.assertTrue('xml' in r.getheader('Content-Type'))
class TestAdminExtensions(KeystoneTestCase):
def test_extensions_json(self):
r = self.admin_request(path='/extensions.json')
self.assertTrue('json' in r.getheader('Content-Type'))
def test_extensions_xml(self):
r = self.admin_request(path='/extensions.xml')
self.assertTrue('xml' in r.getheader('Content-Type'))
if __name__ == '__main__':
unittest.main()

View File

@ -11,6 +11,10 @@ class TestStaticFiles(KeystoneTestCase):
r = self.service_request(path='/identity.wadl')
self.assertTrue('xml' in r.getheader('Content-Type'))
def test_wadl_common(self):
r = self.service_request(path='/common.ent')
self.assertTrue('xml' in r.getheader('Content-Type'))
def test_xsd_contract(self):
r = self.service_request(path='/xsd/api.xsd')
self.assertTrue('xml' in r.getheader('Content-Type'))
@ -19,6 +23,26 @@ class TestStaticFiles(KeystoneTestCase):
r = self.service_request(path='/xsd/atom/atom.xsd')
self.assertTrue('xml' in r.getheader('Content-Type'))
def test_xslt(self):
r = self.service_request(path='/xslt/schema.xslt')
self.assertTrue('xslt' in r.getheader('Content-Type'))
def test_js(self):
r = self.service_request(path='/js/shjs/sh_java.js')
self.assertTrue('javascript' in r.getheader('Content-Type'))
def test_xml_sample(self):
r = self.service_request(path='/samples/auth.xml')
self.assertTrue('xml' in r.getheader('Content-Type'))
def test_json_sample(self):
r = self.service_request(path='/samples/auth.json')
self.assertTrue('json' in r.getheader('Content-Type'))
def test_stylesheet(self):
r = self.service_request(path='/style/shjs/sh_acid.css')
self.assertTrue('css' in r.getheader('Content-Type'))
class TestAdminStaticFiles(KeystoneTestCase):
def test_pdf_contract(self):
@ -37,5 +61,26 @@ class TestAdminStaticFiles(KeystoneTestCase):
r = self.admin_request(path='/xsd/atom/atom.xsd')
self.assertTrue('xml' in r.getheader('Content-Type'))
def test_xslt(self):
r = self.admin_request(path='/xslt/schema.xslt')
self.assertTrue('xslt' in r.getheader('Content-Type'))
def test_js(self):
r = self.admin_request(path='/js/shjs/sh_java.js')
self.assertTrue('javascript' in r.getheader('Content-Type'))
def test_xml_sample(self):
r = self.admin_request(path='/samples/auth.xml')
self.assertTrue('xml' in r.getheader('Content-Type'))
def test_json_sample(self):
r = self.admin_request(path='/samples/auth.json')
self.assertTrue('json' in r.getheader('Content-Type'))
def test_stylesheet(self):
r = self.admin_request(path='/style/shjs/sh_acid.css')
self.assertTrue('css' in r.getheader('Content-Type'))
if __name__ == '__main__':
unittest.main()

View File

@ -30,6 +30,11 @@ def is_xml_response(req):
return "Accept" in req.headers and "application/xml" in req.accept
def is_json_response(req):
"""Returns True when the request wants a JSON response, False otherwise"""
return "Accept" in req.headers and "application/json" in req.accept
def get_app_root():
return os.path.abspath(os.path.dirname(__file__))
@ -58,6 +63,8 @@ def wrap_error(func):
except Exception as err:
if isinstance(err, fault.IdentityFault):
return send_error(err.code, kwargs['req'], err)
elif isinstance(err, fault.ItemNotFoundFault):
return send_error(err.code, kwargs['req'], err)
else:
logging.exception(err)
return send_error(500, kwargs['req'],

View File

@ -55,9 +55,9 @@ function run_pep8 {
#
# [1] https://bugs.launchpad.net/bzr/+bug/701898
#
PEP8_EXCLUDE=vcsversion.py
PEP8_EXCLUDE="vcsversion.py"
PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat --show-pep8 --show-source"
PEP8_INCLUDE="bin/* keystone tests tools setup.py run_tests.py"
PEP8_INCLUDE="bin/k* keystone examples tools setup.py run_tests.py"
pep8 $PEP8_OPTIONS $PEP8_INCLUDE
}

View File

@ -108,6 +108,7 @@ def install_dependencies(venv=VENV):
f = open(pthfile, 'w')
f.write("%s\n" % ROOT)
def print_help():
help = """
Keystone development environment setup is complete.

View File

@ -99,15 +99,15 @@ if '--trace-calls' in sys.argv:
os.pardir))
func_filename = func_filename.replace(possible_topdir, '')
caller = frame.f_back
if caller:
caller_line_no = caller.f_lineno
caller_filename = caller.f_code.co_filename.replace(possible_topdir,
'')
caller_filename = caller.f_code.co_filename.replace(
possible_topdir, '')
print '%s%s::%s:%s (from %s:%s)' % \
(' ' * stack_depth, func_filename, func_name, func_line_no,
caller_filename, caller_line_no)
stack_depth = stack_depth + 1
return localtrace