org.drools.guvnor.server.files
Class FileManagerUtils

java.lang.Object
  extended by org.drools.guvnor.server.files.FileManagerUtils

@Name(value="fileManager")
@Scope(value=EVENT)
@AutoCreate
public class FileManagerUtils
extends Object

This assists the file manager servlets.


Constructor Summary
FileManagerUtils()
           
 
Method Summary
 void attachFile(FormData uploadItem)
          This attach a file to an asset.
 void attachFileToAsset(String uuid, InputStream fileData, String fileName)
          This utility method attaches a file to an asset.
 void close()
           
 byte[] exportPackageFromRepository(String packageName)
           
 void exportRulesRepository(OutputStream out)
           
static FormData getFormData(javax.servlet.http.HttpServletRequest request)
          Get the form data from the inbound request.
 long getLastModified(String name, String version)
          This will return the last time the package was built.
 RulesRepository getRepository()
           
 String importClassicDRL(InputStream drlStream, String packageName)
          This will import DRL from a drl file into a more normalised structure.
 void importPackageToRepository(byte[] data, boolean importAsNew)
           
 void importRulesRepository(InputStream in)
           
 boolean isPackageExist(String packageName)
           
 String loadBinaryPackage(String packageName, String packageVersion, boolean isLatest, OutputStream out)
          Load up the appropriate package version.
 String loadFileAttachmentByUUID(String uuid, OutputStream out)
          The get returns files based on UUID of an asset.
 String loadSourceAsset(String packageName, String packageVersion, boolean isLatest, String assetName, ByteArrayOutputStream out)
           
 String loadSourcePackage(String packageName, String packageVersion, boolean isLatest, OutputStream out)
          Load up the approproate package version.
 void setRepository(RulesRepository repository)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileManagerUtils

public FileManagerUtils()
Method Detail

attachFile

@Restrict(value="#{identity.loggedIn}")
public void attachFile(FormData uploadItem)
                throws IOException
This attach a file to an asset.

Throws:
IOException

attachFileToAsset

@Restrict(value="#{identity.loggedIn}")
public void attachFileToAsset(String uuid,
                                       InputStream fileData,
                                       String fileName)
                       throws IOException
This utility method attaches a file to an asset.

Throws:
IOException

getRepository

public RulesRepository getRepository()

setRepository

public void setRepository(RulesRepository repository)

loadFileAttachmentByUUID

@Restrict(value="#{identity.loggedIn}")
public String loadFileAttachmentByUUID(String uuid,
                                                OutputStream out)
                                throws IOException
The get returns files based on UUID of an asset.

Throws:
IOException

getFormData

public static FormData getFormData(javax.servlet.http.HttpServletRequest request)
Get the form data from the inbound request.


loadBinaryPackage

public String loadBinaryPackage(String packageName,
                                String packageVersion,
                                boolean isLatest,
                                OutputStream out)
                         throws IOException
Load up the appropriate package version.

Parameters:
packageName - The name of the package.
packageVersion - The version (if it is a snapshot).
isLatest - true if the latest package binary will be used (ie NOT a snapshot).
Returns:
The filename if its all good.
Throws:
IOException

loadSourcePackage

public String loadSourcePackage(String packageName,
                                String packageVersion,
                                boolean isLatest,
                                OutputStream out)
                         throws IOException
Load up the approproate package version.

Parameters:
packageName - The name of the package.
packageVersion - The version (if it is a snapshot).
isLatest - true if the latest package binary will be used (ie NOT a snapshot).
Returns:
The filename if its all good.
Throws:
IOException

exportPackageFromRepository

public byte[] exportPackageFromRepository(String packageName)

isPackageExist

public boolean isPackageExist(String packageName)

exportRulesRepository

public void exportRulesRepository(OutputStream out)

importRulesRepository

@Restrict(value="#{identity.loggedIn}")
public void importRulesRepository(InputStream in)

importPackageToRepository

@Restrict(value="#{identity.loggedIn}")
public void importPackageToRepository(byte[] data,
                                               boolean importAsNew)

importClassicDRL

@Restrict(value="#{identity.loggedIn}")
public String importClassicDRL(InputStream drlStream,
                                        String packageName)
                        throws IOException,
                               org.drools.compiler.DroolsParserException
This will import DRL from a drl file into a more normalised structure. If the package does not exist, it will be created. If it does, it will be "merged" in the sense that any new rules in the drl will be created as new assets in the repo, everything else will stay as it was in the repo.

Parameters:
packageName - Name for this package. Overrides the one in the DRL.
Throws:
IOException
org.drools.compiler.DroolsParserException

getLastModified

public long getLastModified(String name,
                            String version)
This will return the last time the package was built.


loadSourceAsset

public String loadSourceAsset(String packageName,
                              String packageVersion,
                              boolean isLatest,
                              String assetName,
                              ByteArrayOutputStream out)
                       throws IOException
Throws:
IOException

close

@Destroy
public void close()


Copyright © 2001-2012 JBoss by Red Hat. All Rights Reserved.