|
|
|
|
1 |
|
/**
|
|
1 |
|
/**
|
|
|
|
|
2 |
|
* Licens
ed to the
Apache Sof
tware Foun
dation (AS
F) under o
ne or more
|
|
2 |
|
* Licens
ed to the
Apache Sof
tware Foun
dation (AS
F) under o
ne or more
|
|
|
|
|
3 |
|
* contri
butor lice
nse agreem
ents. See
the NOTIC
E file dis
tributed w
ith
|
|
3 |
|
* contri
butor lice
nse agreem
ents. See
the NOTIC
E file dis
tributed w
ith
|
|
|
|
|
4 |
|
* this w
ork for ad
ditional i
nformation
regarding
copyright
ownership
.
|
|
4 |
|
* this w
ork for ad
ditional i
nformation
regarding
copyright
ownership
.
|
|
|
|
|
5 |
|
* The AS
F licenses
this file
to You un
der the Ap
ache Licen
se, Versio
n 2.0
|
|
5 |
|
* The AS
F licenses
this file
to You un
der the Ap
ache Licen
se, Versio
n 2.0
|
|
|
|
|
6 |
|
* (the "
License");
you may n
ot use thi
s file exc
ept in com
pliance wi
th
|
|
6 |
|
* (the "
License");
you may n
ot use thi
s file exc
ept in com
pliance wi
th
|
|
|
|
|
7 |
|
* the Li
cense. Yo
u may obta
in a copy
of the Lic
ense at
|
|
7 |
|
* the Li
cense. Yo
u may obta
in a copy
of the Lic
ense at
|
|
|
|
|
8 |
|
*
|
|
8 |
|
*
|
|
|
|
|
9 |
|
* htt
p://www.ap
ache.org/l
icenses/LI
CENSE-2.0
|
|
9 |
|
* htt
p://www.ap
ache.org/l
icenses/LI
CENSE-2.0
|
|
|
|
|
10 |
|
*
|
|
10 |
|
*
|
|
|
|
|
11 |
|
* Unless
required
by applica
ble law or
agreed to
in writin
g, softwar
e
|
|
11 |
|
* Unless
required
by applica
ble law or
agreed to
in writin
g, softwar
e
|
|
|
|
|
12 |
|
* distri
buted unde
r the Lice
nse is dis
tributed o
n an "AS I
S" BASIS,
|
|
12 |
|
* distri
buted unde
r the Lice
nse is dis
tributed o
n an "AS I
S" BASIS,
|
|
|
|
|
13 |
|
* WITHOU
T WARRANTI
ES OR COND
ITIONS OF
ANY KIND,
either exp
ress or im
plied.
|
|
13 |
|
* WITHOU
T WARRANTI
ES OR COND
ITIONS OF
ANY KIND,
either exp
ress or im
plied.
|
|
|
|
|
14 |
|
* See th
e License
for the sp
ecific lan
guage gove
rning perm
issions an
d
|
|
14 |
|
* See th
e License
for the sp
ecific lan
guage gove
rning perm
issions an
d
|
|
|
|
|
15 |
|
* limita
tions unde
r the Lice
nse.
|
|
15 |
|
* limita
tions unde
r the Lice
nse.
|
|
|
|
|
16 |
|
*/
|
|
16 |
|
*/
|
|
|
|
|
17 |
|
package or
g.apache.c
atalina.au
thenticato
r.jaspic;
|
|
17 |
|
package or
g.apache.c
atalina.au
thenticato
r.jaspic;
|
|
|
|
|
18 |
|
|
|
18 |
|
|
|
|
|
|
19 |
|
import jav
a.io.File;
|
|
19 |
|
import jav
a.io.File;
|
|
|
|
|
20 |
|
import jav
a.io.FileI
nputStream
;
|
|
20 |
|
import jav
a.io.FileI
nputStream
;
|
|
|
|
|
21 |
|
import jav
a.io.FileO
utputStrea
m;
|
|
21 |
|
import jav
a.io.FileO
utputStrea
m;
|
|
|
|
|
22 |
|
import jav
a.io.IOExc
eption;
|
|
22 |
|
import jav
a.io.IOExc
eption;
|
|
|
|
|
23 |
|
import jav
a.io.Input
Stream;
|
|
23 |
|
import jav
a.io.Input
Stream;
|
|
|
|
|
24 |
|
import jav
a.io.Outpu
tStream;
|
|
24 |
|
import jav
a.io.Outpu
tStream;
|
|
|
|
|
25 |
|
import jav
a.io.Outpu
tStreamWri
ter;
|
|
25 |
|
import jav
a.io.Outpu
tStreamWri
ter;
|
|
|
|
|
26 |
|
import jav
a.io.Write
r;
|
|
26 |
|
import jav
a.io.Write
r;
|
|
|
|
|
27 |
|
import jav
a.nio.char
set.Standa
rdCharsets
;
|
|
27 |
|
import jav
a.nio.char
set.Standa
rdCharsets
;
|
|
|
|
|
28 |
|
import jav
a.util.Arr
ayList;
|
|
28 |
|
import jav
a.util.Arr
ayList;
|
|
|
|
|
29 |
|
import jav
a.util.Has
hMap;
|
|
29 |
|
import jav
a.util.Has
hMap;
|
|
|
|
|
30 |
|
import jav
a.util.Lis
t;
|
|
30 |
|
import jav
a.util.Lis
t;
|
|
|
|
|
31 |
|
import jav
a.util.Map
;
|
|
31 |
|
import jav
a.util.Map
;
|
|
|
|
|
32 |
|
import jav
a.util.Map
.Entry;
|
|
32 |
|
import jav
a.util.Map
.Entry;
|
|
|
|
|
33 |
|
|
|
33 |
|
|
|
|
|
|
34 |
|
import org
.apache.ju
li.logging
.Log;
|
|
34 |
|
import org
.apache.ju
li.logging
.Log;
|
|
|
|
|
35 |
|
import org
.apache.ju
li.logging
.LogFactor
y;
|
|
35 |
|
import org
.apache.ju
li.logging
.LogFactor
y;
|
|
|
|
|
36 |
|
import org
.apache.to
mcat.util.
digester.D
igester;
|
|
36 |
|
import org
.apache.to
mcat.util.
digester.D
igester;
|
|
|
|
|
37 |
|
import org
.apache.to
mcat.util.
res.String
Manager;
|
|
37 |
|
import org
.apache.to
mcat.util.
res.String
Manager;
|
|
|
|
|
38 |
|
import org
.xml.sax.S
AXExceptio
n;
|
|
38 |
|
import org
.xml.sax.S
AXExceptio
n;
|
|
|
|
|
39 |
|
|
|
39 |
|
|
|
|
|
|
40 |
|
/**
|
|
40 |
|
/**
|
|
|
|
|
41 |
|
* Utility
class for
the loadi
ng and sav
ing of JAS
PIC persis
tent provi
der
|
|
41 |
|
* Utility
class for
the loadi
ng and sav
ing of JAS
PIC persis
tent provi
der
|
|
|
|
|
42 |
|
* registr
ations.
|
|
42 |
|
* registr
ations.
|
|
|
|
|
43 |
|
*/
|
|
43 |
|
*/
|
|
|
|
|
44 |
|
final clas
s Persiste
ntProvider
Registrati
ons {
|
|
44 |
|
final clas
s Persiste
ntProvider
Registrati
ons {
|
|
|
|
|
45 |
|
|
|
45 |
|
|
|
|
|
|
46 |
|
privat
e static f
inal Log l
og = LogFa
ctory.getL
og(Persist
entProvide
rRegistrat
ions.class
);
|
|
46 |
|
privat
e static f
inal Log l
og = LogFa
ctory.getL
og(Persist
entProvide
rRegistrat
ions.class
);
|
|
|
|
|
47 |
|
privat
e static f
inal Strin
gManager s
m =
|
|
47 |
|
privat
e static f
inal Strin
gManager s
m =
|
|
|
|
|
48 |
|
StringMa
nager.getM
anager(Per
sistentPro
viderRegis
trations.c
lass);
|
|
48 |
|
StringMa
nager.getM
anager(Per
sistentPro
viderRegis
trations.c
lass);
|
|
|
|
|
49 |
|
|
|
49 |
|
|
|
|
|
|
50 |
|
|
|
50 |
|
|
|
|
|
|
51 |
|
privat
e Persiste
ntProvider
Registrati
ons() {
|
|
51 |
|
privat
e Persiste
ntProvider
Registrati
ons() {
|
|
|
|
|
52 |
|
//
Utility c
lass. Hide
default c
onstructor
|
|
52 |
|
//
Utility c
lass. Hide
default c
onstructor
|
|
|
|
|
53 |
|
}
|
|
53 |
|
}
|
|
|
|
|
54 |
|
|
|
54 |
|
|
|
|
|
|
55 |
|
|
|
55 |
|
|
|
|
|
|
56 |
|
static
Providers
loadProvi
ders(File
configFile
) {
|
|
56 |
|
static
Providers
loadProvi
ders(File
configFile
) {
|
|
|
|
|
57 |
|
tr
y (InputSt
ream is =
new FileIn
putStream(
configFile
)) {
|
|
57 |
|
tr
y (InputSt
ream is =
new FileIn
putStream(
configFile
)) {
|
|
|
|
|
58 |
|
// Const
ruct a dig
ester to r
ead the XM
L input fi
le
|
|
58 |
|
// Const
ruct a dig
ester to r
ead the XM
L input fi
le
|
|
|
|
|
59 |
|
Digester
digester
= new Dige
ster();
|
|
59 |
|
Digester
digester
= new Dige
ster();
|
|
|
|
|
60 |
|
|
|
60 |
|
|
|
|
|
|
61 |
|
try {
|
|
61 |
|
try {
|
|
|
|
|
62 |
|
dige
ster.setFe
ature("htt
p://apache
.org/xml/f
eatures/al
low-java-e
ncodings",
true);
|
|
62 |
|
dige
ster.setFe
ature("htt
p://apache
.org/xml/f
eatures/al
low-java-e
ncodings",
true);
|
|
|
|
|
63 |
|
dige
ster.setVa
lidating(t
rue);
|
|
63 |
|
dige
ster.setVa
lidating(t
rue);
|
|
|
|
|
64 |
|
dige
ster.setNa
mespaceAwa
re(true);
|
|
64 |
|
dige
ster.setNa
mespaceAwa
re(true);
|
|
|
|
|
65 |
|
} catch
(Exception
e) {
|
|
65 |
|
} catch
(Exception
e) {
|
|
|
|
|
66 |
|
thro
w new Secu
rityExcept
ion(e);
|
|
66 |
|
thro
w new Secu
rityExcept
ion(e);
|
|
|
|
|
67 |
|
}
|
|
67 |
|
}
|
|
|
|
|
68 |
|
|
|
68 |
|
|
|
|
|
|
69 |
|
// Creat
e an objec
t to hold
the parse
results an
d put it o
n the top
|
|
69 |
|
// Creat
e an objec
t to hold
the parse
results an
d put it o
n the top
|
|
|
|
|
70 |
|
// of th
e digester
's stack
|
|
70 |
|
// of th
e digester
's stack
|
|
|
|
|
71 |
|
Provider
s result =
new Provi
ders();
|
|
71 |
|
Provider
s result =
new Provi
ders();
|
|
|
|
|
72 |
|
digester
.push(resu
lt);
|
|
72 |
|
digester
.push(resu
lt);
|
|
|
|
|
73 |
|
|
|
73 |
|
|
|
|
|
|
74 |
|
// Confi
gure the d
igester
|
|
74 |
|
// Confi
gure the d
igester
|
|
|
|
|
75 |
|
digester
.addObject
Create("ja
spic-provi
ders/provi
der", Prov
ider.class
.getName()
);
|
|
75 |
|
digester
.addObject
Create("ja
spic-provi
ders/provi
der", Prov
ider.class
.getName()
);
|
|
|
|
|
76 |
|
digester
.addSetPro
perties("j
aspic-prov
iders/prov
ider");
|
|
76 |
|
digester
.addSetPro
perties("j
aspic-prov
iders/prov
ider");
|
|
|
|
|
77 |
|
digester
.addSetNex
t("jaspic-
providers/
provider",
"addProvi
der", Prov
ider.class
.getName()
);
|
|
77 |
|
digester
.addSetNex
t("jaspic-
providers/
provider",
"addProvi
der", Prov
ider.class
.getName()
);
|
|
|
|
|
78 |
|
|
|
78 |
|
|
|
|
|
|
79 |
|
digester
.addObject
Create("ja
spic-provi
ders/provi
der/proper
ty", Prope
rty.class.
getName())
;
|
|
79 |
|
digester
.addObject
Create("ja
spic-provi
ders/provi
der/proper
ty", Prope
rty.class.
getName())
;
|
|
|
|
|
80 |
|
digester
.addSetPro
perties("j
aspic-prov
iders/prov
ider/prope
rty");
|
|
80 |
|
digester
.addSetPro
perties("j
aspic-prov
iders/prov
ider/prope
rty");
|
|
|
|
|
81 |
|
digester
.addSetNex
t("jaspic-
providers/
provider/p
roperty",
"addProper
ty", Prope
rty.class.
getName())
;
|
|
81 |
|
digester
.addSetNex
t("jaspic-
providers/
provider/p
roperty",
"addProper
ty", Prope
rty.class.
getName())
;
|
|
|
|
|
82 |
|
|
|
82 |
|
|
|
|
|
|
83 |
|
// Parse
the input
|
|
83 |
|
// Parse
the input
|
|
|
|
|
84 |
|
digester
.parse(is)
;
|
|
84 |
|
digester
.parse(is)
;
|
|
|
|
|
85 |
|
|
|
85 |
|
|
|
|
|
|
86 |
|
return r
esult;
|
|
86 |
|
return r
esult;
|
|
|
|
|
87 |
|
}
catch (IOE
xception |
SAXExcept
ion e) {
|
|
87 |
|
}
catch (IOE
xception |
SAXExcept
ion e) {
|
|
|
|
|
88 |
|
throw ne
w Security
Exception(
e);
|
|
88 |
|
throw ne
w Security
Exception(
e);
|
|
|
|
|
89 |
|
}
|
|
89 |
|
}
|
|
|
|
|
90 |
|
}
|
|
90 |
|
}
|
|
|
|
|
91 |
|
|
|
91 |
|
|
|
|
|
|
92 |
|
|
|
92 |
|
|
|
|
|
|
93 |
|
static
void writ
eProviders
(Providers
providers
, File con
figFile) {
|
|
93 |
|
static
void writ
eProviders
(Providers
providers
, File con
figFile) {
|
|
|
|
|
94 |
|
Fi
le configF
ileOld = n
ew File(co
nfigFile.g
etAbsolute
Path() + "
.old");
|
|
94 |
|
Fi
le configF
ileOld = n
ew File(co
nfigFile.g
etAbsolute
Path() + "
.old");
|
|
|
|
|
95 |
|
Fi
le configF
ileNew = n
ew File(co
nfigFile.g
etAbsolute
Path() + "
.new");
|
|
95 |
|
Fi
le configF
ileNew = n
ew File(co
nfigFile.g
etAbsolute
Path() + "
.new");
|
|
|
|
|
96 |
|
|
|
96 |
|
|
|
|
|
|
97 |
|
//
Remove le
ft over te
mporary fi
les if pre
sent
|
|
97 |
|
//
Remove le
ft over te
mporary fi
les if pre
sent
|
|
|
|
|
98 |
|
if
(configFi
leOld.exis
ts()) {
|
|
98 |
|
if
(configFi
leOld.exis
ts()) {
|
|
|
|
|
99 |
|
if (conf
igFileOld.
delete())
{
|
|
99 |
|
if (conf
igFileOld.
delete())
{
|
|
|
|
|
100 |
|
thro
w new Secu
rityExcept
ion(sm.get
String(
|
|
100 |
|
thro
w new Secu
rityExcept
ion(sm.get
String(
|
|
|
|
|
101 |
|
"persi
stentProvi
derRegistr
ations.exi
stsDeleteF
ail",
|
|
101 |
|
"persi
stentProvi
derRegistr
ations.exi
stsDeleteF
ail",
|
|
|
|
|
102 |
|
config
FileOld.ge
tAbsoluteP
ath()));
|
|
102 |
|
config
FileOld.ge
tAbsoluteP
ath()));
|
|
|
|
|
103 |
|
}
|
|
103 |
|
}
|
|
|
|
|
104 |
|
}
|
|
104 |
|
}
|
|
|
|
|
105 |
|
if
(configFi
leNew.exis
ts()) {
|
|
105 |
|
if
(configFi
leNew.exis
ts()) {
|
|
|
|
|
106 |
|
if (conf
igFileNew.
delete())
{
|
|
106 |
|
if (conf
igFileNew.
delete())
{
|
|
|
|
|
107 |
|
thro
w new Secu
rityExcept
ion(sm.get
String(
|
|
107 |
|
thro
w new Secu
rityExcept
ion(sm.get
String(
|
|
|
|
|
108 |
|
"persi
stentProvi
derRegistr
ations.exi
stsDeleteF
ail",
|
|
108 |
|
"persi
stentProvi
derRegistr
ations.exi
stsDeleteF
ail",
|
|
|
|
|
109 |
|
config
FileNew.ge
tAbsoluteP
ath()));
|
|
109 |
|
config
FileNew.ge
tAbsoluteP
ath()));
|
|
|
|
|
110 |
|
}
|
|
110 |
|
}
|
|
|
|
|
111 |
|
}
|
|
111 |
|
}
|
|
|
|
|
112 |
|
|
|
112 |
|
|
|
|
|
|
113 |
|
//
Write out
the provi
ders to th
e temporar
y new file
|
|
113 |
|
//
Write out
the provi
ders to th
e temporar
y new file
|
|
|
|
|
114 |
|
tr
y (OutputS
tream fos
= new File
OutputStre
am(configF
ileNew);
|
|
114 |
|
tr
y (OutputS
tream fos
= new File
OutputStre
am(configF
ileNew);
|
|
|
|
|
115 |
|
Writ
er writer
= new Outp
utStreamWr
iter(fos,
StandardCh
arsets.UTF
_8)) {
|
|
115 |
|
Writ
er writer
= new Outp
utStreamWr
iter(fos,
StandardCh
arsets.UTF
_8)) {
|
|
|
|
|
116 |
|
writer.w
rite(
|
|
116 |
|
writer.w
rite(
|
|
|
|
|
117 |
|
"<?xml ver
sion='1.0'
encoding=
'utf-8'?>\
n" +
|
|
117 |
|
"<?xml ver
sion='1.0'
encoding=
'utf-8'?>\
n" +
|
|
|
|
|
118 |
|
"<jaspic-p
roviders\n
" +
|
|
118 |
|
"<jaspic-p
roviders\n
" +
|
|
|
|
|
119 |
|
" xmlns
=\"http://
tomcat.apa
che.org/xm
l\"\n" +
|
|
119 |
|
" xmlns
=\"http://
tomcat.apa
che.org/xm
l\"\n" +
|
|
|
|
|
120 |
|
" xmlns
:xsi=\"htt
p://www.w3
.org/2001/
XMLSchema-
instance\"
\n" +
|
|
120 |
|
" xmlns
:xsi=\"htt
p://www.w3
.org/2001/
XMLSchema-
instance\"
\n" +
|
|
|
|
|
121 |
|
" xsi:s
chemaLocat
ion=\"http
://tomcat.
apache.org
/xml jaspi
c-provider
s.xsd\"\n"
+
|
|
121 |
|
" xsi:s
chemaLocat
ion=\"http
://tomcat.
apache.org
/xml jaspi
c-provider
s.xsd\"\n"
+
|
|
|
|
|
122 |
|
" versi
on=\"1.0\"
>\n");
|
|
122 |
|
" versi
on=\"1.0\"
>\n");
|
|
|
|
|
123 |
|
for (Pro
vider prov
ider : pro
viders.pro
viders) {
|
|
123 |
|
for (Pro
vider prov
ider : pro
viders.pro
viders) {
|
|
|
|
|
124 |
|
writ
er.write("
<provide
r classNam
e=\"");
|
|
124 |
|
writ
er.write("
<provide
r classNam
e=\"");
|
|
|
|
|
125 |
|
writ
er.write(p
rovider.ge
tClassName
());
|
|
125 |
|
writ
er.write(p
rovider.ge
tClassName
());
|
|
|
|
|
126 |
|
writ
er.write("
\" layer=\
"");
|
|
126 |
|
writ
er.write("
\" layer=\
"");
|
|
|
|
|
127 |
|
writ
er.write(p
rovider.ge
tLayer());
|
|
127 |
|
writ
er.write(p
rovider.ge
tLayer());
|
|
|
|
|
128 |
|
writ
er.write("
\" appCont
ext=\"");
|
|
128 |
|
writ
er.write("
\" appCont
ext=\"");
|
|
|
|
|
129 |
|
writ
er.write(p
rovider.ge
tAppContex
t());
|
|
129 |
|
writ
er.write(p
rovider.ge
tAppContex
t());
|
|
|
|
|
130 |
|
if (
provider.g
etDescript
ion() != n
ull) {
|
|
130 |
|
if (
provider.g
etDescript
ion() != n
ull) {
|
|
|
|
|
131 |
|
writer.wri
te("\" des
cription=\
"");
|
|
131 |
|
writer.wri
te("\" des
cription=\
"");
|
|
|
|
|
132 |
|
writer.wri
te(provide
r.getDescr
iption());
|
|
132 |
|
writer.wri
te(provide
r.getDescr
iption());
|
|
|
|
|
133 |
|
}
|
|
133 |
|
}
|
|
|
|
|
134 |
|
writ
er.write("
\">\n");
|
|
134 |
|
writ
er.write("
\">\n");
|
|
|
|
|
135 |
|
for
(Entry<Str
ing,String
> entry :
provider.g
etProperti
es().entry
Set()) {
|
|
135 |
|
for
(Entry<Str
ing,String
> entry :
provider.g
etProperti
es().entry
Set()) {
|
|
|
|
|
136 |
|
writer.wri
te(" <p
roperty na
me=\"");
|
|
136 |
|
writer.wri
te(" <p
roperty na
me=\"");
|
|
|
|
|
137 |
|
writer.wri
te(entry.g
etKey());
|
|
137 |
|
writer.wri
te(entry.g
etKey());
|
|
|
|
|
138 |
|
writer.wri
te("\" val
ue=\"");
|
|
138 |
|
writer.wri
te("\" val
ue=\"");
|
|
|
|
|
139 |
|
writer.wri
te(entry.g
etValue())
;
|
|
139 |
|
writer.wri
te(entry.g
etValue())
;
|
|
|
|
|
140 |
|
writer.wri
te("\"/>\n
");
|
|
140 |
|
writer.wri
te("\"/>\n
");
|
|
|
|
|
141 |
|
}
|
|
141 |
|
}
|
|
|
|
|
142 |
|
writ
er.write("
</provid
er>\n");
|
|
142 |
|
writ
er.write("
</provid
er>\n");
|
|
|
|
|
143 |
|
}
|
|
143 |
|
}
|
|
|
|
|
144 |
|
writer.w
rite("</ja
spic-provi
ders>\n");
|
|
144 |
|
writer.w
rite("</ja
spic-provi
ders>\n");
|
|
|
|
|
145 |
|
}
catch (IOE
xception e
) {
|
|
145 |
|
}
catch (IOE
xception e
) {
|
|
|
|
|
146 |
|
configFile
New.delete
()
;
|
|
146 |
|
if (!
configFile
New.delete
()
) {
|
|
|
|
|
|
|
|
|
147 |
|
log.
warn(sm.ge
tString("p
ersistentP
roviderReg
istrations
.deleteFai
l",
|
|
|
|
|
|
|
|
|
148 |
|
config
FileNew.ge
tAbsoluteP
ath()));
|
|
|
|
|
|
|
|
|
149 |
|
}
|
|
|
|
|
147 |
|
throw ne
w Security
Exception(
e);
|
|
150 |
|
throw ne
w Security
Exception(
e);
|
|
|
|
|
148 |
|
}
|
|
151 |
|
}
|
|
|
|
|
149 |
|
|
|
152 |
|
|
|
|
|
|
150 |
|
//
Move the
current fi
le out of
the way
|
|
153 |
|
//
Move the
current fi
le out of
the way
|
|
|
|
|
151 |
|
if
(configFi
le.isFile(
)) {
|
|
154 |
|
if
(configFi
le.isFile(
)) {
|
|
|
|
|
152 |
|
if (!con
figFile.re
nameTo(con
figFileOld
)) {
|
|
155 |
|
if (!con
figFile.re
nameTo(con
figFileOld
)) {
|
|
|
|
|
153 |
|
thro
w new Secu
rityExcept
ion(sm.get
String("pe
rsistentPr
oviderRegi
strations.
moveFail",
|
|
156 |
|
thro
w new Secu
rityExcept
ion(sm.get
String("pe
rsistentPr
oviderRegi
strations.
moveFail",
|
|
|
|
|
154 |
|
config
File.getAb
solutePath
(), config
FileOld.ge
tAbsoluteP
ath()));
|
|
157 |
|
config
File.getAb
solutePath
(), config
FileOld.ge
tAbsoluteP
ath()));
|
|
|
|
|
155 |
|
}
|
|
158 |
|
}
|
|
|
|
|
156 |
|
}
|
|
159 |
|
}
|
|
|
|
|
157 |
|
|
|
160 |
|
|
|
|
|
|
158 |
|
//
Move the
new file i
nto place
|
|
161 |
|
//
Move the
new file i
nto place
|
|
|
|
|
159 |
|
if
(!configF
ileNew.ren
ameTo(conf
igFile)) {
|
|
162 |
|
if
(!configF
ileNew.ren
ameTo(conf
igFile)) {
|
|
|
|
|
160 |
|
throw ne
w Security
Exception(
sm.getStri
ng("persis
tentProvid
erRegistra
tions.move
Fail",
|
|
163 |
|
throw ne
w Security
Exception(
sm.getStri
ng("persis
tentProvid
erRegistra
tions.move
Fail",
|
|
|
|
|
161 |
|
configFile
New.getAbs
olutePath(
), configF
ile.getAbs
olutePath(
)));
|
|
164 |
|
configFile
New.getAbs
olutePath(
), configF
ile.getAbs
olutePath(
)));
|
|
|
|
|
162 |
|
}
|
|
165 |
|
}
|
|
|
|
|
163 |
|
|
|
166 |
|
|
|
|
|
|
164 |
|
//
Remove th
e old file
|
|
167 |
|
//
Remove th
e old file
|
|
|
|
|
165 |
|
if
(configFi
leOld.exis
ts() && !c
onfigFileO
ld.delete(
)) {
|
|
168 |
|
if
(configFi
leOld.exis
ts() && !c
onfigFileO
ld.delete(
)) {
|
|
|
|
|
166 |
|
log.warn
(sm.getStr
ing("persi
stentProvi
derRegistr
ations.del
eteFail",
|
|
169 |
|
log.warn
(sm.getStr
ing("persi
stentProvi
derRegistr
ations.del
eteFail",
|
|
|
|
|
167 |
|
configFile
Old.getAbs
olutePath(
)));
|
|
170 |
|
configFile
Old.getAbs
olutePath(
)));
|
|
|
|
|
168 |
|
}
|
|
171 |
|
}
|
|
|
|
|
169 |
|
}
|
|
172 |
|
}
|
|
|
|
|
170 |
|
|
|
173 |
|
|
|
|
|
|
171 |
|
|
|
174 |
|
|
|
|
|
|
172 |
|
public
static cl
ass Provid
ers {
|
|
175 |
|
public
static cl
ass Provid
ers {
|
|
|
|
|
173 |
|
pr
ivate fina
l List<Pro
vider> pro
viders = n
ew ArrayLi
st<>();
|
|
176 |
|
pr
ivate fina
l List<Pro
vider> pro
viders = n
ew ArrayLi
st<>();
|
|
|
|
|
174 |
|
|
|
177 |
|
|
|
|
|
|
175 |
|
pu
blic void
addProvide
r(Provider
provider)
{
|
|
178 |
|
pu
blic void
addProvide
r(Provider
provider)
{
|
|
|
|
|
176 |
|
provider
s.add(prov
ider);
|
|
179 |
|
provider
s.add(prov
ider);
|
|
|
|
|
177 |
|
}
|
|
180 |
|
}
|
|
|
|
|
178 |
|
|
|
181 |
|
|
|
|
|
|
179 |
|
pu
blic List<
Provider>
getProvide
rs() {
|
|
182 |
|
pu
blic List<
Provider>
getProvide
rs() {
|
|
|
|
|
180 |
|
return p
roviders;
|
|
183 |
|
return p
roviders;
|
|
|
|
|
181 |
|
}
|
|
184 |
|
}
|
|
|
|
|
182 |
|
}
|
|
185 |
|
}
|
|
|
|
|
183 |
|
|
|
186 |
|
|
|
|
|
|
184 |
|
|
|
187 |
|
|
|
|
|
|
185 |
|
public
static cl
ass Provid
er {
|
|
188 |
|
public
static cl
ass Provid
er {
|
|
|
|
|
186 |
|
pr
ivate Stri
ng classNa
me;
|
|
189 |
|
pr
ivate Stri
ng classNa
me;
|
|
|
|
|
187 |
|
pr
ivate Stri
ng layer;
|
|
190 |
|
pr
ivate Stri
ng layer;
|
|
|
|
|
188 |
|
pr
ivate Stri
ng appCont
ext;
|
|
191 |
|
pr
ivate Stri
ng appCont
ext;
|
|
|
|
|
189 |
|
pr
ivate Stri
ng descrip
tion;
|
|
192 |
|
pr
ivate Stri
ng descrip
tion;
|
|
|
|
|
190 |
|
pr
ivate fina
l Map<Stri
ng,String>
propertie
s = new Ha
shMap<>();
|
|
193 |
|
pr
ivate fina
l Map<Stri
ng,String>
propertie
s = new Ha
shMap<>();
|
|
|
|
|
191 |
|
|
|
194 |
|
|
|
|
|
|
192 |
|
|
|
195 |
|
|
|
|
|
|
193 |
|
pu
blic Strin
g getClass
Name() {
|
|
196 |
|
pu
blic Strin
g getClass
Name() {
|
|
|
|
|
194 |
|
return c
lassName;
|
|
197 |
|
return c
lassName;
|
|
|
|
|
195 |
|
}
|
|
198 |
|
}
|
|
|
|
|
196 |
|
pu
blic void
setClassNa
me(String
className)
{
|
|
199 |
|
pu
blic void
setClassNa
me(String
className)
{
|
|
|
|
|
197 |
|
this.cla
ssName = c
lassName;
|
|
200 |
|
this.cla
ssName = c
lassName;
|
|
|
|
|
198 |
|
}
|
|
201 |
|
}
|
|
|
|
|
199 |
|
|
|
202 |
|
|
|
|
|
|
200 |
|
|
|
203 |
|
|
|
|
|
|
201 |
|
pu
blic Strin
g getLayer
() {
|
|
204 |
|
pu
blic Strin
g getLayer
() {
|
|
|
|
|
202 |
|
return l
ayer;
|
|
205 |
|
return l
ayer;
|
|
|
|
|
203 |
|
}
|
|
206 |
|
}
|
|
|
|
|
204 |
|
pu
blic void
setLayer(S
tring laye
r) {
|
|
207 |
|
pu
blic void
setLayer(S
tring laye
r) {
|
|
|
|
|
205 |
|
this.lay
er = layer
;
|
|
208 |
|
this.lay
er = layer
;
|
|
|
|
|
206 |
|
}
|
|
209 |
|
}
|
|
|
|
|
207 |
|
|
|
210 |
|
|
|
|
|
|
208 |
|
|
|
211 |
|
|
|
|
|
|
209 |
|
pu
blic Strin
g getAppCo
ntext() {
|
|
212 |
|
pu
blic Strin
g getAppCo
ntext() {
|
|
|
|
|
210 |
|
return a
ppContext;
|
|
213 |
|
return a
ppContext;
|
|
|
|
|
211 |
|
}
|
|
214 |
|
}
|
|
|
|
|
212 |
|
pu
blic void
setAppCont
ext(String
appContex
t) {
|
|
215 |
|
pu
blic void
setAppCont
ext(String
appContex
t) {
|
|
|
|
|
213 |
|
this.app
Context =
appContext
;
|
|
216 |
|
this.app
Context =
appContext
;
|
|
|
|
|
214 |
|
}
|
|
217 |
|
}
|
|
|
|
|
215 |
|
|
|
218 |
|
|
|
|
|
|
216 |
|
|
|
219 |
|
|
|
|
|
|
217 |
|
pu
blic Strin
g getDescr
iption() {
|
|
220 |
|
pu
blic Strin
g getDescr
iption() {
|
|
|
|
|
218 |
|
return d
escription
;
|
|
221 |
|
return d
escription
;
|
|
|
|
|
219 |
|
}
|
|
222 |
|
}
|
|
|
|
|
220 |
|
pu
blic void
setDescrip
tion(Strin
g descript
ion) {
|
|
223 |
|
pu
blic void
setDescrip
tion(Strin
g descript
ion) {
|
|
|
|
|
221 |
|
this.des
cription =
descripti
on;
|
|
224 |
|
this.des
cription =
descripti
on;
|
|
|
|
|
222 |
|
}
|
|
225 |
|
}
|
|
|
|
|
223 |
|
|
|
226 |
|
|
|
|
|
|
224 |
|
|
|
227 |
|
|
|
|
|
|
225 |
|
pu
blic void
addPropert
y(Property
property)
{
|
|
228 |
|
pu
blic void
addPropert
y(Property
property)
{
|
|
|
|
|
226 |
|
properti
es.put(pro
perty.getN
ame(), pro
perty.getV
alue());
|
|
229 |
|
properti
es.put(pro
perty.getN
ame(), pro
perty.getV
alue());
|
|
|
|
|
227 |
|
}
|
|
230 |
|
}
|
|
|
|
|
228 |
|
vo
id addProp
erty(Strin
g name, St
ring value
) {
|
|
231 |
|
vo
id addProp
erty(Strin
g name, St
ring value
) {
|
|
|
|
|
229 |
|
properti
es.put(nam
e, value);
|
|
232 |
|
properti
es.put(nam
e, value);
|
|
|
|
|
230 |
|
}
|
|
233 |
|
}
|
|
|
|
|
231 |
|
pu
blic Map<S
tring,Stri
ng> getPro
perties()
{
|
|
234 |
|
pu
blic Map<S
tring,Stri
ng> getPro
perties()
{
|
|
|
|
|
232 |
|
return p
roperties;
|
|
235 |
|
return p
roperties;
|
|
|
|
|
233 |
|
}
|
|
236 |
|
}
|
|
|
|
|
234 |
|
}
|
|
237 |
|
}
|
|
|
|
|
235 |
|
|
|
238 |
|
|
|
|
|
|
236 |
|
|
|
239 |
|
|
|
|
|
|
237 |
|
public
static cl
ass Proper
ty {
|
|
240 |
|
public
static cl
ass Proper
ty {
|
|
|
|
|
238 |
|
pr
ivate Stri
ng name;
|
|
241 |
|
pr
ivate Stri
ng name;
|
|
|
|
|
239 |
|
pr
ivate Stri
ng value;
|
|
242 |
|
pr
ivate Stri
ng value;
|
|
|
|
|
240 |
|
|
|
243 |
|
|
|
|
|
|
241 |
|
|
|
244 |
|
|
|
|
|
|
242 |
|
pu
blic Strin
g getName(
) {
|
|
245 |
|
pu
blic Strin
g getName(
) {
|
|
|
|
|
243 |
|
return n
ame;
|
|
246 |
|
return n
ame;
|
|
|
|
|
244 |
|
}
|
|
247 |
|
}
|
|
|
|
|
245 |
|
pu
blic void
setName(St
ring name)
{
|
|
248 |
|
pu
blic void
setName(St
ring name)
{
|
|
|
|
|
246 |
|
this.nam
e = name;
|
|
249 |
|
this.nam
e = name;
|
|
|
|
|
247 |
|
}
|
|
250 |
|
}
|
|
|
|
|
248 |
|
|
|
251 |
|
|
|
|
|
|
249 |
|
|
|
252 |
|
|
|
|
|
|
250 |
|
pu
blic Strin
g getValue
() {
|
|
253 |
|
pu
blic Strin
g getValue
() {
|
|
|
|
|
251 |
|
return v
alue;
|
|
254 |
|
return v
alue;
|
|
|
|
|
252 |
|
}
|
|
255 |
|
}
|
|
|
|
|
253 |
|
pu
blic void
setValue(S
tring valu
e) {
|
|
256 |
|
pu
blic void
setValue(S
tring valu
e) {
|
|
|
|
|
254 |
|
this.val
ue = value
;
|
|
257 |
|
this.val
ue = value
;
|
|
|
|
|
255 |
|
}
|
|
258 |
|
}
|
|
|
|
|
256 |
|
}
|
|
259 |
|
}
|
|
|
|
|
257 |
|
}
|
|
260 |
|
}
|