org.jboss.osgi.resolver.v2.spi
Class URLBasedResource

java.lang.Object
  extended by org.jboss.osgi.resolver.v2.spi.AbstractResource
      extended by org.jboss.osgi.resolver.v2.spi.URLBasedResource
All Implemented Interfaces:
XAttachmentSupport, XElement, XResource, org.osgi.framework.resource.Resource

public final class URLBasedResource
extends AbstractResource

A resource based on an URL

Since:
16-Jan-2012
Author:
thomas.diesler@jboss.com

Constructor Summary
URLBasedResource(URL baseURL, String contentPath)
           
 
Method Summary
<T> T
addAttachment(Class<T> clazz, T value)
          Attach an arbirtary object with this element.
<T> T
getAttachment(Class<T> clazz)
          Get the attached object for a given key
 InputStream getContent()
           
 String getContentPath()
           
 URL getContentURL()
           
<T> T
removeAttachment(Class<T> clazz)
          Remove an attached object for a given key
 
Methods inherited from class org.jboss.osgi.resolver.v2.spi.AbstractResource
addCapability, addRequirement, getCapabilities, getIdentityCapability, getRequirements, isFragment, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.osgi.resolver.v2.XAttachmentSupport
addAttachment, getAttachment, removeAttachment
 

Constructor Detail

URLBasedResource

public URLBasedResource(URL baseURL,
                        String contentPath)
Method Detail

getContentURL

public URL getContentURL()

getContentPath

public String getContentPath()

getContent

public InputStream getContent()
Specified by:
getContent in interface XResource
Overrides:
getContent in class AbstractResource

addAttachment

public <T> T addAttachment(Class<T> clazz,
                           T value)
Description copied from interface: XAttachmentSupport
Attach an arbirtary object with this element.

Specified by:
addAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The previously attachment object or null

getAttachment

public <T> T getAttachment(Class<T> clazz)
Description copied from interface: XAttachmentSupport
Get the attached object for a given key

Specified by:
getAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The attached object or null

removeAttachment

public <T> T removeAttachment(Class<T> clazz)
Description copied from interface: XAttachmentSupport
Remove an attached object for a given key

Specified by:
removeAttachment in interface XAttachmentSupport
Parameters:
clazz - key for the attachment
Returns:
The attached object or null


Copyright © 2012. All Rights Reserved.