summaryrefslogtreecommitdiff
path: root/configmgr/workben/local_io
diff options
context:
space:
mode:
Diffstat (limited to 'configmgr/workben/local_io')
-rw-r--r--configmgr/workben/local_io/cfgfile.cxx94
-rw-r--r--configmgr/workben/local_io/cfglocal.cxx620
-rw-r--r--configmgr/workben/local_io/com.sun.star.office.Setup.xml29
-rw-r--r--configmgr/workben/local_io/filetest.cxx90
-rw-r--r--configmgr/workben/local_io/makefile.mk110
-rw-r--r--configmgr/workben/local_io/org.openoffice.test.xml70
-rw-r--r--configmgr/workben/local_io/simpletest.cxx758
-rw-r--r--configmgr/workben/local_io/xmlexport.cxx236
-rw-r--r--configmgr/workben/local_io/xmlimport.cxx469
9 files changed, 0 insertions, 2476 deletions
diff --git a/configmgr/workben/local_io/cfgfile.cxx b/configmgr/workben/local_io/cfgfile.cxx
deleted file mode 100644
index a91cc512aa62..000000000000
--- a/configmgr/workben/local_io/cfgfile.cxx
+++ /dev/null
@@ -1,94 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-
-// -----------------------------------------------------------------------------
-// ------------------------------------ main ------------------------------------
-// -----------------------------------------------------------------------------
-
-/*
- OUString operator+(const OUString &a, const OUString &b)
- {
- OUString c = a;
- c += b;
- return c;
- }
-*/
-
-namespace configmgr
-{
- void simpleMappingTest();
-
- void importTest();
- void exportTest();
-
- void hierarchyTest();
- //void simpleTest();
- void speedTest();
- void stringTest();
- void classTest();
- void hash_test();
- void testRefs();
- void ConfigName();
-
- void oslTest();
-}
-
-
-
-#if (defined UNX) || (defined OS2)
-int main( int argc, char * argv[] )
-#else
- int _cdecl main( int argc, char * argv[] )
-#endif
-{
-
-// configmgr::hierarchyTest();
-
-
-// configmgr::importTest();
-// configmgr::exportTest();
-// configmgr::speedTest();
-// configmgr::simpleTest();
-
-// configmgr::simpleMappingTest();
-// configmgr::stringTest();
-// configmgr::classTest();
-
-// configmgr::hash_test();
-
- // configmgr::testRefs();
- // configmgr::ConfigName();
-
- configmgr::oslTest();
- return 0;
-}
-
-
diff --git a/configmgr/workben/local_io/cfglocal.cxx b/configmgr/workben/local_io/cfglocal.cxx
deleted file mode 100644
index 10530b0ba48d..000000000000
--- a/configmgr/workben/local_io/cfglocal.cxx
+++ /dev/null
@@ -1,620 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-#define _PRIVATE_TEST_
-
-#include <memory.h>
-#include <string.h>
-#include <stdio.h>
-#include <vos/socket.hxx>
-#include "attributes.hxx"
-
-#ifndef _CONFIGMGR_SESSION_REMOTESESSION_HXX_
-#include "remotesession.hxx"
-#endif
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <cppuhelper/servicefactory.hxx>
-#include <cppuhelper/implbase1.hxx>
-#include <vos/conditn.hxx>
-
-#include <osl/time.h>
-
-#include "localsession.hxx"
-#include "confname.hxx"
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::xml;
-using namespace ::vos;
-using namespace ::cppu;
-using namespace ::configmgr;
-using namespace rtl;
-
-// #define USE_LAYOUT_NODE
-
-//=============================================================================
-//= a dirty littly class for printing ascii characters
-//=============================================================================
-class OAsciiOutput
-{
-protected:
- sal_Char* m_pCharacters;
-
-public:
- OAsciiOutput(const ::rtl::OUString& _rUnicodeChars);
- ~OAsciiOutput() { delete m_pCharacters; }
-
- const sal_Char* getCharacters() const { return m_pCharacters; }
-};
-
-//-----------------------------------------------------------------------------
-OAsciiOutput::OAsciiOutput(const ::rtl::OUString& _rUnicodeChars)
-{
- sal_Int32 nLen = _rUnicodeChars.getLength();
- m_pCharacters = new sal_Char[nLen + 1];
- sal_Char* pFillPtr = m_pCharacters;
- const sal_Unicode* pSourcePtr = _rUnicodeChars.getStr();
-#ifdef DBG_UTIL
- sal_Bool bAsserted = sal_False;
-#endif
- for (sal_Int32 i=0; i<nLen; ++i, ++pFillPtr, ++pSourcePtr)
- {
- OSL_ENSURE(bAsserted || !(bAsserted = (*pSourcePtr >= 0x80)),
- "OAsciiOutput::OAsciiOutput : non-ascii character found !");
- *pFillPtr = *reinterpret_cast<const sal_Char*>(pSourcePtr);
- }
- *pFillPtr = 0;
-}
-
-#define ASCII_STRING(rtlOUString) OAsciiOutput(rtlOUString).getCharacters()
-#define UNI_STRING(salCharPtr) ::rtl::OUString::createFromAscii(salCharPtr)
-
-//=============================================================================
-//= OOpenNodeCallback
-//=============================================================================
-typedef ::cppu::WeakImplHelper1< sax::XDocumentHandler > OOpenNodeCallback_Base;
-class OOpenNodeCallback : public IOpenObjectCallback, public OOpenNodeCallback_Base
-{
-protected:
- OUString m_sNodeId;
- ::vos::OCondition& m_rFinishCondition;
-
- enum ACTION { STARTELEMENT, CHARACTERS, ENDELEMENT };
- ACTION m_eLastAction;
- sal_Int32 m_nLevel;
- sal_Bool m_bCloseStartTag;
-
-protected:
- ~OOpenNodeCallback()
- {
- }
-
-public:
- OOpenNodeCallback(::vos::OCondition& _rFinishCond) : m_rFinishCondition(_rFinishCond), m_nLevel(0), m_eLastAction(ENDELEMENT), m_bCloseStartTag(sal_False) { }
-
- OUString getNodeId() const { return m_sNodeId; }
-
- // IOpenObjectCallback
- virtual void gotObjectId(const OUString &aName);
-
- // IDataRequestCallback
- virtual Reference< sax::XDocumentHandler > getDataReader() { return static_cast< sax::XDocumentHandler* >(this); }
-
- // IRequestCallback
- virtual void acknowledged(sal_Int32 _nTransId);
- virtual void failed(sal_Int32 _nErrorCode);
- virtual void done(const StatusInfo& _rStatus);
-
- // IInterface
- virtual void SAL_CALL acquire( ) throw (::com::sun::star::uno::RuntimeException) { OOpenNodeCallback_Base::acquire(); }
- virtual void SAL_CALL release( ) throw (::com::sun::star::uno::RuntimeException) { OOpenNodeCallback_Base::release(); }
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument( ) throw(sax::SAXException, RuntimeException) { }
- virtual void SAL_CALL endDocument( ) throw(sax::SAXException, RuntimeException) { }
- virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const Reference< sax::XAttributeList >& xAttribs ) throw(sax::SAXException, RuntimeException);
- virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw(sax::SAXException, RuntimeException);
- virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw(sax::SAXException, RuntimeException);
- virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw(sax::SAXException, RuntimeException) { }
- virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw(sax::SAXException, RuntimeException) { }
- virtual void SAL_CALL setDocumentLocator( const Reference< sax::XLocator >& xLocator ) throw(sax::SAXException, RuntimeException) { }
-};
-
-//.............................................................................
-inline void linefeed()
-{
- // printf("\n");
-}
-
-//.............................................................................
-void printTabs(sal_Int32 _nCount)
-{
- sal_Char* pBuffer = new sal_Char[2 * _nCount + 1];
- memset(pBuffer, ' ', 2 * _nCount);
- pBuffer[2 * _nCount] = 0;
- // printf(pBuffer);
-}
-
-//-----------------------------------------------------------------------------
-void SAL_CALL OOpenNodeCallback::startElement( const ::rtl::OUString& _rName, const Reference< sax::XAttributeList >& xAttribs ) throw(sax::SAXException, RuntimeException)
-{
- switch (m_eLastAction)
- {
- case STARTELEMENT:
- if (m_bCloseStartTag)
- {
- // printf(">");
- }
-
- m_bCloseStartTag = sal_False;
- // no break
- case CHARACTERS:
- case ENDELEMENT:
- linefeed();
- printTabs(m_nLevel);
- break;
- }
- m_eLastAction = STARTELEMENT;
- ++m_nLevel;
- // printf("<%s", ASCII_STRING(_rName));
- m_bCloseStartTag = sal_True;
-}
-
-//-----------------------------------------------------------------------------
-void SAL_CALL OOpenNodeCallback::endElement( const ::rtl::OUString& _rName ) throw(sax::SAXException, RuntimeException)
-{
- --m_nLevel;
- switch (m_eLastAction)
- {
- case STARTELEMENT:
- if (m_bCloseStartTag)
- {
- // printf("/>");
- }
-
- m_bCloseStartTag = sal_False;
- break;
- case ENDELEMENT:
- linefeed();
- printTabs(m_nLevel);
- // dont break
- case CHARACTERS:
- // printf("</%s>", ASCII_STRING(_rName));
- break;
- }
- m_eLastAction = ENDELEMENT;
-}
-
-//-----------------------------------------------------------------------------
-void SAL_CALL OOpenNodeCallback::characters( const ::rtl::OUString& _rChars ) throw(sax::SAXException, RuntimeException)
-{
- if (STARTELEMENT == m_eLastAction)
- {
- if (m_bCloseStartTag && _rChars.trim().getLength())
- {
- // printf(">");
- m_bCloseStartTag = sal_False;
- }
- }
- if (_rChars.trim().getLength() != 0)
- {
- // printf("%s", ASCII_STRING(_rChars));
- m_eLastAction = CHARACTERS;
- }
-}
-
-//-----------------------------------------------------------------------------
-void OOpenNodeCallback::gotObjectId(const OUString &_nId)
-{
- m_sNodeId = _nId;
- // printf("object id %i\n", m_nNodeId);
-}
-
-//-----------------------------------------------------------------------------
-void OOpenNodeCallback::acknowledged(sal_Int32 _nTransId)
-{
- // printf("acknowledged, transaction id : %i\n", _nTransId);
-}
-
-//-----------------------------------------------------------------------------
-void OOpenNodeCallback::failed(sal_Int32 _nErrorCode)
-{
- // printf("failed because of a connection error (%i)\n", _nErrorCode);
- m_rFinishCondition.set();
-}
-
-//-----------------------------------------------------------------------------
-void OOpenNodeCallback::done(const StatusInfo& _rStatus)
-{
- if (_rStatus.nCode)
- {
- printf("\n\ndone, but had an error : %s\n", ASCII_STRING(_rStatus.sMessage));
- }
- else
- {
- // printf("\n\nsuccessfully done\n", ASCII_STRING(_rStatus.sMessage));
- }
-
- m_rFinishCondition.set();
-}
-
-//=============================================================================
-//= ONodeUpdater
-//=============================================================================
-class ONodeUpdater : public IDOMNodeDataProvider
-{
- sal_Bool m_bWriterLevel;
- sal_Bool m_bAdd;
-public:
- ONodeUpdater(sal_Bool _bStartAtWriterLevel, sal_Bool bAdd) : m_bWriterLevel(_bStartAtWriterLevel), m_bAdd(bAdd) { }
-
- virtual void writeNodeData(const Reference< sax::XDocumentHandler >& _rHandler);
-};
-
-//-----------------------------------------------------------------------------
-void ONodeUpdater::writeNodeData(const Reference< sax::XDocumentHandler >& _rHandler)
-{
- AttributeListImpl *pAttr = new AttributeListImpl;
- Reference< sax::XAttributeList > xEmptyAttrList = pAttr;
-
- pAttr = new AttributeListImpl;
- pAttr->addAttribute(UNI_STRING("type"),UNI_STRING("CDATA"),UNI_STRING("string"));
- Reference< sax::XAttributeList > xStringAttrList = pAttr;
-
- if (m_bWriterLevel)
- _rHandler->startElement(UNI_STRING("Writer"), xEmptyAttrList);
-#ifdef USE_LAYOUT_NODE
- _rHandler->startElement(UNI_STRING("Layout"), xEmptyAttrList);
- _rHandler->startElement(UNI_STRING("TabStops"), xEmptyAttrList);
- if (m_bAdd)
- _rHandler->characters(UNI_STRING("0.90"));
- else
- _rHandler->characters(UNI_STRING("99.99"));
-
- _rHandler->endElement(UNI_STRING("TabStops"));
- _rHandler->endElement(UNI_STRING("Layout"));
-#else
- // _rHandler->startElement(UNI_STRING("com.sun.star.office.Setup"), xEmptyAttrList);
- _rHandler->startElement(UNI_STRING("Modules"), xEmptyAttrList);
- _rHandler->startElement(UNI_STRING("StandFonts"), xEmptyAttrList);
- _rHandler->startElement(UNI_STRING("Standard"), xStringAttrList);
- _rHandler->startElement(UNI_STRING("value"), xEmptyAttrList);
- if (m_bAdd)
- _rHandler->characters(UNI_STRING("Arial"));
- else
- _rHandler->characters(UNI_STRING("Courier"));
-
- _rHandler->endElement(UNI_STRING("value"));
- _rHandler->endElement(UNI_STRING("Standard"));
- _rHandler->endElement(UNI_STRING("StandFonts"));
- _rHandler->endElement(UNI_STRING("Modules"));
- // _rHandler->endElement(UNI_STRING("com.sun.star.office.Setup"));
-
- _rHandler->ignorableWhitespace(OUString());
-#endif
- if (m_bWriterLevel)
- _rHandler->endElement(UNI_STRING("Writer"));
-}
-
-//=============================================================================
-//= OSessionListener
-//=============================================================================
-class OSessionListener : public ISessionListener
-{
-protected:
- oslInterlockedCount m_refCount;
-
-public:
- // ISessionListener
- virtual void nodeUpdated(const ::rtl::OUString& _rNodePath);
- virtual void nodeDeleted(const ::rtl::OUString& _rNodePath);
- virtual void nodeAdded(const ::rtl::OUString& _rNodePath);
-
- // IInterface
- virtual void SAL_CALL acquire( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL release( ) throw (::com::sun::star::uno::RuntimeException);
-};
-
-//-----------------------------------------------------------------------------
-void OSessionListener::nodeUpdated(const ::rtl::OUString& _rNodePath)
-{
- // printf("[listener] : a node was updated, node path : %s\n", ASCII_STRING(_rNodePath));
-}
-
-//-----------------------------------------------------------------------------
-void OSessionListener::nodeDeleted(const ::rtl::OUString& _rNodePath)
-{
- // printf("[listener] : a node was deleted, node path : %s\n", ASCII_STRING(_rNodePath));
-}
-
-//-----------------------------------------------------------------------------
-void OSessionListener::nodeAdded(const ::rtl::OUString& _rNodePath)
-{
- // printf("\n[listener] : a node was added, node path : %s", ASCII_STRING(_rNodePath));
-}
-
-//-----------------------------------------------------------------------------
-void SAL_CALL OSessionListener::acquire( ) throw (::com::sun::star::uno::RuntimeException)
-{
- osl_incrementInterlockedCount(&m_refCount);
-}
-
-//-----------------------------------------------------------------------------
-void SAL_CALL OSessionListener::release( ) throw (::com::sun::star::uno::RuntimeException)
-{
- if (!osl_decrementInterlockedCount(&m_refCount))
- delete this;
-}
-
-//=============================================================================
-//=============================================================================
-
-//=============================================================================
-static ::rtl::OUString sHost;
-static sal_Int32 nPort;
-static ::rtl::OUString sRegistry = ::rtl::OUString::createFromAscii("applicat.rdb");
-
-//=============================================================================
-sal_Bool collectArgs(int argc, char * argv[])
-{
- if (argc > 1)
- {
- sal_Char* pConnectTo = argv[1];
- sal_Char* pSeparator = strchr(pConnectTo, ':');
- if (pSeparator && (0 != *(pSeparator + 1)))
- {
- sHost = ::rtl::OUString(pConnectTo, pSeparator - pConnectTo, RTL_TEXTENCODING_ASCII_US);
- nPort = ::rtl::OUString::createFromAscii(pSeparator + 1).toInt32();
-
- if (argc > 2)
- sRegistry = ::rtl::OUString::createFromAscii(argv[2]);
- return sal_True;
- }
- }
-
- printf("cfgclient - registry server client test ...\n\r\n\r");
- printf("usage :\n\r");
- printf(" cfgclient <server>:<port> [<registry file>]\n\r\n\r");
- printf(" <server> : machine to connect to\n\r");
- printf(" <port> : port to connect to\n\r");
- printf(" <registry file> : (optional) registry to bootstrap from. defaulted to \"applicat.rdb\"\n\r\n\r");
- return sal_False;
-}
-
-//=============================================================================
-
-#if (defined UNX) || (defined OS2)
-void main( int argc, char * argv[] )
-#else
-void _cdecl main( int argc, char * argv[] )
-#endif
-{
- Reference< XMultiServiceFactory > xORB;
- try
- {
- xORB = createRegistryServiceFactory(sRegistry, ::rtl::OUString());
- }
- catch (Exception& e)
- {
- printf("could not bootstrap the services from %s\n\r", ASCII_STRING(sRegistry));
- printf(" (error message : %s)", ASCII_STRING(e.Message));
- }
-
- if (!xORB.is())
- {
- fprintf(stdout, "could not create the service factory !");
- return;
- }
-
- ORef< OSessionListener > xListener = new OSessionListener;
- {
-/*
- ORemoteSession aSession(xORB);
- // --------- connect ----------
- sal_Bool bSuccess = aSession.connect(sHost, nPort, &aTimeout);
- if (!bSuccess)
- {
- printf("could not connect to the server (error : %i) ...", aSession.getConnectionError());
- return;
- }
-*/
-
- void testSession(const Reference< XMultiServiceFactory > &xORB, bool bPrint);
-
- for (int i=0;i<100;i++)
- {
- TimeValue aStartTime, aEndTime;
- osl_getSystemTime(&aStartTime);
- testSession(xORB, false);
- osl_getSystemTime(&aEndTime);
-
- sal_Int32 nSeconds = aEndTime.Seconds - aStartTime.Seconds;
- sal_Int32 nNanoSec = aEndTime.Nanosec - aStartTime.Nanosec;
- if (nNanoSec < 0)
- {
- nNanoSec = 1000000000 - nNanoSec;
- nSeconds++;
- }
-
- cout << "Time: " << nSeconds << ". " << nNanoSec << endl;
- }
- }
-}
-
-void testSession(const Reference< XMultiServiceFactory > &xORB, bool bPrint)
-{
- TimeValue aTimeout;
- aTimeout.Seconds = 5;
- aTimeout.Nanosec = 0;
-
-
- // create it .. and connect
- LocalSession aSession(xORB);
-
- // --------- openSession ----------
-
- OUString aRootPath = OUString::createFromAscii("f:/local/SRC598/configmgr/workben/local_io");
- // f:/local/SRC595/configmgr/workben/local_io);
- aSession.open(aRootPath);
-
- if (aSession.isOpen())
- {
- if (bPrint) printf("\nopened the session ...");
- }
- else
- {
- printf("\ncould not open the session ... exiting\n\n");
- return;
- }
-
- // aSession.setListener(xListener.getBodyPtr());
-
- OCondition aWaitForSomething;
- aWaitForSomething.reset();
-
- // --------- openNode ----------
- char* pWriterNode = "com.sun.star.Setup/Modules";
- if (bPrint) printf("\nsending an openNode request for %s ...\n", pWriterNode);
- ORef< OOpenNodeCallback > xOpenCallback = new OOpenNodeCallback(aWaitForSomething);
- aSession.openNode(UNI_STRING(pWriterNode), 2, xOpenCallback.getBodyPtr());
-
- aTimeout.Seconds = 30;
- switch (aWaitForSomething.wait(&aTimeout))
- {
- case ICondition::result_error:
- printf("error while waiting for the callback ... exiting\n\n");
- return;
- case ICondition::result_timeout:
- if (bPrint) printf("timed out ... exiting\n\n");
- return;
- }
-
- OUString sOpenedNode = xOpenCallback->getNodeId();
-
-// aSession.getNode(UNI_STRING("com.sun.star.Spreadsheet"), NULL);
-//
-// // --------- getNode (1) ----------
-//#ifdef USE_LAYOUT_NODE
-// char* pLayoutNode = "com.sun.star.office.Setup/Modules";
-//#else
- char* pLayoutNode = "com.sun.star.Setup/Modules";
-//#endif
-// printf("\nsending an getNode request for %s ...\n", pLayoutNode);
-// aWaitForSomething.reset();
-// aSession.getNode(UNI_STRING(pLayoutNode), new OOpenNodeCallback(aWaitForSomething));
-//
-// switch (aWaitForSomething.wait(&aTimeout))
-// {
-// case ICondition::result_error:
-// printf("error while waiting for the callback ... exiting\n\n");
-// return;
-// case ICondition::result_timeout:
-// printf("timed out ... exiting\n\n");
-// return;
-// }
-
- // --------- addNode ----------
- if (bPrint) printf("\n\naddNode ....");
- ONodeUpdater aAddTabstops(sal_False, true); // true = WRITER LEVEL
- aWaitForSomething.reset();
- aSession.addNode(sOpenedNode, UNI_STRING(pLayoutNode), &aAddTabstops, new OOpenNodeCallback(aWaitForSomething));
- switch (aWaitForSomething.wait(&aTimeout))
- {
- case ICondition::result_error:
- printf("error while waiting for the callback ... exiting\n\n");
- return;
- case ICondition::result_timeout:
- if (bPrint) printf("timed out ... exiting\n\n");
- return;
- }
-
- // --------- updateNode ----------
- if (bPrint) printf("\n\nokay, let's try an update ....\n");
-
- ONodeUpdater aUpdateWriter(sal_False, false);
- aWaitForSomething.reset();
- aSession.updateNode(sOpenedNode, UNI_STRING(pLayoutNode), &aUpdateWriter, new OOpenNodeCallback(aWaitForSomething));
-
- switch (aWaitForSomething.wait(&aTimeout))
- {
- case ICondition::result_error:
- printf("error while waiting for the callback ... exiting\n\n");
- return;
- case ICondition::result_timeout:
- if (bPrint) printf("timed out ... exiting\n\n");
- return;
- }
-
- // --------- deleteNode ----------
- char* pLayoutNode2 = "com.sun.star.Setup/Modules/StandFonts";
-
- if (bPrint) printf("\n\ndeleteNode ....");
- aWaitForSomething.reset();
- aSession.deleteNode(sOpenedNode, UNI_STRING(pLayoutNode2), new OOpenNodeCallback(aWaitForSomething));
- switch (aWaitForSomething.wait(&aTimeout))
- {
- case ICondition::result_error:
- printf("error while waiting for the callback ... exiting\n\n");
- return;
- case ICondition::result_timeout:
- if (bPrint) printf("timed out ... exiting\n\n");
- return;
- }
-
-/*
- // --------- startListening ----------
- printf("\n\nadding a listener for the Layout node\n");
- Sequence< ::rtl::OUString > aNodesToListen(1);
- aNodesToListen[0] = UNI_STRING(pLayoutNode);
- aSession.startListening(aNodesToListen, NULL);
-
- printf("waiting 10 seconds ....\n\n");
- aWaitForSomething.reset();
- aTimeout.Seconds = 10;
- aWaitForSomething.wait(&aTimeout);
-*/
- // --------- getNode (2) ----------
-// printf("\ndoing a new getNode for the Layout node ...\n");
-// aWaitForSomething.reset();
-// aSession.getNode(UNI_STRING(pLayoutNode), new OOpenNodeCallback(aWaitForSomething));
-// switch (aWaitForSomething.wait(&aTimeout))
-// {
-// case ICondition::result_error:
-// printf("error while waiting for the callback ... exiting\n\n");
-// return;
-// case ICondition::result_timeout:
-// printf("timed out ... exiting\n\n");
-// return;
-// }
-
- aSession.closeNode(sOpenedNode, NULL);
- aSession.close(NULL);
-
-}
-
diff --git a/configmgr/workben/local_io/com.sun.star.office.Setup.xml b/configmgr/workben/local_io/com.sun.star.office.Setup.xml
deleted file mode 100644
index 4018ab3b8d5d..000000000000
--- a/configmgr/workben/local_io/com.sun.star.office.Setup.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<com.sun.star.office.Setup>
- <Language>
- <Language_ID Type="string"><value>1033</value></Language_ID>
- </Language>
- <Modules>
- <SCalc Type="boolean">
- <value>true</value>
- </SCalc>
- <SChart Type="boolean">
- <value>true</value>
- </SChart>
- <SDraw Type="boolean">
- <value>true</value>
- </SDraw>
- <SImage Type="boolean">
- <value>true</value>
- </SImage>
- <SImpress Type="boolean">
- <value>true</value>
- </SImpress>
- <SMath Type="boolean">
- <value>true</value>
- </SMath>
- <SWriter Type="boolean">
- <value>true</value>
- </SWriter>
- </Modules>
-</com.sun.star.office.Setup> \ No newline at end of file
diff --git a/configmgr/workben/local_io/filetest.cxx b/configmgr/workben/local_io/filetest.cxx
deleted file mode 100644
index 0a8038e3ae29..000000000000
--- a/configmgr/workben/local_io/filetest.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-#include <iostream>
-#include<osl/file.hxx>
-
-#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-// -----------------------------------------------------------------------------
-// --------------------------------- namespaces ---------------------------------
-// -----------------------------------------------------------------------------
-using namespace com::sun::star::uno;
-
-using ::rtl::OUString;
-using ::osl::File;
-// -----------------------------------------------------------------------------
-// ---------------------------------- defines ----------------------------------
-// -----------------------------------------------------------------------------
-#define ASCII(x) OUString::createFromAscii(x)
-
-
-// -----------------------------------------------------------------------------
-// ------------------------------------ main ------------------------------------
-// -----------------------------------------------------------------------------
-
-/*
-OUString operator+(const OUString &a, const OUString &b)
-{
- OUString c = a;
- c += b;
- return c;
-}
-*/
-
-#if (defined UNX) || (defined OS2)
-int main( int argc, char * argv[] )
-#else
-int _cdecl main( int argc, char * argv[] )
-#endif
-{
- OUString aPath = ASCII("f:/local/SRC598/configmgr/workben/local_io");
- OUString aFilename = ASCII("com.sun.star.office.Setup");
- OUString aExtension = ASCII("xml");
-
- OUString aFullname = aPath + ASCII("/") + aFilename + ASCII(".") + aExtension;
-
- // Filename convertieren
- OUString aURL;
- File aConvert(ASCII(""));
- aConvert.normalizePath(aFullname, aURL);
-
- // File oeffnen
- File aFile(aURL);
- aFile.open(osl_File_OpenFlag_Read);
-
- sal_uInt64 nBytesRead;
- Sequence< sal_Int8 > aBufferSeq(2000);
- sal_Int8 *pBuff = aBufferSeq.getArray();
- aFile.read(pBuff, 2000, nBytesRead);
-
- aFile.close();
- return 0;
-}
diff --git a/configmgr/workben/local_io/makefile.mk b/configmgr/workben/local_io/makefile.mk
deleted file mode 100644
index 4e3e2f7d2f40..000000000000
--- a/configmgr/workben/local_io/makefile.mk
+++ /dev/null
@@ -1,110 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-PRJINC=$(PRJ)$/source
-
-PRJNAME=configmgr
-
-TARGET=cfgfile
-TARGETTYPE=CUI
-LIBTARGET=NO
-
-ENABLE_EXCEPTIONS=TRUE
-
-# --- Settings -----------------------------------------------------
-.INCLUDE : settings.mk
-
-# --- Files --------------------------------------------------------
-
-# ... common for all test executables ..............................
-APPSTDLIBS=\
- $(SALLIB) \
- $(VOSLIB) \
- $(CPPULIB) \
- $(UNOTOOLSLIB) \
- $(CPPUHELPERLIB) \
-
-
-# ... FileTests .....................................................
-APP1STDLIBS = $(APPSTDLIBS) \
- $(STDLIBCPP) \
-
-APP1STDLIBS+=$(STDLIBCPP)
-
-APP1TARGET= $(TARGET)
-
-APP1OBJS= \
- $(SLO)$/cfgfile.obj \
- $(SLO)$/oslstream.obj \
- $(SLO)$/filehelper.obj \
- $(SLO)$/simpletest.obj \
- $(SLO)$/strimpl.obj \
- $(SLO)$/confname.obj \
-
-# $(SLO)$/xmlexport.obj \
-# $(SLO)$/xmlimport.obj \
-
-# $(SLO)$/xmltreebuilder.obj \
-# $(SLO)$/cmtree.obj \
-# $(SLO)$/cmtreemodel.obj \
-# $(SLO)$/typeconverter.obj \
-# $(SLO)$/changes.obj \
-# $(SLO)$/xmlformater.obj \
-# $(SLO)$/attributes.obj \
-# $(SLO)$/tracer.obj \
-
-
-# ... common for all test executables ..............................
-# APP2STDLIBS = $(APPSTDLIBS)
-#
-# APP2STDLIBS+=$(STDLIBCPP)
-#
-# APP2TARGET= cfglocal
-# APP2OBJS= \
-# $(SLO)$/cfglocal.obj \
-# $(SLO)$/receivethread.obj \
-# $(SLO)$/redirector.obj \
-# $(SLO)$/socketstream.obj \
-# $(SLO)$/attributes.obj \
-# $(SLO)$/localsession.obj \
-# $(SLO)$/saxtools.obj \
-# $(SLO)$/mergeupdates.obj \
-# $(SLO)$/oslstream.obj \
-# $(SLO)$/configsession.obj \
-# $(SLO)$/confname.obj \
-# $(SLO)$/sessionstream.obj \
-# $(SLO)$/filehelper.obj \
-# $(SLO)$/tracer.obj \
-# $(SLO)$/updatedom.obj \
-# $(SLO)$/strconverter.obj \
-# $(SLO)$/strimpl.obj \
-#
-
-.INCLUDE : target.mk
-
-
diff --git a/configmgr/workben/local_io/org.openoffice.test.xml b/configmgr/workben/local_io/org.openoffice.test.xml
deleted file mode 100644
index ff8e37be411c..000000000000
--- a/configmgr/workben/local_io/org.openoffice.test.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-
-<org.openoffice.test
-xmlns="http://openoffice.org/2000/registry/components/org.openoffice.Inet"
-xmlns:cfg="http://openoffice.org/2000/registry/instance"
-xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xml:lang="en-US">
-
-<!-- long -->
- <Long cfg:type="long">100000000000000</Long>
- <LongList cfg:type="long" cfg:derivedBy="list">1 2 3
-
- 4 5
-
-
-
-
- 6 7 8 9</LongList>
- <LongList2 cfg:type="long" cfg:derivedBy="list" cfg:separator=".">1.2.3.4.5.6.7.8.9</LongList2>
-
-<!-- double -->
- <DoubleWithDot cfg:type="double">.787564</DoubleWithDot>
- <EuroDM cfg:type="double">1.95583</EuroDM>
- <ZeroDotZeroZeroOne cfg:type="double">0.001</ZeroDotZeroZeroOne>
- <ZeroDotOne cfg:type="double">0.1</ZeroDotOne>
- <NZeroDotOne cfg:type="double">-0.1</NZeroDotOne>
-
-<!-- binary -->
- <Binary cfg:type="binary" cfg:nullable="true" xsi:null="true"/>
- <Binary2 cfg:type="binary" xsi:null="true"/>
- <Binary3 cfg:type="binary" >010203040506070809</Binary3>
- <Binary4 cfg:type="binary" cfg:nullable="true">000102030405060708090a</Binary4>
-
-<!-- Strings -->
- <NullString cfg:type="string" xsi:null="true"/>
- <String cfg:type="string">Identifier</String>
- <StringList cfg:type="string" cfg:derivedBy="list">file:/ private:explorer private:help private:newmenu private:schedule private:searchfolder private:user</StringList>
- <List cfg:type="string" cfg:derivedBy="list">NULL</List>
- <PathAutoCorrect cfg:type="string" cfg:separator=":" cfg:derivedBy="list">$(inst)/share/autocorr:$(user)/autocorr</PathAutoCorrect>
- <List2 cfg:type="string" cfg:derivedBy="list" cfg:separator="stupid" >NULLstupidFIRSTstupidSECONDstupid</List2>
- <SeparatorKiller cfg:type="string" cfg:derivedBy="list" cfg:separator="." > .,.;.:.#.|.a._.!.$.%./.(.)=.?.+.*.#.~.'.\.{.}._</SeparatorKiller>
-
-<!-- localized -->
- <LocaleString cfg:type="string" cfg:localized="true">
- <cfg:value xml:lang="en-US">This is a string</cfg:value>
- <cfg:value xml:lang="de-DE">Dies ist ein String</cfg:value>
- </LocaleString>
-
-<!-- boolean -->
- <BoolFalse cfg:type="boolean">false</BoolFalse>
- <BoolTrue cfg:type="boolean">true</BoolTrue>
- <BoolList cfg:type="boolean" cfg:derivedBy="list">true true false</BoolList>
- <BoolNULL cfg:type="boolean" xsi:null="true"/>
-
-<!-- int -->
- <Integer cfg:type="int">3</Integer>
- <IntegerNullWithXsi cfg:type="int" xsi:null="true">10</IntegerNullWithXsi>
- <IntegerNull cfg:type="int"/>
-
- <IntList cfg:type="int" cfg:derivedBy="list">1 2 3 4 5 6 7 8 224 226 222 223 5</IntList>
-
-<!-- short -->
- <Short cfg:type="short">100</Short>
-
- <Inner>
- <Inner2>
- <IntList cfg:type="int" cfg:derivedBy="list">224 226 222 223 5</IntList>
- </Inner2>
- </Inner>
-
-</org.openoffice.test>
diff --git a/configmgr/workben/local_io/simpletest.cxx b/configmgr/workben/local_io/simpletest.cxx
deleted file mode 100644
index ffe4741d7d2c..000000000000
--- a/configmgr/workben/local_io/simpletest.cxx
+++ /dev/null
@@ -1,758 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include <memory>
-#include <vector>
-#include <stack>
-#include<osl/file.hxx>
-
-#include <rtl/ustring.hxx>
-#include <rtl/string.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/servicefactory.hxx>
-
-#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_
-#include <com/sun/star/lang/XComponent.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HDL_
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HDL_
-#include <com/sun/star/io/XActiveDataSink.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HDL_
-#include <com/sun/star/io/XActiveDataControl.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XDATATRANSFEREVENTLISTENER_HDL_
-#include <com/sun/star/io/XDataTransferEventListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XDATAIMPORTER_HDL_
-#include <com/sun/star/io/XDataImporter.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HDL_
-#include <com/sun/star/io/XInputStream.hpp>
-#endif
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/SAXParseException.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <vos/thread.hxx>
-
-#include <vos/pipe.hxx>
-#include <osl/diagnose.h>
-#include "oslstream.hxx"
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XHierarchicalName.hpp>
-
-#include <com/sun/star/container/XNameReplace.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <osl/conditn.hxx>
-
-#include "xmltreebuilder.hxx"
-
-#include "dataimport.hxx"
-
-#include "createpropertyvalue.hxx"
-#include "strdecl.hxx"
-
-#include "confname.hxx"
-
-#include "FileHelper.hxx"
-
-// -----------------------------------------------------------------------------
-// --------------------------------- namespaces ---------------------------------
-// -----------------------------------------------------------------------------
-namespace uno = com::sun::star::uno;
-namespace lang = com::sun::star::lang;
-namespace io = com::sun::star::io;
-namespace sax = com::sun::star::xml::sax;
-namespace script = com::sun::star::script;
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
-using namespace ::com::sun::star::xml::sax;
-using namespace ::com::sun::star::io;
-using namespace rtl;
-using namespace osl;
-
-// -----------------------------------------------------------------------------
-// ---------------------------------- defines ----------------------------------
-// -----------------------------------------------------------------------------
-#ifndef ASCII
-#define ASCII(x) OUString::createFromAscii(x)
-#endif
-
-ostream& operator << (ostream& out, rtl::OUString const& aStr)
-{
- sal_Unicode const* const pStr = aStr.getStr();
- sal_Unicode const* const pEnd = pStr + aStr.getLength();
- for (sal_Unicode const* p = pStr; p < pEnd; ++p)
- if (0 < *p && *p < 127) // ASCII
- out << char(*p);
- else
- out << "[\\u" << hex << *p << "]";
- return out;
-}
-
-
-// -----------------------------------------------------------------------------
-// ---------------------------------- a Class ----------------------------------
-// -----------------------------------------------------------------------------
-// <Name a="xyz" b="bar">
-
-//==========================================================================
-//= Visitors
-//==========================================================================
-
-
-namespace configmgr
-{
-
- class XMLSimpleDocHandler : public ::cppu::WeakImplHelper1<sax::XDocumentHandler>
- {
- // uno::Reference< sax::XDocumentHandler > m_xWriter; // the service object for writing XML code
-
- sal_Int32 m_nElementDepth;
- sal_Int32 m_nIgnoreLevel;
- public:
- XMLSimpleDocHandler::XMLSimpleDocHandler()
- {}
-
-
- // DECLARE_UNO3_DEFAULTS(XMLReadFilter, CmDocumentHandler_BASE);
-
- // XDocumentHandler
- virtual void SAL_CALL startDocument(void)
- throw (sax::SAXException, uno::RuntimeException)
- {
- }
-
- virtual void SAL_CALL endDocument(void)
- throw(sax::SAXException, uno::RuntimeException)
- {
- }
-
- virtual void SAL_CALL startElement(const rtl::OUString& aName,
- const uno::Reference< sax::XAttributeList > &_xAttrList)
- throw(sax::SAXException, uno::RuntimeException)
- {
- sal_Int16 nAttrCount = _xAttrList.is() ? _xAttrList->getLength() : 0;
- for( sal_Int16 i=0; i < nAttrCount; i++ )
- {
- OUString aParamName( _xAttrList->getNameByIndex( i ) );
- OUString aParamValue( _xAttrList->getValueByIndex( i ) );
- volatile int dummy = 0;
- }
- }
-
- virtual void SAL_CALL endElement(const rtl::OUString& aName)
- throw(sax::SAXException, uno::RuntimeException)
- {
- }
-
- virtual void SAL_CALL characters(const rtl::OUString& aChars)
- throw(sax::SAXException, uno::RuntimeException)
- {}
-
-
- virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces)
- throw(sax::SAXException, uno::RuntimeException)
- {}
-
-
- virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget,
- const rtl::OUString& aData)
- throw(sax::SAXException, uno::RuntimeException)
- {}
-
- virtual void SAL_CALL setDocumentLocator(const uno::Reference< sax::XLocator > &xLocator)
- throw(sax::SAXException, uno::RuntimeException)
- {}
- };
-
-// -----------------------------------------------------------------------------
-// ------------------------------------ Test ------------------------------------
-// -----------------------------------------------------------------------------
-#define ASCII_STRING(rtlOUString) rtl::OUStringToOString(rtlOUString, RTL_TEXTENCODING_ASCII_US).getStr()
- static ::rtl::OUString sRegistry = ::rtl::OUString::createFromAscii("applicat.rdb");
-
- void simpleTest()
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF;
- try
- {
- xMSF = cppu::createRegistryServiceFactory(sRegistry, ::rtl::OUString());
- }
- catch (uno::Exception& e)
- {
- cout << "could not bootstrap the services from " << ASCII_STRING(sRegistry) << endl ;
- cout << " (error message : " << ASCII_STRING(e.Message) << ")" << endl;
- }
-
- if (!xMSF.is())
- {
- cerr << "could not create the service factory !" << endl;
- return;
- }
-
- OUString aPath = ASCII("e:/temp/Test");
- OUString aFilename = ASCII("calc");
- OUString aExtension = ASCII("xml");
-
- OUString aFullname = aPath + ASCII("/") + aFilename + ASCII(".") + aExtension;
-
- // Filename convertieren
- OUString aURL;
- File aConvert(ASCII(""));
- aConvert.normalizePath(aFullname, aURL);
-
- // File oeffnen
- File aFile(aURL);
- aFile.open(osl_File_OpenFlag_Read);
-
- uno::Reference<io::XInputStream> xInputStream =
- new configmgr::OSLInputStreamWrapper(aFile);
-
- // connect stream to input stream to the parser
- InputSource aInputSource;
- Reference<XInputStream> xPipeInput( xInputStream, UNO_QUERY );
- aInputSource.aInputStream = xPipeInput;
-
- Reference< sax::XParser > xParser;
- xParser = Reference< sax::XParser > (
- xMSF->createInstance(
- ::rtl::OUString::createFromAscii("com.sun.star.xml.sax.Parser")), UNO_QUERY);
-
- XMLSimpleDocHandler *pTest = new XMLSimpleDocHandler();
-
- // get filter
- Reference<XDocumentHandler> xFilter = pTest;
-
- // connect parser and filter
- xParser->setDocumentHandler( xFilter );
-
- // parse
- sal_Int16 nRet = 0;
- OUString sError;
- try
- {
- xParser->parseStream( aInputSource );
- }
- catch( SAXParseException &e )
- {
- OUString sLine = OUString::valueOf(e.LineNumber);
- OUString aStr = ASCII("SAXParseException occured in ");
- sError = aStr + ASCII(" Line: (") + sLine + ASCII(")");
-
- OSL_ENSURE(0, rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US).getStr());
- nRet = 3;
- }
- catch( SAXException &e )
- {
- sError = e.Message;
- OSL_ENSURE(0, rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US).getStr());
- nRet = 4;
- }
- catch( IOException &e )
- {
- sError = e.Message;
- OSL_ENSURE(0, rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US).getStr());
- nRet = 5;
- }
- }
-
-
-#include <osl/time.h>
-#include <rtl/string.hxx>
-
-class TimeTest
-{
- TimeValue m_aStartTime, m_aEndTime;
- bool m_bStarted;
-public:
- TimeTest()
- :m_bStarted(false)
- {
- }
-
- void start()
- {
- m_bStarted = true;
- osl_getSystemTime(&m_aStartTime);
- }
- void stop()
- {
- osl_getSystemTime(&m_aEndTime);
- OSL_ENSURE(m_bStarted, "Not Started.");
- m_bStarted = false;
- }
- void showTime(const rtl::OString & aWhatStr)
- {
- OSL_ENSURE(!m_bStarted, "Not Stopped.");
-
- sal_Int32 nSeconds = m_aEndTime.Seconds - m_aStartTime.Seconds;
- sal_Int32 nNanoSec = m_aEndTime.Nanosec - m_aStartTime.Nanosec;
- if (nNanoSec < 0)
- {
- nNanoSec = 1000000000 - nNanoSec;
- nSeconds++;
- }
- rtl::OString aStr = "Time for ";
- aStr += aWhatStr;
- aStr += " : ";
- aStr += rtl::OString::valueOf(nSeconds);
- aStr += ".";
- aStr += rtl::OString::valueOf(nNanoSec);
-
- cout << aStr.getStr() << endl;
- }
-
-};
-
-// -----------------------------------------------------------------------------
-// -------------------------------- Mapping Test --------------------------------
-// -----------------------------------------------------------------------------
-// Simple Map created with a stl::vector
-
-typedef ::std::pair< rtl::OUString, rtl::OUString > Assoc;
-// typedef ::std::set<Assoc, ltNode> MappingTable;
-typedef std::vector<Assoc> MappingTable;
-
-rtl::OUString mapTo(const rtl::OUString& aFrom, bool bToNew)
-{
- static MappingTable aMap;
- if (aMap.empty())
- {
- // Fill Map old, new
-
- aMap.push_back(Assoc(ASCII("value"), TAG_VALUE));
- aMap.push_back(Assoc(ASCII("type"), ATTR_TYPE));
- aMap.push_back(Assoc(ASCII("instance"), ATTR_INSTANCE));
- }
- if (bToNew)
- {
- // check, if we should convert first to second
- for (std::vector<Assoc>::const_iterator it = aMap.begin();it != aMap.end();++it)
- {
- if ((*it).first.equals(aFrom))
- return (*it).second;
- }
- }
- else
- {
- // check if we should convert second to first
- for (std::vector<Assoc>::const_iterator it = aMap.begin();it != aMap.end();++it)
- {
- if ((*it).second.equals(aFrom))
- return (*it).first;
- }
- }
-
- // do nothing!
- return aFrom;
-}
-// -----------------------------------------------------------------------------
-void simpleMappingTest()
-{
- OUString aValue = ASCII("value");
- OUString aNew;
-
- aNew = mapTo(aValue, true); // true for ToNew
- aNew = mapTo(aNew, false);
- aNew = mapTo(aNew, false);
-
- volatile int dummy = 0;
-}
-
-// -----------------------------------------------------------------------------
- void speedTest()
- {
- // check speed of:
- // ASCII("value")
- // TAG_VALUE
- // ...
-
- sal_Int32 nCount = 1000 * 1000 * 100;
- sal_Int32 n;
-
- cout << "Starting Timetest" << endl;
- TimeTest tt;
- tt.start();
- for(n=0;n<nCount;n++)
- {
- }
- tt.stop();
- tt.showTime("Leere Schleife: ");
-
-
- nCount = 1000 * 1000 * 5;
- rtl::OUString aStr;
-
- tt.start();
- for(n=0;n<nCount;n++)
- {
- aStr = ASCII("value");
- }
- tt.stop();
- tt.showTime("ASCII() ");
-
-
- OUString aValue = ASCII("value");
- tt.start();
- for(n=0;n<nCount;n++)
- {
- aStr = TAG_VALUE;
- }
- tt.stop();
- tt.showTime("TAG_VALUE: ");
-
- }
-
-OUString changeToComSunStarPath(const OUString &aPath)
-{
- static OUString aOO = ASCII("org.OpenOffice");
- static OUString aCSS = ASCII("com.sun.star");
- OUString aNewPath;
-
- // compare
- if (aPath.compareTo( aOO, aOO.getLength() ) == 0)
- {
- aNewPath = aCSS;
- aNewPath += aPath.copy(aOO.getLength());
- return aNewPath;
- }
- return aPath;
-}
-
-void stringTest2()
-{
- OUString aPath = ASCII("org.OpenOffice.Setup/blah/blub");
-
- OUString aNewPath = changeToComSunStarPath(aPath);
- volatile int dummy = 0;
-}
-
-/*
-
-class A
-{
-public:
- static void run() {
- cout << "This is A::run();" << endl;
- }
-
-};
-
-class B : public A
-{
-public:
-
- static void run() {
- cout << "This is B::run();" << endl;
- }
-};
-
-void classTest()
-{
- A a;
- B b;
- B::run();
-}
-*/
-
-// -----------------------------------------------------------------------------
-// ------------------------------------ Map ------------------------------------
-// -----------------------------------------------------------------------------
-struct ltstr
-{
- bool operator()(const rtl::OUString &s1, const rtl::OUString &s2) const
- {
- return s1.compareTo(s2) < 0 ? true : false;
- }
-};
-
-void stringTest()
-{
- map<const OUString, int, ltstr> months;
-
- months[ASCII("january")] = 31;
- months[ASCII("february")] = 28;
- months[ASCII("march")] = 31;
- months[ASCII("april")] = 30;
- months[ASCII("may")] = 31;
- months[ASCII("june")] = 30;
- months[ASCII("july")] = 31;
- months[ASCII("august")] = 31;
- months[ASCII("september")] = 30;
- months[ASCII("october")] = 31;
- months[ASCII("november")] = 30;
- months[ASCII("december")] = 31;
-
- cout << "june -> " << months[ASCII("june")] << endl;
- map<const OUString, int, ltstr>::iterator cur = months.find(ASCII("april"));
- // map<const OUString, int, ltstr>::iterator prev = cur;
- map<const OUString, int, ltstr>::iterator next = cur;
- // ++next;
- // --prev;
- // cout << "Previous (in alphabetical order) is " << (*prev).first << endl;
- for(int i=0;i<12;i++)
- {
- cout << "Next (in alphabetical order) is " << (*next).first << " days " << (*next).second << endl;
- ++next;
- }
-}
-
-// -----------------------------------------------------------------------------
-// ---------------------------------- HashMap ----------------------------------
-// -----------------------------------------------------------------------------
-#include <hash_map>
-
-
-namespace test {
-
-struct eqstr
-{
- bool operator()(const rtl::OUString &s1, const rtl::OUString &s2) const
- {
- return s1.equals(s2) == sal_True ? true : false;
- }
-};
-
-struct hash_oustring
-{
- // This hash funktion is a copy of hash<char*> from SGI-STL
- size_t operator()(const rtl::OUString &_s) const
- {
- sal_Int64 nStrLen = _s.getLength();
- const sal_Unicode *pStr = _s.getStr();
- unsigned long h = 0;
- for (sal_Int64 i=0;i<nStrLen; ++i)
- h = 5*h + *pStr++;
-
- return size_t(h);
- }
-};
-
-void hash_test()
-{
- hash_map<const rtl::OUString, rtl::OUString, hash_oustring, eqstr> months;
-
- rtl::OUString sJanuary = ASCII("january");
- months[sJanuary] = ASCII("31");
- months[ASCII("february")] = ASCII("28");
- months[ASCII("march")] = ASCII("31");
- months[ASCII("april")] = ASCII("30");
- months[ASCII("may")] = ASCII("31");
- months[ASCII("june")] = ASCII("30");
- months[ASCII("july")] = ASCII("31");
- months[ASCII("august")] = ASCII("31");
- months[ASCII("september")] = ASCII("30");
- months[ASCII("october")] = ASCII("31");
- months[ASCII("november")] = ASCII("30");
- months[ASCII("december")] = ASCII("31");
-
- cout << "september -> " << months[ASCII("september")] << endl;
- cout << "april -> " << months[ASCII("april")] << endl;
- cout << "june -> " << months[ASCII("june")] << endl;
- cout << "november -> " << months[ASCII("november")] << endl;
-}
-}
-
-
-// -----------------------------------------------------------------------------
-// Fri Nov 10 15:10:45 2000
-// -----------------------------------------------------------------------------
-
-#include <vos/ref.hxx>
-
-class Options : public vos::OReference
-{
- int m_aValue;
-public:
- int getValue() {return m_aValue;}
- void setValue(int _aValue) {m_aValue = _aValue;}
-
-
-};
-
-class A
-{
- vos::ORef<Options> m_aOptions;
-public:
-
- vos::ORef<Options> getOptions() {return m_aOptions;}
- void setOptions(vos::ORef<Options>& _aOptions) {
- m_aOptions = _aOptions;
- }
-};
-
-void testRefs()
-{
- vos::ORef<Options> aO = new Options;
- aO->setValue(10);
-
- A a,b;
- a.setOptions(aO);
- b.setOptions(aO);
- cout << "Options from a : " << a.getOptions()->getValue() << endl;
- cout << "Options from b : " << b.getOptions()->getValue() << endl;
-
- aO->setValue(20);
- cout << "Options from a : " << a.getOptions()->getValue() << endl;
- cout << "Options from b : " << b.getOptions()->getValue() << endl;
-}
-
-
-
-void ConfigName()
-{
- // OUString aSubtreePath = ASCII("/org.openoffice.office.common/path/blah/blub");
- OUString aSubtreePath = ASCII("/org.openoffice.office.common");
- ConfigurationName aName(aSubtreePath);
- OUString a = aName.localName();
- OUString b = aName.fullName();
- OUString c = aName.moduleName();
- ConfigurationName aParentName(aName.getParentName());
- OUString d = aParentName.fullName();
-
-
- {
- ConfigurationName aName( ASCII("/" ));
-
- std::stack< rtl::OUString, std::vector<rtl::OUString> > m_aStringStack;
-
- if (aName.localName().getLength() != 0)
- {
- for (ConfigurationName::Iterator it = aName.begin();
- it != aName.end();
- ++it)
- {
- rtl::OUString aName = *it;
- m_aStringStack.push(aName);
- // m_xHandler->startElement(*it, rList);
- volatile int dummy = 0;
- }
- }
-
- // bBack = writeChanges();
-
- while(!m_aStringStack.empty())
- {
- OUString aName = m_aStringStack.top();
- m_aStringStack.pop();
- }
- }
-}
-
-void ConfigName2()
-{
- OUString aSubtreePath = ASCII("/org.openoffice.office.common/path/blah/blub");
- ConfigurationName aName(aSubtreePath);
- ConfigurationName aParent = aName.getParentName();
-
- for (ConfigurationName::Iterator it = aName.begin();
- it != aName.end();
- ++it)
- {
- rtl::OUString aName = *it;
- volatile int dummy = 0;
- }
-}
-
-// -----------------------------------------------------------------------------
-inline void operator <<= (rtl::OUString& _rUnicodeString, const sal_Char* _pAsciiString)
-{
- _rUnicodeString = ::rtl::OUString::createFromAscii(_pAsciiString);
-}
-
-inline void operator <<= (rtl::OUString& _rUnicodeString, const rtl::OString& _rAsciiString)
-{
- _rUnicodeString <<= _rAsciiString.getStr();
-}
-
-inline void operator <<= (rtl::OString& _rAsciiString, const rtl::OUString& _rUnicodeString)
-{
- _rAsciiString = rtl::OUStringToOString(_rUnicodeString,RTL_TEXTENCODING_ASCII_US);
-}
-
-// -----------------------------------------------------------------------------
-bool isBTimeGreaterATime(TimeValue const& A, TimeValue const& B)
-{
- if (B.Seconds > A.Seconds) return true;
- if (B.Nanosec > A.Nanosec) return true;
-
- // lower or equal
- return false;
-}
-
-// -----------------------------------------------------------------------------
-
-void oslTest()
-{
-
- OUString aDirectory(FileHelper::convertFilenameToFileURL(ASCII("c:/temp/file.out.1")));
- TimeValue a = FileHelper::getFileModificationStamp(aDirectory);
-
- OUString aDirectory2(FileHelper::convertFilenameToFileURL(ASCII("c:/temp/file.out.2")));
- TimeValue b = FileHelper::getFileModificationStamp(aDirectory2);
-
- if (isBTimeGreaterATime(a,b))
- {
- OSL_ENSURE(false, "FileB ist neuer als FileA");
- }
-
-
-/*
- OUString aDirectory(FileHelper::convertFilenameToFileURL(ASCII("c:/temp/dies")));
- osl::FileBase::RC eError = osl::Directory::create(aDirectory);
- if (eError != osl::FileBase::E_None)
- {
- OUString aUStr = FileHelper::createOSLErrorString(eError);
- OString aStr;
- aStr <<= aUStr;
- OSL_ENSURE(false, aStr.getStr());
- }
-*/
-}
-
-} // namespace configmgr
diff --git a/configmgr/workben/local_io/xmlexport.cxx b/configmgr/workben/local_io/xmlexport.cxx
deleted file mode 100644
index 3312f6ffb1ff..000000000000
--- a/configmgr/workben/local_io/xmlexport.cxx
+++ /dev/null
@@ -1,236 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include<iostream>
-#include<osl/file.hxx>
-
-#include <rtl/ustring.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/servicefactory.hxx>
-/*
-#include <cppuhelper/implbase1.hxx>
-*/
-#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_
-#include <com/sun/star/lang/XComponent.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XDATATRANSFEREVENTLISTENER_HDL_
-#include <com/sun/star/io/XDataTransferEventListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XDATAIMPORTER_HDL_
-#include <com/sun/star/io/XDataExporter.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HDL_
-#include <com/sun/star/io/XOutputStream.hpp>
-#endif
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#include <com/sun/star/xml/sax/SAXParseException.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-#include <osl/diagnose.h>
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-
-#include "oslstream.hxx"
-#include "attributes.hxx"
-#include "typeconverter.hxx"
-#include "xmlformater.hxx"
-#include "filehelper.hxx"
-
-
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-
-#include "createpropertyvalue.hxx"
-// -----------------------------------------------------------------------------
-// --------------------------------- namespaces ---------------------------------
-// -----------------------------------------------------------------------------
-namespace configmgr
-{
-
- namespace uno = com::sun::star::uno;
- namespace lang = com::sun::star::lang;
- namespace io = com::sun::star::io;
- namespace sax = com::sun::star::xml::sax;
- namespace beans = com::sun::star::beans;
-
- using ::rtl::OUString;
- using ::osl::File;
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::container;
-
-// -----------------------------------------------------------------------------
-// ---------------------------------- defines ----------------------------------
-// -----------------------------------------------------------------------------
-#define ASCII(x) OUString::createFromAscii(x)
-
-// -----------------------------------------------------------------------------
- class Listener : public ::cppu::WeakImplHelper1<io::XDataTransferEventListener>
- {
- virtual void SAL_CALL disposing( const lang::EventObject& Source )
- throw(::com::sun::star::uno::RuntimeException)
- {
- OSL_ENSURE(0, "disposing");
- }
-
-
- virtual void SAL_CALL finished( const io::DataTransferEvent& aEvent )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "finished");
- }
-
- virtual void SAL_CALL cancelled( const io::DataTransferEvent& aEvent )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "cancelled");
- }
- };
-
- class Component: public ::cppu::WeakImplHelper1<lang::XComponent>
- {
- virtual void SAL_CALL dispose( )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "dispose");
-
- }
- virtual void SAL_CALL addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "addEventListener");
- }
- virtual void SAL_CALL removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "removeEventListener");
- }
- };
-
-
-
-
-
-#define ASCII_STRING(rtlOUString) rtl::OUStringToOString(rtlOUString, RTL_TEXTENCODING_ASCII_US).getStr()
- static ::rtl::OUString sRegistry = ::rtl::OUString::createFromAscii("applicat.rdb");
-
-
-
-
-
-
-
-
-// -----------------------------------------------------------------------------
-
-// -----------------------------------------------------------------------------
- void exportTest()
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF;
- try
- {
- xMSF = cppu::createRegistryServiceFactory(sRegistry, ::rtl::OUString());
- }
- catch (uno::Exception& e)
- {
- cout << "could not bootstrap the services from " << ASCII_STRING(sRegistry) << endl ;
- cout << " (error message : " << ASCII_STRING(e.Message) << ")" << endl;
- }
-
- if (!xMSF.is())
- {
- cerr << "could not create the service factory !" << endl;
- return;
- }
-
- OUString aPath = ASCII("l:/SRC601/configmgr/workben/local_io");
- OUString sFilename = ASCII("exported_config");
- OUString aExtension = ASCII("xml");
-
- OUString aFullname = aPath + ASCII("/") + sFilename + ASCII(".") + aExtension;
-
- // Filename convertieren
- OUString aURL;
- File aConvert(ASCII(""));
- aConvert.normalizePath(aFullname, aURL);
-
- FileHelper::tryToRemoveFile(aURL);
-
- rtl::OUString sError;
-
- // File oeffnen
- File aFile(aURL);
- osl::FileBase::RC eError = aFile.open(OpenFlag_Write | OpenFlag_Create);
-
- if (eError != osl_File_E_None)
- {
- sError = ASCII("XMLExportTest:");
- rtl::OString aStr = rtl::OUStringToOString(sError,RTL_TEXTENCODING_ASCII_US);
- OSL_ENSURE(0, aStr.getStr());
- return;
- }
-
- // create an outputstream
- uno::Reference<io::XOutputStream> xOutputStream = new configmgr::OSLOutputStreamWrapper(aFile);
-
- // Listener & Component
- uno::Reference<io::XDataTransferEventListener> rListener = new Listener();
- uno::Reference<lang::XComponent> rComponent = new Component();
-
-
- OUString sPath = ASCII("com.sun.star.ucb.Hierarchy");
-
- // Create a TypeConverter
- uno::Reference<script::XTypeConverter> aConverter;
- aConverter = aConverter.query(xMSF->createInstance(ASCII( "com.sun.star.script.Converter" )) );
-
- // prepare parameters for DataExport
- Sequence< uno::Any > aArgs(4);
- aArgs[0] <<= createPropertyValue(ASCII("PackageName"), sFilename);
- aArgs[1] <<= createPropertyValue(ASCII("Path"), sPath); // multiple occur possible
- aArgs[2] <<= createPropertyValue(ASCII("TypeConverter"), aConverter); // optional
- aArgs[3] <<= createPropertyValue(ASCII("Path"), ASCII("com.sun.star.office.Setup")); // multiple occur possible
-
- // important: createInstanceWithArguments will throw an IllegalArgumentException() if
- // parameters are wrong...
- Reference< XInterface > xDataExport = xMSF->createInstanceWithArguments(
- OUString::createFromAscii("com.sun.star.configuration.DataExport"),
- aArgs);
-
- uno::Reference<io::XDataExporter> rExporter(xDataExport, UNO_QUERY);
-
- // Export Data
- rExporter->exportData(xOutputStream, rComponent, rListener);
- }
-
-} // namespace configmgr
diff --git a/configmgr/workben/local_io/xmlimport.cxx b/configmgr/workben/local_io/xmlimport.cxx
deleted file mode 100644
index e1d2a6ebb823..000000000000
--- a/configmgr/workben/local_io/xmlimport.cxx
+++ /dev/null
@@ -1,469 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_configmgr.hxx"
-
-#include <memory>
-#include <vector>
-#include <stack>
-#include<osl/file.hxx>
-
-#include <rtl/ustring.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/servicefactory.hxx>
-
-#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HDL_
-#include <com/sun/star/lang/XComponent.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASOURCE_HDL_
-#include <com/sun/star/io/XActiveDataSource.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HDL_
-#include <com/sun/star/io/XActiveDataSink.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XACTIVEDATACONTROL_HDL_
-#include <com/sun/star/io/XActiveDataControl.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XDATATRANSFEREVENTLISTENER_HDL_
-#include <com/sun/star/io/XDataTransferEventListener.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XDATAIMPORTER_HDL_
-#include <com/sun/star/io/XDataImporter.hpp>
-#endif
-
-#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HDL_
-#include <com/sun/star/io/XInputStream.hpp>
-#endif
-#include <com/sun/star/xml/sax/XParser.hpp>
-#include <com/sun/star/xml/sax/SAXParseException.hpp>
-#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
-
-#include <com/sun/star/xml/sax/InputSource.hpp>
-#include <vos/thread.hxx>
-
-#include <vos/pipe.hxx>
-#include <osl/diagnose.h>
-#include "oslstream.hxx"
-#include <com/sun/star/xml/sax/XAttributeList.hpp>
-
-#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XHierarchicalName.hpp>
-
-#include <com/sun/star/container/XNameReplace.hpp>
-#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/script/XTypeConverter.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <osl/conditn.hxx>
-
-#include "xmltreebuilder.hxx"
-
-#include "dataimport.hxx"
-
-#include "createpropertyvalue.hxx"
-// -----------------------------------------------------------------------------
-// --------------------------------- namespaces ---------------------------------
-// -----------------------------------------------------------------------------
-namespace uno = com::sun::star::uno;
-namespace lang = com::sun::star::lang;
-namespace io = com::sun::star::io;
-namespace sax = com::sun::star::xml::sax;
-namespace script = com::sun::star::script;
-
-using ::rtl::OUString;
-using ::osl::File;
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::container;
-using namespace ::com::sun::star::util;
-
-// -----------------------------------------------------------------------------
-// ---------------------------------- defines ----------------------------------
-// -----------------------------------------------------------------------------
-#ifndef ASCII
-#define ASCII(x) OUString::createFromAscii(x)
-#endif
-
-
-// -----------------------------------------------------------------------------
-// ---------------------------------- a Class ----------------------------------
-// -----------------------------------------------------------------------------
-// <Name a="xyz" b="bar">
-
-//==========================================================================
-//= Visitors
-//==========================================================================
-
-
-// -----------------------------------------------------------------------------
-class Listener : public ::cppu::WeakImplHelper1<io::XDataTransferEventListener>
-{
- osl::Condition m_aCondition;
-public:
- Listener()
- {
- m_aCondition.reset(); // will block
- }
-
- virtual void SAL_CALL disposing( const lang::EventObject& Source )
- throw(::com::sun::star::uno::RuntimeException)
- {
- OSL_ENSURE(0, "disposing");
- m_aCondition.set(); // will not block
- }
-
- virtual void SAL_CALL finished( const io::DataTransferEvent& aEvent )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "finished");
- m_aCondition.set(); // will not block
- }
-
- virtual void SAL_CALL cancelled( const io::DataTransferEvent& aEvent )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "cancelled");
- m_aCondition.set(); // will not block
- }
-public:
- void wait()
- {
- m_aCondition.wait();
- }
-};
-
-class Component: public ::cppu::WeakImplHelper1<lang::XComponent>
-{
- virtual void SAL_CALL dispose( )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "dispose");
-
- }
- virtual void SAL_CALL addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "addEventListener");
- }
- virtual void SAL_CALL removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
- throw(uno::RuntimeException)
- {
- OSL_ENSURE(0, "removeEventListener");
- }
-};
-
-
-
-namespace configmgr
-{
-
-// -----------------------------------------------------------------------------
-// ------------------------------------ Test ------------------------------------
-// -----------------------------------------------------------------------------
-#define ASCII_STRING(rtlOUString) rtl::OUStringToOString(rtlOUString, RTL_TEXTENCODING_ASCII_US).getStr()
- static ::rtl::OUString sRegistry = ::rtl::OUString::createFromAscii("applicat.rdb");
-
- void importTest()
- {
- uno::Reference< lang::XMultiServiceFactory > xMSF;
- try
- {
- xMSF = cppu::createRegistryServiceFactory(sRegistry, ::rtl::OUString());
- }
- catch (uno::Exception& e)
- {
- cout << "could not bootstrap the services from " << ASCII_STRING(sRegistry) << endl ;
- cout << " (error message : " << ASCII_STRING(e.Message) << ")" << endl;
- }
-
- if (!xMSF.is())
- {
- cerr << "could not create the service factory !" << endl;
- return;
- }
-
- OUString aPath = ASCII("l:/SRC601/configmgr/workben/local_io");
- OUString aFilename = ASCII("hierarchy");
- OUString aExtension = ASCII("xml");
-
- OUString aFullname = aPath + ASCII("/") + aFilename + ASCII(".") + aExtension;
-
- // Filename convertieren
- OUString aURL;
- File aConvert(ASCII(""));
- aConvert.normalizePath(aFullname, aURL);
-
- // File oeffnen
- File aFile(aURL);
- aFile.open(osl_File_OpenFlag_Read);
-
- // sal_uInt64 nBytesRead;
- // uno::Sequence< sal_Int8 > aBufferSeq(2000);
- // sal_Int8 *pBuff = aBufferSeq.getArray();
- // aFile.read(pBuff, 2000, nBytesRead);
- //
- // aFile.close();
-
- uno::Reference<io::XInputStream> xInputStream = new configmgr::OSLInputStreamWrapper(aFile);
-
- uno::Reference <uno::XInterface> xPump = xMSF->createInstance( L"com.sun.star.io.Pump" );
- OSL_ENSURE(xPump.is(), "there is no pump");
-
- uno::Reference<io::XActiveDataSink> xPumpSink(xPump, uno::UNO_QUERY);
- xPumpSink->setInputStream(xInputStream);
-
- uno::Reference<io::XActiveDataSource> xPumpSource(xPump, uno::UNO_QUERY);
-
- Listener *pListener = new Listener();
- uno::Reference<io::XDataTransferEventListener> rListener = pListener;
- uno::Reference<lang::XComponent> rComponent = new Component();
-
- // Create a TypeConverter
- uno::Reference<script::XTypeConverter> aConverter;
- aConverter = aConverter.query(xMSF->createInstance(ASCII( "com.sun.star.script.Converter" )) );
-
- Sequence< uno::Any > aArgs(1); // optional arg.
- aArgs[0] <<= configmgr::createPropertyValue(ASCII("TypeConverter"), aConverter);
-
- Reference< XInterface > xDataImport = xMSF->createInstanceWithArguments(
- OUString::createFromAscii("com.sun.star.configuration.DataImport"),
- aArgs);
-
- if (xDataImport.is())
- {
- uno::Reference<io::XDataImporter> rImporter(xDataImport, UNO_QUERY);
-
- // Import Data
- rImporter->importData(xPumpSource, rComponent, rListener);
-
- // lets pump
- uno::Reference<io::XActiveDataControl> xControl(xPump, uno::UNO_QUERY);
- xControl->start();
-
- // TEST:
- // rImporter->cancel();
-
- // pImporter->wait();
- // Wait until the listener send ready
- pListener->wait();
- }
- return;
- }
-
-// -----------------------------------------------------------------------------
-// -------------------------------- Import Test --------------------------------
-// -----------------------------------------------------------------------------
-
- // ----------- TEST ReadAccess -----------
- void showSequence(const Sequence<OUString> &aSeq);
-
-void hierarchyTest()
-{
-
- uno::Reference< lang::XMultiServiceFactory > xMSF;
- try
- {
- xMSF = cppu::createRegistryServiceFactory(sRegistry, ::rtl::OUString());
- }
- catch (uno::Exception& e)
- {
- cout << "could not bootstrap the services from " << ASCII_STRING(sRegistry) << endl ;
- cout << " (error message : " << ASCII_STRING(e.Message) << ")" << endl;
- }
-
- if (!xMSF.is())
- {
- cerr << "could not create the service factory !" << endl;
- return;
- }
-
-
- Reference< XMultiServiceFactory > xCfgProvider( xMSF->createInstance(
- ::rtl::OUString::createFromAscii("com.sun.star.configuration.ConfigurationProvider")),
- UNO_QUERY);
-
- if (!xCfgProvider.is())
- {
- OSL_ENSURE(0, "No Configuration Provider");
- }
-
- OUString sPath = ASCII("com.sun.star.ucb.Hierarchy");
-
- Sequence< Any > aArgs(1);
- aArgs[0] <<= sPath;
-
- Reference< XInterface > xCfgUpdt = xCfgProvider->createInstanceWithArguments(
- OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"),
- aArgs);
-
- Reference< XNameAccess > xNameAccess(xCfgUpdt, UNO_QUERY);
-
- // which Names are exist?
- showSequence(xNameAccess->getElementNames());
-
- OUString aNamePath = ASCII("Root");
- if (xNameAccess->hasByName(aNamePath))
- {
- Any aAny;
- aAny = xNameAccess->getByName(aNamePath);
- TypeClass aTypeClass = aAny.getValueTypeClass();
- if (aAny.getValueTypeClass() == TypeClass_INTERFACE)
- {
- Reference< XInterface > xInterface;
- aAny >>= xInterface;
- Reference< XNameAccess > xNameAccess2(xInterface, UNO_QUERY);
- if (xNameAccess.is())
- {
- Sequence<OUString> aSeq = xNameAccess2->getElementNames();
- showSequence(aSeq);
-
- // insert a new set
-/*
- Reference<XHierarchicalName> xHierarchical(xNameAccess, UNO_QUERY);
- OUString aHierachicalName = xHierarchical->getHierarchicalName();
-
- Sequence< Any > aArgs(2);
- aArgs[0] <<= aHierachicalName;
- sal_Int32 nLevels=1;
- aArgs[1] <<= nLevels;
-
- Reference< XInterface > xCfgNewUpdt = xCfgProvider->createInstanceWithArguments(
- OUString::createFromAscii("com.sun.star.configuration.ConfigurationUpdateAccess"),
- aArgs);
-*/
- Reference< lang::XSingleServiceFactory > xChildFactory(xNameAccess2, UNO_QUERY);
- if (xChildFactory.is())
- {
- Reference< XInterface > xChild = xChildFactory->createInstance();
- if (xChild.is())
- {
- Reference<XNameAccess> xObjectOnTheMedow(xChild, UNO_QUERY);
-
-
-
-
- // which Names are exist?
- showSequence(xObjectOnTheMedow->getElementNames());
-
- OUString aChildren = ASCII("Children");
- if (xObjectOnTheMedow->hasByName(aChildren))
- {
- Any aAny;
- aAny = xObjectOnTheMedow->getByName(aChildren);
- TypeClass aTypeClass = aAny.getValueTypeClass();
- if (aAny.getValueTypeClass() == TypeClass_INTERFACE)
- {
- Reference< XInterface > xInterface;
- aAny >>= xInterface;
- Reference< XNameAccess > xChildFromOOM(xInterface, UNO_QUERY);
-
- if (xChildFromOOM.is())
- {
- // insert a new Object in the new Object
-
- Reference< lang::XSingleServiceFactory > xChildFactory(xChildFromOOM, UNO_QUERY);
- if (xChildFactory.is())
- {
- Reference< XInterface > xChild = xChildFactory->createInstance();
- if (xChild.is())
- {
- Reference<XNameContainer> xNameContainer(xChildFromOOM, UNO_QUERY);
- if (xNameContainer.is())
- {
- xNameContainer->insertByName(ASCII("Test2"), makeAny(xChild));
- }
- }
- }
- }
- }
- }
-
-
- Reference<XNameContainer> xNameContainer(xNameAccess2, UNO_QUERY);
- if (xNameContainer.is())
- {
- xNameContainer->insertByName(ASCII("Test"), makeAny(xObjectOnTheMedow));
- }
- }
-
- // commit changes
- Reference< XChangesBatch > xChangesBatch(xCfgUpdt, UNO_QUERY);
- if (xChangesBatch.is())
- {
- xChangesBatch->commitChanges();
- }
- }
-
- Sequence<OUString> aSeq2 = xNameAccess2->getElementNames();
- showSequence(aSeq2);
-
-/*
- OUString *pStr = aSeq.getArray();
- for (int i=0;i<aSeq.getLength();i++)
- {
- OUString aStr = pStr[i];
- Any aAny;
- aAny = xNameAccess->getByName(aStr);
- TypeClass aTypeClass = aAny.getValueTypeClass();
-
- Reference< XNameReplace > xNameReplace(xNameAccess, UNO_QUERY);
-
- Any aNewAny;
- sal_Bool bValue = false;
- aNewAny <<= bValue;
- xNameReplace->replaceByName(aStr, aNewAny);
-
- volatile int dummy = 0;
- }
-*/
- }
- }
- volatile int dummy = 0;
- }
-}
-
-// ------------------------------ Helperfunctions ------------------------------
-
- void showSequence(const Sequence<OUString> &aSeq)
- {
- OUString aArray;
- const OUString *pStr = aSeq.getConstArray();
- for (int i=0;i<aSeq.getLength();i++)
- {
- OUString aStr = pStr[i];
- aArray += aStr + ASCII(", ");
- }
- volatile int dummy = 0;
- }
-
-} // namespace configmgr