Kaydet (Commit) 6b849a6a authored tarafından sb's avatar sb

#i101955# initial work in progress of a configmgr reimplementation (for now in…

#i101955# initial work in progress of a configmgr reimplementation (for now in an extra module "configmgr2")
üst 07f98faf
#*************************************************************************
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2009 by Sun Microsystems, Inc.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# $RCSfile: makefile,v $
#
# $Revision: 1.4 $
#
# 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 = ..
PRJNAME = configmgr
TARGET = inc
ENABLE_EXCEPTIONS = TRUE
VISIBILITY_HIDDEN = TRUE
.INCLUDE: settings.mk
.INCLUDE: target.mk
.IF "$(ENABLE_PCH)" != ""
ALLTAR: $(SLO)$/precompiled.pch $(SLO)$/precompiled_ex.pch
.ENDIF
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#include "precompiled_configmgr.hxx"
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#if defined PRECOMPILED_HEADERS
#include "sal/config.h"
#endif
cg configmgr : NULL
cg configmgr\inc nmake - all cg_inc NULL
cg configmgr\source nmake - all cg_source cg_inc NULL
..\%__SRC%\bin\configmgr2.uno.dll %_DEST%\bin%_EXT%\configmgr2.uno.dll
..\%__SRC%\lib\configmgr2.uno.dylib %_DEST%\bin%_EXT%\configmgr2.uno.dylib
..\%__SRC%\lib\configmgr2.uno.so %_DEST%\bin%_EXT%\configmgr2.uno.so
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#ifndef INCLUDED_CONFIGMGR_COMPONENTS_HXX
#define INCLUDED_CONFIGMGR_COMPONENTS_HXX
#include "sal/config.h"
#include "boost/noncopyable.hpp"
#include "nodemap.hxx"
namespace rtl { class OUString; }
namespace configmgr {
class Node;
class Components: private boost::noncopyable {
public:
static Components & singleton();
Node * resolvePath(Node * base, rtl::OUString const & path);
private:
Components();
~Components();
NodeMap templates_;
NodeMap components_;
};
}
#endif
This diff is collapsed.
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#ifndef INCLUDED_CONFIGMGR_CONFIGURATIONPROVIDER_HXX
#define INCLUDED_CONFIGMGR_CONFIGURATIONPROVIDER_HXX
#include "sal/config.h"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/factory.hxx"
#include "rtl/unload.h"
namespace com { namespace sun { namespace star {
namespace lang { class XSingleComponentFactory; }
namespace uno {
class XComponentContext;
class XInterface;
}
} } }
namespace rtl { class OUString; }
namespace configmgr { namespace configuration_provider {
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > createDefault(
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
const & context);
rtl::OUString SAL_CALL getImplementationName();
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames();
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
SAL_CALL createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(());
} }
#endif
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#include "precompiled_configmgr.hxx"
#include "sal/config.h"
#include "boost/noncopyable.hpp"
#include "com/sun/star/lang/XSingleComponentFactory.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/weak.hxx"
#include "sal/types.h"
#include "rtl/unload.h"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "configurationprovider.hxx"
#include "lock.hxx"
namespace configmgr { namespace default_provider {
namespace {
namespace css = com::sun::star;
class Factory:
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
private boost::noncopyable
{
public:
Factory() {}
private:
virtual ~Factory() {}
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstanceWithContext(
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
};
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
{
return createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any >(), Context);
}
css::uno::Reference< css::uno::XInterface >
Factory::createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
{
if (Arguments.getLength() != 0) {
throw css::uno::Exception(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.DefaultProvider must be"
" instantiated without arguments")),
static_cast< cppu::OWeakObject * >(this));
}
osl::MutexGuard guard(lock);
static css::uno::Reference< css::uno::XInterface > singleton(
configuration_provider::createDefault(Context));
return singleton;
}
}
rtl::OUString getImplementationName() {
return rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.comp.configuration.DefaultProvider"));
}
com::sun::star::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
rtl::OUString name(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.DefaultProvider"));
return css::uno::Sequence< rtl::OUString >(&name, 1);
}
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
SAL_CALL createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(())
{
return new Factory;
}
} }
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#ifndef INCLUDED_CONFIGMGR_DEFAULTPROVIDER_HXX
#define INCLUDED_CONFIGMGR_DEFAULTPROVIDER_HXX
#include "sal/config.h"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/factory.hxx"
#include "rtl/unload.h"
namespace com { namespace sun { namespace star { namespace lang {
class XSingleComponentFactory;
} } } }
namespace rtl { class OUString; }
namespace configmgr { namespace default_provider {
rtl::OUString SAL_CALL getImplementationName();
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames();
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
SAL_CALL createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(());
} }
#endif
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#include "precompiled_configmgr.hxx"
#include "sal/config.h"
#include <memory>
#include "rtl/ustring.hxx"
#include "groupnode.hxx"
#include "node.hxx"
#include "nodemap.hxx"
namespace configmgr {
GroupNode::GroupNode(rtl::OUString const & name, bool extensible):
name_(name), extensible_(extensible) {}
GroupNode::~GroupNode() {}
GroupNode * GroupNode::clone() const {
return new GroupNode(*this);
}
Node * GroupNode::clone(rtl::OUString const & name) const {
std::auto_ptr< GroupNode > p(clone());
p->name_ = name;
return p.release();
}
rtl::OUString GroupNode::getName() {
return name_;
}
Node * GroupNode::getMember(rtl::OUString const & name) {
NodeMap::iterator i(members_.find(name));
return i == members_.end() ? 0 : i->second;
}
bool GroupNode::isExtensible() const {
return extensible_;
}
NodeMap & GroupNode::getMembers() {
return members_;
}
}
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#ifndef INCLUDED_CONFIGMGR_GROUPNODE_HXX
#define INCLUDED_CONFIGMGR_GROUPNODE_HXX
#include "sal/config.h"
#include "rtl/ustring.hxx"
#include "node.hxx"
#include "nodemap.hxx"
namespace configmgr {
class GroupNode: public Node {
public:
GroupNode(rtl::OUString const & name, bool extensible);
virtual ~GroupNode();
virtual GroupNode * clone() const;
virtual Node * clone(rtl::OUString const & name) const;
virtual rtl::OUString getName();
virtual Node * getMember(rtl::OUString const & name);
bool isExtensible() const;
NodeMap & getMembers();
private:
rtl::OUString name_;
bool extensible_;
NodeMap members_;
};
}
#endif
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: code,v $
*
* $Revision: 1.4 $
*
* 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.
************************************************************************/
#include "precompiled_configmgr.hxx"
#include "sal/config.h"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "osl/diagnose.h"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "localizedpropertynode.hxx"
#include "localizedvalues.hxx"
#include "node.hxx"
#include "type.hxx"
namespace configmgr {
namespace {
namespace css = com::sun::star;
}
LocalizedPropertyNode::LocalizedPropertyNode(
rtl::OUString const & name, Type type, bool nillable,
LocalizedValues const & values):
name_(name), type_(type), nillable_(nillable), values_(values) {}
LocalizedPropertyNode::~LocalizedPropertyNode() {}
Node * LocalizedPropertyNode::clone() const {
return new LocalizedPropertyNode(*this);
}
Node * LocalizedPropertyNode::clone(rtl::OUString const &) const {
OSL_ASSERT(false);
throw css::uno::RuntimeException(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("this cannot happen")),
0);
}
rtl::OUString LocalizedPropertyNode::getName() {
return name_;
}
Node * LocalizedPropertyNode::getMember(rtl::OUString const &) {
return 0; //TODO
}
Type LocalizedPropertyNode::getType() const {
return type_;
}
bool LocalizedPropertyNode::isNillable() const {
return nillable_;
}
LocalizedValues & LocalizedPropertyNode::getValues() {
return values_;
}
void LocalizedPropertyNode::setValues(LocalizedValues const & values) {
values_ = values;
}
css::uno::Any LocalizedPropertyNode::getValue(rtl::OUString const & locale)
const
{
//TODO
LocalizedValues::const_iterator i(values_.find(locale));
if (i != values_.end()) {
return i->second;
}
i = values_.find(rtl::OUString());
if (i != values_.end()) {
return i->second;
}
i = values_.find(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US")));
if (i != values_.end()) {
return i->second;
}
i = values_.begin();
if (i != values_.end()) {
return i->second;
}
return css::uno::Any();
}
}
/*************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2009 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite