+
+class CRepository;
+
+/**
+ * Java Central Repository.
+ */
+class CJavaCentralRepository : public CBase
+{
+public:
+
+ /**
+ * Two-phased constructor.
+ * @param aRepositoryUid The UID of the repository to be accessed
+ */
+ static CJavaCentralRepository* NewL(TUid aRepositoryUid);
+
+ /**
+ * Two-phased constructor.
+ * @param aRepositoryUid The UID of the repository to be accessed
+ */
+ static CJavaCentralRepository* NewLC(TUid aRepositoryUid);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CJavaCentralRepository();
+
+ /**
+ * Closes opened central repository.
+ */
+ void Close();
+
+ /**
+ * Reads a descriptor setting.
+ *
+ * @param aKey Key of setting to be read.
+ * @param aValue Returns the value of the setting if it is a descriptor.
+ * @leave System wide code if setting can not be read.
+ */
+ void GetL(TUint32 aKey, TDes& aValue);
+
+ /**
+ * Reads a integer setting.
+ *
+ * @param aKey Key of setting to be read.
+ * @param aValue Returns the value of the setting if it is an integer.
+ * @leave System wide code if setting can not be read.
+ */
+ void GetL(TUint32 aKey, TInt& aValue);
+
+ /**
+ * Stores descriptor setting.
+ *
+ * @param key The key of setting to be stored.
+ * @param value The value of the setting to be stored.
+ * @leave System wide error code if value cannot be stored.
+ */
+ void SetL(TUint32 aKey, TDesC& aValue);
+
+ /**
+ * Stores integer setting.
+ *
+ * @param aKey Key of setting to be stored.
+ * @param aValue The value of the setting to be stored.
+ * @leave System wide error code if value cannot be stored.
+ */
+ void SetL(TUint32 aKey, TInt aValue);
+
+ HBufC* GetStringL(TUint32 aKey);
+
+ TInt GetIntL(TUint32 aKey);
+
+private:
+
+ CJavaCentralRepository(TUid aRepositoryUid);
+
+ void ConstructL();
+
+private: // data
+
+ /**
+ * Access to a repository
+ * Own
+ */
+ CRepository* iRepository;
+
+ /**
+ * Repository ID
+ */
+ TUid iRepositoryUid;
+
+};
+
+#endif // C_JAVACENTRALREPOSITORY_H
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/javasrc/com/nokia/mid/cenrep/CentralRepository.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/centralrepository/javasrc/com/nokia/mid/cenrep/CentralRepository.java Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mid.cenrep;
+
+import com.nokia.mj.impl.cenrep.CentralRepositoryImpl;
+
+/**
+ * The CentralRepository
is class to manage application
+ * settings and share data with other runtimes. In S60 this API can be used
+ * to set and get values in Symbian Central Repositories.
+ *
+ * Example of usage:
+ *
+ *
+ * class CentralRepositoryExample {
+ * private static final String EXAMPLE_REPOSITORY= "0x20000000";
+ * private static final String EXAMPLE_KEY1 = "0x00000001";
+ * private static final String EXAMPLE_KEY2 = "0x00000002";
+ *
+ * public modifySetting() throws CentralRepositoryException {
+ * CentralRepository cenrep = CentralRepository.open(EXAMPLE_REPOSITORY);
+ * try {
+ * String value1 = cenrep.getString(EXAMPLE_KEY1);
+ * int value2 = cenrep.getInt(EXAMPLE_KEY2);
+
+ * cenrep.setString(EXAMPLE_KEY1, value3);
+ * cenrep.setInt(EXAMPLE_KEY2, value4);
+ * }
+ * catch (CentralRepositoryException cre) {
+ * System.out.println(cre);
+ * }
+ * finally {
+ * cenrep.close();
+ * }
+ * }
+ * }
+ */
+public abstract class CentralRepository
+{
+
+ /**
+ * Hidden default constructor.
+ */
+ protected CentralRepository()
+ {
+ }
+
+ /**
+ * Opens central repository.
+ *
+ * @param repositoryId it is platform specific and in S60 it is
+ * Symbian Central Repository UID.
+ * @return An instance of CentralRepository class
+ * for accessing a repository.
+ * @throws CentralRepositoryException if openning fails.
+ */
+ static public CentralRepository open(String repositoryId)
+ throws CentralRepositoryException
+ {
+ return CentralRepositoryImpl.open(repositoryId);
+ }
+
+ /**
+ * Closes central repository. If get or set methods are used after
+ * close operation, exception will be thrown.
+ */
+ public abstract void close()
+ throws CentralRepositoryException;
+
+ /**
+ * Returns string stored in given key.
+ *
+ * @param key the key of setting to be read.
+ * @return the value of the setting if it is the string.
+ * @throws CentralRepositoryException if key is not found or
+ * stored data is not string.
+ */
+ public abstract String getString(String key)
+ throws CentralRepositoryException;
+
+ /**
+ * Returns integer stored in given key.
+ *
+ * @param key the key of setting to be read.
+ * @return the value of the setting if it is an integer.
+ * @throws CentralRepositoryException if key is not found or
+ * stored data is not integer.
+ */
+ public abstract int getInt(String key)
+ throws CentralRepositoryException;
+
+ /** Stores string value in key.
+ *
+ * @param key the key of setting to be stored.
+ * @param value the string value of the setting to be stored.
+ * @throws CentralRepositoryException if string value cannot be stored.
+ */
+ public abstract void setString(String key, String value)
+ throws CentralRepositoryException;
+
+ /** Stores integer value in key.
+ *
+ * @param key the key of setting to be stored.
+ * @param value the integer value of the setting to be stored.
+ * @throws CentralRepositoryException if integer value cannot be stored.
+ */
+ public abstract void setInt(String key, int value)
+ throws CentralRepositoryException;
+}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/javasrc/com/nokia/mid/cenrep/CentralRepositoryException.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/centralrepository/javasrc/com/nokia/mid/cenrep/CentralRepositoryException.java Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mid.cenrep;
+
+/**
+ * Generic exception class for Central Repository API.
+ */
+public class CentralRepositoryException extends Exception
+{
+
+ /**
+ * Default constructor is not allowed.
+ */
+ protected CentralRepositoryException()
+ {
+ }
+
+ /**
+ * Constructs an exception instance with a textual information.
+ *
+ * @param message human readable information about the exception.
+ */
+ public CentralRepositoryException(String message)
+ {
+ super(message);
+ }
+
+}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryImpl.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryImpl.java Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mj.impl.cenrep;
+
+import com.nokia.mid.cenrep.CentralRepository;
+import com.nokia.mid.cenrep.CentralRepositoryException;
+import com.nokia.mj.impl.gcf.utils.NativeError;
+import com.nokia.mj.impl.rt.support.ApplicationInfo;
+import com.nokia.mj.impl.utils.Logger;
+import com.nokia.mj.impl.rt.support.Finalizer;
+import com.nokia.mj.impl.rt.support.Jvm;
+
+/**
+ * CentralRepositoryImpl implements the functionality specified in
+ * com.nokia.mid.cenrep.CentralRepository class.
+ */
+public class CentralRepositoryImpl extends CentralRepository
+{
+
+ static
+ {
+ try
+ {
+ Jvm.loadSystemLibrary("javacentrep");
+ }
+ catch (Exception e)
+ {
+ Logger.ELOG(Logger.EJavaCentrep,
+ "Unable to load javacentrep dll.");
+ }
+ }
+
+ private static final int INITIAL = 0;
+
+ private static final int OPEN = 1;
+
+ private static final int CLOSED = 2;
+
+ /*
+ * Central Repository API Function server.
+ */
+ private int iFunctionSourceHandle;
+
+ /**
+ * Handle to the native side peer object.
+ */
+ private int iCenrepHandle = 0;
+
+ /**
+ * Repository ID
+ */
+ private String iRepositoryId = null;
+
+ private Finalizer iFinalizer;
+
+ private int iState;
+
+ /**
+ * Hidden default constructor.
+ */
+ private CentralRepositoryImpl()
+ {
+ }
+
+ /**
+ * Hidden constructor.
+ *
+ * @param repositoryId it is platform specific and in S60 it is
+ * Symbian Central Repository UID.
+ */
+ private CentralRepositoryImpl(String repositoryId)
+ throws CentralRepositoryException
+ {
+ checkAccess();
+ iState = INITIAL;
+ int cenrepUid = CentralRepositoryUid.getIntValue(repositoryId);
+ this.iRepositoryId = repositoryId;
+ iFinalizer = registerFinalize();
+
+ iFunctionSourceHandle = _createFunctionSource();
+ iCenrepHandle = _createNativePeer(iFunctionSourceHandle, cenrepUid);
+ iState = OPEN;
+ }
+
+ /**
+ * See class CentralRepository for comments.
+ */
+ static public CentralRepository open(String repositoryId)
+ throws CentralRepositoryException
+ {
+ return new CentralRepositoryImpl(repositoryId);
+ }
+
+ /**
+ * See class CentralRepository for comments.
+ */
+ public void close() throws CentralRepositoryException
+ {
+ synchronized (this)
+ {
+
+ if (iState != CLOSED)
+ {
+ iState = CLOSED;
+ _close(iFunctionSourceHandle, iCenrepHandle);
+ _dispose(iFunctionSourceHandle, iCenrepHandle);
+ }
+ iRepositoryId = null;
+ }
+ }
+
+ /**
+ * See class CentralRepository for comments.
+ */
+ public String getString(String key)
+ throws CentralRepositoryException
+ {
+ synchronized (this)
+ {
+
+ if (iState == CLOSED)
+ {
+ throw new CentralRepositoryException("Connection Already Closed");
+ }
+ long cenrepKey = CentralRepositoryKey.getLongValue(key);
+ String value = _getString(iFunctionSourceHandle, iCenrepHandle, cenrepKey);
+ return value;
+ }
+ }
+
+ /**
+ * See class CentralRepository for comments.
+ */
+ public int getInt(String key)
+ throws CentralRepositoryException
+ {
+ synchronized (this)
+ {
+
+ if (iState == CLOSED)
+ {
+ throw new CentralRepositoryException("Connection Already Closed");
+ }
+ long cenrepKey = CentralRepositoryKey.getLongValue(key);
+ int res = _getInt(iFunctionSourceHandle, iCenrepHandle, cenrepKey);
+ return res;
+ }
+ }
+
+ /**
+ * See class CentralRepository for comments.
+ */
+ public void setString(String key, String value)
+ throws CentralRepositoryException
+ {
+ synchronized (this)
+ {
+
+ if (iState == CLOSED)
+ {
+ throw new CentralRepositoryException("Connection Already Closed");
+ }
+ long cenrepKey = CentralRepositoryKey.getLongValue(key);
+ if (value == null)
+ {
+ throw new CentralRepositoryException("Value is null");
+ }
+ _setString(iFunctionSourceHandle, iCenrepHandle, cenrepKey, value);
+ }
+ }
+
+ /**
+ * See class CentralRepository for comments.
+ */
+ public void setInt(String key, int value)
+ throws CentralRepositoryException
+ {
+ synchronized (this)
+ {
+
+ if (iState == CLOSED)
+ {
+ throw new CentralRepositoryException("Connection Already Closed");
+ }
+ long cenrepKey = CentralRepositoryKey.getLongValue(key);
+ _setInt(iFunctionSourceHandle, iCenrepHandle, cenrepKey, value);
+ }
+ }
+
+ /**
+ * Registers with Finalizer to call a method when the object gets collected
+ * by GC
+ *
+ * @return Finalizer object that will be notified when GC happens
+ */
+ private Finalizer registerFinalize()
+ {
+ return new Finalizer()
+ {
+ public void finalizeImpl()
+ {
+ registeredFinalize();
+ }
+ };
+ }
+
+ /**
+ * Called when the object is finalized by the garbage collector.
+ */
+ final void registeredFinalize()
+ {
+ try
+ {
+ close();
+ }
+ catch (CentralRepositoryException e)
+ {
+ // Ignore
+ }
+ }
+
+ /**
+ * Creates a native side function source.
+ *
+ * @return handle to the native function source.
+ */
+ private native int _createFunctionSource();
+
+ /**
+ * Create native side peer of this Java class. It opens a repository.
+ *
+ * @param FunctionSource Handle handle to the native function source.
+ * @param arepositoryId is platform specific and in S60 it is
+ * Symbian Central Repository UID.
+ * @return handle to the native side peer.
+ * @return Symbian OS error code, if openning fails.
+ */
+ private native int _createNativePeer(
+ int aFunctionSourceHandle,
+ int repositoryId);
+
+ /**
+ * Closes a repository.
+ *
+ * @param FunctionSourceHandle handle to the native function source.
+ * @param cenrepHandle handle to the native side peer object.
+ * @return Symbian OS error code, if closing fails.
+ */
+ private native void _close(int aFunctionSourceHandle, int cenrepHandle);
+
+ /**
+ * Dispose native side resources owned by this class.
+ *
+ * @param FunctionSourceHandle handle to the native function source.
+ * @param cenrepHandle handle to the native side peer object.
+ */
+ private native void _dispose(int aFunctionSourceHandle, int cenrepHandle);
+
+ /**
+ * Returns string stored in given key.
+ *
+ * @param FunctionSourceHandle handle to the native function source.
+ * @param cenrepHandle handle to the native side peer object.
+ * @param key the key of setting to be read.
+ * @param value returns the value of the setting if it is the string.
+ * @return Symbian OS error code, if key is not found or
+ * stored data is not string.
+ */
+ private native String _getString(
+ int aFunctionSourceHandle,
+ int cenrepHandle,
+ long key);
+
+ /**
+ * Returns integer stored in given key.
+ *
+ * @param FunctionSourceHandle handle to the native function source.
+ * @param cenrepHandle handle to the native side peer object.
+ * @param key the key of setting to be read.
+ * @param value the value of the setting if it is an integer.
+ * @return Symbian OS error code, if key is not found or
+ * stored data is not integer.
+ */
+ private native int _getInt(
+ int aFunctionSourceHandle,
+ int cenrepHandle,
+ long key);
+
+ /** Stores string value in key.
+ *
+ * @param FunctionSourceHandle handle to the native function source.
+ * @param cenrepHandle handle to the native side peer object.
+ * @param key the key of setting to be stored.
+ * @param value the string value of the setting to be stored.
+ * @return Symbian OS error code, if string value cannot be stored.
+ */
+ private native void _setString(
+ int aFunctionSourceHandle,
+ int cenrepHandle,
+ long key,
+ String value);
+
+ /** Stores integer value in key.
+ *
+ * @param FunctionSourceHandle handle to the native function source.
+ * @param cenrepHandle handle to the native side peer object.
+ * @param key the key of setting to be stored.
+ * @param value the integer value of the setting to be stored.
+ * @return Symbian OS error code, if integer value cannot be stored.
+ */
+ private native void _setInt(
+ int aFunctionSourceHandle,
+ int cenrepHandle,
+ long key,
+ int value);
+
+
+ /**
+ * Checks if MIDlet is permited to access the central repository.
+ * Only MIDlets in manufacturer or operator domain are allowed.
+ * @throws CentralRepositoryException if MIDlet is not in manufacturer or
+ * operator domain.
+ */
+ private void checkAccess()
+ throws SecurityException
+ {
+
+ ApplicationInfo appInfo = ApplicationInfo.getInstance();
+ String protectionDomain = appInfo.getProtectionDomain();
+
+ if (protectionDomain.equals(ApplicationInfo.MANUFACTURER_DOMAIN) == false &&
+ protectionDomain.equals(ApplicationInfo.OPERATOR_DOMAIN) == false)
+ {
+ Logger.ELOG(Logger.EJavaCentrep, "Protection Domain: " + protectionDomain +
+ ", Access denied");
+ throw new SecurityException("Access denied!");
+ }
+ }
+}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryKey.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryKey.java Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mj.impl.cenrep;
+
+import com.nokia.mid.cenrep.CentralRepositoryException;
+/**
+ * Class for central repository key representation
+ */
+class CentralRepositoryKey
+{
+
+ /**
+ * Default constructor.
+ */
+ protected CentralRepositoryKey()
+ {
+ }
+
+ /**
+ * Returns long value represantion.
+ *
+ * @param value string represantion of key.
+ * @throws CentralRepositoryException, if key is null, empty, negative
+ * or not valid.
+ */
+ static long getLongValue(String value)
+ throws CentralRepositoryException
+ {
+ if (value == null || value.length() == 0)
+ {
+ throw new CentralRepositoryException("Key is null or empty!");
+ }
+
+ String numStr = value;
+
+ // Negative value is not allowed
+ if (numStr.startsWith("-"))
+ {
+ throw new CentralRepositoryException("Nagative value is not allowed!");
+ }
+
+ // Check for optional radix prefix.
+ int radix = 10;
+ if (numStr.startsWith("0x"))
+ {
+ radix = 16;
+ numStr = numStr.substring(2);
+ }
+
+ return Long.parseLong(numStr, radix);
+ }
+
+};
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryUid.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/centralrepository/javasrc/com/nokia/mj/impl/cenrep/CentralRepositoryUid.java Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+package com.nokia.mj.impl.cenrep;
+
+import com.nokia.mj.impl.utils.Uid;
+import com.nokia.mid.cenrep.CentralRepositoryException;
+
+/**
+ * Class for central repository UID.
+ */
+class CentralRepositoryUid extends Uid
+{
+
+ /**
+ * Default constructor.
+ */
+ protected CentralRepositoryUid()
+ {
+ super();
+ }
+
+ /**
+ * Returns int value
+ *
+ * @param value string representation of uid.
+ * @throws CentralRepositoryException, if value is null, empty or not valid.
+ */
+ static int getIntValue(String value)
+ throws CentralRepositoryException
+ {
+ Uid uid = Uid.createUid(value);
+ if (uid == null)
+ {
+ throw new CentralRepositoryException("Uid is null or empty");
+ }
+
+ String numStr = uid.getStringValue();
+
+ // Check if value is negative.
+ boolean negative = false;
+ if (numStr.startsWith("-"))
+ {
+ negative = true;
+ numStr = numStr.substring(1);
+ }
+
+ // Check for optional radix prefix.
+ int radix = 10;
+ if (numStr.startsWith("0x"))
+ {
+ radix = 16;
+ numStr = numStr.substring(2);
+ }
+
+ // Check if numStr is in Symbian TUid form [12345678].
+ if (numStr.length() <= 10 && numStr.startsWith("[") && numStr.endsWith("]"))
+ {
+ radix = 16;
+ numStr = numStr.substring(1, numStr.length()-1);
+ }
+
+ int result = 0;
+ long val = Long.parseLong(numStr, radix);
+ if (negative)
+ {
+ result = (int)-val;
+ }
+ else
+ {
+ result = (int)val;
+ }
+ return result;
+ }
+
+};
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/src/cjavacentralrepository.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/centralrepository/src/cjavacentralrepository.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include // CRepository
+
+#include "cjavacentralrepository.h" // CJavaCentralRepository
+#include "logger.h"
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::NewL
+// ---------------------------------------------------------------------------
+CJavaCentralRepository* CJavaCentralRepository::NewL(TUid aRepositoryUid)
+{
+ CJavaCentralRepository* self = CJavaCentralRepository::NewLC(aRepositoryUid);
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::NewLC
+// ---------------------------------------------------------------------------
+CJavaCentralRepository* CJavaCentralRepository::NewLC(TUid aRepositoryUid)
+{
+ CJavaCentralRepository* self =
+ new(ELeave) CJavaCentralRepository(aRepositoryUid);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::~CJavaCentralRepository
+// ---------------------------------------------------------------------------
+CJavaCentralRepository::~CJavaCentralRepository()
+{
+ Close();
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::Close
+// ---------------------------------------------------------------------------
+void CJavaCentralRepository::Close()
+{
+ iRepositoryUid = TUid::Null();
+ delete iRepository;
+ iRepository = NULL;
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::CJavaCentralRepository
+// ---------------------------------------------------------------------------
+CJavaCentralRepository::CJavaCentralRepository(TUid aRepositoryUid)
+{
+ iRepositoryUid = aRepositoryUid;
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::ConstructL
+// ---------------------------------------------------------------------------
+void CJavaCentralRepository::ConstructL()
+{
+ iRepository = CRepository::NewL(iRepositoryUid);
+}
+
+/**
+ * GetStringL
+ */
+HBufC* CJavaCentralRepository::GetStringL(TUint32 aKey)
+{
+ HBufC* value = HBufC::NewLC(NCentralRepositoryConstants::KMaxUnicodeStringLength);
+ TPtr ptr(value->Des());
+ GetL(aKey, ptr);
+
+ //aValue = value;
+ CleanupStack::Pop(value);
+ return value;
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::Get
+// ---------------------------------------------------------------------------
+void CJavaCentralRepository::GetL(TUint32 aKey, TDes& aValue)
+{
+ User::LeaveIfError(iRepository->Get(aKey, aValue));
+}
+
+/**
+ * GetIntL
+ */
+TInt CJavaCentralRepository::GetIntL(TUint32 aKey/*, TInt& aValue*/)
+{
+ TInt value(0);
+ GetL(aKey, value);
+ return value;
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::Get
+// ---------------------------------------------------------------------------
+void CJavaCentralRepository::GetL(TUint32 aKey, TInt& aValue)
+{
+ User::LeaveIfError(iRepository->Get(aKey, aValue));
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::Set
+// ---------------------------------------------------------------------------
+void CJavaCentralRepository::SetL(TUint32 aKey, TDesC& aValue)
+{
+ User::LeaveIfError(iRepository->Set(aKey, aValue));
+}
+
+// ---------------------------------------------------------------------------
+// CJavaCentralRepository::Set
+// ---------------------------------------------------------------------------
+void CJavaCentralRepository::SetL(TUint32 aKey, TInt aValue)
+{
+ User::LeaveIfError(iRepository->Set(aKey, aValue));
+}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/centralrepository/src/javacentralrepositoryjni.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/centralrepository/src/javacentralrepositoryjni.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,277 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include // KMaxUnicodeStringLength
+
+#include "com_nokia_mj_impl_cenrep_CentralRepositoryImpl.h"
+#include "cjavacentralrepository.h"
+#include "centrepfunctionserver.h"
+#include "javajniutils.h"
+#include "jstringutils.h"
+#include "s60commonutils.h"
+#include "logger.h"
+#include "fs_methodcall.h"
+
+using namespace java::util;
+/*
+ * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl
+ * Method: _createFunctionSource
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1createFunctionSource
+(JNIEnv *aJni, jobject /*aPeer*/)
+{
+ JELOG2(EJavaCentrep);
+ java::centrep::CentrepFunctionServer* mFunctionServer;
+ mFunctionServer = new java::centrep::CentrepFunctionServer();
+ TInt handle = reinterpret_cast(mFunctionServer);
+ if (handle < KErrNone)
+ {
+ JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" ,
+ JavaCommonUtils::intToString(handle));
+ }
+ return handle;
+}
+
+/**
+ * CreateCentralRepositoryL
+ */
+void CreateCentralRepositoryL(CJavaCentralRepository*& aCenRep,
+ TUid aRepositoryId)
+{
+ CJavaCentralRepository* cenrep =
+ CJavaCentralRepository::NewL(aRepositoryId);
+ aCenRep = cenrep;
+}
+
+/*
+ * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl
+ * Method: _createNativePeer
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1createNativePeer
+(JNIEnv *aJni, jobject, jint aFunctionSourceHandle, jint aRepositoryId)
+{
+ java::centrep::CentrepFunctionServer* mFunctionServer =
+ reinterpret_cast< java::centrep::CentrepFunctionServer*>(aFunctionSourceHandle);
+
+ CJavaCentralRepository* cenrep = NULL;
+
+ TUid uid = TUid::Uid(aRepositoryId);
+ TRAPD(err,CallMethodL(CreateCentralRepositoryL, cenrep, uid, mFunctionServer));
+
+ if (err != KErrNone)
+ {
+ JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" ,
+ JavaCommonUtils::intToString(err));
+ }
+ return reinterpret_cast(cenrep);
+}
+
+/**
+ * Close
+ */
+void CloseCentralRepository(CJavaCentralRepository* aCenRep)
+{
+ aCenRep->Close();
+}
+
+/*
+ * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl
+ * Method: _close
+ * Signature: (II)I
+ */
+JNIEXPORT void JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1close
+(JNIEnv *, jobject, jint aFunctionSourceHandle, jint aCenrepHandle)
+{
+ java::centrep::CentrepFunctionServer* mFunctionServer =
+ reinterpret_cast< java::centrep::CentrepFunctionServer*>(
+ aFunctionSourceHandle);
+
+ CJavaCentralRepository* cenrep =
+ reinterpret_cast(aCenrepHandle);
+
+ CallMethod(CloseCentralRepository, cenrep, mFunctionServer);
+}
+
+/**
+ * Dispose
+ */
+void Dispose(CJavaCentralRepository* aCenRep)
+{
+ delete aCenRep;
+ aCenRep = NULL;
+}
+
+/*
+ * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl
+ * Method: _dispose
+ * Signature: (II)V
+ */
+JNIEXPORT void JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1dispose
+(JNIEnv *, jobject, jint aFunctionSourceHandle, jint aCenrepHandle)
+{
+ java::centrep::CentrepFunctionServer* mFunctionServer =
+ reinterpret_cast< java::centrep::CentrepFunctionServer*>(
+ aFunctionSourceHandle);
+
+ CJavaCentralRepository* cenrep =
+ reinterpret_cast(aCenrepHandle);
+
+ CallMethod(Dispose, cenrep, mFunctionServer);
+ delete mFunctionServer;
+}
+
+/*
+ * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl
+ * Method: _getString
+ * Signature: (IIJLcom/nokia/mj/impl/cenrep/CentralRepositoryImpl$StringValue;)I
+ */
+JNIEXPORT jstring JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1getString
+(JNIEnv * aJni, jobject, jint aFunctionSourceHandle, jint aCenrepHandle,
+ jlong aKey)
+{
+ java::centrep::CentrepFunctionServer* mFunctionServer =
+ reinterpret_cast< java::centrep::CentrepFunctionServer*>(
+ aFunctionSourceHandle);
+
+ CJavaCentralRepository* cenrep =
+ reinterpret_cast(aCenrepHandle);
+
+ HBufC* buf = NULL;
+
+ TUint32 key = (TUint32)aKey;
+ TRAPD(err, CallMethodL(buf, cenrep, &CJavaCentralRepository::GetStringL, key, mFunctionServer));
+
+ jstring val = NULL;
+ if (err == KErrNone && buf)
+ {
+ val = java::util::S60CommonUtils::NativeToJavaString(*aJni, *buf);
+ }
+ else
+ {
+ JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" ,
+ JavaCommonUtils::intToString(err));
+ }
+
+ delete buf;
+ return val;
+}
+
+
+/*
+ * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl
+ * Method: _getInt
+ * Signature: (IIJLcom/nokia/mj/impl/cenrep/CentralRepositoryImpl$IntValue;)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1getInt
+(JNIEnv * aJni, jobject, jint aFunctionSourceHandle, jint aCenrepHandle,
+ jlong aKey)
+{
+ java::centrep::CentrepFunctionServer* mFunctionServer =
+ reinterpret_cast< java::centrep::CentrepFunctionServer*>(
+ aFunctionSourceHandle);
+
+ CJavaCentralRepository* cenrep =
+ reinterpret_cast(aCenrepHandle);
+
+ TInt val = 0;
+ TUint32 key = (TUint32)aKey;
+
+ TRAPD(err, CallMethodL(val, cenrep, &CJavaCentralRepository::GetIntL, key, mFunctionServer));
+
+ if (err != KErrNone)
+ {
+ JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" ,
+ JavaCommonUtils::intToString(err));
+ }
+ return val;
+}
+
+/**
+ * SetStringL
+ */
+void SetStringL(CJavaCentralRepository* aCenRep, TUint32 aKey, TDesC* aValue)
+{
+ aCenRep->SetL(aKey, *aValue);
+}
+
+/*
+ * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl
+ * Method: _setString
+ * Signature: (IIJLjava/lang/String;)I
+ */
+JNIEXPORT void JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1setString
+(JNIEnv *aJni, jobject, jint aFunctionSourceHandle, jint aCenrepHandle,
+ jlong aKey, jstring aValue)
+{
+ java::centrep::CentrepFunctionServer* mFunctionServer =
+ reinterpret_cast< java::centrep::CentrepFunctionServer*>(
+ aFunctionSourceHandle);
+
+ CJavaCentralRepository* cenrep =
+ reinterpret_cast(aCenrepHandle);
+
+ JStringUtils string(*aJni, aValue);
+ TUint32 key = (TUint32)aKey;
+
+ TDesC* tstring = (TDesC*) &string;
+ TRAPD(err, CallMethodL(SetStringL, cenrep, key, tstring, mFunctionServer));
+
+ if (err != KErrNone)
+ {
+ JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" ,
+ JavaCommonUtils::intToString(err));
+ }
+}
+
+/**
+ * SetIntL
+ */
+void SetIntL(CJavaCentralRepository* aCenRep, TUint32 aKey, TInt aValue)
+{
+ aCenRep->SetL(aKey, aValue);
+}
+
+/*
+ * Class: com_nokia_mj_impl_cenrep_CentralRepositoryImpl
+ * Method: _setInt
+ * Signature: (IIJI)I
+ */
+JNIEXPORT void JNICALL Java_com_nokia_mj_impl_cenrep_CentralRepositoryImpl__1setInt
+(JNIEnv *aJni, jobject, jint aFunctionSourceHandle, jint aCenrepHandle,
+ jlong aKey, jint aValue)
+{
+ java::centrep::CentrepFunctionServer* mFunctionServer =
+ reinterpret_cast< java::centrep::CentrepFunctionServer*>(
+ aFunctionSourceHandle);
+
+ CJavaCentralRepository* cenrep =
+ reinterpret_cast(aCenrepHandle);
+
+ TUint32 key = (TUint32)aKey;
+ TInt value = (TInt)aValue;
+
+ TRAPD(err, CallMethodL(SetIntL, cenrep, key, value, mFunctionServer));
+ if (err != KErrNone)
+ {
+ JniUtils::throwNewException(aJni, "com/nokia/mid/cenrep/CentralRepositoryException" ,
+ JavaCommonUtils::intToString(err));
+ }
+}
+
+
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/javaextensions.pro
--- a/javaextensions/javaextensions.pro Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/javaextensions.pro Thu Sep 02 13:22:59 2010 +0300
@@ -22,6 +22,7 @@
SUBDIRS += satsa/build/javasatsa.pro
SUBDIRS += location/build/javalocation.pro
SUBDIRS += sensor/build/javasensor.pro
+SUBDIRS += centralrepository/build/javacentrep.pro
SUBDIRS += midppush
SUBDIRS += bluetooth
SUBDIRS += datagram
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java
--- a/javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/midprms_db/javasrc/com/nokia/mj/impl/rms/RecordIdCache.java Thu Sep 02 13:22:59 2010 +0300
@@ -88,8 +88,8 @@
private void insertRecordId(int aRecordId)
{
int[] temp = new int[iRecordIds.length + 1];
- temp[0] = aRecordId;
- System.arraycopy(iRecordIds, 0, temp, 1, iRecordIds.length);
+ temp[iRecordIds.length] = aRecordId;
+ System.arraycopy(iRecordIds, 0, temp, 0, iRecordIds.length);
iRecordIds = temp;
}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/tsrc/build/rmsintersuite.jad
--- a/javaextensions/midprms_db/tsrc/build/rmsintersuite.jad Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/midprms_db/tsrc/build/rmsintersuite.jad Thu Sep 02 13:22:59 2010 +0300
@@ -4,6 +4,6 @@
MicroEdition-Profile: MIDP-2.0
MIDlet-1: InterSuite,,j2meunitomj.MIDletTestRunner
MIDlet-Name: InterSuite
-MIDlet-Jar-Size: 69754
+MIDlet-Jar-Size: 70421
MIDlet-Jar-URL: rmsintersuite.jar
J2MEUnitTestClasses: com.nokia.mj.test.rms.TestInterSuiteAccess
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/tsrc/build/rmssharedtests.jad
--- a/javaextensions/midprms_db/tsrc/build/rmssharedtests.jad Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/midprms_db/tsrc/build/rmssharedtests.jad Thu Sep 02 13:22:59 2010 +0300
@@ -4,6 +4,6 @@
MicroEdition-Profile: MIDP-2.0
MIDlet-1: SharedStore,,j2meunitomj.MIDletTestRunner
MIDlet-Name: SharedStore
-MIDlet-Jar-Size: 69757
+MIDlet-Jar-Size: 70423
MIDlet-Jar-URL: rmssharedtests.jar
J2MEUnitTestClasses: com.nokia.mj.test.rms.CreateSharedStore
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/tsrc/build/rmstests.jad
--- a/javaextensions/midprms_db/tsrc/build/rmstests.jad Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/midprms_db/tsrc/build/rmstests.jad Thu Sep 02 13:22:59 2010 +0300
@@ -4,7 +4,7 @@
MicroEdition-Profile: MIDP-2.0
MIDlet-1: RmsUnitTests,,j2meunitomj.MIDletTestRunner
MIDlet-Name: RmsUnitTests
-MIDlet-Jar-Size: 69757
+MIDlet-Jar-Size: 70423
MIDlet-Jar-URL: rmstests.jar
J2MEUnitTestClasses: com.nokia.mj.test.rms.AllTests
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/midprms_db/tsrc/javasrc/com/nokia/mj/test/rms/TestRecordEnumeration.java
--- a/javaextensions/midprms_db/tsrc/javasrc/com/nokia/mj/test/rms/TestRecordEnumeration.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/midprms_db/tsrc/javasrc/com/nokia/mj/test/rms/TestRecordEnumeration.java Thu Sep 02 13:22:59 2010 +0300
@@ -139,6 +139,14 @@
}
}));
+ aSuite.addTest(new TestRecordEnumeration("testEnumerationOrder", new TestMethod()
+ {
+ public void run(TestCase tc)
+ {
+ ((TestRecordEnumeration) tc).testEnumerationOrder();
+ }
+ }));
+
return aSuite;
}
@@ -1147,5 +1155,56 @@
}
}
+ public void testEnumerationOrder()
+ {
+ // This test checks that record enumeration returns records in FIFO order
+ // if null RecordComparator is provided
+ // MIDP spec says that order is undefined in this case but many acceptance tests
+ // assume this order
+ System.out.println("TestRecordEnumeration.testEnumerationOrder()");
+ RecordStore store = null;
+ String rec_store_name = "testEnumerationOrder";
+
+ try
+ {
+ // 0: Init
+ System.out.println("0: Init");
+ try
+ {
+ RecordStore.deleteRecordStore(rec_store_name);
+ }
+ catch (Exception e) {}
+ store = RecordStore.openRecordStore(rec_store_name, true);
+ populateRecordStore(store);
+
+ // 1: check order
+ System.out.println("1: check order");
+ RecordEnumeration enumeration = store.enumerateRecords(null, null, false);
+ for(int i = 0; enumeration.hasNextElement(); i++)
+ {
+ byte[] r = enumeration.nextRecord();
+ assertEquals(r, iData[i].getBytes());
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Unexpected exception " + e);
+ }
+ finally
+ {
+ try
+ {
+ store.closeRecordStore();
+ }
+ catch (Exception e) {}
+ try
+ {
+ RecordStore.deleteRecordStore(rec_store_name);
+ }
+ catch (Exception e) {}
+ }
+ }
+
}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h
--- a/javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimagnlistadapter.h Thu Sep 02 13:22:59 2010 +0300
@@ -225,7 +225,8 @@
GetExternalItemModificationsByEntryTypeL(
CCalEntry::TType aEntryType);
- void DoExternalItemModificationsByEntryTypeL(CCalEntry::TType aEntryType);
+ void CPIMAgnListAdapter::DoExternalItemModificationsByEntryTypeL(
+ CCalEntry::TType aEntryType);
/**
* Fetches a CAgnEntry from the native Agenda Model.
@@ -267,7 +268,8 @@
*
* @param aEntryType Entry type for change callbacks (ToDo/Event/all).
*/
- void ConstructL(MCalChangeCallBack::TChangeEntryType aEntryType);
+ void ConstructL(MCalChangeCallBack::TChangeEntryType aEntryType,
+ CCalSession* aCalSession);
void DoClose();
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h
--- a/javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimeventadapteraccess.h Thu Sep 02 13:22:59 2010 +0300
@@ -73,13 +73,17 @@
MPIMLocalizationData** aRetLocalizationData);
TBool OpenEventListL(
- const TDesC* aListName,
+ CCalSession* aCalSession,
+
+ const TDesC* aCalNameArg,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
TBool OpenToDoListL(
- const TDesC* aListName,
+ CCalSession* aCalSession,
+
+ const TDesC* aCalNameArg,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h
--- a/javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimeventlistadapter.h Thu Sep 02 13:22:59 2010 +0300
@@ -27,6 +27,7 @@
// FORWARD DECLARATIONS
class MPIMEventItem;
class CPIMAgnEventAdapter;
+class CCalSession;
// CLASS DECLARATION
@@ -47,7 +48,8 @@
static CPIMEventListAdapter* NewL(
CCalEntry::TType aEntryType,
CPIMAgnEventAdapter* aEventAdapter,
- java::util::FunctionServer* aFuncServer);
+ java::util::FunctionServer* aFuncServer,
+ CCalSession *aCalSession);
/**
* Destructor.
@@ -137,7 +139,8 @@
*/
void CreateEventItemL(MPIMEventItem& aEventItem);
- void DoCreateEventItemL(MPIMEventItem& aEventItem);
+ void CPIMEventListAdapter::DoCreateEventItemL(
+ MPIMEventItem& aEventItem);
/**
* Reads an existing event item from the Agenda File.
@@ -162,7 +165,8 @@
*/
void ReadEventItemL(MPIMEventItem& aEventItem);
- void DoReadEventItemL(MPIMEventItem& aEventItem);
+ void CPIMEventListAdapter::DoReadEventItemL(
+ MPIMEventItem& aEventItem);
/**
* Writes an existing event item to the native Agenda File.
@@ -188,7 +192,8 @@
*/
void WriteEventItemL(MPIMEventItem& aEventItem);
- void DoWriteEventItemL(MPIMEventItem& aEventItem);
+ void CPIMEventListAdapter::DoWriteEventItemL(
+ MPIMEventItem& aEventItem);
/**
* Removes an existing event from the native Agenda File.
@@ -208,7 +213,8 @@
*/
void RemoveEventItemL(TPIMItemID aItemID);
- void DoRemoveEventItemL(TPIMItemID aItemID);
+ void CPIMEventListAdapter::DoRemoveEventItemL(
+ TPIMItemID aItemID);
protected:
@@ -222,7 +228,9 @@
*/
void ConstructL(
CCalEntry::TType aEntryType,
- CPIMAgnEventAdapter* aEventAdapter);
+
+ CPIMAgnEventAdapter* aEventAdapter,
+ TInt aCalSessionInt);
private: // Member data
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h
--- a/javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimtodoadapteraccess.h Thu Sep 02 13:22:59 2010 +0300
@@ -67,13 +67,17 @@
MPIMLocalizationData** aRetLocalizationData);
TBool OpenEventListL(
- const TDesC* aListName,
+ CCalSession* aCalSession,
+
+ const TDesC* aCalNameArg,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
TBool OpenToDoListL(
- const TDesC* aListName,
+ CCalSession* aCalSession,
+
+ const TDesC* aCalNameArg,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h
--- a/javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/inc.s60/cpimtodolistadapter.h Thu Sep 02 13:22:59 2010 +0300
@@ -44,7 +44,8 @@
/**
* Two-phased constructor.
*/
- static CPIMToDoListAdapter* NewL(java::util::FunctionServer* aFuncServer);
+ static CPIMToDoListAdapter* NewL(java::util::FunctionServer* aFuncServer,
+ CCalSession *aCalSession);
/**
* Destructor.
@@ -134,7 +135,8 @@
*/
void CreateToDoItemL(MPIMToDoItem& aToDoItem);
- void DoCreateToDoItemL(MPIMToDoItem& aToDoItem);
+ void CPIMToDoListAdapter::DoCreateToDoItemL(
+ MPIMToDoItem& aToDoItem);
/**
* Reads an existing To-Do item from the Agenda File.
@@ -159,7 +161,8 @@
*/
void ReadToDoItemL(MPIMToDoItem& aToDoItem);
- void DoReadToDoItemL(MPIMToDoItem& aToDoItem);
+ void CPIMToDoListAdapter::DoReadToDoItemL(
+ MPIMToDoItem& aToDoItem);
/**
* Writes an existing To-Do item to the native Agenda File.
@@ -185,7 +188,8 @@
*/
void WriteToDoItemL(MPIMToDoItem& aToDoItem);
- void DoWriteToDoItemL(MPIMToDoItem& aToDoItem);
+ void CPIMToDoListAdapter::DoWriteToDoItemL(
+ MPIMToDoItem& aToDoItem);
/**
* Removes an existing To-Do from the native Agenda File.
@@ -205,7 +209,8 @@
*/
void RemoveToDoItemL(TPIMItemID aItemID);
- void DoRemoveToDoItemL(TPIMItemID aItemID);
+ void CPIMToDoListAdapter::DoRemoveToDoItemL(
+ TPIMItemID aItemID);
protected:
@@ -217,7 +222,7 @@
/**
* By default Symbian 2nd phase constructor is private.
*/
- void ConstructL();
+ void ConstructL(TInt aCalSessionInt);
private: // Member data
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp
--- a/javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimagnapptadapter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -46,6 +46,7 @@
CPIMAgnApptAdapter* self = new(ELeave) CPIMAgnApptAdapter(aFuncServer);
CleanupStack::PushL(self);
CallMethodL(self, &CPIMAgnApptAdapter::ConstructL, self->iFuncServer);
+
CleanupStack::Pop(self);
return self;
}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp
--- a/javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimagnlistadapter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -19,7 +19,7 @@
// INCLUDE FILES
#include "cpimagnlistadapter.h"
#include "mpimitemdata.h"
-#include "javasymbianoslayer.h"
+#include "cleanupresetanddestroy.h"
#include "cpimagnserverwait.h"
#include "logger.h"
@@ -54,12 +54,14 @@
// -----------------------------------------------------------------------------
//
void CPIMAgnListAdapter::ConstructL(
- MCalChangeCallBack::TChangeEntryType aEntryType)
+
+ MCalChangeCallBack::TChangeEntryType aEntryType,
+ CCalSession* aCalSession)
{
JELOG2(EPim);
+
iServerWait = CPIMAgnServerWait::NewL();
- iCalSession = CCalSession::NewL();
- iCalSession->OpenL(iCalSession->DefaultFileNameL());
+ iCalSession = aCalSession;
iCalEntryView = CCalEntryView::NewL(*iCalSession, *iServerWait);
iServerWait->WaitCompleteL(KServerMaxWait);
@@ -285,10 +287,9 @@
void CPIMAgnListAdapter::CloseAgendaSession()
{
JELOG2(EPim);
+ iCalSession->StopChangeNotification();
delete iCalEntryView;
iCalEntryView = NULL;
-
- delete iCalSession;
iCalSession = NULL;
iChangesRead = ETrue;
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp
--- a/javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimeventadapteraccess.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -139,7 +139,8 @@
return EFalse;
}
-TBool CPIMEventAdapterAccess::OpenEventListL(const TDesC* aListName,
+TBool CPIMEventAdapterAccess::OpenEventListL(CCalSession* aCalSession,
+ const TDesC* aListName,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData)
@@ -181,8 +182,8 @@
CPIMAgnApptAdapter* adapter = CPIMAgnApptAdapter::NewL(iFuncServer);
CleanupStack::PushL(adapter);
- listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAppt, adapter,
- iFuncServer);
+ listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAppt,adapter,
+ iFuncServer, aCalSession);
CleanupStack::Pop(adapter);
CleanupStack::Pop(adapterManager);
@@ -200,8 +201,8 @@
CPIMAgnMemoAdapter* adapter = CPIMAgnMemoAdapter::NewL(iFuncServer);
CleanupStack::PushL(adapter);
- listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EEvent, adapter,
- iFuncServer);
+ listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EEvent,adapter,
+ iFuncServer, aCalSession);
CleanupStack::Pop(adapter);
CleanupStack::Pop(adapterManager);
@@ -219,8 +220,8 @@
CPIMAgnAnnivAdapter* adapter = CPIMAgnAnnivAdapter::NewL(iFuncServer);
CleanupStack::PushL(adapter);
- listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAnniv, adapter,
- iFuncServer);
+ listAdapter = CPIMEventListAdapter::NewL(CCalEntry::EAnniv,adapter,
+ iFuncServer, aCalSession);
CleanupStack::Pop(adapter);
CleanupStack::Pop(adapterManager);
@@ -244,9 +245,11 @@
return ETrue;
}
-TBool CPIMEventAdapterAccess::OpenToDoListL(const TDesC* /*aListName*/,
+TBool CPIMEventAdapterAccess::OpenToDoListL(CCalSession* /*aCalSession*/,
+ const TDesC* /*aListName*/,
MPIMToDoAdapterManager** /*aRetAdapterManager*/,
- MPIMToDoListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/)
+ MPIMToDoListAdapter** /*aRetListAdapter*/,
+ MPIMLocalizationData** /*aRetLocalizationData*/)
{
JELOG2(EPim);
// no ToDo lists
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp
--- a/javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimeventlistadapter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -49,10 +49,13 @@
// -----------------------------------------------------------------------------
//
void CPIMEventListAdapter::ConstructL(CCalEntry::TType aEntryType,
- CPIMAgnEventAdapter* aEventAdapter)
+
+ CPIMAgnEventAdapter* aEventAdapter,
+ TInt aCalSessionInt)
{
JELOG2(EPim);
- CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryEvent);
+ CCalSession* calSession = reinterpret_cast (aCalSessionInt);
+ CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryEvent, calSession);
iEntryType = aEntryType;
iAgnAdapter = aEventAdapter;
}
@@ -63,13 +66,17 @@
// -----------------------------------------------------------------------------
//
CPIMEventListAdapter* CPIMEventListAdapter::NewL(CCalEntry::TType aEntryType,
- CPIMAgnEventAdapter* aEventAdapter, java::util::FunctionServer* aFuncServer)
+ CPIMAgnEventAdapter* aEventAdapter,
+ java::util::FunctionServer* aFuncServer, CCalSession *aCalSession
+ )
{
JELOG2(EPim);
CPIMEventListAdapter* self = new(ELeave) CPIMEventListAdapter(aFuncServer);
CleanupStack::PushL(self);
+ TInt calSessionInt = reinterpret_cast (aCalSession);
CallMethodL(self, &CPIMEventListAdapter::ConstructL, aEntryType,
- aEventAdapter, self->iFuncServer);
+ aEventAdapter, calSessionInt,self->iFuncServer);
+
CleanupStack::Pop(self);
return self;
}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp
--- a/javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimtodoadapteraccess.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -106,16 +106,20 @@
return EFalse;
}
-TBool CPIMToDoAdapterAccess::OpenEventListL(const TDesC* /*aListName*/,
+TBool CPIMToDoAdapterAccess::OpenEventListL(CCalSession* /*aCalSession*/,
+ const TDesC* /*aListName*/,
MPIMEventAdapterManager** /*aRetAdapterManager*/,
- MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/)
+ MPIMEventListAdapter** /*aRetListAdapter*/,
+ MPIMLocalizationData** /*aRetLocalizationData*/
+ )
{
JELOG2(EPim);
// no Event lists
return EFalse;
}
-TBool CPIMToDoAdapterAccess::OpenToDoListL(const TDesC* aListName,
+TBool CPIMToDoAdapterAccess::OpenToDoListL(CCalSession* aCalSession,
+ const TDesC* aListName,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData)
@@ -136,7 +140,7 @@
(*iToDoListNames)[0]);
CleanupDeletePushL(adapterManager);
- MPIMToDoListAdapter* listAdapter = CPIMToDoListAdapter::NewL(iFuncServer);
+ MPIMToDoListAdapter* listAdapter = CPIMToDoListAdapter::NewL(iFuncServer, aCalSession);
CleanupStack::Pop(adapterManager);
MPIMLocalizationData* localizationData = iToDoLocalizationData;
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp
--- a/javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/agnadapter/src.s60/cpimtodolistadapter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -49,10 +49,11 @@
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
-void CPIMToDoListAdapter::ConstructL()
+void CPIMToDoListAdapter::ConstructL(TInt aCalSessionInt)
{
JELOG2(EPim);
- CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryTodo);
+ CCalSession* calSession = reinterpret_cast (aCalSessionInt);
+ CPIMAgnListAdapter::ConstructL(MCalChangeCallBack::EChangeEntryTodo, calSession);
iAgnToDoAdapter = CPIMAgnToDoAdapter::NewL(iFuncServer);
}
@@ -61,13 +62,14 @@
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
-CPIMToDoListAdapter* CPIMToDoListAdapter::NewL(
- java::util::FunctionServer* aFuncServer)
+CPIMToDoListAdapter* CPIMToDoListAdapter::NewL(java::util::FunctionServer* aFuncServer,
+ CCalSession *aCalSession)
{
JELOG2(EPim);
CPIMToDoListAdapter* self = new(ELeave) CPIMToDoListAdapter(aFuncServer);
CleanupStack::PushL(self);
- CallMethodL(self, &CPIMToDoListAdapter::ConstructL, self->iFuncServer);
+ TInt calSessionInt = reinterpret_cast (aCalSession);
+ CallMethodL(self, &CPIMToDoListAdapter::ConstructL,calSessionInt,self->iFuncServer);
CleanupStack::Pop(self);
return self;
}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/build/build.xml
--- a/javaextensions/pim/build/build.xml Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/build/build.xml Thu Sep 02 13:22:59 2010 +0300
@@ -39,6 +39,7 @@
+ com.nokia.mid.calendars=:pim.DynamicPropertyHandler
microedition.pim.version=1.0
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/build/javapim.pro
--- a/javaextensions/pim/build/javapim.pro Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/build/javapim.pro Thu Sep 02 13:22:59 2010 +0300
@@ -44,21 +44,21 @@
LIBS += -lbafl \
- -lBitmapTransforms \
+ -lbitmaptransforms \
-lcaleninterimutils2 \
-lcalinterimapi \
-lcntmodel \
-lefsrv \
-lestor \
-lfbscli \
- -lImageConversion \
+ -limageconversion \
-ltzclient \
-lvcal \
-lversit \
-lvcard \
-lefsrv \
- -lcommonengine \
- -lPlatformEnv
+ -lCommonEngine \
+ -lplatformenv
# Resource files
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h
--- a/javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/cntadapter/inc.s60/cpimcmadapteraccess.h Thu Sep 02 13:22:59 2010 +0300
@@ -26,6 +26,7 @@
// FORWARD DECLARATIONS
class MPIMLocalizationManager;
class MPIMLocalizationData;
+class CCalSession;
// CLASS DECLARATION
/**
@@ -63,12 +64,14 @@
MPIMLocalizationData** aRetLocalizationData);
TBool OpenEventListL(
+ CCalSession* aCalSession,
const TDesC* aListName,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData);
TBool OpenToDoListL(
+ CCalSession* aCalSession,
const TDesC* aListName,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h
--- a/javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/cntadapter/inc.s60/cpimcontactlistadapter.h Thu Sep 02 13:22:59 2010 +0300
@@ -195,7 +195,7 @@
*/
void Close();
- void DoClose();
+ void CPIMContactListAdapter::DoClose();
public: // MPIMContactListAdapter
@@ -223,7 +223,8 @@
*/
void CreateContactItemL(MPIMContactItem& aContactItem);
- void DoCreateContactItemL(MPIMContactItem& aContactItem);
+ void CPIMContactListAdapter::DoCreateContactItemL(
+ MPIMContactItem& aContactItem);
/**
* Reads an existing contact item from the native database.
@@ -248,7 +249,8 @@
*/
void ReadContactItemL(MPIMContactItem& aContactItem);
- void DoCallReadContactItemL(MPIMContactItem& aContactItem);
+ void CPIMContactListAdapter::DoCallReadContactItemL(
+ MPIMContactItem& aContactItem);
/**
* Reads an existing contact item from the native database
@@ -269,9 +271,11 @@
* native database.
* @li Other - The list adapter is non-functional.
*/
- void ReadMinimalContactItemL(MPIMContactItem& aContactItem);
+ void ReadMinimalContactItemL(
+ MPIMContactItem& aContactItem);
- void DoCallReadMinimalContactItemL(MPIMContactItem& aContactItem);
+ void CPIMContactListAdapter::DoCallReadMinimalContactItemL(
+ MPIMContactItem& aContactItem);
/**
* Reads an existing contact item from the native database
@@ -311,7 +315,7 @@
void ReadContactFieldL(MPIMContactItem& aContactItem,
TPIMContactField aContactField);
- void DoReadContactFieldL(
+ void CPIMContactListAdapter::DoReadContactFieldL(
MPIMContactItem& aContactItem,
TPIMContactField aContactField);
@@ -339,7 +343,8 @@
*/
void WriteContactItemL(MPIMContactItem& aContactItem);
- void DoWriteContactItemL(MPIMContactItem& aContactItem);
+ void CPIMContactListAdapter::DoWriteContactItemL(
+ MPIMContactItem& aContactItem);
/**
* Removes an existing contact from the native database.
@@ -410,7 +415,7 @@
* @param aContactItemViewDef View definition which is used for
* reading the contact item from the database
*/
- void DoReadContactItemL(
+ void CPIMContactListAdapter::DoReadContactItemL(
MPIMContactItem& aContactItem,
const CContactItemViewDef& aContactItemViewDef);
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp
--- a/javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/cntadapter/src.s60/cpimcmadapteraccess.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -75,16 +75,16 @@
return ETrue;
}
-TBool CPIMCMAdapterAccess::OpenEventListL(const TDesC* /*aListName*/,
+TBool CPIMCMAdapterAccess::OpenEventListL(CCalSession* /*aCalSession*/, const TDesC* /*aListName*/,
MPIMEventAdapterManager** /*aRetAdapterManager*/,
- MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData */)
+ MPIMEventListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData*/)
{
JELOG2(EPim);
// no Event lists
return EFalse;
}
-TBool CPIMCMAdapterAccess::OpenToDoListL(const TDesC* /*aListName*/,
+TBool CPIMCMAdapterAccess::OpenToDoListL(CCalSession* /*aCalSession*/, const TDesC* /*aListName*/,
MPIMToDoAdapterManager** /*aRetAdapterManager*/,
MPIMToDoListAdapter** /*aRetListAdapter*/, MPIMLocalizationData** /*aRetLocalizationData */)
{
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp
--- a/javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/cntadapter/src.s60/cpimcontactitemadapter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -193,12 +193,12 @@
JELOG2(EPim);
const CDesCArray& pimCategories = aItem.ItemData().Categories();
const TInt pimCategoryCount = pimCategories.Count();
- CArrayFix* newCategoryTable = new(ELeave) CArrayFixFlat (pimCategoryCount);
- CleanupStack::PushL(newCategoryTable);
+ TBool* newCategoryTable = new(ELeave) TBool[pimCategoryCount];
+ CleanupArrayDeletePushL(newCategoryTable);
TInt i = 0;
for (i = 0; i < pimCategoryCount; i++)
{
- newCategoryTable->InsertL(TRUE,i);
+ newCategoryTable[i] = ETrue;
}
CContactIdArray* cardCategories = aCard.GroupsJoinedLC();
@@ -220,14 +220,14 @@
}
else
{
- // old group
- newCategoryTable->InsertL(FALSE,pos);
+ // old group
+ newCategoryTable[pos] = EFalse;
}
}
// then add new categories
for (i = 0; i < pimCategoryCount; i++)
{
- if (newCategoryTable->At(i))
+ if (newCategoryTable[i])
{
TPtrC category = pimCategories[i];
iCategoryManager.AddToGroupL(id, category);
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp
--- a/javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/cntadapter/src.s60/cpimcontactlistadapter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -809,8 +809,7 @@
EPIMPanicInvalidItemID));
// Read contact item using the item view definition
CContactCard* contactItem =
- static_cast(iDatabase->ReadContactLC(id,
- aContactItemViewDef));
+ static_cast(iDatabase->ReadContactLC(id,aContactItemViewDef));
// Set date and fill the PIM item
TTime lastModified = contactItem->LastModified();
aContactItem.SetLastModifiedL(lastModified);
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/common/inc.s60/mpimadapteraccess.h
--- a/javaextensions/pim/common/inc.s60/mpimadapteraccess.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/common/inc.s60/mpimadapteraccess.h Thu Sep 02 13:22:59 2010 +0300
@@ -31,6 +31,7 @@
class MPIMToDoAdapterManager;
class MPIMToDoListAdapter;
class MPIMLocalizationData;
+class CCalSession;
// CLASS DECLARATION
@@ -129,7 +130,9 @@
* @li \c KErrNotFound - The native database does not exist any more.
* @li Other - The system is non-functional.
*/
- virtual TBool OpenEventListL(const TDesC* aListName,
+ virtual TBool OpenEventListL(CCalSession* aCalSession,
+ const TDesC* aListName,
+ //const TDesC* aCalNameArg,
MPIMEventAdapterManager** aRetAdapterManager,
MPIMEventListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData) = 0;
@@ -163,7 +166,9 @@
* @li \c KErrNotFound - The native database does not exist any more.
* @li Other - The system is non-functional.
*/
- virtual TBool OpenToDoListL(const TDesC* aListName,
+ virtual TBool OpenToDoListL(CCalSession* aCalSession,
+ const TDesC* aListName,
+ //const TDesC* aCalNameArg,
MPIMToDoAdapterManager** aRetAdapterManager,
MPIMToDoListAdapter** aRetListAdapter,
MPIMLocalizationData** aRetLocalizationData) = 0;
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/inc.s60/cleanupresetanddestroy.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/pim/framework/inc.s60/cleanupresetanddestroy.h Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Cleanup Stack "reset and destroy" push operation.
+ *
+*/
+
+
+#ifndef CLEANUPRESETANDDESTROY_H
+#define CLEANUPRESETANDDESTROY_H
+
+// INCLUDE FILES
+#include
+
+/**
+ * An operation for pushing objects to cleanup stack with \c TCleanupItems
+ * that will perform a \c ResetAndDestroy() operation on the pushed object
+ * if a leave occurs.
+ *
+ * Note that the object itself will not be deleted.
+ *
+ * @par Example:
+ * Here is an example of using \c CleanupResetAndDestroy with a dynamically
+ * allocated \c RPointerArray. \c RPointerArray clears its contents with a
+ * \cResetAndDestroy() operation.
+ * @code
+ *
+ * // A function which creates a pointer array with couple of initialized
+ * // CThings. The function must return a pointer to the pointer array,
+ * // because the array has to be allocated dynamically. CThing is some
+ * // simple CBase-derived class.
+ *
+ * RPointerArray< CThing >* CreateThingArrayL( )
+ * {
+ * // Create an array of pointers to CThings with granularity of 4
+ *
+ * RPointerArray< CThing >* things =
+ * new( ELeave ) RPointerArray< CThing >( 4 );
+ *
+ * // Push pointer to the array to the cleanup stack; then push reference
+ * // to the array and a ResetAndDestroy operation to the cleanup stack.
+ *
+ * // (Note that order of these operations matters: the ResetAndDestroy
+ * // operation must be performed before the array itself is deleted.)
+ *
+ * CleanupStack::PushL( things );
+ * CleanupResetAndDestroyPushL( *things );
+ *
+ * // Add couple of CThings with magic numbers to the array.
+ * // If any of the NewL() operations leaves, the array will be cleared
+ * // with ResetAndDestroy() and the array itself will destroyed.
+ *
+ * User::LeaveIfError( things->Append( CThing::NewL( 7 ) ) );
+ * User::LeaveIfError( things->Append( CThing::NewL( 96 ) ) );
+ * User::LeaveIfError( things->Append( CThing::NewL( 999 ) ) );
+ *
+ * // Pop the array reference with ResetAndDestroy from cleanup stack
+ * // then pop the pointer to the array itself.
+ *
+ * CleanupStack::Pop(); // *things
+ * CleanupStack::Pop(); // things
+ *
+ * // Now we're ready to return the results (a pointer to the array)
+ * return things;
+ * }
+ *
+ * @endcode
+ */
+template
+inline void CleanupResetAndDestroyPushL(T& aRef);
+
+/**
+ * See \ref CleanupResetAndDestroyPushL() documentation.
+ */
+template
+class CleanupResetAndDestroy
+{
+public:
+ inline static void PushL(T& aRef);
+
+private:
+ static void ResetAndDestroy(TAny *aPtr);
+};
+
+template
+inline void CleanupResetAndDestroy::PushL(T& aRef)
+{
+ CleanupStack::PushL(TCleanupItem(&ResetAndDestroy, &aRef));
+}
+
+template
+void CleanupResetAndDestroy::ResetAndDestroy(TAny *aPtr)
+{
+ static_cast(aPtr)->ResetAndDestroy();
+}
+
+template
+inline void CleanupResetAndDestroyPushL(T& aRef)
+{
+ CleanupResetAndDestroy::PushL(aRef);
+}
+
+#endif // CLEANUPRESETANDDESTROY_H
+// End of File
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/inc.s60/cpimmanager.h
--- a/javaextensions/pim/framework/inc.s60/cpimmanager.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/framework/inc.s60/cpimmanager.h Thu Sep 02 13:22:59 2010 +0300
@@ -43,6 +43,7 @@
class CPIMEventValidator;
class CPIMToDoValidator;
class MPIMAdapterAccess;
+class CCalSession;
// CLASS DECLARATION
@@ -77,6 +78,7 @@
* Destructor.
*/
virtual ~CPIMManager();
+ void DeleteSessions();
public: // New functions
@@ -113,6 +115,8 @@
* @param aPimListName Name of the list. The name must be valid list
* name. If not present, name is resolved to the default list
* of the given type.
+ * @param aCalName Name of the Canlendar. The name must be valid Canlendar
+ * name. If not present, name is resolved to the default Canlendar.
*
* @return PIM list. Type of the list corresponds to
* \a aPimListType argument.
@@ -130,6 +134,7 @@
pimbaselist* openPimList(
const TPIMListType& aPimListType,
jstring aPimListName,
+ jstring aCalName,
JNIEnv* aJniEnv);
/**
@@ -149,6 +154,48 @@
const TPIMListType& aPimListType,
jintArray aError,
JNIEnv* aJniEnv);
+ /**
+ * Lists list of Calendars existsing the mobile database.
+ *
+ * @return Array of list names.
+ * Caller takes the ownership of the returned object.
+ *
+ */
+ jobjectArray listCalendars(jintArray aError, JNIEnv* aJniEnv);
+
+ /**
+ * Lists list of Calendars names existsing the mobile database.
+ *
+ * @return Array of list names.
+ * Caller takes the ownership of the returned object.
+ */
+ jobjectArray listCalendarNames(jintArray aError, JNIEnv* aJniEnv);
+
+ /**
+ * create new calendar which you given name.
+ *
+ * @param calendar name Sting type this is used as filename.
+ *
+ * @param calendar name Sting type this is used as diaplay to the user.
+ *
+ * @return void.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \if name already exists
+ */
+ void createCalendar(jstring aCalName, jstring aDisplayName, JNIEnv* aJniEnv);
+
+ /**
+ * delete the calendar which you given name.
+ *
+ * @param calendar name Sting type this is used as canlader filename
+ * which it will delete.
+ * @return void.
+ *
+ * @par Leaving:
+ * @li \c KErrArgument - \a calendar name is not valid or not exists.
+ */
+ void deleteCalendar(jstring aCalName, JNIEnv* aJniEnv);
/**
* Provides a Contact validator.
@@ -187,28 +234,102 @@
* @return A new list or NULL if no matching list was found.
*/
CPIMEventList* DoOpenEventListL(
- const TDesC* aListName);
+ const TDesC* aListName, const TDesC* aCalName);
/**
* Opens a to-do list.
*
* @param aListName Name of the list or NULL to indicate
* default list.
- *
- * @return A new list or NULL if no matching list was found.
+ * @param aCalName Name of the calendar or NULL to indicate
+ * default calendar.
+ * @return A new list or NULL if no matching list and calendar was found.
*/
- CPIMToDoList* DoOpenToDoListL(
- const TDesC* aListName);
+ CPIMToDoList* DoOpenToDoListL(const TDesC* aListName, const TDesC* aCalName);
+
- CDesCArray* DoListPimListsL(
+ /**
+ * Opens a to-do list.
+ *
+ * @param aPimListType Name of the list or NULL to indicate
+ * default list.
+ * @return A new list or NULL if no matching list and calendar was found.
+ */
+ CDesCArray* CPIMManager::DoListPimListsL(
const TPIMListType& aPimListType);
- pimbaselist* DoOpenPimListL(
+ /**
+ * list all the calendars this function will call by ListCalendars function
+ *
+ * @return void.
+ */
+ void CPIMManager::DoListCalendarsL();
+
+ /**
+ * list all the calendars names this function will call by ListCalendatNames function
+ *
+ * @return void.
+ */
+ void CPIMManager::DoListCalendarNamesL();
+
+
+ /**
+ * creates the new calendar by given name.
+ *
+ * @param aFileName name of the calendar file this is string type.
+ *
+ * @param aDisplayName name of the calendar to display this is string type
+ *
+ * @return void.
+ */
+ void CPIMManager::DoCreateCalFileL(const TDesC &aFileName,const TDesC &aDisplayName);
+
+ /**
+ * delets the calendar by given name.
+ *
+ * @param aFileName name of the calendar file this is string type.
+ *
+ * @return void.
+ */
+ void CPIMManager::DoDeleteCalFileL(const TDesC& aFileName);
+
+ /**
+ * Opens a PIM list of given type.
+ *
+ * @param aPimListType List type.
+ * @param aPimListName Name of the list. The name must be valid list
+ * name. If not present, name is resolved to the default list
+ * of the given type.
+ * @param aCalName Name of the Canlendar. The name must be valid Canlendar
+ * name. If not present, name is resolved to the default Canlendar.
+ *
+ * @return PIM list. Type of the list corresponds to
+ * \a aPimListType argument.
+ *
+ * @par Leaving:
+ * The method leaves on error. Error codes should be interpreted as
+ * follows:
+ * @li \c KErrArgument - \a aPimListType is invalid.
+ * @li \c KErrNotSupported - \a aPimListType is not supported.
+ * @li \c KErrNotFound - No list was found by \a aPimListName.
+ * @li \c KErrAlreadyExists - The list was already opened and multiple
+ * instances of the list are not supported.
+ * @li Other - Internal error.
+ */
+ pimbaselist* CPIMManager::DoOpenPimListL(
const TPIMListType& aPimListType,
- const TDesC* aPimListName);
+ const TDesC* aPimListName,
+ const TDesC* aCalName);
+ /**
+ * this method will create the Sessions with every calendar using file server.
+ *
+ */
+
+ void CPIMManager::createCalSessionL();
void dispose();
+
private: // Constructors
/**
@@ -240,6 +361,23 @@
/** Owned. */
CPIMToDoValidator* iToDoValidator;
+ /** (Owned.) */
+ RLibrary iLocalizationLibrary;
+
+ CDesCArray* iCalList;
+ /** Session to calendar server. Owned. */
+ //CCalSession* iCalSession;
+
+ RPointerArray iCalSessions;
+
+ CDesCArray* iCalendarNamesDesCArray;
+
+ CDesCArray* iCalSessionArray;
+
+ CDesCArray* iCalListName;
+ CDesCArrayFlat* iDesCArray;
+ CCalSession* iCalSession;
+
};
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/inc/pimbasemanager.h
--- a/javaextensions/pim/framework/inc/pimbasemanager.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/framework/inc/pimbasemanager.h Thu Sep 02 13:22:59 2010 +0300
@@ -35,13 +35,22 @@
virtual MPIMLocalizationManager* localizationManager() const = 0;
virtual pimbaselist* openPimList(const TPIMListType& aPimListType,
- jstring aPimListName, JNIEnv* aJniEnv) = 0;
+ jstring aPimListName, jstring aCalName,
+ JNIEnv* aJniEnv) = 0;
virtual jobjectArray listPimLists(const TPIMListType& aPimListType,
jintArray aError, JNIEnv* aJniEnv) = 0;
+ virtual jobjectArray listCalendars(jintArray aError,
+ JNIEnv* aJniEnv) = 0;
+ virtual jobjectArray listCalendarNames(jintArray aError,
+ JNIEnv* aJniEnv) = 0;
virtual void dispose()= 0;
+ virtual void createCalendar(jstring aCalName, jstring aDisplayName, JNIEnv* aJniEnv) = 0;
+
+ virtual void deleteCalendar(jstring aCalName, JNIEnv* aJniEnv) = 0;
+
static pimbasemanager* getInstance();
};
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/cpimeventlist.cpp
--- a/javaextensions/pim/framework/src.s60/cpimeventlist.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/cpimeventlist.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -29,7 +29,7 @@
#include "pimjnitools.h"
#include "pimutils.h"
#include "s60commonutils.h"
-#include "javasymbianoslayer.h"
+#include "cleanupresetanddestroy.h"
#include "logger.h"
CPIMEventList::CPIMEventList(const CPIMEventValidator& aValidator) :
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/cpimlist.cpp
--- a/javaextensions/pim/framework/src.s60/cpimlist.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/cpimlist.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -25,7 +25,7 @@
#include "cpimitem.h"
#include "cpimitemmatcher.h"
#include "cpimstringmatcher.h"
-#include "javasymbianoslayer.h"
+#include "cleanupresetanddestroy.h"
#include "pimexternalchanges.h"
#include "pimpanics.h"
#include "pimjnitools.h"
@@ -927,9 +927,9 @@
User::LeaveIfError(newAndRemovedItems->Append(
tempRemovedItems[i]));
}
- CleanupStack::Pop(newAndRemovedItems);
+
CleanupStack::Pop(); // newAndRemovedItems cleanup close
-
+ CleanupStack::Pop(newAndRemovedItems);
CleanupStack::PopAndDestroy(); // tempRemovedItems cleanup close
CleanupStack::PopAndDestroy(); // tempNewItems cleanup close
@@ -1163,6 +1163,7 @@
RPointerArray& aTempNewItems, CPIMItem* aMatchingItem)
{
JELOG2(EPim);
+
// Create new item
CPIMItem* newItem = NULL;
TRAPD(errCreateItem, newItem = DoCreateItemL(aNewItemId,
@@ -1179,13 +1180,10 @@
{
User::LeaveIfError(errCreateItem);
}
-
- // OK
newItem->SetModified(EFalse);
CleanupStack::PushL(newItem);
User::LeaveIfError(iItems.Append(newItem));
CleanupStack::Pop(newItem);
-
// Add to list of new items
CleanupClosePushL(aTempNewItems);
TInt errAddToNewItems = aTempNewItems.Append(newItem);
@@ -1217,8 +1215,6 @@
{
User::LeaveIfError(errUpdateItem);
}
-
- // OK
aModifiedItem.SetModified(EFalse);
}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/cpimmanager.cpp
--- a/javaextensions/pim/framework/src.s60/cpimmanager.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/cpimmanager.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -17,35 +17,44 @@
// INCLUDE FILES
-#include "cpimmanager.h"
+
#include
#include
-#include "pimcommon.h"
+#include
+#include
+#ifdef RD_JAVA_PIM_MULTICAL_ENABLED
+#include
+#include
+#endif
+#include "cpimmanager.h"
+#include "cpimcontactlist.h"
+#include "cpimcontactvalidator.h"
+#include "cpimeventvalidator.h"
+#include "cpimtodovalidator.h"
+#include "cpimeventlist.h"
+#include "cpimtodolist.h"
+#include "cpimversit.h"
+#include "cpimcmadapteraccess.h"
+#include "cpimeventadapteraccess.h"
+#include "cpimtodoadapteraccess.h"
+#include "cpimlocalizationmanager.h"
+#include "fs_methodcall.h"
+#include "jstringutils.h"
+#include "logger.h"
#include "mpimcontactadaptermanager.h"
#include "mpimeventadaptermanager.h"
#include "mpimtodoadaptermanager.h"
#include "mpimcontactlistadapter.h"
#include "mpimeventlistadapter.h"
#include "mpimtodolistadapter.h"
-#include "cpimversit.h"
#include "mpimlocalizationmanager.h"
#include "mpimlocalizationdata.h"
-#include "cpimcontactlist.h"
-#include "cpimeventlist.h"
-#include "cpimtodolist.h"
-#include "cpimcontactvalidator.h"
-#include "cpimeventvalidator.h"
-#include "cpimtodovalidator.h"
#include "mpimadapteraccess.h"
-#include "cpimcmadapteraccess.h"
-#include "cpimeventadapteraccess.h"
-#include "cpimtodoadapteraccess.h"
+#include "pimcommon.h"
#include "pimpanics.h"
#include "pimjnitools.h"
#include "pimutils.h"
-#include "jstringutils.h"
-#include "logger.h"
-#include "cpimlocalizationmanager.h"
+#include "s60commonutils.h"
// CONSTANTS
@@ -55,10 +64,12 @@
* low, at the time of writing 1 to 4.
*/
const TInt KManagerArrayGranularity = 2;
-
+#ifdef RD_JAVA_PIM_MULTICAL_ENABLED
+const TInt KBuffLength = 24;
+#endif
CPIMManager::CPIMManager() :
- java::util::FunctionServer("CPIMManager"), iAdapterAccesses()
+ java::util::FunctionServer("CPIMManager"), iAdapterAccesses(), iCalSessions()
{
JELOG2(EPim);
}
@@ -69,18 +80,86 @@
iContactValidator = CPIMContactValidator::NewL();
iEventValidator = CPIMEventValidator::NewL();
iToDoValidator = CPIMToDoValidator::NewL();
-
+ iDesCArray = new(ELeave) CDesCArrayFlat(KManagerArrayGranularity);
iLocalizationManager
= (MPIMLocalizationManager*)(CPIMLocalizationManager::NewL());
createServerToNewThread();
+ CallMethodL(this, &CPIMManager::createCalSessionL, this);
+}
+
+void CPIMManager::createCalSessionL()
+{
+ iCalSession = CCalSession::NewL();
+ //CleanupStack::PushL(iCalSession);
+ iCalSessionArray = iCalSession->ListCalFilesL();
+
+ TInt index = 0;
+ TInt find = iCalSessionArray->Find(iCalSession->DefaultFileNameL(),index);
+
+ if (!find)
+ {
+ iCalSessionArray->Delete(index);
+ }
+
+ TRAPD(err, iCalSession->OpenL(iCalSession->DefaultFileNameL()));
+ if (KErrNotFound == err)
+ {
+ iCalSession->CreateCalFileL(iCalSession->DefaultFileNameL());
+ iCalSession->OpenL(iCalSession->DefaultFileNameL());
+ }
+ else
+ {
+ User::LeaveIfError(err);
+ }
+ //CleanupStack::Pop(iCalSession);
+
+#ifdef RD_JAVA_PIM_MULTICAL_ENABLED
+ TInt iterate = 0;
+ TBool softDelete = EFalse;
+
+ while (iterate < iCalSessionArray->Count())
+ {
+ CCalSession* aCalSession = CCalSession::NewL(*iCalSession);
+ CleanupStack::PushL(aCalSession);
+ aCalSession->OpenL(iCalSessionArray->MdcaPoint(iterate));
+ CCalCalendarInfo* caleninfo = aCalSession->CalendarInfoL();
+ CleanupStack::PushL(caleninfo);
+ aCalSession->SetCalendarInfoL(*caleninfo);
+
+ TBuf8 keyBuff;
+ keyBuff.Zero();
+ keyBuff.AppendNum(EMarkAsDelete);
+ TPckgC pkgSoftDelete(softDelete);
+ TRAPD(err,pkgSoftDelete.Set(caleninfo->PropertyValueL(keyBuff)));
+ if (KErrNone == err)
+ {
+ softDelete = pkgSoftDelete();
+ }
+
+ if (softDelete)
+ {
+
+ CleanupStack::PopAndDestroy(caleninfo);
+ CleanupStack::PopAndDestroy(aCalSession);
+ }
+ else
+ {
+ iCalSessions.AppendL(aCalSession);
+ iDesCArray->AppendL(iCalSessionArray->MdcaPoint(iterate));
+ CleanupStack::PopAndDestroy(caleninfo);
+ CleanupStack::Pop(aCalSession);
+ }
+ iterate++;
+ }
+ delete iCalSessionArray;
+ iCalSessionArray = NULL;
+#endif
}
pimbasemanager* pimbasemanager::getInstance()
{
JELOG2(EPim);
- // Create CPIMManager
-
CPIMManager* self = NULL;
TInt error = KErrNone;
TRAP(error, self = CPIMManager::NewL());
@@ -135,9 +214,18 @@
delete iEventValidator;
iEventValidator = NULL;
delete iToDoValidator;
+ CallMethod(this, &CPIMManager::DeleteSessions, this);
+ delete iDesCArray;
iToDoValidator = NULL;
stopServer();
}
+void CPIMManager::DeleteSessions()
+{
+ JELOG2(EPim);
+ iCalSessions.ResetAndDestroy();
+ delete iCalSession;
+ iCalSession = NULL;
+}
void CPIMManager::dispose()
{
@@ -163,21 +251,24 @@
}
pimbaselist* CPIMManager::openPimList(const TPIMListType& aPimListType,
- jstring aPimListName, JNIEnv* aJniEnv)
+ jstring aPimListName, jstring aCalName,
+ JNIEnv* aJniEnv)
{
JELOG2(EPim);
const JStringUtils listName(*aJniEnv, aPimListName);
const TDesC* listNameArg = (aPimListName ? &listName : NULL);
+ const JStringUtils calName(*aJniEnv, aCalName);
+ const TDesC* calNameArg = (aCalName ? &calName : NULL);
pimbaselist* list = NULL;
TInt error = KErrNone;
- TRAP(error, list = DoOpenPimListL(aPimListType, listNameArg));
+ TRAP(error, list = DoOpenPimListL(aPimListType, listNameArg, calNameArg));
if (error != KErrNone)
throw error;
return list;
}
pimbaselist* CPIMManager::DoOpenPimListL(const TPIMListType& aPimListType,
- const TDesC* aPimListName)
+ const TDesC* aPimListName, const TDesC* aCalNameArg)
{
JELOG2(EPim);
pimbaselist* list = NULL;
@@ -188,20 +279,18 @@
}
else if (aPimListType == EPIMEventList)
{
- list = DoOpenEventListL(aPimListName);
+ list = DoOpenEventListL(aPimListName, aCalNameArg);
}
else if (aPimListType == EPIMToDoList)
{
- list = DoOpenToDoListL(aPimListName);
+ list = DoOpenToDoListL(aPimListName, aCalNameArg);
}
else
{
// invalid list type
User::Leave(KErrArgument);
}
-
// Check results
-
if (!list)
{
if (aPimListName)
@@ -241,9 +330,6 @@
retVal->AppendL(lists[listIndex]);
}
}
-
- // Done
-
CleanupStack::Pop(retVal);
return retVal;
@@ -276,6 +362,276 @@
return javaStringArray;
}
+
+
+
+
+void CPIMManager::DoListCalendarsL()
+{
+
+#ifdef RD_JAVA_PIM_MULTICAL_ENABLED
+ iCalList = iCalSession->ListCalFilesL();
+
+ TInt index = 0;
+ TInt find = iCalList->Find(iCalSession->DefaultFileNameL(),index);
+
+ if (!find)
+ {
+ iCalList->Delete(index);
+ }
+ iCalSessionArray = iCalList;
+ TInt iterate = 0;
+ TInt aPosition = 0;
+ while (iterate < iCalList->Count())
+ {
+ aPosition = 0;
+
+ TInt findInCurrentArray = iDesCArray->Find(iCalList->MdcaPoint(iterate),aPosition, ECmpNormal16);
+ CCalSession* aCalSession;
+ if (findInCurrentArray == 0)
+ {
+ aCalSession = iCalSessions[aPosition];
+ }
+ else
+ {
+ aCalSession = CCalSession::NewL(*iCalSession);
+ CleanupStack::PushL(aCalSession);
+ aCalSession->OpenL(iCalList->MdcaPoint(iterate));
+ }
+ // check for soft deleted calendars, incase of calendars being held by other applications, this will be followed.
+ CCalCalendarInfo* caleninfo = aCalSession->CalendarInfoL();
+ CleanupStack::PushL(caleninfo);
+ aCalSession->SetCalendarInfoL(*caleninfo);
+ TBool softDelete = EFalse;
+ TBuf8 keyBuff;
+ keyBuff.Zero();
+ keyBuff.AppendNum(EMarkAsDelete);
+
+ TPckgC pkgSoftDelete(softDelete);
+
+ TRAPD(err,pkgSoftDelete.Set(caleninfo->PropertyValueL(keyBuff)));
+
+ if (KErrNone == err)
+ {
+ softDelete = pkgSoftDelete();
+ }
+
+ if (!softDelete && findInCurrentArray != 0)
+ {
+ iCalSessions.AppendL(aCalSession);
+ CleanupStack::Pop(aCalSession);
+ iDesCArray->AppendL(iCalList->MdcaPoint(iterate));
+ }
+ else if (softDelete && findInCurrentArray == 0)
+ {
+ CleanupStack::PopAndDestroy(caleninfo);
+ caleninfo = NULL;
+ delete aCalSession;
+ iCalSessions[aPosition] = NULL;
+ iCalSessions.Remove(aPosition);
+ iDesCArray->Delete(aPosition);
+
+ }
+ else if (softDelete && findInCurrentArray != 0)
+ {
+ CleanupStack::PopAndDestroy(caleninfo);
+ CleanupStack::PopAndDestroy(aCalSession);
+ caleninfo=NULL;
+ aCalSession = NULL;
+ }
+ if (caleninfo != NULL)
+ {
+ CleanupStack::PopAndDestroy(caleninfo);
+ caleninfo = NULL;
+ }
+ iterate++;
+
+ }
+
+ iCalList = iDesCArray;
+ iCalList->AppendL(iCalSession->DefaultFileNameL());
+ delete iCalSessionArray;
+ iCalSessionArray = NULL;
+#endif
+
+}
+
+
+jobjectArray CPIMManager::listCalendars(jintArray aError,
+ JNIEnv* aJniEnv)
+{
+
+ jobjectArray javaStringArray = NULL;
+ TInt error = KErrNone;
+ TRAP(error, CallMethodL(this, &CPIMManager::DoListCalendarsL, this));
+ if (error == KErrNone)
+ {
+ javaStringArray = CreateJavaStringArray(aJniEnv, *iCalList, EFalse);
+ if (!javaStringArray)
+ {
+ SetJavaErrorCode(aJniEnv, aError, KErrNoMemory);
+ }
+ iCalList = NULL;
+ TInt index = 0;
+ TInt find = 0;
+ TRAPD(error,find = iDesCArray->Find(iCalSession->DefaultFileNameL(),index));
+ if (error == KErrNone)
+ if (!find)
+ {
+ iDesCArray->Delete(index);
+ }
+ else
+ {
+ SetJavaErrorCode(aJniEnv, aError, error);
+ }
+ }
+ else
+ {
+
+ SetJavaErrorCode(aJniEnv, aError, error);
+ }
+ return javaStringArray;
+}
+
+jobjectArray CPIMManager::listCalendarNames(jintArray aError,
+ JNIEnv* aJniEnv)
+{
+ jobjectArray javaStringArray = NULL;
+ TInt error = KErrNone;
+ TRAP(error, CallMethodL(this, &CPIMManager::DoListCalendarNamesL, this));
+ if (error == KErrNone)
+ {
+ javaStringArray = CreateJavaStringArray(aJniEnv, *iCalListName, EFalse);
+ if (!javaStringArray)
+ {
+ SetJavaErrorCode(aJniEnv, aError, KErrNoMemory);
+ }
+ delete iCalListName;
+ iCalListName = NULL;
+ }
+ else
+ {
+ SetJavaErrorCode(aJniEnv, aError, error);
+ }
+ return javaStringArray;
+}
+
+void CPIMManager::DoListCalendarNamesL()
+{
+#ifdef RD_JAVA_PIM_MULTICAL_ENABLED
+ iCalListName = new(ELeave) CDesCArrayFlat(KManagerArrayGranularity);
+ //CleanupStack::PushL(iCalListName);
+ for (int iterate = 0; iterate < iDesCArray->Count(); iterate++)
+ {
+ CCalCalendarInfo* caleninfo = iCalSessions[iterate]->CalendarInfoL();
+ CleanupStack::PushL(caleninfo);
+ iCalListName->AppendL(caleninfo->NameL());
+
+ CleanupStack::PopAndDestroy(caleninfo);
+ }
+ CCalCalendarInfo* caleninfo = iCalSession->CalendarInfoL();
+ CleanupStack::PushL(caleninfo);
+ iCalListName->AppendL(caleninfo->NameL());
+
+ CleanupStack::PopAndDestroy(caleninfo);
+ //CleanupStack::Pop(iCalListName);
+#endif
+}
+void CPIMManager::createCalendar(jstring aCalName,jstring aDisplayName, JNIEnv* aJniEnv)
+{
+ const JStringUtils calName(*aJniEnv, aCalName);
+ const JStringUtils displayName(*aJniEnv, aDisplayName);
+ const TDesC* displayNameArg = (aDisplayName ? &displayName : NULL);
+ const TDesC* calNameArg = (aCalName ? &calName : NULL);
+ TInt error = KErrNone;
+ TRAP(error, CallMethodL(this, &CPIMManager::DoCreateCalFileL, *calNameArg,*displayNameArg, this));
+ if (error != KErrNone)
+ throw error;
+}
+
+void CPIMManager::DoCreateCalFileL(const TDesC& aFileName, const TDesC& aDisplayName)
+{
+ #ifdef RD_JAVA_PIM_MULTICAL_ENABLED
+
+ CCalSession* aCalSession = CCalSession::NewL(*iCalSession);
+ CleanupStack::PushL(aCalSession);
+ CCalCalendarInfo* calendarInfo = CCalCalendarInfo::NewL();
+ CleanupStack::PushL(calendarInfo);
+
+ aCalSession->CreateCalFileL(aFileName,*calendarInfo);
+ CleanupStack::PopAndDestroy(calendarInfo);
+ aCalSession->OpenL(aFileName);
+ CCalCalendarInfo* calendarinfostack = aCalSession->CalendarInfoL();
+ CleanupStack::PushL(calendarinfostack);
+
+ calendarinfostack->SetNameL(aDisplayName);
+ calendarinfostack->SetEnabled(ETrue);
+ aCalSession->SetCalendarInfoL(*calendarinfostack);
+ CleanupStack::PopAndDestroy(calendarinfostack);
+ iCalSessions.AppendL(aCalSession);
+ iDesCArray->AppendL(aFileName);
+ CleanupStack::Pop(aCalSession);
+
+ #endif
+}
+
+void CPIMManager::deleteCalendar(jstring aCalName, JNIEnv* aJniEnv)
+{
+ const JStringUtils calName(*aJniEnv, aCalName);
+ const TDesC* calNameArg = (aCalName ? &calName : NULL);
+ TInt error = KErrNone;
+ TRAP(error, CallMethodL(this, &CPIMManager::DoDeleteCalFileL, *calNameArg, this));
+ if (error != KErrNone)
+ throw error;
+
+}
+
+
+void CPIMManager::DoDeleteCalFileL(const TDesC& aFileName)
+{
+ #ifdef RD_JAVA_PIM_MULTICAL_ENABLED
+
+ if (aFileName != iCalSession->DefaultFileNameL())
+ {
+ TInt aPosition = 0;
+ TInt findInCurrentArray = iDesCArray->Find(aFileName, aPosition, ECmpNormal16);
+ if (findInCurrentArray == 0)
+ {
+ CCalCalendarInfo* caleninfo = iCalSessions[aPosition]->CalendarInfoL();
+ CleanupStack::PushL(caleninfo);
+
+ caleninfo->SetEnabled(EFalse);
+
+ TBuf8 keyBuff;
+
+ keyBuff.Zero();
+ keyBuff.AppendNum(EMarkAsDelete);
+ TPckgC pkgSoftDelete(ETrue);
+ caleninfo->SetPropertyL(keyBuff, pkgSoftDelete);
+
+ CleanupStack::PopAndDestroy(caleninfo);
+ TRAP_IGNORE(iCalSessions[aPosition]->DeleteCalFileL(aFileName));
+
+ delete iCalSessions[aPosition];
+ iCalSessions[aPosition]= NULL;
+ iCalSessions.Remove(aPosition);
+
+ iDesCArray->Delete(aPosition);
+ }
+ else
+ {
+ User::Leave(KErrNotFound);
+ }
+
+ }
+ else
+ {
+ User::Leave(KErrAccessDenied);
+ }
+
+ #endif
+}
+
const CPIMContactValidator& CPIMManager::ContactValidator()
{
JELOG2(EPim);
@@ -309,26 +665,20 @@
if (iAdapterAccesses[i]->OpenContactListL(aListName,
&contactAdapterManager, &contactListAdapter, &localizationData))
{
- // got one
CleanupDeletePushL(contactAdapterManager);
CleanupDeletePushL(contactListAdapter);
-
contactList = CPIMContactList::NewL(contactAdapterManager,
contactListAdapter, localizationData, *iContactValidator);
-
CleanupStack::Pop(contactListAdapter);
CleanupStack::Pop(contactAdapterManager);
-
break;
}
-
- // else try next Adapter Access
}
return contactList;
}
-CPIMEventList* CPIMManager::DoOpenEventListL(const TDesC* aListName)
+CPIMEventList* CPIMManager::DoOpenEventListL(const TDesC* aListName, const TDesC* aCalNameArg)
{
JELOG2(EPim);
CPIMEventList* eventList = NULL;
@@ -337,22 +687,40 @@
MPIMEventListAdapter* eventListAdapter = NULL;
MPIMLocalizationData* localizationData = NULL;
+
+ CCalSession* calSession = NULL;
+ TInt findInCurrentArray = 0;
+ TInt aPosition = 0;
+ if (aCalNameArg == NULL || *aCalNameArg == iCalSession->DefaultFileNameL())
+ {
+ calSession = iCalSession;
+ }
+ else
+ {
+ findInCurrentArray = iDesCArray->Find(*aCalNameArg, aPosition);
+
+ if (findInCurrentArray == 0)
+ {
+ calSession = iCalSessions[aPosition];
+ }
+ else
+ {
+ User::Leave(KErrNotFound);
+ }
+ }
+
const TInt n = iAdapterAccesses.Count();
for (TInt i = 0; i < n; i++)
{
- if (iAdapterAccesses[i]->OpenEventListL(aListName,
+ if (iAdapterAccesses[i]->OpenEventListL(calSession, aListName,
&eventAdapterManager, &eventListAdapter, &localizationData))
{
- // got one
CleanupDeletePushL(eventAdapterManager);
CleanupDeletePushL(eventListAdapter);
-
eventList = CPIMEventList::NewL(eventAdapterManager,
eventListAdapter, localizationData, *iEventValidator);
-
CleanupStack::Pop(eventListAdapter);
CleanupStack::Pop(eventAdapterManager);
-
break;
}
@@ -362,7 +730,7 @@
return eventList;
}
-CPIMToDoList* CPIMManager::DoOpenToDoListL(const TDesC* aListName)
+CPIMToDoList* CPIMManager::DoOpenToDoListL(const TDesC* aListName, const TDesC* aCalNameArg)
{
JELOG2(EPim);
CPIMToDoList* toDoList = NULL;
@@ -370,12 +738,34 @@
MPIMToDoAdapterManager* toDoAdapterManager = NULL;
MPIMToDoListAdapter* toDoListAdapter = NULL;
MPIMLocalizationData* localizationData = NULL;
+ TInt aPosition = 0;
+ TInt findInCurrentArray = 0;
+
+ CCalSession* calSession = NULL;
+
+ if (aCalNameArg == NULL || *aCalNameArg == iCalSession->DefaultFileNameL())
+ {
+ calSession = iCalSession;
+ }
+ else
+ {
+ findInCurrentArray = iDesCArray->Find(*aCalNameArg, aPosition);
+
+ if (findInCurrentArray == 0)
+ {
+ calSession = iCalSessions[aPosition];
+ }
+ else
+ {
+ User::Leave(KErrNotFound);
+ }
+ }
const TInt n = iAdapterAccesses.Count();
for (TInt i = 0; i < n; i++)
{
- if (iAdapterAccesses[i]->OpenToDoListL(aListName, &toDoAdapterManager,
- &toDoListAdapter, &localizationData))
+ if (iAdapterAccesses[i]->OpenToDoListL(calSession, aListName,
+ &toDoAdapterManager, &toDoListAdapter,&localizationData))
{
// got one
CleanupDeletePushL(toDoAdapterManager);
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/cpimtodolist.cpp
--- a/javaextensions/pim/framework/src.s60/cpimtodolist.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/cpimtodolist.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -24,7 +24,7 @@
#include "cpimtodoitem.h"
#include "mpimadaptermanager.h"
#include "pimtodo.h"
-#include "javasymbianoslayer.h"
+#include "cleanupresetanddestroy.h"
#include "pimjnitools.h"
#include "pimutils.h"
#include "s60commonutils.h"
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/framework/src.s60/pimjnitools.cpp
--- a/javaextensions/pim/framework/src.s60/pimjnitools.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/framework/src.s60/pimjnitools.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -174,10 +174,12 @@
JELOG2(EPim);
const TInt numElems = aNativeArray.Count();
+
// Initializes the array with NULLs
jobjectArray javaStringArray = aJniEnv->NewObjectArray(numElems,
aJniEnv->FindClass("java/lang/String"), NULL);
+
if (!javaStringArray)
{
return NULL;
@@ -208,7 +210,6 @@
// Avoid running out of local references
aJniEnv->DeleteLocalRef(javaElem);
}
-
return javaStringArray;
}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/inc.s60/dummy.txt
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/inc.s60/mpimlocalizationdata.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/pim/inc.s60/mpimlocalizationdata.h Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Access interface to list-specific localization data.
+*
+*/
+
+#ifndef MPIMLOCALIZATIONDATA_H
+#define MPIMLOCALIZATIONDATA_H
+
+// INCLUDES
+#include "pimtypes.h"
+
+// CLASS DECLARATION
+
+/**
+* Provides localized strings for the various labels used in the PIM API
+*/
+class MPIMLocalizationData
+{
+public: // destructor
+ /**
+ * Destructor is public virtual in order to allow deletion through
+ * M-class
+ */
+ virtual ~MPIMLocalizationData() { }
+
+public: // New functions
+
+ /**
+ * Provides a string label associated with the given field. The caller
+ * takes ownership of the returned object.
+ *
+ * @param aField The field for which the label is being queried.
+ *
+ * @return String label for the field. The label is locale specific.
+ */
+ virtual HBufC* GetFieldLabelL(TPIMField aField) = 0;
+
+ /**
+ * Provides a string label associated with the given attribute.
+ * The caller takes ownership of the returned object.
+ *
+ * @param aAttribute The attribute for which the label is being queried.
+ *
+ * @return String label for the attribute. The label is locale specific.
+ */
+ virtual HBufC* GetAttributeLabelL(TPIMAttribute aAttribute) = 0;
+
+ /**
+ * Provides a string label associated with the given array element.
+ * The caller takes ownership of the returned object.
+ *
+ * @param aStringArrayField The field which has a EPIMFieldStringArray
+ * data type.
+ * @param aArrayElement The element in the array.
+ *
+ * @return String label for the array element
+ */
+ virtual HBufC* GetArrayElementLabelL(TPIMField aStringArrayField,
+ TPIMArrayElement aArrayElement) = 0;
+ /**
+ * Provides the name of the list.
+ * The caller takes ownership of the returned object.
+ *
+ * @return the list name.
+ */
+ virtual HBufC* GetListNameL() = 0;
+
+};
+
+
+
+#endif // MPIMLOCALIZATIONDATA_H
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/inc.s60/mpimlocalizationmanager.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/pim/inc.s60/mpimlocalizationmanager.h Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Access interface to different list localization data sets.
+*
+*/
+
+#ifndef MPIMLOCALIZATIONMANAGER_H
+#define MPIMLOCALIZATIONMANAGER_H
+
+// INCLUDES
+#include "pimtypes.h"
+#include
+
+// FORWARD DECLARATIONS
+class MPIMLocalizationData;
+class MPIMConfirmationDialogue;
+
+/**
+ * PIM Item and category operations
+ */
+enum TPIMOperationType
+{
+ EPIMOperationItemDeletion = 1,
+ EPIMOperationItemCommit,
+ EPIMOperationCategoryDeletion,
+ EPIMOperationContactListRead,
+ EPIMOperationContactListWrite,
+ EPIMOperationEventListRead,
+ EPIMOperationEventListWrite,
+ EPIMOperationToDoListRead,
+ EPIMOperationToDoListWrite
+};
+
+// CLASS DECLARATION
+/**
+ * A Factory class for MPIMLocalizationData objects
+ */
+class MPIMLocalizationManager
+{
+public: // destructor
+ /**
+ * Destructor is public virtual in order to allow deletion through
+ * M-class
+ */
+ virtual ~MPIMLocalizationManager() { }
+
+public:
+ /**
+ * Creates an instance of MPIMLocalizationData.
+ * Caller takes ownership of the returned object.
+ *
+ * @param aType Type of the list, which of data to localize.
+ * This can be KPIMLocalizationIdContact,
+ * KPIMLocalizationIdSIM, KPIMLocalizationIdEvent or
+ * KPIMLocalizationidToDo
+ *
+ * @return MPIMLocalizationData object for the requested list type.
+ * @par Leaving:
+ * The method leaves on error. Error codes should be interpreted as
+ * follows:
+ * @li \c KErrArgument - \a aType is not valid
+ * @li \c KErrNotFound - The resource file cannot be read
+ */
+ virtual MPIMLocalizationData* GetPIMLocalizationDataL(
+ TPIMLocalizationDataID aType) = 0;
+
+ /**
+ * Creates an instance of MPIMLocalizationData.
+ * Caller takes ownership of the returned object.
+ *
+ * @param aType Type of the list, which of data to localize.
+ * This can be KPIMLocalizationIdContact,
+ * KPIMLocalizationIdSIM, KPIMLocalizationIdEvent or
+ * KPIMLocalizationidToDo
+ *
+ * @param aSubType List name identifier. Currently only Event lists
+ * can have list name identifiers (all other list should
+ * use zero).
+ *
+ * @return MPIMLocalizationData object for the requested list type.
+ * @par Leaving:
+ * The method leaves on error. Error codes should be interpreted as
+ * follows:
+ * @li \c KErrArgument - \a aType is not valid, or \a aSubType is not
+ * valid for \a aType.
+ * @li \c KErrNotFound - The resource file cannot be read
+ */
+ virtual MPIMLocalizationData* GetPIMLocalizationDataL(
+ TPIMLocalizationDataID aType,
+ TPIMLocalizationDataID aSubType) = 0;
+
+
+
+};
+
+
+
+#endif // MPIMLOCALIZATIONMANAGER_H
+
+// End of file
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/inc.s60/pimlocalizationids.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/pim/inc.s60/pimlocalizationids.h Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Localization data identifiers.
+*
+*/
+
+
+
+#ifndef PIMLOCALIZATIONIDS_H
+#define PIMLOCALIZATIONIDS_H
+
+// INCLUDE FILES
+#include "pimtypes.h"
+
+/**
+* @file
+* This file contains constants that map the lists provided by adapters
+* with label sets provided with the localization module. A constant may
+* apply to one or several related lists.
+*
+* There are two types of IDs:
+* @li Localization IDs
+* @li List name IDs
+* Both of them are of type TPIMLocalizationDataID.
+*
+* Localization IDs define a set of localized labels for fields, attributes
+* and array elements and a default name for the list.
+*
+* List name IDs specify a name among a set of localized labels defined by
+* a localization ID. The default list name can be thus overridden using
+* a list name ID. A localization set may or may not define several list name
+* IDs. If only single name is defined for a localization set, it may not be
+* documented but it can be used using the localization operations that rely
+* on the default list name id.
+*
+* Naming:
+* @li Localization IDs are of form \c KPIMLocalizationIDXXX.
+* @li List name IDs are of form \c KPIMListNameIdYYY.
+*/
+
+// CONSTANTS
+
+
+// Localization data IDs
+
+/**
+* Localization data identifier for Contacts Model contact list. The labels
+* associated with this identifier apply only on that list.
+*/
+const TPIMLocalizationDataID KPIMLocalizationIdContacts = 1;
+
+/**
+* Localization data identifier for SIM contact list. The labels associated
+* with this identifier apply only on that list.
+*
+* NOTE: Currently unused, defined for future purposes.
+*/
+const TPIMLocalizationDataID KPIMLocalizationIdSIM = 2;
+
+/**
+* Localization data identifier for all Agenda Event lists (Meeting, Memo and
+* Anniversary). The labels are valid for any of those lists. Each of the lists
+* uses only a subset of the labels associated with this identifier.
+*/
+const TPIMLocalizationDataID KPIMLocalizationIdEvent = 3;
+
+/**
+* Localization data identifier for Agenda to-do list. The labels associated
+* with this identifier apply only on that list.
+*/
+const TPIMLocalizationDataID KPIMLocalizationIdToDo = 4;
+
+
+// List name IDs
+// NOTE! It is essential that these IDs are sequential and start from zero.
+
+/**
+* List name identifier for "Appointment" Agenda Event list.
+* Applies with the localization data identifier \c KPIMLocalizationIdEvent.
+*/
+const TPIMLocalizationDataID KPIMListNameIdAppointment = 0;
+
+/**
+* List name identifier for "Event" Agenda Event list.
+* Applies with the localization data identifier \c KPIMLocalizationIdEvent.
+*/
+const TPIMLocalizationDataID KPIMListNameIdEvent = 1;
+
+/**
+* List name identifier for "Anniversary" Agenda Event list.
+* Applies with the localization data identifier \c KPIMLocalizationIdEvent.
+*/
+const TPIMLocalizationDataID KPIMListNameIdAnniversary = 2;
+
+
+#endif // PIMLOCALIZATIONIDS_H
+
+
+// End of File
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc.s60/com/nokia/mj/impl/pim/utils/NativeError.java
--- a/javaextensions/pim/javasrc.s60/com/nokia/mj/impl/pim/utils/NativeError.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/javasrc.s60/com/nokia/mj/impl/pim/utils/NativeError.java Thu Sep 02 13:22:59 2010 +0300
@@ -644,7 +644,81 @@
}
}
}
+ public static void handleCreateCalendarError(int aNativeErrorCode, String aCalName)
+ {
+
+ if (aNativeErrorCode == OsErrorMessage.SUCCESS)
+ {
+ return; // OK
+ }
+
+ switch (aNativeErrorCode)
+ {
+ case OsErrorMessage.KERR_ARGUMENT:
+ {
+ throw new IllegalArgumentException(
+ "Creation of calendar failed: calendar name is invalid"
+ + aCalName);
+ }
+ case OsErrorMessage.KERR_BAD_NAME:
+ {
+ throw new IllegalArgumentException(
+ "Creation of calendar failed: calendar name is not valid "
+ + aCalName);
+ }
+ case OsErrorMessage.KERR_ALREADY_EXISTS:
+ {
+ throw new RuntimeException(ErrorString.CALENDAR_ALREADY_EXISTS);
+ }
+ default:
+ {
+ throw new GenericException(ErrorString.GENERAL_ERROR_COLON + aNativeErrorCode);
+ }
+ }
+ }
+
+ public static void handleDeleteCalendarError(int aNativeErrorCode, String aCalName)
+ {
+
+
+ if (aNativeErrorCode == OsErrorMessage.SUCCESS)
+ {
+ return; // OK
+ }
+
+ switch (aNativeErrorCode)
+ {
+ case OsErrorMessage.KERR_ACCESS_DENIED:
+ {
+ throw new IllegalArgumentException(
+ "Deletion of calendar failed: phone default calendar cannot be deleted");
+ }
+ case OsErrorMessage.KERR_ARGUMENT:
+ {
+ // we should never end up here since the calendar name is
+ // verified to be not empty before making the native call
+ throw new IllegalArgumentException(
+ "Deletion of calendar failed: calendar name is null");
+ }
+ case OsErrorMessage.KERR_NOT_FOUND:
+ {
+ throw new IllegalArgumentException(
+ "Deletion of calendar failed: calendar by name "
+ + aCalName + " cannot be found");
+ }
+ case OsErrorMessage.KERR_BAD_NAME:
+ {
+ throw new IllegalArgumentException(
+ "Deletion of calendar failed: calendar name "
+ + aCalName + " includes a path explicitly");
+ }
+ default:
+ {
+ throw new GenericException(ErrorString.GENERAL_ERROR_COLON + aNativeErrorCode);
+ }
+ }
+ }
/**
* Construction prohibited.
*/
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/Calendar.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/Calendar.java Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Abstract PIMExtension class.
+ *
+*/
+
+// PACKAGE
+package com.nokia.mj.impl.pim;
+
+// CLASS DEFINITION
+/**
+ *
+ * Nokia propritery class for holding the calendar file name and calendar display name.
+ *
+
+ * General
+ * The object of the class will be returned to user when listcalendars is called from the MIDlet.
+ * Using the object user can obtain either calendar file name or calendar display name. These names should be used in appropriate places.
+ *
+ * -
+ *
Sample MIDlet code snippet
+ *
+ * Opening a Memo List from a calendar name Personal available on C drive
+ *
+ *
+ * import javax.microedition.pim.*;
+ * import com.nokia.mid.pimextension.PIMExtension;
+ * import com.nokia.mid.pimextension.calendar;
+ *
+ * ...
+ * // Gets a PIMExtended class instance
+ * PIM pim = PIM.getInstance();
+ * try {
+ * PIMExtension pimExtension = (PIMExtension) pim;
+ * }
+ * catch (ClassCastException e){
+ * // extension is not avaialable
+ * }
+ *
+ * // Gets the list of calendars available on the device
+ * calendar[] calList = pimExtension.listCalendars();
+ *
+ * // Opens the memo list from the "Personal" calendar
+ * EventList memoList = ( EventList )
+ * calPIM.openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE, "Memos", calList.getCalendarFileName);
+ * ...
+ *
+ *
+ */
+public final class Calendar
+{
+ /*
+ *
+ * two strings to hold calendar File Name and Calendar name. These should not be accesible, hence they are private.
+ *
+ */
+ private String calendarFileName;
+ private String calendarName;
+ /*
+ *
+ *constructor accessed by jrt implementation to construct the object with the 2 different names of the calendar.
+ *
+ */
+ public Calendar(String fileName, String userName)
+ {
+ calendarFileName = fileName;
+ calendarName = userName;
+ }
+ /*
+ *
+ *
+ * This functions getCalendarFileName() returns the calendar file name in the database.
+ * This string should be passed to all the operations on calendar.
+ *
+ */
+ public String getCalendarFileName()
+ {
+ return calendarFileName;
+ }
+
+ /*
+ *
+ *
+ * This functions getCalendarName() returns the display name of the calendar.
+ * This should be used for user display purposes.
+ * Note: When user creates a calendar from java side, both the names will be same.
+ * The file created will be named as the string passed by user.
+ * The calendar will also be named with the string.
+ *
+ */
+ public String getCalendarName()
+ {
+ return calendarName;
+ }
+}
\ No newline at end of file
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java
--- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/ErrorString.java Thu Sep 02 13:22:59 2010 +0300
@@ -217,4 +217,7 @@
/** Error description. */
public final static String SEARCHING_FAILED_COLON = "Searching failed:";
+
+ /** Error description. */
+ public final static String CALENDAR_ALREADY_EXISTS = "Calendar already Exists:";
}
\ No newline at end of file
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java
--- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMListImpl.java Thu Sep 02 13:22:59 2010 +0300
@@ -111,12 +111,14 @@
PIMListImpl(int aListHandle, int aMode)
{
iListHandle = aListHandle;
+ iMode = aMode;
Logger.LOG(Logger.EPim,Logger.EInfo,"+PIMListImpl() = iListHandle = "+iListHandle);
+ if (iListHandle != 0)
+ {
+ iItems = new ItemTable();
+ }
setShutdownListener();
iFinalizer = registerForFinalization();
- iMode = aMode;
-
- iItems = new ItemTable();
}
public Finalizer registerForFinalization()
@@ -359,8 +361,11 @@
if (iIsOpen == true)
{
iIsOpen = false;
- int err = _close(iListHandle);
- NativeError.handlePIMListCloseError(err);
+ if (iListHandle != 0)
+ {
+ int err = _close(iListHandle);
+ NativeError.handlePIMListCloseError(err);
+ }
iItems = null;
}
else
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java
--- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMManager.java Thu Sep 02 13:22:59 2010 +0300
@@ -20,12 +20,13 @@
package com.nokia.mj.impl.pim;
// IMPORTS
-
import javax.microedition.pim.PIM;
import javax.microedition.pim.PIMException;
import javax.microedition.pim.PIMItem;
import javax.microedition.pim.PIMList;
import java.io.UnsupportedEncodingException;
+import java.util.Enumeration;
+import java.util.Vector;
import com.nokia.mj.impl.pim.ErrorString;
import com.nokia.mj.impl.pim.GenericException;
import com.nokia.mj.impl.rt.support.ApplicationUtils;
@@ -33,7 +34,8 @@
import com.nokia.mj.impl.rt.support.ShutdownListener;
import com.nokia.mj.impl.security.utils.SecurityPromptMessage;
import com.nokia.mj.impl.pim.utils.NativeError;
-
+import com.nokia.mj.impl.utils.Tokenizer;
+import com.nokia.mj.impl.pim.Calendar;
// CLASS DEFINITION
/**
@@ -72,6 +74,7 @@
/** Serializer. */
private Serializer iSerializer;
+ private Vector iCalInfo;
// Methods
@@ -98,7 +101,7 @@
* Creates PIMManager.
* Direct creation of a PIMManager is prohibited.
*/
- private PIMManager()
+ public PIMManager()
{
super();
setShutdownListener();
@@ -111,6 +114,7 @@
}
iSerializer = new Serializer(iManagerHandle);
+ iCalInfo = new Vector();
}
/**
@@ -164,7 +168,6 @@
iManagerHandle = 0;
}
}
-
});
}
@@ -178,13 +181,18 @@
}
// Methods from PIM
-
public synchronized PIMList openPIMList(int aPimListType, int aMode)
throws PIMException
{
- return doOpenPIMList(aPimListType, aMode, null);
+ return doOpenPIMList(aPimListType, aMode, null, null);
}
+
+ /**
+ * this method is used to open existsing calendar, create new calendar and delete existsing calendar by passing string as name.
+ * function will parse the string and do the operation.
+ * user as to pass the string in given format only
+ */
public synchronized PIMList openPIMList(int aPimListType, int aMode,
String aName) throws PIMException
{
@@ -193,17 +201,130 @@
throw new NullPointerException(ErrorString.OPENING_LISTS_FAILED_COLON +
ErrorString.LIST_NAME_IS_NULL);
}
+ //Check if the aName is as per the MultipleCalendar Parameter definition
+ //aName = [calendarname "/"] listname ["?operation=" ["create" | "delete"]]
+ if (isMultiCalendarParam(aName))
+ {
- return doOpenPIMList(aPimListType, aMode, aName);
+ String calendarName = null;
+ String operation = null;
+ String listName = null;
+
+ listName = getListName(aName);
+ operation = getOperation(aName);
+ calendarName = aName.substring(0, aName.indexOf("/"));
+ if (isListNameValid(listName))
+ {
+ if (operation == null)
+ {
+ if (calendarName != null)
+ {
+ //This is the case of opening an existing calendar
+ return doOpenPIMList(aPimListType, aMode, listName, "C:" + calendarName);
+ }
+ else
+ {
+ //This is the case with IllegalArgumentException
+ throw new IllegalArgumentException("Calendar Name is NULL");
+ }
+ }
+ else if (operation.equals("create"))
+ {
+ createCalendar(calendarName);
+ int[] error = new int[1];
+ int listHandle = _openPIMList(iManagerHandle, aPimListType, listName, calendarName, error);
+ PIMListImpl pimList = new EventListImpl(listHandle, aMode);
+ return pimList;
+ }
+ else if (operation.equals("delete"))
+ {
+ deleteCalendar(calendarName);
+ int listHandle = 0;
+ PIMListImpl pimList = new EventListImpl(listHandle, aMode);
+ return pimList;
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid operation");
+ }
+ } // if isListNameValid(listName) block ends here
+ else
+ {
+ throw new IllegalArgumentException("Invalid List name");
+ }
+ } // if isMultiCalendarParam(aName) block ends here
+ else
+ {
+ //This is not the case of Multiple Calendar, so follow the default calendar path
+ return doOpenPIMList(aPimListType, aMode, aName);
+ }
+ }
+
+ private boolean isMultiCalendarParam(String aListTypeName)
+ {
+ //If there is "?" and/or "=" is present in aListTypeName
+ //return true
+ boolean ret = false;
+ if ((aListTypeName.indexOf("/") != -1) || (aListTypeName.indexOf("?") != -1) || (aListTypeName.indexOf("=") != -1))
+ {
+ ret = true;
+ }
+ return ret;
+ }
+
+ private String getListName(String aName)
+ {
+ // Get Operation
+ String operation = "?operation=";
+ int operationIndex = aName.indexOf(operation);
+
+ if (operationIndex == -1)
+ {
+ operationIndex = aName.length();
+ }
+
+ return aName.substring(aName.indexOf("/") + 1, operationIndex);
+ }
+
+ private boolean isListNameValid(String aListName)
+ {
+ String lists[] = listPIMLists(PIM.EVENT_LIST);
+ boolean listExist = false;
+
+ for (int i = 0; i < lists.length; i++)
+ {
+ if (aListName.trim().equalsIgnoreCase(lists[i]))
+ {
+ listExist = true;
+ break;
+ }
+ }
+
+ return listExist;
+ }
+
+ private String getOperation(String aName)
+ {
+ String aOperation = null;
+ String operation = "?operation=";
+ int operationIndex = aName.indexOf(operation);
+
+ if (operationIndex != -1)
+ {
+ aOperation = aName.substring(operationIndex + operation.length());
+ }
+
+
+ return aOperation;
+
}
public synchronized String[] listPIMLists(int aPimListType)
{
- if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST
- && aPimListType != PIM.TODO_LIST)
+
+ if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST && aPimListType != PIM.TODO_LIST)
{
- throw new java.lang.IllegalArgumentException(ErrorString.LISTING_FAILED_DOT +
- ErrorString.INVALID_LIST_TYPE_COLON + aPimListType);
+ throw new java.lang.IllegalArgumentException(ErrorString.LISTING_FAILED_DOT + ErrorString.INVALID_LIST_TYPE_COLON + aPimListType);
}
// Ensure permission
getPermission(aPimListType, PIM.READ_ONLY);
@@ -233,7 +354,121 @@
{
return iSerializer.supportedSerialFormats(aPimListType);
}
+ /**
+ * Enumerates the calendars currently present in the device.
+ *
+ * @return A list of Calendar names
+ * @throws java.lang.SecurityException
+ * if the application is not given permission to read PIM lists
+ */
+ public synchronized Calendar[] listCalendars()
+ {
+ // security check
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+ PIMPermissionImpl per = new PIMPermissionImpl("pim://*", PIMPermissionImpl.ACTION_READ_EVENTS + "," + PIMPermissionImpl.ACTION_READ_TODOS);
+ appUtils.checkPermission(per);
+ int[] error = new int[1];
+ String[] calendarFileLists = _listCalendars(iManagerHandle, error);
+ String[] calendarNameLists = _listCalendarNames(iManagerHandle, error);
+ if (!NativeError.checkSuccess(error[0]))
+ {
+ throw new GenericException(ErrorString.GENERAL_ERROR_COLON + error[0]);
+ }
+ Vector tokens = new Vector();
+ Vector tokenNames = new Vector();
+ int length = calendarFileLists.length;
+ for (int i = 0; i < length; i++)
+ {
+ String str[] = Tokenizer.split(calendarFileLists[i], ":");
+ String strname[] = Tokenizer.split(calendarNameLists[i], ":");
+
+
+ if (str[0].equals("C"))
+ {
+ tokens.addElement(str[1]);
+
+ }
+ if (strname[0].equals("C"))
+ {
+
+ tokenNames.addElement(strname[1]);
+ }
+ else
+ {
+
+ tokenNames.addElement(strname[0]);
+ }
+ }
+ String[] calendarLists = new String[tokens.size()];
+ String[] calendarNames = new String[tokenNames.size()];
+ tokens.copyInto(calendarLists);
+ tokenNames.copyInto(calendarNames);
+ Calendar[] calendarobjlist = new Calendar[calendarLists.length];
+ for (int i = 0; i < calendarLists.length; i++)
+ {
+ Calendar cal = new Calendar(calendarLists[i], calendarNames[i]);
+ calendarobjlist[i] = cal;
+ }
+ //return calendarLists;
+ return calendarobjlist;
+ }
+
+
+ private synchronized void createCalendar(String aCalName)
+ {
+
+ String displayName = aCalName;
+ // security check
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+ PIMPermissionImpl per = new PIMPermissionImpl("pim://*", PIMPermissionImpl.ACTION_WRITE_EVENTS + "," + PIMPermissionImpl.ACTION_WRITE_TODOS);
+ appUtils.checkPermission(per);
+ String fileName = "C:" + aCalName;
+ int error = _createCalendar(iManagerHandle, fileName,displayName);
+ NativeError.handleCreateCalendarError(error, aCalName);
+ }
+
+ private synchronized void deleteCalendar(String aCalName)
+ {
+ // security check
+ ApplicationUtils appUtils = ApplicationUtils.getInstance();
+ PIMPermissionImpl per = new PIMPermissionImpl(PIMPermissionImpl.ACTION_WRITE_EVENTS + "," + PIMPermissionImpl.ACTION_WRITE_TODOS, aCalName, null, -1);
+ appUtils.checkPermission(per);
+
+ boolean isCalPresent = false;
+ String fileName = "C:" + aCalName;
+ int index;
+ for (index = 0; index < iCalInfo.size(); index++)
+ {
+ CalendarListInfo calList = (CalendarListInfo) iCalInfo.elementAt(index);
+ String calName = calList.iCalName;
+ if (calName.equals(fileName))
+ {
+ Enumeration e = calList.iList.elements();
+ while (e.hasMoreElements())
+ {
+ PIMList list = (PIMList) e.nextElement();
+ try
+ {
+ list.close();
+ }
+ catch (PIMException ex)
+ {
+ //throw new GenericException("Delete entry failed. " + ex.toString());
+ }
+ }
+ calList.iList.removeAllElements();
+ isCalPresent = true;
+ break;
+ }
+ }
+ int error = _deleteCalendar(iManagerHandle, fileName);
+ NativeError.handleDeleteCalendarError(error, aCalName);
+ if (isCalPresent)
+ {
+ iCalInfo.removeElementAt(index);
+ }
+ }
/**
* getPermission
@@ -297,27 +532,17 @@
appUtils.checkPermission(per);
}
-
- // New private methods
- /**
- * Common implementation of the list opening. Arguments and permissions are
- * pre-checked.
- *
- * @param aName
- * If null, default list is opened.
- */
private PIMList doOpenPIMList(int aPimListType, int aMode, String aName)
throws PIMException
{
- if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST
- && aPimListType != PIM.TODO_LIST)
+
+ if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST && aPimListType != PIM.TODO_LIST)
{
throw new java.lang.IllegalArgumentException(
ErrorString.INVALID_LIST_TYPE_COLON + aPimListType);
}
- if (aMode != PIM.READ_ONLY && aMode != PIM.WRITE_ONLY
- && aMode != PIM.READ_WRITE)
+ if (aMode != PIM.READ_ONLY && aMode != PIM.WRITE_ONLY && aMode != PIM.READ_WRITE)
{
throw new java.lang.IllegalArgumentException(
ErrorString.INVALID_MODE_COLON + aMode);
@@ -339,8 +564,7 @@
}
int[] error = new int[1];
int listHandle = _openPIMList(
-
- iManagerHandle, aPimListType, aName, error); // if null, open default
+ iManagerHandle, aPimListType, aName, null, error); // if null, open default
// list
NativeError.handleOpenPIMListError(error[0], aPimListType, aName);
@@ -378,6 +602,86 @@
return pimList;
}
+///////////////////////
+ // New private methods
+
+ /**
+ * Common implementation of the list opening. Arguments and permissions are
+ * pre-checked.
+ *
+ * @param aName
+ * If null, default list is opened.
+ */
+ private PIMList doOpenPIMList(int aPimListType, int aMode, String aName, String aCalName)
+ throws PIMException
+ {
+
+ if (aPimListType != PIM.CONTACT_LIST && aPimListType != PIM.EVENT_LIST && aPimListType != PIM.TODO_LIST)
+ {
+ throw new java.lang.IllegalArgumentException(
+ ErrorString.INVALID_LIST_TYPE_COLON + aPimListType);
+ }
+
+ if (aMode != PIM.READ_ONLY && aMode != PIM.WRITE_ONLY && aMode != PIM.READ_WRITE)
+ {
+ throw new java.lang.IllegalArgumentException(
+ ErrorString.INVALID_MODE_COLON + aMode);
+ }
+
+ // Both permissions must be checked separately if aMode is
+ // PIM.READ_WRITE
+ if (aMode == PIM.READ_WRITE)
+ {
+ // First ensure read access permission
+ // Get localized text info for the security dialog
+ getPermission(aPimListType, PIM.READ_ONLY);
+ getPermission(aPimListType, PIM.WRITE_ONLY);
+
+ }
+ else
+ {
+ getPermission(aPimListType, aMode);
+ }
+ int[] error = new int[1];
+
+ int listHandle = _openPIMList(
+ iManagerHandle, aPimListType, aName, aCalName, error);
+ // list
+ NativeError.handleOpenPIMListError(error[0], aPimListType, aName);
+
+ // Create new pim list of right type
+ PIMListImpl pimList = null;
+
+ switch (aPimListType)
+ {
+ case PIM.CONTACT_LIST:
+ {
+ pimList = new ContactListImpl(listHandle, aMode);
+ break;
+ }
+
+ case PIM.EVENT_LIST:
+ {
+ pimList = new EventListImpl(listHandle, aMode);
+ break;
+ }
+
+ case PIM.TODO_LIST:
+ {
+ pimList = new ToDoListImpl(listHandle, aMode);
+ break;
+ }
+
+ default:
+ {
+ // We should never end up here
+ throw new PIMException(ErrorString.GENERAL_ERROR,
+ PIMException.GENERAL_ERROR);
+ }
+ }
+
+ return pimList;
+ }
// Native operations
@@ -398,11 +702,33 @@
* value on error.
*/
private native int _openPIMList(int aManagerHandle, int aPimListType,
- String aPimListName, int[] aError);
+ String aPimListName, String aCalName,
+ int[] aError);
private native String[] _listPIMLists(int aManagerHandle, int aPimListType,
int[] aError);
+ private native String[] _listCalendars(int aManagerHandle, int[] aError);
+
+ private native String[] _listCalendarNames(int aManagerHandle, int[] aError);
+
+ private native int _createCalendar(int aManagerHandle, String aCalName, String aDisplayName);
+
+ private native int _deleteCalendar(int aManagerHandle, String aCalName);
+
+ class CalendarListInfo
+ {
+
+ String iCalName;
+ Vector iList;
+
+ CalendarListInfo(String aCalName, PIMList aPIMList)
+ {
+ iCalName = aCalName;
+ iList = new Vector();
+ iList.addElement(aPIMList);
+ }
+ }
}
// End of file
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java
--- a/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/pim/PIMPermissionImpl.java Thu Sep 02 13:22:59 2010 +0300
@@ -96,7 +96,7 @@
{
return (SecurityPromptMessage.getInstance()).getText(
SecurityPromptMessage.QUESTION_ID_DELETING_ITEM,
- new String[] {iListName});
+ new String[] {iItemInfo, iListName});
}
}
else if (iOperation == OPERATION_ITEM_COMMIT)
@@ -111,7 +111,7 @@
{
return (SecurityPromptMessage.getInstance()).getText(
SecurityPromptMessage.QUESTION_ID_UPDATING_ITEM,
- new String[] {iListName});
+ new String[] {iItemInfo, iListName});
}
}
else if (iOperation == OPERATION_CATEGORY_DELETION)
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/com/nokia/mj/impl/properties/pim/DynamicPropertyHandler.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javaextensions/pim/javasrc/com/nokia/mj/impl/properties/pim/DynamicPropertyHandler.java Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+
+package com.nokia.mj.impl.properties.pim;
+
+import com.nokia.mj.impl.pim.PIMManager;
+import com.nokia.mj.impl.pim.Calendar;
+import com.nokia.mj.impl.rt.support.SystemPropertyProvider;
+
+/**
+ * This class implements SystemPropertyProvider and provides getProperty to
+ * retrieve dynamic system property.
+ */
+public final class DynamicPropertyHandler implements SystemPropertyProvider
+{
+
+ public String getProperty(String key)
+ {
+
+ //Code for list calendars - Call Open PIM List
+ // 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:
+ // String calendarNames = System.getProperty("com.nokia.mid.calendars");
+
+ PIMManager pim = new PIMManager();
+
+ Calendar calendarList[] = pim.listCalendars();
+
+ StringBuffer calendarListString = new StringBuffer();;
+
+ if (calendarList != null)
+ {
+ for (int i = 0; i < calendarList.length; i++)
+ {
+ calendarListString.append(calendarList[i].getCalendarName()+",");
+
+ }
+ }
+ else
+ {
+ return null;
+ }
+ pim = null;
+ calendarListString.deleteCharAt(calendarListString.length() - 1);
+ return calendarListString.toString();
+ }
+
+ public boolean isStatic(String key)
+ {
+ return false;
+ }
+
+}
\ No newline at end of file
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/javasrc/javax/microedition/pim/PIM.java
--- a/javaextensions/pim/javasrc/javax/microedition/pim/PIM.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/javasrc/javax/microedition/pim/PIM.java Thu Sep 02 13:22:59 2010 +0300
@@ -80,20 +80,63 @@
{
}
+ /**
+ * @param aPimListType which list user want to open Ex.CONTACT_LIST, EVENT_LIST, or TODO_LIST.
+ * @param aMode list open mode READ_ONLY or WRITE_ONLY or READ_WRITE
+ * @return PIMList
+ * @throws javax.microedition.pim.PIMException
+ */
public abstract PIMList openPIMList(int aPimListType, int aMode)
throws PIMException;
+ /**
+ *
+ * @param aPimListType aPimListType which list user want to open Ex.CONTACT_LIST, EVENT_LIST, or TODO_LIST.
+ * @param aMode list open mode READ_ONLY or WRITE_ONLY or READ_WRITE
+ * @param aName List name
+ * @return PIMList
+ * @throws javax.microedition.pim.PIMException
+ */
public abstract PIMList openPIMList(int aPimListType, int aMode,
String aName) throws PIMException;
+ /**
+ *
+ * @param aPimListType aPimListType which list user want to open Ex.CONTACT_LIST, EVENT_LIST, or TODO_LIST.
+ * @return String which contains list of PIMList names
+ */
public abstract String[] listPIMLists(int aPimListType);
+ /**
+ * @param aIs an inputstream object containing PIM information
+ * @param aEnc encoding of the characters in the input stream
+ * @return PIMItem Array
+ * @throws javax.microedition.pim.PIMException
+ * @throws java.io.UnsupportedEncodingException
+ */
public abstract PIMItem[] fromSerialFormat(java.io.InputStream aIs,
String aEnc) throws PIMException, UnsupportedEncodingException;
+ /**
+ *
+ * @param aItem the item to export
+ * @param aOs the OutputStream object that where is written to as a character stream.
+ * @param aEnc encoding of the characters in the input stream
+ * @param aDataFormat PIM data format to use
+ * @throws javax.microedition.pim.PIMException
+ * @throws java.io.UnsupportedEncodingException
+ */
public abstract void toSerialFormat(PIMItem aItem,
java.io.OutputStream aOs, String aEnc, String aDataFormat)
throws PIMException, UnsupportedEncodingException;
+ /**
+ *
+ * @param aPimListType which list user want to open Ex.CONTACT_LIST, EVENT_LIST, or TODO_LIST.
+ * @return String object
+ */
public abstract String[] supportedSerialFormats(int aPimListType);
+
+
+
}
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/jni/src/pimmanager.cpp
--- a/javaextensions/pim/jni/src/pimmanager.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/jni/src/pimmanager.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -69,6 +69,7 @@
jint aManagerHandle,
jint aPimListType,
jstring aPimListName,
+ jstring aCalName,
jintArray aError)
{
JELOG2(EPim);
@@ -77,13 +78,15 @@
int error = 0;
try
{
+
list = manager->openPimList(
- static_cast< TPIMListType>(aPimListType),aPimListName, aJniEnv);
+ static_cast< TPIMListType>(aPimListType),aPimListName,aCalName, aJniEnv);
}
catch (int aError)
{
error = aError;
}
+
SetJavaErrorCode(aJniEnv, aError, error);
// We now own the list (through the handle). The ownership of
@@ -114,6 +117,86 @@
return javaStringArray;
}
+JNIEXPORT jint
+JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1createCalendar(
+ JNIEnv* aJniEnv,
+ jobject /*aPeer*/,
+ jint aManagerHandle,
+ jstring aCalName,
+ jstring aDisplayName)
+{
+ JELOG2(EPim);
+ pimbasemanager* manager =
+ reinterpret_cast< pimbasemanager *>(aManagerHandle);
+ TInt error = 0;
+ try
+ {
+ manager->createCalendar(aCalName, aDisplayName,aJniEnv);
+ }
+ catch (int aError)
+ {
+ error = aError;
+ }
+ return error;
+}
+
+JNIEXPORT jint
+JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1deleteCalendar(
+ JNIEnv* aJniEnv,
+ jobject /*aPeer*/,
+ jint aManagerHandle,
+ jstring aCalName)
+{
+ JELOG2(EPim);
+ pimbasemanager* manager =
+ reinterpret_cast< pimbasemanager *>(aManagerHandle);
+ TInt error = 0;
+
+ try
+ {
+ manager->deleteCalendar(aCalName,aJniEnv);
+ }
+ catch (int aError)
+ {
+ error = aError;
+ }
+
+ return error;
+
+}
+
+JNIEXPORT jobjectArray
+JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1listCalendars(
+ JNIEnv* aJniEnv,
+ jobject /*aPeer*/,
+ jint aManagerHandle,
+ jintArray aError)
+{
+ JELOG2(EPim);
+ pimbasemanager* manager =
+ reinterpret_cast< pimbasemanager *>(aManagerHandle);
+ jobjectArray javaStringArray = NULL;
+ javaStringArray = manager->listCalendars(aError,
+ aJniEnv);
+ return javaStringArray;
+}
+
+JNIEXPORT jobjectArray
+JNICALL Java_com_nokia_mj_impl_pim_PIMManager__1listCalendarNames(
+ JNIEnv* aJniEnv,
+ jobject /*aPeer*/,
+ jint aManagerHandle,
+ jintArray aError)
+{
+ JELOG2(EPim);
+ pimbasemanager* manager =
+ reinterpret_cast< pimbasemanager *>(aManagerHandle);
+
+ jobjectArray javaStringArray = NULL;
+ javaStringArray = manager->listCalendarNames(aError,
+ aJniEnv);
+ return javaStringArray;
+}
// End of File
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp
--- a/javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/versit/src.s60/cpimcalendarconverter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -30,7 +30,7 @@
#include "cpimeventpropertyconverter.h"
#include "fs_methodcall.h"
#include "logger.h"
-#include "javasymbianoslayer.h"
+#include "cleanupresetanddestroy.h"
// EXTERNAL INCLUDES
#include
@@ -165,8 +165,6 @@
RPointerArray& aItemArray, Versit::TVersitCharSet aCharset)
{
JELOG2(EPim);
-
-
CParserVCal* parser = CParserVCal::NewL();
CleanupStack::PushL(parser);
parser->SetDefaultCharSet(aCharset);
@@ -201,8 +199,6 @@
}
}
CleanupStack::PopAndDestroy(3, parser); // parser, eventArray, todoArray
-
-
}
// -----------------------------------------------------------------------------
@@ -242,7 +238,7 @@
RPointerArray& aItemArray)
{
JELOG2(EPim);
-
+ CleanupClosePushL(aItemArray);
CPIMEventItem* item = CPIMEventItem::NewLC(iEventValidator);
TPIMDate alarm(TInt64(0));
// We don't take the ownership of the propertyArray, so the properties
@@ -269,7 +265,6 @@
item->addInt(EPIMEventAlarm, KPIMAttrNone, interval.Int());
}
}
- CleanupClosePushL(aItemArray);
User::LeaveIfError(aItemArray.Append(item));
CleanupStack::Pop(item); // item
CleanupStack::Pop(&aItemArray);
@@ -284,7 +279,7 @@
RPointerArray& aItemArray)
{
JELOG2(EPim);
-
+ CleanupClosePushL(aItemArray);
CPIMToDoItem* item = CPIMToDoItem::NewLC(iToDoValidator);
TPIMDate alarm(TInt64(0));
// We don't take the ownership of the propertyArray, so the properties
@@ -319,7 +314,6 @@
{
item->AddBooleanL(EPIMToDoCompleted, KPIMAttrNone, ETrue);
}
- CleanupClosePushL(aItemArray);
User::LeaveIfError(aItemArray.Append(item));
CleanupStack::Pop(item); // item
CleanupStack::Pop(&aItemArray);
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/versit/src.s60/cpimcardconverter.cpp
--- a/javaextensions/pim/versit/src.s60/cpimcardconverter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/versit/src.s60/cpimcardconverter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -26,7 +26,7 @@
#include "cpimcardpropertyconverter.h"
#include "fs_methodcall.h"
#include "logger.h"
-#include "javasymbianoslayer.h"
+#include "cleanupresetanddestroy.h"
#include
// ============================ MEMBER FUNCTIONS ===============================
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp
--- a/javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/versit/src.s60/cpimeventpropertyconverter.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -27,7 +27,7 @@
#include "cpimitem.h"
#include "cpimeventitem.h"
#include "mpimrepeatruledata.h"
-#include "javasymbianoslayer.h"
+#include "cleanupresetanddestroy.h"
#include "logger.h"
// EXTERNAL INCLUDES
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/pim/versit/src.s60/cpimversit.cpp
--- a/javaextensions/pim/versit/src.s60/cpimversit.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/pim/versit/src.s60/cpimversit.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -22,7 +22,7 @@
#include "cpimcardconverter.h"
#include "cpimcalendarconverter.h"
#include "cpimitem.h"
-#include "javasymbianoslayer.h"
+#include "cleanupresetanddestroy.h"
#include "logger.h"
#include // RBufWriteStream
#include
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/subsystem.mk
--- a/javaextensions/subsystem.mk Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/subsystem.mk Thu Sep 02 13:22:59 2010 +0300
@@ -44,6 +44,10 @@
wma \
pim
+ifdef RD_JAVA_S60_RELEASE_9_2_ONWARDS
+ COMPONENTS += centralrepository/build
+endif
+
ifdef RD_JAVA_MIDPRMS_DB
SUBSYSTEMS += midprms_db
else
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/wma/mms/build/javawmamms.pro
--- a/javaextensions/wma/mms/build/javawmamms.pro Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/wma/mms/build/javawmamms.pro Thu Sep 02 13:22:59 2010 +0300
@@ -27,7 +27,7 @@
../src.s60/*.cpp
LIBS += -lapmime \
- -lPlatformEnv \
+ -lplatformenv \
-lcharconv \
-lCommonUI \
-lefsrv \
diff -r 0ea12c182930 -r 63b81d807542 javaextensions/wma/mms/src.s60/cjavammsmessagehandler.cpp
--- a/javaextensions/wma/mms/src.s60/cjavammsmessagehandler.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javaextensions/wma/mms/src.s60/cjavammsmessagehandler.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -790,8 +790,6 @@
{
// get cc length
aHeaderLengths[KCcFieldIndex] = ReadIntL(aReadStream);
- if (div == 0)
- break;
mmsMap = div;
}
break;
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javaappscheme/build/javaappscheme.pro
--- a/javamanager/javaappscheme/build/javaappscheme.pro Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javaappscheme/build/javaappscheme.pro Thu Sep 02 13:22:59 2010 +0300
@@ -12,7 +12,7 @@
# Contributors:
#
# Description: QT Service application the implements support for
-# starting Java applications using "javaapp:" QUrl
+# starting Java applications using "javaapp:" QUrl
#
TEMPLATE=app
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javaappscheme/build/service_conf.xml
--- a/javamanager/javaappscheme/build/service_conf.xml Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javaappscheme/build/service_conf.xml Thu Sep 02 13:22:59 2010 +0300
@@ -8,6 +8,5 @@
1.0
Interface for showing URIs
javaapp
- com.nokia.services.serviceapp
\ No newline at end of file
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javaappscheme/src.s60/serviceapp.cpp
--- a/javamanager/javaappscheme/src.s60/serviceapp.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javaappscheme/src.s60/serviceapp.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -56,6 +56,7 @@
void ServiceApp::quit()
{
LOG(EJavaQtServiceApp, EInfo, "ServiceApp quit() called");
+ exit(KErrNone); // Exit with OK status
}
@@ -88,13 +89,8 @@
LOG(EJavaQtServiceApp, EInfo, "UriService::view(uri, retValue) called");
std::wstring stdWStrUri = uri.toStdWString();
LOG1(EJavaQtServiceApp, EInfo, "url is %S", stdWStrUri.c_str());
- if (retValue)
- {
- LOG(EJavaQtServiceApp, EInfo, "UriService::view retValue parameter is true");
- }
XQRequestInfo info = requestInfo();
- bool asyncAnswer = !info.isSynchronous();
// Start javalauncher.exe and pass the Url to it
_LIT(KJavaLauncherExe, "javalauncher.exe");
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp
--- a/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javabackup/midp2backup/build/midp2backupplugin.mmp Thu Sep 02 13:22:59 2010 +0300
@@ -50,9 +50,13 @@
USERINCLUDE ../../inc.s60
USERINCLUDE ../../../../inc
-start resource ../data/10282474.rss
+START RESOURCE ../data/10282474.rss
TARGET midp2backupplugin.rsc
-end
+END
+START RESOURCE ../data/10282474_iad.rss
+TARGET midp2backupplugin.rsc
+TARGETPATH resource/java/iad
+END
LIBRARY ecom.lib
LIBRARY estor.lib
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/data/10282474.rss
--- a/javamanager/javabackup/midp2backup/data/10282474.rss Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javabackup/midp2backup/data/10282474.rss Thu Sep 02 13:22:59 2010 +0300
@@ -19,6 +19,10 @@
#include
#include "javauids.h"
+#ifndef ECOM_VERSION_NO
+#define ECOM_VERSION_NO 1
+#endif
+
// Declares info for one implementation
RESOURCE REGISTRY_INFO theInfo
{
@@ -36,7 +40,7 @@
IMPLEMENTATION_INFO
{
implementation_uid = KBackupEcomImplUid;
- version_no = 1;
+ version_no = ECOM_VERSION_NO;
display_name = "MIDP2 Backup Plugin";
default_data = "midp2";
opaque_data = "test_params";
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/data/10282474_iad.rss
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup/data/10282474_iad.rss Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM resource definition for IAD
+*
+*/
+
+// Version for IAD
+#define ECOM_VERSION_NO 2
+
+// Include actual rss
+#include "10282474.rss"
+
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp
--- a/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -39,6 +39,9 @@
using namespace java::storage;
using namespace java::backup;
+const wchar_t * const JBNULLSTRING = L"ABBAABBA_NULL";
+const int JBNULLSTRINGLENGTH = -1;
+
// ======== MEMBER FUNCTIONS ========
CStorageBackupUtil::CStorageBackupUtil()
@@ -82,60 +85,134 @@
// clear the vectors to free all the heap data.
iStringVector.clear();
+ if (iBufForJavaStorageItemsPtr)
+ {
+ delete iBufForJavaStorageItemsPtr;
+ iBufForJavaStorageItemsPtr = 0;
+ }
+
}
void CStorageBackupUtil::BackupStorageDataL(RDesWriteStream& aStream, TBool& aBackupNotFinished, TInt& aBufferSpaceLeft)
{
- LOG(EBackup, EInfo, "CStorageBackupUtil::BackupStorageDataL");
+ ILOG(EBackup, "CStorageBackupUtil::BackupStorageDataL()");
iBufferSpaceLeft = aBufferSpaceLeft;
if (iFirstCalltoBackupStorageData)
{
+ ILOG(EBackup, "First call to BackupStorageData()");
int err = FillVectorWithStorageData();
if (err != KErrNone)
{
+ ELOG1(EBackup, "Error (%d) in filling wstring vector", err);
User::Leave(err);
}
- LOG1(EBackup, EInfo, "Total no of rows in vector: %d", iStringVector.size());
+ ILOG1(EBackup, "Total no of rows in vector: %d", iStringVector.size());
- // First write the total no of rows in the vector to the stream
+ // 1. Find out the size of the buffer needed for containing JavaStorage
+ // data in "streamed" format.
+ TUint totalStringLengthInBytes = 0;
+ for (int i = 0; i < iStringVector.size(); ++i)
+ {
+ if (iStringVector[i] == JBNULLSTRING ){
+ continue;
+ }
+ totalStringLengthInBytes += iStringVector[i].length()*sizeof(wchar_t);
+ }
+ ILOG1(EBackup, "Total string length calculated: %d", totalStringLengthInBytes);
- aStream.WriteInt32L(iStringVector.size());
- iBufferSpaceLeft -= sizeof(TInt32);
+ // Calculate the total length of the buffer.
+ // The content of the buffer will be as follows:
+
+ TUint totalBuffSize = sizeof(TInt32) + NUMBER_OF_TABLES*sizeof(TInt16)
+ + iStringVector.size()*sizeof(TInt16) + totalStringLengthInBytes;
+
+ // 2. Reserve the buffer with adequate space
+ iBufForJavaStorageItemsPtr = HBufC8::NewL(totalBuffSize);
+ ILOG1(EBackup, "javaStorage Buffer(size %d) allocated SUCCESSFULLY", totalBuffSize);
- /* Then write the number of rows in each table to the stream.
- This will be used while writing the data to storage. */
-
- for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; tableNumber++)
+ // 3. Create temporary stream operator and with it write stuff to buffer
+ TPtr8 buffPtr(iBufForJavaStorageItemsPtr->Des());
+ RDesWriteStream buffStream(buffPtr);
+ CleanupClosePushL(buffStream);
+ buffStream.WriteInt32L(iStringVector.size());
+ for (int tableNumber = 0; tableNumber < NUMBER_OF_TABLES; ++tableNumber)
+ {
+ buffStream.WriteInt16L(iTableSize[tableNumber]);
+ }
+ ILOG(EBackup, "JavaStorage table sizes writen to buffer");
+ TUint writenStringLength = 0;
+ for (int i = 0; i < iStringVector.size(); ++i)
{
- aStream.WriteInt16L(iTableSize[tableNumber]);
- iBufferSpaceLeft -= sizeof(TInt16);
+ TInt16 lenOf8byteString = JBNULLSTRINGLENGTH;
+ if ( iStringVector[i] == JBNULLSTRING )
+ {
+ buffStream.WriteInt16L(lenOf8byteString);
+ continue;
+ }
+ lenOf8byteString = iStringVector[i].length()*sizeof(wchar_t);
+ buffStream.WriteInt16L(lenOf8byteString);
+ if (lenOf8byteString > 0 )
+ {
+ HBufC* tempstring = java::util::S60CommonUtils::wstringToDes(
+ iStringVector[i].c_str());
+ if (!tempstring)
+ {
+ ELOG(EBackup, "Out of memory in JavaStorage backup(in wstring -> des conv)!");
+ User::Leave(KErrNoMemory);
+ }
+ CleanupStack::PushL(tempstring);
+ TPtrC tempStr = tempstring->Des();
+ writenStringLength += tempStr.Size();
+ buffStream.WriteL(tempStr); //length of the string will not be written
+ CleanupStack::PopAndDestroy(tempstring);
+ }
}
+ ILOG1(EBackup, "Total string length writen: %d", writenStringLength);
+ ILOG(EBackup, "Whole Java Storage String vector writen to streambuffer");
+ // 4. Clear not needed resources
+ iStringVector.clear();
+ CleanupStack::PopAndDestroy(&buffStream);
+ ILOG(EBackup, "Not needed resources cleared");
+
+ // 5. Set the read pointer to the beginning of the buffer data
+ // Note that the length of the HBufC8 buffer is exact.
+ iBuffReadPointer.Set(iBufForJavaStorageItemsPtr->Des());
iFirstCalltoBackupStorageData = EFalse;
}
- // Now write the actual string data into the stream.
-
- while (iBufferSpaceLeft > 0 && iStrCount < iStringVector.size())
+ // 6. Start to provide data to SBE from the buffer.
+ ILOG(EBackup, "Extracting data from buffer to SBE");
+ ILOG1(EBackup, "Length of the data in stream buffer: %d", iBuffReadPointer.Length());
+ ILOG1(EBackup, "Space available in SBE buffer: %d", aBufferSpaceLeft);
+ if (iBuffReadPointer.Length() <= aBufferSpaceLeft )
{
- WriteStringtoStreamL(aStream, iStringVector[iStrCount]);
- LOG1(EBackup, EInfo, "StrCount = %d", iStrCount);
+ aStream.WriteL(iBuffReadPointer);
+ aBufferSpaceLeft -= iBuffReadPointer.Length();
+ iBuffReadPointer.Set(NULL,0);
+ delete iBufForJavaStorageItemsPtr;
+ iBufForJavaStorageItemsPtr = 0;
+ ILOG(EBackup, "BACKUP OF STORAGE DATA FINISHED");
+ aBackupNotFinished = EFalse; // Indicate to caller that we are ready
}
-
- if (iStrCount >= iStringVector.size())
+ else // All data from internal buffer does not fit at once to buffer received from SBE
{
- LOG(EBackup, EInfo, "Backup of storage data finished");
- aBackupNotFinished = EFalse;
+ aStream.WriteL(iBuffReadPointer, aBufferSpaceLeft);
+ TInt lengthOfWritenData = aBufferSpaceLeft;
+ iBuffReadPointer.Set(iBuffReadPointer.Ptr() + lengthOfWritenData,
+ iBuffReadPointer.Length() - lengthOfWritenData);
+ aBufferSpaceLeft = 0;
+ ILOG(EBackup, "Not all of the storage data fit into SBE buffer, new buffer from SBE needed.");
}
}
void CStorageBackupUtil::RestoreStorageDataL(RDesReadStream& aStream, TInt& aRestoreState, TInt& aBufferSpaceLeft)
{
- LOG(EBackup, EInfo, "CStorageBackupUtil::RestoreStorageDataL()");
+ ILOG(EBackup, "+CStorageBackupUtil::RestoreStorageDataL()");
iBufferSpaceLeft = aBufferSpaceLeft;
@@ -177,49 +254,11 @@
updater.update();
// Storage restore is over; Set state to EAppArc
+ ILOG(EBackup, "JAVASTORAGE RESTORED SUCCESSFULLY");
aRestoreState = EAppArc;
aBufferSpaceLeft = iBufferSpaceLeft;
}
-}
-
-
-void CStorageBackupUtil::WriteStringtoStreamL(RDesWriteStream& aStream, wstring aStr)
-{
- iLenOfString = aStr.length();
-
- // if length of string is 0, do not write any string to the stream.
- if (iLenOfString == 0)
- {
- aStream.WriteInt16L(iLenOfString*2);
- iBufferSpaceLeft -= sizeof(TInt16);
- iStrCount++;
- }
-
- else
- {
- /* if space is not enough for writing the complete string,
- do not write it. Could be written next time. */
- if (((iLenOfString*2) + sizeof(TInt16)) > iBufferSpaceLeft)
- {
- LOG(EBackup, EInfo, "Stream size is not enough to hold the string");
- // set the bufferspaceleft to zero
- iBufferSpaceLeft = 0;
- }
- // stream has enough space for the length and the string data.
- else
- {
- aStream.WriteInt16L(iLenOfString*2);
- iBufferSpaceLeft -= sizeof(TInt16);
-
- HBufC* tempstr = java::util::S60CommonUtils::wstringToDes(aStr.c_str());
- TPtrC tempStr = tempstr->Des();
- aStream.WriteL(tempStr);
- iBufferSpaceLeft -= (iLenOfString*2);
- delete tempstr;
-
- iStrCount++;
- }
- }
+ ILOG(EBackup, "-CStorageBackupUtil::RestoreStorageDataL()");
}
void CStorageBackupUtil::ReadStringfromStreamL(RDesReadStream& aStream)
@@ -271,7 +310,7 @@
}
}
- else
+ else /* handling new string */
{
iLenOfString = aStream.ReadInt16L();
iBufferSpaceLeft -= sizeof(TInt16);
@@ -326,6 +365,12 @@
delete data;
}
}
+ /* */
+ else if (iLenOfString == JBNULLSTRINGLENGTH )
+ {
+ iStringVector.push_back(JBNULLSTRING);
+ iStrCount--;
+ }
/* if length of string is 0, do not read anything from the stream;
just push an empty string into the vector */
else
@@ -657,6 +702,20 @@
}
+void CStorageBackupUtil::WriteItemToStorageEntry(
+ const std::wstring& aEntryName,
+ const std::wstring& aEntryValue,
+ JavaStorageApplicationEntry_t& aInsertEntry
+ )
+{
+ JavaStorageEntry attribute;
+ if (aEntryValue != JBNULLSTRING )
+ {
+ attribute.setEntry(aEntryName, aEntryValue);
+ aInsertEntry.insert(attribute);
+ }
+}
+
int CStorageBackupUtil::WriteDataToStorage()
{
JELOG2(EBackup);
@@ -706,7 +765,7 @@
js->remove(RUNTIME_SETTINGS_TABLE, emptyEntry);
js->remove(PREINSTALL_TABLE, emptyEntry);
- ILOG(EBackup, "Data removed successfully from table");
+ ELOG(EBackup, "Data removed successfully from table");
}
catch (JavaStorageException jse)
{
@@ -716,7 +775,6 @@
}
}
- JavaStorageEntry attribute;
JavaStorageApplicationEntry_t insertEntry;
ILOG(EBackup, "Start transaction for writing into the database");
@@ -728,47 +786,20 @@
for (int rowNumber = 0; rowNumber < iTableSize[0]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(PACKAGE_NAME, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(VENDOR, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(VERSION, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(ROOT_PATH, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(MEDIA_ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(INITIAL_SIZE, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(JAD_PATH, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(JAR_PATH, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(JAD_URL, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(JAR_URL, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(ACCESS_POINT, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(CONTENT_INFO, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(CONTENT_ID, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(PACKAGE_NAME, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(VENDOR, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(VERSION, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(ROOT_PATH, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(MEDIA_ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(INITIAL_SIZE, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(JAD_PATH, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(JAR_PATH, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(JAD_URL, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(JAR_URL, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(ACCESS_POINT, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(CONTENT_INFO, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(CONTENT_ID, iStringVector[count++], insertEntry);
try
{
@@ -791,20 +822,11 @@
for (int rowNumber = 0; rowNumber < iTableSize[1]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(PACKAGE_ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(NAME, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(MAIN_CLASS, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(AUTORUN, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(PACKAGE_ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(MAIN_CLASS, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(AUTORUN, iStringVector[count++], insertEntry);
try
{
@@ -827,17 +849,10 @@
for (int rowNumber = 0; rowNumber < iTableSize[2]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(NAME, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(VALUE, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(TRUSTED, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(VALUE, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(TRUSTED, iStringVector[count++], insertEntry);
try
{
@@ -860,35 +875,16 @@
for (int rowNumber = 0; rowNumber < iTableSize[3]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(TYPE, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(SECURITY_DOMAIN, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(SECURITY_DOMAIN_CATEGORY, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(HASH, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(CERT_HASH, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(RMS, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(VALID_CERTS, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(ON_SCREEN_KEYPAD, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(SECURITY_WARNINGS, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(TYPE, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(SECURITY_DOMAIN, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(SECURITY_DOMAIN_CATEGORY, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(HASH, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(CERT_HASH, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(RMS, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(VALID_CERTS, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(ON_SCREEN_KEYPAD, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(SECURITY_WARNINGS, iStringVector[count++], insertEntry);
try
{
@@ -911,20 +907,11 @@
for (int rowNumber = 0; rowNumber < iTableSize[4]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(CLASS, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(NAME, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(ACTION, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(FUNCTION_GROUP, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(CLASS, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(ACTION, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(FUNCTION_GROUP, iStringVector[count++], insertEntry);
try
{
@@ -947,20 +934,11 @@
for (int rowNumber = 0; rowNumber < iTableSize[5]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(FUNCTION_GROUP, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(ALLOWED_SETTINGS, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(CURRENT_SETTING, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(BLANKET_PROMPT, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(FUNCTION_GROUP, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(ALLOWED_SETTINGS, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(CURRENT_SETTING, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(BLANKET_PROMPT, iStringVector[count++], insertEntry);
try
{
@@ -983,20 +961,11 @@
for (int rowNumber = 0; rowNumber < iTableSize[6]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(URL, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(NAME, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(FILTER, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(REGISTRATION_TYPE, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(URL, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(FILTER, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(REGISTRATION_TYPE, iStringVector[count++], insertEntry);
try
{
@@ -1019,11 +988,8 @@
for (int rowNumber = 0; rowNumber < iTableSize[7]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(ALARM_TIME, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(ALARM_TIME, iStringVector[count++], insertEntry);
try
{
@@ -1047,8 +1013,7 @@
for (int rowNumber = 0; rowNumber < iTableSize[8]; rowNumber++)
{
- attribute.setEntry(EXTENSIONS, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(EXTENSIONS, iStringVector[count++], insertEntry);
try
{
@@ -1071,17 +1036,10 @@
for (int rowNumber = 0; rowNumber < iTableSize[9]; rowNumber++)
{
- attribute.setEntry(NAME, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(VENDOR, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(VERSION, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(INSTALL_STATE, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(NAME, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(VENDOR, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(VERSION, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(INSTALL_STATE, iStringVector[count++], insertEntry);
try
{
@@ -1170,26 +1128,13 @@
for (int rowNumber = 0; rowNumber < iTableSize[10]; rowNumber++)
{
- attribute.setEntry(ID, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(CREATION_TIME, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(TYPE, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(OTA_CODE, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(URL, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(LATEST_RETRY_TIME, iStringVector[count++]);
- insertEntry.insert(attribute);
-
- attribute.setEntry(RETRY_COUNT, iStringVector[count++]);
- insertEntry.insert(attribute);
+ WriteItemToStorageEntry(ID, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(CREATION_TIME, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(TYPE, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(OTA_CODE, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(URL, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(LATEST_RETRY_TIME, iStringVector[count++], insertEntry);
+ WriteItemToStorageEntry(RETRY_COUNT, iStringVector[count++], insertEntry);
try
{
@@ -1247,144 +1192,46 @@
for (applications = foundEntries.begin(); applications != foundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(PACKAGE_NAME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(VENDOR, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(VERSION, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(ROOT_PATH, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(MEDIA_ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(INITIAL_SIZE, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(JAD_PATH, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(JAR_PATH, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(JAD_URL, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(JAR_URL, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(ACCESS_POINT, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(CONTENT_INFO, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(CONTENT_ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1408,54 +1255,19 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(PACKAGE_ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(NAME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(MAIN_CLASS, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(AUTORUN, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1479,44 +1291,16 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(NAME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(VALUE, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(TRUSTED, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1524,6 +1308,24 @@
return rowsCount;
}
+void CStorageBackupUtil::FetchStorageEntryToStringVector(const JavaStorageEntry& aAttribute,
+ JavaStorageApplicationList_t::const_iterator& aApplicationsIter)
+{
+ const wstring emptyString;
+ wstring str;
+ JavaStorageApplicationEntry_t::const_iterator findIterator;
+ str = emptyString;
+ findIterator = (*aApplicationsIter).find(aAttribute);
+
+ if (findIterator != (*aApplicationsIter).end())
+ {
+ str = (*findIterator).entryValue();
+ iStringVector.push_back(str);
+ } else {
+ iStringVector.push_back(JBNULLSTRING);
+ }
+}
+
int CStorageBackupUtil::FillVectorwithMidpPackageTableData(JavaStorageApplicationList_t& afoundEntries)
{
const wstring emptyString;
@@ -1534,110 +1336,39 @@
/* Initialise Iterators to iterate through all applications
matched with search patterns. */
JavaStorageApplicationList_t::const_iterator applications;
- JavaStorageApplicationEntry_t::const_iterator findIterator;
int rowsCount=0;
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(TYPE, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(SECURITY_DOMAIN, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(SECURITY_DOMAIN_CATEGORY, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(HASH, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(CERT_HASH, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(RMS, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(VALID_CERTS, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(ON_SCREEN_KEYPAD, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
+ FetchStorageEntryToStringVector(attribute, applications);
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
-
attribute.setEntry(SECURITY_WARNINGS, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1661,54 +1392,19 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(CLASS, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(NAME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(ACTION, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(FUNCTION_GROUP, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1732,54 +1428,19 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(FUNCTION_GROUP, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(ALLOWED_SETTINGS, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(CURRENT_SETTING, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(BLANKET_PROMPT, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1803,54 +1464,19 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(URL, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(NAME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(FILTER, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(REGISTRATION_TYPE, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1874,24 +1500,10 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(ALARM_TIME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1915,14 +1527,7 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(EXTENSIONS, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -1946,44 +1551,16 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(NAME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(VENDOR, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(VERSION, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(INSTALL_STATE, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
@@ -2007,74 +1584,25 @@
for (applications = afoundEntries.begin(); applications != afoundEntries.end(); applications++)
{
attribute.setEntry(ID, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(CREATION_TIME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(TYPE, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(OTA_CODE, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(URL, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(LATEST_RETRY_TIME, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
attribute.setEntry(RETRY_COUNT, L"");
- str = emptyString;
- findIterator = (*applications).find(attribute);
-
- if (findIterator != (*applications).end())
- {
- str = (*findIterator).entryValue();
- }
- iStringVector.push_back(str);
+ FetchStorageEntryToStringVector(attribute, applications);
rowsCount++;
}
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h
--- a/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javabackup/midp2backup/src.s60/javastoragebackuputil.h Thu Sep 02 13:22:59 2010 +0300
@@ -172,16 +172,6 @@
int FillVectorWithStorageData();
/**
- * A utility function which converts a wstring into a TDesC
- * and writes it into the stream.
- *
- * @param stream an RDesWriteStream into which the converted
- * string is written
- * @param tempString the wstring which is to be converted.
- */
- void WriteStringtoStreamL(RDesWriteStream& aStream, std::wstring aTempString);
-
- /**
* A utility function which reads a TDesC from the stream, converts it
* to a wstring and writes it into the vector.
*
@@ -200,6 +190,17 @@
* has completed successfully or not.
*/
int WriteDataToStorage();
+
+
+ void FetchStorageEntryToStringVector(
+ const java::storage::JavaStorageEntry& aAttribute,
+ java::storage::JavaStorageApplicationList_t::const_iterator& aApplicationsIter
+ );
+
+ void WriteItemToStorageEntry(const std::wstring& aEntryName,
+ const std::wstring& aEntryValue,
+ java::storage::JavaStorageApplicationEntry_t& aInsertEntry);
+
public:
/**
* Utility function which fills the vector with data got from storage.
@@ -396,6 +397,19 @@
* Own
*/
int iBufferSpaceLeft;
+
+ /**
+ * During backup data fromJavaStorage will be temporarily stored
+ * in serialised format in this buffer.
+ */
+ HBufC8* iBufForJavaStorageItemsPtr;
+
+ /**
+ * Stores the position in iBufForJavaStorageItemsPtr from where data is
+ * being read during backup operation.
+ */
+ TPtrC8 iBuffReadPointer;
+
};
} // namespace backup
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp
--- a/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javabackup/midp2backup/src.s60/midp2backupplugin.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -125,7 +125,7 @@
void CMidp2BackupPlugin::GetBackupDataSectionL(TPtr8& aBuffer, TBool& aFinished)
{
- LOG(EBackup, EInfo, "CMidp2BackupPlugin::GetBackupDataSectionL");
+ ILOG(EBackup, "+CMidp2BackupPlugin::GetBackupDataSectionL()");
iBufferSpaceLeft = aBuffer.MaxLength();
RDesWriteStream stream(aBuffer);
@@ -144,7 +144,7 @@
aFinished = EFalse;
}
- else
+ if (!iStorageDataBackup)
{
if (iFirstCallToGetBackupDataSection)
{
@@ -301,12 +301,13 @@
{
aFinished = ETrue;
iFirstCallToGetBackupDataSection = ETrue;
- iStorageDataBackup = ETrue;
+ // iStorageDataBackup = ETrue;
}
delete fullFileName;
}
CleanupStack::PopAndDestroy(&stream);
+ ILOG(EBackup, "-CMidp2BackupPlugin::GetBackupDataSectionL()");
}
@@ -318,7 +319,7 @@
void CMidp2BackupPlugin::RestoreBaseDataSectionL(TDesC8& aBuffer, TBool aFinished)
{
- LOG(EBackup, EInfo, "CMidp2BackupPlugin::RestoreBaseDataSectionL");
+ ILOG(EBackup, "+CMidp2BackupPlugin::RestoreBaseDataSectionL()");
iBufferSpaceLeft = aBuffer.Size();
RDesReadStream stream(aBuffer);
@@ -349,6 +350,7 @@
if (iRestoreState == EStorage)
{
+ ILOG1(EBackup, "Restoring Storage for drive %d", iDrive);
iStorageBackupUtil -> RestoreStorageDataL(stream, iRestoreState, iBufferSpaceLeft);
}
@@ -372,12 +374,14 @@
if (aFinished)
{
// Set state to EStorage
- iRestoreState = EStorage;
+ ILOG1(EBackup, "Restore of drive %d complete, resetting statemachine for next drive", iDrive);
+ iRestoreState = EAppArc;
}
}
- aFinished = ETrue;
+ // aFinished = ETrue;
CleanupStack::PopAndDestroy(&stream);
+ ILOG(EBackup, "-CMidp2BackupPlugin::RestoreBaseDataSectionL()");
}
void CMidp2BackupPlugin::InitialiseRestoreIncrementDataL(TDriveNumber /* aDrive */)
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp
--- a/javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javabackup/midp2backup_usif/build/midp2backupplugin.mmp Thu Sep 02 13:22:59 2010 +0300
@@ -55,9 +55,13 @@
USERINCLUDE ../../inc.s60
USERINCLUDE ../../../../inc
-start resource ../data/10282474.rss
+START RESOURCE ../data/10282474.rss
TARGET midp2backupplugin.rsc
-end
+END
+START RESOURCE ../data/10282474_iad.rss
+TARGET midp2backupplugin.rsc
+TARGETPATH resource/java/iad
+END
LIBRARY ecom.lib
LIBRARY efsrv.lib
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup_usif/data/10282474.rss
--- a/javamanager/javabackup/midp2backup_usif/data/10282474.rss Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javabackup/midp2backup_usif/data/10282474.rss Thu Sep 02 13:22:59 2010 +0300
@@ -19,6 +19,10 @@
#include
#include "javauids.h"
+#ifndef ECOM_VERSION_NO
+#define ECOM_VERSION_NO 1
+#endif
+
// Declares info for one implementation
RESOURCE REGISTRY_INFO theInfo
{
@@ -36,7 +40,7 @@
IMPLEMENTATION_INFO
{
implementation_uid = KBackupEcomImplUid;
- version_no = 1;
+ version_no = ECOM_VERSION_NO;
display_name = "MIDP2 Backup Plugin";
default_data = "midp2";
opaque_data = "test_params";
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javabackup/midp2backup_usif/data/10282474_iad.rss
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javabackup/midp2backup_usif/data/10282474_iad.rss Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM resource definition for IAD
+*
+*/
+
+// Version for IAD
+#define ECOM_VERSION_NO 2
+
+// Include actual rss
+#include "10282474.rss"
+
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javacaptain/extensionplugins/scrupdater/inc/scrupdater.h
--- a/javamanager/javacaptain/extensionplugins/scrupdater/inc/scrupdater.h Mon Aug 23 14:24:31 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ScrUpdater is Java Captain Symbian plugin that updates
-* presence information of Java Applications in USIF SCR
-* when removable drive is added or removed to the device.
-*
-*/
-
-#ifndef SCRUPDATER_H
-#define SCRUPDATER_H
-
-#include
-#include
-
-#include "javaosheaders.h"
-
-#include "eventconsumerinterface.h"
-#include "extensionplugininterface.h"
-
-namespace java
-{
-
-namespace captain
-{
-
-class CoreInterface;
-
-OS_NONSHARABLE_CLASS(ScrUpdater) : public EventConsumerInterface,
- public ExtensionPluginInterface
-{
-public:
- ScrUpdater();
- virtual ~ScrUpdater();
-
- // PluginInterface
- virtual void startPlugin(CoreInterface* aCore);
- virtual void stopPlugin();
-
- // EventConsumerInterface
- virtual void event(const std::string& eventProvider,
- java::comms::CommsMessage& aMsg);
-
- // ExtensionPluginInterface methods
- virtual EventConsumerInterface* getEventConsumer();
-
-private:
- void removeScrPresencesL(driveInfo *aInfo);
- void addScrPresencesL(driveInfo *aInfo);
- void initializeScrPresenceInfoL();
-
- Usif::RSoftwareComponentRegistry *createScrL();
-
-
- CoreInterface* mCore;
-};
-
-} // namespace captain
-} // namespace java
-
-#endif // SCRUPDATER_H
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javacaptain/extensionplugins/scrupdater/src.s60/lookup.cpp
--- a/javamanager/javacaptain/extensionplugins/scrupdater/src.s60/lookup.cpp Mon Aug 23 14:24:31 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: lookup
-*
-*/
-
-#include //For strcmp
-
-#include "javasymbianoslayer.h"
-#include "logger.h"
-
-#include "extensionplugininterface.h"
-
-using namespace java::captain;
-
-ExtensionPluginInterface* getExtensionPlugin();
-
-EXPORT_C FuncPtr findDllMethod(const char* funcName)
-{
- JELOG2(EJavaCaptain);
- FuncPtr ptr = 0;
- if (funcName)
- {
- if (strcmp(funcName, "getExtensionPlugin") == 0)
- {
- ptr = (FuncPtr)getExtensionPlugin;
- }
- }
- else
- {
- ELOG(EJavaCaptain,
- "scrupdater extensionplugin findDllMethod() funcName == null");
- }
- return ptr;
-}
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javacaptain/extensionplugins/scrupdater/src.s60/scrupdater.cpp
--- a/javamanager/javacaptain/extensionplugins/scrupdater/src.s60/scrupdater.cpp Mon Aug 23 14:24:31 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,705 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: ScrUpdater is Java Captain Symbian plugin that updates
-* presence information of Java Applications in USIF SCR
-* when removable drive is added or removed to the device.
-*
-*/
-
-#include
-#include
-#include
-
-#include "javaprocessconstants.h"
-#include "javasymbianoslayer.h"
-#include "javauids.h"
-#include "logger.h"
-#include "coreinterface.h"
-#include "booteventprovidermessages.h"
-#include "mmceventprovidermessages.h"
-
-#include "scrupdater.h"
-
-// Enable notifying AppArc for USIF Phase 2.
-//#define RD_JAVA_USIF_NOTIFY_APP_ARC
-
-
-using namespace Usif;
-
-/**
- * Return pointer to ExtensionPluginInterface implementation for this
- * extension dll
- */
-java::captain::ExtensionPluginInterface* getExtensionPlugin()
-{
- return new java::captain::ScrUpdater();
-}
-
-namespace java
-{
-namespace captain
-{
-
-using java::fileutils::driveInfo;
-using java::fileutils::DriveListenerInterface;
-
-/**
- * Empty contructor
- */
-ScrUpdater::ScrUpdater() : mCore(0)
-{
-}
-
-/**
- * Empty destructor
- */
-ScrUpdater::~ScrUpdater()
-{
-}
-
-/**
- * Implement PluginInterface method
- */
-void ScrUpdater::startPlugin(CoreInterface* core)
-{
- LOG(EJavaCaptain, EInfo, "ScrUpdater plugin started");
-
- mCore = core;
-}
-
-/**
- * Implement PluginInterface method
- */
-void ScrUpdater::stopPlugin()
-{
- mCore = 0;
-}
-
-/**
- * Implement ExtensionPluginInterface method
- */
-EventConsumerInterface* ScrUpdater::getEventConsumer()
-{
- return this;
-}
-
-/**
- * Handle Java Captain events sent by Boot event provider or
- * MMC event provider.
- *
- * Implement EventConsumerInterface method
- */
-void ScrUpdater::event(const std::string& eventProvider,
- java::comms::CommsMessage& aMsg)
-{
- if (eventProvider == BOOT_EVENT_PROVIDER)
- {
- int bootType = NORMAL_BOOT_C;
- getBootMessageParams(aMsg, bootType);
- LOG1(
- EJavaCaptain,
- EInfo,
- "ScrUpdater::event() boot event received (type=%d)",
- bootType);
- switch (bootType)
- {
- case IAD_BOOT_C:
- case FIRST_DEVICE_BOOT_C:
- case NORMAL_BOOT_C:
- {
- // Update presence information
- TRAPD(err, initializeScrPresenceInfoL())
- if (KErrNone != err)
- {
- ELOG1(EJavaCaptain, "initializeScrPresenceInfoL: leaved (%d)", err);
- }
- }
- break;
-
- default:
- {
- WLOG1(EJavaCaptain,
- "DriveListenerInterface: event() unknown boot event (type=%d)", bootType);
- }
- break;
- }
- }
- else if (eventProvider == MMC_EVENT_PROVIDER)
- {
- int operation = 0;
- driveInfo di;
- getMmcChangedMessageParams(aMsg, operation, di);
- LOG1(
- EJavaCaptain,
- EInfo,
- "ScrUpdater::event() mmc event received (operation=%d)",
- operation);
-
- switch (operation)
- {
- case DriveListenerInterface::REMOVABLE_MEDIA_REMOVED_C:
- {
- // All Java applications in the removed drive are set
- // to 'not present' state
- TRAPD(err, removeScrPresencesL(&di));
- if (KErrNone != err)
- {
- ELOG1(EJavaCaptain, "removeScrPresencesL leaved (%d)", err);
- }
- }
- break;
-
- case DriveListenerInterface::REMOVABLE_MEDIA_INSERTED_C:
- {
- // Those Java applications in the drive to where the media
- // (e.g. memory card) was added are set to 'present' state
- // IF the media id is correct (in other words if the same
- // memory card that they have been installed to is added
- // to the drive).
- TRAPD(err, addScrPresencesL(&di));
- if (KErrNone != err)
- {
- ELOG1(EJavaCaptain, "addScrPresencesL leaved (%d)", err);
- }
- }
- break;
- }
- }
-}
-
-/**
- * Set the presence state of all Java applications installed
- * to the removable drive specified in aInfo to not present
- */
-void ScrUpdater::removeScrPresencesL(driveInfo *aInfo)
-{
- __UHEAP_MARK;
- LOG1WSTR(EJavaCaptain, EInfo,
- "removeScrPresencesL: driveInfo root path is %s", aInfo->iRootPath);
-
- RSoftwareComponentRegistry *pScr = createScrL();
- CleanupStack::PushL(pScr);
-
- // Get ids of all Java components in scr
- RArray componentIdList;
- CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
- pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
-
- pScr->GetComponentIdsL(componentIdList);
- CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
- CleanupClosePushL(componentIdList);
-
- // For each component check whether it has been installed
- // to the removed drive
- TInt nComponents = componentIdList.Count();
- TUint removedDrive = (TUint)(aInfo->iRootPath[0]);
- // Now removedDrive contains the drive letter, convert it to drive number 0-25
- if ((removedDrive > 64) && (removedDrive < 91))
- {
- // 'A' - 'Z'
- removedDrive -= 65;
- }
- else if ((removedDrive > 96) && (removedDrive < 123))
- {
- // 'a' - 'z'
- removedDrive -= 97;
- }
- else
- {
- ELOG1WSTR(EJavaCaptain,
- "removeScrPresencesL: Unexpected root path in remove drive info %s",
- aInfo->iRootPath);
- CleanupStack::PopAndDestroy(pScr);
- return;
- }
-
- LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, removed drive is %d",
- nComponents, removedDrive);
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
- // TEMP TEST
- TBool fPresenceChange = EFalse;
- RArray removedApps;
- CleanupClosePushL(removedApps);
-#endif
-
- for (TInt nInd = 0; nInd < nComponents; nInd++)
- {
- CComponentEntry *pEntry = CComponentEntry::NewLC();
- if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry)))
- {
- ELOG1(EJavaCaptain,
- "removeScrPresencesL: SCR GetComponentIdsL returned id %d "
- "but GetComponentL does not find it", componentIdList[nInd]);
- CleanupStack::PopAndDestroy(pEntry);
- continue;
- }
-
- TInt nInstalledDrives = pEntry->InstalledDrives().Length();
- if (nInstalledDrives <= removedDrive)
- {
- // SCR InstalledDrives should be array of 26 elements (value 0 or 1)
- ELOG2(EJavaCaptain,
- "removeScrPresencesL: The length of InstalledDrives array (%d) "
- "is smaller than removedDrive (%d)", nInstalledDrives, removedDrive);
- CleanupStack::PopAndDestroy(pEntry);
- continue;
- }
-
- LOG1(EJavaCaptain, EInfo, "Java component id %d", componentIdList[nInd]);
-
- if (pEntry->InstalledDrives()[removedDrive])
- {
- // This component has been installed to the drive
- // that has just been removed
- pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse);
-
- LOG1(EJavaCaptain, EInfo,
- "removeScrPresencesL: set component %d to not present",
- componentIdList[nInd]);
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
- fPresenceChange = ETrue;
-
- // Gather the Uids of all applications that are no longer present
- RArray appsInComponent;
- CleanupClosePushL(appsInComponent);
- pScr->GetAppUidsForComponentL(
- componentIdList[nInd], appsInComponent);
- for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++)
- {
- TApaAppUpdateInfo appInfo;
- appInfo.iAppUid = appsInComponent[nInd2];
- appInfo.iAction = TApaAppUpdateInfo::EAppNotPresent;
- (void)removedApps.Append(appInfo);
- }
- CleanupStack::PopAndDestroy(&appsInComponent);
-#endif
- }
-
- CleanupStack::PopAndDestroy(pEntry);
- }
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
- // Tell AppArc which applications are no longer present
- while (fPresenceChange)
- {
- if (removedApps.Count() == 0)
- {
- ELOG(EJavaCaptain, "removeScrPresencesL: Uids of the removed apps are not known");
- break;
- }
-
- RApaLsSession apaSession;
- TInt err = apaSession.Connect();
- if (KErrNone != err)
- {
- ELOG1(EJavaCaptain, "removeScrPresencesL: Error %d when connecting AppArc", err);
- break;
- }
- else
- {
- CleanupClosePushL(apaSession);
- apaSession.UpdateAppListL(removedApps);
- CleanupStack::PopAndDestroy(); // closes apaSession
- fPresenceChange = EFalse;
- }
- }
-
- CleanupStack::PopAndDestroy(); // Close removedApps
-#endif
- CleanupStack::PopAndDestroy(); // Close componentIdList
- CleanupStack::PopAndDestroy(pScr);
- __UHEAP_MARKEND;
-}
-
-
-/**
- * Set the presence state of all Java applications installed
- * to the removable drive specified in aInfo to present
- */
-void ScrUpdater::addScrPresencesL(driveInfo *aInfo)
-{
- __UHEAP_MARK;
- LOG1WSTR(EJavaCaptain, EInfo,
- "addScrPresencesL: driveInfo root path is %s", aInfo->iRootPath);
-
- RSoftwareComponentRegistry *pScr = createScrL();
- CleanupStack::PushL(pScr);
-
- // Get ids of all Java components in scr
- RArray componentIdList;
- CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
- pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
-
- pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
- CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
- CleanupClosePushL(componentIdList);
-
-
- // For each component check whether it has been installed
- // to the added drive AND whether the media id is correct
- // (in other words if the actual memory card where the component
- // has been installed to is added to the drive).
- TInt nComponents = componentIdList.Count();
- TUint addedMediaId = (TUint)(aInfo->iId);
- TUint addedDrive = (TUint)(aInfo->iRootPath[0]);
- // Now addedDrive contains the drive letter, convert it to drive number 0-25
- if ((addedDrive > 64) && (addedDrive < 91))
- {
- // 'A' - 'Z'
- addedDrive -= 65;
- }
- else if ((addedDrive > 96) && (addedDrive < 123))
- {
- // 'a' - 'z'
- addedDrive -= 97;
- }
- else
- {
- ELOG1WSTR(EJavaCaptain,
- "addScrPresencesL: Unexpected root path in add drive info %s",
- aInfo->iRootPath);
- CleanupStack::PopAndDestroy(pScr);
- return;
- }
-
- LOG2(EJavaCaptain, EInfo, "Number of Java components is %d, added drive is %d",
- nComponents, addedDrive);
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
- TBool fPresenceChange = EFalse;
- RArray addedApps;
- CleanupClosePushL(addedApps);
-#endif
-
- for (TInt nInd = 0; nInd < nComponents; nInd++)
- {
- CComponentEntry *pEntry = CComponentEntry::NewLC();
- if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry)))
- {
- ELOG1(EJavaCaptain,
- "addScrPresencesL: SCR GetComponentIdsL returned id %d "
- "but GetComponentL does not find it", componentIdList[nInd]);
- CleanupStack::PopAndDestroy(pEntry);
- continue;
- }
-
- // When Java Installer registers Java app to SCR it stores also
- // the media id using SetComponentPropertyL(TComponentId aComponentId,
- // _L("Media-Id")), TInt64 aValue); (aValue is actually 32 bit int)
- CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *)
- pScr->GetComponentPropertyL(componentIdList[nInd],_L("Media-Id"));
- if (NULL == pMediaIdProperty)
- {
- ELOG1(EJavaCaptain,
- "addScrPresencesL: media_id property not found for component %d",
- componentIdList[nInd]);
- CleanupStack::PopAndDestroy(pEntry);
- continue;
- }
- CleanupStack::PushL(pMediaIdProperty);
-
- TInt nInstalledDrives = pEntry->InstalledDrives().Length();
- if (nInstalledDrives <= addedDrive)
- {
- // SCR InstalledDrives should be array of 26 elements (value 0 or 1)
- ELOG2(EJavaCaptain,
- "addScrPresencesL: The length of InstalledDrives array (%d) "
- "is smaller than addedDrive (%d)", nInstalledDrives, addedDrive);
- CleanupStack::PopAndDestroy(pEntry);
- continue;
- }
-
- LOG1(EJavaCaptain, EInfo, "Java component id %d", componentIdList[nInd]);
-
- if (pEntry->InstalledDrives()[addedDrive])
- {
- // This component has been installed to the drive
- // that has just been added.
- // Now check whether the media id of the added media
- // is OK for this component.
- if (addedMediaId == pMediaIdProperty->IntValue())
- {
- pScr->SetIsComponentPresentL(componentIdList[nInd], ETrue);
-
- LOG1(EJavaCaptain, EInfo,
- "addScrPresencesL: set component %d to present",
- componentIdList[nInd]);
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
- fPresenceChange = ETrue;
-
- // Gather the Uids of all 'new' applications that are now present
- RArray appsInComponent;
- CleanupClosePushL(appsInComponent);
- pScr->GetAppUidsForComponentL(
- componentIdList[nInd], appsInComponent);
- for (TInt nInd2 = 0; nInd2 < appsInComponent.Count(); nInd2++)
- {
- TApaAppUpdateInfo appInfo;
- appInfo.iAppUid = appsInComponent[nInd2];
- appInfo.iAction = TApaAppUpdateInfo::EAppPresent;
- (void)addedApps.Append(appInfo);
- }
- CleanupStack::PopAndDestroy(&appsInComponent);
-#endif
- }
- }
-
- CleanupStack::PopAndDestroy(pMediaIdProperty);
- CleanupStack::PopAndDestroy(pEntry);
- }
-
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
- // Tell AppArc which 'new' applications are now present
- while (fPresenceChange)
- {
- if (addedApps.Count() == 0)
- {
- ELOG(EJavaCaptain, "addScrPresencesL: Uids of the 'new' apps are not known");
- break;
- }
-
- RApaLsSession apaSession;
- TInt err = apaSession.Connect();
- if (KErrNone != err)
- {
- ELOG1(EJavaCaptain, "addScrPresencesL: Error %d when connecting AppArc", err);
- break;
- }
- else
- {
- CleanupClosePushL(apaSession);
- apaSession.UpdateAppListL(addedApps);
- CleanupStack::PopAndDestroy(); // closes apaSession
- fPresenceChange = EFalse;
- }
- }
-
- CleanupStack::PopAndDestroy(); // Close addedApps
-#endif
- CleanupStack::PopAndDestroy(); // Close componentIdList
- CleanupStack::PopAndDestroy(pScr);
- __UHEAP_MARKEND;
-}
-
-
-/**
- * Loop through all removable drives and get the media id of
- * the memory card or other removable media in the drive and update
- * presence information of all Java applications installed
- * to removable drives accordingly.
- */
-void ScrUpdater::initializeScrPresenceInfoL()
-{
- __UHEAP_MARK;
- RFs fs;
- User::LeaveIfError(fs.Connect());
- CleanupClosePushL(fs);
-
- // Which drives are present and what is the media id of
- // each removable volume
- TInt err = KErrNone;
- TInt err2 = KErrNone;
- TBool drivePresent[EDriveZ + 1];
- TUint driveMediaId[EDriveZ + 1];
- TVolumeInfo volumeInfo;
- TDriveInfo driveInfo;
-
- for (TInt nInd = EDriveA; nInd < EDriveZ; nInd++)
- {
- err = fs.Volume(volumeInfo, nInd);
- if (KErrNone == err)
- {
- drivePresent[nInd] = ETrue;
- driveMediaId[nInd] = volumeInfo.iUniqueID;
- // If the media is not removable, media id is not checked
- err2 = fs.Drive(driveInfo, nInd);
- if (KErrNone != err2)
- {
- ELOG1(EJavaCaptain,
- "initializeScrPresenceInfoL: error (%d) when trying to get drive info",
- err2);
- User::Leave(err2);
- }
- else
- {
- if (!(driveInfo.iDriveAtt & KDriveAttRemovable))
- {
- driveMediaId[nInd] = 0;
- }
- }
- }
- else if (KErrNotReady == err)
- {
- // no volume in this drive
- drivePresent[nInd] = EFalse;
- driveMediaId[nInd] = 0;
- }
- else
- {
- ELOG1(EJavaCaptain,
- "initializeScrPresenceInfoL: error (%d) when trying to get volume info",
- err);
- User::Leave(err);
- }
- }
- CleanupStack::PopAndDestroy(); // close RFs
-
-
- RSoftwareComponentRegistry *pScr = createScrL();
- CleanupStack::PushL(pScr);
-
- // Get ids of all Java components in scr
- RArray componentIdList;
- CComponentFilter *pJavaSwTypeFilter = CComponentFilter::NewLC();
- pJavaSwTypeFilter->SetSoftwareTypeL(Usif::KSoftwareTypeJava);
-
- pScr->GetComponentIdsL(componentIdList, pJavaSwTypeFilter);
- CleanupStack::PopAndDestroy(pJavaSwTypeFilter);
- CleanupClosePushL(componentIdList);
-
- // For each component check whether the drive it has been installed
- // to is present AND whether the media id is correct
- TInt nComponents = componentIdList.Count();
-
- LOG1(EJavaCaptain, EInfo, "initializeScrPresenceInfoL: Number of Java components is %d",
- nComponents);
-
- for (TInt nInd = 0; nInd < nComponents; nInd++)
- {
- CComponentEntry *pEntry = CComponentEntry::NewLC();
- if (!(pScr->GetComponentL(componentIdList[nInd], *pEntry)))
- {
- ELOG1(EJavaCaptain,
- "initializeScrPresenceInfoL: SCR GetComponentIdsL returned id %d "
- "but GetComponentL does not find it", componentIdList[nInd]);
- CleanupStack::PopAndDestroy(pEntry);
- continue;
- }
-
- CIntPropertyEntry* pMediaIdProperty = (CIntPropertyEntry *)
- pScr->GetComponentPropertyL(componentIdList[nInd],_L("Media-Id"));
- if (NULL == pMediaIdProperty)
- {
- ELOG1(EJavaCaptain,
- "initializeScrPresenceInfoL: media_id property not found for component %d",
- componentIdList[nInd]);
- CleanupStack::PopAndDestroy(pEntry);
- continue;
- }
- CleanupStack::PushL(pMediaIdProperty);
-
- TInt nInstalledDrives = pEntry->InstalledDrives().Length();
- if (nInstalledDrives > (EDriveZ + 1))
- {
- WLOG2(EJavaCaptain,
- "initializeScrPresenceInfoL: too big (%d) installed drives array for "
- "component %d", nInstalledDrives, componentIdList[nInd]);
- nInstalledDrives = EDriveZ;
- }
- // When Java components are installed, only one installed drive
- // and corresponding media id are registered.
- TInt installationDrive = -1;
-
- for (TInt driveNumber = EDriveA; driveNumber < nInstalledDrives; driveNumber++)
- {
- if (pEntry->InstalledDrives()[driveNumber])
- {
- installationDrive = driveNumber;
- break;
- }
- }
-
- if (installationDrive == -1)
- {
- ELOG1(EJavaCaptain,
- "initializeScrPresenceInfoL: component (id %d) did not have installed drive info",
- componentIdList[nInd]);
- CleanupStack::PopAndDestroy(pMediaIdProperty);
- CleanupStack::PopAndDestroy(pEntry);
- continue;
- }
-
- if (drivePresent[installationDrive])
- {
- // Check also the media id
- if (driveMediaId[installationDrive] == pMediaIdProperty->IntValue())
- {
- LOG1(EJavaCaptain, EInfo,
- "initializeScrPresenceInfoL: set component %d to present",
- componentIdList[nInd]);
-
- pScr->SetIsComponentPresentL(componentIdList[nInd], ETrue);
- }
- else
- {
- LOG1(EJavaCaptain, EInfo,
- "initializeScrPresenceInfoL: set component %d to NOT present",
- componentIdList[nInd]);
-
- pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse);
- }
- }
- else
- {
- LOG1(EJavaCaptain, EInfo,
- "initializeScrPresenceInfoL: set component %d to NOT present",
- componentIdList[nInd]);
-
- // drive is not present -> Java component installed to that
- // drive is not present
- pScr->SetIsComponentPresentL(componentIdList[nInd], EFalse);
- }
-
- CleanupStack::PopAndDestroy(pMediaIdProperty);
- CleanupStack::PopAndDestroy(pEntry);
- }
-
- CleanupStack::PopAndDestroy(); // Close componentIdList
- CleanupStack::PopAndDestroy(pScr); // Also closes RSoftwareComponentRegistry
-
- __UHEAP_MARKEND;
-}
-
-
-/**
- * Creates an instance of RSoftwareComponentRegistry and connects to it.
- */
-RSoftwareComponentRegistry *ScrUpdater::createScrL()
-{
- RSoftwareComponentRegistry *pScr = new RSoftwareComponentRegistry;
- if (NULL == pScr)
- {
- ELOG(EJavaInstaller,
- "CreateScrL: Creating RSoftwareComponentRegistry failed");
- User::Leave(KErrGeneral);
- }
- TInt err = pScr->Connect();
- if (KErrNone != err)
- {
- ELOG1(EJavaInstaller,
- "CreateScrL: Connecting to RSoftwareComponentRegistry failed, error %d",
- err);
- delete pScr;
- User::Leave(err);
- }
-
- return pScr;
-}
-
-
-} // namespace captain
-} // namespace java
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro
--- a/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javacaptain/extensionplugins/settingslistener/build/javacaptain_ext_settingslistener.pro Thu Sep 02 13:22:59 2010 +0300
@@ -20,7 +20,7 @@
CONFIG -= qt
symbian {
- LIBS += -lcommonengine \
+ LIBS += -lCommonEngine \
-lcentralrepository \
-lcenrepnotifhandler \
-ljavacomms
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp
--- a/javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/appinstuiplugin/build/javainstalllauncher.mmp Thu Sep 02 13:22:59 2010 +0300
@@ -40,6 +40,10 @@
START RESOURCE ../data/101F875F.rss
TARGET ifeui.rsc
END
+START RESOURCE ../data/101F875F_iad.rss
+TARGET ifeui.rsc
+TARGETPATH resource/java/iad
+END
// Sources
SOURCEPATH ../src
@@ -52,8 +56,6 @@
USERINCLUDE ../inc
USERINCLUDE ../../../../inc
-SYSTEMINCLUDE ../../../../inc
-
// Libraries
LIBRARY charconv.lib
LIBRARY cone.lib
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/appinstuiplugin/data/101F875F.rss
--- a/javamanager/javainstaller/appinstuiplugin/data/101F875F.rss Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/appinstuiplugin/data/101F875F.rss Thu Sep 02 13:22:59 2010 +0300
@@ -23,6 +23,10 @@
// RESOURCE DEFINITIONS
+#ifndef ECOM_VERSION_NO
+#define ECOM_VERSION_NO 2
+#endif
+
RESOURCE REGISTRY_INFO registry_info
{
resource_format_version = RESOURCE_FORMAT_VERSION_2;
@@ -42,8 +46,7 @@
IMPLEMENTATION_INFO
{
implementation_uid = KInstallerFrontEndEcomImplUid;
- // Version number is 2 so that this implementation should override the old one in ROM
- version_no = 2;
+ version_no = ECOM_VERSION_NO;
display_name = "Midlet installation ui implementation";
default_data = "application/java-archive||text/vnd.sun.j2me.app-descriptor||application/x-java-archive||application/java";
opaque_data = " ";
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/appinstuiplugin/data/101F875F_iad.rss
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/appinstuiplugin/data/101F875F_iad.rss Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM resource definition for IAD
+*
+*/
+
+// Version for IAD
+#define ECOM_VERSION_NO 3
+
+// Include actual rss
+#include "101F875F.rss"
+
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp
--- a/javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/iconsizenotifplugin/build/javaiconsizenotifplugin.mmp Thu Sep 02 13:22:59 2010 +0300
@@ -16,8 +16,12 @@
*/
+#include <../../../../inc/project_defines.hrh>
+#include
#include
+#include <../../../../inc/java_stdcpp_support_for_dll.hrh>
+
TARGET javaiconsizenotifplugin.dll
TARGETTYPE PLUGIN
@@ -33,6 +37,10 @@
START RESOURCE ../data/javaiconsizenotifplugin.rss
TARGET javaiconsizenotifplugin.rsc
END
+START RESOURCE ../data/javaiconsizenotifplugin_iad.rss
+TARGET javaiconsizenotifplugin.rsc
+TARGETPATH resource/java/iad
+END
SOURCEPATH ../src
SOURCE iconsizenotifier.cpp
@@ -43,8 +51,8 @@
LIBRARY euser.lib
LIBRARY eiksrv.lib // MEikSrvNotifierBase2
-LIBRARY cdlengine.lib // AknLayoutScalable_Avkon
-LIBRARY aknlayout2scalable.lib // TAknWindowComponentLayout
+LIBRARY CdlEngine.lib // AknLayoutScalable_Avkon
+LIBRARY AknLayout2Scalable.lib // TAknWindowComponentLayout
LIBRARY avkon.lib // TAknLayoutRect
LIBRARY eikcore.lib // TAknLayoutRect
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss
--- a/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin.rss Thu Sep 02 13:22:59 2010 +0300
@@ -18,6 +18,10 @@
#include
#include
+#ifndef ECOM_VERSION_NO
+#define ECOM_VERSION_NO 1
+#endif
+
RESOURCE REGISTRY_INFO r_registry
{
resource_format_version = RESOURCE_FORMAT_VERSION_2;
@@ -32,7 +36,7 @@
IMPLEMENTATION_INFO
{
implementation_uid = 0x101FD68A;
- version_no = 1;
+ version_no = ECOM_VERSION_NO;
display_name = "JavaIconSizeNotifPlugin";
default_data = "";
opaque_data = "0";
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin_iad.rss
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/javamanager/javainstaller/iconsizenotifplugin/data/javaiconsizenotifplugin_iad.rss Thu Sep 02 13:22:59 2010 +0300
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: ECOM resource definition for IAD
+*
+*/
+
+// Version for IAD
+#define ECOM_VERSION_NO 2
+
+// Include actual rss
+#include "javaiconsizenotifplugin.rss"
+
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java
--- a/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc.s60/com/nokia/mj/impl/installer/applicationregistrator/SifNotifier.java Thu Sep 02 13:22:59 2010 +0300
@@ -18,8 +18,11 @@
package com.nokia.mj.impl.installer.applicationregistrator;
+import com.nokia.mj.impl.installer.ui.InstallerUi;
import com.nokia.mj.impl.installer.utils.InstallerException;
import com.nokia.mj.impl.installer.utils.Log;
+import com.nokia.mj.impl.installer.utils.PropertyListener;
+import com.nokia.mj.impl.installer.utils.PropertyProvider;
/**
* Sends installation and uninstallation progress notifications
@@ -28,24 +31,26 @@
public final class SifNotifier
{
/** Install operation. */
- public static final int OP_INSTALL = 1;
+ public static final int OP_INSTALL = 1; // TSifOperationPhase::EInstalling
/** Uninstall operation. */
- public static final int OP_UNINSTALL = 2;
+ public static final int OP_UNINSTALL = 2; // TSifOperationPhase::EUninstalling
/** Update operation. */
- public static final int OP_UPDATE = 3;
+ public static final int OP_UPDATE = 3; // TSifOperationPhase::EUpgrading
- /** Indicates installaion or uninstallation without
+ /** Indicates installation or uninstallation without
specific suboperation. */
- public static final int SUB_OP_NO = 1;
+ public static final int SUB_OP_NO = 1; // TSifOperationSubPhase::ENoSubPhase
/** OCSP phase during installation. */
- public static final int SUB_OP_OCSP = 2;
+ public static final int SUB_OP_OCSP = 2; // TSifOperationSubPhase::EOCSPCheck
/** Download phase during installation. */
- public static final int SUB_OP_DOWNLOAD = 3;
+ public static final int SUB_OP_DOWNLOAD = 3; // TSifOperationSubPhase::EDownload
/** Maximum progress notification value. */
private static final int MAX_PROGRESS = 100;
/** Operation being notified. */
private int iOperation = 0;
+ /** Suboperation during installation. */
+ private int iSubOperation = 0;
/** Global component id for the application. */
private String iGlobalComponentId = null;
/** Component name (i.e. suite name). */
@@ -64,11 +69,26 @@
/** Sending progress notifications is only allowed between start
* and end notifications. */
private boolean iNotifyProgressAllowed = false;
- /** Value of the last progress notification that has been sent. */
+ /**
+ * Value of the last progress notification that has been sent with
+ * SUB_OP_NO suboperation.
+ */
private int iLastProgressSent = 0;
+ /** Current value of the last progress notification that has been sent. */
+ private int iCurrentValue = 0;
+ /** total value of the last progress notification that has been sent. */
+ private int iTotalValue = 0;
- /** Native object handle. */
+ /** Native notifier object handle. */
private int iHandle = 0;
+ /** Native indicator object handle. */
+ private int iIndicatorHandle = 0;
+ /** InstallerUi handle. */
+ private InstallerUi iInstallerUi = null;
+ /** Provider for indicator status events. */
+ private PropertyProvider iIndicatorStatusProvider = null;
+ /** Indicator state. */
+ private int iIndicatorState = -1;
/*** ----------------------------- PUBLIC ------------------------------ */
@@ -81,6 +101,164 @@
}
/**
+ * Set InstallerUi used when handling indicator.
+ */
+ public void setInstallerUi(InstallerUi aInstallerUi)
+ {
+ iInstallerUi = aInstallerUi;
+ }
+
+ /**
+ * Activates and updates indicator which displays installation
+ * progress to user while installer UI is hidden. The notifyStart
+ * and notifyProgress methods must be called at least once before
+ * calling this method.
+ */
+ public void activateIndicator()
+ {
+ if (iInstallerUi == null)
+ {
+ return;
+ }
+
+ if (iIndicatorHandle == 0)
+ {
+ int ret = _initIndicator();
+ if (ret < 0)
+ {
+ Log.logError(
+ "Initializing SifNotifier indicator failed with code " +
+ ret);
+ }
+ else
+ {
+ Log.log("SifNotifier indicator created");
+ }
+ iIndicatorHandle = ret;
+ }
+
+ if (iIndicatorHandle == 0)
+ {
+ return;
+ }
+
+ int phase = 0;
+ switch (iSubOperation)
+ {
+ case SUB_OP_OCSP: phase = 2; break; // TInstallingPhase::ECheckingCerts
+ case SUB_OP_DOWNLOAD: phase = 1; break; // TInstallingPhase::EDownloading
+ default: phase = 0; // TInstallingPhase::EInstalling
+ }
+ int progress = (iTotalValue == 0? 0: iCurrentValue*100/iTotalValue);
+ updateIndicator(iComponentName, phase, progress);
+
+ if (iIndicatorStatusProvider == null)
+ {
+ // Create PropertyListener which listens indicator status events
+ // and unhides UI when necessary.
+ final int indicatorCategory = 0x20022FC5; // sifuiinstallindicatorplugin
+ final int indicatorKey = 0x2002E690; // /SifUiInstallIndicator/Status
+ iIndicatorStatusProvider = new PropertyProvider();
+ iIndicatorStatusProvider.subscribe(
+ indicatorCategory, indicatorKey, new PropertyListener()
+ {
+ public void valueChanged(int aCategory, int aKey, int aValue)
+ {
+ Log.log("SifNotifier indicator status " + aValue +
+ " (category=" + aCategory + ", key=" + aKey + ")");
+ iIndicatorState = aValue;
+ if (iIndicatorState == 0)
+ {
+ // Indicator has been closed, unhide the UI.
+ iInstallerUi.hide(false);
+ }
+ }
+ });
+ Log.log("SifNotifier indicator status provider subscribed");
+ }
+ }
+
+ /**
+ * Updates indicator which displays installation progress to user
+ * while installer UI is hidden. The activateindicator method must
+ * be called before calling this method.
+ */
+ public void updateIndicator(String aName, int aPhase, int aProgress)
+ {
+ if (iInstallerUi == null || iIndicatorHandle == 0)
+ {
+ return;
+ }
+
+ final String name = aName;
+ final int phase = aPhase;
+ final int progress = aProgress;
+ iInstallerUi.syncExec(new Runnable()
+ {
+ // Indicator must be updated from UI thread.
+ public void run()
+ {
+ int ret = _updateIndicator(
+ iIndicatorHandle, name, phase, progress);
+ if (ret < 0)
+ {
+ Log.logError(
+ "Updating SifNotifier indicator failed with code " +
+ ret);
+ }
+ else
+ {
+ Log.log("SifNotifier indicator updated: " + name +
+ ", " + phase + ", " + progress + "%");
+ }
+ }
+ });
+ }
+
+ /**
+ * Deactivates indicator which displays installation
+ * progress to user while installer UI is hidden.
+ */
+ public void deactivateIndicator()
+ {
+ if (iIndicatorStatusProvider != null)
+ {
+ iIndicatorStatusProvider.unsubscribe();
+ iIndicatorStatusProvider = null;
+ Log.log("SifNotifier indicator status provider unsubscribed");
+ }
+
+ if (iInstallerUi == null)
+ {
+ return;
+ }
+
+ iInstallerUi.syncExec(new Runnable()
+ {
+ // Indicator must be deactivated from UI thread.
+ public void run()
+ {
+ if (iIndicatorHandle == 0)
+ {
+ return;
+ }
+ int ret = _destroyIndicator(iIndicatorHandle, iIndicatorState);
+ if (ret < 0)
+ {
+ Log.logError(
+ "Destroying SifNotifier indicator failed with code " +
+ ret);
+ }
+ else
+ {
+ Log.log("SifNotifier indicator destroyed");
+ }
+ iIndicatorHandle = 0;
+ }
+ });
+ }
+
+ /**
* Returns true if SIF progress notifications are enabled, false otherwise.
*/
public static boolean enabled()
@@ -107,19 +285,15 @@
iIconDir = aIconDir;
iComponentIcon = aComponentIcon;
- if (iHandle == 0)
- {
- InstallerException.internalError(
- "SifNotifier.notifyStart: notifier has not been initialized");
- }
+ checkHandle();
int ret = _notifyStart(
- iHandle, aGlobalComponentId, aComponentName,
+ iHandle, aOperation, aGlobalComponentId, aComponentName,
aApplicationNames, aApplicationIcons,
aComponentSize, aIconDir, aComponentIcon);
if (ret < 0)
{
- Log.logError("Notifying SIF start failed with code " + ret +
- ", " + getInfoString());
+ Log.log("Notifying SIF start failed with code " + ret +
+ ", " + getInfoString());
InstallerException.internalError(
"Notifying SIF start failed with code " + ret);
}
@@ -138,11 +312,7 @@
public void notifyEnd(
int aErrCategory, int aErrCode, String aErrMsg, String aErrMsgDetails)
{
- if (iHandle == 0)
- {
- InstallerException.internalError(
- "SifNotifier.notifyEnd: notifier has not been initialized");
- }
+ checkHandle();
if (aErrCategory == 0 && iLastProgressSent < MAX_PROGRESS)
{
// Before sending end notification, update progress to max if
@@ -162,8 +332,8 @@
", ErrMsgDetails: " + aErrMsgDetails;
if (ret < 0)
{
- Log.logError("Notifying SIF end failed with code " + ret +
- ", " + getInfoString() + ", " + logMsg);
+ Log.log("Notifying SIF end failed with code " + ret +
+ ", " + getInfoString() + ", " + logMsg);
InstallerException.internalError(
"Notifying SIF end failed with code " + ret);
}
@@ -184,11 +354,17 @@
{
return;
}
- if (iHandle == 0)
+
+ iSubOperation = aSubOperation;
+ iCurrentValue = aCurrent;
+ iTotalValue = aTotal;
+ if (iIndicatorHandle != 0)
{
- InstallerException.internalError(
- "SifNotifier.notifyProgress: notifier has not been initialized");
+ // Call activateIndicator so that indicator gets updated.
+ activateIndicator();
}
+
+ checkHandle();
if (aSubOperation == SUB_OP_NO)
{
iLastProgressSent = aCurrent;
@@ -202,8 +378,8 @@
", Total: " + aTotal;
if (ret < 0)
{
- Log.logError("Notifying SIF progress failed with code " + ret +
- ", " + getInfoString() + ", " + logMsg);
+ Log.log("Notifying SIF progress failed with code " + ret +
+ ", " + getInfoString() + ", " + logMsg);
InstallerException.internalError(
"Notifying SIF progress failed with code " + ret);
}
@@ -221,11 +397,8 @@
*/
public void destroy()
{
- if (iHandle == 0)
- {
- InstallerException.internalError(
- "SifNotifier.destroy: notifier has not been initialized");
- }
+ deactivateIndicator();
+ checkHandle();
int ret = _destroy(iHandle);
if (ret < 0)
{
@@ -265,6 +438,19 @@
/*** ----------------------------- PRIVATE ---------------------------- */
/**
+ * Checks if notifier instance has been initialized.
+ * @throws InstallerException if notifier has not been initialized
+ */
+ private void checkHandle()
+ {
+ if (iHandle == 0)
+ {
+ InstallerException.internalError(
+ "SifNotifier.destroy: notifier has not been initialized");
+ }
+ }
+
+ /**
* Returns notification info string used in logging.
*/
private String getInfoString()
@@ -312,6 +498,7 @@
* Notifies SIF about installation/uinstallation start.
*
* @param aHandle
+ * @param aOperation
* @param aGlobalComponentId
* @param aComponentName
* @param aApplicationNames
@@ -323,9 +510,10 @@
* otherwise 0
*/
private static native int _notifyStart(
- int aHandle, String aGlobalComponentId, String aComponentName,
- String[] aApplicationNames, String[] aApplicationIcons,
- int aComponentSize, String aIconDir, String aComponentIcon);
+ int aHandle, int aOperation, String aGlobalComponentId,
+ String aComponentName, String[] aApplicationNames,
+ String[] aApplicationIcons, int aComponentSize,
+ String aIconDir, String aComponentIcon);
/**
* Notifies SIF about installation/uinstallation completion.
@@ -365,7 +553,7 @@
* other methods are called.
*
* @return Symbian error code (negative number) if operation fails,
- * otherwise handle to the natie side object
+ * otherwise handle to the native side object
*/
private static native int _init();
@@ -379,4 +567,35 @@
*/
private static native int _destroy(int aHandle);
+ /**
+ * Initializes SifNotifier indicator.
+ *
+ * @return Symbian error code (negative number) if operation fails,
+ * otherwise handle to the native side object
+ */
+ private static native int _initIndicator();
+
+ /**
+ * Updates SifNotifier indicator.
+ *
+ * @param aHandle handle to indicator object
+ * @param aName application name
+ * @param aPhase operation phase
+ * @param aProgress progress in percentage
+ * @return Symbian error code (negative number) if operation fails,
+ * otherwise handle to the native side object
+ */
+ private static native int _updateIndicator(
+ int aHandle, String aName, int aPhase, int aProgress);
+
+ /**
+ * Destroys SifNotifier indicator.
+ *
+ * @param aHandle handle to indicator object
+ * @param aState indicator state
+ * @return Symbian error code (negative number) if operation fails,
+ * otherwise 0
+ */
+ private static native int _destroyIndicator(int aHandle, int aState);
+
}
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/InstallationNotifier.java Thu Sep 02 13:22:59 2010 +0300
@@ -47,7 +47,7 @@
// Maximum number of progress updates to SysUtil.setProperty().
private static final int MAX_PROPERTY_PROGRESS_UPDATES = 5;
// Maximum number of progress updates to SIF.
- private static final int MAX_SIF_PROGRESS_UPDATES = 5;
+ private static final int MAX_SIF_PROGRESS_UPDATES = 8;
// Maximum number of progress updates to UI.
private static final int MAX_UI_PROGRESS_UPDATES = 20;
@@ -132,18 +132,6 @@
public void ended()
{
Log.log("InstallationNotifier.ended");
- if (iInstallerUi != null)
- {
- try
- {
- iInstallerUi.ended();
- }
- catch (Throwable t)
- {
- Log.logError(
- "InstallationNotifier: InstallerUi.ended threw exception", t);
- }
- }
if (iSifNotifier != null)
{
// After this SifNotifier is no longer used, destroy it.
@@ -157,6 +145,18 @@
Log.logError("InstallationNotifier: SifNotifier.destroy failed", t);
}
}
+ if (iInstallerUi != null)
+ {
+ try
+ {
+ iInstallerUi.ended();
+ }
+ catch (Throwable t)
+ {
+ Log.logError(
+ "InstallationNotifier: InstallerUi.ended threw exception", t);
+ }
+ }
}
/**
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/Installer.java Thu Sep 02 13:22:59 2010 +0300
@@ -589,6 +589,8 @@
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
ConfirmPermissions()); // Show UI confirmation dialog.
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
+ AddSecurityData());
+ table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
HandleCustomAttributes());
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
CheckJarPackages());
@@ -596,8 +598,6 @@
StopApplication());
// Update new application info in the following steps.
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
- AddSecurityData());
- table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
AddToStorage());
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
RegisterPush());
@@ -607,12 +607,13 @@
RegisterApplicationToSif());
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
CopyAppFiles());
- if (Platform.isS60()) // PrepareSplashScreen uses eSWT which is
+ if (Platform.isS60())
{
- // not available in Linux.
+ // PrepareSplashScreen uses eSWT which is not available in Linux.
+ // Create splash screen images after app dir exists,
+ // that is after CopyAppFiles step.
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
- PrepareSplashScreen()); // Create splash screen images
- // after app dir exists (after CopyAppFiles step).
+ PrepareSplashScreen());
}
table.add(new com.nokia.mj.impl.installer.midp2.install.steps.
NotifyJsrPlugins());
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/applicationregistrator/AppRegInfo.java Thu Sep 02 13:22:59 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -77,41 +77,6 @@
* When this object is used for registering applications, all
* params must be valid. When used for unregistering applications,
* only aUid is really needed.
- * Use default values for optional information.
- *
- * @param aUid Java application Uid (MIDlet Uid).
- * @param aGroupName The value of Nokia-MIDlet-Category attribute or empty.
- * Note that in Symbian only 16 first characters are stored to
- * application registry.
- * @param aMIDletName MIDlet name from MIDlet- attribute.
- * @param aTargetDrive The installation drive, e.g. "C:" in S60
- * @param aIconFileName The full path name to the icon file in file system.
- * The file must be accessible and the path must have \\ chars.
- * @param aJarFileName Full path name to jar file.
- * @see ApplicationRegistrator
- */
- public AppRegInfo(
- Uid aUid,
- String aGroupName,
- String aMIDletName,
- String aTargetDrive,
- String aIconFileName,
- String aJarFileName)
- {
- iUid = aUid;
- iGroupName = aGroupName;
- iMIDletName = aMIDletName;
- iTargetDrive = aTargetDrive;
- iIconFileName = aIconFileName;
- iJarFileName = aJarFileName;
- }
-
-
- /**
- * Construct new AppRegInfo object.
- * When this object is used for registering applications, all
- * params must be valid. When used for unregistering applications,
- * only aUid is really needed.
* Specify all information.
*
* @param aUid Java application Uid (MIDlet Uid).
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/jsrpluginnotifier/InstallerExtensionInfo.java Thu Sep 02 13:22:59 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -18,38 +18,54 @@
package com.nokia.mj.impl.installer.jsrpluginnotifier;
+import com.nokia.mj.impl.storage.StorageSession;
import com.nokia.mj.impl.utils.Logger;
import com.nokia.mj.impl.utils.Uid;
import java.util.Hashtable;
/**
* Information passed to JSR plugins when installing or uninstalling
- * Java applications
+ * Java applications.
* @see JsrPluginNotifier
*/
public final class InstallerExtensionInfo
{
/**
- * MIDlet Suite Uid. Can be null.
+ * MIDlet Suite Uid.
*/
- public Uid iUid;
+ public Uid iUid = null;
+
+ /**
+ * Application Uids.
+ */
+ public Uid[] iAppUids = null;
/**
- * true if upgrade installation
+ * Application suite root directory path.
*/
- public boolean iUpgrade;
+ public String iRootPath = null;
/**
- * true if silent installation
+ * True if upgrade installation.
*/
- public boolean iSilent;
+ public boolean iUpgrade = false;
/**
- * Combined jad./.jar attributes.
+ * True if silent installation.
+ */
+ public boolean iSilent = false;
+
+ /**
+ * Combined jad/jar attributes.
* Key is attribute name, value is com.nokia.mj.impl.utils.Attribute object
* Can be null.
*/
- public Hashtable iAttributes;
+ public Hashtable iAttributes = null;
+
+ /**
+ * JavaStorage session where installation/uninstallation changes are made.
+ */
+ public StorageSession iStorageSession = null;
/*** ----------------------------- PUBLIC ------------------------------ */
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/CheckDiskSpace.java Thu Sep 02 13:22:59 2010 +0300
@@ -42,15 +42,8 @@
public void execute(ExeBall aBall)
{
InstallBall ball = (InstallBall)aBall;
-
int initialSize = ball.iSuite.calculateInitialSize();
- if (initialSize == 0 && ball.iJarFilename != null)
- {
- // Get initialSize from jar file size.
- initialSize = (int)FileUtils.getSize(ball.iJarFilename);
-
- }
- int requiredSize = initialSize + (100 * 1024); // +100kB
+ int requiredSize = getRequiredSize(ball);
if (ball.iUserConfirmation == null)
{
@@ -103,6 +96,25 @@
}
/**
+ * Returns amount of disk space this application requires.
+ */
+ static int getRequiredSize(InstallBall aBall)
+ {
+ int initialSize = aBall.iSuite.getInitialSize();
+ if (initialSize <= 0)
+ {
+ initialSize = aBall.iSuite.calculateInitialSize();
+ }
+ if (initialSize == 0 && aBall.iJarFilename != null)
+ {
+ // Get initialSize from jar file size.
+ initialSize = (int)FileUtils.getSize(aBall.iJarFilename);
+
+ }
+ return initialSize + (100 * 1024); // +100kB
+ }
+
+ /**
* Checks if given drive has enough free disk space. Throws
* InstallerException if there is not enough free disk space.
*/
@@ -139,9 +151,9 @@
int driveId = drive.getNumber();
if (SysUtil.isDiskSpaceBelowCriticalLevel(aSizeInBytes, driveId))
{
- Log.logWarning("Drive " + driveId +
- " space below critical level, required space " +
- aSizeInBytes + " bytes");
+ Log.log("Drive " + driveId +
+ " space below critical level, required space " +
+ aSizeInBytes + " bytes");
}
else
{
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/ConfirmInstallation.java Thu Sep 02 13:22:59 2010 +0300
@@ -126,6 +126,7 @@
installInfo.setDriveId(ball.iInstallationDrive);
Vector drives = new Vector();
SysUtil.getUserVisibleDrives(drives);
+ removeFullDrives(ball, drives);
int[] driveIds = new int[drives.size()];
int[] driveTypes = new int[drives.size()];
long[] driveFreeSpaces = new long[drives.size()];
@@ -385,4 +386,34 @@
}
return size;
}
+
+ /**
+ * Removes drives which do not have enough free space for the
+ * application from the aDrives vector.
+ */
+ private void removeFullDrives(InstallBall aBall, Vector aDrives)
+ {
+ int requiredSize = CheckDiskSpace.getRequiredSize(aBall);
+ for (int i = 0; i < aDrives.size(); i++)
+ {
+ DriveInfo drive = (DriveInfo)aDrives.elementAt(i);
+ int driveId = drive.getNumber();
+ if (SysUtil.isDiskSpaceBelowCriticalLevel(requiredSize, driveId))
+ {
+ Log.logWarning("Drive " + FileUtils.getDriveName(driveId) +
+ " (" + driveId + ") does not have enough " +
+ " free space, required space " + requiredSize +
+ " bytes");
+ aDrives.removeElementAt(i);
+ i--; // Decrease index because drive was removed from Vector.
+ }
+ }
+ if (aDrives.size() == 0)
+ {
+ // None of the available drives has enough space,
+ // throw an exception.
+ throw InstallerException.getOutOfDiskSpaceException(
+ requiredSize, null);
+ }
+ }
}
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/InstallBall.java Thu Sep 02 13:22:59 2010 +0300
@@ -233,6 +233,31 @@
}
/**
+ * Called when InstallerUi is hidden or unhidden.
+ *
+ * @param aHidden true if UI was hidden, false if UI was unhidden.
+ */
+ public void uiIsHidden(boolean aHidden)
+ {
+ log("InstallBall.uiIsHidden " + aHidden);
+ if (iSifNotifier == null)
+ {
+ Log.logWarning("InstallBall.uiIsHidden(" + aHidden +
+ ") called when SifNotifier does not exist");
+ return;
+ }
+ iSifNotifier.setInstallerUi(getInstallerUi());
+ if (aHidden)
+ {
+ iSifNotifier.activateIndicator();
+ }
+ else
+ {
+ iSifNotifier.deactivateIndicator();
+ }
+ }
+
+ /**
* Called when user cancels the execution from the InstallerUi.
* This method must return quickly.
*/
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/install/steps/NotifyJsrPlugins.java Thu Sep 02 13:22:59 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -34,17 +34,11 @@
{
InstallBall ball = (InstallBall)aBall;
- // If any Jsr plugins, notify plugins
+ // If any Jsr plugins, notify plugins.
if (ball.iJsrPluginNotifier.anyJsrPlugins())
{
- // Create info object to be passed to plugins
- InstallerExtensionInfo info = new InstallerExtensionInfo();
- info.iUid = ball.iSuite.getUid();
- info.iUpgrade = (ball.iOldSuite != null);
- info.iSilent = ball.isSilent();
- info.iAttributes = ball.iCombinedAttributes;
-
- ball.iJsrPluginNotifier.notifyInstallation(info);
+ ball.iJsrPluginNotifier.notifyInstallation(
+ createInstallerExtensionInfo(ball));
}
}
@@ -52,26 +46,31 @@
{
InstallBall ball = (InstallBall)aBall;
- // Notify possible plugins that installation can been cancelled
+ // Notify possible plugins that installation has been cancelled.
if (ball.iJsrPluginNotifier.anyJsrPlugins())
{
- // Create info object to be passed to plugins
- InstallerExtensionInfo info = new InstallerExtensionInfo();
- // Beware, it is possible that aBall has not been fully
- // initialized
- if (null == ball.iSuite)
- {
- info.iUid = null;
- }
- else
- {
- info.iUid = ball.iSuite.getUid();
- }
- info.iUpgrade = (ball.iOldSuite != null);
- info.iSilent = ball.isSilent();
- info.iAttributes = ball.iCombinedAttributes;
-
- ball.iJsrPluginNotifier.notifyRollbackInstall(info);
+ ball.iJsrPluginNotifier.notifyRollbackInstall(
+ createInstallerExtensionInfo(ball));
}
}
+
+ private InstallerExtensionInfo createInstallerExtensionInfo(InstallBall aBall)
+ {
+ InstallerExtensionInfo info = new InstallerExtensionInfo();
+ // Beware, it is possible that aBall has not been fully initialized.
+ if (aBall.iSuite != null)
+ {
+ info.iUid = aBall.iSuite.getUid();
+ info.iAppUids = aBall.iSuite.getApplicationUids();
+ info.iRootPath = aBall.iSuite.getRootDir();
+ }
+ info.iUpgrade = (aBall.iOldSuite != null);
+ info.iSilent = aBall.isSilent();
+ info.iAttributes = aBall.iCombinedAttributes;
+ if (aBall.iStorageHandler != null)
+ {
+ info.iStorageSession = aBall.iStorageHandler.getSession();
+ }
+ return info;
+ }
}
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java
--- a/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/javasrc/com/nokia/mj/impl/installer/midp2/uninstall/steps/NotifyJsrPlugins.java Thu Sep 02 13:22:59 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -34,17 +34,11 @@
{
UninstallBall ball = (UninstallBall)aBall;
- // If any Jsr plugins, notify plugins
+ // If any Jsr plugins, notify plugins.
if (ball.iJsrPluginNotifier.anyJsrPlugins())
{
- // Create info object to be passed to plugins
- InstallerExtensionInfo info = new InstallerExtensionInfo();
- info.iUid = ball.iSuite.getUid();
- info.iUpgrade = false;
- info.iSilent = ball.isSilent();
- info.iAttributes = ball.iSuite.getAttributes();
-
- ball.iJsrPluginNotifier.notifyUninstallation(info);
+ ball.iJsrPluginNotifier.notifyUninstallation(
+ createInstallerExtensionInfo(ball));
}
}
@@ -52,27 +46,31 @@
{
UninstallBall ball = (UninstallBall)aBall;
- // Notify possible plugins that uninstallation can been cancelled
+ // Notify possible plugins that uninstallation has been cancelled.
if (ball.iJsrPluginNotifier.anyJsrPlugins())
{
- // Create info object to be passed to plugins
- InstallerExtensionInfo info = new InstallerExtensionInfo();
- // Beware, it is possible that aBall has not been fully
- // initialized
- if (null == ball.iSuite)
- {
- info.iUid = null;
- info.iAttributes = null;
- }
- else
- {
- info.iUid = ball.iSuite.getUid();
- info.iAttributes = ball.iSuite.getAttributes();
- }
- info.iUpgrade = false;
- info.iSilent = ball.isSilent();
-
- ball.iJsrPluginNotifier.notifyRollbackUninstall(info);
+ ball.iJsrPluginNotifier.notifyRollbackUninstall(
+ createInstallerExtensionInfo(ball));
}
}
+
+ private InstallerExtensionInfo createInstallerExtensionInfo(UninstallBall aBall)
+ {
+ InstallerExtensionInfo info = new InstallerExtensionInfo();
+ // Beware, it is possible that aBall has not been fully initialized.
+ if (aBall.iSuite != null)
+ {
+ info.iUid = aBall.iSuite.getUid();
+ info.iAppUids = aBall.iSuite.getApplicationUids();
+ info.iAttributes = aBall.iSuite.getAttributes();
+ info.iRootPath = aBall.iSuite.getRootDir();
+ }
+ info.iUpgrade = false;
+ info.iSilent = aBall.isSilent();
+ if (aBall.iStorageHandler != null)
+ {
+ info.iStorageSession = aBall.iStorageHandler.getSession();
+ }
+ return info;
+ }
}
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifnotifier.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -23,6 +23,9 @@
#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+#include
+#include
+#include
#include
#include
@@ -51,7 +54,7 @@
* This method makes calls that may leave (the actual notifying).
*/
void NotifyStartL(
- JNIEnv *aEnv, CPublishSifOperationInfo *aNotifier,
+ JNIEnv *aEnv, CPublishSifOperationInfo *aNotifier, jint aOperation,
jstring aGlobalComponentId, jstring aComponentName,
jobjectArray aApplicationNames, jobjectArray aApplicationIcons,
jint aComponentSize, jstring aIconDir, jstring /*aComponentIcon*/)
@@ -106,7 +109,8 @@
CSifOperationStartData::NewLC(
*globalComponentId, *componentName, applicationNames, applicationIcons,
aComponentSize, /*aIconPath=*/ (NULL != aIconDir? *iconDir: KNullDesC()),
- /*aComponentIcon=*/ KNullDesC(), Usif::KSoftwareTypeJava);
+ /*aComponentIcon=*/ KNullDesC(), Usif::KSoftwareTypeJava,
+ (TSifOperationPhase)aOperation);
aNotifier->PublishStartL(*startData);
@@ -130,16 +134,17 @@
* Signature: (IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;I)I
*/
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyStart
-(JNIEnv *aEnv, jclass, jint aHandle, jstring aGlobalComponentId,
- jstring aComponentName, jobjectArray aApplicationNames,
- jobjectArray aApplicationIcons, jint aComponentSize,
- jstring aIconDir, jstring aComponentIcon)
+(JNIEnv *aEnv, jclass, jint aHandle, jint aOperation,
+ jstring aGlobalComponentId, jstring aComponentName,
+ jobjectArray aApplicationNames, jobjectArray aApplicationIcons,
+ jint aComponentSize, jstring aIconDir, jstring aComponentIcon)
{
CPublishSifOperationInfo *pNotifier =
reinterpret_cast(aHandle<<2);
- TRAPD(err, NotifyStartL(aEnv, pNotifier, aGlobalComponentId, aComponentName,
- aApplicationNames, aApplicationIcons,
- aComponentSize, aIconDir, aComponentIcon));
+ TRAPD(err, NotifyStartL(aEnv, pNotifier, aOperation, aGlobalComponentId,
+ aComponentName, aApplicationNames,
+ aApplicationIcons, aComponentSize,
+ aIconDir, aComponentIcon));
return err;
}
@@ -297,6 +302,103 @@
return KErrNone;
}
+/*
+ * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier
+ * Method: _initIndicator
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1initIndicator
+(JNIEnv *, jclass)
+{
+ CHbIndicatorSymbian *pIndicator = NULL;
+ TRAPD(err, pIndicator = CHbIndicatorSymbian::NewL());
+ if (KErrNone != err)
+ {
+ ELOG1(EJavaInstaller,
+ "SifNotifier.initIndicator: Creating indicator failed, error %d",
+ err);
+ return err;
+ }
+ // Return handle to the object. Utilize the fact that in Symbian
+ // all pointer addresses are MOD 4 so the last 2 bits are 0
+ // and can be shifted out. This way the returned handle is
+ // always positive whereas Symbian error codes are always negative.
+ return reinterpret_cast(pIndicator)>>2;
+}
+
+/**
+ * See JNI method __1updateIndicator.
+ * This method makes calls that may leave (the actual notifying).
+ */
+void UpdateIndicatorL(
+ JNIEnv *aEnv, CHbIndicatorSymbian *pIndicator, jstring aName, jint aPhase, jint aProgress)
+{
+ HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
+
+ CHbSymbianVariantMap *variantMap = CHbSymbianVariantMap::NewL();
+ CleanupStack::PushL(variantMap);
+ CHbSymbianVariant *variantName = CHbSymbianVariant::NewL(name, CHbSymbianVariant::EDes);
+ variantMap->Add(KSifUiInstallIndicatorAppName, variantName);
+ CHbSymbianVariant *variantPhase = CHbSymbianVariant::NewL(&aPhase, CHbSymbianVariant::EInt);
+ variantMap->Add(KSifUiInstallIndicatorPhase, variantPhase);
+ CHbSymbianVariant *variantProgress = CHbSymbianVariant::NewL(&aProgress, CHbSymbianVariant::EInt);
+ variantMap->Add(KSifUiInstallIndicatorProgress, variantProgress);
+
+ CHbSymbianVariant *variant = CHbSymbianVariant::NewL(variantMap, CHbSymbianVariant::EVariantMap);
+ CleanupStack::PushL(variant);
+
+ TInt err = KErrNone;
+ if (!pIndicator->Activate(KSifUiInstallIndicatorType, variant))
+ {
+ err = pIndicator->Error();
+ ELOG1(EJavaInstaller,
+ "SifNotifier.updateIndicator: activating indicator failed, error %d",
+ err);
+ err = KErrGeneral;
+ }
+
+ CleanupStack::PopAndDestroy(variant);
+ CleanupStack::PopAndDestroy(variantMap);
+ CleanupStack::PopAndDestroy(name);
+}
+
+/*
+ * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier
+ * Method: _updateIndicator
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1updateIndicator
+(JNIEnv *aEnv, jclass, jint aHandle, jstring aName, jint aPhase, jint aProgress)
+{
+ CHbIndicatorSymbian *pIndicator =
+ reinterpret_cast(aHandle<<2);
+ TRAPD(err, UpdateIndicatorL(aEnv, pIndicator, aName, aPhase, aProgress));
+ return err;
+}
+
+/*
+ * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier
+ * Method: _destroyIndicator
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1destroyIndicator
+(JNIEnv *, jclass, jint aHandle, jint aState)
+{
+ CHbIndicatorSymbian *pIndicator =
+ reinterpret_cast(aHandle<<2);
+ TInt err = KErrNone;
+ if (aState && !pIndicator->Deactivate(KSifUiInstallIndicatorType))
+ {
+ err = pIndicator->Error();
+ ELOG1(EJavaInstaller,
+ "SifNotifier.destroyIndicator: Deactivating indicator failed, error %d",
+ err);
+ err = KErrGeneral;
+ }
+ delete pIndicator;
+ return err;
+}
+
#else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
/*
@@ -316,7 +418,7 @@
* Signature: (IILjava/lang/String;Ljava/lang/String;[Ljava/lang/String;I)I
*/
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1notifyStart
-(JNIEnv *, jclass, jint, jstring, jstring, jobjectArray, jobjectArray, jint, jstring, jstring)
+(JNIEnv *, jclass, jint, jint, jstring, jstring, jobjectArray, jobjectArray, jint, jstring, jstring)
{
LOG(EJavaInstaller, EInfo, "SifNotifier.notifyStart");
return KErrNone;
@@ -381,4 +483,40 @@
return KErrNone;
}
+/*
+ * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier
+ * Method: _initIndicator
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1initIndicator
+(JNIEnv *, jclass)
+{
+ LOG(EJavaInstaller, EInfo, "SifNotifier.initIndicator");
+ return 1; // return dummy object handle
+}
+
+/*
+ * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier
+ * Method: _updateIndicator
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1updateIndicator
+(JNIEnv *, jclass, jint, jstring, jint, jint)
+{
+ LOG(EJavaInstaller, EInfo, "SifNotifier.updateIndicator");
+ return KErrNone;
+}
+
+/*
+ * Class: com_nokia_mj_impl_installer_applicationregistrator_SifNotifier
+ * Method: _destroyIndicator
+ * Signature: (II)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifNotifier__1destroyIndicator
+(JNIEnv *, jclass, jint, jint)
+{
+ LOG(EJavaInstaller, EInfo, "SifNotifier.destroyIndicator");
+ return KErrNone;
+}
+
#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp
--- a/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/src.s60/applicationregistrator/sifregistrator.cpp Thu Sep 02 13:22:59 2010 +0300
@@ -24,6 +24,7 @@
#include
#include "com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator.h"
+#include "com_nokia_mj_impl_utils_InstallerErrorMessage.h"
#include "javacommonutils.h"
#include "javasymbianoslayer.h" // for CleanupResetAndDestroyPushL
#include "logger.h"
@@ -33,19 +34,15 @@
#include
#include
-#ifdef RD_JAVA_USIF_APP_REG
#include
-#endif // RD_JAVA_USIF_APP_REG
+#include
#include
// Helper macro for logging a TDesC.
#define LOG_TDESC_L(compIdParam, logLevelParam, msgParam, tdescParam) \
- { \
- HBufC8* tdescBuf = HBufC8::NewLC(tdescParam.Length() + 1); \
- TPtr8 tdescPtr(tdescBuf->Des()); \
- tdescPtr.Append(tdescParam); \
- LOG1(compIdParam, logLevelParam, msgParam, tdescPtr.PtrZ());\
- CleanupStack::PopAndDestroy(tdescBuf); \
+ { \
+ std::wstring ws((wchar_t*)tdescParam.Ptr(), tdescParam.Length()); \
+ LOG1(compIdParam, logLevelParam, msgParam, ws.c_str()); \
}
// NAMESPACE DECLARATION
@@ -55,21 +52,19 @@
IMPORT_C HBufC* CreateHBufCFromJavaStringLC(JNIEnv* aEnv, jstring aString);
// Properties registered to SCR.
-_LIT(KMIDletName, "MIDlet-Name");
_LIT(KUid, "Uid");
_LIT(KMediaId, "Media-Id");
_LIT(KMIDletInfoURL, "MIDlet-Info-URL");
_LIT(KMIDletDescription, "MIDlet-Description");
_LIT(KDownloadURL, "Download-URL");
+_LIT(KUpdateURL, "Update-URL");
_LIT(KSettingsPlugin, "SettingsName");
_LIT(KSettingsPluginValue, "javaapplicationsettingsview");
-#ifdef RD_JAVA_USIF_APP_REG
// Symbian file path separator.
_LIT(KPathSeperator, "\\");
// Postfix for the fake application name generated for AppArc.
_LIT(KAppPostfix, ".fakeapp");
-#endif // RD_JAVA_USIF_APP_REG
/**
* Internal helper method for checking if specified application
@@ -179,7 +174,6 @@
* See JNI method __1notifyAppChange.
* This method makes calls that may leave (the actual registering).
*/
-#ifdef RD_JAVA_USIF_NOTIFY_APP_ARC
void NotifyAppChangeL(JNIEnv *aEnv, jintArray aAppUids, jint aAppChange)
{
RApaLsSession apaSession;
@@ -212,11 +206,6 @@
CleanupStack::PopAndDestroy(&apaSession);
LOG(EJavaInstaller, EInfo, "NotifyAppChangeL completed");
}
-#else
-void NotifyAppChangeL(JNIEnv *, jintArray, jint)
-{
-}
-#endif // RD_JAVA_USIF_NOTIFY_APP_ARC
/*
* Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
@@ -227,12 +216,6 @@
(JNIEnv *aEnv, jclass, jintArray aAppUids, jint aAppChange)
{
TRAPD(err, NotifyAppChangeL(aEnv, aAppUids, aAppChange));
- if (KErrNone != err)
- {
- ELOG1(EJavaInstaller,
- "notifyAppChange: notifying AppArc failed, error %d",
- err);
- }
return err;
}
@@ -257,14 +240,21 @@
QUrl openRecentView("appto://20022F35?activityname=AppLibRecentView");
XQApplicationManager applicationManager;
XQAiwRequest *request = applicationManager.create(openRecentView);
- if (request) {
+ if (request)
+ {
+ LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib");
bool result = request->send();
- if (!result) {
+ if (!result)
+ {
int error = request->lastError();
ELOG1(EJavaInstaller,
"launchAppView: launching AppLib failed, error %d", error);
err = KErrGeneral;
}
+ else
+ {
+ LOG(EJavaInstaller, EInfo, "launchAppView: launching AppLib succeeded");
+ }
delete request;
}
@@ -354,12 +344,6 @@
TRAPD(err, pScr->RollbackTransactionL());
pScr->Close();
delete pScr;
- if (KErrNone != err)
- {
- ELOG1(EJavaInstaller,
- "rollbackSession: Rolling back transaction failed, error %d",
- err);
- }
return err;
}
@@ -389,9 +373,9 @@
HBufC *valueBuf = CreateHBufCFromJavaStringLC(aEnv, aValue);
aScr->SetComponentPropertyL(aComponentId, aName, *valueBuf);
//LOG_TDESC_L(EJavaInstaller, EInfo,
- // "SetComponentPropertyL: name %s", aName);
+ // "SetComponentPropertyL: name %S", aName);
//LOG_TDESC_L(EJavaInstaller, EInfo,
- // "SetComponentPropertyL: value %s", valueBuf->Des());
+ // "SetComponentPropertyL: value %S", valueBuf->Des());
CleanupStack::PopAndDestroy(valueBuf);
}
}
@@ -402,23 +386,14 @@
*/
TComponentId RegisterComponentL(
JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aUid,
- jstring aSuiteName, jstring aVendor, jstring aVersion,
- jstring aName, jstring aGlobalId,
+ jstring aSuiteName, jstring aVendor, jstring aVersion, jstring aGlobalId,
jobjectArray aComponentFiles, TInt64 aComponentSize,
TBool aIsRemovable, TBool aIsDrmProtected,
TBool aIsOriginVerified, TBool aIsUpdate, jint aMediaId,
- jstring aMidletInfoUrl, jstring aMidletDescription, jstring aDownloadUrl)
+ jstring aMidletInfoUrl, jstring aMidletDescription,
+ jstring aDownloadUrl, jstring aUpdateUrl)
{
- HBufC *name = NULL;
- if (NULL == aName)
- {
- // If name is not specified, use suite name.
- name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName);
- }
- else
- {
- name = CreateHBufCFromJavaStringLC(aEnv, aName);
- }
+ HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aSuiteName);
HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
HBufC *version = CreateHBufCFromJavaStringLC(aEnv, aVersion);
HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId);
@@ -445,14 +420,10 @@
aScr->SetComponentPropertyL(componentId, KSettingsPlugin(), KSettingsPluginValue());
//LOG(EJavaInstaller, EInfo, "RegisterComponentL: Settings plugin property set");
- if (NULL != aName)
- {
- // If name is specified, store suite name as property.
- SetComponentPropertyL(aEnv, aScr, componentId, KMIDletName(), aSuiteName);
- }
SetComponentPropertyL(aEnv, aScr, componentId, KMIDletInfoURL(), aMidletInfoUrl);
SetComponentPropertyL(aEnv, aScr, componentId, KMIDletDescription(), aMidletDescription);
SetComponentPropertyL(aEnv, aScr, componentId, KDownloadURL(), aDownloadUrl);
+ SetComponentPropertyL(aEnv, aScr, componentId, KUpdateURL(), aUpdateUrl);
CleanupStack::PopAndDestroy(globalId);
CleanupStack::PopAndDestroy(version);
@@ -478,21 +449,22 @@
*/
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent
(JNIEnv *aEnv, jclass, jint aSessionHandle, jint aUid, jstring aSuiteName,
- jstring aVendor, jstring aVersion, jstring aName, jstring aGlobalId,
+ jstring aVendor, jstring aVersion, jstring aGlobalId,
jobjectArray aComponentFiles, jlong aComponentSize, jboolean aIsRemovable,
jboolean aIsDrmProtected, jboolean aIsOriginVerified, jboolean aIsUpdate,
jint aMediaId, jstring aMidletInfoUrl, jstring aMidletDescription,
- jstring aDownloadUrl, jobject aComponentId)
+ jstring aDownloadUrl, jstring aUpdateUrl, jobject aComponentId)
{
__UHEAP_MARK;
RSoftwareComponentRegistry *pScr =
reinterpret_cast(aSessionHandle<<2);
TComponentId componentId = -1;
TRAPD(err, componentId = RegisterComponentL(
- aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aName, aGlobalId,
+ aEnv, pScr, aUid, aSuiteName, aVendor, aVersion, aGlobalId,
aComponentFiles, aComponentSize, aIsRemovable,
aIsDrmProtected, aIsOriginVerified, aIsUpdate, aMediaId,
- aMidletInfoUrl, aMidletDescription, aDownloadUrl));
+ aMidletInfoUrl, aMidletDescription,
+ aDownloadUrl, aUpdateUrl));
__UHEAP_MARKEND;
if (KErrNone == err)
{
@@ -515,9 +487,7 @@
RSoftwareComponentRegistry *pScr =
reinterpret_cast(aSessionHandle<<2);
TInt err = KErrNone;
-#ifdef RD_JAVA_USIF_APP_REG
TRAP(err, pScr->DeleteApplicationEntriesL(aComponentId));
-#endif // RD_JAVA_USIF_APP_REG
if (KErrNone == err)
{
TRAP(err, pScr->DeleteComponentL(aComponentId));
@@ -530,7 +500,6 @@
* See JNI method __1registerApplication.
* This method makes calls that may leave.
*/
-#ifdef RD_JAVA_USIF_APP_REG
void RegisterApplicationL(
JNIEnv *aEnv, RSoftwareComponentRegistry *aScr,
jint aComponentId, jint aAppUid,
@@ -598,47 +567,36 @@
RPointerArray captionsArray;
CleanupResetAndDestroyPushL(captionsArray);
TInt langCount = aEnv->GetArrayLength(aLanguages);
- TInt captionCount = aEnv->GetArrayLength(aAppNames);
- if (langCount == captionCount)
+ jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL);
+ for (TInt i = 0; i < langCount; i++)
{
- jint* languages = aEnv->GetIntArrayElements(aLanguages, NULL);
- for (TInt i = 0; i < langCount; i++)
- {
- TLanguage tmpLanguage = (TLanguage)languages[i];
- HBufC *tmpCaption =
- CreateHBufCFromJavaStringLC(
- aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i));
- captionsArray.AppendL(tmpCaption);
- CleanupStack::Pop(tmpCaption);
- //LOG1(EJavaInstaller, EInfo,
- // "RegisterApplicationL: language %d", tmpLanguage);
- //LOG_TDESC_L(EJavaInstaller, EInfo,
- // "RegisterApplicationL: caption %s", tmpCaption->Des());
- CCaptionAndIconInfo *tmpCaptionAndIconInfo =
- CCaptionAndIconInfo::NewLC(
- /*aCaption=*/ *tmpCaption,
- /*aIconFileName=*/ KNullDesC,
- /*aNumOfAppIcons=*/ 0);
- CLocalizableAppInfo *tmpLocAppInfo =
- CLocalizableAppInfo::NewLC(
- /*aShortCaption=*/ KNullDesC,
- /*aApplicationLanguage=*/ tmpLanguage,
- /*aGroupName=*/ KNullDesC,
- /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo,
- /*aViewDataList=*/ viewDataList);
- localizableAppInfoList.AppendL(tmpLocAppInfo);
- CleanupStack::Pop(tmpLocAppInfo);
- CleanupStack::Pop(tmpCaptionAndIconInfo);
- }
- aEnv->ReleaseIntArrayElements(aLanguages, languages, 0);
+ TLanguage tmpLanguage = (TLanguage)languages[i];
+ HBufC *tmpCaption =
+ CreateHBufCFromJavaStringLC(
+ aEnv, (jstring)aEnv->GetObjectArrayElement(aAppNames, i));
+ captionsArray.AppendL(tmpCaption);
+ CleanupStack::Pop(tmpCaption);
+ //LOG1(EJavaInstaller, EInfo,
+ // "RegisterApplicationL: language %d", tmpLanguage);
+ //LOG_TDESC_L(EJavaInstaller, EInfo,
+ // "RegisterApplicationL: caption %S", tmpCaption->Des());
+ CCaptionAndIconInfo *tmpCaptionAndIconInfo =
+ CCaptionAndIconInfo::NewLC(
+ /*aCaption=*/ *tmpCaption,
+ /*aIconFileName=*/ KNullDesC,
+ /*aNumOfAppIcons=*/ 0);
+ CLocalizableAppInfo *tmpLocAppInfo =
+ CLocalizableAppInfo::NewLC(
+ /*aShortCaption=*/ KNullDesC,
+ /*aApplicationLanguage=*/ tmpLanguage,
+ /*aGroupName=*/ KNullDesC,
+ /*aCaptionAndIconInfo=*/ tmpCaptionAndIconInfo,
+ /*aViewDataList=*/ viewDataList);
+ localizableAppInfoList.AppendL(tmpLocAppInfo);
+ CleanupStack::Pop(tmpLocAppInfo);
+ CleanupStack::Pop(tmpCaptionAndIconInfo);
}
- else
- {
- WLOG2(EJavaInstaller,
- "RegisterApplicationL: localisation not made because language " \
- "count does not match to caption count (%d != %d)",
- langCount, captionCount);
- }
+ aEnv->ReleaseIntArrayElements(aLanguages, languages, 0);
// Create application registration data objects.
TApplicationCharacteristics appCharacteristics;
@@ -674,13 +632,6 @@
CleanupStack::PopAndDestroy(caption);
__UHEAP_MARKEND;
}
-#else
-void RegisterApplicationL(
- JNIEnv *, RSoftwareComponentRegistry *, jint, jint, jstring,
- jstring, jstring, jstring, jint, jintArray, jobjectArray)
-{
-}
-#endif // RD_JAVA_USIF_APP_REG
/*
* Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
@@ -710,19 +661,13 @@
JNIEnv *aEnv, RSoftwareComponentRegistry *aScr, jint aComponentId,
jstring aName, jstring aVendor, jint aLanguage)
{
- if (NULL != aName)
- {
- HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
- aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage);
- CleanupStack::PopAndDestroy(name);
- }
+ HBufC *name = CreateHBufCFromJavaStringLC(aEnv, aName);
+ aScr->SetComponentNameL(aComponentId, *name, (TLanguage)aLanguage);
+ CleanupStack::PopAndDestroy(name);
- if (NULL != aVendor)
- {
- HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
- aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage);
- CleanupStack::PopAndDestroy(vendor);
- }
+ HBufC *vendor = CreateHBufCFromJavaStringLC(aEnv, aVendor);
+ aScr->SetVendorNameL(aComponentId, *vendor, (TLanguage)aLanguage);
+ CleanupStack::PopAndDestroy(vendor);
}
/*
@@ -827,7 +772,6 @@
* Method: _getComponentIdForApp
* Signature: (IILcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I
*/
-#ifdef RD_JAVA_USIF_APP_REG
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp
(JNIEnv *aEnv, jclass, jint aSessionHandle, jint aAppUid, jobject aComponentId)
{
@@ -847,13 +791,6 @@
}
return err;
}
-#else
-JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getComponentIdForApp
-(JNIEnv *, jclass, jint, jint, jobject)
-{
- return KErrNone;
-}
-#endif // RD_JAVA_USIF_APP_REG
/**
* See JNI method __1getuid.
@@ -866,20 +803,8 @@
CleanupClosePushL(*pScr);
TInt uid = 0;
CPropertyEntry *property = pScr->GetComponentPropertyL(aCid, KUid());
- if (NULL != property)
- {
- if (property->PropertyType() == CPropertyEntry::EIntProperty)
- {
- uid = ((CIntPropertyEntry*)property)->IntValue();
- }
- else
- {
- ELOG2(EJavaInstaller,
- "GetUidL: Incorrect property type %d for cid %d",
- property->PropertyType(), aCid);
- }
- delete property;
- }
+ uid = ((CIntPropertyEntry*)property)->IntValue();
+ delete property;
// Close and delete the temporary RSoftwareComponentRegistry.
CleanupStack::PopAndDestroy(pScr);
delete pScr; // For some reason PopAndDestroy does not delete this.
@@ -916,23 +841,16 @@
HBufC *globalId = CreateHBufCFromJavaStringLC(aEnv, aGlobalId);
CComponentEntry *componentEntry =
aScr->GetComponentL(*globalId, Usif::KSoftwareTypeJava, aLanguage);
- if (NULL == componentEntry)
- {
- //LOG_TDESC_L(EJavaInstaller, EInfo,
- // "Component not found for GlobalId %s", globalId->Des());
- CleanupStack::PopAndDestroy(globalId);
- return;
- }
CleanupStack::PopAndDestroy(globalId);
// Log component entry.
TComponentId componentId = componentEntry->ComponentId();
- LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %s", componentEntry->GlobalId());
+ LOG_TDESC_L(EJavaInstaller, EInfo, "GlobalId: %S", componentEntry->GlobalId());
LOG1(EJavaInstaller, EInfo, "ComponentId: %d", componentId);
- LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %s", componentEntry->SoftwareType());
- LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %s", componentEntry->Name());
- LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %s", componentEntry->Vendor());
- LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %s", componentEntry->Version());
+ LOG_TDESC_L(EJavaInstaller, EInfo, "SoftwareType: %S", componentEntry->SoftwareType());
+ LOG_TDESC_L(EJavaInstaller, EInfo, "Name: %S", componentEntry->Name());
+ LOG_TDESC_L(EJavaInstaller, EInfo, "Vendor: %S", componentEntry->Vendor());
+ LOG_TDESC_L(EJavaInstaller, EInfo, "Version: %S", componentEntry->Version());
LOG1(EJavaInstaller, EInfo, "ComponentSize: %d", componentEntry->ComponentSize());
LOG1(EJavaInstaller, EInfo, "ScomoState: %d", componentEntry->ScomoState());
LOG1(EJavaInstaller, EInfo, "IsDrmProtected: %d", componentEntry->IsDrmProtected());
@@ -960,42 +878,37 @@
switch (propertyEntry->PropertyType())
{
case CPropertyEntry::EBinaryProperty:
- LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %s",
+ LOG_TDESC_L(EJavaInstaller, EInfo, "BinaryProperty: %S",
propertyEntry->PropertyName());
break;
case CPropertyEntry::EIntProperty:
- LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %s",
+ LOG_TDESC_L(EJavaInstaller, EInfo, "IntProperty: %S",
propertyEntry->PropertyName());
LOG2(EJavaInstaller, EInfo, " = 0x%x (%d)",
((CIntPropertyEntry*)propertyEntry)->IntValue(),
((CIntPropertyEntry*)propertyEntry)->IntValue());
break;
case CPropertyEntry::ELocalizedProperty:
- LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %s",
+ LOG_TDESC_L(EJavaInstaller, EInfo, "LocalizedProperty: %S",
propertyEntry->PropertyName());
- LOG_TDESC_L(EJavaInstaller, EInfo, " = %s",
+ LOG_TDESC_L(EJavaInstaller, EInfo, " = %S",
((CLocalizablePropertyEntry*)propertyEntry)->StrValue());
break;
}
}
CleanupStack::PopAndDestroy(&properties);
-#ifdef RD_JAVA_USIF_APP_REG
// Log uids of applications associated to component.
RArray appUids;
CleanupClosePushL(appUids);
aScr->GetAppUidsForComponentL(componentId, appUids);
- if (appUids.Count() == 0)
- {
- LOG(EJavaInstaller, EInfo, "No component appUids found from SCR");
- }
+ LOG1(EJavaInstaller, EInfo, "Number of AppUids found: %d", appUids.Count());
for (TInt i = 0; i < appUids.Count(); i++)
{
LOG2(EJavaInstaller, EInfo, "AppUid [%x] (%d)",
appUids[i].iUid, appUids[i].iUid);
}
CleanupStack::PopAndDestroy(&appUids);
-#endif // RD_JAVA_USIF_APP_REG
}
/**
@@ -1047,11 +960,51 @@
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getUsifMode
(JNIEnv *, jclass)
{
-#ifdef RD_JAVA_USIF_APP_REG
return 1;
-#else
- return 0;
-#endif // RD_JAVA_USIF_APP_REG
+}
+
+/*
+ * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
+ * Method: _getErrorCategory
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getErrorCategory
+(JNIEnv *, jclass, jint aErrorId)
+{
+ int errorCategory = Usif::EUnexpectedError;
+ switch (aErrorId)
+ {
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_NO_MEM:
+ errorCategory = Usif::ELowDiskSpace;
+ break;
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_NO_NET:
+ errorCategory = Usif::ENetworkUnavailable;
+ break;
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_CORRUPT_PKG:
+ errorCategory = Usif::ECorruptedPackage;
+ break;
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_COMPAT_ERR:
+ errorCategory = Usif::EApplicationNotCompatible;
+ break;
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_AUTHORIZATION_ERR:
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_AUTHENTICATION_ERR:
+ errorCategory = Usif::ESecurityError;
+ break;
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_PUSH_REG_ERR:
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_UNEXPECTED_ERR:
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_UNEXPECTED_ERR:
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_OTHER_UNEXPECTED_ERR:
+ errorCategory = Usif::EUnexpectedError;
+ break;
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_INST_CANCEL:
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_CANCEL:
+ errorCategory = Usif::EUserCancelled;
+ break;
+ case com_nokia_mj_impl_utils_InstallerErrorMessage_UNINST_NOT_ALLOWED:
+ errorCategory = Usif::EUninstallationBlocked;
+ break;
+ }
+ return errorCategory;
}
#else // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
@@ -1127,9 +1080,9 @@
* Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;JZZZZLcom/nokia/mj/impl/installer/applicationregistrator/ComponentId;)I
*/
JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1registerComponent
-(JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring, jstring,
- jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint, jstring,
- jstring, jstring, jobject)
+(JNIEnv *, jclass, jint, jint, jstring, jstring, jstring, jstring,
+ jobjectArray, jlong, jboolean, jboolean, jboolean, jboolean, jint,
+ jstring, jstring, jstring, jstring, jobject)
{
return KErrNone;
}
@@ -1233,4 +1186,15 @@
return 0;
}
+/*
+ * Class: com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator
+ * Method: _getErrorCategory
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_installer_applicationregistrator_SifRegistrator__1getErrorCategory
+(JNIEnv *, jclass, jint)
+{
+ return 0;
+}
+
#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
diff -r 0ea12c182930 -r 63b81d807542 javamanager/javainstaller/installer/tsrc/build/build.xml
--- a/javamanager/javainstaller/installer/tsrc/build/build.xml Mon Aug 23 14:24:31 2010 +0300
+++ b/javamanager/javainstaller/installer/tsrc/build/build.xml Thu Sep 02 13:22:59 2010 +0300
@@ -1,6 +1,6 @@
@@ -96,7 +96,7 @@
tofile="${dist.dir}/${junit.omj.jar.filename}"/>
-
+
@@ -108,6 +108,9 @@
+
+
+