23 import com.nokia.mj.impl.installer.utils.ComponentId; |
23 import com.nokia.mj.impl.installer.utils.ComponentId; |
24 import com.nokia.mj.impl.installer.utils.InstallerException; |
24 import com.nokia.mj.impl.installer.utils.InstallerException; |
25 import com.nokia.mj.impl.installer.utils.FileUtils; |
25 import com.nokia.mj.impl.installer.utils.FileUtils; |
26 import com.nokia.mj.impl.installer.utils.Log; |
26 import com.nokia.mj.impl.installer.utils.Log; |
27 import com.nokia.mj.impl.installer.utils.PlatformUid; |
27 import com.nokia.mj.impl.installer.utils.PlatformUid; |
28 import com.nokia.mj.impl.rt.installer.ApplicationInfoImpl; |
|
29 import com.nokia.mj.impl.utils.Attribute; |
28 import com.nokia.mj.impl.utils.Attribute; |
30 import com.nokia.mj.impl.utils.Uid; |
29 import com.nokia.mj.impl.utils.Uid; |
31 |
30 |
32 import java.util.Enumeration; |
31 import java.util.Enumeration; |
33 import java.util.Hashtable; |
32 import java.util.Hashtable; |
124 if (id.getId() != 0) |
123 if (id.getId() != 0) |
125 { |
124 { |
126 uid = PlatformUid.createUid(id.getId()); |
125 uid = PlatformUid.createUid(id.getId()); |
127 } |
126 } |
128 return uid; |
127 return uid; |
129 } |
|
130 |
|
131 /** |
|
132 * Registers or unregisters Java software type to software |
|
133 * installation framework. |
|
134 * |
|
135 * @param aRegister true for registration, false for unregistration |
|
136 */ |
|
137 public static void registerJavaSoftwareType(boolean aRegister) |
|
138 { |
|
139 String op = (aRegister? "Register": "Unregister"); |
|
140 int err = _registerJavaSoftwareType(aRegister); |
|
141 if (err < 0) |
|
142 { |
|
143 InstallerException.internalError( |
|
144 op + " Java software type failed with code " + err); |
|
145 } |
|
146 else |
|
147 { |
|
148 Log.log("SifRegistrator " + op + "ed Java software type"); |
|
149 } |
|
150 } |
128 } |
151 |
129 |
152 /** |
130 /** |
153 * Starts application registration session. |
131 * Starts application registration session. |
154 * The registrations and unregistrations are done only |
132 * The registrations and unregistrations are done only |
688 } |
666 } |
689 |
667 |
690 private static String[] getComponentFiles(SuiteInfo aSuite) |
668 private static String[] getComponentFiles(SuiteInfo aSuite) |
691 { |
669 { |
692 Vector componentFiles = new Vector(); |
670 Vector componentFiles = new Vector(); |
693 String path = aSuite.getJadPath(); |
671 if (!aSuite.isPreinstalled()) |
694 if (path != null) |
672 { |
695 { |
673 // Add component jad and jar files only when the |
696 componentFiles.addElement(getScrString(path)); |
674 // application is not preinstalled. |
697 } |
675 String path = aSuite.getJadPath(); |
698 path = aSuite.getJarPath(); |
676 if (path != null) |
699 if (path != null) |
677 { |
700 { |
678 componentFiles.addElement(getScrString(path)); |
701 componentFiles.addElement(getScrString(path)); |
679 } |
|
680 path = aSuite.getJarPath(); |
|
681 if (path != null) |
|
682 { |
|
683 componentFiles.addElement(getScrString(path)); |
|
684 } |
702 } |
685 } |
703 boolean addRootPath = true; |
686 boolean addRootPath = true; |
704 int rootDrive = FileUtils.getDrive(aSuite.getRootDir()); |
687 int rootDrive = FileUtils.getDrive(aSuite.getRootDir()); |
705 for (int i = 0; i < componentFiles.size(); i++) |
688 for (int i = 0; i < componentFiles.size(); i++) |
706 { |
689 { |
714 break; |
697 break; |
715 } |
698 } |
716 } |
699 } |
717 if (addRootPath) |
700 if (addRootPath) |
718 { |
701 { |
719 componentFiles.addElement(getScrString(aSuite.getRootDir())); |
702 componentFiles.addElement( |
|
703 getScrString(aSuite.getRootDir() + "nofile.txt")); |
720 } |
704 } |
721 String[] result = new String[componentFiles.size()]; |
705 String[] result = new String[componentFiles.size()]; |
722 componentFiles.copyInto(result); |
706 componentFiles.copyInto(result); |
|
707 for (int i = 0; i < result.length; i++) |
|
708 { |
|
709 Log.log("SifRegistrator componentFiles[" + i + "]: " + result[i]); |
|
710 } |
723 return result; |
711 return result; |
724 } |
712 } |
725 |
713 |
726 /** |
714 /** |
727 * Registers localized names for given application from given suite. |
715 * Registers localized names for given application from given suite. |
824 " (" + localizedAttrValues[i] + ")"); |
812 " (" + localizedAttrValues[i] + ")"); |
825 } |
813 } |
826 } |
814 } |
827 |
815 |
828 // Register Domain-Category property. |
816 // Register Domain-Category property. |
829 ApplicationInfoImpl appInfoImpl = (ApplicationInfoImpl) |
817 String protectionDomainProperty = "Domain-Category"; |
830 com.nokia.mj.impl.rt.support.ApplicationInfo.getInstance(); |
818 String protectionDomainName = aSuite.getProtectionDomainName(); |
831 String domainCategory = appInfoImpl.getProtectionDomain(); |
819 if (protectionDomainName != null) |
832 err = _setLocalizedComponentProperty( |
820 { |
833 iSessionHandle, cid, "Domain-Category", |
821 err = _setLocalizedComponentProperty( |
834 domainCategory, UNSPECIFIED_LOCALE); |
822 iSessionHandle, cid, protectionDomainProperty, |
835 if (err < 0) |
823 getProtectionDomainPropertyValue(protectionDomainName), |
836 { |
824 UNSPECIFIED_LOCALE); |
837 InstallerException.internalError( |
825 if (err < 0) |
838 "Adding property Domain-Category value " + domainCategory + |
826 { |
839 " for component " + cid + " failed with code " + err); |
827 InstallerException.internalError( |
840 } |
828 "Adding property " + protectionDomainProperty + |
|
829 " value " + protectionDomainName + " for component " + |
|
830 cid + " failed with code " + err); |
|
831 } |
|
832 } |
|
833 else |
|
834 { |
|
835 Log.logWarning( |
|
836 "SifRegistrator.registerLocalizedProperties: " + |
|
837 protectionDomainProperty + " not set"); |
|
838 } |
|
839 } |
|
840 |
|
841 /** |
|
842 * Returns the "Domain-Category" property value which contains |
|
843 * the text id and text file name for the localized domain category |
|
844 * text. |
|
845 */ |
|
846 private String getProtectionDomainPropertyValue(String aProtectionDomain) |
|
847 { |
|
848 String textId = null; |
|
849 if (aProtectionDomain.equals("Manufacturer")) |
|
850 { |
|
851 textId = "txt_java_inst_setlabel_cert_domain_val_manufacturer"; |
|
852 } |
|
853 else if (aProtectionDomain.equals("Operator")) |
|
854 { |
|
855 textId = "txt_java_inst_setlabel_cert_domain_val_operator"; |
|
856 } |
|
857 else if (aProtectionDomain.equals("IdentifiedThirdParty")) |
|
858 { |
|
859 textId = "txt_java_inst_setlabel_cert_domain_val_trusted_third_party"; |
|
860 } |
|
861 else if (aProtectionDomain.equals("UnidentifiedThirdParty")) |
|
862 { |
|
863 textId = "txt_java_inst_setlabel_cert_domain_val_untrusted_third_party"; |
|
864 } |
|
865 return textId + ",javaapplicationinstaller"; |
841 } |
866 } |
842 |
867 |
843 /** |
868 /** |
844 * Returns array of localized names from the specified |
869 * Returns array of localized names from the specified |
845 * attributes of given suite. Assumes that aAttrPrefix |
870 * attributes of given suite. Assumes that aAttrPrefix |
947 * @return 0 or Symbian error code (negative number) |
972 * @return 0 or Symbian error code (negative number) |
948 */ |
973 */ |
949 private static native int _launchAppView(); |
974 private static native int _launchAppView(); |
950 |
975 |
951 /** |
976 /** |
952 * Registers Java software type to software installation framework. |
|
953 * |
|
954 * @param aRegister true for registration, false for unregistration |
|
955 * @return 0 or Symbian error code (negative number) |
|
956 */ |
|
957 private static native int _registerJavaSoftwareType(boolean aRegister); |
|
958 |
|
959 /** |
|
960 * Starts native application registration session. |
977 * Starts native application registration session. |
961 * |
978 * |
962 * @param aTransaction true if also transaction for this session should |
979 * @param aTransaction true if also transaction for this session should |
963 * be opened, false otherwise |
980 * be opened, false otherwise |
964 * @return native session handle or Symbian error code (negative number) |
981 * @return native session handle or Symbian error code (negative number) |