1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#include "dm_tree_class.H" 18#include "dm_uri_utils.h" 19#include "SyncML_DM_Archive.H" 20#include "xpl_Logger.h" 21#include "dm_uri_utils.h" 22 23/*================================================================================================== 24 25Function: SyncML_DM_Archive::SyncML_DM_Archive 26 27Description: The SyncML_DM_Archive class constructor. 28 29==================================================================================================*/ 30SyncML_DM_Archive::SyncML_DM_Archive(CEnv* env, CPCHAR pURI, CPCHAR path) 31 : m_pURI(pURI), 32 m_path(path) 33{ 34 rootTreeNode=NULL; 35 parent=NULL; 36 dirty = FALSE; 37 m_bWritableExist = FALSE; 38 m_permission = -1; 39 40 env->GetWFSFullPath(path,m_strWFSFileName); 41} 42 43/*================================================================================================== 44 45Function: SyncML_DM_Archive::~SyncML_DM_Archive 46 47Description: The SyncML_DM_Archive class deconstructor. 48 49==================================================================================================*/ 50SyncML_DM_Archive::~SyncML_DM_Archive() 51{ 52 if ( rootTreeNode ) 53 rootTreeNode->pArchive = NULL; 54} 55 56void 57SyncML_DM_Archive::getFilePath(char * path, CPCHAR ext) 58{ 59 DmStrcpy(path, m_strWFSFileName); 60 DmStrcat(path, ext); 61} 62 63BOOLEAN 64SyncML_DM_Archive::LoadSkeleton(DMTree* pTree) 65{ 66 if ( rootTreeNode ) 67 return TRUE; 68 69 rootTreeNode = pTree->CreateSkeletonNode( getURI() ); 70 71 if ( rootTreeNode ) 72 rootTreeNode->pArchive = this; 73 else 74 return FALSE; 75 76 return TRUE; 77} 78 79 80SYNCML_DM_RET_STATUS_T 81SyncML_DM_Archive::Init(DMTree* pTree) 82{ 83 if ( !pTree ) 84 return SYNCML_DM_FAIL; 85 86 m_pTree = pTree; 87 return oEventLogger.Init(pTree); 88 89} 90 91void 92SyncML_DM_Archive::setLastAccessedTime(XPL_CLK_CLOCK_T lastAccessedTime) 93{ 94 m_lastAccessedTime = lastAccessedTime; 95} 96 97XPL_CLK_CLOCK_T 98SyncML_DM_Archive::getLastAccessedTime() 99{ 100 return m_lastAccessedTime; 101} 102