summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jvmfwk/inc/jvmfwk/framework.h8
-rw-r--r--jvmfwk/source/elements.cxx300
-rw-r--r--jvmfwk/source/elements.hxx85
-rw-r--r--jvmfwk/source/framework.cxx31
-rw-r--r--jvmfwk/source/framework.hxx8
-rw-r--r--jvmfwk/source/fwkutil.cxx86
-rw-r--r--jvmfwk/source/fwkutil.hxx20
7 files changed, 381 insertions, 157 deletions
diff --git a/jvmfwk/inc/jvmfwk/framework.h b/jvmfwk/inc/jvmfwk/framework.h
index aa7a0520fa84..5f6097c317f6 100644
--- a/jvmfwk/inc/jvmfwk/framework.h
+++ b/jvmfwk/inc/jvmfwk/framework.h
@@ -2,9 +2,9 @@
*
* $RCSfile: framework.h,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jl $ $Date: 2004-04-23 08:40:39 $
+ * last change: $Author: jl $ $Date: 2004-04-26 11:20:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -566,7 +566,9 @@ javaFrameworkError SAL_CALL jfw_getVMParameters(
/** sets the user class path.
<p>When the VM is started then it is passed the class path. The
- class path also contains the user class path set by this function.</p>
+ class path also contains the user class path set by this function.
+ The paths contained in <code>pCP</code> must be separated with a
+ system dependent path separator.</p>
@param pCP
[in] the user class path.
diff --git a/jvmfwk/source/elements.cxx b/jvmfwk/source/elements.cxx
index 4260578bf0e3..1bbbb7532f6c 100644
--- a/jvmfwk/source/elements.cxx
+++ b/jvmfwk/source/elements.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elements.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jl $ $Date: 2004-04-23 08:40:39 $
+ * last change: $Author: jl $ $Date: 2004-04-26 11:20:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,6 +60,7 @@
************************************************************************/
#include "elements.hxx"
#include "osl/mutex.hxx"
+#include "osl/file.hxx"
#include "fwkutil.hxx"
#include "libxmlutil.hxx"
#include "osl/thread.hxx"
@@ -67,12 +68,276 @@
#include "libxml/parser.h"
#include "libxml/xpath.h"
#include "libxml/xpathinternals.h"
-#define NS_JAVA_FRAMEWORK "http://openoffice.org/2004/java/framework/1.0"
-#define NS_SCHEMA_INSTANCE "http://www.w3.org/2001/XMLSchema-instance"
+
+// #define NS_JAVA_FRAMEWORK "http://openoffice.org/2004/java/framework/1.0"
+// #define NS_SCHEMA_INSTANCE "http://www.w3.org/2001/XMLSchema-instance"
namespace jfw
{
+xmlNode* findChildNode(const xmlNode * pParent, const xmlChar* pName)
+{
+ xmlNode* ret = NULL;
+
+ if (pParent)
+ {
+ xmlNode* cur = pParent->children;
+ while (cur != NULL)
+ {
+ if (xmlStrcmp(cur->name, pName) == 0)
+ break;
+ cur = cur->next;
+ }
+ ret = cur;
+ }
+ return ret;
+}
+
+javaFrameworkError getElementUpdated(rtl::OString & sValue)
+{
+ javaFrameworkError errcode = JFW_E_NONE;
+ //Prepare the xml document and context
+ rtl::OString sSettingsPath = jfw::getVendorSettingsPath();
+ jfw::CXmlDocPtr doc = xmlParseFile(sSettingsPath.getStr());
+ if (doc == NULL)
+ {
+ OSL_ASSERT(0);
+ return JFW_E_CONFIG_READWRITE;
+ }
+ jfw::CXPathContextPtr context = xmlXPathNewContext(doc);
+ int reg = xmlXPathRegisterNs(context, (xmlChar*) "jf",
+ (xmlChar*) NS_JAVA_FRAMEWORK);
+ if (reg == -1)
+ return JFW_E_ERROR;
+ CXPathObjectPtr pathObj = xmlXPathEvalExpression(
+ (xmlChar*)"/jf:javaSelection/jf:updated/text()", context);
+ if (xmlXPathNodeSetIsEmpty(pathObj->nodesetval))
+ return JFW_E_FORMAT_STORE;
+ sValue = (sal_Char*) pathObj->nodesetval->nodeTab[0]->content;
+
+ return errcode;
+}
+
+javaFrameworkError createUserSettingsDocument()
+{
+ javaFrameworkError ret = JFW_E_NONE;
+ // check if javasettings.xml already exist
+ rtl::OUString sURL = getUserSettingsURL();
+
+ osl::DirectoryItem testFileItem;
+ osl::File::RC fileError = osl::DirectoryItem::get(sURL, testFileItem);
+ if (fileError == osl::FileBase::E_None)
+ //file exist already
+ return JFW_E_NONE;
+ else if (fileError != osl::FileBase::E_NOENT)
+ return JFW_E_ERROR;
+
+ //javasettings.xml does not exist yet
+ CXmlDocPtr doc = xmlNewDoc((xmlChar *)"1.0");
+ if (! doc)
+ return JFW_E_ERROR;
+ //Create a comment
+ xmlNewDocComment(
+ doc, (xmlChar *) "This is a generated file. Do not alter this file!");
+
+ //Create the root element and name spaces
+ xmlNodePtr root = xmlNewDocNode(
+ doc, NULL, (xmlChar *) "java", (xmlChar *) "\n");
+ if (root == NULL)
+ return JFW_E_ERROR;
+ if (xmlNewNs(root, (xmlChar *) NS_JAVA_FRAMEWORK,NULL) == NULL)
+ return JFW_E_ERROR;
+ if (xmlNewNs(root,(xmlChar*) NS_SCHEMA_INSTANCE,(xmlChar*)"xsi") == NULL)
+ return JFW_E_ERROR;
+ xmlDocSetRootElement(doc, root);
+
+ //Create a comment
+ xmlNodePtr com = xmlNewComment(
+ (xmlChar *) "This is a generated file. Do not alter this file!");
+ if (com == NULL)
+ return JFW_E_ERROR;
+
+ if (xmlAddPrevSibling(root, com) == NULL)
+ return JFW_E_ERROR;
+
+ rtl::OString sSettingsPath = jfw::getUserSettingsPath();
+ if (xmlSaveFormatFileEnc(
+ sSettingsPath.getStr(), doc,"UTF-8", 1) == -1)
+ return JFW_E_CONFIG_READWRITE;
+
+ return ret;
+}
+
+javaFrameworkError createSettingsStructure(xmlDoc * document, bool * bNeedsSave)
+{
+ javaFrameworkError errcode = JFW_E_NONE;
+ xmlNode * root = xmlDocGetRootElement(document);
+ if (root == NULL)
+ return JFW_E_ERROR;
+ bool bFound = false;
+ xmlNode * cur = root->children;
+ while (cur != NULL)
+ {
+ if (xmlStrcmp(cur->name, (xmlChar*) "enabled") == 0)
+ {
+ bFound = true;
+ break;
+ }
+ cur = cur->next;
+ }
+ if (bFound)
+ {
+ bNeedsSave = false;
+ return errcode;
+ }
+ //We will modify this document
+ *bNeedsSave = true;
+ // Now we create the child elements ------------------
+ //Get xsi:nil namespace
+ xmlNs* nsXsi = xmlSearchNsByHref(
+ document, root,(xmlChar*) NS_SCHEMA_INSTANCE);
+
+ //<classesDirectory/>
+ xmlNode * nodeCP = xmlNewTextChild(
+ root,NULL, (xmlChar*) "classesDirectory", (xmlChar*) "");
+ if (nodeCP == NULL)
+ return JFW_E_ERROR;
+ //add a new line
+ xmlNode * nodeCrLf = xmlNewText((xmlChar*) "\n");
+ xmlAddChild(root, nodeCrLf);
+
+ //<enabled xsi:nil="true"
+ xmlNode * nodeEn = xmlNewTextChild(
+ root,NULL, (xmlChar*) "enabled", (xmlChar*) "");
+ if (nodeEn == NULL)
+ return JFW_E_ERROR;
+ xmlSetNsProp(nodeEn,nsXsi,(xmlChar*) "nil",(xmlChar*) "true");
+ //add a new line
+ nodeCrLf = xmlNewText((xmlChar*) "\n");
+ xmlAddChild(root, nodeCrLf);
+
+ //<userClassPath xsi:nil="true">
+ xmlNode * nodeUs = xmlNewTextChild(
+ root,NULL, (xmlChar*) "userClassPath", (xmlChar*) "");
+ if (nodeUs == NULL)
+ return JFW_E_ERROR;
+ xmlSetNsProp(nodeUs,nsXsi,(xmlChar*) "nil",(xmlChar*) "true");
+ //add a new line
+ nodeCrLf = xmlNewText((xmlChar*) "\n");
+ xmlAddChild(root, nodeCrLf);
+
+ //<vmParameters xsi:nil="true">
+ xmlNode * nodeVm = xmlNewTextChild(
+ root,NULL, (xmlChar*) "vmParameters", (xmlChar*) "");
+ if (nodeVm == NULL)
+ return JFW_E_ERROR;
+ xmlSetNsProp(nodeVm,nsXsi,(xmlChar*) "nil",(xmlChar*) "true");
+ //add a new line
+ nodeCrLf = xmlNewText((xmlChar*) "\n");
+ xmlAddChild(root, nodeCrLf);
+
+ //<jreLocations xsi:nil="true">
+ xmlNode * nodeJre = xmlNewTextChild(
+ root,NULL, (xmlChar*) "jreLocations", (xmlChar*) "");
+ if (nodeJre == NULL)
+ return JFW_E_ERROR;
+ xmlSetNsProp(nodeJre,nsXsi,(xmlChar*) "nil",(xmlChar*) "true");
+ //add a new line
+ nodeCrLf = xmlNewText((xmlChar*) "\n");
+ xmlAddChild(root, nodeCrLf);
+
+ //<javaInfo xsi:nil="true">
+ xmlNode * nodeJava = xmlNewTextChild(
+ root,NULL, (xmlChar*) "javaInfo", (xmlChar*) "");
+ if (nodeJava == NULL)
+ return JFW_E_ERROR;
+ xmlSetNsProp(nodeJava,nsXsi,(xmlChar*) "nil",(xmlChar*) "true");
+ //add a new line
+ nodeCrLf = xmlNewText((xmlChar*) "\n");
+ xmlAddChild(root, nodeCrLf);
+
+ //only copied during first time setup for the current user and client
+ //machine
+ //!!! ToDo replace root later
+ errcode = copyShareSettings(document, root);
+
+ return errcode;
+}
+
+javaFrameworkError copyShareSettings(xmlDoc * doc, xmlNode * userParent)
+{
+ javaFrameworkError errcode = JFW_E_NONE;
+ CXPathContextPtr contextShare;
+ CXPathObjectPtr pathObj;
+
+ //check if there is a share/config/javasettings.xml
+ rtl::OUString sShareSettings = getSharedSettingsURL();
+
+ osl::DirectoryItem testFileItem;
+ osl::File::RC fileError = osl::DirectoryItem::get(
+ sShareSettings, testFileItem);
+ if (fileError == osl::FileBase::E_NOENT)
+ return JFW_E_NONE;
+ if (fileError != osl::FileBase::E_None)
+ //file exist already
+ return JFW_E_ERROR;
+
+
+
+ //Prepare access to share javasettings.xml
+ rtl::OString sSettings = getSharedSettingsPath();
+ CXmlDocPtr docShare = xmlParseFile(sSettings.getStr());
+ if (docShare == NULL)
+ return JFW_E_CONFIG_READWRITE;
+ contextShare = xmlXPathNewContext(docShare);
+ if (xmlXPathRegisterNs(contextShare, (xmlChar*) "jf",
+ (xmlChar*) NS_JAVA_FRAMEWORK) == -1)
+ return JFW_E_CONFIG_READWRITE;
+
+ //copy <classesDirectory>
+ //ToDo make sure that this works when admin copied the user javasettings.xml
+ //to the share/javasettings.xml
+ rtl::OString sExpression= rtl::OString("//jf:classesDirectory[1]/text()");
+ pathObj = xmlXPathEvalExpression((xmlChar*) sExpression.getStr(),
+ contextShare);
+ if ( ! pathObj || xmlXPathNodeSetIsEmpty(pathObj->nodesetval))
+ return JFW_E_FORMAT_STORE;
+
+ CXmlCharPtr sClasses = xmlNodeListGetString(
+ docShare, pathObj->nodesetval->nodeTab[0], 1);
+
+ xmlNode* userClasses =
+ findChildNode(userParent, (xmlChar*) "classesDirectory");
+ OSL_ASSERT(userClasses);
+
+ xmlNodeSetContent(userClasses, sClasses);
+
+ return errcode;
+}
+javaFrameworkError prepareSettingsDocument()
+{
+ javaFrameworkError errcode = JFW_E_NONE;
+ if ((errcode = createUserSettingsDocument()) != JFW_E_NONE)
+ return errcode;
+
+ rtl::OString sSettings = getUserSettingsPath();
+ CXmlDocPtr doc = xmlParseFile(sSettings.getStr());
+ if (!doc)
+ return JFW_E_CONFIG_READWRITE;
+
+ bool bNeedsSave = false;
+ errcode = createSettingsStructure(doc, & bNeedsSave);
+ if (errcode != JFW_E_NONE)
+ return errcode;
+ if (bNeedsSave)
+ {
+ if (xmlSaveFormatFileEnc(
+ sSettings.getStr(), doc,"UTF-8", 1) == -1)
+ return JFW_E_CONFIG_READWRITE;
+ }
+ return errcode;
+}
+
//====================================================================
VersionInfo::VersionInfo(): arVersions(NULL)
{
@@ -357,6 +622,7 @@ javaFrameworkError CNodeJava::writeSettings() const
CXPathContextPtr contextUser;
CXPathObjectPtr pathObj;
+ javaFrameworkError err = prepareSettingsDocument();
//Read the user elements
rtl::OString sSettingsPath = jfw::getUserSettingsPath();
docUser = xmlParseFile(sSettingsPath.getStr());
@@ -542,12 +808,14 @@ rtl::OUString const & CNodeJava::getUserClassPath() const
return m_sUserClassPath;
}
-void CNodeJava::setJavaInfo(const JavaInfo * pInfo,
- const rtl::OUString & sVendorUpdate)
+void CNodeJava::setJavaInfo(const JavaInfo * pInfo)
+
{
- OSL_ASSERT(sVendorUpdate.getLength() > 0);
+
m_aInfo.bNil = false;
- m_aInfo.sAttrVendorUpdate = sVendorUpdate;
+// m_aInfo.sAttrVendorUpdate = sVendorUpdate;
+
+
if (pInfo != NULL)
{
m_aInfo.m_bEmptyNode = false;
@@ -577,7 +845,7 @@ JavaInfo * CNodeJava::getJavaInfo() const
return m_aInfo.makeJavaInfo();
}
-rtl::OUString const & CNodeJava::getJavaInfoAttrVendorUpdate() const
+rtl::OString const & CNodeJava::getJavaInfoAttrVendorUpdate() const
{
return m_aInfo.sAttrVendorUpdate;
}
@@ -707,13 +975,12 @@ CNodeJavaInfo::~CNodeJavaInfo()
{
}
-CNodeJavaInfo::CNodeJavaInfo(const JavaInfo * pInfo,
- const rtl::OUString & sUpdated)
+CNodeJavaInfo::CNodeJavaInfo(const JavaInfo * pInfo)
{
if (pInfo != NULL)
{
m_bEmptyNode = false;
- sAttrVendorUpdate = sUpdated;
+// sAttrVendorUpdate = sUpdated;
sVendor = pInfo->sVendor;
sLocation = pInfo->sLocation;
sVersion = pInfo->sVersion;
@@ -813,11 +1080,14 @@ javaFrameworkError CNodeJavaInfo::writeToNode(xmlDoc* pDoc,
OSL_ASSERT(pJavaInfoNode && pDoc);
javaFrameworkError errcode = JFW_E_NONE;
//write the attribute vendorSettings
- rtl::OString osUpdate = rtl::OUStringToOString(
- sAttrVendorUpdate, osl_getThreadTextEncoding());
+
//creates the attribute if necessary
+ rtl::OString sUpdated;
+ errcode = getElementUpdated(sUpdated);
+ if (errcode != JFW_E_NONE)
+ return errcode;
xmlSetProp(pJavaInfoNode, (xmlChar*)"vendorUpdate",
- (xmlChar*) osUpdate.getStr());
+ (xmlChar*) sUpdated.getStr());
//Set xsi:nil in javaInfo element to false
//the xmlNs pointer must not be destroyed
diff --git a/jvmfwk/source/elements.hxx b/jvmfwk/source/elements.hxx
index f452510935fc..403e3b51e6b0 100644
--- a/jvmfwk/source/elements.hxx
+++ b/jvmfwk/source/elements.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: elements.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jl $ $Date: 2004-04-21 09:30:36 $
+ * last change: $Author: jl $ $Date: 2004-04-26 11:20:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,9 +66,72 @@
#include "rtl/ustring.hxx"
#include "rtl/byteseq.hxx"
#include "libxml/parser.h"
+
+#define NS_JAVA_FRAMEWORK "http://openoffice.org/2004/java/framework/1.0"
+#define NS_SCHEMA_INSTANCE "http://www.w3.org/2001/XMLSchema-instance"
+
namespace jfw
{
+xmlNode* findChildNode(const xmlNode * pParent, const xmlChar* pName);
+
+/** gets the value of the updated element from the javavendors.xml.
+ */
+javaFrameworkError getElementUpdated(rtl::OString & sValue);
+
+/** creates the javasettings.xml in the users home directory.
+
+ If javasettings.xml does not exist then it creates the file
+ and inserts the root element with its namespaces.
+ The content should look like this:
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!--This is a generated file. Do not alter this file!-->
+ <java xmlns:="http://openoffice.org/2004/java/framework/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ </java>
+
+ @return
+ JFW_E_NONE
+ JFW_E_ERROR
+ */
+javaFrameworkError createUserSettingsDocument();
+
+/** create the child elements within the root structure for each platform.
+
+ @param bNeedsSave
+ [out]If true then the respective structure of elements was added and the
+ document needs to be saved.
+ */
+javaFrameworkError createSettingsStructure(
+ xmlDoc * document, bool * bNeedsSave);
+
+/** copies share settings to user settings.
+
+ This must only occur the first time when the javasettings.xml is
+ prepared for the user.
+
+ @param userParent
+ The node under which the values are to be copied. For example if classesDirectory is
+ copied, then it is copied to userParent/classesDirectory
+
+ */
+javaFrameworkError copyShareSettings(xmlDoc * userDoc, xmlNode* userParent);
+
+/** creates the structure of the documend.
+
+ When this function is called the first time for a user then it creates the
+ javasettings.xml in th ~/<office>/user/config/ unless it already exists
+ (see createUserSettingsDocument). Then
+ it creates a section for the current platform unless it already exist and
+ creates all children elements. If the respective platform section did not exist
+ then after creating the children, the values from the share/config/javasettings.xml
+ are copied.
+
+ @return
+ JFW_E_CONFIG_READWRITE
+ */
+javaFrameworkError prepareSettingsDocument();
+
class CXmlCharPtr;
class CNodeJavaInfo
{
@@ -79,16 +142,18 @@ public:
sUpdated is the value from the <updated> element from the
javavendors.xml.
*/
- CNodeJavaInfo(const JavaInfo * pInfo, const rtl::OUString& sUpdated);
+ CNodeJavaInfo(const JavaInfo * pInfo);
/** if true, then javaInfo is empty. When writeToNode is called
then all child elements are deleted.
*/
bool m_bEmptyNode;
/** Contains the value of the <updated> element of
- the javavendors.xml
+ the javavendors.xml after loadFromNode was called.
+ It is not used, when the javaInfo node is written.
+ see writeToNode
*/
- rtl::OUString sAttrVendorUpdate;
+ rtl::OString sAttrVendorUpdate;
/** contains the nil value of the /java/javaInfo@xsi:nil attribute.
Default is true;
*/
@@ -106,7 +171,8 @@ public:
*/
javaFrameworkError loadFromNode(xmlDoc * pDoc,xmlNode * pJavaInfo);
/** Only writes user settings. The attribut nil always gets the value
- false;
+ false. The function gets the value javaSettings/updated from the
+ javavendors.xml and writes it to javaInfo@vendorUpdate in javasettings.xml
*/
javaFrameworkError writeToNode(xmlDoc * pDoc, xmlNode * pJavaInfo) const;
@@ -203,11 +269,8 @@ public:
*/
rtl::OUString const & getUserClassPath() const;
/** sets m_aInfo. Analog to setEnabled.
- @param sVendorUpdated
- The date string that is written to /java/javaInfo@vendorUpdate
- The string is the same as the value of /javaSettings/updated in javavendors.xml
*/
- void setJavaInfo(const JavaInfo * pInfo, const rtl::OUString& sVendorUpdated);
+ void setJavaInfo(const JavaInfo * pInfo);
/** returns a JavaInfo structure representing the node
/java/javaInfo
If both, user and share settings are nil, then NULL is returned.
@@ -215,7 +278,7 @@ public:
JavaInfo * getJavaInfo() const;
/** returns the value of the attribute /java/javaInfo[@vendorUpdate].
*/
- rtl::OUString const & getJavaInfoAttrVendorUpdate() const;
+ rtl::OString const & getJavaInfoAttrVendorUpdate() const;
/** sets the /java/vmParameters/param elements.
The values are kept in a vector m_arVmParameters. When this method is
called then the vector is cleared and the new values are inserted.
diff --git a/jvmfwk/source/framework.cxx b/jvmfwk/source/framework.cxx
index adf60c1778a6..67e4231011c5 100644
--- a/jvmfwk/source/framework.cxx
+++ b/jvmfwk/source/framework.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: framework.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jl $ $Date: 2004-04-23 08:40:39 $
+ * last change: $Author: jl $ $Date: 2004-04-26 11:20:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -299,7 +299,7 @@ javaFrameworkError SAL_CALL jfw_startVM(JavaVMOption *arOptions, sal_Int32 cOpti
if (aInfo == NULL)
return JFW_E_NO_SELECT;
//check if the javavendors.xml has changed after a Java was selected
- rtl::OUString sVendorUpdate;
+ rtl::OString sVendorUpdate;
if ((errcode = jfw::getElementUpdated(sVendorUpdate))
!= JFW_E_NONE)
return errcode;
@@ -603,20 +603,10 @@ javaFrameworkError SAL_CALL jfw_findAndSelectJRE(JavaInfo **pInfo)
}
if ((JavaInfo*) aCurrentInfo)
{
- rtl::OString sSettings = jfw::getUserSettingsPath();
- if (sSettings.getLength() == 0)
- return JFW_E_ERROR;
- // Get the <updated> element from the javavendors.xml
- jfw::CXPathObjectPtr pathObjUpdated = xmlXPathEvalExpression(
- (xmlChar*) "/jf:javaSelection/jf:updated/text()", context);
- if (xmlXPathNodeSetIsEmpty(pathObjUpdated->nodesetval))
- return JFW_E_FORMAT_STORE;
- rtl::OString osUpdated =
- (sal_Char*) pathObjUpdated->nodesetval->nodeTab[0]->content;
- rtl::OUString sUpdated =
- rtl::OStringToOUString(osUpdated, RTL_TEXTENCODING_UTF8);
- // write the Java information to the user settings
- errcode = jfw::writeJavaInfoData(aCurrentInfo, sUpdated, sSettings);
+ jfw::CNodeJava javaNode;
+ javaNode.setJavaInfo(aCurrentInfo);
+ errcode = javaNode.writeSettings();
+
if (errcode == JFW_E_NONE && pInfo !=NULL)
{
//copy to out param
@@ -680,7 +670,7 @@ javaFrameworkError SAL_CALL jfw_getSelectedJRE(JavaInfo **ppInfo)
//If the javavendors.xml has changed, then the current selected
//Java is not valid anymore
// /java/javaInfo/@vendorUpdate != javaSelection/updated (javavendors.xml)
- rtl::OUString sUpdated;
+ rtl::OString sUpdated;
if ((errcode = jfw::getElementUpdated(sUpdated)) != JFW_E_NONE)
return errcode;
if (sUpdated.equals(aSettings.getJavaInfoAttrVendorUpdate()) == sal_False)
@@ -793,10 +783,7 @@ javaFrameworkError SAL_CALL jfw_setSelectedJRE(JavaInfo const *pInfo)
osl::MutexGuard guard(jfw::getFwkMutex());
javaFrameworkError errcode = JFW_E_NONE;
jfw::CNodeJava node;
- rtl::OUString sUpdated;
- if((errcode = jfw::getElementUpdated(sUpdated)) != JFW_E_NONE)
- return errcode;
- node.setJavaInfo(pInfo, sUpdated);
+ node.setJavaInfo(pInfo);
errcode = node.writeSettings();
if (errcode != JFW_E_NONE)
return errcode;
diff --git a/jvmfwk/source/framework.hxx b/jvmfwk/source/framework.hxx
index 39afe88f3106..9a289f4fd5ec 100644
--- a/jvmfwk/source/framework.hxx
+++ b/jvmfwk/source/framework.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: framework.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jl $ $Date: 2004-04-19 15:55:46 $
+ * last change: $Author: jl $ $Date: 2004-04-26 11:20:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,8 +66,8 @@
#include "jvmfwk/vendorplugin.h"
-#define NS_JAVA_FRAMEWORK "http://openoffice.org/2004/java/framework/1.0"
-#define NS_SCHEMA_INSTANCE "http://www.w3.org/2001/XMLSchema-instance"
+//#define NS_JAVA_FRAMEWORK "http://openoffice.org/2004/java/framework/1.0"
+//#define NS_SCHEMA_INSTANCE "http://www.w3.org/2001/XMLSchema-instance"
/** typedefs for functions from vendorplugin.h
*/
diff --git a/jvmfwk/source/fwkutil.cxx b/jvmfwk/source/fwkutil.cxx
index f5a9a614184b..e46d8d6b124b 100644
--- a/jvmfwk/source/fwkutil.cxx
+++ b/jvmfwk/source/fwkutil.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fwkutil.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jl $ $Date: 2004-04-19 15:55:15 $
+ * last change: $Author: jl $ $Date: 2004-04-26 11:20:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -542,88 +542,6 @@ rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data)
}
-javaFrameworkError writeJavaInfoData(const jfw::CJavaInfo & aInfo,
- const rtl::OUString & sUpdated,
- const rtl::OString & sSettings)
-{
- OSL_ASSERT(sSettings.getLength());
- javaFrameworkError errcode = JFW_E_NONE;
- jfw::CXmlDocPtr docUser;
- jfw::CXPathContextPtr contextUser;
- jfw::CXPathObjectPtr pathObjUser;
- docUser = xmlParseFile(sSettings.getStr());
- if (docUser == NULL)
- return JFW_E_CONFIG_READWRITE;
-
-
- contextUser = xmlXPathNewContext(docUser);
- if (xmlXPathRegisterNs(contextUser, (xmlChar*) "jf",
- (xmlChar*) NS_JAVA_FRAMEWORK) == -1)
- return JFW_E_CONFIG_READWRITE;
-
- //Get position of javaInfo element
- rtl::OString sExpresion= rtl::OString(
- "/jf:java/jf:javaInfo");
- pathObjUser = xmlXPathEvalExpression((xmlChar*) sExpresion.getStr(),
- contextUser);
- if ( ! pathObjUser || xmlXPathNodeSetIsEmpty(pathObjUser->nodesetval))
- return JFW_E_FORMAT_STORE;
-
- CNodeJavaInfo infoNode(aInfo, sUpdated);
- errcode = infoNode.writeToNode(docUser, pathObjUser->nodesetval->nodeTab[0]);
- if (errcode == JFW_E_NONE)
- {
-// xmlKeepBlanksDefault(0);
- if (xmlSaveFormatFile(sSettings.getStr(), docUser, 1) == -1)
- return JFW_E_CONFIG_READWRITE;
- setJavaSelected();
- }
- return errcode;
-}
-
-xmlNode* findChildNode(const xmlNode * pParent, const xmlChar* pName)
-{
- xmlNode* ret = NULL;
-
- if (pParent)
- {
- xmlNode* cur = pParent->children;
- while (cur != NULL)
- {
- if (xmlStrcmp(cur->name, pName) == 0)
- break;
- cur = cur->next;
- }
- ret = cur;
- }
- return ret;
-}
-
-javaFrameworkError getElementUpdated(rtl::OUString & sValue)
-{
- javaFrameworkError errcode = JFW_E_NONE;
- //Prepare the xml document and context
- rtl::OString sSettingsPath = jfw::getVendorSettingsPath();
- jfw::CXmlDocPtr doc = xmlParseFile(sSettingsPath.getStr());
- if (doc == NULL)
- {
- OSL_ASSERT(0);
- return JFW_E_CONFIG_READWRITE;
- }
- jfw::CXPathContextPtr context = xmlXPathNewContext(doc);
- int reg = xmlXPathRegisterNs(context, (xmlChar*) "jf",
- (xmlChar*) NS_JAVA_FRAMEWORK);
- if (reg == -1)
- return JFW_E_ERROR;
- CXPathObjectPtr pathObj = xmlXPathEvalExpression(
- (xmlChar*)"/jf:javaSelection/jf:updated/text()", context);
- if (xmlXPathNodeSetIsEmpty(pathObj->nodesetval))
- return JFW_E_FORMAT_STORE;
- rtl::OString osUpdated =
- (sal_Char*) pathObj->nodesetval->nodeTab[0]->content;
- sValue = rtl::OStringToOUString(osUpdated, RTL_TEXTENCODING_UTF8);
- return errcode;
-}
javaFrameworkError buildClassPathFromDirectory(const rtl::OUString & relPath,
rtl::OUString & sClassPath)
diff --git a/jvmfwk/source/fwkutil.hxx b/jvmfwk/source/fwkutil.hxx
index 8af560513349..71d1747a4648 100644
--- a/jvmfwk/source/fwkutil.hxx
+++ b/jvmfwk/source/fwkutil.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fwkutil.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jl $ $Date: 2004-04-19 15:55:56 $
+ * last change: $Author: jl $ $Date: 2004-04-26 11:20:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -85,7 +85,6 @@ rtl::OUString getBaseInstallation();
rtl::OUString getVendorSettingsURL();
rtl::OString getVendorSettingsPath();
-xmlNode* findChildNode(const xmlNode * pParent, const xmlChar* pName);
struct PluginLibrary;
class VersionInfo;
@@ -103,26 +102,11 @@ javaFrameworkError getVersionInformation(
const rtl::OString & sVendor,
VersionInfo *pVersionInfo);
-/** gets the value of the updated element from the javavendors.xml.
- */
-javaFrameworkError getElementUpdated(rtl::OUString & sValue);
/** Gets the file URL to the plubin library for the currently selected Java.
*/
javaFrameworkError getPluginLibrary(rtl::OUString & sLibPathe);
-//xmlNode* findChildNode(const xmlNode * pParent, const xmlChar* pName);
-/**
- @param sUpdated
- the value of the element /javaSelection/updated from the javavendors.xml
- file.
- @param sSettings
- the system path to the settings xml file.
- */
-javaFrameworkError writeJavaInfoData(const jfw::CJavaInfo & aInfo,
- const rtl::OUString& sUpdated,
- const rtl::OString & sSettings);
-
/** Called from writeJavaInfoData. It sets the process identifier. When
java is to be started, then the current id is compared to the one set by
this function. If they are identical then the Java was selected in the