Author: jonesde
Date: Tue Oct 23 02:52:49 2007 New Revision: 587433 URL: http://svn.apache.org/viewvc?rev=587433&view=rev Log: Fairly significant update to correct a long-standing problem; reverted ByteWrapper back for backward compatibility, and then replaced all use of ByteWrapper with java.nio.ByteBuffer; the main point is to both store only the byte[] data in the database and not a serialized object containing the byte[], and at the same time be able to read the old ByteWrapper objects, and there is a service to read and update all old data to be plan bytes instead of wrapped in a serialized object; this includes changing the java-type for blob fields to be java.sql.Blob to greater compatibility and flexibility, ie you can either set a plain byte[] or you can pass in a Blob object to be persisted, you can also get both as get returns java.sql.Blob, but getBytes always returns the byte[], converting as needed; this is tested a fair amount, but obviously needs to be watched as it is new code Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/layout/LayoutEvents.xml ofbiz/trunk/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml ofbiz/trunk/applications/content/servicedef/services.xml ofbiz/trunk/applications/content/servicedef/services_data.xml ofbiz/trunk/applications/content/servicedef/services_survey.xml ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/view/SimpleContentViewHandler.java ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleEvents.xml ofbiz/trunk/applications/party/servicedef/services.xml ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java ofbiz/trunk/applications/product/src/org/ofbiz/product/promo/PromoServices.java ofbiz/trunk/framework/common/servicedef/services_test.xml ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java ofbiz/trunk/framework/entity/fieldtype/fieldtypeadvantage.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypeaxion.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypecloudscape.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypedaffodil.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypederby.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypefirebird.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypehsql.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypemssql.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypemysql.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypeoracle.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypepostgres.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypesapdb.xml ofbiz/trunk/framework/entity/fieldtype/fieldtypesybase.xml ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SQLProcessor.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/ByteWrapper.java ofbiz/trunk/framework/entityext/servicedef/services.xml ofbiz/trunk/framework/entityext/src/org/ofbiz/entityext/data/EntityDataServices.java ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/event/ServiceEventHandler.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/layout/LayoutEvents.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/layout/LayoutEvents.xml?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/script/org/ofbiz/content/layout/LayoutEvents.xml (original) +++ ofbiz/trunk/applications/content/script/org/ofbiz/content/layout/LayoutEvents.xml Tue Oct 23 02:52:49 2007 @@ -180,7 +180,7 @@ <string value="imageData"/> </call-class-method> - <call-class-method class-name="org.ofbiz.content.layout.LayoutWorker" method-name="returnByteWrapper" ret-field-name="byteWrap"> + <call-class-method class-name="org.ofbiz.content.layout.LayoutWorker" method-name="returnByteBuffer" ret-field-name="byteWrap"> <field field-name="formInput" type="java.util.Map"/> </call-class-method> Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml (original) +++ ofbiz/trunk/applications/content/script/org/ofbiz/content/survey/SurveyServices.xml Tue Oct 23 02:52:49 2007 @@ -751,7 +751,7 @@ </if-compare> <if-compare field-name="surveyQuestionAndAppl.surveyQuestionTypeId" operator="equals" value="CONTENT"> <!-- <log level="always" message="Found CONTENT type question"/> --> - <if-instance-of field-name="answers.${currentFieldName}" class="org.ofbiz.entity.util.ByteWrapper"> + <if-instance-of field-name="answers.${currentFieldName}" class="java.nio.ByteBuffer"> <set from-field="answers._${surveyQuestionAndAppl.surveyQuestionId}_contentType" field="partyContent._uploadedFile_contentType"/> <set from-field="answers._${surveyQuestionAndAppl.surveyQuestionId}_fileName" field="partyContent._uploadedFile_fileName"/> <set from-field="answers.${currentFieldName}" field="partyContent.uploadedFile"/> Modified: ofbiz/trunk/applications/content/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services.xml?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/servicedef/services.xml (original) +++ ofbiz/trunk/applications/content/servicedef/services.xml Tue Oct 23 02:52:49 2007 @@ -26,7 +26,7 @@ <!-- interfaces --> <service name="uploadFileInterface" engine="interface"> <description>Contains necessary paramters for all file upload requests via service event handler</description> - <attribute name="uploadedFile" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="true"/> + <attribute name="uploadedFile" type="java.nio.ByteBuffer" mode="IN" optional="true"/> <attribute name="_uploadedFile_fileName" type="String" mode="IN" optional="true" /> <attribute name="_uploadedFile_contentType" type="String" mode="IN" optional="false"/> </service> @@ -455,7 +455,7 @@ <attribute mode="IN" name="targetOperationString" optional="true" type="String"/> <attribute mode="IN" name="contentPurposeString" optional="true" type="String"/> <attribute mode="IN" name="userLogin" optional="true" type="GenericValue"/> - <attribute mode="IN" name="imageData" optional="true" type="org.ofbiz.entity.util.ByteWrapper"/> + <attribute mode="IN" name="imageData" optional="true" type="java.nio.ByteBuffer"/> <attribute mode="IN" name="_imageData_contentType" optional="true" type="String"/> <attribute mode="IN" name="_imageData_fileName" optional="true" type="String"/> <attribute mode="IN" name="deactivateExisting" optional="true" type="String"/> @@ -486,7 +486,7 @@ <attribute mode="IN" name="targetOperationString" optional="true" type="String"/> <attribute mode="IN" name="contentPurposeString" optional="true" type="String"/> <attribute mode="IN" name="userLogin" optional="true" type="GenericValue"/> - <attribute mode="IN" name="imageData" optional="true" type="org.ofbiz.entity.util.ByteWrapper"/> + <attribute mode="IN" name="imageData" optional="true" type="java.nio.ByteBuffer"/> <attribute mode="IN" name="_imageData_contentType" optional="true" type="String"/> <attribute mode="IN" name="_imageData_fileName" optional="true" type="String"/> <attribute mode="IN" name="forceElectronicText" optional="true" type="String"/> @@ -743,14 +743,14 @@ location="org.ofbiz.content.data.DataServices" invoke="updateImage"> <description>Update image</description> <attribute name="dataResourceId" type="String" mode="IN" optional="false"/> - <attribute name="imageData" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="false"/> + <attribute name="imageData" type="java.nio.ByteBuffer" mode="IN" optional="false"/> </service> <service name="createImage" engine="java" transaction-timeout="72000" location="org.ofbiz.content.data.DataServices" invoke="createImage"> <description>Create image</description> <attribute name="dataResourceId" type="String" mode="IN" optional="false"/> - <attribute name="imageData" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="false"/> + <attribute name="imageData" type="java.nio.ByteBuffer" mode="IN" optional="false"/> </service> <service name="updateContentSubscription" engine="java" transaction-timeout="72000" auth="true" @@ -991,15 +991,15 @@ </service> <!-- Open Office Services --> - <service name="convertDocumentByteWrapper" auth="false" engine="java" transaction-timeout="72000" - location="org.ofbiz.content.openoffice.OpenOfficeServices" invoke="convertDocumentByteWrapper"> + <service name="convertDocumentByteBuffer" auth="false" engine="java" transaction-timeout="72000" + location="org.ofbiz.content.openoffice.OpenOfficeServices" invoke="convertDocumentByteBuffer"> <description>Use OpenOffice to convert between document types</description> <attribute name="oooHost" type="String" mode="IN" optional="true"/> <attribute name="oooPort" type="String" mode="IN" optional="true"/> <attribute name="inputMimeType" type="String" mode="IN" optional="true"/> <attribute name="outputMimeType" type="String" mode="IN" optional="true"/> - <attribute name="inByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="false"/> - <attribute name="outByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="OUT" optional="false"/> + <attribute name="inByteBuffer" type="java.nio.ByteBuffer" mode="IN" optional="false"/> + <attribute name="outByteBuffer" type="java.nio.ByteBuffer" mode="OUT" optional="false"/> </service> <service name="convertDocument" auth="false" engine="java" transaction-timeout="72000" location="org.ofbiz.content.openoffice.OpenOfficeServices" invoke="convertDocument"> @@ -1041,7 +1041,7 @@ <attribute name="https" type="String" mode="IN" optional="true"/> <attribute name="rootDir" type="String" mode="IN" optional="true"/> <attribute name="locale" type="java.util.Locale" mode="IN" optional="true"/> - <attribute name="outByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="OUT" optional="false"/> + <attribute name="outByteBuffer" type="java.nio.ByteBuffer" mode="OUT" optional="false"/> </service> <service name="renderContentPdf" engine="java" location="org.ofbiz.content.compdoc.CompDocServices" @@ -1053,7 +1053,7 @@ <attribute name="https" type="String" mode="IN" optional="true"/> <attribute name="rootDir" type="String" mode="IN" optional="true"/> <attribute name="locale" type="java.util.Locale" mode="IN" optional="true"/> - <attribute name="outByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="OUT" optional="false"/> + <attribute name="outByteBuffer" type="java.nio.ByteBuffer" mode="OUT" optional="false"/> </service> <!-- blog services --> Modified: ofbiz/trunk/applications/content/servicedef/services_data.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_data.xml?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/servicedef/services_data.xml (original) +++ ofbiz/trunk/applications/content/servicedef/services_data.xml Tue Oct 23 02:52:49 2007 @@ -220,7 +220,7 @@ <description>Create a File</description> <implements service="createDataResource"/> <attribute mode="IN" name="dataResource" optional="true" type="GenericValue"/> - <attribute mode="IN" name="binData" optional="true" type="org.ofbiz.entity.util.ByteWrapper"/> + <attribute mode="IN" name="binData" optional="true" type="java.nio.ByteBuffer"/> <attribute mode="IN" name="textData" optional="true" type="String"/> <attribute mode="IN" name="rootDir" optional="true" type="String"/> <attribute mode="IN" name="dataResourceTypeId" optional="true" type="String"/> @@ -235,7 +235,7 @@ location="org.ofbiz.content.data.DataServices" invoke="updateFile" auth="true"> <description>Update a File</description> <attribute mode="IN" name="dataResource" optional="true" type="GenericValue"/> - <attribute mode="IN" name="binData" optional="true" type="org.ofbiz.entity.util.ByteWrapper"/> + <attribute mode="IN" name="binData" optional="true" type="java.nio.ByteBuffer"/> <attribute mode="IN" name="textData" optional="true" type="String"/> <attribute mode="IN" name="rootDir" optional="true" type="String"/> <attribute mode="IN" name="dataResourceTypeId" optional="true" type="String"/> Modified: ofbiz/trunk/applications/content/servicedef/services_survey.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_survey.xml?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/servicedef/services_survey.xml (original) +++ ofbiz/trunk/applications/content/servicedef/services_survey.xml Tue Oct 23 02:52:49 2007 @@ -306,7 +306,7 @@ <description>Create a Survey and related entities from AcroForm</description> <attribute name="pdfFileNameIn" type="String" mode="IN" optional="true" /> <attribute name="contentId" type="String" mode="IN" optional="true" /> - <attribute name="inputByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="true" /> + <attribute name="inputByteBuffer" type="java.nio.ByteBuffer" mode="IN" optional="true" /> <attribute name="surveyName" type="String" mode="IN" optional="true" /> <attribute name="surveyId" type="String" mode="INOUT" optional="true"/> </service> @@ -316,7 +316,7 @@ <description>Create a Survey and related entities from AcroForm</description> <attribute name="pdfFileNameIn" type="String" mode="IN" optional="true" /> <attribute name="contentId" type="String" mode="IN" optional="true" /> - <attribute name="inputByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="true" /> + <attribute name="inputByteBuffer" type="java.nio.ByteBuffer" mode="IN" optional="true" /> <attribute name="surveyId" type="String" mode="IN" optional="true"/> <attribute name="partyId" type="String" mode="IN" optional="true"/> <attribute name="surveyResponseId" type="String" mode="INOUT" optional="true"/> @@ -327,7 +327,7 @@ <description>Get fields from AcroForm</description> <attribute name="pdfFileNameIn" type="String" mode="IN" optional="true" /> <attribute name="contentId" type="String" mode="IN" optional="true" /> - <attribute name="inputByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="true" /> + <attribute name="inputByteBuffer" type="java.nio.ByteBuffer" mode="IN" optional="true" /> <attribute name="acroFieldMap" type="Map" mode="OUT" optional="false"/> </service> @@ -336,9 +336,9 @@ <description>Get fields from AcroForm</description> <attribute name="pdfFileNameIn" type="String" mode="IN" optional="true" /> <attribute name="contentId" type="String" mode="IN" optional="true" /> - <attribute name="inputByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="true" /> + <attribute name="inputByteBuffer" type="java.nio.ByteBuffer" mode="IN" optional="true" /> <attribute name="surveyResponseId" type="String" mode="IN" optional="false" /> - <attribute name="outByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="OUT" optional="true" /> + <attribute name="outByteBuffer" type="java.nio.ByteBuffer" mode="OUT" optional="true" /> </service> <service name="setAcroFields" engine="java" @@ -346,16 +346,16 @@ <description>Get fields from AcroForm</description> <attribute name="pdfFileNameIn" type="String" mode="IN" optional="true" /> <attribute name="contentId" type="String" mode="IN" optional="true" /> - <attribute name="inputByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="IN" optional="true" /> + <attribute name="inputByteBuffer" type="java.nio.ByteBuffer" mode="IN" optional="true" /> <attribute name="acroFieldMap" type="Map" mode="IN" optional="false"/> - <attribute name="outByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="OUT" optional="true" /> + <attribute name="outByteBuffer" type="java.nio.ByteBuffer" mode="OUT" optional="true" /> </service> <service name="buildPdfFromSurveyResponse" engine="java" location="org.ofbiz.content.survey.PdfSurveyServices" invoke="buildPdfFromSurveyResponse" auth="false"> <description>Build Pdf From Survey Response</description> <attribute name="surveyResponseId" type="String" mode="IN" optional="false" /> - <attribute name="outByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="OUT" optional="false" /> + <attribute name="outByteBuffer" type="java.nio.ByteBuffer" mode="OUT" optional="false" /> </service> <service name="buildSurveyQuestionsAndAnswers" engine="java" location="org.ofbiz.content.survey.PdfSurveyServices" invoke="buildSurveyQuestionsAndAnswers" auth="false"> Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/ContentManagementServices.java Tue Oct 23 02:52:49 2007 @@ -18,6 +18,7 @@ *******************************************************************************/ package org.ofbiz.content; +import java.nio.ByteBuffer; import java.sql.Timestamp; import java.util.Calendar; import java.util.ArrayList; @@ -47,7 +48,6 @@ import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.ModelUtil; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.security.Security; import org.ofbiz.service.DispatchContext; @@ -94,7 +94,7 @@ view = ContentWorker.getSubContentCache( delegator, contentId, mapKey, subContentId, userLogin, assocTypes, fromDate, Boolean.FALSE, null); content = ContentWorker.getContentFromView(view); } catch(GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } Map results = ServiceUtil.returnSuccess(); @@ -117,7 +117,7 @@ try { view = ContentWorker.getContentCache( delegator, contentId); } catch(GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } Map results = ServiceUtil.returnSuccess(); @@ -262,11 +262,14 @@ try { dataResourceResult = persistDataResourceAndDataMethod(dctx, context); } catch (GenericServiceException e) { - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e, e.toString(), module); + return ServiceUtil.returnError(e.toString()); } catch (GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e, e.toString(), module); + return ServiceUtil.returnError(e.toString()); } catch (Exception e) { - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e, e.toString(), module); + return ServiceUtil.returnError(e.toString()); } String errorMsg = ServiceUtil.getErrorMessage(dataResourceResult); if (UtilValidate.isNotEmpty(errorMsg)) { @@ -292,7 +295,7 @@ GenericValue val = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); if (val == null) contentExists = false; } catch(GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } } //List targetOperations = new ArrayList(); @@ -348,7 +351,7 @@ } } } catch(GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } } @@ -423,9 +426,9 @@ } } } catch (GenericEntityException e) { - throw new GenericServiceException(e.getMessage()); + throw new GenericServiceException(e.toString()); } catch (Exception e2) { - throw new GenericServiceException(e2.getMessage()); + throw new GenericServiceException(e2.toString()); } String errMsg = ServiceUtil.getErrorMessage(thisResult); if (UtilValidate.isNotEmpty(errMsg)) { @@ -467,7 +470,7 @@ try { siteRoles = delegator.findByAndCache("RoleType", UtilMisc.toMap("parentTypeId", "BLOG")); } catch(GenericEntityException e) { - return ServiceUtil.returnError( e.getMessage()); + return ServiceUtil.returnError( e.toString()); } Iterator siteRoleIter = siteRoles.iterator(); @@ -490,7 +493,7 @@ serviceContext.put("roleTypeId", siteRole); if (siteRoleVal != null && siteRoleVal.equalsIgnoreCase("Y")) { // for now, will assume that any error is due to duplicates - ignore - //return ServiceUtil.returnError(e.getMessage()); + //return ServiceUtil.returnError(e.toString()); if (fromDate == null ) { try { Map newContext = new HashMap(); @@ -507,17 +510,17 @@ return ServiceUtil.returnError(errMsg); //addRoleToUser(delegator, dispatcher, serviceContext); } catch (GenericServiceException e) { - Debug.logError(e, e.getMessage(), module); - return ServiceUtil.returnError( e.getMessage()); + Debug.logError(e, e.toString(), module); + return ServiceUtil.returnError( e.toString()); } catch (Exception e2) { - Debug.logError(e2, e2.getMessage(), module); - return ServiceUtil.returnError( e2.getMessage()); + Debug.logError(e2, e2.toString(), module); + return ServiceUtil.returnError( e2.toString()); } } } else { if (fromDate != null ) { // for now, will assume that any error is due to non-existence - ignore - //return ServiceUtil.returnError(e.getMessage()); + //return ServiceUtil.returnError(e.toString()); try { Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, module); //Timestamp thruDate = UtilDateTime.nowTimestamp(); @@ -533,11 +536,11 @@ if (UtilValidate.isNotEmpty(errMsg)) return ServiceUtil.returnError(errMsg); } catch (GenericServiceException e) { - Debug.logError(e, e.getMessage(), module); - return ServiceUtil.returnError( e.getMessage()); + Debug.logError(e, e.toString(), module); + return ServiceUtil.returnError( e.toString()); } catch (Exception e2) { - Debug.logError(e2, e2.getMessage(), module); - return ServiceUtil.returnError( e2.getMessage()); + Debug.logError(e2, e2.toString(), module); + return ServiceUtil.returnError( e2.toString()); } } } @@ -563,11 +566,14 @@ return ServiceUtil.returnError("no access to upload image"); } } catch (GenericServiceException e) { - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e, e.toString(), module); + return ServiceUtil.returnError(e.toString()); } catch (GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e, e.toString(), module); + return ServiceUtil.returnError(e.toString()); } catch (Exception e) { - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e, e.toString(), module); + return ServiceUtil.returnError(e.toString()); } String errorMsg = ServiceUtil.getErrorMessage(result); if (UtilValidate.isNotEmpty(errorMsg)) { @@ -606,7 +612,7 @@ if (val == null) dataResourceExists = false; } catch(GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } } GenericValue userLogin = (GenericValue) context.get("userLogin"); @@ -616,9 +622,9 @@ newDrContext.putAll(ctx); newDrContext.put("userLogin", userLogin); newDrContext.put("skipPermissionCheck", context.get("skipPermissionCheck")); - ByteWrapper byteWrapper = (ByteWrapper)context.get("imageData"); + ByteBuffer imageDataBytes = (ByteBuffer) context.get("imageData"); String mimeTypeId = (String) newDrContext.get("mimeTypeId"); - if (byteWrapper != null && (mimeTypeId == null || (mimeTypeId.indexOf("image") >= 0) || (mimeTypeId.indexOf("application") >= 0))) { + if (imageDataBytes != null && (mimeTypeId == null || (mimeTypeId.indexOf("image") >= 0) || (mimeTypeId.indexOf("application") >= 0))) { mimeTypeId = (String) context.get("_imageData_contentType"); if (dataResourceTypeId.equals("IMAGE_OBJECT")) { String fileName = (String) context.get("_imageData_fileName"); @@ -644,8 +650,8 @@ fileContext.put("textData", textData); hasData = true; } - if (byteWrapper != null) { - fileContext.put("binData", byteWrapper); + if (imageDataBytes != null) { + fileContext.put("binData", imageDataBytes); hasData = true; } if (hasData) { @@ -659,16 +665,16 @@ } } } else if (dataResourceTypeId.equals("IMAGE_OBJECT")) { - if (byteWrapper != null) { + if (imageDataBytes != null) { fileContext.put("dataResourceId", dataResourceId); - fileContext.put("imageData", byteWrapper); + fileContext.put("imageData", imageDataBytes); thisResult = dispatcher.runSync("createImage", fileContext); errorMsg = ServiceUtil.getErrorMessage(thisResult); if (UtilValidate.isNotEmpty(errorMsg)) { return ServiceUtil.returnError(errorMsg); } } else { - //return ServiceUtil.returnError("'byteWrapper' empty when trying to create database image."); + //return ServiceUtil.returnError("'byteBuffer' empty when trying to create database image."); } } else if (dataResourceTypeId.equals("SHORT_TEXT")) { } else if (dataResourceTypeId.startsWith("SURVEY")) { @@ -703,8 +709,8 @@ fileContext.put("textData", textData); hasData = true; } - if (byteWrapper != null) { - fileContext.put("binData", byteWrapper); + if (imageDataBytes != null) { + fileContext.put("binData", imageDataBytes); hasData = true; } if (hasData || "true".equalsIgnoreCase(forceElectronicText)) { @@ -718,9 +724,9 @@ } } } else if (dataResourceTypeId.equals("IMAGE_OBJECT")) { - if (byteWrapper != null || "true".equalsIgnoreCase(forceElectronicText)) { + if (imageDataBytes != null || "true".equalsIgnoreCase(forceElectronicText)) { fileContext.put("dataResourceId", dataResourceId); - fileContext.put("imageData", byteWrapper); + fileContext.put("imageData", imageDataBytes); Debug.logInfo("====trying to update image", module); thisResult = dispatcher.runSync("updateImage", fileContext); errorMsg = ServiceUtil.getErrorMessage(thisResult); @@ -728,7 +734,7 @@ return ServiceUtil.returnError(errorMsg); } } else { - return ServiceUtil.returnError("'byteWrapper' empty when trying to create database image."); + return ServiceUtil.returnError("'byteBuffer' empty when trying to create database image."); } } else if (dataResourceTypeId.equals("SHORT_TEXT")) { } else if (dataResourceTypeId.startsWith("SURVEY")) { @@ -786,7 +792,7 @@ try { siteRoles = delegator.findByAndCache("RoleType", UtilMisc.toMap("parentTypeId", "BLOG")); } catch(GenericEntityException e) { - return ServiceUtil.returnError( e.getMessage()); + return ServiceUtil.returnError( e.toString()); } Iterator siteRoleIter = siteRoles.iterator(); while (siteRoleIter.hasNext()) { @@ -800,7 +806,7 @@ serviceContext.put("roleTypeId", siteRole); if (siteRoleVal != null && siteRoleVal.equalsIgnoreCase("Y")) { // for now, will assume that any error is due to duplicates - ignore - //return ServiceUtil.returnError(e.getMessage()); + //return ServiceUtil.returnError(e.toString()); if (fromDate == null ) { try { serviceContext.put("fromDate", UtilDateTime.nowTimestamp()); @@ -808,15 +814,15 @@ addRoleToUser(delegator, dispatcher, serviceContext); Map permResults = dispatcher.runSync("createContentRole", serviceContext); } catch (GenericServiceException e) { - Debug.logError(e, e.getMessage(), module); + Debug.logError(e, e.toString(), module); } catch (Exception e2) { - Debug.logError(e2, e2.getMessage(), module); + Debug.logError(e2, e2.toString(), module); } } } else { if (fromDate != null ) { // for now, will assume that any error is due to non-existence - ignore - //return ServiceUtil.returnError(e.getMessage()); + //return ServiceUtil.returnError(e.toString()); try { Debug.logInfo("updateSiteRoles, serviceContext(2):" + serviceContext, module); //Timestamp thruDate = UtilDateTime.nowTimestamp(); @@ -828,9 +834,9 @@ newContext.put("roleTypeId", serviceContext.get("roleTypeId")); Map permResults = dispatcher.runSync("deactivateAllContentRoles", newContext); } catch (GenericServiceException e) { - Debug.logError(e, e.getMessage(), module); + Debug.logError(e, e.toString(), module); } catch (Exception e2) { - Debug.logError(e2, e2.getMessage(), module); + Debug.logError(e2, e2.toString(), module); } } } @@ -879,7 +885,7 @@ } catch (GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return results; } @@ -931,7 +937,7 @@ contentAssoc.put("sequenceNum", prevSeqNum); contentAssoc.store(); } catch (Exception e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } } } else { @@ -958,7 +964,7 @@ } } catch(GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } @@ -1016,7 +1022,7 @@ try { Map thisResult = dispatcher.runSync("persistContentAndAssoc", serviceIn); } catch(ServiceAuthException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } List typeList = UtilMisc.toList("SUB_CONTENT"); @@ -1025,7 +1031,7 @@ } catch(GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } @@ -1045,7 +1051,7 @@ result.put("leafCount", new Integer(leafCount)); } catch(GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return result; } @@ -1108,7 +1114,7 @@ } catch(GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return result; } @@ -1155,7 +1161,7 @@ } } catch(GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return results; @@ -1201,7 +1207,7 @@ } } catch(GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return results; @@ -1338,7 +1344,7 @@ results.put("_LIST_", lst); } catch(GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return results; } @@ -1401,7 +1407,7 @@ ContentManagementWorker.updateStatsBottomUp(delegator, contentId, UtilMisc.toList(contentAssocTypeId), changeBranchCount, changeLeafCount); } catch(GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return result; } @@ -1427,7 +1433,7 @@ ContentManagementWorker.updateStatsBottomUp(delegator, contentId, UtilMisc.toList(contentAssocTypeId), changeBranchCount, changeLeafCount); } catch(GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return result; } @@ -1448,7 +1454,7 @@ try { ContentManagementWorker.updateStatsTopDown(delegator, contentId, typeList); } catch(GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return result; } @@ -1476,7 +1482,7 @@ hasExistingContentRole = true; } } catch (GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } if (contentRole == null) { @@ -1527,7 +1533,7 @@ contentRole.create(); } } catch (GenericEntityException e) { - return ServiceUtil.returnError(e.getMessage()); + return ServiceUtil.returnError(e.toString()); } return result; } @@ -1558,8 +1564,8 @@ productContent = (GenericValue) listOrdered.get(0); } } catch(GenericEntityException e) { - Debug.logError(e.getMessage(), module); - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e.toString(), module); + return ServiceUtil.returnError(e.toString()); } if (productContent == null) { String msg = "No ProductContent found for productId:" + productId; @@ -1622,8 +1628,8 @@ } } } catch(GenericEntityException e) { - Debug.logError(e.getMessage(), module); - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e.toString(), module); + return ServiceUtil.returnError(e.toString()); } return result; } @@ -1656,8 +1662,8 @@ GenericValue content = delegator.findByPrimaryKey("Content", UtilMisc.toMap("contentId", contentId)); result = followNodeChildrenMethod(content, dispatcher, serviceName, ctx); } catch(GenericEntityException e) { - Debug.logError(e.getMessage(), module); - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e.toString(), module); + return ServiceUtil.returnError(e.toString()); } return result; } @@ -1708,8 +1714,8 @@ try { dataResource = delegator.findByPrimaryKey("DataResource", UtilMisc.toMap("dataResourceId", oldDataResourceId)); } catch(GenericEntityException e) { - Debug.logError(e.getMessage(), module); - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e.toString(), module); + return ServiceUtil.returnError(e.toString()); } } @@ -1755,8 +1761,8 @@ } } catch (GenericServiceException e) { - Debug.logError(e.getMessage(), module); - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e.toString(), module); + return ServiceUtil.returnError(e.toString()); } return result; } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocEvents.java Tue Oct 23 02:52:49 2007 @@ -20,6 +20,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; +import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Locale; import java.util.Map; @@ -40,7 +41,6 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; @@ -151,7 +151,7 @@ public static String genCompDocPdf(HttpServletRequest request, HttpServletResponse response) { String responseStr = "success"; - //ByteWrapper byteWrapper = null; + //ByteBuffer byteBuffer = null; HttpSession session = request.getSession(); GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); ServletContext servletContext = session.getServletContext(); @@ -200,23 +200,23 @@ return "error"; } - ByteWrapper outByteWrapper = (ByteWrapper)results.get("outByteWrapper"); + ByteBuffer outByteBuffer = (ByteBuffer) results.get("outByteBuffer"); // setup content type String contentType = "application/pdf; charset=ISO-8859-1"; - ByteArrayInputStream bais = new ByteArrayInputStream(outByteWrapper.getBytes()); + ByteArrayInputStream bais = new ByteArrayInputStream(outByteBuffer.array()); /* try { FileOutputStream fos = new FileOutputStream("/home/byersa/pdftest.pdf"); - fos.write(outByteWrapper.getBytes()); + fos.write(outByteBuffer.getBytes()); } catch(FileNotFoundException e) { } catch(IOException e) { } */ try { - UtilHttp.streamContentToBrowser(response, bais, outByteWrapper.getLength(), contentType); + UtilHttp.streamContentToBrowser(response, bais, outByteBuffer.limit(), contentType); } catch(IOException e) { request.setAttribute("_ERROR_MESSAGE_", e.toString()); return "error"; @@ -225,7 +225,7 @@ } public static String genContentPdf(HttpServletRequest request, HttpServletResponse response) { String responseStr = "success"; - //ByteWrapper byteWrapper = null; + //ByteBuffer byteBuffer = null; HttpSession session = request.getSession(); GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); ServletContext servletContext = session.getServletContext(); @@ -274,24 +274,24 @@ return "error"; } - ByteWrapper outByteWrapper = (ByteWrapper)results.get("outByteWrapper"); + ByteBuffer outByteBuffer = (ByteBuffer) results.get("outByteBuffer"); // setup content type String contentType = "application/pdf; charset=ISO-8859-1"; - ByteArrayInputStream bais = new ByteArrayInputStream(outByteWrapper.getBytes()); + ByteArrayInputStream bais = new ByteArrayInputStream(outByteBuffer.array()); /* try { FileOutputStream fos = new FileOutputStream("/home/byersa/pdftest.pdf"); - fos.write(outByteWrapper.getBytes()); + fos.write(outByteBuffer.getBytes()); fos.close(); } catch(FileNotFoundException e) { } catch(IOException e) { } */ try { - UtilHttp.streamContentToBrowser(response, bais, outByteWrapper.getLength(), contentType); + UtilHttp.streamContentToBrowser(response, bais, outByteBuffer.limit(), contentType); } catch(IOException e) { request.setAttribute("_ERROR_MESSAGE_", e.toString()); return "error"; Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/compdoc/CompDocServices.java Tue Oct 23 02:52:49 2007 @@ -20,6 +20,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.nio.ByteBuffer; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; @@ -40,7 +41,6 @@ import org.ofbiz.entity.condition.EntityConditionList; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -199,12 +199,12 @@ byte [] inputByteArray = null; PdfReader reader = null; if (inputMimeType != null && inputMimeType.equals("application/pdf")) { - ByteWrapper byteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, thisDataResourceId, https, webSiteId, locale, rootDir); - inputByteArray = byteWrapper.getBytes(); + ByteBuffer byteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, thisDataResourceId, https, webSiteId, locale, rootDir); + inputByteArray = byteBuffer.array(); reader = new PdfReader(inputByteArray); } else if (inputMimeType != null && inputMimeType.equals("text/html")) { - ByteWrapper byteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, thisDataResourceId, https, webSiteId, locale, rootDir); - inputByteArray = byteWrapper.getBytes(); + ByteBuffer byteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, thisDataResourceId, https, webSiteId, locale, rootDir); + inputByteArray = byteBuffer.array(); String s = new String(inputByteArray); Debug.logInfo("text/html string:" + s, module); continue; @@ -236,8 +236,8 @@ return ServiceUtil.returnError("Error building PDF from SurveyResponse: ", null, null, survey2PdfResults); } - ByteWrapper outByteWrapper = (ByteWrapper)survey2PdfResults.get("outByteWrapper"); - inputByteArray = outByteWrapper.getBytes(); + ByteBuffer outByteBuffer = (ByteBuffer) survey2PdfResults.get("outByteBuffer"); + inputByteArray = outByteBuffer.array(); reader = new PdfReader(inputByteArray); } else { // Fill in acroForm @@ -246,26 +246,26 @@ return ServiceUtil.returnError("Error setting AcroFields from SurveyResponse: ", null, null, survey2AcroFieldResults); } - ByteWrapper outByteWrapper = (ByteWrapper) survey2AcroFieldResults.get("outByteWrapper"); - inputByteArray = outByteWrapper.getBytes(); + ByteBuffer outByteBuffer = (ByteBuffer) survey2AcroFieldResults.get("outByteBuffer"); + inputByteArray = outByteBuffer.array(); reader = new PdfReader(inputByteArray); } } } else { - ByteWrapper inByteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, thisDataResourceId, https, webSiteId, locale, rootDir); + ByteBuffer inByteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, thisDataResourceId, https, webSiteId, locale, rootDir); - Map convertInMap = UtilMisc.toMap("userLogin", userLogin, "inByteWrapper", inByteWrapper, "inputMimeType", inputMimeType, "outputMimeType", "application/pdf"); + Map convertInMap = UtilMisc.toMap("userLogin", userLogin, "inByteBuffer", inByteBuffer, "inputMimeType", inputMimeType, "outputMimeType", "application/pdf"); if (UtilValidate.isNotEmpty(oooHost)) convertInMap.put("oooHost", oooHost); if (UtilValidate.isNotEmpty(oooPort)) convertInMap.put("oooPort", oooPort); - Map convertResult = dispatcher.runSync("convertDocumentByteWrapper", convertInMap); + Map convertResult = dispatcher.runSync("convertDocumentByteBuffer", convertInMap); if (ServiceUtil.isError(convertResult)) { return ServiceUtil.returnError("Error in Open", null, null, convertResult); } - ByteWrapper outByteWrapper = (ByteWrapper) convertResult.get("outByteWrapper"); - inputByteArray = outByteWrapper.getBytes(); + ByteBuffer outByteBuffer = (ByteBuffer) convertResult.get("outByteBuffer"); + inputByteArray = outByteBuffer.array(); reader = new PdfReader(inputByteArray); } if (reader != null) { @@ -279,10 +279,10 @@ } } document.close(); - ByteWrapper outByteWrapper = new ByteWrapper(baos.toByteArray()); + ByteBuffer outByteBuffer = ByteBuffer.wrap(baos.toByteArray()); Map results = ServiceUtil.returnSuccess(); - results.put("outByteWrapper", outByteWrapper); + results.put("outByteBuffer", outByteBuffer); return results; } catch (GenericEntityException e) { return ServiceUtil.returnError(e.toString()); @@ -347,11 +347,11 @@ } byte [] inputByteArray = null; if (inputMimeType != null && inputMimeType.equals("application/pdf")) { - ByteWrapper byteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, dataResourceId, https, webSiteId, locale, rootDir); - inputByteArray = byteWrapper.getBytes(); + ByteBuffer byteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, dataResourceId, https, webSiteId, locale, rootDir); + inputByteArray = byteBuffer.array(); } else if (inputMimeType != null && inputMimeType.equals("text/html")) { - ByteWrapper byteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, dataResourceId, https, webSiteId, locale, rootDir); - inputByteArray = byteWrapper.getBytes(); + ByteBuffer byteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, dataResourceId, https, webSiteId, locale, rootDir); + inputByteArray = byteBuffer.array(); String s = new String(inputByteArray); Debug.logInfo("text/html string:" + s, module); } else if (inputMimeType != null && inputMimeType.equals("application/vnd.ofbiz.survey.response")) { @@ -383,8 +383,8 @@ return ServiceUtil.returnError("Error building PDF from SurveyResponse: ", null, null, survey2PdfResults); } - ByteWrapper outByteWrapper = (ByteWrapper)survey2PdfResults.get("outByteWrapper"); - inputByteArray = outByteWrapper.getBytes(); + ByteBuffer outByteBuffer = (ByteBuffer)survey2PdfResults.get("outByteBuffer"); + inputByteArray = outByteBuffer.array(); } else { // Fill in acroForm Map survey2AcroFieldResults = dispatcher.runSync("setAcroFieldsFromSurveyResponse", UtilMisc.toMap("surveyResponseId", surveyResponseId)); @@ -392,30 +392,30 @@ return ServiceUtil.returnError("Error setting AcroFields from SurveyResponse: ", null, null, survey2AcroFieldResults); } - ByteWrapper outByteWrapper = (ByteWrapper) survey2AcroFieldResults.get("outByteWrapper"); - inputByteArray = outByteWrapper.getBytes(); + ByteBuffer outByteBuffer = (ByteBuffer) survey2AcroFieldResults.get("outByteBuffer"); + inputByteArray = outByteBuffer.array(); } } } else { - ByteWrapper inByteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, dataResourceId, https, webSiteId, locale, rootDir); + ByteBuffer inByteBuffer = DataResourceWorker.getContentAsByteBuffer(delegator, dataResourceId, https, webSiteId, locale, rootDir); - Map convertInMap = UtilMisc.toMap("userLogin", userLogin, "inByteWrapper", inByteWrapper, + Map convertInMap = UtilMisc.toMap("userLogin", userLogin, "inByteBuffer", inByteBuffer, "inputMimeType", inputMimeType, "outputMimeType", "application/pdf"); if (UtilValidate.isNotEmpty(oooHost)) convertInMap.put("oooHost", oooHost); if (UtilValidate.isNotEmpty(oooPort)) convertInMap.put("oooPort", oooPort); - Map convertResult = dispatcher.runSync("convertDocumentByteWrapper", convertInMap); + Map convertResult = dispatcher.runSync("convertDocumentByteBuffer", convertInMap); if (ServiceUtil.isError(convertResult)) { return ServiceUtil.returnError("Error in Open", null, null, convertResult); } - ByteWrapper outByteWrapper = (ByteWrapper) convertResult.get("outByteWrapper"); - inputByteArray = outByteWrapper.getBytes(); + ByteBuffer outByteBuffer = (ByteBuffer) convertResult.get("outByteBuffer"); + inputByteArray = outByteBuffer.array(); } - ByteWrapper outByteWrapper = new ByteWrapper(inputByteArray); - results.put("outByteWrapper", outByteWrapper); + ByteBuffer outByteBuffer = ByteBuffer.wrap(inputByteArray); + results.put("outByteBuffer", outByteBuffer); } catch (GenericEntityException e) { return ServiceUtil.returnError(e.toString()); } catch (IOException e) { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/UploadContentAndImage.java Tue Oct 23 02:52:49 2007 @@ -41,7 +41,6 @@ import org.ofbiz.entity.model.ModelEntity; import org.ofbiz.entity.transaction.GenericTransactionException; import org.ofbiz.entity.transaction.TransactionUtil; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.SimpleMapProcessor; @@ -276,7 +275,7 @@ imgContext.put("dataResourceTypeId", dataResourceTypeId); imgContext.put("contentIdTo", ftlContentId); imgContext.put("contentAssocTypeId", "SUB_CONTENT"); - imgContext.put("imageData", new ByteWrapper(imageBytes)); + imgContext.put("imageData", imageBytes); imgContext.put("mapKey", "IMAGE"); imgContext.put("dataTemplateTypeId", "NONE"); String rootDir = request.getSession().getServletContext().getRealPath("/"); @@ -489,9 +488,8 @@ ftlContext.put("textData", passedParams.get("textData" + suffix)); byte[] bytes = (byte[])passedParams.get("imageData" + suffix); - ByteWrapper byteWrapper = new ByteWrapper(bytes); - ftlContext.put("imageData", byteWrapper); - if (Debug.infoOn()) Debug.logInfo("[UploadContentStuff]byteWrapper:" + byteWrapper, module); + ftlContext.put("imageData", bytes); + //if (Debug.infoOn()) Debug.logInfo("[UploadContentStuff]byteBuffer:" + bytes, module); //contentAssocDataResourceViewFrom.setAllFields(ftlContext2, true, null, null); //ftlContext.putAll(ftlContext2); if (Debug.infoOn()) Debug.logInfo("[UploadContentStuff]ftlContext:" + ftlContext, module); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Tue Oct 23 02:52:49 2007 @@ -21,6 +21,7 @@ import java.io.*; import java.net.URL; import java.net.URLConnection; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; @@ -51,7 +52,6 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.widget.html.HtmlScreenRenderer; @@ -1129,11 +1129,11 @@ } } - public static ByteWrapper getContentAsByteWrapper(GenericDelegator delegator, String dataResourceId, String https, String webSiteId, Locale locale, String rootDir) throws IOException, GeneralException { + public static ByteBuffer getContentAsByteBuffer(GenericDelegator delegator, String dataResourceId, String https, String webSiteId, Locale locale, String rootDir) throws IOException, GeneralException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); streamDataResource(baos, delegator, dataResourceId, https, webSiteId, locale, rootDir); - ByteWrapper byteWrapper = new ByteWrapper(baos.toByteArray()); - return byteWrapper; + ByteBuffer byteBuffer = ByteBuffer.wrap(baos.toByteArray()); + return byteBuffer; } public String renderDataResourceAsTextExt(GenericDelegator delegator, String dataResourceId, Map templateContext, Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java Tue Oct 23 02:52:49 2007 @@ -26,6 +26,7 @@ import java.io.IOException; import java.io.RandomAccessFile; import java.io.Writer; +import java.nio.ByteBuffer; import java.sql.Timestamp; import java.util.HashMap; import java.util.List; @@ -40,7 +41,6 @@ import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.ModelService; @@ -179,7 +179,7 @@ //GenericValue dataResource = (GenericValue) context.get("dataResource"); String dataResourceTypeId = (String) context.get("dataResourceTypeId"); String objectInfo = (String) context.get("objectInfo"); - ByteWrapper binData = (ByteWrapper) context.get("binData"); + ByteBuffer binData = (ByteBuffer) context.get("binData"); String textData = (String) context.get("textData"); // a few place holders @@ -228,7 +228,7 @@ } else if (binData != null) { try { RandomAccessFile out = new RandomAccessFile(file, "rw"); - out.write(binData.getBytes()); + out.write(binData.array()); out.close(); } catch (FileNotFoundException e) { Debug.logError(e, module); @@ -381,7 +381,7 @@ String dataResourceTypeId = (String) context.get("dataResourceTypeId"); String objectInfo = (String) context.get("objectInfo"); String textData = (String) context.get("textData"); - ByteWrapper binData = (ByteWrapper) context.get("binData"); + ByteBuffer binData = (ByteBuffer) context.get("binData"); String prefix = ""; File file = null; String fileName = ""; @@ -426,7 +426,7 @@ } else if (binData != null) { try { RandomAccessFile out = new RandomAccessFile(file, "rw"); - out.write(binData.getBytes()); + out.write(binData.array()); out.close(); } catch (FileNotFoundException e) { Debug.logError(e, module); @@ -495,9 +495,9 @@ GenericDelegator delegator = dctx.getDelegator(); //Locale locale = (Locale) context.get("locale"); String dataResourceId = (String) context.get("dataResourceId"); - ByteWrapper byteWrapper = (ByteWrapper)context.get("imageData"); - if (byteWrapper != null) { - byte[] imageBytes = byteWrapper.getBytes(); + ByteBuffer byteBuffer = (ByteBuffer)context.get("imageData"); + if (byteBuffer != null) { + byte[] imageBytes = byteBuffer.array(); try { GenericValue imageDataResource = delegator.findByPrimaryKey("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); if (Debug.infoOn()) Debug.logInfo("imageDataResource(U):" + imageDataResource, module); @@ -528,9 +528,9 @@ HashMap result = new HashMap(); GenericDelegator delegator = dctx.getDelegator(); String dataResourceId = (String) context.get("dataResourceId"); - ByteWrapper byteWrapper = (ByteWrapper)context.get("imageData"); - if (byteWrapper != null) { - byte[] imageBytes = byteWrapper.getBytes(); + ByteBuffer byteBuffer = (ByteBuffer)context.get("imageData"); + if (byteBuffer != null) { + byte[] imageBytes = byteBuffer.array(); try { GenericValue imageDataResource = delegator.makeValue("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); //imageDataResource.set("imageData", imageBytes); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/email/EmailWorker.java Tue Oct 23 02:52:49 2007 @@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.IOException; +import java.nio.ByteBuffer; import javax.mail.internet.MimeMessage; import javax.mail.MessagingException; @@ -34,7 +35,6 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.GenericServiceException; -import org.ofbiz.entity.util.ByteWrapper; public class EmailWorker { @@ -107,8 +107,8 @@ while ((c = is.read()) > -1) { baos.write(c); } - ByteWrapper imageData = new ByteWrapper(baos.toByteArray()); - int len = imageData.getLength(); + ByteBuffer imageData = ByteBuffer.wrap(baos.toByteArray()); + int len = imageData.limit(); if (Debug.infoOn()) Debug.logInfo("imageData length: " + len, module); commEventMap.put("drDataResourceName", part.getFileName()); commEventMap.put("imageData", imageData); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutEvents.java Tue Oct 23 02:52:49 2007 @@ -18,10 +18,9 @@ *******************************************************************************/ package org.ofbiz.content.layout; +import java.nio.ByteBuffer; import java.sql.Timestamp; -import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; @@ -30,6 +29,9 @@ import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import javolution.util.FastList; +import javolution.util.FastMap; + import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilHttp; @@ -41,7 +43,6 @@ import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericPK; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.minilang.MiniLangException; import org.ofbiz.minilang.SimpleMapProcessor; import org.ofbiz.service.GenericServiceException; @@ -65,9 +66,9 @@ HttpSession session = request.getSession(); Map uploadResults = LayoutWorker.uploadImageAndParameters(request, "imageData"); //Debug.logVerbose("in createLayoutImage(java), uploadResults:" + uploadResults, ""); - Map formInput = (Map)uploadResults.get("formInput"); - Map context = new HashMap(); - ByteWrapper byteWrap = (ByteWrapper)uploadResults.get("imageData"); + Map formInput = (Map) uploadResults.get("formInput"); + Map context = FastMap.newInstance(); + ByteBuffer byteWrap = (ByteBuffer) uploadResults.get("imageData"); if (byteWrap == null) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.image_data_null", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); @@ -83,7 +84,7 @@ imageFileNameExt = imageFileName.substring(pos + 1); } String mimeTypeId = "image/" + imageFileNameExt; - List errorMessages = new ArrayList(); + List errorMessages = FastList.newInstance(); if (locale == null) locale = Locale.getDefault(); context.put("locale", locale); @@ -121,7 +122,7 @@ String dataResourceId = (String)result.get("dataResourceId"); String activeContentId = (String)result.get("contentId"); if (UtilValidate.isNotEmpty(activeContentId)) { - Map context2 = new HashMap(); + Map context2 = FastMap.newInstance(); context2.put("activeContentId", activeContentId); //context2.put("dataResourceId", dataResourceId); context2.put("contentAssocTypeId", result.get("contentAssocTypeId")); @@ -154,12 +155,11 @@ UtilMisc.toMap("dataResourceId", dataResourceId)); //Debug.logVerbose("in createLayoutImage, imageDataResource(0):" + imageDataResource, module); if (imageDataResource == null) { - imageDataResource = delegator.makeValue("ImageDataResource", - UtilMisc.toMap("dataResourceId", dataResourceId)); - imageDataResource.set("imageData", byteWrap.getBytes()); + imageDataResource = delegator.makeValue("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); + imageDataResource.set("imageData", byteWrap.array()); imageDataResource.create(); } else { - imageDataResource.set("imageData", byteWrap.getBytes()); + imageDataResource.set("imageData", byteWrap.array()); imageDataResource.store(); } } catch (GenericEntityException e3) { @@ -179,7 +179,7 @@ HttpSession session = request.getSession(); Map uploadResults = LayoutWorker.uploadImageAndParameters(request, "imageData"); Map context = (Map)uploadResults.get("formInput"); - ByteWrapper byteWrap = (ByteWrapper)uploadResults.get("imageData"); + ByteBuffer byteWrap = (ByteBuffer)uploadResults.get("imageData"); if (byteWrap == null) { String errMsg = UtilProperties.getMessage(LayoutEvents.err_resource, "layoutEvents.image_data_null", locale); request.setAttribute("_ERROR_MESSAGE_", errMsg); @@ -218,10 +218,10 @@ if (imageDataResource == null) { imageDataResource = delegator.makeValue("ImageDataResource", UtilMisc.toMap("dataResourceId", dataResourceId)); - imageDataResource.set("imageData", byteWrap.getBytes()); + imageDataResource.set("imageData", byteWrap.array()); imageDataResource.create(); } else { - imageDataResource.set("imageData", byteWrap.getBytes()); + imageDataResource.set("imageData", byteWrap.array()); imageDataResource.store(); } } catch (GenericEntityException e3) { @@ -236,7 +236,7 @@ LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); HttpSession session = request.getSession(); Locale locale = UtilHttp.getLocale(request); - Map context = new HashMap(); + Map context = FastMap.newInstance(); Map paramMap = UtilHttp.getParameterMap(request); Debug.logVerbose("in replaceSubContent, paramMap:" + paramMap, module); String dataResourceId = (String)paramMap.get("dataResourceId"); @@ -286,7 +286,7 @@ Map result = dispatcher.runSync("persistContentAndAssoc", context); //Debug.logVerbose("in replaceSubContent, result:" + result, module); request.setAttribute("contentId", contentIdTo); - Map context2 = new HashMap(); + Map context2 = FastMap.newInstance(); context2.put("activeContentId", contentId); //context2.put("dataResourceId", dataResourceId); context2.put("contentAssocTypeId", "SUB_CONTENT"); @@ -381,7 +381,7 @@ request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); return "error"; } - Map serviceIn = new HashMap(); + Map serviceIn = FastMap.newInstance(); Map results = null; serviceIn.put("fromDate", UtilDateTime.nowTimestamp()); serviceIn.put("contentId", contentId); @@ -401,16 +401,17 @@ return "error"; } - serviceIn = new HashMap(); + serviceIn = FastMap.newInstance(); serviceIn.put("userLogin", session.getAttribute("userLogin")); // Can't count on records being unique - Map beenThere = new HashMap(); + Map beenThere = FastMap.newInstance(); for (int i=0; i<entityList.size(); i++) { GenericValue view = (GenericValue)entityList.get(i); - List errorMessages = new ArrayList(); - if (locale == null) + List errorMessages = FastList.newInstance(); + if (locale == null) { locale = Locale.getDefault(); + } try { SimpleMapProcessor.runSimpleMapProcessor( "org/ofbiz/content/ContentManagementMapProcessors.xml", "contentAssocIn", @@ -426,11 +427,7 @@ String mapKey = (String)view.get("caMapKey"); Timestamp fromDate = (Timestamp)view.get("caFromDate"); Timestamp thruDate = (Timestamp)view.get("caThruDate"); - Debug.logVerbose("in cloneLayout, contentIdFrom:" + contentIdFrom - + " fromDate:" + fromDate - + " thruDate:" + thruDate - + " mapKey:" + mapKey - , ""); + Debug.logVerbose("in cloneLayout, contentIdFrom:" + contentIdFrom + " fromDate:" + fromDate + " thruDate:" + thruDate + " mapKey:" + mapKey, ""); if (beenThere.get(contentIdFrom) == null) { serviceIn.put("contentIdFrom", contentIdFrom); serviceIn.put("contentIdTo", newId); @@ -444,7 +441,6 @@ } beenThere.put(contentIdFrom, view); } - } GenericValue view = delegator.makeValue("ContentDataResourceView"); @@ -458,8 +454,6 @@ } public static String createLayoutSubContent(HttpServletRequest request, HttpServletResponse response) { - - try { LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); HttpSession session = request.getSession(); @@ -470,11 +464,12 @@ Debug.logVerbose("in createSubContent, contentIdTo:" + contentIdTo, module); Debug.logVerbose("in createSubContent, mapKey:" + mapKey, module); } - Map context = new HashMap(); + Map context = FastMap.newInstance(); List errorMessages = null; Locale loc = (Locale)request.getSession().getServletContext().getAttribute("locale"); - if (loc == null) + if (loc == null) { loc = Locale.getDefault(); + } GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); context.put("userLogin", userLogin); @@ -517,7 +512,7 @@ request.setAttribute("contentId", contentId); request.setAttribute("drDataResourceId", dataResourceId); request.setAttribute("currentEntityName", "SubContentDataResourceId"); - Map context2 = new HashMap(); + Map context2 = FastMap.newInstance(); context2.put("activeContentId", contentId); //context2.put("dataResourceId", dataResourceId); context2.put("contentAssocTypeId", "SUB_CONTENT"); @@ -536,15 +531,13 @@ public static String updateLayoutSubContent(HttpServletRequest request, HttpServletResponse response) { - - try { LocalDispatcher dispatcher = (LocalDispatcher)request.getAttribute("dispatcher"); HttpSession session = request.getSession(); Map paramMap = UtilHttp.getParameterMap(request); String contentIdTo = (String)paramMap.get("contentIdTo"); String mapKey = (String)paramMap.get("mapKey"); - Map context = new HashMap(); + Map context = FastMap.newInstance(); List errorMessages = null; Locale loc = (Locale)request.getSession().getServletContext().getAttribute("locale"); if (loc == null) @@ -590,7 +583,7 @@ request.setAttribute("drDataResourceId", dataResourceId); request.setAttribute("currentEntityName", "SubContentDataResourceId"); /* - Map context2 = new HashMap(); + Map context2 = FastMap.newInstance(); context2.put("activeContentId", contentId); //context2.put("dataResourceId", dataResourceId); context2.put("contentAssocTypeId", "SUB_CONTENT"); Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/layout/LayoutWorker.java Tue Oct 23 02:52:49 2007 @@ -19,15 +19,16 @@ package org.ofbiz.content.layout; import java.io.File; -import java.util.HashMap; +import java.nio.ByteBuffer; import java.util.Locale; import java.util.Map; import javax.servlet.http.HttpServletRequest; +import javolution.util.FastMap; + import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.service.ServiceUtil; import org.apache.commons.fileupload.FileItem; @@ -53,8 +54,8 @@ //Debug.logVerbose("in uploadAndStoreImage", ""); Locale locale = UtilHttp.getLocale(request); - HashMap results = new HashMap(); - HashMap formInput = new HashMap(); + Map results = FastMap.newInstance(); + Map formInput = FastMap.newInstance(); results.put("formInput", formInput); ServletFileUpload fu = new ServletFileUpload(new DiskFileItemFactory(10240, new File("runtime/tmp"))); java.util.List lst = null; @@ -96,20 +97,11 @@ } byte[] imageBytes = imageFi.get(); - ByteWrapper byteWrap = new ByteWrapper(imageBytes); + ByteBuffer byteWrap = ByteBuffer.wrap(imageBytes); results.put("imageData", byteWrap); results.put("imageFileName", imageFi.getName()); //Debug.logVerbose("in uploadAndStoreImage, results:" + results, ""); return results; - } - - - public static ByteWrapper returnByteWrapper(Map map) { - - ByteWrapper byteWrap = (ByteWrapper)map.get("imageData"); - return byteWrap; - } - } Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java?rev=587433&r1=587432&r2=587433&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java Tue Oct 23 02:52:49 2007 @@ -25,6 +25,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.FileNotFoundException; +import java.nio.ByteBuffer; import java.util.Map; import java.util.Random; import java.sql.Timestamp; @@ -35,7 +36,6 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilProperties; -import org.ofbiz.entity.util.ByteWrapper; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.ServiceUtil; @@ -65,7 +65,7 @@ * This value should be operating system dependent with "\\" separators for Windows * and "/" for Linux/Unix. */ - public static Map convertDocumentByteWrapper(DispatchContext dctx, Map context) { + public static Map convertDocumentByteBuffer(DispatchContext dctx, Map context) { Map results = ServiceUtil.returnSuccess(); GenericDelegator delegator = dctx.getDelegator(); @@ -79,7 +79,7 @@ File fileIn = null; File fileOut = null; - ByteWrapper inByteWrapper = (ByteWrapper) context.get("inByteWrapper"); + ByteBuffer inByteBuffer = (ByteBuffer) context.get("inByteBuffer"); String inputMimeType = (String) context.get("inputMimeType"); String outputMimeType = (String) context.get("outputMimeType"); String extName = OpenOfficeWorker.getExtensionFromMimeType(outputMimeType); @@ -91,11 +91,11 @@ try { xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort); - byte[] inByteArray = inByteWrapper.getBytes(); + byte[] inByteArray = inByteBuffer.getBytes(); // The following line work in linux, but not Windows or Mac environment. It is preferred because it does not use temporary files //OpenOfficeByteArrayInputStream oobais = new OpenOfficeByteArrayInputStream(inByteArray); - //Debug.logInfo("Doing convertDocumentByteWrapper, inBytes size is [" + inByteArray.length + "]", module); + //Debug.logInfo("Doing convertDocumentByteBuffer, inBytes size is [" + inByteArray.length + "]", module); //OpenOfficeByteArrayOutputStream baos = OpenOfficeWorker.convertOODocByteStreamToByteStream(xmulticomponentfactory, oobais, inputMimeType, outputMimeType); @@ -115,7 +115,7 @@ } fis.close(); - results.put("outByteWrapper", new ByteWrapper(baos.toByteArray())); + results.put("outByteBuffer", new ByteBuffer(baos.toByteArray())); baos.close(); } catch (MalformedURLException e) { |
Free forum by Nabble | Edit this page |