org.xwiki.xar.script
Class XarScriptService

java.lang.Object
  extended by org.xwiki.xar.script.XarScriptService
All Implemented Interfaces:
org.xwiki.script.service.ScriptService

@Component
@Named(value="xar")
@Unstable
public class XarScriptService
extends Object
implements org.xwiki.script.service.ScriptService

Provide APIs to manipulate XAR files.

Since:
5.4RC1
Version:
$Id: 110a4692910dedff31073e24369ea653b09a0e1f $

Field Summary
static String ERROR_KEY
          The key under which the last encountered error is stored in the current execution context.
protected  org.xwiki.context.Execution execution
          Provides access to the current context.
 
Constructor Summary
XarScriptService()
           
 
Method Summary
 Exception getLastError()
          Get the error generated while performing the previously called action.
 XarPackage getXarPackage(File file)
          Generate a XarPackage from the passed XAR file.
 XarPackage getXarPackage(InputStream stream, boolean close)
          Generate a XarPackage from the passed XAR file.
protected  void setError(Exception e)
          Store a caught exception in the context, so that it can be later retrieved using getLastError().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_KEY

public static final String ERROR_KEY
The key under which the last encountered error is stored in the current execution context.

See Also:
Constant Field Values

execution

@Inject
protected org.xwiki.context.Execution execution
Provides access to the current context.

Constructor Detail

XarScriptService

public XarScriptService()
Method Detail

getLastError

public Exception getLastError()
Get the error generated while performing the previously called action.

Returns:
an eventual exception or null if no exception was thrown

setError

protected void setError(Exception e)
Store a caught exception in the context, so that it can be later retrieved using getLastError().

Parameters:
e - the exception to store, can be null to clear the previously stored exception
See Also:
getLastError()

getXarPackage

public XarPackage getXarPackage(File file)
Generate a XarPackage from the passed XAR file.

Parameters:
file - the XAR file
Returns:
the package

getXarPackage

public XarPackage getXarPackage(InputStream stream,
                                boolean close)
Generate a XarPackage from the passed XAR file.

Parameters:
stream - the XAR file
close - indicate if the passed stream should be closed at the end
Returns:
the package


Copyright © 2004–2014 XWiki. All rights reserved.