1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DriverPropertyInfo.cxx,v $
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 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_connectivity.hxx"
33 #include "java/sql/DriverPropertyInfo.hxx"
34 #include "java/lang/Boolean.hxx"
35 #include "java/tools.hxx"
36 #include "java/lang/String.hxx"
37 using namespace connectivity
;
38 using namespace ::com::sun::star::uno
;
39 using namespace ::com::sun::star::beans
;
40 // using namespace ::com::sun::star::sdbcx;
41 using namespace ::com::sun::star::sdbc
;
42 using namespace ::com::sun::star::container
;
43 using namespace ::com::sun::star::lang
;
46 //**************************************************************
47 //************ Class: java.sql.Driver
48 //**************************************************************
50 jclass
java_sql_DriverPropertyInfo::theClass
= 0;
51 // --------------------------------------------------------------------------------
52 java_sql_DriverPropertyInfo::~java_sql_DriverPropertyInfo()
54 // --------------------------------------------------------------------------------
55 jclass
java_sql_DriverPropertyInfo::getMyClass() const
57 // die Klasse muss nur einmal geholt werden, daher statisch
59 theClass
= findMyClass("java/sql/DriverPropertyInfo");
63 // --------------------------------------------------------------------------------
64 java_sql_DriverPropertyInfo::operator starsdbc::DriverPropertyInfo()
66 starsdbc::DriverPropertyInfo aInfo
;
68 aInfo
.Description
= description();
69 aInfo
.IsRequired
= required();
70 aInfo
.Value
= value();
71 aInfo
.Choices
= choices();
75 // --------------------------------------------------------------------------------
76 ::rtl::OUString
java_sql_DriverPropertyInfo::name()
79 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
82 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"name","Ljava/lang/String;");
84 aStr
= JavaString2String(t
.pEnv
,(jstring
)t
.pEnv
->GetObjectField( object
, id
));
88 // --------------------------------------------------------------------------------
89 ::rtl::OUString
java_sql_DriverPropertyInfo::description()
92 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
95 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"description","Ljava/lang/String;");
97 aStr
= JavaString2String(t
.pEnv
,(jstring
)t
.pEnv
->GetObjectField( object
, id
));
101 // --------------------------------------------------------------------------------
102 ::rtl::OUString
java_sql_DriverPropertyInfo::value()
104 ::rtl::OUString aStr
;
105 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
108 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"value","Ljava/lang/String;");
110 aStr
= JavaString2String(t
.pEnv
,(jstring
)t
.pEnv
->GetObjectField( object
, id
));
114 // --------------------------------------------------------------------------------
115 sal_Bool
java_sql_DriverPropertyInfo::required()
118 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
121 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"required","Z");
123 out
= t
.pEnv
->GetBooleanField( object
, id
);
127 // --------------------------------------------------------------------------------
128 Sequence
< ::rtl::OUString
> java_sql_DriverPropertyInfo::choices()
130 SDBThreadAttach t
; OSL_ENSURE(t
.pEnv
,"Java Enviroment geloescht worden!");
133 jfieldID id
= t
.pEnv
->GetFieldID(getMyClass(),"choices","[Ljava/lang/String;");
136 const java_lang_String
* pEmpty
= NULL
;
137 const ::rtl::OUString
* pEmpty2
= NULL
;
138 return copyArrayAndDelete(t
.pEnv
,(jobjectArray
)t
.pEnv
->GetObjectField( object
, id
), pEmpty2
, pEmpty
);
141 return Sequence
< ::rtl::OUString
>();
143 // --------------------------------------------------------------------------------