Skip to content

Instantly share code, notes, and snippets.

@dizz
Created March 11, 2011 10:23
Show Gist options
  • Save dizz/865701 to your computer and use it in GitHub Desktop.
Save dizz/865701 to your computer and use it in GitHub Desktop.
OCCI Text to Java Datastructures via OCCI LexPar
OCCI Header format:
Category: storage; scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind"; title="Storage Resource";rel="http://schemas.ogf.org/occi/core#resource";location=/storage/;attributes="occi.storage.size occi.storage.state";actions="http://schemas.ogf.org/occi/infrastructure/storage/action#resize"
Link: </storage/disk03>; rel="http://example.com/occi/resource#storage";self="/link/456-456-456";category="http://example.com/occi/link#disk_drive";com.example.drive0.interface="ide0",com.example.drive1.interface="ide1"
X-OCCI-Attribute: occi.compute.architechture="x86", occi.compute.cores=2, occi.compute.hostname="testserver", occi.compute.speed=2.66, occi.compute.memory=3.0, occi.compute.state="active"
Generated Java Datastructures (displayed using $type.toString()):
{
occi.attributes={
occi.compute.state="active",
occi.compute.hostname="testserver",
occi.compute.memory=3.0,
occi.compute.architechture="x86",
occi.compute.cores=2,
occi.compute.speed=2.66
},
occi.links=[
{
com.example.drive1.interface="ide1",
occi.core.category="http://example.com/occi/link#disk_drive",
com.example.drive0.interface="ide0",
occi.core.target=/storage/disk03,
occi.core.self="/link/456-456-456",
occi.core.rel="http://example.com/occi/resource#storage"
}
],
occi.categories=[
{
occi.core.actions="http://schemas.ogf.org/occi/infrastructure/storage/action#resize",
occi.core.location=/storage/,
occi.core.scheme="http://schemas.ogf.org/occi/infrastructure#",
occi.core.class=kind,
occi.core.term=storage,
occi.core.attributes="occi.storage.size occi.storage.state",
occi.core.title="Storage Resource",
occi.core.rel="http://schemas.ogf.org/occi/core#resource"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment