1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "java/sql/DriverPropertyInfo.hxx"
30 #include "java/lang/Boolean.hxx"
31 #include "java/tools.hxx"
32 #include "java/lang/String.hxx"
34 using namespace connectivity
;
35 using namespace ::com::sun::star::uno
;
36 using namespace ::com::sun::star::beans
;
37 using namespace ::com::sun::star::sdbc
;
38 using namespace ::com::sun::star::container
;
39 using namespace ::com::sun::star::lang
;
42 //**************************************************************
43 //************ Class: java.sql.Driver
44 //**************************************************************
46 jclass
java_sql_DriverPropertyInfo::theClass
= 0;
47 // --------------------------------------------------------------------------------
48 java_sql_DriverPropertyInfo::~java_sql_DriverPropertyInfo()
50 // --------------------------------------------------------------------------------
51 jclass
java_sql_DriverPropertyInfo::getMyClass() const
53 // the class must be fetched only once, therefore static
55 theClass
= findMyClass("java/sql/DriverPropertyInfo");
59 // --------------------------------------------------------------------------------
60 java_sql_DriverPropertyInfo::operator starsdbc::DriverPropertyInfo()
62 starsdbc::DriverPropertyInfo aInfo
;
64 aInfo
.Description
= description();
65 aInfo
.IsRequired
= required();
66 aInfo
.Value
= value();
67 aInfo
.Choices
= choices();
71 // --------------------------------------------------------------------------------
72 ::rtl::OUString
java_sql_DriverPropertyInfo::name()
75 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
78 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"name","Ljava/lang/String;");
80 aStr
= JavaString2String(t
.pEnv
,(jstring
)t
.pEnv
->GetObjectField( object
, id
));
84 // --------------------------------------------------------------------------------
85 ::rtl::OUString
java_sql_DriverPropertyInfo::description()
88 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
91 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"description","Ljava/lang/String;");
93 aStr
= JavaString2String(t
.pEnv
,(jstring
)t
.pEnv
->GetObjectField( object
, id
));
97 // --------------------------------------------------------------------------------
98 ::rtl::OUString
java_sql_DriverPropertyInfo::value()
100 ::rtl::OUString aStr
;
101 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
104 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"value","Ljava/lang/String;");
106 aStr
= JavaString2String(t
.pEnv
,(jstring
)t
.pEnv
->GetObjectField( object
, id
));
110 // --------------------------------------------------------------------------------
111 sal_Bool
java_sql_DriverPropertyInfo::required()
114 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
117 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"required","Z");
119 out
= t
.pEnv
->GetBooleanField( object
, id
);
123 // --------------------------------------------------------------------------------
124 Sequence
< ::rtl::OUString
> java_sql_DriverPropertyInfo::choices()
126 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
129 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"choices","[Ljava/lang/String;");
132 const java_lang_String
* pEmpty
= NULL
;
133 const ::rtl::OUString
* pEmpty2
= NULL
;
134 return copyArrayAndDelete(t
.pEnv
,(jobjectArray
)t
.pEnv
->GetObjectField( object
, id
), pEmpty2
, pEmpty
);
137 return Sequence
< ::rtl::OUString
>();
139 // --------------------------------------------------------------------------------
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */