org.overlord.sramp.atom
Class SrampAtomUtils

java.lang.Object
  extended by org.overlord.sramp.atom.SrampAtomUtils

public final class SrampAtomUtils
extends Object

Some useful static utils for users of the s-ramp client.

Author:
eric.wittmann@redhat.com

Method Summary
static ArtifactType getArtifactType(org.jboss.resteasy.plugins.providers.atom.Entry entry)
          Figures out the S-RAMP artifact type for the given Entry.
protected static ArtifactType getArtifactTypeFromEntry(org.jboss.resteasy.plugins.providers.atom.Entry entry)
          Figures out the S-RAMP artifact type for the given Entry.
static
<T> T
unwrap(org.jboss.resteasy.plugins.providers.atom.Entry entry, Class<T> clazz)
          Unwrap some other jaxb object from its Atom Entry wrapper.
static BaseArtifactType unwrapSrampArtifact(ArtifactType artifactType, Artifact artifact)
          Unwraps the specific BaseArtifactType from the S-RAMP Artifact wrapper element.
static BaseArtifactType unwrapSrampArtifact(ArtifactType artifactType, org.jboss.resteasy.plugins.providers.atom.Entry entry)
          Unwraps a specific BaseArtifactType from the Atom Entry containing it.
static BaseArtifactType unwrapSrampArtifact(org.jboss.resteasy.plugins.providers.atom.Entry entry)
          Unwraps a specific BaseArtifactType from the Atom Entry containing it.
static org.jboss.resteasy.plugins.providers.atom.Entry wrapSrampArtifact(BaseArtifactType artifact)
          Wraps the given s-ramp artifact in an Atom Entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

unwrapSrampArtifact

public static BaseArtifactType unwrapSrampArtifact(ArtifactType artifactType,
                                                   Artifact artifact)
Unwraps the specific BaseArtifactType from the S-RAMP Artifact wrapper element. This method requires the artifact's type.

Parameters:
artifactType - the s-ramp artifact type
artifact - the s-ramp wrapper Artifact
Returns:
a BaseArtifactType

unwrapSrampArtifact

public static BaseArtifactType unwrapSrampArtifact(org.jboss.resteasy.plugins.providers.atom.Entry entry)
Unwraps a specific BaseArtifactType from the Atom Entry containing it. This method grabs the Artifact child from the Atom Entry and then unwraps the BaseArtifactType from that.

Parameters:
entry - an Atom Entry
Returns:
a BaseArtifactType

unwrapSrampArtifact

public static BaseArtifactType unwrapSrampArtifact(ArtifactType artifactType,
                                                   org.jboss.resteasy.plugins.providers.atom.Entry entry)
Unwraps a specific BaseArtifactType from the Atom Entry containing it. This method grabs the Artifact child from the Atom Entry and then unwraps the BaseArtifactType from that.

Parameters:
artifactType - the s-ramp artifact type
entry - an Atom Entry
Returns:
a BaseArtifactType

wrapSrampArtifact

public static org.jboss.resteasy.plugins.providers.atom.Entry wrapSrampArtifact(BaseArtifactType artifact)
                                                                         throws URISyntaxException,
                                                                                IllegalArgumentException,
                                                                                IllegalAccessException,
                                                                                InvocationTargetException,
                                                                                SecurityException,
                                                                                NoSuchMethodException
Wraps the given s-ramp artifact in an Atom Entry.

Parameters:
artifact -
Throws:
URISyntaxException
InvocationTargetException
IllegalAccessException
IllegalArgumentException
NoSuchMethodException
SecurityException

getArtifactType

public static ArtifactType getArtifactType(org.jboss.resteasy.plugins.providers.atom.Entry entry)
Figures out the S-RAMP artifact type for the given Entry.

Parameters:
entry -

getArtifactTypeFromEntry

protected static ArtifactType getArtifactTypeFromEntry(org.jboss.resteasy.plugins.providers.atom.Entry entry)
Figures out the S-RAMP artifact type for the given Entry. There are a number of ways we can do this. We'll try them all: 1) check the 'self' link, parsing it for the type and model information 2) check the Atom Category - there should be one for the artifact type 3) unwrap the Entry's Artifact and get the artifactType value (xml attribute)

Parameters:
entry -

unwrap

public static <T> T unwrap(org.jboss.resteasy.plugins.providers.atom.Entry entry,
                           Class<T> clazz)
                throws JAXBException
Unwrap some other jaxb object from its Atom Entry wrapper.

Parameters:
entry -
clazz -
Throws:
JAXBException


Copyright © 2011-2013 JBoss, a division of Red Hat. All Rights Reserved.