Update ooo320-m1
[ooovba.git] / jvmfwk / source / fwkutil.hxx
blobcabae659ab5cc40b4c9784764cd542d2bd172e8b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fwkutil.hxx,v $
10 * $Revision: 1.17 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #if !defined INCLUDED_JVMFWK_FWKUTIL_HXX
31 #define INCLUDED_JVMFWK_FWKUTIL_HXX
33 #include "sal/config.h"
34 #include "osl/mutex.hxx"
35 #include "rtl/bootstrap.hxx"
36 #include "rtl/instance.hxx"
37 #include "rtl/ustrbuf.hxx"
38 #include "rtl/byteseq.hxx"
39 #include "osl/thread.hxx"
40 #if OSL_DEBUG_LEVEL >=2
41 #include <stdio.h>
42 #endif
45 namespace jfw
48 /** Returns the file URL of the directory where the framework library
49 (this library) resides.
51 rtl::OUString getLibraryLocation();
53 /** provides a bootstrap class which already knows the values from the
54 jvmfkwrc file.
56 struct Bootstrap :
57 public ::rtl::StaticWithInit< const rtl::Bootstrap *, Bootstrap > {
58 const rtl::Bootstrap * operator () () {
59 ::rtl::OUStringBuffer buf(256);
60 buf.append(getLibraryLocation());
61 buf.appendAscii(SAL_CONFIGFILE("/jvmfwk3"));
62 ::rtl::OUString sIni = buf.makeStringAndClear();
63 ::rtl::Bootstrap * bootstrap = new ::rtl::Bootstrap(sIni);
64 #if OSL_DEBUG_LEVEL >=2
65 rtl::OString o = rtl::OUStringToOString( sIni , osl_getThreadTextEncoding() );
66 fprintf(stderr, "[Java framework] Using configuration file %s\n" , o.getStr() );
67 #endif
68 return bootstrap;
72 struct FwkMutex: public ::rtl::Static<osl::Mutex, FwkMutex> {};
74 //osl::Mutex * getFwkMutex();
76 rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData);
77 rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data);
79 rtl::OUString getPlatform();
81 //const rtl::Bootstrap& getBootstrap();
84 rtl::OUString getDirFromFile(const rtl::OUString& usFilePath);
86 /** Returns the file URL of the folder where the executable resides.
88 rtl::OUString getExecutableDirectory();
89 /** Locates the plugin library and returns the file URL.
91 First tries to locate plugin relative to baseUrl (if relative);
92 vnd.sun.star.expand URLs are supported. If that fails, tries to
93 locate plugin relative to the executable. If that fails, and plugin
94 contains no slashes, tries to locate plugin in a platform-specific way
95 (e.g., LD_LIBRARY_PATH).
97 @param baseUrl
98 The base file URL relative to which the plugin argument is interpreted.
100 @param plugin
101 The argument is an absolute or relative URL or just the name of the plugin.
103 rtl::OUString findPlugin(
104 const rtl::OUString & baseUrl, const rtl::OUString & plugin);
107 enum FileStatus
109 FILE_OK,
110 FILE_DOES_NOT_EXIST,
111 FILE_INVALID
114 /** checks if the URL is a file.
116 If it is a link to a file than
117 it is resolved. Assuming that the argument
118 represents a relative URL then FILE_INVALID
119 is returned.
122 @return
123 one of the values of FileStatus.
125 @exception
126 Errors occured during determining if the file exists
128 FileStatus checkFileURL(const rtl::OUString & path);
131 struct PluginLibrary;
132 class VersionInfo;
133 class CJavaInfo;
135 bool isAccessibilitySupportDesired();
137 rtl::OUString buildClassPathFromDirectory(const rtl::OUString & relPath);
139 rtl::OUString retrieveClassPath( ::rtl::OUString const & macro );
141 #endif