javaextensions/pim/javasrc/com/nokia/mj/impl/properties/pim/DynamicPropertyHandler.java
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
child 84 0553e2305d00
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 package com.nokia.mj.impl.properties.pim;
       
    20 
       
    21 import com.nokia.mj.impl.pim.PIMManager;
       
    22 import com.nokia.mj.impl.pim.Calendar;
       
    23 import com.nokia.mj.impl.rt.support.SystemPropertyProvider;
       
    24 
       
    25 /**
       
    26  * This class implements SystemPropertyProvider and provides getProperty to
       
    27  * retrieve dynamic system property.
       
    28  */
       
    29 public final class DynamicPropertyHandler implements SystemPropertyProvider
       
    30 {
       
    31 
       
    32     public String getProperty(String key)
       
    33     {
       
    34 
       
    35         //Code for list calendars - Call Open PIM List
       
    36         // MIDlet should know about its own calendars, but we could offer also system property (e.g.) com.nokia.mid.calendars, which lists comma-separated local calendarnames:
       
    37         // String calendarNames = System.getProperty("com.nokia.mid.calendars");
       
    38 
       
    39         PIMManager pim = new PIMManager();
       
    40 
       
    41         Calendar calendarList[] = pim.listCalendars();
       
    42 
       
    43         StringBuffer calendarListString = new StringBuffer();;
       
    44 
       
    45         if (calendarList != null)
       
    46         {
       
    47             for (int i = 0; i < calendarList.length; i++)
       
    48             {
       
    49                 calendarListString.append(calendarList[i].getCalendarName()+",");
       
    50 
       
    51             }
       
    52         }
       
    53         else
       
    54         {
       
    55             return null;
       
    56         }
       
    57         pim = null;
       
    58         calendarListString.deleteCharAt(calendarListString.length() - 1);
       
    59         return calendarListString.toString();
       
    60     }
       
    61 
       
    62     public boolean isStatic(String key)
       
    63     {
       
    64         return false;
       
    65     }
       
    66 
       
    67 }