// limitations under the License.
//
-#include <dpl/log/log.h>
#include <CommonsJavaScript/Converter.h>
#include <CommonsJavaScript/JSUtils.h>
#include "ConverterMessage.h"
#include <JSWebAPIError.h>
#include <ArgumentValidator.h>
+#include <Logger.h>
#if 0
namespace {
void JSMessageAttachment::initialize(JSContextRef context,
JSObjectRef object)
{
- LogDebug("enter");
+ LoggerD("enter");
if (!JSObjectGetPrivate(object)) {
- LogDebug("Private object not set... setting it.");
+ LoggerD("Private object not set... setting it.");
IAttachmentPtr attachment(new Attachment());
JSMessageAttachmentPrivate *priv = new JSMessageAttachmentPrivate(context, attachment);
void JSMessageAttachment::finalize(JSObjectRef object)
{
- LogDebug("enter");
+ LoggerD("enter");
JSMessageAttachmentPrivate* priv = static_cast<JSMessageAttachmentPrivate*>(JSObjectGetPrivate(object));
JSContextRef gContext = priv->getContext();
JSStringRef propertyName,
JSValueRef* exception)
{
- LogDebug("enter");
+ LoggerD("enter");
Try
{
IAttachmentPtr attachment = getAttachment(context, object);
WrtDeviceApis::CommonsJavaScript::Converter converter(context);
- LogDebug("mine type :" << attachment->getMimeType());
+ LoggerD("mine type :" << attachment->getMimeType());
if (attachment->getMimeType().size() == 0)
{
- LogDebug("return NULL");
+ LoggerD("return NULL");
return JSValueMakeNull(context);
}
return converter.toJSValueRef(attachment->getMimeType());
}
Catch(WrtDeviceApis::Commons::Exception)
{
- LogError("invalid conversion");
+ LoggerE("invalid conversion");
}
return JSValueMakeUndefined(context);
}
JSStringRef propertyName,
JSValueRef* exception)
{
- LogDebug("enter");
+ LoggerD("enter");
Try
{
IAttachmentPtr attachment = getAttachment(context, object);
WrtDeviceApis::CommonsJavaScript::Converter converter(context);
- LogDebug("Message ID :" << (attachment->getMessage()));
+ LoggerD("Message ID :" << (attachment->getMessage()));
if ( (attachment->getAttachmentID() < 0) && (attachment->getMessage() == 0))
{
- LogDebug("return NULL");
+ LoggerD("return NULL");
return JSValueMakeNull(context);
}
return converter.toJSValueRef(attachment->getMessage()->getId());
}
Catch(WrtDeviceApis::Commons::InvalidArgumentException)
{
- LogError("invalid value conversion");
+ LoggerE("invalid value conversion");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT);
}
Catch(WrtDeviceApis::Commons::Exception)
{
- LogError("Unkown Exception");
+ LoggerE("Unkown Exception");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
}
JSStringRef propertyName,
JSValueRef* exception)
{
- LogDebug("enter");
+ LoggerD("enter");
Try
{
IAttachmentPtr attachment = getAttachment(context, object);
ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context);
- LogDebug("Attachment Loaded :" << (attachment->getDownloaded() ));
+ LoggerD("Attachment Loaded :" << (attachment->getDownloaded() ));
if ( attachment->getAttachmentID() < 0)
{
- LogDebug("return NULL");
+ LoggerD("return NULL");
return JSValueMakeNull(context);
}
}
Catch(WrtDeviceApis::Commons::InvalidArgumentException)
{
- LogError("invalid value conversion");
+ LoggerE("invalid value conversion");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT);
}
Catch(WrtDeviceApis::Commons::Exception)
{
- LogError("Unkown Exception");
+ LoggerE("Unkown Exception");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
}
JSValueRef* exception)
{
- LogDebug("enter");
+ LoggerD("enter");
Try
{
IAttachmentPtr attachment = getAttachment(context, object);
WrtDeviceApis::CommonsJavaScript::Converter converter(context);
- LogDebug("Attachment Loaded :" << (attachment->getDownloaded() ));
+ LoggerD("Attachment Loaded :" << (attachment->getDownloaded() ));
return converter.toJSValueRef(attachment->getDownloaded());
}
Catch(WrtDeviceApis::Commons::InvalidArgumentException)
{
- LogError("invalid value conversion");
+ LoggerE("invalid value conversion");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT);
}
Catch(WrtDeviceApis::Commons::Exception)
{
- LogError("Unkown Exception");
+ LoggerE("Unkown Exception");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
}
JSStringRef propertyName,
JSValueRef* exception)
{
- LogDebug("enter");
+ LoggerD("enter");
JSMessageAttachmentPrivate* priv = static_cast<JSMessageAttachmentPrivate*>(JSObjectGetPrivate(object));
if (priv)
- LogDebug("priv is vaild");
+ LoggerD("priv is vaild");
JSContextRef globalContext = priv ? priv->getContext() : context;
WrtDeviceApis::CommonsJavaScript::Converter converter(context);
std::string fullPath = attachment->getFullPath();
- LogDebug("fullPath=" << fullPath);
+ LoggerD("fullPath=" << fullPath);
if (fullPath.empty()) {
return JSValueMakeNull(context);
std::string filePath;
Try {
filePath = DeviceAPI::Filesystem::Utils::toVirtualPath(globalContext, fullPath);
- LogDebug("return virtual path : " << filePath);
+ LoggerD("return virtual path : " << filePath);
return converter.toJSValueRef(filePath);
}
catch (WrtDeviceApis::Commons::ConversionException)
{
- LogDebug("return real path : " << fullPath);
+ LoggerD("return real path : " << fullPath);
return converter.toJSValueRef(fullPath);
/*
- LogDebug("It is not in the the list of root locations ");
+ LoggerD("It is not in the the list of root locations ");
if (attachment->hasDummyFile())
{
- LogDebug("Get Dummy File Path " << attachment->getDummyFilePath());
+ LoggerD("Get Dummy File Path " << attachment->getDummyFilePath());
filePath = attachment->getDummyFilePath();
}
else
{
- LogDebug("Create DummyFile");
+ LoggerD("Create DummyFile");
std::string tmpPath = AttachmentFactory::getDummyFileFromRealPath(globalContext, fullPath);
- LogDebug("tmp Path : " << tmpPath);
+ LoggerD("tmp Path : " << tmpPath);
if (tmpPath.length())
{
attachment->setDummyFilePath(tmpPath);
if ( !attachment->hasDummyFile())
{
- LogDebug("dummy File Path is invalided But Can't access this file.");
+ LoggerD("dummy File Path is invalided But Can't access this file.");
return JSValueMakeNull(context);
}
else
}
Catch(WrtDeviceApis::Commons::InvalidArgumentException)
{
- LogError("invalid value conversion");
+ LoggerE("invalid value conversion");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT);
}
Catch(WrtDeviceApis::Commons::Exception)
{
- LogError("Unkown Exception");
+ LoggerE("Unkown Exception");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
}
}
/* // MESSAGING ATTACHMENT IS BLOCKED
- LogDebug("enter");
+ LoggerD("enter");
Try
{
IAttachmentPtr attachment = getAttachment(context, object);
}
std::string fullPath = attachment->getFullPath();
- LogDebug("full Path = " << fullPath );
+ LoggerD("full Path = " << fullPath );
if (fullPath.empty()) {
return JSValueMakeUndefined(context);
}
WrtDeviceApis::Commons::ExceptionCodes::Enumeration code = event->getExceptionCode();
if (code != WrtDeviceApis::Commons::ExceptionCodes::None) {
- LogError("Attachment location not resolved. Exception code: " << code);
+ LoggerE("Attachment location not resolved. Exception code: " << code);
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
DeviceAPI::Filesystem::INodePtr node = event->getResult();
if (!node) {
- LogError("Resolved attachment location is empty.");
+ LoggerE("Resolved attachment location is empty.");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
DeviceAPI::Filesystem::IPathPtr path = node->getPath();
- LogError(" Path = " << path->getPath() << " Full Path = " << path->getFullPath());
+ LoggerE(" Path = " << path->getPath() << " Full Path = " << path->getFullPath());
JSObjectRef result = WrtDeviceApis::CommonsJavaScript::JSUtils::makeObject(context,
JSFile::getClassRef(),
}
Catch(WrtDeviceApis::Commons::InvalidArgumentException)
{
- LogError("invalid value conversion");
+ LoggerE("invalid value conversion");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::TYPE_MISMATCH_ERROR, JSMESSAGING_EXCEPTION_MSG_INVALID_ARGUMENT);
}
Catch(WrtDeviceApis::Commons::Exception)
{
- LogError("Unkown Exception");
+ LoggerE("Unkown Exception");
return JSTizenExceptionFactory::postException(context, exception,
JSTizenException::UNKNOWN_ERROR, JSMESSAGING_EXCEPTION_MSG_UNKNOWN);
}
JSMessageAttachmentPrivate* thisPrivate =
static_cast<JSMessageAttachmentPrivate*>(JSObjectGetPrivate(thisObject));
if (!thisPrivate) {
- LogError("no private");
+ LoggerE("no private");
Throw(WrtDeviceApis::Commons::NullPointerException);
}
return thisPrivate;
const JSValueRef arguments[],
JSValueRef* exception)
{
- LogDebug("entered");
+ LoggerD("entered");
try
std::string path = validator.toString(0);
std::string mimetype = validator.toString(1, true);
- LogDebug("path size() : " << path.size());
+ LoggerD("path size() : " << path.size());
if(path.size() != 0)
{
DeviceAPI::Filesystem::IPathPtr src = DeviceAPI::Filesystem::Utils::fromVirtualPath(context, path);
if (src)
{
- LogDebug("path size() : " << path.size());
+ LoggerD("path size() : " << path.size());
path = src->getFullPath();
}
else
{
- LogDebug("path size() : " << path.size());
+ LoggerD("path size() : " << path.size());
path = ""; //set empty string.
}
}
else
{
- LogDebug("path size() : " << path.size());
+ LoggerD("path size() : " << path.size());
path = ""; //set empty string.
}
- LogDebug("real path = " << path);
+ LoggerD("real path = " << path);
IAttachmentPtr attachment = AttachmentFactory::createAttachment(
path,
mimetype);
if (attachment)
{
JSClassRef jsClassRef = JSClassCreate(getClassInfo());
- LogDebug("jsClassRef success");
+ LoggerD("jsClassRef success");
JSMessageAttachmentPrivate* priv = new JSMessageAttachmentPrivate(context, attachment);
- LogDebug("priv success");
+ LoggerD("priv success");
JSObjectRef jsObjRef = JSObjectMake(context, jsClassRef, static_cast<void*>(priv));
- LogDebug("JSObjectMake success");
+ LoggerD("JSObjectMake success");
JSClassRelease(jsClassRef);
if (NULL == jsObjRef) {
- LogError("object creation error");
+ LoggerE("object creation error");
throw DeviceAPI::Common::UnknownException("JSObject make error");
}
return jsObjRef;
}
else
{
- LogDebug("attachment can't create");
+ LoggerD("attachment can't create");
throw DeviceAPI::Common::UnknownException("attachment create failed");
}
}catch(BasePlatformException & e) {
- LogError("Message creation failed: " << e.getMessage());
+ LoggerE("Message creation failed: " << e.getMessage());
JSObjectRef error = JSWebAPIError::makeJSWebAPIError(context, e);
*exception = error;
}
JSStringRef propertyName,
JSValueRef* exception)
{
- LogDebug("OK");
+ LoggerD("OK");
ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context);
// WrtDeviceApis::CommonsJavaScript::Converter converter(context);
}
}
catch (const WrtDeviceApis::Commons::Exception& ex) {
- LogError("Exception: " << ex.GetMessage());
+ LoggerE("Exception: " << ex.GetMessage());
return JSValueMakeUndefined(context);
}
return NULL;
JSValueRef value,
JSValueRef* exception)
{
- LogDebug("entered");
+ LoggerD("entered");
if (JSStringIsEqualToUTF8CString(propertyName, ATTACHMENTID)) {
return true;
JSObjectRef object,
JSPropertyNameAccumulatorRef propertyNames)
{
- LogDebug("Entered");
+ LoggerD("Entered");
JSStringRef propertyName = NULL;
propertyName = JSStringCreateWithUTF8CString(ATTACHMENTID);