diff options
author | Jürgen Schmidt <jsc@apache.org> | 2012-02-03 15:58:45 +0000 |
---|---|---|
committer | Jürgen Schmidt <jsc@apache.org> | 2012-02-03 15:58:45 +0000 |
commit | 50ff2b5993e88113e4503fbcad5fab63e1c364fd (patch) | |
tree | c9bec518f29a9b611860d710cdc28191e8ec55ba | |
parent | 223ad0ef21e0b3bcdb90fd947a5532f0a47720e4 (diff) |
remove onlineregistration with dependencies
93 files changed, 42 insertions, 8686 deletions
diff --git a/Repository.mk b/Repository.mk index ba733d14828c..175fa1c6697e 100755 --- a/Repository.mk +++ b/Repository.mk @@ -124,7 +124,6 @@ $(eval $(call gb_Helper_register_libraries,UNOLIBS_OOO, \ fsstorage \ hatchwindowfactory \ passwordcontainer \ - productregistration \ vbaswobj \ msforms \ )) diff --git a/chart2/uiconfig/menubar/menubar.xml b/chart2/uiconfig/menubar/menubar.xml index 788dac2fc90b..0d100eea927d 100644 --- a/chart2/uiconfig/menubar/menubar.xml +++ b/chart2/uiconfig/menubar/menubar.xml @@ -148,7 +148,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/configmgr/qa/unit/data.xcd b/configmgr/qa/unit/data.xcd index 00ffaf208609..b217d279677a 100644 --- a/configmgr/qa/unit/data.xcd +++ b/configmgr/qa/unit/data.xcd @@ -3582,11 +3582,6 @@ <value>1</value> </prop> </node> - <node oor:name=".uno:OnlineRegistrationDlg" oor:op="replace"> - <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="x-no-translate"></value><value xml:lang="en-US">~Registration...</value> - </prop> - </node> <node oor:name=".uno:GoToStartSel" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="x-no-translate"></value><value xml:lang="en-US">Select to File Begin</value> diff --git a/cui/source/options/optgenrl.src b/cui/source/options/optgenrl.src index 573739c43beb..0a15d45120df 100644 --- a/cui/source/options/optgenrl.src +++ b/cui/source/options/optgenrl.src @@ -286,7 +286,7 @@ QueryBox RID_SVXQB_CHANGEDATA { BUTTONS = WB_YES_NO ; DEFBUTTON = WB_DEF_NO ; - Message [ en-US ] = "The User Data have been changed.\nNote that, if you continue, the registration key will become invalid.\nTherefore, a new registration key is needed within 30 days.\nYou can find the registration form in the menu Help - Registration...\nDo you really want to change your User Data?"; + Message [ en-US ] = "The User Data have been changed.\nDo you really want to change your User Data?"; }; // ********************************************************************** EOF diff --git a/dbaccess/uiconfig/dbapp/menubar/menubar.xml b/dbaccess/uiconfig/dbapp/menubar/menubar.xml index baafddcae8ad..e0e15ed5c2a2 100644 --- a/dbaccess/uiconfig/dbapp/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbapp/menubar/menubar.xml @@ -134,7 +134,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/dbaccess/uiconfig/dbquery/menubar/menubar.xml b/dbaccess/uiconfig/dbquery/menubar/menubar.xml index a3a965290fd6..715b04314da2 100644 --- a/dbaccess/uiconfig/dbquery/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbquery/menubar/menubar.xml @@ -75,7 +75,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/dbaccess/uiconfig/dbrelation/menubar/menubar.xml b/dbaccess/uiconfig/dbrelation/menubar/menubar.xml index 542395e58e9a..0bb81c061b62 100644 --- a/dbaccess/uiconfig/dbrelation/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbrelation/menubar/menubar.xml @@ -58,7 +58,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/dbaccess/uiconfig/dbtable/menubar/menubar.xml b/dbaccess/uiconfig/dbtable/menubar/menubar.xml index 18bdde9ec991..d1323096e25a 100644 --- a/dbaccess/uiconfig/dbtable/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbtable/menubar/menubar.xml @@ -59,7 +59,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/dbaccess/uiconfig/dbtdata/menubar/menubar.xml b/dbaccess/uiconfig/dbtdata/menubar/menubar.xml index 6b261670f854..39c335b2a098 100644 --- a/dbaccess/uiconfig/dbtdata/menubar/menubar.xml +++ b/dbaccess/uiconfig/dbtdata/menubar/menubar.xml @@ -67,7 +67,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index d29227153eca..ee0ae2ed1699 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -13,7 +13,7 @@ dt desktop\win32\source nmake - w dt_wrapper dt_inc NULL dt desktop\win32\source\setup nmake - w dt_setup dt_inc NULL dt desktop\win32\source\officeloader nmake - w dt_officeloader dt_inc NULL dt desktop\win32\source\guiloader nmake - w dt_guiloader dt_wrapper.w dt_inc NULL -dt desktop\win32\source\guistdio nmake - w dt_guistdio dt_inc NULL +dt desktop\win32\source\guistdio nmake - w dt_guistdio dt_inc NULL dt desktop\win32\source\applauncher nmake - w dt_applauncher dt_inc NULL dt desktop\win32\source\applauncher\ooo nmake - w dt_applauncher_ooo dt_applauncher.w dt_inc NULL dt desktop\win32\source\rebase nmake - w dt_rebase dt_inc NULL @@ -40,11 +40,8 @@ dt desktop\source\deployment\registry\executable nmake - all dt_dp_registry_exe dt desktop\scripts nmake - u dt_scripts dt_inc NULL dt desktop\util nmake - all dt_util dt_app dt_pagein.u dt_so_comp dt_spl dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_rebase.w dt_win32_quickstart_so.w NULL dt desktop\zipintro nmake - all dt_zipintro NULL -dt desktop\registry\data\org\openoffice\Office nmake - all sn_regconfig NULL -dt desktop\source\registration\com\sun\star\servicetag\resources get - all sn_svctagres NULL -dt desktop\source\registration\com\sun\star\servicetag nmake - all sn_svctag NULL -dt desktop\source\registration\com\sun\star\registration nmake - all sn_regjob sn_svctag NULL -dt desktop\qa\deployment_misc nmake - all sn_qa_deployment_misc dt_dp_misc dt_inc NULL -dt desktop\test\deployment\active nmake - all dt_test_deployment_active NULL -dt desktop\test\deployment\boxt nmake - all dt_test_deployment_boxt NULL -dt desktop\test\deployment\passive nmake - all dt_test_deployment_passive NULL +dt desktop\registry\data\org\openoffice\Office nmake - all sn_regconfig NULL +dt desktop\qa\deployment_misc nmake - all sn_qa_deployment_misc dt_dp_misc dt_inc NULL +dt desktop\test\deployment\active nmake - all dt_test_deployment_active NULL +dt desktop\test\deployment\boxt nmake - all dt_test_deployment_boxt NULL +dt desktop\test\deployment\passive nmake - all dt_test_deployment_passive NULL diff --git a/desktop/prj/d.lst b/desktop/prj/d.lst index e7d18a565d11..654545b6debc 100644 --- a/desktop/prj/d.lst +++ b/desktop/prj/d.lst @@ -145,6 +145,5 @@ mkdir: %_DEST%\xml%_EXT%\registry\spool\org\openoffice\Office\Jobs ..\%__SRC%\misc\migrationoo2.component %_DEST%\xml%_EXT%\migrationoo2.component ..\%__SRC%\misc\migrationoo3.component %_DEST%\xml%_EXT%\migrationoo3.component ..\%__SRC%\misc\offacc.component %_DEST%\xml%_EXT%\offacc.component -..\%__SRC%\misc\productregistration.jar.component %_DEST%\xml%_EXT%\productregistration.jar.component ..\%__SRC%\misc\socomp.component %_DEST%\xml%_EXT%\socomp.component ..\%__SRC%\misc\spl.component %_DEST%\xml%_EXT%\spl.component diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 3837b314a91a..79d286f43b89 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -155,7 +155,7 @@ #include <svtools/apearcfg.hxx> #include <unotools/misccfg.hxx> #include <svtools/filter.hxx> -#include <unotools/regoptions.hxx> +//#include <unotools/regoptions.hxx> #include "langselect.hxx" @@ -197,9 +197,6 @@ static SalMainPipeExchangeSignalHandler* pSignalHandler = 0; static sal_Bool _bCrashReporterEnabled = sal_True; static const ::rtl::OUString CFG_PACKAGE_COMMON_HELP ( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Office.Common/Help")); -static const ::rtl::OUString CFG_PATH_REG ( RTL_CONSTASCII_USTRINGPARAM( "Registration" )); -static const ::rtl::OUString CFG_ENTRY_REGURL ( RTL_CONSTASCII_USTRINGPARAM( "URL" )); -static const ::rtl::OUString CFG_ENTRY_TEMPLATEREGURL ( RTL_CONSTASCII_USTRINGPARAM( "TemplateURL" )); static ::rtl::OUString getBrandSharePreregBundledPathURL(); // ---------------------------------------------------------------------------- @@ -1747,7 +1744,6 @@ void Desktop::Main() if (IsFirstStartWizardNeeded()) { - ::utl::RegOptions().removeReminder(); // remove patch registration reminder Reference< XJob > xFirstStartJob( xSMgr->createInstance( DEFINE_CONST_UNICODE( "com.sun.star.comp.desktop.FirstStart" ) ), UNO_QUERY ); if (xFirstStartJob.is()) diff --git a/desktop/source/migration/pages.cxx b/desktop/source/migration/pages.cxx index ede5b190e3d2..5c362678b01e 100644 --- a/desktop/source/migration/pages.cxx +++ b/desktop/source/migration/pages.cxx @@ -36,7 +36,6 @@ #include <osl/file.hxx> #include <unotools/bootstrap.hxx> #include <unotools/configmgr.hxx> -#include <unotools/regoptions.hxx> #include <unotools/useroptions.hxx> #include <sfx2/basedlgs.hxx> #include <comphelper/processfactory.hxx> diff --git a/desktop/source/registration/com/sun/star/registration/Registration.java b/desktop/source/registration/com/sun/star/registration/Registration.java deleted file mode 100644 index f5a9e0922608..000000000000 --- a/desktop/source/registration/com/sun/star/registration/Registration.java +++ /dev/null @@ -1,331 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -package com.sun.star.registration; - -import com.sun.star.beans.NamedValue; -import com.sun.star.comp.loader.FactoryHelper; -import com.sun.star.frame.DispatchResultEvent; -import com.sun.star.frame.DispatchResultState; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XMultiComponentFactory; -import com.sun.star.lang.XSingleServiceFactory; -import com.sun.star.registry.*; -import com.sun.star.servicetag.*; -import com.sun.star.system.*; -import com.sun.star.task.*; -import com.sun.star.uno.*; -import com.sun.star.uri.XExternalUriReferenceTranslator; -import com.sun.star.util.XStringSubstitution; - -import java.io.*; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Locale; -import java.util.Set; -import java.net.HttpURLConnection; - -public class Registration { - - public static XSingleServiceFactory __getServiceFactory(String implName, - XMultiServiceFactory multiFactory, XRegistryKey regKey) { - XSingleServiceFactory xSingleServiceFactory = null; - - if (implName.equals(Registration.class.getName())) { - xSingleServiceFactory = FactoryHelper.getServiceFactory(_Registration.class, _serviceName, multiFactory, regKey); - } - - return xSingleServiceFactory; - } - - static final String _serviceName = "com.sun.star.comp.framework.DoRegistrationJob"; - - static public class _Registration implements XJob { - XComponentContext xComponentContext; - - XStringSubstitution xPathSubstService = null; - XExternalUriReferenceTranslator xUriTranslator = null; - - RegistrationData theRegistrationData = null; - - public _Registration(XComponentContext xComponentContext) { - this.xComponentContext = xComponentContext; - } - - private String resolvePath(String path) { - try { - if( xPathSubstService == null || xUriTranslator == null ) { - XMultiComponentFactory theServiceManager = xComponentContext.getServiceManager(); - if( xPathSubstService == null ) { - Object o = theServiceManager.createInstanceWithContext( - "com.sun.star.util.PathSubstitution", - xComponentContext ); - xPathSubstService = (XStringSubstitution) - UnoRuntime.queryInterface(XStringSubstitution.class, o); - } - - if( xUriTranslator == null ) { - Object o = theServiceManager.createInstanceWithContext( - "com.sun.star.uri.ExternalUriReferenceTranslator", - xComponentContext ); - xUriTranslator = (XExternalUriReferenceTranslator) - UnoRuntime.queryInterface(XExternalUriReferenceTranslator.class, o); - } - } - - String s = xPathSubstService.substituteVariables(path, true); - return xUriTranslator.translateToExternal(s); - } catch (java.lang.Exception e) { - return path; - } - } - - private void openBrowser(String url) { - try { - XMultiComponentFactory theServiceManager = xComponentContext.getServiceManager(); - - Object o = theServiceManager.createInstanceWithContext( - "com.sun.star.system.SystemShellExecute", - xComponentContext ); - - XSystemShellExecute xShellExecuteService = (XSystemShellExecute) - UnoRuntime.queryInterface(XSystemShellExecute.class, o); - - xShellExecuteService.execute( url, "", SystemShellExecuteFlags.DEFAULTS ); - } catch (java.lang.Exception e) { - } - } - - private ServiceTag getServiceTagFromRegistrationData(File xmlFile, String productURN) { - try { - RegistrationData storedRegData = RegistrationData.loadFromXML(new FileInputStream(xmlFile)); - Set<ServiceTag> storedServiceTags = storedRegData.getServiceTags(); - - Iterator<ServiceTag> tagIterator = storedServiceTags.iterator(); - while( tagIterator.hasNext() ) { - ServiceTag tag = tagIterator.next(); - if( tag.getProductURN().equals(productURN) ) { - theRegistrationData = storedRegData; - return tag; - } - } - - // product URN has changed, remove registration data file - xmlFile.delete(); - } catch (IOException e) { - // fall through intentionally - } catch (IllegalArgumentException e) { - // file is damaged (or a name clash appeared) - xmlFile.delete(); - } - return null; - } - - /* - * XJob - * - * NOTE: as this Job hets triggered by the the JobExecutor service from first start - * wizard and registration reminder code (because their frames do not implement - * XDispatchProvider), making this an XAsyncJob doesn't make sense as the - * JobExecutor waits for the jobFinished call on the listener passed. - */ - public Object execute(NamedValue[] args) - throws com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception { - - final NamedValue[] f_args = args; - - new Thread( - new Runnable () { - public void run() { - try { - executeImpl(f_args); - } catch(com.sun.star.uno.Exception e) { - } - } - } - ).start(); - - NamedValue ret[] = new NamedValue[1]; - ret[0] = new NamedValue( "Deactivate", new Boolean(false) ); - return ret; - } - - public synchronized void executeImpl(NamedValue[] args) - throws com.sun.star.lang.IllegalArgumentException, com.sun.star.uno.Exception { - - // extract the interesting part of the argument list - NamedValue[] theJobConfig = null; - NamedValue[] theEnvironment = null; - - int c = args.length; - for (int i=0; i<c; ++i) { - if (args[i].Name.equals("JobConfig")) - theJobConfig = (NamedValue[]) AnyConverter.toArray(args[i].Value); - else if (args[i].Name.equals("Environment")) - theEnvironment = (NamedValue[]) AnyConverter.toArray(args[i].Value); - } - - if (theEnvironment==null) - throw new com.sun.star.lang.IllegalArgumentException("no environment"); - - boolean saveConfig = false; - - String productName = ""; - String productVersion = ""; - String productURN = ""; - String productParent = ""; - String productParentURN = ""; - String productDefinedInstanceID = ""; - String productSource = ""; - String vendor = ""; - - String urlRegData = null; - String registrationURL = null; - - c = theJobConfig.length; - for (int i=0; i<c; ++i) { - if( theJobConfig[i].Name.equals("ProductName") ) { - productName = AnyConverter.toString(theJobConfig[i].Value); - } else if( theJobConfig[i].Name.equals("ProductVersion") ) { - productVersion = AnyConverter.toString(theJobConfig[i].Value); - } else if( theJobConfig[i].Name.equals("ProductURN") ) { - productURN = AnyConverter.toString(theJobConfig[i].Value); - } else if( theJobConfig[i].Name.equals("ProductParent") ) { - productParent = AnyConverter.toString(theJobConfig[i].Value); - } else if( theJobConfig[i].Name.equals("ProductParentURN") ) { - productParentURN = AnyConverter.toString(theJobConfig[i].Value); - } else if( theJobConfig[i].Name.equals("ProductSource") ) { - productSource = AnyConverter.toString(theJobConfig[i].Value); - } else if( theJobConfig[i].Name.equals("Vendor") ) { - vendor = AnyConverter.toString(theJobConfig[i].Value); - } else if( theJobConfig[i].Name.equals("RegistrationData") ) { - urlRegData = resolvePath(AnyConverter.toString(theJobConfig[i].Value)); - } else if( theJobConfig[i].Name.equals("RegistrationURL") ) { - registrationURL = AnyConverter.toString(theJobConfig[i].Value); - } else { - System.err.println( theJobConfig[i].Name + " = " + AnyConverter.toString(theJobConfig[i].Value) ); - } - } - - if (registrationURL==null) - throw new com.sun.star.lang.IllegalArgumentException("no registration url"); - - boolean local_only = false; - - c = theEnvironment.length; - for (int i=0; i<c; ++i) { - if( theEnvironment[i].Name.equals("EventName") ) { - if( ! AnyConverter.toString(theEnvironment[i].Value).equals("onRegisterNow") ) { - local_only = true; - } - } - } - - try { - - /* ensure only one thread accesses/writes registration.xml at a time - * regardless how many instances of this Job exist. - */ - synchronized( _serviceName ) { - - File xmlRegData = new File( new URI( urlRegData ) ); - - ServiceTag tag = getServiceTagFromRegistrationData(xmlRegData, productURN); - if( tag == null ) { - tag = ServiceTag.newInstance( - ServiceTag.generateInstanceURN(), - productName, - productVersion, - productURN, - productParent, - productParentURN, - productDefinedInstanceID, - vendor, - System.getProperty("os.arch"), - Installer.getZoneName(), - productSource); - - theRegistrationData = new RegistrationData(); - theRegistrationData.addServiceTag(tag); - theRegistrationData.storeToXML( new FileOutputStream( xmlRegData ) ); - } - - // Store the service tag in local registry, which might have been installed later - if( Registry.isSupported() ) { - // ignore communication failures with local service tag client - try { - if( Registry.getSystemRegistry().getServiceTag(tag.getInstanceURN()) == null ) { - Registry.getSystemRegistry().addServiceTag(tag); - } - } catch( java.io.IOException e) { - e.printStackTrace(); - } catch (java.lang.RuntimeException e) { - e.printStackTrace(); - } - } - } - - if( ! local_only ) { - registrationURL = registrationURL.replaceAll("\\$\\{registry_urn\\}", theRegistrationData.getRegistrationURN()); - registrationURL = registrationURL.replaceAll("\\$\\{locale\\}", Locale.getDefault().getLanguage()); - - HttpURLConnection con = (HttpURLConnection) new URL(registrationURL).openConnection(); - con.setDoInput(true); - con.setDoOutput(true); - con.setUseCaches(false); - con.setAllowUserInteraction(false); - con.setRequestMethod("POST"); - - con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\""); - try { - con.connect(); - - OutputStream out = con.getOutputStream(); - theRegistrationData.storeToXML(out); - out.flush(); - out.close(); - - int returnCode = con.getResponseCode(); -// if (returnCode == HttpURLConnection.HTTP_OK); - } catch(java.lang.Exception e) { - // IOException and UnknownHostException - } - openBrowser(registrationURL); - } - } catch (java.net.MalformedURLException e) { - e.printStackTrace(); - throw new com.sun.star.lang.IllegalArgumentException( e.toString() ); - } catch (java.net.URISyntaxException e) { - e.printStackTrace(); - throw new com.sun.star.lang.IllegalArgumentException( e.toString() ); - } catch (java.io.IOException e) { - e.printStackTrace(); - throw new com.sun.star.uno.RuntimeException( e.toString() ); - } catch (java.lang.RuntimeException e) { - e.printStackTrace(); - throw new com.sun.star.uno.RuntimeException( e.toString() ); - } - } - } -} diff --git a/desktop/source/registration/com/sun/star/registration/makefile.mk b/desktop/source/registration/com/sun/star/registration/makefile.mk deleted file mode 100644 index 1fc394bddd38..000000000000 --- a/desktop/source/registration/com/sun/star/registration/makefile.mk +++ /dev/null @@ -1,58 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJNAME = setup_native -PRJ = ..$/..$/..$/..$/..$/.. -TARGET = productregistration -PACKAGE = com$/sun$/star$/registration - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(ENABLE_SVCTAGS)" == "YES" - -JARFILES = jurt.jar unoil.jar ridl.jar -JAVAFILES = \ - Registration.java - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE -JARCLASSDIRS = $(PACKAGE) com$/sun$/star$/servicetag -CUSTOMMANIFESTFILE = manifest -.ENDIF # "$(ENABLE_SVCTAGS)" == "YES" - -# --- Targets ------------------------------------------------------ - - -.INCLUDE : target.mk - -ALLTAR : $(MISC)/productregistration.jar.component - -$(MISC)/productregistration.jar.component .ERRREMOVE : \ - $(SOLARENV)/bin/createcomponent.xslt productregistration.jar.component - $(XSLTPROC) --nonet --stringparam uri \ - '$(COMPONENTPREFIX_BASIS_JAVA)productregistration.jar' -o $@ \ - $(SOLARENV)/bin/createcomponent.xslt productregistration.jar.component diff --git a/desktop/source/registration/com/sun/star/registration/manifest b/desktop/source/registration/com/sun/star/registration/manifest deleted file mode 100644 index 952aaa804e96..000000000000 --- a/desktop/source/registration/com/sun/star/registration/manifest +++ /dev/null @@ -1,2 +0,0 @@ -RegistrationClassName: com.sun.star.registration.Registration -UNO-Type-Path: diff --git a/desktop/source/registration/com/sun/star/registration/productregistration.jar.component b/desktop/source/registration/com/sun/star/registration/productregistration.jar.component deleted file mode 100644 index 863f6f91436c..000000000000 --- a/desktop/source/registration/com/sun/star/registration/productregistration.jar.component +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> - - - -<component loader="com.sun.star.loader.Java2" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.registration.Registration"> - <service name="com.sun.star.comp.framework.DoRegistrationJob"/> - </implementation> -</component> diff --git a/desktop/source/registration/com/sun/star/servicetag/BrowserSupport.java b/desktop/source/registration/com/sun/star/servicetag/BrowserSupport.java deleted file mode 100644 index 6bd2b175e804..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/BrowserSupport.java +++ /dev/null @@ -1,197 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; -import java.io.IOException; -import java.net.URI; - -/** - * BrowserSupport class. - * - * The implementation of the com.sun.servicetag API needs to be - * compiled with JDK 5 as well since the consumer of this API - * may require to support JDK 5 (e.g. NetBeans). - * - * The Desktop.browse() method can be backported in this class - * if needed. The current implementation only supports JDK 6. - */ -class BrowserSupport { - private static boolean isBrowseSupported = false; - private static Method browseMethod = null; - private static Object desktop = null; - private static volatile Boolean result = false; - - - private static void initX() { - if (desktop != null) { - return; - } - boolean supported = false; - Method browseM = null; - Object desktopObj = null; - try { - // Determine if java.awt.Desktop is supported - Class desktopCls = Class.forName("java.awt.Desktop", true, null); - Method getDesktopM = desktopCls.getMethod("getDesktop"); - browseM = desktopCls.getMethod("browse", URI.class); - - Class actionCls = Class.forName("java.awt.Desktop$Action", true, null); - final Method isDesktopSupportedMethod = desktopCls.getMethod("isDesktopSupported"); - Method isSupportedMethod = desktopCls.getMethod("isSupported", actionCls); - Field browseField = actionCls.getField("BROWSE"); - // isDesktopSupported calls getDefaultToolkit which can block - // infinitely, see 6636099 for details, to workaround we call - // in a thread and time it out, noting that the issue is specific - // to X11, it does not hurt for Windows. - Thread xthread = new Thread() { - public void run() { - try { - // support only if Desktop.isDesktopSupported() and - // Desktop.isSupported(Desktop.Action.BROWSE) return true. - result = (Boolean) isDesktopSupportedMethod.invoke(null); - } catch (IllegalAccessException e) { - // should never reach here - InternalError x = - new InternalError("Desktop.getDesktop() method not found"); - x.initCause(e); - } catch (InvocationTargetException e) { - // browser not supported - if (Util.isVerbose()) { - e.printStackTrace(); - } - } - } - }; - // set it to daemon, so that the vm will exit. - xthread.setDaemon(true); - xthread.start(); - try { - xthread.join(5 * 1000); - } catch (InterruptedException ie) { - // ignore the exception - } - if (result.booleanValue()) { - desktopObj = getDesktopM.invoke(null); - result = (Boolean) isSupportedMethod.invoke(desktopObj, browseField.get(null)); - supported = result.booleanValue(); - } - } catch (ClassNotFoundException e) { - // browser not supported - if (Util.isVerbose()) { - e.printStackTrace(); - } - } catch (NoSuchMethodException e) { - // browser not supported - if (Util.isVerbose()) { - e.printStackTrace(); - } - } catch (NoSuchFieldException e) { - // browser not supported - if (Util.isVerbose()) { - e.printStackTrace(); - } - } catch (IllegalAccessException e) { - // should never reach here - InternalError x = - new InternalError("Desktop.getDesktop() method not found"); - x.initCause(e); - throw x; - } catch (InvocationTargetException e) { - // browser not supported - if (Util.isVerbose()) { - e.printStackTrace(); - } - } - isBrowseSupported = supported; - browseMethod = browseM; - desktop = desktopObj; - } - - static boolean isSupported() { - initX(); - return isBrowseSupported; - } - - /** - * Launches the default browser to display a {@code URI}. - * If the default browser is not able to handle the specified - * {@code URI}, the application registered for handling - * {@code URIs} of the specified type is invoked. The application - * is determined from the protocol and path of the {@code URI}, as - * defined by the {@code URI} class. - * <p> - * This method calls the Desktop.getDesktop().browse() method. - * <p> - * @param uri the URI to be displayed in the user default browser - * - * @throws NullPointerException if {@code uri} is {@code null} - * @throws UnsupportedOperationException if the current platform - * does not support the {@link Desktop.Action#BROWSE} action - * @throws IOException if the user default browser is not found, - * or it fails to be launched, or the default handler application - * failed to be launched - * @throws IllegalArgumentException if the necessary permissions - * are not available and the URI can not be converted to a {@code URL} - */ - static void browse(URI uri) throws IOException { - if (uri == null) { - throw new NullPointerException("null uri"); - } - if (!isSupported()) { - throw new UnsupportedOperationException("Browse operation is not supported"); - } - - // Call Desktop.browse() method - try { - if (Util.isVerbose()) { - System.out.println("desktop: " + desktop + ":browsing..." + uri); - } - browseMethod.invoke(desktop, uri); - } catch (IllegalAccessException e) { - // should never reach here - InternalError x = - new InternalError("Desktop.getDesktop() method not found"); - x.initCause(e); - throw x; - } catch (InvocationTargetException e) { - Throwable x = e.getCause(); - if (x != null) { - if (x instanceof UnsupportedOperationException) { - throw (UnsupportedOperationException) x; - } else if (x instanceof IllegalArgumentException) { - throw (IllegalArgumentException) x; - } else if (x instanceof IOException) { - throw (IOException) x; - } else if (x instanceof SecurityException) { - throw (SecurityException) x; - } else { - // ignore - } - } - } - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/Installer.java b/desktop/source/registration/com/sun/star/servicetag/Installer.java deleted file mode 100644 index dd4b8274b334..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/Installer.java +++ /dev/null @@ -1,939 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -import java.io.*; -import java.util.HashSet; -import java.util.Locale; -import java.util.Properties; -import java.util.Set; -import java.util.List; -import java.util.ArrayList; -import static com.sun.star.servicetag.Util.*; - -/** - * Service Tag Installer for Java SE. - */ -public class Installer { - // System properties for testing - private static String SVCTAG_DIR_PATH = - "servicetag.dir.path"; - private static String SVCTAG_ENABLE_REGISTRATION = - "servicetag.registration.enabled"; - private final static String SUN_VENDOR = "Sun Microsystems"; - private final static String REGISTRATION_XML = "registration.xml"; - private final static String SERVICE_TAG_FILE = "servicetag"; - private final static String REGISTRATION_HTML_NAME = "register"; - - private final static Locale[] knownSupportedLocales = - new Locale[] { Locale.ENGLISH, - Locale.JAPANESE, - Locale.SIMPLIFIED_CHINESE}; - - private final static String javaHome = System.getProperty("java.home"); - private static File svcTagDir; - private static File serviceTagFile; - private static File regXmlFile; - private static RegistrationData registration; - private static boolean supportRegistration; - private static String registerHtmlParent; - private static Set<Locale> supportedLocales = new HashSet<Locale>(); - private static Properties swordfishProps = null; - private static String[] jreArchs = null; - static { - String dir = System.getProperty(SVCTAG_DIR_PATH); - if (dir == null) { - svcTagDir = new File(getJrePath(), "lib" + File.separator + SERVICE_TAG_FILE); - } else { - svcTagDir = new File(dir); - } - serviceTagFile = new File(svcTagDir, SERVICE_TAG_FILE); - regXmlFile = new File(svcTagDir, REGISTRATION_XML); - if (System.getProperty(SVCTAG_ENABLE_REGISTRATION) == null) { - supportRegistration = isJdk(); - } else { - supportRegistration = true; - } - } - - private Installer() { - } - - // Implementation of ServiceTag.getJavaServiceTag(String) method - static ServiceTag getJavaServiceTag(String source) throws IOException { - if (!System.getProperty("java.vendor").startsWith(SUN_VENDOR)) { - // Products bundling this implementation may run on - // Mac OS which is not a Sun JDK - return null; - } - boolean cleanup = false; - try { - // Check if we have the swordfish entries for this JRE version - if (loadSwordfishEntries() == null) { - return null; - } - - ServiceTag st = getJavaServiceTag(); - // Check if the service tag created by this bundle owner - if (st != null && st.getSource().equals(source)) { - // Install the system service tag if supported - // stclient may be installed after the service tag creation - if (Registry.isSupported()) { - installSystemServiceTag(); - } - return st; - } - - // in case any exception thrown during the cleanup - cleanup = true; - - // re-create a new one for this bundle owner - // first delete the registration data - deleteRegistrationData(); - cleanup = false; - - // create service tag and generate new register.html pages - return createServiceTag(source); - } finally { - if (cleanup) { - if (regXmlFile.exists()) { - regXmlFile.delete(); - } - if (serviceTagFile.exists()) { - serviceTagFile.delete(); - } - } - } - } - - /** - * Returns the Java SE registration data located in - * the <JRE>/lib/servicetag/registration.xml by default. - * - * @throws IllegalArgumentException if the registration data - * is of invalid format. - */ - private static synchronized RegistrationData getRegistrationData() - throws IOException { - if (registration != null) { - return registration; - } - if (regXmlFile.exists()) { - BufferedInputStream in = null; - try { - in = new BufferedInputStream(new FileInputStream(regXmlFile)); - registration = RegistrationData.loadFromXML(in); - } catch (IllegalArgumentException ex) { - System.err.println("Error: Bad registration data \"" + - regXmlFile + "\":" + ex.getMessage()); - throw ex; - } finally { - if (in != null) { - in.close(); - } - } - } else { - registration = new RegistrationData(); - } - return registration; - } - - /** - * Write the registration data to the registration.xml file. - * - * The offline registration page has to be regenerated with - * the new registration data. - * - * @throws java.io.IOException - */ - private static synchronized void writeRegistrationXml() - throws IOException { - if (!svcTagDir.exists()) { - // This check is for NetBeans or other products that - // bundles this com.sun.servicetag implementation for - // pre-6u5 release. - if (!svcTagDir.mkdir()) { - throw new IOException("Failed to create directory: " + svcTagDir); - } - } - - // regenerate the new offline registration page - deleteRegistrationHtmlPage(); - getRegistrationHtmlPage(); - - BufferedOutputStream out = null; - try { - out = new BufferedOutputStream(new FileOutputStream(regXmlFile)); - getRegistrationData().storeToXML(out); - } catch (IllegalArgumentException ex) { - System.err.println("Error: Bad registration data \"" + - regXmlFile + "\":" + ex.getMessage()); - throw ex; - } finally { - if (out != null) { - out.close(); - } - } - } - - /** - * Returns the instance urn(s) stored in the servicetag file - * or empty set if file not exists. - */ - private static Set<String> getInstalledURNs() throws IOException { - Set<String> urnSet = new HashSet<String>(); - if (serviceTagFile.exists()) { - BufferedReader in = null; - try { - in = new BufferedReader(new FileReader(serviceTagFile)); - String urn; - while ((urn = in.readLine()) != null) { - urn = urn.trim(); - if (urn.length() > 0) { - urnSet.add(urn); - } - } - } finally { - if (in != null) { - in.close(); - } - } - } - return urnSet; - } - - /** - * Return the Java SE service tag(s) if it exists. - * Typically only one Java SE service tag but it could have two for - * Solaris 32-bit and 64-bit on the same install directory. - * - * @return the service tag(s) for Java SE - */ - private static ServiceTag[] getJavaServiceTagArray() throws IOException { - RegistrationData regData = getRegistrationData(); - Set<ServiceTag> svcTags = regData.getServiceTags(); - Set<ServiceTag> result = new HashSet<ServiceTag>(); - - Properties props = loadSwordfishEntries(); - String jdkUrn = props.getProperty("servicetag.jdk.urn"); - String jreUrn = props.getProperty("servicetag.jre.urn"); - for (ServiceTag st : svcTags) { - if (st.getProductURN().equals(jdkUrn) || - st.getProductURN().equals(jreUrn)) { - result.add(st); - } - } - return result.toArray(new ServiceTag[0]); - } - - /** - * Returns the Java SE service tag for this running platform; - * or null if not exist. - * This method will return the 64-bit service tag if the JDK - * supports both 32-bit and 64-bit if already created. - */ - private static ServiceTag getJavaServiceTag() throws IOException { - String definedId = getProductDefinedId(); - for (ServiceTag st : getJavaServiceTagArray()) { - if (st.getProductDefinedInstanceID().equals(definedId)) { - return st; - } - } - return null; - } - - /** - * Create a service tag for Java SE and install in the system - * service tag registry if supported. - * - * A registration data <JRE>/lib/servicetag/registration.xml - * will be created to storeToXML the XML entry for Java SE service tag. - * If the system supports service tags, this method will install - * the Java SE service tag in the system service tag registry and - * its <tt>instance_urn</tt> will be stored to <JRE>/lib/servicetag/servicetag. - * - * If <JRE>/lib/servicetag/registration.xml exists but is not installed - * in the system service tag registry (i.e. servicetag doesn't exist), - * this method will install it as described above. - * - * If the system supports service tag, stclient will be used - * to create the Java SE service tag. - * - * A Solaris 32-bit and 64-bit JDK will be installed in the same - * directory but the registration.xml will have 2 service tags. - * The servicetag file will also contain 2 instance_urns for that case. - */ - private static ServiceTag createServiceTag(String svcTagSource) - throws IOException { - // determine if a new service tag is needed to be created - ServiceTag newSvcTag = null; - if (getJavaServiceTag() == null) { - newSvcTag = newServiceTag(svcTagSource); - } - - // Add the new service tag in the registration data - if (newSvcTag != null) { - RegistrationData regData = getRegistrationData(); - - // Add the service tag to the registration data in JDK/JRE - newSvcTag = regData.addServiceTag(newSvcTag); - - // add if there is a service tag for the OS - ServiceTag osTag = SolarisServiceTag.getServiceTag(); - if (osTag != null && regData.getServiceTag(osTag.getInstanceURN()) == null) { - regData.addServiceTag(osTag); - } - // write to the registration.xml - writeRegistrationXml(); - } - - // Install the system service tag if supported - if (Registry.isSupported()) { - installSystemServiceTag(); - } - return newSvcTag; - } - - private static void installSystemServiceTag() throws IOException { - // only install the service tag in the registry if - // it has permission to write the servicetag file. - if ((!serviceTagFile.exists() && !svcTagDir.canWrite()) || - (serviceTagFile.exists() && !serviceTagFile.canWrite())) { - return; - } - - Set<String> urns = getInstalledURNs(); - ServiceTag[] javaSvcTags = getJavaServiceTagArray(); - if (urns.size() < javaSvcTags.length) { - for (ServiceTag st : javaSvcTags) { - // Add the service tag in the system service tag registry - // if not installed - String instanceURN = st.getInstanceURN(); - if (!urns.contains(instanceURN)) { - Registry.getSystemRegistry().addServiceTag(st); - } - } - } - writeInstalledUrns(); - } - - private static ServiceTag newServiceTag(String svcTagSource) throws IOException { - // Load the swoRDFish information for the service tag creation - Properties props = loadSwordfishEntries(); - - // Determine the product URN and name - String productURN; - String productName; - - if (isJdk()) { - // <HOME>/jre exists which implies it's a JDK - productURN = props.getProperty("servicetag.jdk.urn"); - productName = props.getProperty("servicetag.jdk.name"); - } else { - // Otherwise, it's a JRE - productURN = props.getProperty("servicetag.jre.urn"); - productName = props.getProperty("servicetag.jre.name"); - } - - return ServiceTag.newInstance(ServiceTag.generateInstanceURN(), - productName, - System.getProperty("java.version"), - productURN, - props.getProperty("servicetag.parent.name"), - props.getProperty("servicetag.parent.urn"), - getProductDefinedId(), - SUN_VENDOR, - System.getProperty("os.arch"), - getZoneName(), - svcTagSource); - } - - /** - * Delete the registration data, the offline registration pages and - * the service tags in the system service tag registry if installed. - * - * The registration.xml and servicetag file will be removed. - */ - private static synchronized void deleteRegistrationData() - throws IOException { - try { - // delete the offline registration page - deleteRegistrationHtmlPage(); - - // Remove the service tag from the system ST registry if exists - Set<String> urns = getInstalledURNs(); - if (urns.size() > 0 && Registry.isSupported()) { - for (String u : urns) { - Registry.getSystemRegistry().removeServiceTag(u); - } - } - registration = null; - } finally { - // Delete the registration.xml and servicetag files if exists - if (regXmlFile.exists()) { - if (!regXmlFile.delete()) { - throw new IOException("Failed to delete " + regXmlFile); - } - } - if (serviceTagFile.exists()) { - if (!serviceTagFile.delete()) { - throw new IOException("Failed to delete " + serviceTagFile); - } - } - } - } - - /** - * Updates the registration data to contain one single service tag - * for the running Java runtime. - */ - private static synchronized void updateRegistrationData(String svcTagSource) - throws IOException { - RegistrationData regData = getRegistrationData(); - ServiceTag curSvcTag = newServiceTag(svcTagSource); - - ServiceTag[] javaSvcTags = getJavaServiceTagArray(); - Set<String> urns = getInstalledURNs(); - for (ServiceTag st : javaSvcTags) { - if (!st.getProductDefinedInstanceID().equals(curSvcTag.getProductDefinedInstanceID())) { - String instanceURN = st.getInstanceURN(); - regData.removeServiceTag(instanceURN); - - // remove it from the system service tag registry if exists - if (urns.contains(instanceURN) && Registry.isSupported()) { - Registry.getSystemRegistry().removeServiceTag(instanceURN); - } - } - } - writeRegistrationXml(); - writeInstalledUrns(); - } - - private static void writeInstalledUrns() throws IOException { - // if the Registry is not supported, - // remove the servicetag file - if (!Registry.isSupported() && serviceTagFile.exists()) { - serviceTagFile.delete(); - return; - } - - PrintWriter out = null; - try { - out = new PrintWriter(serviceTagFile); - - ServiceTag[] javaSvcTags = getJavaServiceTagArray(); - for (ServiceTag st : javaSvcTags) { - // Write the instance_run to the servicetag file - String instanceURN = st.getInstanceURN(); - out.println(instanceURN); - } - } finally { - if (out != null) { - out.close(); - } - } - } - - /** - * Load the values associated with the swoRDFish metadata entries - * for Java SE. The swoRDFish metadata entries are different for - * different release. - * - * @param version Version of Java SE - */ - private static synchronized Properties loadSwordfishEntries() throws IOException { - if (swordfishProps != null) { - return swordfishProps; - } - - // The version string for Java SE 6 is 1.6.0 - // We just need the minor number in the version string - int version = Util.getJdkVersion(); - - String filename = "/com/sun/servicetag/resources/javase_" + - version + "_swordfish.properties"; - InputStream in = Installer.class.getClass().getResourceAsStream(filename); - if (in == null) { - return null; - } - swordfishProps = new Properties(); - try { - swordfishProps.load(in); - } finally { - in.close(); - } - return swordfishProps; - } - - /** - * Returns the product defined instance ID for Java SE. - * It is a list of comma-separated name/value pairs: - * "id=<full-version> <arch> [<arch>]*" - * "dir=<java.home system property value>" - * - * where <full-version> is the full version string of the JRE, - * <arch> is the architecture that the runtime supports - * (i.e. "sparc", "sparcv9", "i386", "amd64" (ISA list)) - * - * For Solaris, it can be dual mode that can support both - * 32-bit and 64-bit. the "id" will be set to - * "1.6.0_03-b02 sparc sparcv9" - * - * The "dir" property is included in the service tag to enable - * the Service Tag software to determine if a service tag for - * Java SE is invalid and perform appropriate service tag - * cleanup if necessary. See RFE# 6574781 Service Tags Enhancement. - * - */ - private static String getProductDefinedId() { - StringBuilder definedId = new StringBuilder(); - definedId.append("id="); - definedId.append(System.getProperty("java.runtime.version")); - - String[] archs = getJreArchs(); - for (String name : archs) { - definedId.append(" " + name); - } - - String location = ",dir=" + javaHome; - if ((definedId.length() + location.length()) < 256) { - definedId.append(",dir="); - definedId.append(javaHome); - } else { - // if it exceeds the limit, we will not include the location - if (isVerbose()) { - System.err.println("Warning: Product defined instance ID exceeds the field limit:"); - } - } - - return definedId.toString(); - } - - /** - * Returns the architectures that the runtime supports - * (i.e. "sparc", "sparcv9", "i386", "amd64" (ISA list)) - * The directory name where libjava.so is located. - * - * On Windows, returns the "os.arch" system property value. - */ - private synchronized static String[] getJreArchs() { - if (jreArchs != null) { - return jreArchs; - } - - Set<String> archs = new HashSet<String>(); - - String os = System.getProperty("os.name"); - if (os.equals("SunOS") || os.equals("Linux")) { - // Traverse the directories under <JRE>/lib. - // If <JRE>/lib/<arch>/libjava.so exists, add <arch> - // to the product defined ID - File dir = new File(getJrePath() + File.separator + "lib"); - if (dir.isDirectory()) { - String[] children = dir.list(); - for (String name : children) { - File f = new File(dir, name + File.separator + "libjava.so"); - if (f.exists()) { - archs.add(name); - } - } - } - } else { - // Windows - append the os.arch - archs.add(System.getProperty("os.arch")); - } - jreArchs = archs.toArray(new String[0]); - return jreArchs; - } - - /** - * Return the zonename if zone is supported; otherwise, return - * "global". - */ - public static String getZoneName() throws IOException { - String zonename = "global"; - - String command = "/usr/bin/zonename"; - File f = new File(command); - // com.sun.servicetag package has to be compiled with JDK 5 as well - // JDK 5 doesn't support the File.canExecute() method. - // Risk not checking isExecute() for the zonename command is very low. - if (f.exists()) { - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - if (p.exitValue() == 0) { - zonename = output.trim(); - } - - } - return zonename; - } - - private synchronized static String getRegisterHtmlParent() throws IOException { - if (registerHtmlParent == null) { - File htmlDir; // register.html is put under the JDK directory - if (getJrePath().endsWith(File.separator + "jre")) { - htmlDir = new File(getJrePath(), ".."); - } else { - // j2se non-image build - htmlDir = new File(getJrePath()); - } - - // initialize the supported locales - initSupportedLocales(htmlDir); - - // Determine the location of the offline registration page - String path = System.getProperty(SVCTAG_DIR_PATH); - if (path == null) { - // Default is <JDK>/register.html - registerHtmlParent = htmlDir.getCanonicalPath(); - } else { - File f = new File(path); - registerHtmlParent = f.getCanonicalPath(); - if (!f.isDirectory()) { - throw new InternalError("Path " + path + " set in \"" + - SVCTAG_DIR_PATH + "\" property is not a directory"); - } - } - } - return registerHtmlParent; - } - - /** - * Returns the File object of the offline registration page localized - * for the default locale in the JDK directory. - */ - static synchronized File getRegistrationHtmlPage() throws IOException { - if (!supportRegistration) { - // No register.html page generated if JRE - return null; - } - - String parent = getRegisterHtmlParent(); - - // check if the offline registration page is already generated - File f = new File(parent, REGISTRATION_HTML_NAME + ".html"); - if (!f.exists()) { - // Generate the localized version of the offline registration Page - generateRegisterHtml(parent); - } - - String name = REGISTRATION_HTML_NAME; - List<Locale> candidateLocales = getCandidateLocales(Locale.getDefault()); - for (Locale l : candidateLocales) { - if (supportedLocales.contains(l)) { - name = REGISTRATION_HTML_NAME + "_" + l.toString(); - break; - } - } - File htmlFile = new File(parent, name + ".html"); - if (isVerbose()) { - System.out.print("Offline registration page: " + htmlFile); - System.out.println((htmlFile.exists() ? - "" : " not exist. Use register.html")); - } - if (htmlFile.exists()) { - return htmlFile; - } else { - return new File(parent, - REGISTRATION_HTML_NAME + ".html"); - } - } - - private static List<Locale> getCandidateLocales(Locale locale) { - String language = locale.getLanguage(); - String country = locale.getCountry(); - String variant = locale.getVariant(); - - List<Locale> locales = new ArrayList<Locale>(3); - if (variant.length() > 0) { - locales.add(locale); - } - if (country.length() > 0) { - locales.add((locales.size() == 0) ? - locale : new Locale(language, country, "")); - } - if (language.length() > 0) { - locales.add((locales.size() == 0) ? - locale : new Locale(language, "", "")); - } - return locales; - } - - // Remove the offline registration pages - private static void deleteRegistrationHtmlPage() throws IOException { - String parent = getRegisterHtmlParent(); - if (parent == null) { - return; - } - - for (Locale locale : supportedLocales) { - String name = REGISTRATION_HTML_NAME; - if (!locale.equals(Locale.ENGLISH)) { - name += "_" + locale.toString(); - } - File f = new File(parent, name + ".html"); - if (f.exists()) { - if (!f.delete()) { - throw new IOException("Failed to delete " + f); - } - } - } - } - - private static void initSupportedLocales(File jdkDir) { - if (supportedLocales.isEmpty()) { - // initialize with the known supported locales - for (Locale l : knownSupportedLocales) { - supportedLocales.add(l); - } - } - - // Determine unknown supported locales if any - // by finding the localized version of README.html - // This prepares if a new locale in JDK is supported in - // e.g. in the OpenSource world - FilenameFilter ff = new FilenameFilter() { - public boolean accept(File dir, String name) { - String fname = name.toLowerCase(); - if (fname.startsWith("readme") && fname.endsWith(".html")) { - return true; - } - return false; - } - }; - - String[] readmes = jdkDir.list(ff); - for (String name : readmes) { - String basename = name.substring(0, name.length() - ".html".length()); - String[] ss = basename.split("_"); - switch (ss.length) { - case 1: - // English version - break; - case 2: - supportedLocales.add(new Locale(ss[1])); - break; - case 3: - supportedLocales.add(new Locale(ss[1], ss[2])); - break; - default: - // ignore - break; - } - } - if (isVerbose()) { - System.out.println("Supported locales: "); - for (Locale l : supportedLocales) { - System.out.println(l); - } - } - } - - private static final String JDK_HEADER_PNG_KEY = "@@JDK_HEADER_PNG@@"; - private static final String JDK_VERSION_KEY = "@@JDK_VERSION@@"; - private static final String REGISTRATION_URL_KEY = "@@REGISTRATION_URL@@"; - private static final String REGISTRATION_PAYLOAD_KEY = "@@REGISTRATION_PAYLOAD@@"; - - @SuppressWarnings("unchecked") - private static void generateRegisterHtml(String parent) throws IOException { - int version = Util.getJdkVersion(); - int update = Util.getUpdateVersion(); - String jdkVersion = "Version " + version; - if (update > 0) { - // product name is not translated - jdkVersion += " Update " + update; - } - RegistrationData regData = getRegistrationData(); - String registerURL = SunConnection.getRegistrationURL( - regData.getRegistrationURN()).toString(); - // Make sure it uses the canonical path before getting the URI. - File img = new File(svcTagDir.getCanonicalPath(), "jdk_header.png"); - String headerImageSrc = img.toURI().toString(); - - // Format the registration data in one single line - StringBuilder payload = new StringBuilder(); - String xml = regData.toString().replaceAll("\"", "%22"); - BufferedReader reader = new BufferedReader(new StringReader(xml)); - try { - String line = null; - while ((line = reader.readLine()) != null) { - payload.append(line.trim()); - } - } finally { - reader.close(); - } - - String resourceFilename = "/com/sun/servicetag/resources/register"; - for (Locale locale : supportedLocales) { - String name = REGISTRATION_HTML_NAME; - String resource = resourceFilename; - if (!locale.equals(Locale.ENGLISH)) { - name += "_" + locale.toString(); - resource += "_" + locale.toString(); - } - File f = new File(parent, name + ".html"); - InputStream in = null; - BufferedReader br = null; - PrintWriter pw = null; - try { - in = Installer.class.getClass().getResourceAsStream(resource + ".html"); - if (in == null) { - // if the resource file is missing - if (isVerbose()) { - System.out.println("Missing resouce file: " + resource + ".html"); - } - continue; - } - if (isVerbose()) { - System.out.println("Generating " + f + " from " + resource + ".html"); - } - - br = new BufferedReader(new InputStreamReader(in, "UTF-8")); - pw = new PrintWriter(f, "UTF-8"); - String line = null; - while ((line = br.readLine()) != null) { - String output = line; - if (line.contains(JDK_VERSION_KEY)) { - output = line.replace(JDK_VERSION_KEY, jdkVersion); - } else if (line.contains(JDK_HEADER_PNG_KEY)) { - output = line.replace(JDK_HEADER_PNG_KEY, headerImageSrc); - } else if (line.contains(REGISTRATION_URL_KEY)) { - output = line.replace(REGISTRATION_URL_KEY, registerURL); - } else if (line.contains(REGISTRATION_PAYLOAD_KEY)) { - output = line.replace(REGISTRATION_PAYLOAD_KEY, payload.toString()); - } - pw.println(output); - } - f.setReadOnly(); - pw.flush(); - } finally { - if (pw != null) { - pw.close(); - } - if (in != null) { - in.close(); - } - if (br!= null) { - br.close(); - } - } - } - } - - /** - * A utility class to create a service tag for Java SE. - * <p> - * <b>Usage:</b><br> - * <blockquote><tt> - * <JAVA_HOME>/bin/java com.sun.servicetag.Installer - * </tt></blockquote> - * <p> - */ - public static void main(String[] args) { - String source = "Manual"; - - // Parse the options (arguments starting with "-" ) - boolean delete = false; - boolean update = false; - boolean register = false; - int count = 0; - while (count < args.length) { - String arg = args[count]; - if (arg.trim().length() == 0) { - // skip empty arguments - count++; - continue; - } - - if (arg.equals("-source")) { - source = args[++count]; - } else if (arg.equals("-delete")) { - delete = true; - } else if (arg.equals("-register")) { - register = true; - } else { - usage(); - return; - } - count++; - } - try { - if (delete) { - deleteRegistrationData(); - } else { - ServiceTag[] javaSvcTags = getJavaServiceTagArray(); - String[] archs = getJreArchs(); - if (javaSvcTags.length > archs.length) { - // 64-bit has been uninstalled - // so remove the service tag - updateRegistrationData(source); - } else { - // create the service tag - createServiceTag(source); - } - } - - if (register) { - // Registration is only supported by JDK - // For testing purpose, override with a "servicetag.enable.registration" property - - RegistrationData regData = getRegistrationData(); - if (supportRegistration && !regData.getServiceTags().isEmpty()) { - SunConnection.register(regData); - } - } - System.exit(0); - } catch (IOException e) { - System.err.println("I/O Error: " + e.getMessage()); - if (isVerbose()) { - e.printStackTrace(); - } - } catch (IllegalArgumentException ex) { - if (isVerbose()) { - ex.printStackTrace(); - } - } catch (Exception e) { - System.err.println("Error: " + e.getMessage()); - if (isVerbose()) { - e.printStackTrace(); - } - } - System.exit(1); - } - - private static void usage() { - System.out.println("Usage:"); - System.out.print(" " + Installer.class.getName()); - System.out.println(" [-delete|-source <source>|-register]"); - System.out.println(" to create a service tag for the Java platform"); - System.out.println(""); - System.out.println("Internal Options:"); - System.out.println(" -source: to specify the source of the service tag to be created"); - System.out.println(" -delete: to delete the service tag "); - System.out.println(" -register: to register the JDK"); - System.out.println(" -help: to print this help message"); - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java deleted file mode 100644 index e921dadd3d1a..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java +++ /dev/null @@ -1,319 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - - -package com.sun.star.servicetag; - -// The Service Tags team maintains the latest version of the implementation -// for system environment data collection. JDK will include a copy of -// the most recent released version for a JDK release. We rename -// the package to com.sun.servicetag so that the Sun Connection -// product always uses the latest version from the com.sun.scn.servicetags -// package. JDK and users of the com.sun.servicetag API -// (e.g. NetBeans and SunStudio) will use the version in JDK. - -import java.io.*; -import java.util.*; - -/** - * Linux implementation of the SystemEnvironment class. - */ -class LinuxSystemEnvironment extends SystemEnvironment { - LinuxSystemEnvironment() { - setHostId(getLinuxHostId()); - - setSystemModel(getLinuxModel()); - setSystemManufacturer(getLinuxSystemManufacturer()); - setCpuManufacturer(getLinuxCpuManufacturer()); - setSerialNumber(getLinuxSN()); - setPhysMem(getLinuxPhysMem()); - setSockets(getLinuxSockets()); - setCores(getLinuxCores()); - setVirtCpus(getLinuxVirtCpus()); - setCpuName(getLinuxCpuName()); - setClockRate(getLinuxClockRate()); - } - private String dmiInfo = null; - private String kstatCpuInfo = null; - - private static final int SN = 1; - private static final int SYS = 2; - private static final int CPU = 3; - private static final int MODEL = 4; - - private String getLinuxHostId() { - String output = getCommandOutput("/usr/bin/hostid"); - // trim off the leading 0x - if (output.startsWith("0x")) { - output = output.substring(2); - } - return output; - } - - /** - * Tries to obtain and return the cpu manufacturer. - * @return The cpu manufacturer (an empty string if not found or an error occurred) - */ - private String getLinuxCpuManufacturer() { - String tmp = getLinuxPSNInfo(CPU); - if (tmp.length() > 0) { - return tmp; - } - - String contents = getFileContent("/proc/cpuinfo"); - for (String line : contents.split("\n")) { - if (line.contains("vendor_id")) { - String[] ss = line.split(":", 2); - if (ss.length > 1) { - return ss[1].trim(); - } - } - } - - // returns an empty string if it can't be found or an error happened - return getLinuxDMIInfo("dmi type 4", "manufacturer"); - } - - private String getLinuxModel() { - String tmp = getLinuxPSNInfo(MODEL); - if (tmp.length() > 0) { - return tmp + "::" + getCommandOutput("/bin/uname","-v"); - } - - tmp = getLinuxDMIInfo("dmi type 1", "product name"); - if (tmp.length() > 0) { - return tmp + "::" + getCommandOutput("/bin/uname","-v"); - } - - return getCommandOutput("/bin/uname","-i") - + "::" + getCommandOutput("/bin/uname","-v"); - } - - - /** - * Tries to obtain and return the system manufacturer. - * @return The system manufacturer (an empty string if not found or an error occurred) - */ - private String getLinuxSystemManufacturer() { - String tmp = getLinuxPSNInfo(SYS); - if (tmp.length() > 0) { - return tmp; - } - - // returns an empty string if it can't be found or an error happened - return getLinuxDMIInfo("dmi type 1", "manufacturer"); - } - - /** - * Tries to obtain and return the serial number of the system. - * @return The serial number (an empty string if not found or an error occurred) - */ - private String getLinuxSN() { - String tmp = getLinuxPSNInfo(SN); - if (tmp.length() > 0) { - return tmp; - } - - // returns an empty string if it can't be found or an error happened - return getLinuxDMIInfo("dmi type 1", "serial number"); - } - - private String getLinuxPSNInfo(int target) { - // try to read from the psn file if it exists - String contents = getFileContent("/var/run/psn"); - String[] ss = contents.split("\n"); - if (target <= ss.length) { - return ss[target-1]; - } - - // default case is to return "" - return ""; - } - - // reads from dmidecode with the given type and target - // returns an empty string if nothing was found or an error occurred - // - // Sample output segment: - // Handle 0x0001 - // DMI type 1, 25 bytes. - // System Information - // Manufacturer: System manufacturer - // Product Name: System Product Name - // Version: System Version - // Serial Number: System Serial Number - // UUID: 3091D719-B25B-D911-959D-6D1B12C7686E - // Wake-up Type: Power Switch - - private synchronized String getLinuxDMIInfo(String dmiType, String target) { - // only try to get dmidecode information once, after that, we can - // reuse the output - if (dmiInfo == null) { - Thread dmidecodeThread = new Thread() { - public void run() { - dmiInfo = getCommandOutput("/usr/sbin/dmidecode"); - } - }; - dmidecodeThread.start(); - - try { - dmidecodeThread.join(3000); - if (dmidecodeThread.isAlive()) { - dmidecodeThread.interrupt(); - dmiInfo = ""; - } - } catch (InterruptedException ie) { - dmidecodeThread.interrupt(); - } - } - - if (dmiInfo.length() == 0) { - return ""; - } - boolean dmiFlag = false; - for (String s : dmiInfo.split("\n")) { - String line = s.toLowerCase(); - if (dmiFlag) { - if (line.contains(target)) { - String key = target + ":"; - int indx = line.indexOf(key) + key.length(); - if (line.contains(key) && indx < line.length()) { - return line.substring(indx).trim(); - } - String[] ss = line.split(":"); - return ss[ss.length-1]; - } - } else if (line.contains(dmiType)) { - dmiFlag = true; - } - } - return ""; - } - - private String getLinuxClockRate() { - String contents = getFileContent("/proc/cpuinfo"); - String token = "cpu MHz"; - for (String line : contents.split("\n")) { - if (line.contains(token)) { - String[] key = line.split(":", 2); - if (key.length > 1) { - return key[1].trim(); - } - } - } - return ""; - } - - private String getLinuxCpuName() { - String contents = getFileContent("/proc/cpuinfo"); - String token = "model name"; - for (String line : contents.split("\n")) { - if (line.contains(token)) { - String[] key = line.split(":", 2); - if (key.length > 1) { - return key[1].trim(); - } - } - } - return ""; - } - - private String getLinuxVirtCpus() { - Set<String> set = new HashSet<String>(); - String contents = getFileContent("/proc/cpuinfo"); - String token = "processor"; - for (String line : contents.split("\n")) { - if (line.contains(token)) { - String[] key = line.split(":", 2); - if (key.length > 1) { - set.add(key[1].trim()); - } - } - } - return "" + set.size(); - } - - private String getLinuxCores() { - Set<String> set = new HashSet<String>(); - String contents = getFileContent("/proc/cpuinfo"); - String token = "core id"; - for (String line : contents.split("\n")) { - if (line.contains(token)) { - String[] key = line.split(":", 2); - if (key.length > 1) { - set.add(key[1].trim()); - } - } - } - if (set.size() == 0) { - return "1"; - } - return "" + set.size(); - } - - private String getLinuxPhysMem() { - String contents = getFileContent("/proc/meminfo"); - for (String line : contents.split("\n")) { - if (line.contains("MemTotal")) { - String[] total = line.split(":", 2); - if (total.length > 1) { - String[] mem = total[1].trim().split(" "); - if (mem.length >= 1) { - return mem[0].trim(); - } else { - return total[1].trim(); - } - } - } - } - - return ""; - } - - private String getLinuxSockets() { - Set<String> physIdSet = new HashSet<String>(); - Set<String> procSet = new HashSet<String>(); - String contents = getFileContent("/proc/cpuinfo"); - String physIdToken = "physical id"; - String procToken = "processor"; - - for (String line : contents.split("\n")) { - if (line.contains(physIdToken)) { - String[] key = line.split(":", 2); - if (key.length > 1) { - physIdSet.add(key[1].trim()); - } - } - - if (line.contains(procToken)) { - String[] key = line.split(":", 2); - if (key.length > 1) { - procSet.add(key[1].trim()); - } - } - } - if (physIdSet.size() != 0) { - return "" + physIdSet.size(); - } - return "" + procSet.size(); - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java b/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java deleted file mode 100644 index 900bc4058d6f..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java +++ /dev/null @@ -1,516 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - -package com.sun.star.servicetag; - -import java.io.*; -import java.net.UnknownHostException; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; - -import static com.sun.star.servicetag.RegistrationDocument.*; - -/** - * A {@code RegistrationData} object is a container of one or more - * {@link #getServiceTags service tags} that identify the - * components for product registration. - * Each {@code RegistrationData} object has a {@link #getRegistrationURN - * uniform resource name} (URN) as its identifier. - * <a name="EnvMap"></a> - * It also has an <i>environment map</i> with - * the following elements: - * <blockquote> - * <table border=0> - * <tr> - * <td><tt>hostname</tt></td> - * <td>Hostname of the system</td> - * <td>e.g. woody</td> - * </tr> - * <tr> - * <td><tt>hostId</tt></td> - * <td>Host ID of the system</td> - * <td>e.g. 83abc1ab</td> - * </tr> - * <tr> - * <td><tt>osName</tt></td> - * <td>Operating system name</td> - * <td> e.g. SunOS</td> - * </tr> - * <tr> - * <td><tt>osVersion</tt></td> - * <td>Operating system version</td> - * <td> e.g. 5.10</td> - * </tr> - * <tr> - * <td><tt>osArchitecture</tt></td> - * <td>Operating system architecture</td> - * <td> e.g. sparc</td> - * </tr> - * <tr> - * <td><tt>systemModel</tt></td> - * <td>System model</td> - * <td> e.g. SUNW,Sun-Fire-V440</td> - * </tr> - * <tr> - * <td><tt>systemManufacturer</tt></td> - * <td>System manufacturer</td> - * <td> e.g. Sun Microsystems</td> - * </tr> - * <tr> - * <td><tt>cpuManufacturer</tt></td> - * <td>CPU manufacturer</td> - * <td> e.g. Sun Microsystems</td> - * </tr> - * <tr> - * <td><tt>serialNumber</tt></td> - * <td>System serial number</td> - * <td> e.g. BEL078932</td> - * </tr> - * <tr> - * <td><tt>physmem</tt></td> - * <td>Physical memory for the system (in MB)</td> - * <td> e.g. 4096</td> - * </tr> - * </table> - * </blockquote> - * The <tt>hostname</tt> and <tt>osName</tt> element must have a non-empty value. - * If an element is not available on a system and their value will be - * empty. - * <p> - * <a name="XMLSchema"> - * <b>Registration XML Schema</b></a> - * <p> - * A {@code RegistrationData} object can be {@link #loadFromXML loaded} from - * and {@link #storeToXML stored} into an XML file in the format described - * by the - * <a href="https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/product_registration.xsd"> - * registration data schema</a>. The registration data schema is defined by the - * Service Tags Technology. - * <p> - * Typically the registration data is constructed at installation time - * and stored in an XML file for later service tag lookup or registration. - * - * <p> - * <b>Example Usage</b> - * <p> - * The examples below show how the {@code RegistrationData} can be - * used for product registration. - * Exception handling is not shown in these examples for clarity. - * <ol> - * <li>This example shows how the JDK creates a JDK service tag, installs it - * in the system service tag registry and adds it to the registration data. - * <br> - * <blockquote><pre> - * // create a service tag object with an instance_urn - * ServiceTag st = ServiceTag.newInstance(ServiceTag.generateInstanceURN(), - * ....); - * // Adds to the system service tag registry if supported - * if (Registry.isSupported()) { - * Registry.getSystemRegistry().addServiceTag(st); - * } - * - * // add to the registration data - * RegistrationData registration = new RegistrationData(); - * registration.addServiceTag(st); - * </pre></blockquote> - * </li> - * <li>At this point, the registration data is ready to - * send to Sun Connection for registration. This example shows how to register - * the JDK via the <i>Registration Relay Service</i>. - * <p> - * There are several registration services for Sun Connection. For example, - * the <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/RegistrationRelayService"> - * Registration Relay Service</a> is a web application interface that - * processes the registration data payload sent via HTTP post - * and hosts the registration user interface for a specified - * registration URL. Refer to the - * Registration Relay Service Specification for details. - * <p> - * <blockquote><pre> - * // Open the connection to the URL of the registration service - * HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); - * con.setDoInput(true); - * con.setDoOutput(true); - * con.setUseCaches(false); - * con.setAllowUserInteraction(false); - * con.setRequestMethod("POST"); - * con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\""); - * con.connect(); - * - * // send the registration data to the registration service - * OutputStream out = con.getOutputStream(); - * registration.storeToXML(out); - * out.close(); - * </pre></blockquote> - * </li> - * <li>This example shows how to store the registration data in an XML file. - * for later service tag lookup or registration. - * <br> - * <blockquote><pre> - * BufferedOutputStream out = new BufferedOutputStream( - * new FileOutputStream(""<JAVA_HOME>/lib/servicetag/registration.xml")); - * registration.storeToXML(out); - * out.close(); - * </pre></blockquote> - * </li> - * <li>This example shows how to install service tags that are in the - * registration data in the system service tag registry when determined - * to be available. The system service tag registry might not have existed - * when the registration data was constructed. - * <br> - * <blockquote><pre> - * if (Registry.isSupported()) { - * Set<ServiceTag> svctags = registration.getServiceTags(); - * for (ServiceTag st : svctags) { - * Registry.getSystemRegistry().addServiceTag(st); - * } - * } - * </pre></blockquote> - * </li> - * </ol> - * - * @see <a href="https://sunconnection.sun.com/inventory">Sun Connection Inventory Channel</a> - */ -public class RegistrationData { - private final Map<String, String> environment; - private final Map<String, String> cpuInfo; - private final Map<String, ServiceTag> svcTagMap; - private final String urn; - - /** - * Creates a {@code RegistrationData} object with a generated - * {@link #getRegistrationURN registration URN}. - * The following keys in the {@link #getEnvironmentMap environment map} - * will be initialized for the configuration of the - * running system: - * <blockquote> - * <tt>hostname</tt>, <tt>osName</tt>, <tt>osVersion</tt> and - * <tt>osArchitecture</tt> - * </blockquote> - * and the value of other keys may be empty. - */ - public RegistrationData() { - this(Util.generateURN()); - } - - // package private - RegistrationData(String urn) { - this.urn = urn; - SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment(); - this.environment = initEnvironment(sysEnv); - this.cpuInfo = initCpuInfo(sysEnv); - this.svcTagMap = new LinkedHashMap<String, ServiceTag>(); - } - - private Map<String, String> initEnvironment(SystemEnvironment sysEnv) { - Map<String, String> map = new LinkedHashMap<String, String>(); - map.put(ST_NODE_HOSTNAME, sysEnv.getHostname()); - map.put(ST_NODE_HOST_ID, sysEnv.getHostId()); - map.put(ST_NODE_OS_NAME, sysEnv.getOsName()); - map.put(ST_NODE_OS_VERSION, sysEnv.getOsVersion()); - map.put(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture()); - map.put(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel()); - map.put(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer()); - map.put(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer()); - map.put(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber()); - map.put(ST_NODE_PHYS_MEM, sysEnv.getPhysMem()); - return map; - } - - private Map<String, String> initCpuInfo(SystemEnvironment sysEnv) { - Map<String, String> map = new LinkedHashMap<String, String>(); - map.put(ST_NODE_SOCKETS, sysEnv.getSockets()); - map.put(ST_NODE_CORES, sysEnv.getCores()); - map.put(ST_NODE_VIRT_CPUS, sysEnv.getVirtCpus()); - map.put(ST_NODE_CPU_NAME, sysEnv.getCpuName()); - map.put(ST_NODE_CLOCK_RATE, sysEnv.getClockRate()); - return map; - } - - /** - * Returns the uniform resource name of this registration data - * in this format: - * <tt>urn:st:<32-char {@link java.util.UUID uuid}></tt> - * - * @return the URN of this registration data. - */ - public String getRegistrationURN() { - return urn; - } - - /** - * Returns a map containing the environment information for this - * registration data. See the set of <a href="#EnvMap">keys</a> - * in the environment map. Subsequent update to the environment - * map via the {@link #setEnvironment setEnvironment} method will not be reflected - * in the returned map. - * - * @return an environment map for this registration data. - */ - public Map<String, String> getEnvironmentMap() { - return new LinkedHashMap<String,String>(environment); - } - - /** - * Returns a map containing the cpu information for this - * registration data. Subsequent update to the cpu info - * map via the {@link #setCpuInfo setCpuInfo} method will not be reflected - * in the returned map. - * - * @return a cpu info map for this registration data. - */ - public Map<String, String> getCpuInfoMap() { - return new LinkedHashMap<String,String>(cpuInfo); - } - - /** - * Sets an element of the specified {@code name} in the environment map - * with the given {@code value}. - * - * @throws IllegalArgumentException if {@code name} is not a valid key - * in the environment map, or {@code value} is not valid. - */ - public void setEnvironment(String name, String value) { - if (name == null) { - throw new NullPointerException("name is null"); - } - if (value == null) { - throw new NullPointerException("value is null"); - } - if (environment.containsKey(name)) { - if (name.equals(ST_NODE_HOSTNAME) || name.equals(ST_NODE_OS_NAME)) { - if (value.length() == 0) { - throw new IllegalArgumentException("\"" + - name + "\" requires non-empty value."); - } - } - environment.put(name, value); - } else { - throw new IllegalArgumentException("\"" + - name + "\" is not an environment element."); - } - } - - /** - * Sets an element of the specified {@code name} in the cpu info map - * with the given {@code value}. - * - * @throws IllegalArgumentException if {@code name} is not a valid key - * in the cpu info map, or {@code value} is not valid. - */ - public void setCpuInfo(String name, String value) { - if (name == null) { - throw new NullPointerException("name is null"); - } - if (value == null) { - throw new NullPointerException("value is null"); - } - if (cpuInfo.containsKey(name)) { - cpuInfo.put(name, value); - } else { - throw new IllegalArgumentException("\"" + - name + "\" is not an cpuinfo element."); - } - } - - /** - * Returns all service tags in this registration data. - * - * @return a {@link Set Set} of the service tags - * in this registration data. - */ - public Set<ServiceTag> getServiceTags() { - return new HashSet<ServiceTag>(svcTagMap.values()); - } - - /** - * Adds a service tag to this registration data. - * If the given service tag has an empty <tt>instance_urn</tt>, - * this method will generate a URN and place it in the copy - * of the service tag in this registration data. - * This method will return the {@code ServiceTag} object - * added to this registration data. - * - * @param st {@code ServiceTag} object to be added. - * @return a {@code ServiceTag} object added to this registration data. - * - * @throws IllegalArgumentException if - * a service tag of the same {@link ServiceTag#getInstanceURN - * <tt>instance_urn</tt>} already exists in the registry. - */ - public synchronized ServiceTag addServiceTag(ServiceTag st) { - ServiceTag svcTag = ServiceTag.newInstanceWithUrnTimestamp(st); - - String instanceURN = svcTag.getInstanceURN(); - if (svcTagMap.containsKey(instanceURN)) { - throw new IllegalArgumentException("Instance_urn = " + instanceURN + - " already exists in the registration data."); - } else { - svcTagMap.put(instanceURN, svcTag); - } - return svcTag; - } - - /** - * Returns a service tag of the given <tt>instance_urn</tt> in this registration - * data. - * - * @param instanceURN the <tt>instance_urn</tt> of the service tag - * @return the {@code ServiceTag} object of the given <tt>instance_urn</tt> - * if exists; otherwise return {@code null}. - */ - public synchronized ServiceTag getServiceTag(String instanceURN) { - if (instanceURN == null) { - throw new NullPointerException("instanceURN is null"); - } - return svcTagMap.get(instanceURN); - } - - /** - * Removes a service tag of the given <tt>instance_urn</tt> from this - * registration data. - * - * @param instanceURN the <tt>instance_urn</tt> of - * the service tag to be removed. - * - * @return the removed {@code ServiceTag} object; - * or {@code null} if the service tag does not exist in this - * registration data. - */ - public synchronized ServiceTag removeServiceTag(String instanceURN) { - if (instanceURN == null) { - throw new NullPointerException("instanceURN is null"); - } - - ServiceTag svcTag = null; - if (svcTagMap.containsKey(instanceURN)) { - svcTag = svcTagMap.remove(instanceURN); - } - return svcTag; - } - - /** - * Updates the <tt>product_defined_instance_id</tt> in the service tag - * of the given <tt>instance_urn</tt> in this registration data. - * - * @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated. - * @param productDefinedInstanceID the value of the - * <tt>product_defined_instance_id</tt> to be set. - * - * @return the updated {@code ServiceTag} object; - * or {@code null} if the service tag does not exist in this - * registration data. - */ - public synchronized ServiceTag updateServiceTag(String instanceURN, - String productDefinedInstanceID) { - ServiceTag svcTag = getServiceTag(instanceURN); - if (svcTag == null) { - return null; - } - - svcTag = ServiceTag.newInstanceWithUrnTimestamp(svcTag); - // update the product defined instance ID field - svcTag.setProductDefinedInstanceID(productDefinedInstanceID); - svcTagMap.put(instanceURN, svcTag); - return svcTag; - } - - /** - * Reads the registration data from the XML document on the - * specified input stream. The XML document must be - * in the format described by the <a href="#XMLSchema"> - * registration data schema</a>. - * The specified stream is closed after this method returns. - * - * @param in the input stream from which to read the XML document. - * @return a {@code RegistrationData} object read from the input - * stream. - * - * @throws IllegalArgumentException if the input stream - * contains an invalid registration data. - * - * @throws IOException if an error occurred when reading from the input stream. - */ - public static RegistrationData loadFromXML(InputStream in) throws IOException { - try { - return RegistrationDocument.load(in); - } finally { - in.close(); - } - } - - /** - * Writes the registration data to the specified output stream - * in the format described by the <a href="#XMLSchema"> - * registration data schema</a> with "UTF-8" encoding. - * The specified stream remains open after this method returns. - * - * @param os the output stream on which to write the XML document. - * - * @throws IOException if an error occurred when writing to the output stream. - */ - public void storeToXML(OutputStream os) throws IOException { - RegistrationDocument.store(os, this); - os.flush(); - } - - /** - * Returns a newly allocated byte array containing the registration - * data in XML format. - * - * @return a newly allocated byte array containing the registration - * data in XML format. - */ - public byte[] toXML() { - try { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - storeToXML(out); - return out.toByteArray(); - } catch (IOException e) { - // should not reach here - return new byte[0]; - } - } - - /** - * Returns a string representation of this registration data in XML - * format. - * - * @return a string representation of this registration data in XML - * format. - */ - @Override - public String toString() { - try { - ByteArrayOutputStream out = new ByteArrayOutputStream(); - storeToXML(out); - return out.toString("UTF-8"); - } catch (IOException e) { - // should not reach here - return "Error creating the return string."; - } - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java b/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java deleted file mode 100644 index 48b46383b712..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java +++ /dev/null @@ -1,424 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - -package com.sun.star.servicetag; - -import java.io.*; -import java.net.URL; -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; -import org.xml.sax.InputSource; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.validation.Schema; -import javax.xml.validation.SchemaFactory; -import javax.xml.validation.Validator; - -// For write operation -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; - -/** - * XML Support Class for Product Registration. - */ -class RegistrationDocument { - - private static final String REGISTRATION_DATA_SCHEMA = - "/com/sun/star/servicetag/resources/product_registration.xsd"; - private static final String REGISTRATION_DATA_VERSION = "1.0"; - private static final String SERVICE_TAG_VERSION = "1.0"; - final static String ST_NODE_REGISTRATION_DATA = "registration_data"; - final static String ST_ATTR_REGISTRATION_VERSION = "version"; - final static String ST_NODE_ENVIRONMENT = "environment"; - final static String ST_NODE_HOSTNAME = "hostname"; - final static String ST_NODE_HOST_ID = "hostId"; - final static String ST_NODE_OS_NAME = "osName"; - final static String ST_NODE_OS_VERSION = "osVersion"; - final static String ST_NODE_OS_ARCH = "osArchitecture"; - final static String ST_NODE_SYSTEM_MODEL = "systemModel"; - final static String ST_NODE_SYSTEM_MANUFACTURER = "systemManufacturer"; - final static String ST_NODE_CPU_MANUFACTURER = "cpuManufacturer"; - final static String ST_NODE_SERIAL_NUMBER = "serialNumber"; - final static String ST_NODE_PHYS_MEM = "physmem"; - final static String ST_NODE_CPU_INFO = "cpuinfo"; - final static String ST_NODE_SOCKETS = "sockets"; - final static String ST_NODE_CORES = "cores"; - final static String ST_NODE_VIRT_CPUS = "virtcpus"; - final static String ST_NODE_CPU_NAME = "name"; - final static String ST_NODE_CLOCK_RATE = "clockrate"; - final static String ST_NODE_REGISTRY = "registry"; - final static String ST_ATTR_REGISTRY_URN = "urn"; - final static String ST_ATTR_REGISTRY_VERSION = "version"; - final static String ST_NODE_SERVICE_TAG = "service_tag"; - final static String ST_NODE_INSTANCE_URN = "instance_urn"; - final static String ST_NODE_PRODUCT_NAME = "product_name"; - final static String ST_NODE_PRODUCT_VERSION = "product_version"; - final static String ST_NODE_PRODUCT_URN = "product_urn"; - final static String ST_NODE_PRODUCT_PARENT_URN = "product_parent_urn"; - final static String ST_NODE_PRODUCT_PARENT = "product_parent"; - final static String ST_NODE_PRODUCT_DEFINED_INST_ID = "product_defined_inst_id"; - final static String ST_NODE_PRODUCT_VENDOR = "product_vendor"; - final static String ST_NODE_PLATFORM_ARCH = "platform_arch"; - final static String ST_NODE_TIMESTAMP = "timestamp"; - final static String ST_NODE_CONTAINER = "container"; - final static String ST_NODE_SOURCE = "source"; - final static String ST_NODE_INSTALLER_UID = "installer_uid"; - - static RegistrationData load(InputStream in) throws IOException { - Document document = initializeDocument(in); - - // Gets the registration URN - Element root = getRegistrationDataRoot(document); - Element registryRoot = - getSingletonElementFromRoot(root, ST_NODE_REGISTRY); - String urn = registryRoot.getAttribute(ST_ATTR_REGISTRY_URN); - - // Construct a new RegistrationData object from the DOM tree - // Initialize the environment map and service tags - RegistrationData regData = new RegistrationData(urn); - addServiceTags(registryRoot, regData); - - Element envRoot = getSingletonElementFromRoot(root, ST_NODE_ENVIRONMENT); - buildEnvironmentMap(envRoot, regData); - - Element cpuInfo = getSingletonElementFromRoot(envRoot, ST_NODE_CPU_INFO); - buildCpuInfoMap(cpuInfo, regData); - return regData; - } - - static void store(OutputStream os, RegistrationData registration) - throws IOException { - // create a new document with the root node - Document document = initializeDocument(); - - // create the nodes for the environment map and the service tags - // in the registration data - addEnvironmentNodes(document, - registration.getEnvironmentMap(), - registration.getCpuInfoMap()); - addServiceTagRegistry(document, - registration.getRegistrationURN(), - registration.getServiceTags()); - transform(document, os); - } - - // initialize a document from an input stream - private static Document initializeDocument(InputStream in) throws IOException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - SchemaFactory sf = null; - try { - // Some Java versions (e.g., 1.5.0_06-b05) fail with a - // NullPointerException if SchemaFactory.newInstance is called with - // a null context class loader, so work around that here (and the - // class loader of this class hopefully is not the null bootstrap - // class loader): - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) { - Thread.currentThread().setContextClassLoader( - RegistrationDocument.class.getClassLoader()); - } - try { - sf = SchemaFactory.newInstance( - XMLConstants.W3C_XML_SCHEMA_NS_URI); - } finally { - Thread.currentThread().setContextClassLoader(cl); - } - - Schema schema = null; - try { - // Even using the workaround above is not enough on some - // Java versions. Therefore try to workaround the validation - // completely! - URL xsdUrl = RegistrationDocument.class.getResource(REGISTRATION_DATA_SCHEMA); - schema = sf.newSchema(xsdUrl); - } - catch (NullPointerException nex) { - } - - Validator validator = null; - if (schema != null) - validator = schema.newValidator(); - - DocumentBuilder builder = factory.newDocumentBuilder(); - Document doc = builder.parse(new InputSource(in)); - - if (validator != null) - validator.validate(new DOMSource(doc)); - - return doc; - } catch (SAXException sxe) { - IllegalArgumentException e = new IllegalArgumentException("Error generated in parsing"); - e.initCause(sxe); - throw e; - } catch (ParserConfigurationException pce) { - // Parser with specific options can't be built - // should not reach here - InternalError x = new InternalError("Error in creating the new document"); - x.initCause(pce); - throw x; - } - } - - // initialize a new document for the registration data - private static Document initializeDocument() throws IOException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - try { - DocumentBuilder builder = factory.newDocumentBuilder(); - Document doc = builder.newDocument(); - - // initialize the document with the registration_data root - Element root = doc.createElement(ST_NODE_REGISTRATION_DATA); - doc.appendChild(root); - root.setAttribute(ST_ATTR_REGISTRATION_VERSION, REGISTRATION_DATA_VERSION); - - return doc; - } catch (ParserConfigurationException pce) { - // Parser with specified options can't be built - // should not reach here - InternalError x = new InternalError("Error in creating the new document"); - x.initCause(pce); - throw x; - } - } - - // Transform the current DOM tree with the given output stream. - private static void transform(Document document, OutputStream os) { - try { - // Use a Transformer for output - TransformerFactory tFactory = TransformerFactory.newInstance(); - tFactory.setAttribute("indent-number", new Integer(3)); - - Transformer transformer = tFactory.newTransformer(); - - transformer.setOutputProperty(OutputKeys.INDENT, "yes"); - transformer.setOutputProperty(OutputKeys.METHOD, "xml"); - transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); - transformer.setOutputProperty(OutputKeys.STANDALONE, "yes"); - transformer.transform(new DOMSource(document), - new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8")))); - } catch (UnsupportedEncodingException ue) { - // Should not reach here - InternalError x = new InternalError("Error generated during transformation"); - x.initCause(ue); - throw x; - } catch (TransformerConfigurationException tce) { - // Error generated by the parser - // Should not reach here - InternalError x = new InternalError("Error in creating the new document"); - x.initCause(tce); - throw x; - } catch (TransformerException te) { - // Error generated by the transformer - InternalError x = new InternalError("Error generated during transformation"); - x.initCause(te); - throw x; - } - } - - private static void addServiceTagRegistry(Document document, - String registryURN, - Set<ServiceTag> svcTags) { - // add service tag registry node and its attributes - Element reg = document.createElement(ST_NODE_REGISTRY); - reg.setAttribute(ST_ATTR_REGISTRY_URN, registryURN); - reg.setAttribute(ST_ATTR_REGISTRY_VERSION, SERVICE_TAG_VERSION); - - Element root = getRegistrationDataRoot(document); - root.appendChild(reg); - - // adds the elements for the service tags - for (ServiceTag st : svcTags) { - addServiceTagElement(document, reg, st); - } - } - - private static void addServiceTagElement(Document document, - Element registryRoot, - ServiceTag st) { - Element svcTag = document.createElement(ST_NODE_SERVICE_TAG); - registryRoot.appendChild(svcTag); - addChildElement(document, svcTag, - ST_NODE_INSTANCE_URN, st.getInstanceURN()); - addChildElement(document, svcTag, - ST_NODE_PRODUCT_NAME, st.getProductName()); - addChildElement(document, svcTag, - ST_NODE_PRODUCT_VERSION, st.getProductVersion()); - addChildElement(document, svcTag, - ST_NODE_PRODUCT_URN, st.getProductURN()); - addChildElement(document, svcTag, - ST_NODE_PRODUCT_PARENT_URN, st.getProductParentURN()); - addChildElement(document, svcTag, - ST_NODE_PRODUCT_PARENT, st.getProductParent()); - addChildElement(document, svcTag, - ST_NODE_PRODUCT_DEFINED_INST_ID, - st.getProductDefinedInstanceID()); - addChildElement(document, svcTag, - ST_NODE_PRODUCT_VENDOR, st.getProductVendor()); - addChildElement(document, svcTag, - ST_NODE_PLATFORM_ARCH, st.getPlatformArch()); - addChildElement(document, svcTag, - ST_NODE_TIMESTAMP, Util.formatTimestamp(st.getTimestamp())); - addChildElement(document, svcTag, - ST_NODE_CONTAINER, st.getContainer()); - addChildElement(document, svcTag, - ST_NODE_SOURCE, st.getSource()); - addChildElement(document, svcTag, - ST_NODE_INSTALLER_UID, - String.valueOf(st.getInstallerUID())); - } - - private static void addChildElement(Document document, Element root, - String element, String text) { - Element node = document.createElement(element); - node.appendChild(document.createTextNode(text)); - root.appendChild(node); - } - - // Constructs service tags from the document - private static void addServiceTags(Element registryRoot, - RegistrationData registration) { - NodeList children = registryRoot.getElementsByTagName(ST_NODE_SERVICE_TAG); - int length = (children == null ? 0 : children.getLength()); - for (int i = 0; i < length; i++) { - Element svcTagElement = (Element) children.item(i); - ServiceTag st = getServiceTag(svcTagElement); - registration.addServiceTag(st); - } - } - - // build environment map from the document - private static void buildEnvironmentMap(Element envRoot, - RegistrationData registration) { - registration.setEnvironment(ST_NODE_HOSTNAME, getTextValue(envRoot, ST_NODE_HOSTNAME)); - registration.setEnvironment(ST_NODE_HOST_ID, getTextValue(envRoot, ST_NODE_HOST_ID)); - registration.setEnvironment(ST_NODE_OS_NAME, getTextValue(envRoot, ST_NODE_OS_NAME)); - registration.setEnvironment(ST_NODE_OS_VERSION, getTextValue(envRoot, ST_NODE_OS_VERSION)); - registration.setEnvironment(ST_NODE_OS_ARCH, getTextValue(envRoot, ST_NODE_OS_ARCH)); - registration.setEnvironment(ST_NODE_SYSTEM_MODEL, getTextValue(envRoot, ST_NODE_SYSTEM_MODEL)); - registration.setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, getTextValue(envRoot, ST_NODE_SYSTEM_MANUFACTURER)); - registration.setEnvironment(ST_NODE_CPU_MANUFACTURER, getTextValue(envRoot, ST_NODE_CPU_MANUFACTURER)); - registration.setEnvironment(ST_NODE_SERIAL_NUMBER, getTextValue(envRoot, ST_NODE_SERIAL_NUMBER)); - registration.setEnvironment(ST_NODE_PHYS_MEM, getTextValue(envRoot, ST_NODE_PHYS_MEM)); - } - - private static void buildCpuInfoMap(Element cpuInfoRoot, - RegistrationData registration) { - registration.setCpuInfo(ST_NODE_SOCKETS, getTextValue(cpuInfoRoot, ST_NODE_SOCKETS)); - registration.setCpuInfo(ST_NODE_CORES, getTextValue(cpuInfoRoot, ST_NODE_CORES)); - registration.setCpuInfo(ST_NODE_VIRT_CPUS, getTextValue(cpuInfoRoot, ST_NODE_VIRT_CPUS)); - registration.setCpuInfo(ST_NODE_CPU_NAME, getTextValue(cpuInfoRoot, ST_NODE_CPU_NAME)); - registration.setCpuInfo(ST_NODE_CLOCK_RATE, getTextValue(cpuInfoRoot, ST_NODE_CLOCK_RATE)); - } - - // add the nodes representing the environment map in the document - private static void addEnvironmentNodes(Document document, - Map<String, String> envMap, - Map<String, String> cpuInfoMap) { - Element root = getRegistrationDataRoot(document); - - Element env = document.createElement(ST_NODE_ENVIRONMENT); - root.appendChild(env); - Set<Map.Entry<String, String>> keys = envMap.entrySet(); - for (Map.Entry<String, String> entry : keys) { - addChildElement(document, env, entry.getKey(), entry.getValue()); - } - - Element cpuInfo = document.createElement(ST_NODE_CPU_INFO); - env.appendChild(cpuInfo); - keys = cpuInfoMap.entrySet(); - for (Map.Entry<String, String> entry : keys) { - addChildElement(document, cpuInfo, entry.getKey(), entry.getValue()); - } - } - - private static Element getRegistrationDataRoot(Document doc) { - Element root = doc.getDocumentElement(); - if (!root.getNodeName().equals(ST_NODE_REGISTRATION_DATA)) { - throw new IllegalArgumentException("Not a " + - ST_NODE_REGISTRATION_DATA + - " node \"" + root.getNodeName() + "\""); - } - return root; - } - - private static Element getSingletonElementFromRoot(Element root, String name) { - NodeList children = root.getElementsByTagName(name); - int length = (children == null ? 0 : children.getLength()); - if (length != 1) { - throw new IllegalArgumentException("Invalid number of " + name + - " nodes = " + length); - } - Element e = (Element) children.item(0); - if (!e.getNodeName().equals(name)) { - throw new IllegalArgumentException("Not a " + name + - " node \"" + e.getNodeName() + "\""); - } - return e; - } - - // Constructs one ServiceTag instance from a service tag element root - private static ServiceTag getServiceTag(Element svcTagElement) { - return new ServiceTag( - getTextValue(svcTagElement, ST_NODE_INSTANCE_URN), - getTextValue(svcTagElement, ST_NODE_PRODUCT_NAME), - getTextValue(svcTagElement, ST_NODE_PRODUCT_VERSION), - getTextValue(svcTagElement, ST_NODE_PRODUCT_URN), - getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT), - getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT_URN), - getTextValue(svcTagElement, ST_NODE_PRODUCT_DEFINED_INST_ID), - getTextValue(svcTagElement, ST_NODE_PRODUCT_VENDOR), - getTextValue(svcTagElement, ST_NODE_PLATFORM_ARCH), - getTextValue(svcTagElement, ST_NODE_CONTAINER), - getTextValue(svcTagElement, ST_NODE_SOURCE), - Util.getIntValue(getTextValue(svcTagElement, ST_NODE_INSTALLER_UID)), - Util.parseTimestamp(getTextValue(svcTagElement, ST_NODE_TIMESTAMP)) - ); - } - - private static String getTextValue(Element e, String tagName) { - String value = ""; - NodeList nl = e.getElementsByTagName(tagName); - if (nl != null && nl.getLength() > 0) { - Element el = (Element) nl.item(0); - Node node = el.getFirstChild(); - if (node != null) { - value = node.getNodeValue(); - } - } - return value; - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/Registry.java b/desktop/source/registration/com/sun/star/servicetag/Registry.java deleted file mode 100644 index aa5d9726bbaf..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/Registry.java +++ /dev/null @@ -1,550 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -import java.io.*; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.Set; - -import static com.sun.star.servicetag.Util.*; -import static com.sun.star.servicetag.RegistrationDocument.*; - -/** - * A service tag registry is a XML-based registry containing - * the list of {@link ServiceTag service tags} installed in the system. - * The {@code Registry} class provides interfaces - * to add, remove, update, and get a service tag from a service tag - * registry. - * This {@code Registry} class may not be supported - * on all systems. The {@link #isSupported} method - * can be called to determine if it is supported. - * <p> - * A registry may implement restrictions to only allow certain users - * to {@link #updateServiceTag update} and - * to {@link #removeServiceTag remove} a service tag record. Typically, - * only the owner of the service tag, the owner of the registry - * and superuser are authorized to update or remove a service tag in - * the registry. - * - * @see <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/ServiceTagDevGuideHelper"> - * Service Tag User Guide</a> - */ -public class Registry { - - private static final String STCLIENT_SOLARIS = "/usr/bin/stclient"; - private static final String STCLIENT_LINUX = "/opt/sun/servicetag/bin/stclient"; - // stclient exit value (see sthelper.h) - private static final int ST_ERR_NOT_AUTH = 245; - private static final int ST_ERR_REC_NOT_FOUND = 225; - - // The stclient output has to be an exported interface - private static final String INSTANCE_URN_DESC = "Product instance URN="; - private static boolean initialized = false; - private static boolean supportsHelperClass = true; // default - private static File stclient = null; - private static String stclientPath = null; - private static Registry registry = new Registry(); - - // System properties for testing - private static String SVCTAG_STCLIENT_CMD = "servicetag.stclient.cmd"; - private static String SVCTAG_STHELPER_SUPPORTED = "servicetag.sthelper.supported"; - - private Registry() { - } - - private synchronized static String getSTclient() { - if (!initialized) { - // the system property always overrides the default setting - if (System.getProperty(SVCTAG_STHELPER_SUPPORTED) != null) { - supportsHelperClass = Boolean.getBoolean(SVCTAG_STHELPER_SUPPORTED); - } - - // This is only used for testing - stclientPath = System.getProperty(SVCTAG_STCLIENT_CMD); - if (stclientPath != null) { - return stclientPath; - } - - // Initialization to determine the platform's stclient pathname - String os = System.getProperty("os.name"); - if (os.equals("SunOS")) { - stclient = new File(STCLIENT_SOLARIS); - } else if (os.equals("Linux")) { - stclient = new File(STCLIENT_LINUX); - } else if (os.startsWith("Windows")) { - stclient = getWindowsStClientFile(); - } else { - if (isVerbose()) { - System.out.println("Running on non-Sun JDK"); - } - } - initialized = true; - } - - // com.sun.servicetag package has to be compiled with JDK 5 as well - // JDK 5 doesn't support the File.canExecute() method. - // Risk not checking isExecute() for the stclient command is very low. - - if (stclientPath == null && stclient != null && stclient.exists()) { - stclientPath = stclient.getAbsolutePath(); - } - return stclientPath; - } - - /** - * Returns the system service tag registry. The {@code Registry} class - * may not be supported on some platforms; use the {@link #isSupported} - * method to determine if it is supported. - * - * @return the {@code Registry} object for the system service tag registry. - * - * @throws UnsupportedOperationException if the {@code Registry} class is - * not supported. - */ - public static Registry getSystemRegistry() { - if (isSupported()) { - return registry; - } else { - throw new UnsupportedOperationException("Registry class is not supported"); - } - } - - /** - * Returns {@code true} if the {@code Registry} class is supported on this system. - * - * @return {@code true} if the {@code Registry} class is supported; - * otherwise, return {@code false}. - */ - public static boolean isSupported() { - return (getSTclient() != null && supportsHelperClass); - } - - private static List<String> getCommandList() { - // Set up the arguments to call stclient - List<String> command = new ArrayList<String>(); - if (System.getProperty(SVCTAG_STCLIENT_CMD) != null) { - // This is for jtreg testing use. This will be set to something - // like: - // $JAVA_HOME/bin/java -cp $TEST_DIR \ - // -Dstclient.registry.path=$TEST_DIR/registry.xml \ - // SvcTagClient - // - // On Windows, the JAVA_HOME and TEST_DIR path could contain - // space e.g. c:\Program Files\Java\jdk1.6.0_05\bin\java. - // The SVCTAG_STCLIENT_CMD must be set with a list of - // space-separated parameters. If a parameter contains spaces, - // it must be quoted with '"'. - - String cmd = getSTclient(); - int len = cmd.length(); - int i = 0; - while (i < len) { - char separator = ' '; - if (cmd.charAt(i) == '"') { - separator = '"'; - i++; - } - // look for the separator or matched the closing '"' - int j; - for (j = i+1; j < len; j++) { - if (cmd.charAt(j) == separator) { - break; - } - } - - if (i == j-1) { - // add an empty parameter - command.add("\"\""); - } else { - // double quotes and space are not included - command.add(cmd.substring(i,j)); - } - - // skip spaces - for (i = j+1; i < len; i++) { - if (!Character.isSpaceChar(cmd.charAt(i))) { - break; - } - } - } - if (isVerbose()) { - System.out.println("Command list:"); - for (String s : command) { - System.out.println(s); - } - } - } else { - command.add(getSTclient()); - } - return command; - } - - // Returns null if the service tag record not found; - // or throw UnauthorizedAccessException or IOException - // based on the exitValue. - private static ServiceTag checkReturnError(int exitValue, - String output, - ServiceTag st) throws IOException { - switch (exitValue) { - case ST_ERR_REC_NOT_FOUND: - return null; - case ST_ERR_NOT_AUTH: - if (st != null) { - throw new UnauthorizedAccessException( - "Not authorized to access " + st.getInstanceURN() + - " installer_uid=" + st.getInstallerUID()); - } else { - throw new UnauthorizedAccessException( - "Not authorized:" + output); - } - default: - throw new IOException("stclient exits with error" + - " (" + exitValue + ")\n" + output); - } - } - - /** - * Adds a service tag to this registry. - * If the given service tag has an empty <tt>instance_urn</tt>, - * this helper class will generate a URN and place it in the - * copy of the service tag in this registry. - * This method will return the {@code ServiceTag} representing - * the service tag entry to this registry. - * - * @param st {@code ServiceTag} object - * @return a {@code ServiceTag} object representing the service tag - * entry to this registry. - * - * @throws IllegalArgumentException if a service tag of the same - * <tt>instance_urn</tt> already exists in this registry. - * - * @throws java.io.IOException if an I/O error occurs in this operation. - */ - public ServiceTag addServiceTag(ServiceTag st) throws IOException { - List<String> command = getCommandList(); - command.add("-a"); - if (st.getInstanceURN().length() > 0) { - ServiceTag sysSvcTag = getServiceTag(st.getInstanceURN()); - if (sysSvcTag != null) { - throw new IllegalArgumentException("Instance_urn = " + - st.getInstanceURN() + " already exists"); - } - command.add("-i"); - command.add(st.getInstanceURN()); - } - command.add("-p"); - command.add(st.getProductName()); - command.add("-e"); - command.add(st.getProductVersion()); - command.add("-t"); - command.add(st.getProductURN()); - if (st.getProductParentURN().length() > 0) { - command.add("-F"); - command.add(st.getProductParentURN()); - } - command.add("-P"); - command.add(st.getProductParent()); - if (st.getProductDefinedInstanceID().length() > 0) { - command.add("-I"); - command.add(st.getProductDefinedInstanceID()); - } - command.add("-m"); - command.add(st.getProductVendor()); - command.add("-A"); - command.add(st.getPlatformArch()); - command.add("-z"); - command.add(st.getContainer()); - command.add("-S"); - command.add(st.getSource()); - - BufferedReader in = null; - try { - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - if (isVerbose()) { - System.out.println("Output from stclient -a command:"); - System.out.println(output); - } - String urn = ""; - if (p.exitValue() == 0) { - // Obtain the instance urn from the stclient output - in = new BufferedReader(new StringReader(output)); - String line = null; - while ((line = in.readLine()) != null) { - line = line.trim(); - if (line.startsWith(INSTANCE_URN_DESC)) { - urn = line.substring(INSTANCE_URN_DESC.length()); - break; - } - } - if (urn.length() == 0) { - throw new IOException("Error in creating service tag:\n" + - output); - } - return getServiceTag(urn); - } else { - return checkReturnError(p.exitValue(), output, st); - } - } finally { - if (in != null) { - in.close(); - } - } - } - - /** - * Removes a service tag of the given <tt>instance_urn</tt> from this - * registry. - * - * @param instanceURN the <tt>instance_urn</tt> of the service tag - * to be removed. - * - * @return the {@code ServiceTag} object removed from this registry; - * or {@code null} if the service tag does not exist in this registry. - * - * @throws UnauthorizedAccessException if the user is not authorized to - * remove the service tag of the given <tt>instance_urn</tt> - * from this registry. - * - * @throws java.io.IOException if an I/O error occurs in this operation. - */ - public ServiceTag removeServiceTag(String instanceURN) throws IOException { - ServiceTag st = getServiceTag(instanceURN); - if (st == null) { - return null; - } - - List<String> command = getCommandList(); - command.add("-d"); - command.add("-i"); - command.add(instanceURN); - - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - if (isVerbose()) { - System.out.println("Output from stclient -d command:"); - System.out.println(output); - } - if (p.exitValue() == 0) { - return st; - } else { - return checkReturnError(p.exitValue(), output, st); - } - } - - /** - * Updates the <tt>product_defined_instance_id</tt> in the service tag - * of the specified <tt>instance_urn</tt> in this registry. - * - * @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated. - * @param productDefinedInstanceID the value of the - * <tt>product_defined_instance_id</tt> to be set. - * - * @return the updated {@code ServiceTag} object; - * or {@code null} if the service tag does not exist in this - * registry. - * - * @throws UnauthorizedAccessException if the user is not authorized to - * update the service tag from this registry. - * - * @throws IOException if an I/O error occurs in this operation. - */ - public ServiceTag updateServiceTag(String instanceURN, - String productDefinedInstanceID) - throws IOException { - ServiceTag svcTag = getServiceTag(instanceURN); - if (svcTag == null) { - return null; - } - - List<String> command = getCommandList(); - command.add("-u"); - command.add("-i"); - command.add(instanceURN); - command.add("-I"); - if (productDefinedInstanceID.length() > 0) { - command.add(productDefinedInstanceID); - } else { - command.add("\"\""); - } - - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - if (isVerbose()) { - System.out.println("Output from stclient -u command:"); - System.out.println(output); - } - - if (p.exitValue() == 0) { - return getServiceTag(instanceURN); - } else { - return checkReturnError(p.exitValue(), output, svcTag); - } - } - - /** - * Returns a {@code ServiceTag} object of the given <tt>instance_urn</tt> - * in this registry. - * - * @param instanceURN the <tt>instance_urn</tt> of the service tag - * @return a {@code ServiceTag} object of the given <tt>instance_urn</tt> - * in this registry; or {@code null} if not found. - * - * @throws java.io.IOException if an I/O error occurs in this operation. - */ - public ServiceTag getServiceTag(String instanceURN) throws IOException { - if (instanceURN == null) { - throw new NullPointerException("instanceURN is null"); - } - - List<String> command = getCommandList(); - command.add("-g"); - command.add("-i"); - command.add(instanceURN); - - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - if (isVerbose()) { - System.out.println("Output from stclient -g command:"); - System.out.println(output); - } - if (p.exitValue() == 0) { - return parseServiceTag(output); - } else { - return checkReturnError(p.exitValue(), output, null); - } - } - - private ServiceTag parseServiceTag(String output) throws IOException { - BufferedReader in = null; - try { - Properties props = new Properties(); - // parse the service tag output from stclient - in = new BufferedReader(new StringReader(output)); - String line = null; - while ((line = in.readLine()) != null) { - if ((line = line.trim()).length() > 0) { - String[] ss = line.trim().split("=", 2); - if (ss.length == 2) { - props.setProperty(ss[0].trim(), ss[1].trim()); - } else { - props.setProperty(ss[0].trim(), ""); - } - } - } - - String urn = props.getProperty(ST_NODE_INSTANCE_URN); - String productName = props.getProperty(ST_NODE_PRODUCT_NAME); - String productVersion = props.getProperty(ST_NODE_PRODUCT_VERSION); - String productURN = props.getProperty(ST_NODE_PRODUCT_URN); - String productParent = props.getProperty(ST_NODE_PRODUCT_PARENT); - String productParentURN = props.getProperty(ST_NODE_PRODUCT_PARENT_URN); - String productDefinedInstanceID = - props.getProperty(ST_NODE_PRODUCT_DEFINED_INST_ID); - String productVendor = props.getProperty(ST_NODE_PRODUCT_VENDOR); - String platformArch = props.getProperty(ST_NODE_PLATFORM_ARCH); - String container = props.getProperty(ST_NODE_CONTAINER); - String source = props.getProperty(ST_NODE_SOURCE); - int installerUID = - Util.getIntValue(props.getProperty(ST_NODE_INSTALLER_UID)); - Date timestamp = - Util.parseTimestamp(props.getProperty(ST_NODE_TIMESTAMP)); - - return new ServiceTag(urn, - productName, - productVersion, - productURN, - productParent, - productParentURN, - productDefinedInstanceID, - productVendor, - platformArch, - container, - source, - installerUID, - timestamp); - } finally { - if (in != null) { - in.close(); - } - } - - } - - /** - * Returns the service tags of the specified - * <tt>product_urn</tt> in this registry. - * - * @param productURN the <tt>product_urn</tt> to look up - * @return a {@code Set} of {@code ServiceTag} objects - * of the specified <tt>product_urn</tt> in this registry. - * - * @throws java.io.IOException if an I/O error occurs in this operation. - */ - public Set<ServiceTag> findServiceTags(String productURN) throws IOException { - if (productURN == null) { - throw new NullPointerException("productURN is null"); - } - - List<String> command = getCommandList(); - command.add("-f"); - command.add("-t"); - command.add(productURN); - - BufferedReader in = null; - try { - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - - Set<ServiceTag> instances = new HashSet<ServiceTag>(); - if (p.exitValue() == 0) { - // parse the service tag output from stclient - in = new BufferedReader(new StringReader(output)); - String line = null; - while ((line = in.readLine()) != null) { - String s = line.trim(); - if (s.startsWith("urn:st:")) { - instances.add(getServiceTag(s)); - } - } - } else { - checkReturnError(p.exitValue(), output, null); - } - return instances; - } finally { - if (in != null) { - in.close(); - } - } - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/ServiceTag.java b/desktop/source/registration/com/sun/star/servicetag/ServiceTag.java deleted file mode 100644 index 7e6ea397c903..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/ServiceTag.java +++ /dev/null @@ -1,632 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -import java.util.Date; -import java.io.IOException; -import static com.sun.star.servicetag.RegistrationDocument.*; - -/** - * A service tag is an XML-based data structure that identifies a product or - * a component on a system. The service tag schema is defined by the - * Service Tags Technology. The location of the DTD file is platform dependent. - * On Solaris, see <tt>/usr/share/lib/xml/dtd/servicetag.dtd</tt>. - * <p> - * A valid {@code ServiceTag} instance must comply to the service tag schema - * and contain the following fields: - * <ul> - * <li>{@link #getInstanceURN <tt>instance_urn</tt>}</li> - * <li>{@link #getProductName <tt>product_name</tt>}</li> - * <li>{@link #getProductVersion <tt>product_version</tt>}</li> - * <li>{@link #getProductURN <tt>product_urn</tt>}</li> - * <li>{@link #getProductParent <tt>product_parent</tt>}</li> - * <li>{@link #getProductParentURN <tt>product_parent_urn</tt>}</li> - * <li>{@link #getProductDefinedInstanceID <tt>product_defined_inst_id</tt>}</li> - * <li>{@link #getProductVendor <tt>product_vendor</tt>}</li> - * <li>{@link #getPlatformArch <tt>platform_arch</tt>}</li> - * <li>{@link #getContainer <tt>container</tt>}</li> - * <li>{@link #getSource <tt>source</tt>}</li> - * <li>{@link #getInstallerUID <tt>installer_uid</tt>}</li> - * <li>{@link #getTimestamp <tt>timestamp</tt>}</li> - * </ul> - * - * The <tt>instance_urn</tt> can be specified when a {@code ServiceTag} - * object is created, or it can be generated when it is added to - * a {@link RegistrationData} object, or {@link Registry - * system service tag registry}. The <tt>installer_uid</tt> and - * <tt>timestamp</tt> are set when a {@code ServiceTag} object - * is added to a {@link RegistrationData} object, or {@link Registry - * system service tag registry}. - * - * @see <a href="https://sunconnection.sun.com/FAQ/sc_faq.html">Service Tags FAQ</a> - */ -public class ServiceTag { - - private String instanceURN; - private String productName; - private String productVersion; - private String productURN; - private String productParent; - private String productParentURN; - private String productDefinedInstanceID; - private String productVendor; - private String platformArch; - private String container; - private String source; - private int installerUID; - private Date timestamp; - - // Service Tag Field Lengths (defined in sthelper.h) - // Since the constants defined in sthelper.h includes the null-terminated - // character, so minus 1 from the sthelper.h defined values. - private final int MAX_URN_LEN = 256 - 1; - private final int MAX_PRODUCT_NAME_LEN = 256 - 1; - private final int MAX_PRODUCT_VERSION_LEN = 64 - 1; - private final int MAX_PRODUCT_PARENT_LEN = 256 - 1; - private final int MAX_PRODUCT_VENDOR_LEN = 64 - 1; - private final int MAX_PLATFORM_ARCH_LEN = 64 - 1; - private final int MAX_CONTAINER_LEN = 64 - 1; - private final int MAX_SOURCE_LEN = 64 - 1; - - // private constructors - private ServiceTag() { - } - // package private - ServiceTag(String instanceURN, - String productName, - String productVersion, - String productURN, - String productParent, - String productParentURN, - String productDefinedInstanceID, - String productVendor, - String platformArch, - String container, - String source, - int installerUID, - Date timestamp) { - setInstanceURN(instanceURN); - setProductName(productName); - setProductVersion(productVersion); - setProductURN(productURN); - setProductParentURN(productParentURN); - setProductParent(productParent); - setProductDefinedInstanceID(productDefinedInstanceID); - setProductVendor(productVendor); - setPlatformArch(platformArch); - setContainer(container); - setSource(source); - setInstallerUID(installerUID); - setTimestamp(timestamp); - } - - /** - * Creates a service tag object with no <tt>instance_urn</tt>. - * - * @param productName the name of the product. - * @param productVersion the version of the product. - * @param productURN the uniform resource name of the product - * @param productParent the name of the product's parent. - * @param productParentURN the uniform resource name of the product's parent. - * @param productDefinedInstanceID the instance identifier. - * @param productVendor the vendor of the product. - * @param platformArch the operating system architecture. - * @param container the container of the product. - * @param source the source of the product. - * - * @throws IllegalArgumentException if any value of the input fields - * does not conform to the service tag XML schema. - */ - public static ServiceTag newInstance(String productName, - String productVersion, - String productURN, - String productParent, - String productParentURN, - String productDefinedInstanceID, - String productVendor, - String platformArch, - String container, - String source) { - return new ServiceTag("", /* empty instance_urn */ - productName, - productVersion, - productURN, - productParent, - productParentURN, - productDefinedInstanceID, - productVendor, - platformArch, - container, - source, - -1, - null); - } - - /** - * Creates a service tag object with a specified <tt>instance_urn</tt>. - * - * @param instanceURN the uniform resource name of this instance. - * @param productName the name of the product. - * @param productVersion the version of the product. - * @param productURN the uniform resource name of the product - * @param productParent the name of the product's parent. - * @param productParentURN the uniform resource name of the product's parent. - * @param productDefinedInstanceID the instance identifier. - * @param productVendor the vendor of the product. - * @param platformArch the operating system architecture. - * @param container the container of the product. - * @param source the source of the product. - * - * @throws IllegalArgumentException if any value of the input fields - * does not conform to the service tag XML schema. - */ - public static ServiceTag newInstance(String instanceURN, - String productName, - String productVersion, - String productURN, - String productParent, - String productParentURN, - String productDefinedInstanceID, - String productVendor, - String platformArch, - String container, - String source) { - return new ServiceTag(instanceURN, - productName, - productVersion, - productURN, - productParent, - productParentURN, - productDefinedInstanceID, - productVendor, - platformArch, - container, - source, - -1, - null); - } - - // Creates a copy of the ServiceTag instance - // with instance_urn and timestamp initialized - static ServiceTag newInstanceWithUrnTimestamp(ServiceTag st) { - String instanceURN = - (st.getInstanceURN().length() == 0 ? Util.generateURN() : - st.getInstanceURN()); - ServiceTag svcTag = new ServiceTag(instanceURN, - st.getProductName(), - st.getProductVersion(), - st.getProductURN(), - st.getProductParent(), - st.getProductParentURN(), - st.getProductDefinedInstanceID(), - st.getProductVendor(), - st.getPlatformArch(), - st.getContainer(), - st.getSource(), - st.getInstallerUID(), - new Date()); - return svcTag; - } - - /** - * Returns a uniform resource name (URN) in this format: - * <blockquote> - * "<tt>urn:st:<32-char {@link java.util.UUID uuid}></tt>" - * </blockquote> - * @return a URN. - */ - public static String generateInstanceURN() { - return Util.generateURN(); - } - - /** - * Returns the uniform resource name of this service tag instance. - * - * @return the <tt>instance_urn</tt> of this service tag. - */ - public String getInstanceURN() { - return instanceURN; - } - - /** - * Returns the name of the product. - * - * @return the product name. - */ - public String getProductName() { - return productName; - } - - /** - * Returns the version of the product. - * - * @return the product version. - */ - public String getProductVersion() { - return productVersion; - } - - /** - * Returns the uniform resource name of the product. - * - * @return the product URN. - */ - public String getProductURN() { - return productURN; - } - - /** - * Returns the uniform resource name of the product's parent. - * - * @return the product's parent URN. - */ - public String getProductParentURN() { - return productParentURN; - } - - /** - * Returns the name of the product's parent. - * - * @return the product's parent name. - */ - public String getProductParent() { - return productParent; - } - - /** - * Returns the identifier defined for this product instance. - * - * @return the identifier defined for this product instance. - */ - public String getProductDefinedInstanceID() { - return productDefinedInstanceID; - } - - /** - * Returns the vendor of the product. - * - * @return the product vendor. - */ - public String getProductVendor() { - return productVendor; - } - - /** - * Returns the platform architecture on which the product - * is running on. - * - * @return the platform architecture on which the product is running on. - */ - public String getPlatformArch() { - return platformArch; - } - - /** - * Returns the timestamp. This timestamp is set when this service tag - * is added to or updated in a {@code RegistrationData} object or - * the system service tag registry. - * This method may return {@code null}. - * - * @return timestamp when this service tag - * is added to or updated in a {@code RegistrationData} object or - * the system service tag registry, or {@code null}. - */ - public Date getTimestamp() { - if (timestamp != null) { - return (Date) timestamp.clone(); - } else { - return null; - } - } - - - /** - * Returns the container of the product. - * - * @return the container of the product. - */ - public String getContainer() { - return container; - } - - /** - * Returns the source of this service tag. - * - * @return source of this service tag. - */ - public String getSource() { - return source; - } - - /** - * Returns the UID. The UID is set when this service tag - * is added to or updated in the system service tag registry. - * This is platform dependent whose default value is {@code -1}. - * When this service tag is added to a {@code RegistrationData}, - * the UID is not set. - * - * @return the UID of whom this service tag - * is added to or updated in the system service tag registry, - * or {@code -1}. - */ - public int getInstallerUID() { - return installerUID; - } - - // The following setter methods are used to validate the - // input field when constructing a ServiceTag instance - - private void setInstanceURN(String instanceURN) { - if (instanceURN == null) { - throw new NullPointerException("Parameter instanceURN cannot be null"); - } - if (instanceURN.length() > MAX_URN_LEN) { - throw new IllegalArgumentException("instanceURN \"" + instanceURN + - "\" exceeds maximum length " + MAX_URN_LEN); - } - this.instanceURN = instanceURN; - } - - private void setProductName(String productName) { - if (productName == null) { - throw new NullPointerException("Parameter productName cannot be null"); - } - if (productName.length() == 0) { - throw new IllegalArgumentException("product name cannot be empty"); - } - if (productName.length() > MAX_PRODUCT_NAME_LEN) { - throw new IllegalArgumentException("productName \"" + productName + - "\" exceeds maximum length " + MAX_PRODUCT_NAME_LEN); - } - this.productName = productName; - } - - private void setProductVersion(String productVersion) { - if (productVersion == null) { - throw new NullPointerException("Parameter productVersion cannot be null"); - } - - if (productVersion.length() == 0) { - throw new IllegalArgumentException("product version cannot be empty"); - } - if (productVersion.length() > MAX_PRODUCT_VERSION_LEN) { - throw new IllegalArgumentException("productVersion \"" + - productVersion + "\" exceeds maximum length " + - MAX_PRODUCT_VERSION_LEN); - } - this.productVersion = productVersion; - } - - private void setProductURN(String productURN) { - if (productURN == null) { - throw new NullPointerException("Parameter productURN cannot be null"); - } - if (productURN.length() == 0) { - throw new IllegalArgumentException("product URN cannot be empty"); - } - if (productURN.length() > MAX_URN_LEN) { - throw new IllegalArgumentException("productURN \"" + productURN + - "\" exceeds maximum length " + MAX_URN_LEN); - } - this.productURN = productURN; - } - - private void setProductParentURN(String productParentURN) { - if (productParentURN == null) { - throw new NullPointerException("Parameter productParentURN cannot be null"); - } - // optional field - can be empty - if (productParentURN.length() > MAX_URN_LEN) { - throw new IllegalArgumentException("productParentURN \"" + - productParentURN + "\" exceeds maximum length " + - MAX_URN_LEN); - } - this.productParentURN = productParentURN; - } - - private void setProductParent(String productParent) { - if (productParent == null) { - throw new NullPointerException("Parameter productParent cannot be null"); - } - if (productParent.length() == 0) { - throw new IllegalArgumentException("product parent cannot be empty"); - } - if (productParent.length() > MAX_PRODUCT_PARENT_LEN) { - throw new IllegalArgumentException("productParent \"" + - productParent + "\" exceeds maximum length " + - MAX_PRODUCT_PARENT_LEN); - } - this.productParent = productParent; - } - - void setProductDefinedInstanceID(String productDefinedInstanceID) { - if (productDefinedInstanceID == null) { - throw new NullPointerException("Parameter productDefinedInstanceID cannot be null"); - } - if (productDefinedInstanceID.length() > MAX_URN_LEN) { - throw new IllegalArgumentException("productDefinedInstanceID \"" + - productDefinedInstanceID + "\" exceeds maximum length " + - MAX_URN_LEN); - } - // optional field - can be empty - this.productDefinedInstanceID = productDefinedInstanceID; - } - - private void setProductVendor(String productVendor) { - if (productVendor == null) { - throw new NullPointerException("Parameter productVendor cannot be null"); - } - if (productVendor.length() == 0) { - throw new IllegalArgumentException("product vendor cannot be empty"); - } - if (productVendor.length() > MAX_PRODUCT_VENDOR_LEN) { - throw new IllegalArgumentException("productVendor \"" + - productVendor + "\" exceeds maximum length " + - MAX_PRODUCT_VENDOR_LEN); - } - this.productVendor = productVendor; - } - - private void setPlatformArch(String platformArch) { - if (platformArch == null) { - throw new NullPointerException("Parameter platformArch cannot be null"); - } - if (platformArch.length() == 0) { - throw new IllegalArgumentException("platform architecture cannot be empty"); - } - if (platformArch.length() > MAX_PLATFORM_ARCH_LEN) { - throw new IllegalArgumentException("platformArch \"" + - platformArch + "\" exceeds maximum length " + - MAX_PLATFORM_ARCH_LEN); - } - this.platformArch = platformArch; - } - - private void setTimestamp(Date timestamp) { - // can be null - this.timestamp = timestamp; - } - - private void setContainer(String container) { - if (container == null) { - throw new NullPointerException("Parameter container cannot be null"); - } - if (container.length() == 0) { - throw new IllegalArgumentException("container cannot be empty"); - } - if (container.length() > MAX_CONTAINER_LEN) { - throw new IllegalArgumentException("container \"" + - container + "\" exceeds maximum length " + - MAX_CONTAINER_LEN); - } - this.container = container; - } - - private void setSource(String source) { - if (source == null) { - throw new NullPointerException("Parameter source cannot be null"); - } - if (source.length() == 0) { - throw new IllegalArgumentException("source cannot be empty"); - } - if (source.length() > MAX_SOURCE_LEN) { - throw new IllegalArgumentException("source \"" + source + - "\" exceeds maximum length " + MAX_SOURCE_LEN); - } - this.source = source; - } - - private void setInstallerUID(int installerUID) { - this.installerUID = installerUID; - } - - /** - * Compares this service tag to the specified object. - * The result is {@code true} if and only if the argument is - * not {@code null} and is a {@code ServiceTag} object whose - * <tt>instance_urn</tt> is the same as the - * <tt>instance_urn</tt> of this service tag. - * - * @return {@code true} if this service tag is the same as - * the specified object. - */ - @Override - public boolean equals(Object obj) { - if (obj == null || !(obj instanceof ServiceTag)) { - return false; - } - ServiceTag st = (ServiceTag) obj; - if (st == this) { - return true; - } - return st.getInstanceURN().equals(getInstanceURN()); - } - - /** - * Returns the hash code value for this service tag. - * @return the hash code value for this service tag. - */ - @Override - public int hashCode() { - int hash = 7; - hash = 19 * hash + (this.instanceURN != null ? this.instanceURN.hashCode() : 0); - return hash; - } - - /** - * Returns the string representation of this service tag. - * The format is implementation specific. - * - * @return the string representation of this service tag. - */ - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(ST_NODE_INSTANCE_URN).append("=").append(instanceURN).append("\n"); - sb.append(ST_NODE_PRODUCT_NAME).append("=").append(productName).append("\n"); - sb.append(ST_NODE_PRODUCT_VERSION).append("=").append(productVersion).append("\n"); - sb.append(ST_NODE_PRODUCT_URN).append("=").append(productURN).append("\n"); - sb.append(ST_NODE_PRODUCT_PARENT_URN).append("=").append(productParentURN).append("\n"); - sb.append(ST_NODE_PRODUCT_PARENT).append("=").append(productParent).append("\n"); - sb.append(ST_NODE_PRODUCT_DEFINED_INST_ID).append("=").append(productDefinedInstanceID).append("\n"); - sb.append(ST_NODE_PRODUCT_VENDOR).append("=").append(productVendor).append("\n"); - sb.append(ST_NODE_PLATFORM_ARCH).append("=").append(platformArch).append("\n"); - sb.append(ST_NODE_TIMESTAMP).append("=").append(Util.formatTimestamp(timestamp)).append("\n"); - sb.append(ST_NODE_CONTAINER).append("=").append(container).append("\n"); - sb.append(ST_NODE_SOURCE).append("=").append(source).append("\n"); - sb.append(ST_NODE_INSTALLER_UID).append("=").append(String.valueOf(installerUID)).append("\n"); - return sb.toString(); - } - - - /** - * Returns the {@link ServiceTag} instance for the running Java - * platform. The {@link ServiceTag#setSource source} field - * of the {@code ServiceTag} will be set to the given {@code source}. - * This method will return {@code null} if there is no service tag - * for the running Java platform. - * <p> - * This method is designed for Sun software that bundles the JDK - * or the JRE to use. It is recommended that the {@code source} - * string contains information about the bundling software - * such as the name and the version of the software bundle, - * for example, - * <blockquote> - * <tt>NetBeans IDE 6.0 with JDK 6 Update 5 Bundle</tt> - * </blockquote> - * in a NetBeans/JDK bundle. - * <p> - * At the first time to call this method the application - * is required to have the write permission to the installed - * directory of this running JDK or JRE instance. - * - * @param source the source that bundles the JDK or the JRE. - * @return a {@code ServiceTag} object for the Java platform, - * or {@code null} if not supported. - * @throws IOException if an error occurs in this operation. - */ - public static ServiceTag getJavaServiceTag(String source) throws IOException { - return Installer.getJavaServiceTag(source); - } - -} diff --git a/desktop/source/registration/com/sun/star/servicetag/SolarisServiceTag.java b/desktop/source/registration/com/sun/star/servicetag/SolarisServiceTag.java deleted file mode 100644 index 58fe3528a860..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/SolarisServiceTag.java +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -import java.io.IOException; -import java.util.Set; - -/** - * Utility class to obtain the service tag for the Solaris Operating System. - */ -class SolarisServiceTag { - private final static String[] SolarisProductURNs = new String[] { - "urn:uuid:a7a38948-2bd5-11d6-98ce-9d3ac1c0cfd7", /* Solaris 8 */ - "urn:uuid:4f82caac-36f3-11d6-866b-85f428ef944e", /* Solaris 9 */ - "urn:uuid:a19de03b-48bc-11d9-9607-080020a9ed93", /* Solaris 9 sparc */ - "urn:uuid:4c35c45b-4955-11d9-9607-080020a9ed93", /* Solaris 9 x86 */ - "urn:uuid:5005588c-36f3-11d6-9cec-fc96f718e113", /* Solaris 10 */ - "urn:uuid:6df19e63-7ef5-11db-a4bd-080020a9ed93" /* Solaris 11 */ - }; - - /** - * Returns null if not found. - * - * There is only one service tag for the operating system. - */ - static ServiceTag getServiceTag() throws IOException { - if (Registry.isSupported()) { - Registry streg = Registry.getSystemRegistry(); - for (String parentURN : SolarisProductURNs) { - Set<ServiceTag> instances = streg.findServiceTags(parentURN); - for (ServiceTag st : instances) { - // there should have only one service tag for the OS - return st; - } - } - } - return null; - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java deleted file mode 100644 index 9f2271faac04..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java +++ /dev/null @@ -1,417 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -// The Service Tags team maintains the latest version of the implementation -// for system environment data collection. JDK will include a copy of -// the most recent released version for a JDK release. We rename -// the package to com.sun.servicetag so that the Sun Connection -// product always uses the latest version from the com.sun.scn.servicetags -// package. JDK and users of the com.sun.servicetag API -// (e.g. NetBeans and SunStudio) will use the version in JDK. - -import java.io.*; -import java.util.Set; -import java.util.HashSet; - -/** - * Solaris implementation of the SystemEnvironment class. - */ -class SolarisSystemEnvironment extends SystemEnvironment { - private static final int SN = 1; - private static final int SYS = 2; - private static final int CPU = 3; - private static final int MODEL = 4; - private String kstatCpuInfo = null; - - SolarisSystemEnvironment() { - setHostId(getCommandOutput("/usr/bin/hostid")); - setSystemModel(getSolarisModel()); - setSystemManufacturer(getSolarisSystemManufacturer()); - setCpuManufacturer(getSolarisCpuManufacturer()); - setSerialNumber(getSolarisSN()); - setPhysMem(getSolarisPhysMem()); - setSockets(getSolarisSockets()); - setCores(getSolarisCores()); - setVirtCpus(getSolarisVirtCpus()); - setCpuName(getSolarisCpuName()); - setClockRate(getSolarisClockRate()); - } - - private String getSolarisClockRate() { - String data = getSolarisKstatCpuInfo(); - - String lines[] = data.split("\n"); - String token = "clock_MHz"; - for (int i=0; i<lines.length; i++) { - String line = lines[i].trim(); - if (line.startsWith(token)) { - return line.substring(line.indexOf(token) + token.length()).trim(); - } - } - return ""; - } - - private String getSolarisCpuName() { - String data = getSolarisKstatCpuInfo(); - - String lines[] = data.split("\n"); - String token = "brand"; - for (int i=0; i<lines.length; i++) { - String line = lines[i].trim(); - if (line.startsWith(token)) { - return line.substring(line.indexOf(token) + token.length()).trim(); - } - } - return ""; - } - - private String getSolarisVirtCpus() { - String data = getSolarisKstatCpuInfo(); - - int cnt = 0; - String lines[] = data.split("\n"); - String token = " cpu_info "; - for (int i=0; i<lines.length; i++) { - String line = lines[i].trim(); - if (line.indexOf(token) != -1) { - cnt++; - } - } - return "" + cnt; - } - - private String getSolarisCores() { - String data = getSolarisKstatCpuInfo(); - - Set<String> set = new HashSet<String>(); - String lines[] = data.split("\n"); - String coreIdToken = "core_id"; - String coreId = ""; - String chipIdToken = "chip_id"; - String chipId = ""; - for (int i=0; i<lines.length; i++) { - String line = lines[i].trim(); - if (line.startsWith(chipIdToken)) { - chipId = line.substring(line.indexOf(chipIdToken) + chipIdToken.length()).trim(); - } - if (line.startsWith(coreIdToken)) { - coreId = line.substring(line.indexOf(coreIdToken) + coreIdToken.length()).trim(); - set.add(chipId + "," + coreId); - } - } - return "" + set.size(); - } - - private String getSolarisPhysMem() { - String data = getCommandOutput("/usr/sbin/prtconf"); - - int cnt = 0; - String lines[] = data.split("\n"); - String token = "Memory size:"; - for (int i=0; i<lines.length; i++) { - String line = lines[i].trim(); - if (line.startsWith(token)) { - line = line.substring(line.indexOf(token) + token.length()).trim(); - if (line.indexOf(" ") != -1) { - return line.substring(0, line.indexOf(" ")).trim(); - } - } - } - return ""; - } - - private String getSolarisSockets() { - String data = getSolarisKstatCpuInfo(); - - Set<String> set = new HashSet<String>(); - String lines[] = data.split("\n"); - String token = "chip_id"; - for (int i=0; i<lines.length; i++) { - String line = lines[i].trim(); - if (line.startsWith(token)) { - String id = line.substring(line.indexOf(token) + token.length()).trim(); - set.add(id); - } - } - return "" + set.size(); - } - - private synchronized String getSolarisKstatCpuInfo() { - // only try to get kstat cpu_info information once, after that, we can - // reuse the output - if (kstatCpuInfo == null) { - Thread thread = new Thread() { - public void run() { - kstatCpuInfo = getCommandOutput("/usr/bin/kstat", "cpu_info"); - } - }; - thread.start(); - - try { - thread.join(2000); - if (thread.isAlive()) { - thread.interrupt(); - kstatCpuInfo = ""; - } - } catch (InterruptedException ie) { - thread.interrupt(); - } - } - return kstatCpuInfo; - } - - private String getSolarisModel() { - String tmp = getFileContent("/var/run/psn"); - if (tmp.length() > 0) { - String[] lines = tmp.split("\n"); - if (MODEL <= lines.length) { - return lines[MODEL-1] + "::" - + getCommandOutput("/usr/bin/uname", "-v"); - } - } - - if ("sparc".equalsIgnoreCase(System.getProperty("os.arch"))) { - return getCommandOutput("/usr/bin/uname", "-i") + "::" - + getCommandOutput("/usr/bin/uname", "-v"); - } else { - String model = getSmbiosData("1", "Product: "); - if (model == null || model.trim().equals("")) { - model = getCommandOutput("/usr/bin/uname", "-i"); - } - if (model == null) { - model = ""; - } - return model.trim() + "::" - + getCommandOutput("/usr/bin/uname", "-v"); - } - } - - /** - * Tries to obtain the cpu manufacturer. - * @return The cpu manufacturer (an empty string if not found or an error occurred) - */ - private String getSolarisCpuManufacturer() { - String tmp = getFileContent("/var/run/psn"); - if (tmp.length() > 0) { - String[] lines = tmp.split("\n"); - if (CPU <= lines.length) { - return lines[CPU-1]; - } - } - - // not fully accurate, this could be another manufacturer (fujitsu for example) - if ("sparc".equalsIgnoreCase(System.getProperty("os.arch"))) { - return "Sun Microsystems, Inc"; - } - - // if we're here, then we'll try smbios (type 4) - return getSmbiosData("4", "Manufacturer: "); - } - - /** - * Tries to obtain the system manufacturer. - * @return The system manufacturer (an empty string if not found or an error occurred) - */ - private String getSolarisSystemManufacturer() { - String tmp = getFileContent("/var/run/psn"); - if (tmp.length() > 0) { - String[] lines = tmp.split("\n"); - if (SYS <= lines.length) { - return lines[SYS-1]; - } - } - - // not fully accurate, this could be another manufacturer (fujitsu for example) - if ("sparc".equalsIgnoreCase(System.getProperty("os.arch"))) { - if (getCommandOutput("/usr/bin/uname", "-m").equals("sun4us")) { - return "Fujitsu"; - } - return "Sun Microsystems, Inc"; - } - - // if we're here, then we'll try smbios (type 1) - return getSmbiosData("1", "Manufacturer: "); - } - - /** - * Tries to obtain the serial number. - * @return The serial number (empty string if not found or an error occurred) - */ - private String getSolarisSN() { - // try to read from the psn file if it exists - String tmp = getFileContent("/var/run/psn"); - if (tmp.length() > 0) { - String[] lines = tmp.split("\n"); - if (SN <= lines.length) { - return lines[SN-1]; - } - } - - // if we're here, then we'll try sneep - String tmpSN = getSneepSN(); - if (tmpSN.length() > 0) { - return tmpSN; - } - - // if we're here, then we'll try smbios (type 1) - tmpSN = getSmbiosData("1", "Serial Number: "); - if (tmpSN.length() > 0) { - return tmpSN; - } - - // if we're here, then we'll try smbios (type 3) - tmpSN = getSmbiosData("3", "Serial Number: "); - if (tmpSN.length() > 0) { - return tmpSN; - } - - if ("sparc".equalsIgnoreCase(System.getProperty("os.arch"))) { - tmpSN = getSNViaPrtfruX(); - if (tmpSN.length() > 0) { - return tmpSN; - } - tmpSN = getSNViaPrtfru(); - if (tmpSN.length() > 0) { - return tmpSN; - } - } - - // give up and return - return ""; - } - - // Sample smbios output segment: - // ID SIZE TYPE - // 1 150 SMB_TYPE_SYSTEM (system information) - // - // Manufacturer: Sun Microsystems - // Product: Sun Fire X4600 - // Version: To Be Filled By O.E.M. - // Serial Number: 00:14:4F:45:0C:2A - private String getSmbiosData(String type, String target) { - String output = getCommandOutput("/usr/sbin/smbios", "-t", type); - for (String s : output.split("\n")) { - if (s.contains(target)) { - int indx = s.indexOf(target) + target.length(); - if (indx < s.length()) { - String tmp = s.substring(indx).trim(); - String lowerCaseStr = tmp.toLowerCase(); - if (!lowerCaseStr.startsWith("not available") - && !lowerCaseStr.startsWith("to be filled by o.e.m")) { - return tmp; - } - } - } - } - - return ""; - } - - private String getSneepSN() { - String basedir = getCommandOutput("pkgparam","SUNWsneep","BASEDIR"); - File f = new File(basedir + "/bin/sneep"); - if (f.exists()) { - String sneepSN = getCommandOutput(basedir + "/bin/sneep"); - if (sneepSN.equalsIgnoreCase("unknown")) { - return ""; - } else { - return sneepSN; - } - } else { - return ""; - } - } - - private String getSNViaPrtfruX() { - String data = getCommandOutput("/usr/sbin/prtfru", "-x"); - - boolean FRUTREE_FLAG = false; - boolean FRUNAME_FLAG = false; - boolean MB_LABEL_FLAG = false; - boolean SYSTEM_BOARD_FLAG = false; - - String lines[] = data.split("\n"); - for (int i=0; i<lines.length; i++) { - String line = lines[i]; - if (SYSTEM_BOARD_FLAG) { - String tok = "<Sun_Serial_No value=\""; - int index = line.indexOf(tok); - if (index != -1) { - String val = line.substring(index+tok.length()); - String vals[] = val.split("\""); - if (vals.length > 0) { - return vals[0].trim(); - } - break; - } - } - - if (line.indexOf("</ContainerData>") != -1) { - FRUTREE_FLAG = false; - FRUNAME_FLAG = false; - SYSTEM_BOARD_FLAG = false; - } - - if (FRUNAME_FLAG && line.indexOf("<Container name=\"system-board\">") != -1 ) { - SYSTEM_BOARD_FLAG = true; - } - - if (FRUTREE_FLAG && line.indexOf("<Fru name=\"chassis\">") != -1 ) { - FRUNAME_FLAG = true; - } - - if (line.indexOf("<Location name=\"frutree\">") != -1) { - FRUTREE_FLAG = true; - } - } - - return ""; - } - - private String getSNViaPrtfru() { - String data = getCommandOutput("/usr/sbin/prtfru"); - boolean CHASSIS_FLAG = false; - - String lines[] = data.split("\n"); - for (int i=0; i<lines.length; i++) { - String line = lines[i]; - if (CHASSIS_FLAG) { - String tok = "/ManR/Sun_Serial_No:"; - int index = line.indexOf(tok); - if (index != -1) { - String val = line.substring(index+tok.length()); - return val.trim(); - } - } - - if (line.indexOf("/frutree/chassis/system-board (container)") != -1) { - CHASSIS_FLAG = true; - } else if (line.indexOf("/frutree/chassis/MB?Label=MB/system-board (container)") != -1) { - CHASSIS_FLAG = true; - } - } - return ""; - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/SunConnection.java b/desktop/source/registration/com/sun/star/servicetag/SunConnection.java deleted file mode 100644 index 53e247f02097..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/SunConnection.java +++ /dev/null @@ -1,288 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -import java.io.*; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.io.OutputStreamWriter; -import java.util.Locale; -import javax.net.ssl.HttpsURLConnection; - -/** - * Sun Connection Class for Product Registration. - * - * Registration Web Application Interface - * 1) POST the product registry to the output stream of the registration - * relay service. - * 2) Open the webapp URL from a browser with the following parameters: - * registry-urn - * product=jdk - * locale=<locale-lang> - * - * @see https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/ - * - */ -class SunConnection { - - private static String JDK_REGISTRATION_URL = - "https://inventory.sun.com/RegistrationWeb/register"; - private static String SANDBOX_TESTING_URL = - "https://connection-tst.sun.com/RegistrationWeb/register"; - - // System properties for testing - private static String SVCTAG_REGISTER_TESTING = "servicetag.register.testing"; - private static String SVCTAG_REGISTRATION_URL = "servicetag.registration.url"; - private static String SVCTAG_CONNECTION_TIMEOUT = "servicetag.connection.timeout"; - - private SunConnection() { - } - - /** - * Returns a URL for JDK registration interfacing with the Sun Connection - * registration relay service in this form: - * <registration-url>/<registry_urn>?product=jdk&locale=<locale-lang> - * - * The <registration-url> can be overridden by an environment - * variable or a system property. - * - * 1) "servicetag.register.testing" system property to switch to the - * Sun Connection registration sandbox testing. - * 2) "servicetag.registration.url" system property to override - * the URL - * 3) Default production URL - * - */ - static URL getRegistrationURL(String registrationURN) { - String url = System.getProperty(SVCTAG_REGISTRATION_URL); - if (url == null) { - if (System.getProperty(SVCTAG_REGISTER_TESTING) != null) { - url = SANDBOX_TESTING_URL; - } else { - url = JDK_REGISTRATION_URL; - } - } - - // trim whitespaces - url = url.trim(); - if (url.length() == 0) { - throw new InternalError("Empty registration url set"); - } - - // Add the registry_urn in the URL's query - String registerURL = rewriteURL(url, registrationURN); - try { - return new URL(registerURL); - } catch (MalformedURLException ex) { - // should never reach here - InternalError x = - new InternalError(ex.getMessage()); - x.initCause(ex); - throw x; - } - } - - private static String rewriteURL(String url, String registryURN) { - StringBuilder sb = new StringBuilder(url.trim()); - int len = sb.length(); - if (sb.charAt(len-1) != '/') { - sb.append('/'); - } - sb.append(registryURN); - sb.append("?"); - sb.append("product=jdk"); - sb.append("&"); - sb.append("locale=").append(Locale.getDefault().getLanguage()); - return sb.toString(); - } - - /** - * Registers all products in the given product registry. If it fails - * to post the service tag registry, open the browser with the offline - * registration page. - * - * @param regData registration data to be posted to the Sun Connection - * for registration. - * - * @throws IOException if I/O error occurs in this operation - */ - public static void register(RegistrationData regData) throws IOException { - // Gets the URL for SunConnection registration relay service - URL url = getRegistrationURL(regData.getRegistrationURN()); - - // Post the Product Registry to Sun Connection - boolean succeed = postRegistrationData(url, regData); - if (succeed) { - // service tags posted successfully - // now prompt for registration - openBrowser(url); - } else { - // open browser with the offline registration page - openOfflineRegisterPage(); - } - } - - /** - * Opens a browser for JDK product registration. - * @param url Registration Webapp URL - */ - private static void openBrowser(URL url) throws IOException { - if (!BrowserSupport.isSupported()) { - if (Util.isVerbose()) { - System.out.println("Browser is not supported"); - } - return; - } - - try { - BrowserSupport.browse(url.toURI()); - } catch (URISyntaxException ex) { - InternalError x = new InternalError("Error in registering: " + ex.getMessage()); - x.initCause(ex); - throw x; - } catch (IllegalArgumentException ex) { - if (Util.isVerbose()) { - ex.printStackTrace(); - } - } catch (UnsupportedOperationException ex) { - // ignore if not supported - if (Util.isVerbose()) { - ex.printStackTrace(); - } - } - } - - /** - * POST service tag registry to Sun Connection - * @param loc the URL of the webapp to handle the POST request - * @param streg the Service Tag registry - * @return true if posting succeeds; otherwise, false. - */ - private static boolean postRegistrationData(URL url, - RegistrationData registration) { - try { - HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); - con.setDoInput(true); - con.setDoOutput(true); - con.setUseCaches(false); - con.setAllowUserInteraction(false); - - // default 10 seconds timeout - String timeout = System.getProperty(SVCTAG_CONNECTION_TIMEOUT, "10"); - con.setConnectTimeout(Util.getIntValue(timeout) * 1000); - - if (Util.isVerbose()) { - System.out.println("Connecting to post registration data at " + url); - } - - con.setRequestMethod("POST"); - con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\""); - con.connect(); - - OutputStream out = con.getOutputStream(); - registration.storeToXML(out); - out.flush(); - out.close(); - - int returnCode = con.getResponseCode(); - if (Util.isVerbose()) { - System.out.println("POST return status = " + returnCode); - printReturnData(con, returnCode); - } - return (returnCode == HttpURLConnection.HTTP_OK); - } catch (MalformedURLException me) { - // should never reach here - InternalError x = new InternalError("Error in registering: " + me.getMessage()); - x.initCause(me); - throw x; - } catch (Exception ioe) { - // SocketTimeoutException, IOException or UnknownHostException - if (Util.isVerbose()) { - ioe.printStackTrace(); - } - return false; - } - } - - /** - * Opens the offline registratioin page in the browser. - * - */ - private static void openOfflineRegisterPage() - throws IOException { - if (!BrowserSupport.isSupported()) { - if (Util.isVerbose()) { - System.out.println("Browser is not supported"); - } - return; - } - - File registerPage = Installer.getRegistrationHtmlPage(); - try { - BrowserSupport.browse(registerPage.toURI()); - } catch (FileNotFoundException ex) { - // should never reach here - InternalError x = - new InternalError("Error in launching " + registerPage + ": " + ex.getMessage()); - x.initCause(ex); - throw x; - } catch (IllegalArgumentException ex) { - if (Util.isVerbose()) { - ex.printStackTrace(); - } - } catch (UnsupportedOperationException ex) { - // ignore if not supported - if (Util.isVerbose()) { - ex.printStackTrace(); - } - } - } - - private static void printReturnData(HttpURLConnection con, int returnCode) - throws IOException { - BufferedReader reader = null; - try { - if (returnCode < 400) { - reader = new BufferedReader( - new InputStreamReader(con.getInputStream())); - } else { - reader = new BufferedReader( - new InputStreamReader(con.getErrorStream())); - } - StringBuilder sb = new StringBuilder(); - String line; - while ((line = reader.readLine()) != null) { - sb.append(line).append("\n"); - } - System.out.println("Response is : "); - System.out.println(sb.toString()); - } finally { - if (reader != null) { - reader.close(); - } - } - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java b/desktop/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java deleted file mode 100644 index 92d0b8a4ce75..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java +++ /dev/null @@ -1,372 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -import java.io.*; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.Set; - -import static com.sun.star.servicetag.Util.*; -import static com.sun.star.servicetag.RegistrationDocument.*; - -/** - * Class containing additional methods that are not yet - * in the JDK Registry class. Note that all methods in this class - * will be superceeded by the JDK classes. - */ -public class SysnetRegistryHelper { - - private static final String STCLIENT_SOLARIS = "/usr/bin/stclient"; - private static final String STCLIENT_LINUX = "/opt/sun/servicetag/bin/stclient"; - // stclient exit value (see sthelper.h) - private static final int ST_ERR_NOT_AUTH = 245; - private static final int ST_ERR_REC_NOT_FOUND = 225; - - // The stclient output has to be an exported interface - private static final String INSTANCE_URN_OPEN_ELEMENT = "<instance_urn>"; - private static final String INSTANCE_URN_CLOSE_ELEMENT = "</instance_urn>"; - private static final String REGISTRY_URN = "<registry urn=\""; - private static final String INSTANCE_URN_DESC = "Product instance URN="; - private static boolean initialized = false; - private static boolean supportsHelperClass = true; // default - private static File stclient = null; - private static String stclientPath = null; - - // System properties for testing - private static String SVCTAG_STCLIENT_CMD = "servicetag.stclient.cmd"; - private static String SVCTAG_STHELPER_SUPPORTED = "servicetag.sthelper.supported"; - - private synchronized static String getSTclient() { - if (!initialized) { - // the system property always overrides the default setting - if (System.getProperty(SVCTAG_STHELPER_SUPPORTED) != null) { - supportsHelperClass = Boolean.getBoolean(SVCTAG_STHELPER_SUPPORTED); - } - - // This is only used for testing - stclientPath = System.getProperty(SVCTAG_STCLIENT_CMD); - if (stclientPath != null) { - return stclientPath; - } - - // Initialization to determine the platform's stclient pathname - String os = System.getProperty("os.name"); - if (os.equals("SunOS")) { - stclient = new File(STCLIENT_SOLARIS); - } else if (os.equals("Linux")) { - stclient = new File(STCLIENT_LINUX); - } else if (os.startsWith("Windows")) { - stclient = getWindowsStClientFile(); - } else { - if (isVerbose()) { - System.out.println("Running on non-Sun JDK"); - } - } - initialized = true; - } - - // com.sun.servicetag package has to be compiled with JDK 5 as well - // JDK 5 doesn't support the File.canExecute() method. - // Risk not checking isExecute() for the stclient command is very low. - - if (stclientPath == null && stclient != null && stclient.exists()) { - stclientPath = stclient.getAbsolutePath(); - } - return stclientPath; - } - - private static List<String> getCommandList() { - // Set up the arguments to call stclient - List<String> command = new ArrayList<String>(); - if (System.getProperty(SVCTAG_STCLIENT_CMD) != null) { - // This is for jtreg testing use. This will be set to something - // like: - // $JAVA_HOME/bin/java -cp $TEST_DIR \ - // -Dstclient.registry.path=$TEST_DIR/registry.xml \ - // SvcTagClient - // - // On Windows, the JAVA_HOME and TEST_DIR path could contain - // space e.g. c:\Program Files\Java\jdk1.6.0_05\bin\java. - // The SVCTAG_STCLIENT_CMD must be set with a list of - // space-separated parameters. If a parameter contains spaces, - // it must be quoted with '"'. - - String cmd = getSTclient(); - int len = cmd.length(); - int i = 0; - while (i < len) { - char separator = ' '; - if (cmd.charAt(i) == '"') { - separator = '"'; - i++; - } - // look for the separator or matched the closing '"' - int j; - for (j = i+1; j < len; j++) { - if (cmd.charAt(j) == separator) { - break; - } - } - - if (i == j-1) { - // add an empty parameter - command.add("\"\""); - } else { - // double quotes and space are not included - command.add(cmd.substring(i,j)); - } - - // skip spaces - for (i = j+1; i < len; i++) { - if (!Character.isSpaceChar(cmd.charAt(i))) { - break; - } - } - } - if (isVerbose()) { - System.out.println("Command list:"); - for (String s : command) { - System.out.println(s); - } - } - } else { - command.add(getSTclient()); - } - return command; - } - - // Returns null if the service tag record not found; - // or throw UnauthorizedAccessException or IOException - // based on the exitValue. - private static ServiceTag checkReturnError(int exitValue, - String output, - ServiceTag st) throws IOException { - switch (exitValue) { - case ST_ERR_REC_NOT_FOUND: - return null; - case ST_ERR_NOT_AUTH: - if (st != null) { - throw new UnauthorizedAccessException( - "Not authorized to access " + st.getInstanceURN() + - " installer_uid=" + st.getInstallerUID()); - } else { - throw new UnauthorizedAccessException( - "Not authorized:" + output); - } - default: - throw new IOException("stclient exits with error" + - " (" + exitValue + ")\n" + output); - } - } - - /** - * Returns a {@code ServiceTag} object of the given <tt>instance_urn</tt> - * in this registry. - * - * @param instanceURN the <tt>instance_urn</tt> of the service tag - * @return a {@code ServiceTag} object of the given <tt>instance_urn</tt> - * in this registry; or {@code null} if not found. - * - * @throws java.io.IOException if an I/O error occurs in this operation. - */ - private static ServiceTag getServiceTag(String instanceURN) throws IOException { - if (instanceURN == null) { - throw new NullPointerException("instanceURN is null"); - } - - List<String> command = getCommandList(); - command.add("-g"); - command.add("-i"); - command.add(instanceURN); - - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - if (isVerbose()) { - System.out.println("Output from stclient -g command:"); - System.out.println(output); - } - if (p.exitValue() == 0) { - return parseServiceTag(output); - } else { - return checkReturnError(p.exitValue(), output, null); - } - } - - private static ServiceTag parseServiceTag(String output) throws IOException { - BufferedReader in = null; - try { - Properties props = new Properties(); - // parse the service tag output from stclient - in = new BufferedReader(new StringReader(output)); - String line = null; - while ((line = in.readLine()) != null) { - if ((line = line.trim()).length() > 0) { - String[] ss = line.trim().split("=", 2); - if (ss.length == 2) { - props.setProperty(ss[0].trim(), ss[1].trim()); - } else { - props.setProperty(ss[0].trim(), ""); - } - } - } - - String urn = props.getProperty(ST_NODE_INSTANCE_URN); - String productName = props.getProperty(ST_NODE_PRODUCT_NAME); - String productVersion = props.getProperty(ST_NODE_PRODUCT_VERSION); - String productURN = props.getProperty(ST_NODE_PRODUCT_URN); - String productParent = props.getProperty(ST_NODE_PRODUCT_PARENT); - String productParentURN = props.getProperty(ST_NODE_PRODUCT_PARENT_URN); - String productDefinedInstanceID = - props.getProperty(ST_NODE_PRODUCT_DEFINED_INST_ID); - String productVendor = props.getProperty(ST_NODE_PRODUCT_VENDOR); - String platformArch = props.getProperty(ST_NODE_PLATFORM_ARCH); - String container = props.getProperty(ST_NODE_CONTAINER); - String source = props.getProperty(ST_NODE_SOURCE); - int installerUID = - Util.getIntValue(props.getProperty(ST_NODE_INSTALLER_UID)); - Date timestamp = - Util.parseTimestamp(props.getProperty(ST_NODE_TIMESTAMP)); - - return new ServiceTag(urn, - productName, - productVersion, - productURN, - productParent, - productParentURN, - productDefinedInstanceID, - productVendor, - platformArch, - container, - source, - installerUID, - timestamp); - } finally { - if (in != null) { - in.close(); - } - } - - } - - /** - * Returns the urn of this registry. - * - * @return a {@code String} for the urn of this registry. - * - * @throws java.io.IOException if an I/O error occurs in this operation. - */ - // Once JDK makes this method available, we'll deprecate this method - // @deprecated Use the JDK version when available. - public static String getRegistryURN() throws IOException { - List<String> command = getCommandList(); - command.add("-x"); - - BufferedReader in = null; - try { - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - - String registryURN = null; - if (p.exitValue() == 0) { - // parse the service tag output from stclient - in = new BufferedReader(new StringReader(output)); - String line = null; - while ((line = in.readLine()) != null) { - String s = line.trim(); - if (s.indexOf(REGISTRY_URN) != -1) { - s = s.substring(s.indexOf(REGISTRY_URN) - + REGISTRY_URN.length()); - if (s.indexOf("\"") != -1) { - s = s.substring(0, s.indexOf("\"")); - registryURN = s; - break; - } - } - } - } else { - checkReturnError(p.exitValue(), output, null); - } - return registryURN; - } finally { - if (in != null) { - in.close(); - } - } - } - - /** - * Returns all the service tags in this registry. - * - * @return a {@code Set} of {@code ServiceTag} objects - * in this registry. - * - * @throws java.io.IOException if an I/O error occurs in this operation. - */ - // Once JDK makes this method available, we'll deprecate this method - // @deprecated Use the JDK version when available. - public static Set<ServiceTag> getServiceTags() throws IOException { - List<String> command = getCommandList(); - command.add("-x"); - - BufferedReader in = null; - try { - ProcessBuilder pb = new ProcessBuilder(command); - Process p = pb.start(); - String output = commandOutput(p); - - Set<ServiceTag> instances = new HashSet<ServiceTag>(); - if (p.exitValue() == 0) { - // parse the service tag output from stclient - in = new BufferedReader(new StringReader(output)); - String line = null; - while ((line = in.readLine()) != null) { - String s = line.trim(); - if (s.indexOf(INSTANCE_URN_OPEN_ELEMENT) != -1 - && s.indexOf(INSTANCE_URN_CLOSE_ELEMENT) != -1) { - s = s.substring(s.indexOf(INSTANCE_URN_OPEN_ELEMENT) - + INSTANCE_URN_OPEN_ELEMENT.length(), - s.indexOf(INSTANCE_URN_CLOSE_ELEMENT)); - try { - instances.add(getServiceTag(s)); - } catch (Exception e) { - } - } - } - } else { - checkReturnError(p.exitValue(), output, null); - } - return instances; - } finally { - if (in != null) { - in.close(); - } - } - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java deleted file mode 100644 index c6f09d148ace..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java +++ /dev/null @@ -1,432 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -// The Service Tags team maintains the latest version of the implementation -// for system environment data collection. JDK will include a copy of -// the most recent released version for a JDK release. We rename -// the package to com.sun.servicetag so that the Sun Connection -// product always uses the latest version from the com.sun.scn.servicetags -// package. JDK and users of the com.sun.servicetag API -// (e.g. NetBeans and SunStudio) will use the version in JDK. - -import java.io.*; -import java.net.InetAddress; -import java.net.UnknownHostException; - -/** - * SystemEnvironment class collects the environment data with the - * best effort from the underlying platform. - */ -public class SystemEnvironment { - private String hostname; - private String hostId; - private String osName; - private String osVersion; - private String osArchitecture; - private String systemModel; - private String systemManufacturer; - private String cpuManufacturer; - private String serialNumber; - private String physmem; - private String sockets; - private String cores; - private String virtcpus; - private String cpuname; - private String clockrate; - private static SystemEnvironment sysEnv = null; - - public static synchronized SystemEnvironment getSystemEnvironment() { - if (sysEnv == null) { - String os = System.getProperty("os.name"); - if (os.equals("SunOS")) { - sysEnv = new SolarisSystemEnvironment(); - } else if (os.equals("Linux")) { - sysEnv = new LinuxSystemEnvironment(); - } else if (os.startsWith("Windows")) { - sysEnv = new WindowsSystemEnvironment(); - } else { - sysEnv = new SystemEnvironment(); - } - } - return sysEnv; - } - - // package-private - SystemEnvironment() { - try { - this.hostname = InetAddress.getLocalHost().getHostName(); - } catch (UnknownHostException ex) { - this.hostname = "Unknown host"; - } - this.hostId = ""; - this.osName = System.getProperty("os.name"); - this.osVersion = System.getProperty("os.version"); - this.osArchitecture = System.getProperty("os.arch"); - this.systemModel = ""; - this.systemManufacturer = ""; - this.cpuManufacturer = ""; - this.serialNumber = ""; - this.physmem = "0"; - this.sockets = "0"; - this.cores = "0"; - this.virtcpus = "0"; - this.cpuname = ""; - this.clockrate = "0"; - } - - - /** - * Sets the hostname. - * @param hostname The hostname to set. - */ - public void setHostname(String hostname) { - this.hostname = hostname; - } - - /** - * Sets the OS name. - * @param osName The osName to set. - */ - public void setOsName(String osName) { - this.osName = osName; - } - - /** - * Sets the OS version. - * @param osVersion The osVersion to set. - */ - public void setOsVersion(String osVersion) { - this.osVersion = osVersion; - } - - /** - * Sets the OS architecture. - * @param osArchitecture The osArchitecture to set. - */ - public void setOsArchitecture(String osArchitecture) { - this.osArchitecture = osArchitecture; - } - - /** - * Sets the system model. - * @param systemModel The systemModel to set. - */ - public void setSystemModel(String systemModel) { - this.systemModel = systemModel; - } - - /** - * Sets the system manufacturer. - * @param systemManufacturer The systemManufacturer to set. - */ - public void setSystemManufacturer(String systemManufacturer) { - this.systemManufacturer = systemManufacturer; - } - - /** - * Sets the cpu manufacturer. - * @param cpuManufacturer The cpuManufacturer to set. - */ - public void setCpuManufacturer(String cpuManufacturer) { - this.cpuManufacturer = cpuManufacturer; - } - - /** - * Sets the serial number. - * @param serialNumber The serialNumber to set. - */ - public void setSerialNumber(String serialNumber) { - this.serialNumber = serialNumber; - } - - /** - * Sets the physmem - * @param physmem The physmem to set. - */ - public void setPhysMem(String physmem) { - if (physmem.length() == 0) - physmem = "0"; - this.physmem = physmem; - } - - /** - * Sets the sockets - * @param sockets The sockets to set. - */ - public void setSockets(String sockets) { - if (sockets.length() == 0) - sockets = "0"; - this.sockets = sockets; - } - - /** - * Sets the cores - * @param cores The cores to set. - */ - public void setCores(String cores) { - if (cores.length() == 0) - cores ="0"; - this.cores = cores; - } - - /** - * Sets the virtcpus - * @param virtcpus The virtcpus to set. - */ - public void setVirtCpus(String virtcpus) { - if (virtcpus.length() == 0) - virtcpus = "0"; - this.virtcpus = virtcpus; - } - - /** - * Sets the cpuname - * @param cpuname The cpuname to set. - */ - public void setCpuName(String cpuname) { - this.cpuname = cpuname; - } - - /** - * Sets the clockrate - * @param clockrate The clockrate to set. - */ - public void setClockRate(String clockrate) { - if (clockrate.length() == 0) - this.clockrate = "0"; - else - { - Float f = Float.parseFloat(clockrate); - Integer nClockrate = f.intValue(); - this.clockrate = nClockrate.toString(); - } - } - - /** - * Sets the hostid. Truncates to a max length of 16 chars. - * @param hostId The hostid to set. - */ - public void setHostId(String hostId) { - if (hostId == null || hostId.equals("null")) { - hostId = ""; - } - if (hostId.length() > 16) { - hostId = hostId.substring(0,16); - } - this.hostId = hostId; - } - - /** - * Returns the hostname. - * @return The hostname. - */ - public String getHostname() { - return hostname; - } - - /** - * Returns the osName. - * @return The osName. - */ - public String getOsName() { - return osName; - } - - /** - * Returns the osVersion. - * @return The osVersion. - */ - public String getOsVersion() { - return osVersion; - } - - /** - * Returns the osArchitecture. - * @return The osArchitecture. - */ - public String getOsArchitecture() { - return osArchitecture; - } - - /** - * Returns the systemModel. - * @return The systemModel. - */ - public String getSystemModel() { - return systemModel; - } - - /** - * Returns the systemManufacturer. - * @return The systemManufacturer. - */ - public String getSystemManufacturer() { - return systemManufacturer; - } - - /** - * Returns the serialNumber. - * @return The serialNumber. - */ - public String getSerialNumber() { - return serialNumber; - } - - public String getPhysMem() { - return physmem; - } - - public String getSockets() { - return sockets; - } - - public String getCores() { - return cores; - } - - public String getVirtCpus() { - return virtcpus; - } - - public String getCpuName() { - return cpuname; - } - - public String getClockRate() { - return clockrate; - } - - /** - * Returns the hostId. - * @return The hostId. - */ - public String getHostId() { - return hostId; - } - - /** - * Returns the cpuManufacturer. - * @return The cpuManufacturer. - */ - public String getCpuManufacturer() { - return cpuManufacturer; - } - - protected String getCommandOutput(String... command) { - StringBuilder sb = new StringBuilder(); - BufferedReader br = null; - Process p = null; - try { - ProcessBuilder pb = new ProcessBuilder(command); - p = pb.start(); - p.waitFor(); - - if (p.exitValue() == 0) { - br = new BufferedReader(new InputStreamReader(p.getInputStream())); - String line = null; - while ((line = br.readLine()) != null) { - line = line.trim(); - if (line.length() > 0) { - if (sb.length() > 0) { - sb.append("\n"); - } - sb.append(line); - } - } - } - return sb.toString(); - } catch (InterruptedException ie) { - // in case the command hangs - if (p != null) { - p.destroy(); - } - return ""; - } catch (Exception e) { - // ignore exception - return ""; - } finally { - if (p != null) { - try { - p.getErrorStream().close(); - } catch (IOException e) { - // ignore - } - try { - p.getInputStream().close(); - } catch (IOException e) { - // ignore - } - try { - p.getOutputStream().close(); - } catch (IOException e) { - // ignore - } - p = null; - } - if (br != null) { - try { - br.close(); - } catch (IOException e) { - // ignore - } - } - } - } - - protected String getFileContent(String filename) { - File f = new File(filename); - if (!f.exists()) { - return ""; - } - - StringBuilder sb = new StringBuilder(); - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(f)); - String line = null; - while ((line = br.readLine()) != null) { - line = line.trim(); - if (line.length() > 0) { - if (sb.length() > 0) { - sb.append("\n"); - } - sb.append(line); - } - } - return sb.toString(); - } catch (Exception e) { - // ignore exception - return ""; - } finally { - if (br != null) { - try { - br.close(); - } catch (IOException e) { - // ignore - } - } - } - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java b/desktop/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java deleted file mode 100644 index 37af57292a5b..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -/** - * Thrown if the user is not authorized to - * {@link Registry#updateServiceTag update} or - * {@link Registry#removeServiceTag remove} - * a service tag from a {@link Registry}. - */ -public class UnauthorizedAccessException extends RuntimeException { - - /** - * Constructs an <code>UnauthorizedAccessException</code> object - * without detail message. - */ - public UnauthorizedAccessException() { - } - - - /** - * Constructs an <code>UnauthorizedAccessException</code> object - * with the specified detail message. - * - * @param msg the detail message. - */ - public UnauthorizedAccessException(String msg) { - super(msg); - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/Util.java b/desktop/source/registration/com/sun/star/servicetag/Util.java deleted file mode 100644 index 75f332c68593..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/Util.java +++ /dev/null @@ -1,289 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -import java.io.*; -import java.util.Date; -import java.text.SimpleDateFormat; -import java.text.ParseException; -import java.util.TimeZone; -import java.util.UUID; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -// Utility class for com.sun.servicetag package -class Util { - private static boolean verbose = (System.getProperty("servicetag.verbose") != null); - private static String jrepath = null; - - // for debugging and tracing - static boolean isVerbose() { - return verbose; - } - - /** - * Gets the pathname of JRE in the running platform - * This can be a JDK or JRE. - */ - static synchronized String getJrePath() { - if (jrepath == null) { - // Determine the JRE path by checking the existence of - // <HOME>/jre/lib and <HOME>/lib. - String javaHome = System.getProperty("java.home"); - jrepath = javaHome + File.separator + "jre"; - File f = new File(jrepath, "lib"); - if (!f.exists()) { - // java.home usually points to the JRE path - jrepath = javaHome; - } - } - return jrepath; - } - - /** - * Tests if the running platform is a JDK. - */ - static boolean isJdk() { - // <HOME>/jre exists which implies it's a JDK - return getJrePath().endsWith(File.separator + "jre"); - } - - /** - * Generates the URN string of "urn:st" namespace - */ - static String generateURN() { - return "urn:st:" + UUID.randomUUID().toString(); - } - - static int getIntValue(String value) { - try { - return Integer.parseInt(value); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("\"" + value + "\"" + - " expected to be an integer"); - } - } - - /** - * Formats the Date into a timestamp string in YYYY-MM-dd HH:mm:ss GMT. - * @param timestamp Date - * @return a string representation of the timestamp - * in the YYYY-MM-dd HH:mm:ss GMT format. - */ - static String formatTimestamp(Date timestamp) { - if (timestamp == null) { - return "[No timestamp]"; - } - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); - df.setTimeZone(TimeZone.getTimeZone("GMT")); - return df.format(timestamp); - } - - /** - * Parses a timestamp string in YYYY-MM-dd HH:mm:ss GMT format. - * @param timestamp Timestamp in the YYYY-MM-dd HH:mm:ss GMT format. - * @return Date - */ - static Date parseTimestamp(String timestamp) { - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); - df.setTimeZone(TimeZone.getTimeZone("GMT")); - try { - return df.parse(timestamp); - } catch (ParseException e) { - // should not reach here - e.printStackTrace(); - return new Date(); - } - } - - static String commandOutput(Process p) throws IOException { - Reader r = null; - Reader err = null; - try { - r = new InputStreamReader(p.getInputStream()); - err = new InputStreamReader(p.getErrorStream()); - String output = commandOutput(r); - String errorMsg = commandOutput(err); - p.waitFor(); - return output + errorMsg.trim(); - } catch (InterruptedException e) { - if (isVerbose()) { - e.printStackTrace(); - } - return e.getMessage(); - } finally { - if (r != null) { - r.close(); - } - if (err != null) { - err.close(); - } - } - } - - static String commandOutput(Reader r) throws IOException { - StringBuilder sb = new StringBuilder(); - int c; - while ((c = r.read()) > 0) { - if (c != '\r') { - sb.append((char) c); - } - } - return sb.toString(); - } - - static int getJdkVersion() { - parseVersion(); - return jdkVersion; - } - - static int getUpdateVersion() { - parseVersion(); - return jdkUpdate; - } - - private static int jdkVersion = 0; - private static int jdkUpdate = 0; - private static synchronized void parseVersion() { - if (jdkVersion > 0) { - return; - } - - // parse java.runtime.version - // valid format of the version string is: - // n.n.n[_uu[c]][-<identifer>]-bxx - String cs = System.getProperty("java.runtime.version"); - if (cs.length() >= 5 && - Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' && - Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' && - Character.isDigit(cs.charAt(4))) { - jdkVersion = Character.digit(cs.charAt(2), 10); - cs = cs.substring(5, cs.length()); - if (cs.charAt(0) == '_' && cs.length() >= 3 && - Character.isDigit(cs.charAt(1)) && - Character.isDigit(cs.charAt(2))) { - int nextChar = 3; - try { - String uu = cs.substring(1, 3); - jdkUpdate = Integer.valueOf(uu).intValue(); - } catch (NumberFormatException e) { - // not conforming to the naming convention - return; - } - } - } else { - throw new InternalError("Invalid java.runtime.version" + cs); - } - } - - /** - * Returns this java string as a null-terminated byte array - */ - private static byte[] stringToByteArray(String str) { - return (str + "\u0000").getBytes(); - } - - /** - * Converts a null-terminated byte array to java string - */ - private static String byteArrayToString(byte[] array) { - return new String(array, 0, array.length -1); - } - - /** - * Gets the stclient path using a well known location from - * the Windows platform Registry, otherwise it will return null. - */ - static File getWindowsStClientFile() { - File out = null; - String regKey = "software\\microsoft\\windows\\currentversion\\app paths\\stclient.exe"; - String keyName = "" ; // use the default key - String path = getRegistryKey(regKey, keyName); - - if (path != null && (new File(path)).exists()) { - out = new File(path); - } - if (isVerbose()) { - System.out.println("stclient=" + out); - } - return out; - } - - /** - * This uses reflection to access a private java windows registry - * interface, any changes to that Class must be appropriately adjusted. - * Returns a null if unsuccessful. - */ - private static String getRegistryKey(String regKey, String keyName) { - String out = null; - try { - Class<?> clazz = Class.forName("java.util.prefs.WindowsPreferences"); - - // Get the registry methods - Method winRegOpenKeyM = clazz.getDeclaredMethod("WindowsRegOpenKey", - int.class, byte[].class, int.class); - winRegOpenKeyM.setAccessible(true); - - Method winRegCloseKeyM = clazz.getDeclaredMethod("WindowsRegCloseKey", - int.class); - winRegCloseKeyM.setAccessible(true); - - Method winRegQueryValueM = clazz.getDeclaredMethod("WindowsRegQueryValueEx", - int.class, byte[].class); - winRegQueryValueM.setAccessible(true); - - // Get all the constants we need - int HKLM = getValueFromStaticField("HKEY_LOCAL_MACHINE", clazz); - int KEY_READ = getValueFromStaticField("KEY_READ", clazz); - int ERROR_CODE = getValueFromStaticField("ERROR_CODE", clazz); - int NATIVE_HANDLE = getValueFromStaticField("NATIVE_HANDLE", clazz); - int ERROR_SUCCESS = getValueFromStaticField("ERROR_SUCCESS", clazz); - - // Convert keys - byte[] reg = stringToByteArray(regKey); - byte[] key = stringToByteArray(keyName); - - // Open the registry - int[] result = (int[]) winRegOpenKeyM.invoke(null, HKLM, reg, KEY_READ); - - if (result[ERROR_CODE] == ERROR_SUCCESS) { - byte[] stvalue = (byte[]) winRegQueryValueM.invoke(null, - result[NATIVE_HANDLE], key); - out = byteArrayToString(stvalue); - winRegCloseKeyM.invoke(null, result[NATIVE_HANDLE]); - } - } catch (Exception ex) { - if (isVerbose()) { - ex.printStackTrace(); - } - } - return out; - } - - private static int getValueFromStaticField(String fldName, Class<?> klass) throws Exception { - Field f = klass.getDeclaredField(fldName); - f.setAccessible(true); - return f.getInt(null); - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java deleted file mode 100644 index 67e731863735..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -package com.sun.star.servicetag; - -// The Service Tags team maintains the latest version of the implementation -// for system environment data collection. JDK will include a copy of -// the most recent released version for a JDK release. We rename -// the package to com.sun.servicetag so that the Sun Connection -// product always uses the latest version from the com.sun.scn.servicetags -// package. JDK and users of the com.sun.servicetag API -// (e.g. NetBeans and SunStudio) will use the version in JDK. - -import java.io.*; -import java.util.ArrayList; -import java.util.List; -import java.util.HashSet; -import java.util.Set; - -/** - * Windows implementation of the SystemEnvironment class. - */ -class WindowsSystemEnvironment extends SystemEnvironment { - WindowsSystemEnvironment() { - super(); - - // run a call to make sure things are initialized - // ignore the first call result as the system may - // give inconsistent data on the first invocation ever - getWmicResult("computersystem", "get", "model"); - - setSystemModel(getWmicResult("computersystem", "get", "model")); - setSystemManufacturer(getWmicResult("computersystem", "get", "manufacturer")); - setSerialNumber(getWmicResult("bios", "get", "serialnumber")); - - String cpuMfr = getWmicResult("cpu", "get", "manufacturer"); - // this isn't as good an option, but if we couldn't get anything - // from wmic, try the processor_identifier - if (cpuMfr.length() == 0) { - String procId = System.getenv("processor_identifer"); - if (procId != null) { - String[] s = procId.split(","); - cpuMfr = s[s.length - 1].trim(); - } - } - setCpuManufacturer(cpuMfr); - - setSockets(getWindowsSockets()); - setCores(getWindowsCores()); - setVirtCpus(getWindowsVirtCpus()); - setPhysMem(getWindowsPhysMem()); - setCpuName(getWmicResult("cpu", "get", "Name")); - setClockRate(getWmicResult("cpu", "get", "MaxClockSpeed")); - - // try to remove the temp file that gets created from running wmic cmds - try { - // look in the current working directory - File f = new File("TempWmicBatchFile.bat"); - if (f.exists()) { - f.delete(); - } - } catch (Exception e) { - // ignore the exception - } - } - - private String getWindowsVirtCpus() { - String res = getWmicResult("cpu", "get", "NumberOfLogicalProcessors"); - if (res == null || res.equals("")) { - res = "1"; - } - return res; - } - - private String getWindowsCores() { - String res = getWmicResult("cpu", "get", "NumberOfCores"); - if (res == null || res.equals("")) { - res = "1"; - } - return res; - } - - private String getWindowsSockets() { - String res = getFullWmicResult("cpu", "get", "DeviceID"); - Set<String> set = new HashSet<String>(); - for (String line : res.split("\n")) { - line = line.trim(); - if (line.equals("")) { - continue; - } - set.add(line); - } - if (set.size() == 0) { - return "1"; - } - return "" + set.size(); - } - - private String getWindowsPhysMem() { - String mem = getWmicResult("computersystem", "get", "TotalPhysicalMemory"); - long l = Long.parseLong(mem); - return "" + ((long) (l / (1024*1024))); - } - - - /** - * This method invokes wmic outside of the normal environment - * collection routines. - * - * An initial call to wmic can be costly in terms of time. - * - * <code> - * Details of why the first call is costly can be found at: - * - * http://support.microsoft.com/kb/290216/en-us - * - * "When you run the Wmic.exe utility for the first time, the utility - * compiles its .mof files into the repository. To save time during - * Windows installation, this operation takes place as necessary." - * </code> - */ - private String getWmicResult(String alias, String verb, String property) { - String res = ""; - BufferedReader in = null; - try { - ProcessBuilder pb = new ProcessBuilder("cmd", "/C", "WMIC", alias, verb, property); - Process p = pb.start(); - // need this for executing windows commands (at least - // needed for executing wmic command) - BufferedWriter bw = new BufferedWriter( - new OutputStreamWriter(p.getOutputStream())); - bw.write(13); - bw.flush(); - bw.close(); - - p.waitFor(); - if (p.exitValue() == 0) { - in = new BufferedReader(new InputStreamReader(p.getInputStream())); - String line = null; - while ((line = in.readLine()) != null) { - line = line.trim(); - if (line.length() == 0) { - continue; - } - res = line; - } - // return the *last* line read - return res; - } - - } catch (Exception e) { - // ignore the exception - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - // ignore - } - } - } - return res.trim(); - } - - private String getFullWmicResult(String alias, String verb, String property) { - String res = ""; - BufferedReader in = null; - try { - ProcessBuilder pb = new ProcessBuilder("cmd", "/C", "WMIC", alias, verb, property); - Process p = pb.start(); - // need this for executing windows commands (at least - // needed for executing wmic command) - BufferedWriter bw = new BufferedWriter( - new OutputStreamWriter(p.getOutputStream())); - bw.write(13); - bw.flush(); - bw.close(); - - p.waitFor(); - if (p.exitValue() == 0) { - in = new BufferedReader(new InputStreamReader(p.getInputStream())); - String line = null; - while ((line = in.readLine()) != null) { - line = line.trim(); - if (line.length() == 0) { - continue; - } - if (line.toLowerCase().indexOf(property.toLowerCase()) != -1) { - continue; - } - res += line + "\n"; - } - } - - } catch (Exception e) { - // ignore the exception - } finally { - if (in != null) { - try { - in.close(); - } catch (IOException e) { - // ignore - } - } - } - return res; - } -} diff --git a/desktop/source/registration/com/sun/star/servicetag/makefile.mk b/desktop/source/registration/com/sun/star/servicetag/makefile.mk deleted file mode 100644 index 82348310fd9e..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/makefile.mk +++ /dev/null @@ -1,75 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -PRJNAME = setup_native -PRJ = ..$/..$/..$/..$/..$/.. -TARGET = servicetag -PACKAGE = com$/sun$/star$/servicetag - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -.IF "$(ENABLE_SVCTAGS)" == "YES" - -JARFILES = jurt.jar unoil.jar ridl.jar -JAVAFILES = \ - BrowserSupport.java \ - Installer.java \ - LinuxSystemEnvironment.java \ - RegistrationData.java \ - RegistrationDocument.java \ - Registry.java \ - ServiceTag.java \ - SolarisServiceTag.java \ - SolarisSystemEnvironment.java \ - SunConnection.java \ - SysnetRegistryHelper.java \ - SystemEnvironment.java \ - UnauthorizedAccessException.java \ - Util.java \ - WindowsSystemEnvironment.java - -JAVACLASSFILES= $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE -JARCLASSDIRS = $(PACKAGE) - -JAVARES= $(CLASSDIR)$/$(PACKAGE)$/resources$/product_registration.xsd - -.ENDIF # "$(ENABLE_SVCTAGS)" == "YES" - -# --- Targets ------------------------------------------------------ - - -.INCLUDE : target.mk - -.IF "$(ENABLE_SVCTAGS)" == "YES" -ALLTAR: $(JAVARES) - -$(JAVARES) : $$(@:d:d:f)$/$$(@:f) - $(MKDIRHIER) $(@:d) - $(COPY) $< $@ - -.ENDIF # "$(ENABLE_SVCTAGS)" == "YES" diff --git a/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd b/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd deleted file mode 100644 index 6681a563a01e..000000000000 --- a/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd +++ /dev/null @@ -1,366 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - -<xs:element name="registration_data"> - <xs:complexType> - <xs:sequence> - <xs:element name="environment" - minOccurs="1" - maxOccurs="1"> - <xs:complexType> - <xs:sequence> - <xs:element ref="hostname" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="hostId" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="osName" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="osVersion" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="osArchitecture" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="systemModel" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="systemManufacturer" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="cpuManufacturer" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="serialNumber" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="physmem" - minOccurs='0' - maxOccurs='1'/> - <xs:element name="cpuinfo" - minOccurs='0' - maxOccurs='1'> - <xs:complexType> - <xs:sequence> - <xs:element ref="sockets" - minOccurs='0' - maxOccurs='1'/> - <xs:element ref="cores" - minOccurs='0' - maxOccurs='1'/> - <xs:element ref="virtcpus" - minOccurs='0' - maxOccurs='1'/> - <xs:element ref="name" - minOccurs='0' - maxOccurs='1'/> - <xs:element ref="clockrate" - minOccurs='0' - maxOccurs='1'/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="registry" - minOccurs="1" - maxOccurs="1"> - <xs:complexType> - <xs:sequence> - <xs:element name="service_tag" - minOccurs="0" - maxOccurs="1024"> - <xs:complexType> - <xs:sequence> - <xs:element ref="instance_urn" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="product_name" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="product_version" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="product_urn" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="product_parent_urn" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="product_parent" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="product_defined_inst_id" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="product_vendor" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="platform_arch" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="timestamp" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="container" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="source" - minOccurs='1' - maxOccurs='1'/> - <xs:element ref="installer_uid" - minOccurs='1' - maxOccurs='1'/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="urn" - type="xs:string" - use="required"/> - <xs:attribute name="version" - type="xs:string" - use="required"/> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute name="version" - type="xs:string" - use="required"/> - </xs:complexType> -</xs:element> - - <!-- definition of simple elements --> - <xs:element name="hostname"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="1"/> - <xs:maxLength value="255"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="hostId"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="16"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="osName"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="1"/> - <xs:maxLength value="256"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="osVersion"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="50"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="osArchitecture"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="256"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="systemModel"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="50"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="systemManufacturer"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="50"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="cpuManufacturer"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="50"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="serialNumber"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="256"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="instance_urn"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="1"/> - <xs:maxLength value="255"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="product_name"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:maxLength value="255"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="product_version"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:maxLength value="63"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="product_urn"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="1"/> - <xs:maxLength value="255"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="product_parent_urn"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="255"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="product_parent"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="255"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="product_defined_inst_id"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="255"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="product_vendor"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="63"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="platform_arch"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:minLength value="0"/> - <xs:maxLength value="63"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="timestamp"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:maxLength value="24"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="container"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:maxLength value="63"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="source"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:maxLength value="63"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="installer_uid"> - <xs:simpleType> - <xs:restriction base="xs:integer"> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="physmem"> - <xs:simpleType> - <xs:restriction base="xs:integer"/> - </xs:simpleType> - </xs:element> - - <xs:element name="sockets"> - <xs:simpleType> - <xs:restriction base="xs:integer"/> - </xs:simpleType> - </xs:element> - - <xs:element name="cores"> - <xs:simpleType> - <xs:restriction base="xs:integer"/> - </xs:simpleType> - </xs:element> - - <xs:element name="virtcpus"> - <xs:simpleType> - <xs:restriction base="xs:integer"/> - </xs:simpleType> - </xs:element> - - <xs:element name="name"> - <xs:simpleType> - <xs:restriction base="xs:string"> - <xs:maxLength value="128"/> - </xs:restriction> - </xs:simpleType> - </xs:element> - - <xs:element name="clockrate"> - <xs:simpleType> - <xs:restriction base="xs:integer"/> - </xs:simpleType> - </xs:element> - -</xs:schema> diff --git a/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml b/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml index 310e80f16c44..5987ae16cbf9 100644 --- a/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml +++ b/extensions/source/bibliography/uiconfig/sbibliography/menubar/menubar.xml @@ -85,7 +85,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index 93e4e813d5a0..e0b45bfc062e 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -61,7 +61,7 @@ using namespace ::com::sun::star::beans; // Please look at sfx2/inc/sfxsids.hrc the values are defined there. Due to build dependencies // we cannot include the header file. const sal_uInt16 SID_HELPMENU = (SID_SFX_START + 410); -const sal_uInt16 SID_ONLINE_REGISTRATION = (SID_SFX_START + 1537); +const sal_uInt16 SID_HELP_SUPPORTPAGE = (SID_SFX_START + 1683); namespace framework { @@ -208,33 +208,33 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me if ( pHelpMenu ) { - static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg"; + static const char REFERENCECOMMAND_AFTER[] = ".uno:HelpSupport"; static const char REFERENCECOMMAND_BEFORE[] = ".uno:About"; // Add-Ons help menu items should be inserted after the "registration" menu item bool bAddAfter = true; sal_uInt16 nItemCount = pHelpMenu->GetItemCount(); - sal_uInt16 nRegPos = pHelpMenu->GetItemPos( SID_ONLINE_REGISTRATION ); - sal_uInt16 nInsPos = nRegPos; + sal_uInt16 nSupPos = pHelpMenu->GetItemPos( SID_HELP_SUPPORTPAGE ); + sal_uInt16 nInsPos = nSupPos; sal_uInt16 nInsSepAfterPos = MENU_APPEND; sal_uInt16 nUniqueMenuId = ADDONMENU_ITEMID_START; AddonsOptions aOptions; - if ( nRegPos == USHRT_MAX ) + if ( nSupPos == USHRT_MAX ) { // try to detect the online registration dialog menu item with the command URL sal_uInt16 nId = FindMenuId( pHelpMenu, String::CreateFromAscii( REFERENCECOMMAND_AFTER )); - nRegPos = pHelpMenu->GetItemPos( nId ); - nInsPos = nRegPos; + nSupPos = pHelpMenu->GetItemPos( nId ); + nInsPos = nSupPos; } - if ( nRegPos == USHRT_MAX ) + if ( nSupPos == USHRT_MAX ) { // second try: // try to detect the about menu item with the command URL sal_uInt16 nId = FindMenuId( pHelpMenu, String::CreateFromAscii( REFERENCECOMMAND_BEFORE )); - nRegPos = pHelpMenu->GetItemPos( nId ); - nInsPos = nRegPos; + nSupPos = pHelpMenu->GetItemPos( nId ); + nInsPos = nSupPos; bAddAfter = false; } @@ -256,8 +256,8 @@ void AddonMenuManager::MergeAddonHelpMenu( const Reference< XFrame >& rFrame, Me if ( pHelpMenu->GetItemType( nInsSepAfterPos ) != MENUITEM_SEPARATOR ) pHelpMenu->InsertSeparator( nInsSepAfterPos ); } - if ( nRegPos < MENU_APPEND ) - pHelpMenu->InsertSeparator( nRegPos+1 ); + if ( nSupPos < MENU_APPEND ) + pHelpMenu->InsertSeparator( nSupPos+1 ); else pHelpMenu->InsertSeparator( nItemCount ); } diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index f99c90536cf1..4c493c84aad0 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -795,7 +795,7 @@ void SAL_CALL MenuBarManager::disposing( const EventObject& Source ) throw ( Run void MenuBarManager::CheckAndAddMenuExtension( Menu* pMenu ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::CheckAndAddMenuExtension" ); - static const char REFERENCECOMMAND_AFTER[] = ".uno:OnlineRegistrationDlg"; + static const char REFERENCECOMMAND_AFTER[] = ".uno:HelpSupport"; static const char REFERENCECOMMAND_BEFORE[] = ".uno:About"; // retrieve menu extension item diff --git a/framework/uiconfig/startmodule/menubar/menubar.xml b/framework/uiconfig/startmodule/menubar/menubar.xml index b5e52e7afac2..e9a0f333f4ce 100644 --- a/framework/uiconfig/startmodule/menubar/menubar.xml +++ b/framework/uiconfig/startmodule/menubar/menubar.xml @@ -75,7 +75,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/officecfg/registry/data/org/openoffice/Office/Common.xcu b/officecfg/registry/data/org/openoffice/Office/Common.xcu index f2df2249b56d..5edd8e64d47a 100644 --- a/officecfg/registry/data/org/openoffice/Office/Common.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Common.xcu @@ -134,19 +134,6 @@ <value>${STARTCENTER_LAYOUT_STYLE}</value> </prop> </node> - <node oor:name="Registration"> - <prop oor:name="TemplateURL"> - <value/> - </prop> - <prop oor:name="URL" install:module="brand"> - <value>${REGISTRATIONURL}</value> - </prop> - <prop oor:name="ReminderDate"> - <value>Patch</value> - </prop> - <node oor:name="ProductVersions"> - </node> - </node> <prop oor:name="System"> <value install:module="unx">UNIX</value> <value install:module="macosx">MAC</value> diff --git a/officecfg/registry/data/org/openoffice/Office/Jobs.xcu b/officecfg/registry/data/org/openoffice/Office/Jobs.xcu index 25c53d8b61b2..6a18dbad365a 100644 --- a/officecfg/registry/data/org/openoffice/Office/Jobs.xcu +++ b/officecfg/registry/data/org/openoffice/Office/Jobs.xcu @@ -24,11 +24,6 @@ <!DOCTYPE oor:component-data SYSTEM "../../../../component-update.dtd"> <oor:component-data oor:name="Jobs" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <node oor:name="Jobs"> - <node oor:name="RegistrationRequest" oor:op="replace"> - <prop oor:name="Service"> - <value>com.sun.star.setup.ProductRegistration</value> - </prop> - </node> </node> <node oor:name="Events"> <node oor:name="onFirstVisibleTask" oor:op="fuse"> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index fcd45f10c723..81a668da42ea 100755 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -3555,11 +3555,6 @@ <value>1</value> </prop> </node> - <node oor:name=".uno:OnlineRegistrationDlg" oor:op="replace"> - <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">~Registration...</value> - </prop> - </node> <node oor:name=".uno:GoToStartSel" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">Select to File Begin</value> diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index e283c04ff818..6e0da189a092 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -3526,59 +3526,6 @@ <value>0</value> </prop> </group> - <group oor:name="Registration"> - <info> - <author>FS</author> - <desc>Contains various settings regarding the product registration feature.</desc> - </info> - <prop oor:name="TemplateURL" oor:type="xs:string"> - <info> - <desc>Contains a string specifying the URL with placeholders to be used for online registration.</desc> - </info> - <value/> - <!-- JB: Empty default inserted into empty property node. Remove if NIL was intended --> - </prop> - <prop oor:name="URL" oor:type="xs:string"> - <info> - <desc>Contains a string specifying the real URL to be used for online registration.</desc> - </info> - <value/> - <!-- JB: Empty default inserted into empty property node. Remove if NIL was intended --> - </prop> - <prop oor:name="ReminderDate" oor:type="xs:string"> - <info> - <desc>Contains a string representation of the date on which the user receives a reminder (e.g. "13.02.2002").</desc> - </info> - <value/> - <!-- JB: Empty default inserted into empty property node. Remove if NIL was intended --> - </prop> - <prop oor:name="RequestDialog" oor:type="xs:int"> - <info> - <desc>Contains the number used internally to determine when the dialog should be started.</desc> - </info> - <value>1</value> - </prop> - <prop oor:name="ShowMenuItem" oor:type="xs:boolean"> - <info> - <desc>Contains a Boolean that specifies if the "Registration..." menu item is available.</desc> - </info> - <value>true</value> - </prop> - <prop oor:name="ProductVersionID" oor:type="xs:string"> - <info> - <author>CD/OBR</author> - <desc>Current product ID.</desc> - <deprecated>This data is saved in a dedicated file since OOo 3.0 FCS</deprecated> - </info> - </prop> - <set oor:name="ProductVersions" oor:node-type="ProductVersionID"> - <info> - <author>CD/OBR</author> - <desc>Specifies product specific IDs and associated instance UUIDs</desc> - <deprecated>This data is saved in a dedicated file since OOo 3.0 FCS</deprecated> - </info> - </set> - </group> </group> <group oor:name="Java"> <info> diff --git a/postprocess/packcomponents/makefile.mk b/postprocess/packcomponents/makefile.mk index c312b42eb525..e53ca21e49b3 100644 --- a/postprocess/packcomponents/makefile.mk +++ b/postprocess/packcomponents/makefile.mk @@ -64,7 +64,6 @@ my_components = \ component/svl/source/passwordcontainer/passwordcontainer \ component/svl/util/svl \ component/svtools/source/hatchwindow/hatchwindowfactory \ - component/svtools/source/productregistration/productregistration.uno \ component/svtools/util/svt \ component/svx/util/svx \ component/svx/util/svxcore \ @@ -252,10 +251,6 @@ my_components += kde4be1 my_components += ogltrans .END -.IF "$(ENABLE_SVCTAGS)" == "YES" -my_components += productregistration.jar -.END - .IF "$(SOLAR_JAVA)" == "TRUE" my_components += \ LuceneHelpWrapper \ diff --git a/postprocess/rebase/coffbase.txt b/postprocess/rebase/coffbase.txt index 9e654d7cc69c..be558cebe310 100755 --- a/postprocess/rebase/coffbase.txt +++ b/postprocess/rebase/coffbase.txt @@ -206,7 +206,6 @@ placewaremi.dll 0x0000000060bd0000 0x00010000 plmi.dll 0x0000000060b90000 0x00030000 pptimportermi.dll 0x0000000060b70000 0x00010000 preloadmi.dll 0x0000000060b40000 0x00020000 -productregistration.uno.dll 0x0000000060b20000 0x00010000 protocolhandlermi.dll 0x0000000060b00000 0x00010000 proxyfac.uno.dll 0x0000000060ae0000 0x00010000 purpenvhelper3msc.dll 0x0000000060ac0000 0x00010000 diff --git a/reportdesign/uiconfig/dbreport/menubar/menubar.xml b/reportdesign/uiconfig/dbreport/menubar/menubar.xml index 783fbcbca499..b62706ef17eb 100644 --- a/reportdesign/uiconfig/dbreport/menubar/menubar.xml +++ b/reportdesign/uiconfig/dbreport/menubar/menubar.xml @@ -409,7 +409,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index a6b772cca012..9132cc2d647f 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -441,7 +441,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/scp2/source/ooo/file_library_ooo.scp b/scp2/source/ooo/file_library_ooo.scp index 7570c98d16b8..ea2f9c52e16b 100755 --- a/scp2/source/ooo/file_library_ooo.scp +++ b/scp2/source/ooo/file_library_ooo.scp @@ -1039,8 +1039,6 @@ STD_LIB_FILE( gid_File_Lib_Pl , pl) STD_LIB_FILE( gid_File_Lib_Preload, preload) -SPECIAL_COMPONENT_LIB_FILE( gid_File_Lib_Productregistration, productregistration.uno ) - #if defined(UNX) && ! defined(QUARTZ) File gid_File_Lib_Desktop_Detector Name = LIBNAME(desktop_detector); diff --git a/scp2/source/ooo/file_ooo.scp b/scp2/source/ooo/file_ooo.scp index d0d5a5e490b2..76250ac98507 100644 --- a/scp2/source/ooo/file_ooo.scp +++ b/scp2/source/ooo/file_ooo.scp @@ -1757,15 +1757,6 @@ End #endif #endif -#ifdef ENABLE_SVCTAGS -File gid_File_Jar_Productregistration - TXT_FILE_BODY; - Name = "productregistration.jar"; - Dir = gid_Dir_Classes; - Styles = (PACKED); -End -#endif - File gid_File_Images_Zip TXT_FILE_BODY; Dir = gid_Dir_Share_Config; diff --git a/scp2/source/ooo/file_resource_ooo.scp b/scp2/source/ooo/file_resource_ooo.scp index 242ac04e7b25..cd9c885d3a90 100644 --- a/scp2/source/ooo/file_resource_ooo.scp +++ b/scp2/source/ooo/file_resource_ooo.scp @@ -64,8 +64,6 @@ STD_RES_FILE( gid_File_Res_Pdffilter, pdffilter) STD_RES_FILE( gid_File_Res_Preload, preload) -STD_RES_FILE( gid_File_Res_Productregistration, productregistration) - #ifdef UNX STD_RES_FILE( gid_File_Res_San, san ) diff --git a/scripting/workben/bindings/calcmenubar.xml b/scripting/workben/bindings/calcmenubar.xml index 21f6404c13a5..885b2bb6e870 100644 --- a/scripting/workben/bindings/calcmenubar.xml +++ b/scripting/workben/bindings/calcmenubar.xml @@ -311,7 +311,6 @@ <menu:menuitem menu:id="slot:5403" menu:helpid="5403" menu:label="~Extended Tips"/> <menu:menuseparator/> <menu:menuitem menu:id="slot:6683" menu:helpid="6683" menu:label="~Support"/> - <menu:menuitem menu:id="slot:6537" menu:helpid="6537" menu:label="~Registration..."/> <menu:menuseparator/> <menu:menuitem menu:id="slot:5301" menu:helpid="5301" menu:label="A~bout OpenOffice.org..."/> </menu:menupopup> diff --git a/scripting/workben/bindings/drawmenubar.xml b/scripting/workben/bindings/drawmenubar.xml index c1c644fe8374..be32d4a7bd9a 100644 --- a/scripting/workben/bindings/drawmenubar.xml +++ b/scripting/workben/bindings/drawmenubar.xml @@ -346,7 +346,6 @@ <menu:menuitem menu:id="slot:5403" menu:helpid="5403" menu:label="~Extended Tips"/> <menu:menuseparator/> <menu:menuitem menu:id="slot:6683" menu:helpid="6683" menu:label="~Support"/> - <menu:menuitem menu:id="slot:6537" menu:helpid="6537" menu:label="~Registration..."/> <menu:menuseparator/> <menu:menuitem menu:id="slot:5301" menu:helpid="5301" menu:label="A~bout OpenOffice.org..."/> </menu:menupopup> diff --git a/scripting/workben/bindings/impressmenubar.xml b/scripting/workben/bindings/impressmenubar.xml index ec51390d0411..c7e7eaa4c546 100644 --- a/scripting/workben/bindings/impressmenubar.xml +++ b/scripting/workben/bindings/impressmenubar.xml @@ -320,7 +320,6 @@ <menu:menuitem menu:id="slot:5403" menu:helpid="5403" menu:label="~Extended Tips"/> <menu:menuseparator/> <menu:menuitem menu:id="slot:6683" menu:helpid="6683" menu:label="~Support"/> - <menu:menuitem menu:id="slot:6537" menu:helpid="6537" menu:label="~Registration..."/> <menu:menuseparator/> <menu:menuitem menu:id="slot:5301" menu:helpid="5301" menu:label="A~bout OpenOffice.org..."/> </menu:menupopup> diff --git a/scripting/workben/bindings/writermenubar.xml b/scripting/workben/bindings/writermenubar.xml index 086520486271..2623f20d5e66 100644 --- a/scripting/workben/bindings/writermenubar.xml +++ b/scripting/workben/bindings/writermenubar.xml @@ -273,7 +273,6 @@ <menu:menuitem menu:id="slot:5403" menu:helpid="5403" menu:label="~Extended Tips"/> <menu:menuseparator/> <menu:menuitem menu:id="slot:6683" menu:helpid="6683" menu:label="~Support"/> - <menu:menuitem menu:id="slot:6537" menu:helpid="6537" menu:label="~Registration..."/> <menu:menuseparator/> <menu:menuitem menu:id="slot:5301" menu:helpid="5301" menu:label="A~bout OpenOffice.org..."/> </menu:menupopup> diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml index 176f25cb06ff..0ded1f0bb1e3 100755 --- a/sd/uiconfig/sdraw/menubar/menubar.xml +++ b/sd/uiconfig/sdraw/menubar/menubar.xml @@ -324,7 +324,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml index bf669992c86a..4fb01e39f981 100755 --- a/sd/uiconfig/simpress/menubar/menubar.xml +++ b/sd/uiconfig/simpress/menubar/menubar.xml @@ -298,7 +298,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/sfx2/inc/pch/precompiled_sfx2.hxx b/sfx2/inc/pch/precompiled_sfx2.hxx index c059cbe0a4a5..9d2564c2af56 100644 --- a/sfx2/inc/pch/precompiled_sfx2.hxx +++ b/sfx2/inc/pch/precompiled_sfx2.hxx @@ -543,7 +543,6 @@ #include "svtools/printoptions.hxx" #include "unotools/printwarningoptions.hxx" #include "svl/rectitem.hxx" -#include "unotools/regoptions.hxx" #include "unotools/saveopt.hxx" #include "unotools/searchopt.hxx" #include "unotools/securityoptions.hxx" diff --git a/sfx2/inc/sfx2/sfxcommands.h b/sfx2/inc/sfx2/sfxcommands.h index 2ff552424606..9cca34890f39 100755 --- a/sfx2/inc/sfx2/sfxcommands.h +++ b/sfx2/inc/sfx2/sfxcommands.h @@ -304,7 +304,6 @@ #define CMD_SID_ADDONHELP ".uno:AddonHelp" #define CMD_SID_FORMATMENUSTATE ".uno:FormatMenuState" #define CMD_SID_INET_DLG ".uno:InternetDialog" -#define CMD_SID_ONLINE_REGISTRATION ".uno:OnlineRegistrationDlg" #define CMD_SID_OFFICE_CHECK_PLZ ".uno:CheckPLZ" #define CMD_SID_ADDRESS_DATA_SOURCE ".uno:AutoPilotAddressDataSource" #define CMD_FN_BUSINESS_CARD ".uno:InsertBusinessCard" diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 282940bc3178..62dae9f469ca 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -200,9 +200,6 @@ #define SID_BASEURL (SID_SFX_START + 1518) #define SID_TEMPLATE (SID_SFX_START + 1519) -#define SID_ONLINE_REGISTRATION (SID_SFX_START + 1537) - -#define SID_ONLINE_REGISTRATION_DLG (SID_SFX_START + 1540) #define SID_CONTENTTYPE (SID_SFX_START + 1541) #define SID_SAVETO (SID_SFX_START + 1546) diff --git a/sfx2/sdi/appslots.sdi b/sfx2/sdi/appslots.sdi index 5a58fe54d921..bfb3be6d0575 100644 --- a/sfx2/sdi/appslots.sdi +++ b/sfx2/sdi/appslots.sdi @@ -223,14 +223,6 @@ shell SfxApplication //---------------------------------------------------------------------- - SID_ONLINE_REGISTRATION - [ - ExecMethod = OfaExec_Impl; - StateMethod = OfaState_Impl; - ] - - //---------------------------------------------------------------------- - SID_OFFICE_CHECK_PLZ [ ExecMethod = OfaExec_Impl; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index baff40e8b3ee..57e834030da7 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -5963,31 +5963,6 @@ SfxBoolItem SourceView SID_SOURCEVIEW ] //-------------------------------------------------------------------------- -SfxVoidItem StartRegistrationDialog SID_ONLINE_REGISTRATION_DLG -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = FALSE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = TRUE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = FALSE, - MenuConfig = FALSE, - StatusBarConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = GID_SPECIAL; -] - -//-------------------------------------------------------------------------- SfxStringItem StatusBar SID_STATUSBARTEXT [ @@ -7385,31 +7360,6 @@ SfxVoidItem InternetDialog SID_INET_DLG ] //-------------------------------------------------------------------------- -SfxVoidItem OnlineRegistrationDlg SID_ONLINE_REGISTRATION -() -[ - /* flags: */ - AutoUpdate = FALSE, - Cachable = Cachable, - FastCall = FALSE, - HasCoreId = FALSE, - HasDialog = TRUE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - Synchron; - - /* config: */ - AccelConfig = TRUE, - MenuConfig = TRUE, - StatusBarConfig = FALSE, - ToolBoxConfig = TRUE, - GroupId = GID_APPLICATION; -] - -//-------------------------------------------------------------------------- SfxBoolItem CheckPLZ SID_OFFICE_CHECK_PLZ (SfxStringItem PLZ SID_OFFICE_CHECK_PLZ) [ diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 2dfdec6e0793..11770c34091a 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -69,7 +69,6 @@ #include <unotools/pathoptions.hxx> #include <unotools/moduleoptions.hxx> -#include <unotools/regoptions.hxx> #include <svtools/helpopt.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/shl.hxx> @@ -650,12 +649,6 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet) } } -static const ::rtl::OUString& getProductRegistrationServiceName( ) -{ - static ::rtl::OUString s_sServiceName = ::rtl::OUString::createFromAscii( "com.sun.star.setup.ProductRegistration" ); - return s_sServiceName; -} - typedef rtl_uString* (SAL_CALL *basicide_choose_macro)(XModel*, sal_Bool, rtl_uString*); typedef void (SAL_CALL *basicide_macro_organizer)( sal_Int16 ); @@ -894,30 +887,6 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) break; } - case SID_ONLINE_REGISTRATION: - { - try - { - // create the ProductRegistration component - Reference< com::sun::star::lang::XMultiServiceFactory > xORB( ::comphelper::getProcessServiceFactory() ); - Reference< com::sun::star::task::XJobExecutor > xProductRegistration; - if ( xORB.is() ) - xProductRegistration = xProductRegistration.query( xORB->createInstance( getProductRegistrationServiceName() ) ); - DBG_ASSERT( xProductRegistration.is(), "OfficeApplication::ExecuteApp_Impl: could not create the service!" ); - - // tell it that the user wants to register - if ( xProductRegistration.is() ) - { - xProductRegistration->trigger( ::rtl::OUString::createFromAscii( "RegistrationRequired" ) ); - } - } - catch( const ::com::sun::star::uno::Exception& ) - { - DBG_ERROR( "OfficeApplication::ExecuteApp_Impl(SID_ONLINE_REGISTRATION): caught an exception!" ); - } - } - break; - case SID_BASICIDE_APPEAR: { SfxViewFrame* pView = lcl_getBasicIDEViewFrame( NULL ); @@ -1235,25 +1204,6 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq ) void SfxApplication::OfaState_Impl(SfxItemSet &rSet) { - const sal_uInt16 *pRanges = rSet.GetRanges(); - DBG_ASSERT(pRanges && *pRanges, "Set ohne Bereich"); - while ( *pRanges ) - { - for(sal_uInt16 nWhich = *pRanges++; nWhich <= *pRanges; ++nWhich) - { - switch(nWhich) - { - case SID_ONLINE_REGISTRATION: - { - ::utl::RegOptions aOptions; - if ( !aOptions.allowMenu() ) - rSet.DisableItem( SID_ONLINE_REGISTRATION ); - } - break; - } - } - } - SvtModuleOptions aModuleOpt; if( !aModuleOpt.IsWriter()) diff --git a/starmath/uiconfig/smath/menubar/menubar.xml b/starmath/uiconfig/smath/menubar/menubar.xml index 7c82d733fa70..9e6e16bda069 100755 --- a/starmath/uiconfig/smath/menubar/menubar.xml +++ b/starmath/uiconfig/smath/menubar/menubar.xml @@ -113,7 +113,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/svtools/AllLangResTarget_productregistration.mk b/svtools/AllLangResTarget_productregistration.mk deleted file mode 100644 index d9dd378098ba..000000000000 --- a/svtools/AllLangResTarget_productregistration.mk +++ /dev/null @@ -1,46 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -$(eval $(call gb_AllLangResTarget_AllLangResTarget,productregistration)) - -$(eval $(call gb_AllLangResTarget_set_reslocation,productregistration,svtools)) - -$(eval $(call gb_AllLangResTarget_add_srs,productregistration,\ - svt/productregistration \ -)) - -$(eval $(call gb_SrsTarget_SrsTarget,svt/productregistration)) - -$(eval $(call gb_SrsTarget_set_include,svt/productregistration,\ - $$(INCLUDE) \ - -I$(WORKDIR)/inc \ - -I$(SRCDIR)/svtools/source/inc \ - -I$(SRCDIR)/svtools/inc/ \ - -I$(SRCDIR)/svtools/inc/svtools \ -)) - -$(eval $(call gb_SrsTarget_add_files,svt/productregistration,\ - svtools/source/productregistration/registrationdlg.src \ -)) - - diff --git a/svtools/Library_productregistration.mk b/svtools/Library_productregistration.mk deleted file mode 100644 index af80bf1745ca..000000000000 --- a/svtools/Library_productregistration.mk +++ /dev/null @@ -1,57 +0,0 @@ -#************************************************************** -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -#************************************************************** - - - -$(eval $(call gb_Library_Library,productregistration)) - -$(eval $(call gb_Library_set_componentfile,productregistration,svtools/source/productregistration/productregistration.uno)) - -$(eval $(call gb_Library_set_include,productregistration,\ - $$(SOLARINC) \ - -I$(WORKDIR)/inc/svtools \ - -I$(WORKDIR)/inc/ \ - -I$(SRCDIR)/svtools/inc/pch/ \ - -I$(OUTDIR)/inc/ \ - -I$(SRCDIR)/svtools/inc \ - -I$(OUTDIR)/inc/offuh \ - -I$(OUTDIR)/inc \ -)) - -$(eval $(call gb_Library_add_linked_libs,productregistration,\ - cppu \ - cppuhelper \ - sal \ - stl \ - svl \ - tk \ - tl \ - utl \ - vcl \ - $(gb_STDLIBS) \ -)) - -$(eval $(call gb_Library_add_exception_objects,productregistration,\ - svtools/source/productregistration/productregistration \ - svtools/source/productregistration/registrationdlg \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/svtools/Module_svtools.mk b/svtools/Module_svtools.mk index 683f381cd6fd..16911dac248d 100644 --- a/svtools/Module_svtools.mk +++ b/svtools/Module_svtools.mk @@ -24,13 +24,11 @@ $(eval $(call gb_Module_Module,svtools)) $(eval $(call gb_Module_add_targets,svtools,\ - AllLangResTarget_productregistration \ AllLangResTarget_svt \ Executable_bmp \ Executable_bmpsum \ Executable_g2g \ Library_hatchwindowfactory \ - Library_productregistration \ Library_svt \ Package_inc \ )) diff --git a/svtools/source/productregistration/productregistration.cxx b/svtools/source/productregistration/productregistration.cxx deleted file mode 100644 index 955e56ea4ac4..000000000000 --- a/svtools/source/productregistration/productregistration.cxx +++ /dev/null @@ -1,484 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include "productregistration.hxx" -#include "unotools/regoptions.hxx" -#include "registrationdlg.hxx" -#ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> -#endif -#include "cppuhelper/factory.hxx" -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/system/XSystemShellExecute.hpp> -#include <com/sun/star/system/SystemShellExecuteFlags.hpp> -#include <com/sun/star/frame/DispatchResultState.hpp> -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/beans/XMaterialHolder.hpp> -#include <com/sun/star/container/XHierarchicalNameAccess.hpp> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/svapp.hxx> -#include <vcl/msgbox.hxx> -#include <osl/diagnose.h> - -#include <algorithm> -#include <functional> -#include <memory> - -#define PRODREG_IMPLNAME "com.sun.star.comp.setup.ProductRegistration" -#define PRODREG_SERVNAME "com.sun.star.setup.ProductRegistration" - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; -using namespace ::com::sun::star::container; - -using rtl::OUString; - -//........................................................................ -namespace svt -{ -//........................................................................ - - using namespace ::com::sun::star::task; - using namespace ::com::sun::star::system; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::frame; - using namespace ::com::sun::star::awt; - - //------------------------------------------------------------------- - - struct EqualsOUString : public ::std::unary_function< OUString, sal_Bool > - { - const OUString& m_rCompare; - EqualsOUString( const OUString& _rCompare ) : m_rCompare( _rCompare ) { } - - sal_Bool operator() ( const OUString& _rCompare ) - { - return m_rCompare.equals( _rCompare ); - } - }; - - //==================================================================== - //= OProductRegistration - //==================================================================== - - //-------------------------------------------------------------------- - OProductRegistration::OProductRegistration( const Reference< XMultiServiceFactory >& _rxORB ) - :m_xORB( _rxORB ) - { - } - - //-------------------------------------------------------------------- - Reference< XInterface > OProductRegistration::Create( const Reference< XMultiServiceFactory >& _rxORB ) - { - return static_cast< ::cppu::OWeakObject* >( new OProductRegistration( _rxORB ) ); - } - - //-------------------------------------------------------------------- - OUString SAL_CALL OProductRegistration::getImplementationName_Static( ) - { - return OUString::createFromAscii( PRODREG_IMPLNAME ); - } - - //-------------------------------------------------------------------- - Sequence< OUString > SAL_CALL OProductRegistration::getSupportedServiceNames_Static( ) throw (RuntimeException) - { - Sequence< OUString > aServiceNames( 1 ); - aServiceNames[ 0 ] = OUString::createFromAscii( PRODREG_SERVNAME ); - return aServiceNames; - } - - //-------------------------------------------------------------------- - OUString SAL_CALL OProductRegistration::getImplementationName( ) throw (RuntimeException) - { - return getImplementationName_Static( ); - } - - //-------------------------------------------------------------------- - sal_Bool SAL_CALL OProductRegistration::supportsService( const OUString& _rServiceName ) throw (RuntimeException) - { - Sequence< OUString > aServiceNames( getSupportedServiceNames( ) ); - const OUString* pNames = aServiceNames.getConstArray( ); - const OUString* pNamesEnd = aServiceNames.getConstArray( ) + aServiceNames.getLength(); - - const OUString* pFound = ::std::find_if( - pNames, - pNamesEnd, - EqualsOUString( _rServiceName ) - ); - return pFound != pNamesEnd; - } - - //-------------------------------------------------------------------- - Sequence< OUString > SAL_CALL OProductRegistration::getSupportedServiceNames( ) throw (RuntimeException) - { - return getSupportedServiceNames_Static( ); - } - - //-------------------------------------------------------------------- - static Reference< XFrame > lcl_getActiveFrame( const Reference< XMultiServiceFactory >& xFactory ) - { - try - { - Reference< XDesktop > xDesktop( - xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ) ), - UNO_QUERY_THROW ); - - Reference< XFrame > xFrame(xDesktop->getCurrentFrame()); - if( ! xFrame.is() ) - { - // Perhaps the frames collection of the desktop knows about an "active frame"? - Reference< XFramesSupplier > xFrames( xDesktop, UNO_QUERY_THROW ); - xFrame = xFrames->getActiveFrame(); - } - - return xFrame; - } - catch(const Exception& ) - { - OSL_ENSURE( sal_False, "lcl_getActiveFrame: caught an exception!" ); - return Reference< XFrame >(); - } - } - - //-------------------------------------------------------------------- - static Window* lcl_getPreferredDialogParent( const Reference< XFrame >& xFrame ) - { - Window* pReturn = Application::GetDefDialogParent(); - - try - { - if ( xFrame.is() ) - { - Reference< XWindow > xWindow = xFrame->getContainerWindow(); - if ( xWindow.is() ) - pReturn = VCLUnoHelper::GetWindow( xWindow ); - } - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, "lcl_getPreferredDialogParent: caught an exception!" ); - } - - return pReturn; - } - - //-------------------------------------------------------------------- - static bool lcl_isEvalVersion( const Reference< XMultiServiceFactory >& _rxORB ) - { - bool bIsEvaluationVersion = false; - - try - { - Reference < XMaterialHolder > xHolder( - _rxORB->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.tab.tabreg" ) ) ), - UNO_QUERY - ); - - if ( xHolder.is() ) - { - Any aData = xHolder->getMaterial(); - Sequence < NamedValue > aSeq; - - if ( aData >>= aSeq ) - { - // it's an evaluation version - a non-eval version wouldn't provide this "material" - bIsEvaluationVersion = true; - } - } - } - catch( const Exception& ) - { - OSL_ENSURE( false, "lcl_isEvalVersion: caught an exception!" ); - } - - return bIsEvaluationVersion; - } - - //-------------------------------------------------------------------- - static bool lcl_doNewStyleRegistration( const Reference< XMultiServiceFactory >& xFactory, bool online ) - { - try - { - Reference< XMultiServiceFactory > xConfigProvider( - xFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ) - ), - UNO_QUERY_THROW - ); - - PropertyValue aNodePath; - aNodePath.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aNodePath.Value = makeAny( OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Jobs/Events" ) ) ); - - Sequence< Any > lArguments(1); - lArguments[0] = makeAny( aNodePath ); - - Reference< XHierarchicalNameAccess > xNameAccess( - xConfigProvider->createInstanceWithArguments( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ) ), - lArguments - ), - UNO_QUERY_THROW - ); - - if( ! xNameAccess->hasByHierarchicalName( OUString( RTL_CONSTASCII_USTRINGPARAM( "onRegisterNow/JobList" ) ) ) ) - return false; - - Reference< XJobExecutor > xJobExecutor( - xFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.JobExecutor" ) ) - ), - UNO_QUERY_THROW - ); - - xJobExecutor->trigger( online ? OUString( RTL_CONSTASCII_USTRINGPARAM( "onRegisterNow" ) ) : - OUString( RTL_CONSTASCII_USTRINGPARAM( "onRegisterLater" ) ) ); - - return true; - } - catch( const Exception& ) - { - OSL_ENSURE( false, "lcl_getOnlineRegistrationDispatch: caught an exception!" ); - return false; - } - } - - //-------------------------------------------------------------------- - void SAL_CALL OProductRegistration::trigger( const OUString& _rEvent ) throw (RuntimeException) - { - bool registerOnline = false; - - switch ( classify( _rEvent ) ) - { - case etRegistrationRequired: - registerOnline = true; - break; - - default: - break; - } - - // prefer new style registration - if( ! lcl_doNewStyleRegistration(m_xORB, registerOnline ) && registerOnline ) - doOnlineRegistration(); - } - - //-------------------------------------------------------------------- - Any SAL_CALL OProductRegistration::execute( const Sequence< NamedValue >& ) throw (IllegalArgumentException, Exception, RuntimeException) - { - Any aReturn; - - static sal_Bool bFirstEncounter( sal_True ); - if ( bFirstEncounter ) - { // during this session, this event was never triggered before .... - bFirstEncounter = sal_False; - - sal_Bool bDeactivateJob = sal_True; - - // our config options - utl::RegOptions aRegOptions; - // check them for the permissions for the dialog - utl::RegOptions::DialogPermission ePermission( aRegOptions.getDialogPermission() ); - - if ( utl::RegOptions::dpDisabled != ePermission ) - { // the dialog is _not_ disabled - - // for this session, I'm no interested in the dialog registration anymore - aRegOptions.markSessionDone( ); - - if ( ( utl::RegOptions::dpNotThisSession == ePermission ) // first trigger session not reached - || ( utl::RegOptions::dpRemindLater == ePermission ) // or at a later reminder date - ) - { // the dialog should be executed during one of the next sessions - bDeactivateJob = sal_False; - } - else - { - // if we're here, the dialog should be executed during this session - OSL_ENSURE( utl::RegOptions::dpThisSession == ePermission, "OProductRegistration::execute: invalid permissions!" ); - - { - // this is some kind of HACK. - // This registration dialog is intended to appear very very early during the - // first office start after installation. Unfortunately, this is so early - // that even SFX is not yet loaded, thus the SfxHelp class is not yet available, - // thus, there is no help during the lifetime of the dialog. - // To fake this, we explicitly load the necessary services when the user - // really requests help herein. - // #110791# - 2003-06-11 - fs@openoffice.org - Reference < XInitialization > xOfficeWrapper( - m_xORB->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.OfficeWrapper" ) ) - ), - UNO_QUERY - ); - if ( xOfficeWrapper.is() ) - xOfficeWrapper->initialize( Sequence < Any >() ); - } - - std::auto_ptr<ResMgr> pResMgr (ResMgr::CreateResMgr ( - CREATEVERSIONRESMGR_NAME(productregistration))); - - Reference< XFrame > xFrame = lcl_getActiveFrame( m_xORB ); - // execute it - RegistrationDialog aDialog ( - lcl_getPreferredDialogParent( xFrame ), - ResId( DLG_REGISTRATION_REQUEST, *pResMgr.get() ), - lcl_isEvalVersion( m_xORB ) ); - aDialog.Execute(); - - bool registerOnline = false; - - switch ( aDialog.getResponse() ) - { - case RegistrationDialog::urRegisterNow: - registerOnline = true; - break; - - case RegistrationDialog::urRegisterLater: - bDeactivateJob = sal_False; - // remind again in seven days from now on ... - aRegOptions.activateReminder( 7 ); - break; - - case RegistrationDialog::urRegisterNever: - case RegistrationDialog::urAlreadyRegistered: - // never register or already registered - // -> deactivate the job, and nothing else - break; - - default: - OSL_ENSURE( sal_False, "OProductRegistration::execute: invalid response from the dialog!" ); - } - - // prefer new style registration - if( ! lcl_doNewStyleRegistration(m_xORB, registerOnline) && registerOnline ) - doOnlineRegistration(); - } - } - - Sequence< NamedValue > aJobResponse( 1 ); - aJobResponse[0].Name = OUString::createFromAscii( "Deactivate" ); - aJobResponse[0].Value <<= bDeactivateJob; - aReturn <<= aJobResponse; - } - - return aReturn; - } - - //-------------------------------------------------------------------- - void OProductRegistration::doOnlineRegistration( ) - { - sal_Bool bSuccess = sal_False; - try - { - // create the Desktop component which can load components - Reference< XSystemShellExecute > xSystemShell( - m_xORB->createInstance( OUString::createFromAscii( "com.sun.star.system.SystemShellExecute" ) ), - UNO_QUERY - ); - OSL_ENSURE( xSystemShell.is(), "OProductRegistration::doOnlineRegistration: invalid SystemExecute component!" ); - - // access the configuration to retrieve the URL we shall use for registration - utl::RegOptions aOptions; - OUString sRegistrationURL( aOptions.getRegistrationURL( ) ); - OSL_ENSURE( sRegistrationURL.getLength(), "OProductRegistration::doOnlineRegistration: invalid URL found!" ); - - if ( xSystemShell.is() && sRegistrationURL.getLength() ) - { - xSystemShell->execute( sRegistrationURL, OUString(), SystemShellExecuteFlags::DEFAULTS ); - bSuccess = sal_True; - } - } - catch( const Exception& ) - { - } - if ( !bSuccess ) - { - std::auto_ptr<ResMgr> pResMgr (ResMgr::CreateResMgr ( - CREATEVERSIONRESMGR_NAME(productregistration))); - - ErrorBox aRegistrationError( - Application::GetDefDialogParent(), - ResId( ERRBOX_REG_NOSYSBROWSER, *pResMgr.get() )); - aRegistrationError.Execute(); - - // try again later - utl::RegOptions aRegOptions; - aRegOptions.activateReminder( 7 ); - } - } - - //-------------------------------------------------------------------- - OProductRegistration::EventType OProductRegistration::classify( const OUString& _rEventDesc ) - { - EventType eReturn = etUnknown; - if ( _rEventDesc.equalsAscii( "RegistrationRequired" ) ) - { - eReturn = etRegistrationRequired; - } - return eReturn; - } - -//........................................................................ -} // namespace svt -//........................................................................ - -extern "C" -{ -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( - const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( - const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */) -{ - void * pResult = 0; - if (pServiceManager) - { - Reference< XSingleServiceFactory > xFactory; - if (svt::OProductRegistration::getImplementationName_Static().compareToAscii (pImplementationName) == 0) - { - xFactory = cppu::createSingleFactory ( - reinterpret_cast< XMultiServiceFactory* >(pServiceManager), - svt::OProductRegistration::getImplementationName_Static(), - svt::OProductRegistration::Create, - svt::OProductRegistration::getSupportedServiceNames_Static()); - } - if (xFactory.is()) - { - xFactory->acquire(); - pResult = xFactory.get(); - } - } - return pResult; -} - -} // extern "C" diff --git a/svtools/source/productregistration/productregistration.hxx b/svtools/source/productregistration/productregistration.hxx deleted file mode 100644 index 3150c644b9ed..000000000000 --- a/svtools/source/productregistration/productregistration.hxx +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SVTOOLS_PRODUCTREGISTRATION_HXX -#define SVTOOLS_PRODUCTREGISTRATION_HXX - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/task/XJobExecutor.hpp> -#include <com/sun/star/task/XJob.hpp> -#include <cppuhelper/implbase3.hxx> - -//........................................................................ -namespace svt -{ -//........................................................................ - - //==================================================================== - //= OProductRegistration - //==================================================================== - typedef ::cppu::WeakImplHelper3 < ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::task::XJobExecutor - , ::com::sun::star::task::XJob - > OProductRegistration_Base; - - class OProductRegistration : public OProductRegistration_Base - { - private: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xORB; - - protected: - OProductRegistration( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); - - public: - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); - - // XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_Static( ); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException); - - protected: - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - - // XJobExecutor - virtual void SAL_CALL trigger( const ::rtl::OUString& sEvent ) throw (::com::sun::star::uno::RuntimeException); - - // XJob - virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - private: - // types of events which can be handled by this component - enum EventType - { - etRegistrationRequired, - - etUnknown - }; - - // classifies a event - EventType classify( const ::rtl::OUString& _rEventDesc ); - - // do the online registration - void doOnlineRegistration( ); - }; - -//........................................................................ -} // namespace svt -//........................................................................ - -#endif // SVTOOLS_PRODUCTREGISTRATION_HXX - diff --git a/svtools/source/productregistration/productregistration.uno.component b/svtools/source/productregistration/productregistration.uno.component deleted file mode 100644 index 83d1bac3bad1..000000000000 --- a/svtools/source/productregistration/productregistration.uno.component +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!--*********************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - ***********************************************************--> - - - -<component loader="com.sun.star.loader.SharedLibrary" - xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.setup.ProductRegistration"> - <service name="com.sun.star.setup.ProductRegistration"/> - </implementation> -</component> diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx deleted file mode 100644 index 1966fafad650..000000000000 --- a/svtools/source/productregistration/registrationdlg.cxx +++ /dev/null @@ -1,167 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" -#include "registrationdlg.hxx" - -#if 0 /* @@@ */ -#include <svtools/svtdata.hxx> -#ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> -#endif -#endif /* @@@ */ - -#ifndef SVTOOLS_REGISTRATIONDLG_HRC -#include "registrationdlg.hrc" -#endif -#include <vcl/msgbox.hxx> -#include <tools/debug.hxx> - -//........................................................................ -namespace svt -{ -//........................................................................ - - static void lcl_moveControls( Control** _ppControls, sal_Int32 _nAmount ) - { - if ( _ppControls ) - while ( *_ppControls ) - { - Point aPos = (*_ppControls)->GetPosPixel(); - aPos.Y() += _nAmount; - (*_ppControls)->SetPosPixel( aPos ); - - ++_ppControls; - } - } - - //==================================================================== - //= RegistrationDialog - //==================================================================== - //-------------------------------------------------------------------- - RegistrationDialog::RegistrationDialog( Window* _pWindow, const ResId& _rResId, bool _bEvalVersion ) - :ModalDialog( _pWindow, _rResId ) - ,m_eResponse ( urRegisterLater ) - ,m_aLogo ( this, ResId( FI_LOGO, *_rResId.GetResMgr() ) ) - ,m_aIntro ( this, ResId( FT_INTRO, *_rResId.GetResMgr() ) ) - ,m_aNow ( this, ResId( RB_NOW, *_rResId.GetResMgr() ) ) - ,m_aLater ( this, ResId( RB_LATER, *_rResId.GetResMgr() ) ) - ,m_aNever ( this, ResId( RB_NEVER, *_rResId.GetResMgr() ) ) - ,m_aAlreadyDone ( this, ResId( RB_DONE, *_rResId.GetResMgr() ) ) - ,m_aSeparator ( this, ResId( FL_SEPARATOR, *_rResId.GetResMgr() ) ) - ,m_aOK ( this, ResId( BTN_OK, *_rResId.GetResMgr() ) ) - ,m_aHelp ( this, ResId( BTN_HELP, *_rResId.GetResMgr() ) ) - { - if ( _bEvalVersion ) - { // if we're an eval version, we need to hide two of the options - m_aNever.Hide( ); - m_aAlreadyDone.Hide( ); - - // make the explanatory text somewhat smaller - Size aIntroSize = m_aIntro.GetSizePixel(); - aIntroSize.Height() = LogicToPixel( Size( 0, 18 ), MAP_APPFONT ).Height(); - sal_Int32 nHeightDifference = m_aIntro.GetSizePixel().Height() - aIntroSize.Height(); - m_aIntro.SetSizePixel( aIntroSize ); - - // resize the dialog, and move the controls below the ones we just hided - sal_Int32 nAlreadyDoneLower = m_aAlreadyDone.GetPosPixel().Y() + m_aAlreadyDone.GetSizePixel().Height(); - sal_Int32 nLaterLower = m_aLater.GetPosPixel().Y() + m_aLater.GetSizePixel().Height(); - sal_Int32 nDifference = nAlreadyDoneLower - nLaterLower; - - sal_Int32 nOverallDifference = nDifference + nHeightDifference; - - // move - Control* pVisibleRadios[] = { &m_aNow, &m_aLater, NULL }; - lcl_moveControls( pVisibleRadios, -nHeightDifference ); - - Control* pControlsToMove[] = { &m_aSeparator, &m_aOK, &m_aHelp, NULL }; - lcl_moveControls( pControlsToMove, -nOverallDifference ); - - // resize the dialog - Size aSize = GetSizePixel(); - aSize.Height() -= nOverallDifference; - SetSizePixel( aSize ); - } - else - { - // the explanatory text needs to be completed - String sCompleteIntro = m_aIntro.GetText( ); - sCompleteIntro += String( ResId( STR_COMPLETE_INTRO, *_rResId.GetResMgr() ) ); - m_aIntro.SetText( sCompleteIntro ); - } - - FreeResource(); - - m_aNow.Check( sal_True ); - } - - //-------------------------------------------------------------------- - short RegistrationDialog::Execute() - { - short nResult = ModalDialog::Execute(); - - // as a default, assume that the user wants to be reminded - m_eResponse = urRegisterLater; - - if ( RET_OK == nResult ) - { - if ( m_aNow.IsChecked() ) - m_eResponse = urRegisterNow; - else if ( m_aLater.IsChecked() ) - m_eResponse = urRegisterLater; - else if ( m_aNever.IsChecked() ) - m_eResponse = urRegisterNever; - else if ( m_aAlreadyDone.IsChecked() ) - m_eResponse = urAlreadyRegistered; -#ifdef DBG_UTIL - else - { - DBG_ERROR( "RegistrationDialog::Execute: invalid dialog state!" ); - } -#endif - } - return nResult; - } - //-------------------------------------------------------------------- - long RegistrationDialog::PreNotify( NotifyEvent& rNEvt ) - { - long nHandled; - if( rNEvt.GetType() == EVENT_KEYINPUT && - rNEvt.GetKeyEvent()->GetCharCode() && - rNEvt.GetKeyEvent()->GetKeyCode().GetCode() == KEY_ESCAPE) - { - EndDialog(RET_CANCEL); - nHandled = 1; - } - else - nHandled = ModalDialog::PreNotify( rNEvt ); - return nHandled; - } - - -//........................................................................ -} // namespace svt -//........................................................................ - - diff --git a/svtools/source/productregistration/registrationdlg.hrc b/svtools/source/productregistration/registrationdlg.hrc deleted file mode 100644 index 7a9efe6b8008..000000000000 --- a/svtools/source/productregistration/registrationdlg.hrc +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SVTOOLS_REGISTRATIONDLG_HRC -#define SVTOOLS_REGISTRATIONDLG_HRC - -#define FI_LOGO 1 -#define FT_INTRO 2 -#define RB_NOW 3 -#define RB_LATER 4 -#define RB_NEVER 5 -#define RB_DONE 6 -#define FL_SEPARATOR 7 -#define BTN_OK 8 -#define BTN_HELP 9 -#define STR_COMPLETE_INTRO 10 - -#endif // SVTOOLS_REGISTRATIONDLG_HRC - diff --git a/svtools/source/productregistration/registrationdlg.hxx b/svtools/source/productregistration/registrationdlg.hxx deleted file mode 100644 index 013d60b3c233..000000000000 --- a/svtools/source/productregistration/registrationdlg.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SVTOOLS_REGISTRATIONDLG_HXX -#define SVTOOLS_REGISTRATIONDLG_HXX - -#include <vcl/fixed.hxx> -#ifndef _SV_BUTTON_HXX -#include <vcl/button.hxx> -#endif -#include <vcl/dialog.hxx> - -//........................................................................ -namespace svt -{ -//........................................................................ - - //==================================================================== - //= RegistrationDialog - //==================================================================== - class RegistrationDialog : public ModalDialog - { - public: - enum UserResponse - { - urRegisterNow, - urRegisterLater, - urRegisterNever, - urAlreadyRegistered - }; - - private: - UserResponse m_eResponse; - - FixedImage m_aLogo; - FixedText m_aIntro; - - RadioButton m_aNow; - RadioButton m_aLater; - RadioButton m_aNever; - RadioButton m_aAlreadyDone; - - FixedLine m_aSeparator; - - OKButton m_aOK; - HelpButton m_aHelp; - - public: - RegistrationDialog( Window* _pWindow, const ResId& _rResId, bool _bEvalVersion ); - - virtual short Execute(); - virtual long PreNotify( NotifyEvent& rNEvt ); - - inline UserResponse getResponse() const { return m_eResponse; } - }; - - - -//........................................................................ -}// namespace svt -//........................................................................ - -#endif // SVTOOLS_REGISTRATIONDLG_HXX diff --git a/svtools/source/productregistration/registrationdlg.src b/svtools/source/productregistration/registrationdlg.src deleted file mode 100644 index 2ca323e52cff..000000000000 --- a/svtools/source/productregistration/registrationdlg.src +++ /dev/null @@ -1,129 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef SVTOOLS_REGISTRATIONDLG_HRC -#include "registrationdlg.hrc" -#endif -#ifndef _SVTOOLS_HRC -#include <svtools/svtools.hrc> -#endif -#ifndef _SVT_HELPID_HRC -#include <svtools/helpid.hrc> -#endif - -ModalDialog DLG_REGISTRATION_REQUEST -{ - HelpID = HID_REGISTRATION_DIALOG; - Moveable = TRUE ; - Closeable = TRUE; - OutputSize = TRUE ; - Size = MAP_APPFONT ( 192 , 134 ) ; - Text [ en-US ] = "%PRODUCTNAME Registration"; - - FixedImage FI_LOGO - { - Pos = MAP_APPFONT ( 6 , 6 ) ; - Size = MAP_APPFONT ( 24 , 24 ) ; - Fixed = Image - { - ImageBitmap = Bitmap - { - File = "regkey.bmp" ; - }; - MaskColor = Color { Red = 0x0000 ; Green = 0x0000 ; Blue = 0xFFFF ; }; - }; - }; - FixedText FT_INTRO - { - Pos = MAP_APPFONT ( 33, 6 ) ; - Size = MAP_APPFONT ( 153 , 32 ) ; - WordBreak = TRUE; - Text [ en-US ] = "You now have the opportunity to register as a %PRODUCTNAME user." ; - }; - - String STR_COMPLETE_INTRO - { - Text [ en-US ] = " Registration is voluntary and is without obligation." ; - }; - - RadioButton RB_NOW - { - HelpID = "svtools:RadioButton:DLG_REGISTRATION_REQUEST:RB_NOW"; - Pos = MAP_APPFONT ( 33 , 41 ) ; - Size = MAP_APPFONT ( 153 , 10 ) ; - Text [ en-US ] = "Register now" ; - }; - - RadioButton RB_LATER - { - HelpID = "svtools:RadioButton:DLG_REGISTRATION_REQUEST:RB_LATER"; - Pos = MAP_APPFONT ( 33 , 54 ) ; - Size = MAP_APPFONT ( 153 , 10 ) ; - Text [ en-US ] = "Remind me to register later" ; - }; - RadioButton RB_NEVER - { - HelpID = "svtools:RadioButton:DLG_REGISTRATION_REQUEST:RB_NEVER"; - Pos = MAP_APPFONT ( 33 , 67 ) ; - Size = MAP_APPFONT ( 153 , 10 ) ; - Text [ en-US ] = "Never register" ; - }; - RadioButton RB_DONE - { - HelpID = "svtools:RadioButton:DLG_REGISTRATION_REQUEST:RB_DONE"; - Pos = MAP_APPFONT ( 33 , 80 ) ; - Size = MAP_APPFONT ( 153 , 20 ) ; - WordBreak = TRUE; - - Text [ en-US ] = "Already registered as %PRODUCTNAME %PRODUCTVERSION user." ; - }; - - FixedLine FL_SEPARATOR - { - Pos = MAP_APPFONT ( 6, 107 ) ; - Size = MAP_APPFONT ( 180 , 1 ) ; - }; - - OKButton BTN_OK - { - Pos = MAP_APPFONT ( 80, 114 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - DefButton = TRUE; - }; - - HelpButton BTN_HELP - { - Pos = MAP_APPFONT ( 136, 114 ) ; - Size = MAP_APPFONT ( 50 , 14 ) ; - }; -}; - -ErrorBox ERRBOX_REG_NOSYSBROWSER -{ - BUTTONS = WB_OK ; - DEFBUTTON = WB_DEF_OK ; - - Message [ en-US ] = "An error occurred in starting the web browser.\nPlease check the %PRODUCTNAME and web browser settings."; -}; - - diff --git a/svx/inc/globlmn_tmpl.hrc b/svx/inc/globlmn_tmpl.hrc index 5a2e0cb4bffe..bbc0cb05aecf 100644 --- a/svx/inc/globlmn_tmpl.hrc +++ b/svx/inc/globlmn_tmpl.hrc @@ -905,12 +905,6 @@ Command = ".uno:HelpSupport" ; \ Text [ en-US ] = "~Support" ; \ -#define ITEM_HELP_ONLINE_REGISTRATION \ - Identifier = SID_ONLINE_REGISTRATION ; \ - Command = ".uno:OnlineRegistrationDlg" ; \ - Text [ en-US ] = "~Registration..." ; \ - - #define ITEM_HELP_ABOUT \ Identifier = SID_ABOUT ; \ Command = ".uno:About" ; \ @@ -958,10 +952,6 @@ };\ MenuItem\ {\ - ITEM_HELP_ONLINE_REGISTRATION\ - };\ - MenuItem\ - {\ Separator = TRUE ; \ };\ MenuItem\ diff --git a/sw/uiconfig/sglobal/menubar/menubar.xml b/sw/uiconfig/sglobal/menubar/menubar.xml index 2426a20c595f..80b68851d489 100755 --- a/sw/uiconfig/sglobal/menubar/menubar.xml +++ b/sw/uiconfig/sglobal/menubar/menubar.xml @@ -451,7 +451,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/sw/uiconfig/swform/menubar/menubar.xml b/sw/uiconfig/swform/menubar/menubar.xml index bb58c81f7d81..4486f2f47993 100755 --- a/sw/uiconfig/swform/menubar/menubar.xml +++ b/sw/uiconfig/swform/menubar/menubar.xml @@ -446,7 +446,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/sw/uiconfig/swreport/menubar/menubar.xml b/sw/uiconfig/swreport/menubar/menubar.xml index bb58c81f7d81..4486f2f47993 100755 --- a/sw/uiconfig/swreport/menubar/menubar.xml +++ b/sw/uiconfig/swreport/menubar/menubar.xml @@ -446,7 +446,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/sw/uiconfig/swriter/menubar/menubar.xml b/sw/uiconfig/swriter/menubar/menubar.xml index 3243d6b1646b..6c4403ed2a58 100755 --- a/sw/uiconfig/swriter/menubar/menubar.xml +++ b/sw/uiconfig/swriter/menubar/menubar.xml @@ -454,7 +454,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/sw/uiconfig/swxform/menubar/menubar.xml b/sw/uiconfig/swxform/menubar/menubar.xml index 3a31ab392010..57a0be201b7b 100755 --- a/sw/uiconfig/swxform/menubar/menubar.xml +++ b/sw/uiconfig/swxform/menubar/menubar.xml @@ -447,7 +447,6 @@ <menu:menuitem menu:id=".uno:ExtendedHelp"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:HelpSupport"/> - <menu:menuitem menu:id=".uno:OnlineRegistrationDlg"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:About"/> </menu:menupopup> diff --git a/testautomation/framework/optional/input/menu/en-us_basic.txt b/testautomation/framework/optional/input/menu/en-us_basic.txt index 91311e18a448..4bdfe53be571 100755 --- a/testautomation/framework/optional/input/menu/en-us_basic.txt +++ b/testautomation/framework/optional/input/menu/en-us_basic.txt @@ -50,7 +50,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/framework/optional/input/menu/en-us_calc.txt b/testautomation/framework/optional/input/menu/en-us_calc.txt index e922d4210ae7..0b92ed7a0ff6 100755 --- a/testautomation/framework/optional/input/menu/en-us_calc.txt +++ b/testautomation/framework/optional/input/menu/en-us_calc.txt @@ -170,7 +170,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/framework/optional/input/menu/en-us_draw.txt b/testautomation/framework/optional/input/menu/en-us_draw.txt index 94af87101e18..6525717acfb9 100755 --- a/testautomation/framework/optional/input/menu/en-us_draw.txt +++ b/testautomation/framework/optional/input/menu/en-us_draw.txt @@ -150,7 +150,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/framework/optional/input/menu/en-us_htmldokument.txt b/testautomation/framework/optional/input/menu/en-us_htmldokument.txt index be4dff80fc67..4eb517d28861 100755 --- a/testautomation/framework/optional/input/menu/en-us_htmldokument.txt +++ b/testautomation/framework/optional/input/menu/en-us_htmldokument.txt @@ -165,7 +165,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/framework/optional/input/menu/en-us_impress.txt b/testautomation/framework/optional/input/menu/en-us_impress.txt index 8f619fbd2e3e..9c7e1027afbd 100755 --- a/testautomation/framework/optional/input/menu/en-us_impress.txt +++ b/testautomation/framework/optional/input/menu/en-us_impress.txt @@ -151,7 +151,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/framework/optional/input/menu/en-us_insight.txt b/testautomation/framework/optional/input/menu/en-us_insight.txt index 578a4f4a524d..7cd96d3b6f0b 100755 --- a/testautomation/framework/optional/input/menu/en-us_insight.txt +++ b/testautomation/framework/optional/input/menu/en-us_insight.txt @@ -75,7 +75,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/framework/optional/input/menu/en-us_masterdoc.txt b/testautomation/framework/optional/input/menu/en-us_masterdoc.txt index dac12d462485..9a929ca3618c 100755 --- a/testautomation/framework/optional/input/menu/en-us_masterdoc.txt +++ b/testautomation/framework/optional/input/menu/en-us_masterdoc.txt @@ -187,7 +187,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/framework/optional/input/menu/en-us_math.txt b/testautomation/framework/optional/input/menu/en-us_math.txt index a8282b595a57..460767011193 100755 --- a/testautomation/framework/optional/input/menu/en-us_math.txt +++ b/testautomation/framework/optional/input/menu/en-us_math.txt @@ -78,7 +78,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/framework/optional/input/menu/en-us_writer.txt b/testautomation/framework/optional/input/menu/en-us_writer.txt index 5b2704581f13..85ddc6e9a870 100755 --- a/testautomation/framework/optional/input/menu/en-us_writer.txt +++ b/testautomation/framework/optional/input/menu/en-us_writer.txt @@ -188,7 +188,6 @@ StarOffice ~Help What's ~This? ~Support -~Registration... Check for ~Updates... diff --git a/testautomation/global/sid/all.sid b/testautomation/global/sid/all.sid index 258ef7c2da3d..32be4f2e49f9 100755 --- a/testautomation/global/sid/all.sid +++ b/testautomation/global/sid/all.sid @@ -597,7 +597,6 @@ HilfeInhalt .uno:HelpIndex HilfeHelferlein .uno:HelperDialog HilfeTip .uno:HelpTip HilfeAktiveHilfe .uno:ActiveHelp -HilfeOnlineregistrierung .uno:OnlineRegistrationDlg HilfeInfoUeber .uno:About diff --git a/toolkit/src2xml/src.lst b/toolkit/src2xml/src.lst index a402a6b633c9..1c0e4dd6613a 100644 --- a/toolkit/src2xml/src.lst +++ b/toolkit/src2xml/src.lst @@ -601,7 +601,6 @@ ../../svtools/source/filter.vcl/filter/dlgejpg.src ../../svtools/source/filter.vcl/filter/strings.src ../../svtools/source/Accessibility/accessiblelistboxentry.src -../../svtools/source/productregistration/registrationdlg.src ../../svtools/source/plugapp/commtest.src ../../svtools/source/plugapp/testtool.src ../../fpicker/source/office/OfficeFilePicker.src diff --git a/unotools/inc/unotools/regoptions.hxx b/unotools/inc/unotools/regoptions.hxx deleted file mode 100644 index 7b605e5f1ba3..000000000000 --- a/unotools/inc/unotools/regoptions.hxx +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef unotools_REGOPTIONS_HXX -#define unotools_REGOPTIONS_HXX - -#include "unotools/unotoolsdllapi.h" -#include <tools/string.hxx> - -//........................................................................ -namespace utl -{ -//........................................................................ - - //==================================================================== - //= RegOptions - //==================================================================== - class RegOptionsImpl; - /** encapsulates access to the configuration settings for registering the product - */ - class UNOTOOLS_DLLPUBLIC RegOptions - { - private: - RegOptionsImpl* m_pImpl; - - // the impl class is constructed upon need only (as this is expensive) - UNOTOOLS_DLLPRIVATE void ensureImpl( ); - - public: - RegOptions( ); - ~RegOptions( ); - - // retrieves the URL which should be used for online registration - String getRegistrationURL( ) const; - - // checks if the menu item which can be used to trigger the online registration should be available - sal_Bool allowMenu( ) const; - - enum DialogPermission - { // the registration dialog shall be executed .... - dpDisabled, // ... never - it has been disabled - dpNotThisSession, // ... later - no statement when, but _not now_ - dpRemindLater, // ... later at a reminder date - dpThisSession // ... during this session - }; - - /** checks if the registration dialog is allowed - <p>A return value of <TRUE/> does not mean that during this session, the dialog is allowed to - be executed. It simply means executing it is allowed <em>in general</em></p> - */ - DialogPermission getDialogPermission( ) const; - - /** claims that the current session is done with respect to the registration dialog. - - <p>This is not to be called if <method>getDialogPermission</method> returned dpDisabled previously<p> - <p>The behaviour changes as follows: - <ul> - <li>any subsequent calls to <method>getDialogPermission</method> will return dpNotThisSession, given - that it previously returned dpNotThisSession</li> - <li>any subsequent calls to <method>getDialogPermission</method> will return dpDisabled, given - that it previously returned dpThisSession</li> - <li>an internal (persistent) session counter is updated, so that during the next session, - <method>getDialogPermission</method> <em>may</em> return dpThisSession</li> - </ul></p> - */ - void markSessionDone( ); - - /** activates the reminder - - <p>If this method is called, the reminder for the dialog will be activated. - This means that during the next <arg>_nDaysFromNow</arg>-1 days, - <method>getDialogPermission</method> will return dpRemindLater</p>, - at the <arg>_nDaysFromNow</arg>th day from today onwards it will - return dpThisSession.</p> - - <p>It is not allowed to call this method if the dialog is currently disabled.</p> - - <p>If the current session has not been marked as done already - (i.e., <method>markSessionDone</method> has not been called, yet), this is - done implicitly when you call <method>activateReminder</method>.</p> - */ - void activateReminder( sal_Int32 _nDaysFromNow ); - - /** removes the reminder - - <p>If this method is called, the reminder for the dialog will be removed. - */ - void removeReminder(); - - /** checks if the reminder date has come - - <p>Returns <true/> if the current date is greater or equal the reminder date. - */ - bool hasReminderDateCome() const; - }; - -//........................................................................ -} // namespace utl -//........................................................................ - -#endif // unotools_REGOPTIONS_HXX - diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx index a542392d278c..f7b012e81fb1 100644 --- a/unotools/source/config/itemholder1.cxx +++ b/unotools/source/config/itemholder1.cxx @@ -53,7 +53,6 @@ #include <unotools/moduleoptions.hxx> #include <unotools/pathoptions.hxx> #include <unotools/printwarningoptions.hxx> -#include <unotools/regoptions.hxx> #include <unotools/optionsdlg.hxx> #include <unotools/saveopt.hxx> #include <unotools/searchopt.hxx> diff --git a/unotools/source/config/makefile.mk b/unotools/source/config/makefile.mk index bdd9e2b1ed36..c7481366aabb 100644 --- a/unotools/source/config/makefile.mk +++ b/unotools/source/config/makefile.mk @@ -44,43 +44,43 @@ SLOFILES=\ $(SLO)$/configmgr.obj \ $(SLO)$/configpathes.obj \ $(SLO)$/docinfohelper.obj \ - $(SLO)$/bootstrap.obj \ + $(SLO)$/bootstrap.obj \ $(SLO)$/accelcfg.obj \ $(SLO)$/cacheoptions.obj \ - $(SLO)$/cmdoptions.obj \ - $(SLO)$/compatibility.obj \ - $(SLO)$/defaultoptions.obj \ - $(SLO)$/dynamicmenuoptions.obj \ - $(SLO)$/eventcfg.obj \ - $(SLO)$/extendedsecurityoptions.obj \ + $(SLO)$/cmdoptions.obj \ + $(SLO)$/compatibility.obj \ + $(SLO)$/defaultoptions.obj \ + $(SLO)$/dynamicmenuoptions.obj \ + $(SLO)$/eventcfg.obj \ + $(SLO)$/extendedsecurityoptions.obj \ $(SLO)$/fltrcfg.obj \ - $(SLO)$/fontcfg.obj \ - $(SLO)$/fontoptions.obj \ + $(SLO)$/fontcfg.obj \ + $(SLO)$/fontoptions.obj \ $(SLO)$/historyoptions.obj \ - $(SLO)$/inetoptions.obj \ - $(SLO)$/internaloptions.obj \ + $(SLO)$/inetoptions.obj \ + $(SLO)$/internaloptions.obj \ $(SLO)$/itemholder1.obj \ $(SLO)$/javaoptions.obj \ $(SLO)$/lingucfg.obj \ - $(SLO)$/localisationoptions.obj \ + $(SLO)$/localisationoptions.obj \ $(SLO)$/misccfg.obj \ $(SLO)$/moduleoptions.obj \ $(SLO)$/options.obj \ $(SLO)$/optionsdlg.obj \ $(SLO)$/pathoptions.obj \ - $(SLO)$/printwarningoptions.obj \ - $(SLO)$/regoptions.obj \ - $(SLO)$/saveopt.obj \ - $(SLO)$/searchopt.obj \ - $(SLO)$/securityoptions.obj \ - $(SLO)$/sourceviewconfig.obj \ - $(SLO)$/startoptions.obj \ + $(SLO)$/printwarningoptions.obj \ + $(SLO)$/saveopt.obj \ + $(SLO)$/searchopt.obj \ + $(SLO)$/securityoptions.obj \ + $(SLO)$/sourceviewconfig.obj \ + $(SLO)$/startoptions.obj \ $(SLO)$/undoopt.obj \ $(SLO)$/useroptions.obj \ - $(SLO)$/viewoptions.obj \ - $(SLO)$/workingsetoptions.obj \ + $(SLO)$/viewoptions.obj \ + $(SLO)$/workingsetoptions.obj \ $(SLO)$/xmlaccelcfg.obj + # --- Targets ---------------------------------- .INCLUDE : target.mk diff --git a/unotools/source/config/regoptions.cxx b/unotools/source/config/regoptions.cxx deleted file mode 100644 index b3cefd3cee23..000000000000 --- a/unotools/source/config/regoptions.cxx +++ /dev/null @@ -1,546 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_unotools.hxx" -#include <unotools/regoptions.hxx> -#include <unotools/confignode.hxx> -#include <tools/date.hxx> -#include <comphelper/processfactory.hxx> -#include <osl/mutex.hxx> -#include <unotools/bootstrap.hxx> -#include <rtl/ustring.hxx> - -//........................................................................ -namespace utl -{ -//........................................................................ - - using namespace ::com::sun::star::uno; - - //==================================================================== - //= local helpers - //==================================================================== - //-------------------------------------------------------------------- - /** converts a string representation of a date into a integer representation - <p>No semantic check is made, i.e. if the string describes the 40.12, this is not recognized. In opposite, - the string must have a valid structure (DD.MM.YYYY).</p> - @return - the integer representation of the date which can be used with the Date class, - or 0 if the given string was no valid date representation - */ - static sal_Int32 lcl_convertString2Date( const ::rtl::OUString& _rStringRep ) - { - sal_Int32 nDateIntRep = 0; - if ( _rStringRep.getLength() == 2 + 1 + 2 + 1 + 4 ) // DD.MM.YYYY - { - // validate the string - sal_Bool bValid = sal_True; - - const sal_Unicode* pStringRep = _rStringRep.getStr(); - sal_Int32 nLen = _rStringRep.getLength(); - for ( sal_Int32 nPos = 0; - bValid && ( nPos < nLen ); - ++nPos, ++pStringRep - ) - { - if ( ( 2 == nPos ) || ( 5 == nPos ) ) - bValid = '.' == *pStringRep; // the number separators - else - bValid = ( *pStringRep >= '0' ) && ( *pStringRep <= '9' ); - } - - // passed the test? - if ( bValid ) - { - Date aDate; - aDate.SetDay ( (sal_uInt16)_rStringRep.copy( 0, 2 ).toInt32( ) ); - aDate.SetMonth ( (sal_uInt16)_rStringRep.copy( 3, 2 ).toInt32( ) ); - aDate.SetYear ( (sal_uInt16)_rStringRep.copy( 6, 4 ).toInt32( ) ); - nDateIntRep = aDate.GetDate(); - } - } - - return nDateIntRep; - } - - //-------------------------------------------------------------------- - static const ::rtl::OUString& lcl_fillToken( const sal_Int32 /* [in] */ _nToken, const sal_Int16 /* [in] */ _nDigits, ::rtl::OUString& /* [out] */ _rToken ) - { - // convert into string - ::rtl::OUString sLeanToken = ::rtl::OUString::valueOf( _nToken ); - // check length - if ( sLeanToken.getLength() < _nDigits ) - { // fill - OSL_ENSURE( _nDigits <= 4, "lcl_fillToken: invalid digit number!" ); - _rToken = ::rtl::OUString( "0000", _nDigits - sLeanToken.getLength(), RTL_TEXTENCODING_ASCII_US ); - _rToken += sLeanToken; - } - else - _rToken = sLeanToken; - - return _rToken; - } - - //-------------------------------------------------------------------- - /** converts a integer representation of a date into a string representation - */ - static ::rtl::OUString lcl_ConvertDate2String( const Date& _rDate ) - { - OSL_ENSURE( _rDate.IsValid(), "lcl_ConvertDate2String: invalid integer representation!" ); - - sal_Unicode cSeparator( '.' ); - ::rtl::OUString sSeparator( &cSeparator, 1 ); - - ::rtl::OUString sStringRep; - ::rtl::OUString sToken; - sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetDay(), 2, sToken ); - sStringRep += sSeparator; - sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetMonth(), 2, sToken ); - sStringRep += sSeparator; - sStringRep += lcl_fillToken( (sal_Int32)_rDate.GetYear(), 4, sToken ); - - return sStringRep; - } - - //-------------------------------------------------------------------- - /// checks whether a given trigger date is reached (i.e. is _before_ the current date) - static sal_Bool lcl_reachedTriggerDate( const Date& _rTriggerDate ) - { - return _rTriggerDate <= Date(); - } - - //-------------------------------------------------------------------- - #define DECLARE_STATIC_LAZY_USTRING( name ) \ - static const ::rtl::OUString& lcl_get##name##Name() \ - { \ - static const ::rtl::OUString sName = ::rtl::OUString::createFromAscii( #name ); \ - return sName; \ - } - - DECLARE_STATIC_LAZY_USTRING( ReminderDate ); - DECLARE_STATIC_LAZY_USTRING( RequestDialog ); - DECLARE_STATIC_LAZY_USTRING( ShowMenuItem ); - DECLARE_STATIC_LAZY_USTRING( Patch ); - - //==================================================================== - //= RegOptionsImpl - //==================================================================== - class RegOptionsImpl - { - private: - OConfigurationTreeRoot m_aRegistrationNode; // the configuration node we need to access our persistent data - - String m_sRegistrationURL; // the URL to use when doing an online registration - Date m_aReminderDate; // the reminder date as found in the configuration - sal_Int32 m_nDialogCounter; // the dialog counter - see getDialogPermission - sal_Bool m_bShowMenuItem; // the flag indicating if the registration menu item is allowed - - static RegOptionsImpl* s_pSingleInstance; // the one and only instance of this class - static sal_Int32 s_nInstanceCount; // reference counter for the instances - static sal_Bool s_bThisSessionDone; // the flag indicating if for this session, everything beeing relevant has already been done - - private: - RegOptionsImpl( ); - - static ::osl::Mutex& getStaticMutex(); // get the mutex used to protect the static members of this class - - void commit( ); - sal_Int32 getBuildId() const; - - private: - RegOptions::DialogPermission implGetDialogPermission( ) const; - - public: - static RegOptionsImpl* registerClient( ); - static void revokeClient( ); - - inline sal_Bool hasURL( ) const { return ( 0 != m_sRegistrationURL.Len() ); } - inline sal_Bool allowMenu( ) const { return hasURL() && m_bShowMenuItem; } - inline String getRegistrationURL( ) const { return m_sRegistrationURL; } - - RegOptions::DialogPermission getDialogPermission( ) const; - void markSessionDone( ); - void activateReminder( sal_Int32 _nDaysFromNow ); - void removeReminder(); - bool hasReminderDateCome() const; - }; - - //-------------------------------------------------------------------- - RegOptionsImpl* RegOptionsImpl::s_pSingleInstance = NULL; - sal_Bool RegOptionsImpl::s_bThisSessionDone = sal_False; - sal_Int32 RegOptionsImpl::s_nInstanceCount = 0; - - //-------------------------------------------------------------------- - ::osl::Mutex& RegOptionsImpl::getStaticMutex() - { - static ::osl::Mutex* s_pStaticMutex = NULL; - if ( !s_pStaticMutex ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if ( !s_pStaticMutex ) - { - static ::osl::Mutex s_aStaticMutex; - s_pStaticMutex = &s_aStaticMutex; - } - } - return *s_pStaticMutex; - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::commit( ) - { - m_aRegistrationNode.commit( ); - } - - //-------------------------------------------------------------------- - RegOptionsImpl* RegOptionsImpl::registerClient( ) - { - ::osl::MutexGuard aGuard( getStaticMutex() ); - - if ( !s_pSingleInstance ) - s_pSingleInstance = new RegOptionsImpl; - - ++s_nInstanceCount; - return s_pSingleInstance; - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::revokeClient( ) - { - ::osl::MutexGuard aGuard( getStaticMutex() ); - OSL_ENSURE( s_nInstanceCount, "RegOptionsImpl::revokeClient: there are no clients alive!" ); - OSL_ENSURE( s_pSingleInstance || !s_nInstanceCount, "RegOptionsImpl::revokeClient: invalid instance pointer!" ); - - if ( s_nInstanceCount ) - { - if ( s_pSingleInstance ) - // commit the changes done by this client - s_pSingleInstance->commit(); - - if ( 0 == --s_nInstanceCount ) - { - delete s_pSingleInstance; - s_pSingleInstance = NULL; - } - } - } - - //-------------------------------------------------------------------- - RegOptionsImpl::RegOptionsImpl( ) - :m_nDialogCounter ( 0 ) - ,m_bShowMenuItem ( sal_False ) - { - // create the config node for all our registration information - m_aRegistrationNode = OConfigurationTreeRoot::createWithServiceFactory( - ::comphelper::getProcessServiceFactory(), - ::rtl::OUString::createFromAscii( "/org.openoffice.Office.Common/Help/Registration" ) - ); - - // cache some data - //the URL to use for online registration - ::rtl::OUString sStringValue; - m_aRegistrationNode.getNodeValue( ::rtl::OUString::createFromAscii( "URL" ) ) >>= sStringValue; - m_sRegistrationURL = sStringValue; - - // the state of the dialog - m_aRegistrationNode.getNodeValue( lcl_getRequestDialogName() ) >>= m_nDialogCounter; - - // the flag for showing the menu item - sal_Bool bBoolValue = sal_False; - m_aRegistrationNode.getNodeValue( lcl_getShowMenuItemName() ) >>= bBoolValue; - m_bShowMenuItem = bBoolValue; - - // the reminder date (if any) - sal_Int32 nIntDate = 0; - sStringValue = ::rtl::OUString(); - m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sStringValue; - bool bIsPatchDate = ( sStringValue.equals( lcl_getPatchName() ) != sal_False ); - if ( !bIsPatchDate && sStringValue.getLength() ) - nIntDate = lcl_convertString2Date( sStringValue ); - m_aReminderDate.SetDate( nIntDate ); - } - - //-------------------------------------------------------------------- - RegOptions::DialogPermission RegOptionsImpl::implGetDialogPermission( ) const - { - RegOptions::DialogPermission eResult = RegOptions::dpDisabled; - // no URL or a counter already decreased to zero means the dialog is disabled - if ( hasURL() && ( m_nDialogCounter > 0 ) ) - { - // during every session, the counter will be decreased - // If it reaches zero, the dialog shall be executed - if ( 1 == m_nDialogCounter ) - { - if ( m_aReminderDate.IsValid( ) ) - { // valid reminder date - // assume remind later - eResult = RegOptions::dpRemindLater; - // and check if we reached the reminder date - if ( lcl_reachedTriggerDate( m_aReminderDate ) ) - eResult = RegOptions::dpThisSession; - } - else - eResult = RegOptions::dpThisSession; // execute in this session - } - else - eResult = RegOptions::dpNotThisSession; // first trigger session not reached - - // a last check .... - if ( ( s_bThisSessionDone ) // this session is already marked as "done" - && ( RegOptions::dpThisSession == eResult )// but without this, the state would be "now" - ) - eResult = RegOptions::dpDisabled; // -> change state to "disabled" - } - - return eResult; - } - - //-------------------------------------------------------------------- - RegOptions::DialogPermission RegOptionsImpl::getDialogPermission( ) const - { - OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::getDialogPermission: should never be asked in this session, again!" ); - // Somebody already marked this session as "everything relevant happened". So why sombody (else?) asks - // me again? - - return implGetDialogPermission( ); - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::activateReminder( sal_Int32 _nDaysFromNow ) - { - OSL_ENSURE( s_bThisSessionDone || ( implGetDialogPermission( ) != RegOptions::dpDisabled ), "RegOptionsImpl::activateReminder: invalid call!" ); - OSL_ENSURE( _nDaysFromNow > 0, "RegOptionsImpl::activateReminder: invalid argument!" ); - - // calc the reminder - m_aReminderDate = Date() + _nDaysFromNow; // today (default ctor) + days - - // remember the date - m_aRegistrationNode.setNodeValue( - lcl_getReminderDateName(), - makeAny( lcl_ConvertDate2String( m_aReminderDate ) ) - ); - // to be on the save side, write the counter - m_aRegistrationNode.setNodeValue( - lcl_getRequestDialogName(), - makeAny( (sal_Int32)1 ) - ); - - // mark this session as done - if ( !s_bThisSessionDone ) - markSessionDone( ); - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::removeReminder() - { - ::rtl::OUString aDefault; - ::rtl::OUString aReminderValue( lcl_getPatchName() ); - aReminderValue += ::rtl::OUString::valueOf(getBuildId()); - - m_aRegistrationNode.setNodeValue( - lcl_getReminderDateName(), - Any( aReminderValue ) - ); - } - - //-------------------------------------------------------------------- - sal_Int32 RegOptionsImpl::getBuildId() const - { - sal_Int32 nBuildId( 0 ); - ::rtl::OUString aDefault; - ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault ); - sal_Int32 nIndex1 = aBuildIdData.indexOf(':'); - sal_Int32 nIndex2 = aBuildIdData.indexOf(')'); - if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 )) - { - ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 ); - nBuildId = aBuildId.toInt32(); - } - - return nBuildId; - } - - //-------------------------------------------------------------------- - bool RegOptionsImpl::hasReminderDateCome() const - { - bool bRet = false; - sal_Int32 nDate = 0; - ::rtl::OUString sDate; - m_aRegistrationNode.getNodeValue( lcl_getReminderDateName() ) >>= sDate; - if ( sDate.getLength() ) - { - if ( sDate.indexOf( lcl_getPatchName() ) == 0) - { - if (sDate.equals( lcl_getPatchName() )) - bRet = true; - else if (sDate.getLength() > lcl_getPatchName().getLength() ) - { - // Check the build ID to determine if the registration - // dialog needs to be shown. - sal_Int32 nBuildId = getBuildId(); - ::rtl::OUString aStoredBuildId( sDate.copy(lcl_getPatchName().getLength())); - - // remind if the current build ID is not the same as the stored one - if ( nBuildId != aStoredBuildId.toInt32() ) - bRet = true; - } - } - else - { - nDate = lcl_convertString2Date( sDate ); - if ( nDate > 0 ) - { - Date aReminderDate; - aReminderDate.SetDate( nDate ); - bRet = aReminderDate <= Date(); - } - } - } - else - bRet = true; - - return bRet; - } - - //-------------------------------------------------------------------- - void RegOptionsImpl::markSessionDone( ) - { - OSL_ENSURE( !s_bThisSessionDone, "RegOptionsImpl::markSessionDone: already marked!" ); - OSL_ENSURE( implGetDialogPermission( ) != RegOptions::dpDisabled, "RegOptionsImpl::markSessionDone: invalid call!" ); - if ( !s_bThisSessionDone ) - { - RegOptions::DialogPermission eOldPermission = implGetDialogPermission( ); - - s_bThisSessionDone = sal_True; - - if ( RegOptions::dpRemindLater == eOldPermission ) - { // no action required. If we shall remind later, the counter is already at 1, we should not change this, - // as the next smaller number (which is 0 :) means that the dialog would be disabled - OSL_ENSURE( 1 == m_nDialogCounter, "RegOptionsImpl::markSessionDone: invalid session counter (1)!" ); - } - else - { - OSL_ENSURE( m_nDialogCounter > 0, "RegOptionsImpl::markSessionDone: invalid session counter (2)!" ); - --m_nDialogCounter; - - // decrease the session counter - m_aRegistrationNode.setNodeValue( - lcl_getRequestDialogName(), - makeAny( (sal_Int32)m_nDialogCounter ) - ); - - // and clear the reminder date - removeReminder(); - } - } - } - - //==================================================================== - //= RegOptions - //==================================================================== - //-------------------------------------------------------------------- - RegOptions::RegOptions() - :m_pImpl( NULL ) - { - } - - //-------------------------------------------------------------------- - void RegOptions::ensureImpl( ) - { - if ( !m_pImpl ) - m_pImpl = RegOptionsImpl::registerClient(); - } - - //-------------------------------------------------------------------- - RegOptions::~RegOptions() - { - if ( m_pImpl ) - { - RegOptionsImpl::revokeClient(); - m_pImpl = NULL; - } - } - - //-------------------------------------------------------------------- - String RegOptions::getRegistrationURL( ) const - { - const_cast< RegOptions* >( this )->ensureImpl( ); - return m_pImpl->getRegistrationURL(); - } - - //-------------------------------------------------------------------- - RegOptions::DialogPermission RegOptions::getDialogPermission( ) const - { - const_cast< RegOptions* >( this )->ensureImpl( ); - return m_pImpl->getDialogPermission(); - } - - //-------------------------------------------------------------------- - void RegOptions::markSessionDone( ) - { - const_cast< RegOptions* >( this )->ensureImpl( ); - m_pImpl->markSessionDone(); - } - - //-------------------------------------------------------------------- - void RegOptions::activateReminder( sal_Int32 _nDaysFromNow ) - { - const_cast< RegOptions* >( this )->ensureImpl( ); - m_pImpl->activateReminder( _nDaysFromNow ); - } - - //-------------------------------------------------------------------- - sal_Bool RegOptions::allowMenu( ) const - { - /// we cache this setting, 'cause it is needed very often - static sal_Bool bKnowMenuPermission = sal_False; - static sal_Bool bAllowMenu = sal_False; - - if ( !bKnowMenuPermission ) - { - const_cast< RegOptions* >( this )->ensureImpl( ); - bAllowMenu = m_pImpl->allowMenu(); - bKnowMenuPermission = sal_True; - } - return bAllowMenu; - } - - //-------------------------------------------------------------------- - void RegOptions::removeReminder() - { - const_cast< RegOptions* >( this )->ensureImpl( ); - m_pImpl->removeReminder(); - } - - //-------------------------------------------------------------------- - bool RegOptions::hasReminderDateCome() const - { - const_cast< RegOptions* >( this )->ensureImpl( ); - return m_pImpl->hasReminderDateCome(); - } - -//........................................................................ -} // namespace utl -//........................................................................ - |