org.ops4j.pax.url.war.internal
Class WarReferenceConnection

java.lang.Object
  extended by java.net.URLConnection
      extended by org.ops4j.pax.url.war.internal.WarReferenceConnection

public class WarReferenceConnection
extends URLConnection

Url connection for war-file protocol handler.

Since:
0.1.0, January 14, 2008
Author:
Alin Dreghiciu

Field Summary
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
WarReferenceConnection(URL url, Configuration config)
           
 
Method Summary
protected static boolean checkJarIsLegal(String name)
          verifies that the given jar name is not contained in the blacklist.
 void connect()
          Does nothing.
protected  InputStream createBundle(InputStream inputStream, Properties instructions, String warUri)
          Actually create the bundle based on the parsed instructions and the given stream
protected  InputStream createBundle(InputStream inputStream, Properties instructions, String warUri, org.ops4j.pax.swissbox.bnd.OverwriteMode overwriteMode)
          Actually create the bundle based on the parsed instructions and the given stream
protected  Configuration getConfiguration()
          Getter.
 InputStream getInputStream()
          Returns the input stream denoted by the url.
protected  Properties getInstructions()
          Url must be a reference to an instructions file.
protected static String join(Collection<String> strings, String delimiter)
          Joins elements from a collection into a delimiter separated string.
protected static List<String> toList(String separatedString, String delimiter)
          Splits a delimiter separated string into a list.
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WarReferenceConnection

public WarReferenceConnection(URL url,
                              Configuration config)
                       throws MalformedURLException
Throws:
MalformedURLException
See Also:
AbstractConnection.AbstractConnection(URL, Configuration)
Method Detail

getInstructions

protected Properties getInstructions()
                              throws IOException
Url must be a reference to an instructions file.

Returns:
processing instructions
Throws:
IOException - if instructions file can not be returned
See Also:
AbstractConnection.getInstructions()

getInputStream

public InputStream getInputStream()
                           throws IOException
Returns the input stream denoted by the url.

Overrides:
getInputStream in class URLConnection
Returns:
the input stream for the resource denoted by url
Throws:
IOException - in case of an exception during accessing the resource
See Also:
URLConnection.getInputStream()

createBundle

protected InputStream createBundle(InputStream inputStream,
                                   Properties instructions,
                                   String warUri)
                            throws IOException
Actually create the bundle based on the parsed instructions and the given stream

Parameters:
warUri -
instructions -
Returns:
Throws:
IOException

createBundle

protected InputStream createBundle(InputStream inputStream,
                                   Properties instructions,
                                   String warUri,
                                   org.ops4j.pax.swissbox.bnd.OverwriteMode overwriteMode)
                            throws IOException
Actually create the bundle based on the parsed instructions and the given stream

Parameters:
inputStream -
instructions -
warUri -
overwriteMode -
Returns:
an input stream for the generated bundle
Throws:
IOException
See Also:
BndUtils.createBundle

getConfiguration

protected Configuration getConfiguration()
Getter.

Returns:
configuration

connect

public void connect()
Does nothing.

Specified by:
connect in class URLConnection

checkJarIsLegal

protected static boolean checkJarIsLegal(String name)
verifies that the given jar name is not contained in the blacklist.

Parameters:
name - of the jar which needs verification
Returns:
true - if the jar is a legal jar
false - if the jar is not supposed to be in a war archive like servlet.jar

toList

protected static List<String> toList(String separatedString,
                                     String delimiter)
Splits a delimiter separated string into a list.

Parameters:
separatedString - string to be split
delimiter - delimiter
Returns:
list composed out of the string segments

join

protected static String join(Collection<String> strings,
                             String delimiter)
Joins elements from a collection into a delimiter separated string.

Parameters:
strings - collection of ellements
delimiter - delimiter
Returns:
string composed from the collection elements delimited by the delimiter


Copyright © 2006-2013 OPS4J - Open Participation Software for Java. All Rights Reserved.