Skip to content

Commit

Permalink
GuvnorNG. ModuleAssembler generated binary extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jervisliu committed Jan 29, 2012
1 parent 6ba1602 commit c8a7945
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public interface ModuleAssembler {
public boolean isModuleConfigurationInError();

public byte[] getCompiledBinary();
public String getBinaryExtension();
public String getCompiledSource();

public boolean hasErrors();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public byte[] getCompiledBinary() {
//NOT_IMPLEMENTED
return null;
}
public String getBinaryExtension() {
return "pkg";
}

public String getCompiledSource() {
//NOT_IMPLEMENTED
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public static FormData getFormData(HttpServletRequest request) {
* @param packageVersion The version (if it is a snapshot).
* @param isLatest true if the latest package binary will be used (ie NOT a snapshot).
* @return The filename if its all good.
* @deprecated Use JAX-RS based REST API instead
*/
public String loadBinaryPackage(String packageName,
String packageVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ public Response getPackageSource(@PathParam("packageName") String packageName) {
public Response getPackageBinary(@PathParam("packageName") String packageName) throws SerializationException {
try {
ModuleItem p = rulesRepository.loadModule(packageName);
String fileName = packageName + ".pkg";

ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(p.getFormat(), p, null);

String fileName = packageName + "." + moduleAssembler.getBinaryExtension();
byte[] result;
if (p.isBinaryUpToDate()) {
result = p.getCompiledBinaryBytes();
Expand Down Expand Up @@ -312,7 +315,8 @@ public Response getHistoricalPackageBinary(@PathParam("packageName") String pack
ModuleItem p = rulesRepository.loadModule(packageName, versionNumber);
byte[] result = p.getCompiledBinaryBytes();
if (result != null) {
String fileName = packageName + ".pkg";
ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(p.getFormat(), p, null);
String fileName = packageName + "." + moduleAssembler.getBinaryExtension();
return Response.ok(result).header("Content-Disposition", "attachment; filename=" + fileName).
header("Last-Modified", createDateFormat().format(this.convertToGmt(p.getLastModified()).getTime())).build();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ClientBundle.Source;

public interface Images
extends
Expand Down Expand Up @@ -344,4 +345,6 @@ public interface Images
@Source("images/mandatory.png")
ImageResource mandatory();

@Source("images/info-large.png")
ImageResource infoLarge();
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public String getCompiledSource() {
//NOT_APPLICABLE
return null;
}

public String getBinaryExtension() {
return "zip";
}
protected InputStream generateZip() {
List<AssetItem> jarAssets = new LinkedList<AssetItem>();
AssetZipper assetZipper = null;
Expand Down

0 comments on commit c8a7945

Please sign in to comment.