/
pinmanager.xml
195 lines (169 loc) · 9.17 KB
/
pinmanager.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config/>
<bean id="properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<description>Imported configuration data</description>
<property name="location" value="arguments:"/>
</bean>
<bean id="message-thread-pool"
class="java.util.concurrent.ThreadPoolExecutor"
destroy-method="shutdown">
<description>Thread pool for message processing</description>
<constructor-arg value="${pinmanager.cell.threads.min}"/>
<constructor-arg value="${pinmanager.cell.threads.max}"/>
<constructor-arg value="${pinmanager.cell.threads.max-idle-time}"/>
<constructor-arg value="${pinmanager.cell.threads.max-idle-time.unit}"/>
<constructor-arg>
<bean class="java.util.concurrent.ArrayBlockingQueue">
<constructor-arg value="${pinmanager.cell.queue.max}"/>
</bean>
</constructor-arg>
</bean>
<bean id="scheduled-executor"
class="java.util.concurrent.Executors"
factory-method="newScheduledThreadPool"
destroy-method="shutdown">
<description>Task scheduler</description>
<constructor-arg value="2"/>
</bean>
<bean id="pnfs-stub" class="org.dcache.cells.CellStub">
<description>PNFS manager communication stub</description>
<property name="destination" value="${pinmanager.service.pnfsmanager}"/>
<property name="timeout" value="${pinmanager.service.pnfsmanager.timeout}"/>
<property name="timeoutUnit" value="${pinmanager.service.pnfsmanager.timeout.unit}"/>
</bean>
<bean id="pool-manager-stub" class="org.dcache.cells.CellStub">
<description>Pool manager communication stub</description>
<property name="destination" value="${pinmanager.service.poolmanager}"/>
<property name="timeout" value="${pinmanager.service.poolmanager.timeout}"/>
<property name="timeoutUnit" value="${pinmanager.service.poolmanager.timeout.unit}"/>
</bean>
<bean id="pool-stub" class="org.dcache.cells.CellStub">
<description>Pool communication stub</description>
<property name="timeout" value="${pinmanager.service.pool.timeout}"/>
<property name="timeoutUnit" value="${pinmanager.service.pool.timeout.unit}"/>
</bean>
<bean id="pool-monitor" class="org.dcache.poolmanager.RemotePoolMonitorFactoryBean" init-method="init">
<description>Maintains runtime information about all pools</description>
<property name="poolManagerStub" ref="pool-manager-stub"/>
<property name="executor" ref="scheduled-executor"/>
</bean>
<bean id="pinmanager" class="org.dcache.pinmanager.PinManager"
init-method="init">
<property name="expirationPeriod" value="${pinmanager.expiration-period}"/>
<property name="expirationPeriodUnit" value="${pinmanager.expiration-period.unit}"/>
<property name="poolStub" ref="pool-stub"/>
<property name="dao" ref="dao"/>
<property name="executor" ref="scheduled-executor"/>
<property name="poolMonitor" ref="pool-monitor"/>
</bean>
<bean id="pin-processor" class="org.dcache.pinmanager.PinRequestProcessor">
<description>Processes pin requests</description>
<property name="poolManagerStub" ref="pool-manager-stub"/>
<property name="poolStub" ref="pool-stub"/>
<property name="pnfsStub" ref="pnfs-stub"/>
<property name="dao" ref="dao"/>
<property name="executor" ref="scheduled-executor"/>
<property name="stagePermission" ref="stage-permission"/>
<property name="maxLifetime" value="${pinmanager.limits.pin-duration}"/>
<property name="maxLifetimeUnit" value="${pinmanager.limits.pin-duration.unit}"/>
<property name="poolMonitor" ref="pool-monitor"/>
</bean>
<bean id="unpin-processor" class="org.dcache.pinmanager.UnpinRequestProcessor">
<description>Processes unpin requests</description>
<property name="dao" ref="dao"/>
<property name="authorizationPolicy" ref="pdp"/>
</bean>
<bean id="move-pin-processor" class="org.dcache.pinmanager.MovePinRequestProcessor">
<description>Processes pin extension requests</description>
<property name="dao" ref="dao"/>
<property name="poolStub" ref="pool-stub"/>
<property name="authorizationPolicy" ref="pdp"/>
<property name="maxLifetime" value="${pinmanager.limits.pin-duration}"/>
<property name="maxLifetimeUnit" value="${pinmanager.limits.pin-duration.unit}"/>
<property name="poolMonitor" ref="pool-monitor"/>
</bean>
<bean id="pinmanager-cli" class="org.dcache.pinmanager.PinManagerCLI">
<description>Command line interface</description>
<property name="pinManager" ref="pinmanager"/>
<property name="pnfsStub" ref="pnfs-stub"/>
<property name="dao" ref="dao"/>
<property name="pinProcessor" ref="pin-processor"/>
<property name="unpinProcessor" ref="unpin-processor"/>
<property name="moveProcessor" ref="move-pin-processor"/>
</bean>
<bean id="pdp" class="org.dcache.pinmanager.DefaultAuthorizationPolicy">
<description>Makes authorization decisions</description>
</bean>
<bean id="stage-permission" class="diskCacheV111.util.CheckStagePermission">
<description>Stage permission checker</description>
<constructor-arg value="${pinmanager.authz.staging}"/>
</bean>
<!-- DATABASE BEANS
-->
<bean id="liquibase" class="org.dcache.util.SpringLiquibase">
<description>Database schema manager</description>
<property name="dataSource">
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${pinmanager.db.driver}"/>
<property name="url" value="${pinmanager.db.url}"/>
<property name="username" value="${pinmanager.db.user}"/>
<property name="password" value="#{ T(diskCacheV111.util.Pgpass).getPassword('${pinmanager.db.password.file}', '${pinmanager.db.url}', '${pinmanager.db.user}', '${pinmanager.db.password}') }"/>
</bean>
</property>
<property name="changeLog" value="classpath:${pinmanager.db.schema.changelog}"/>
<property name="shouldUpdate" value="${pinmanager.db.schema.auto}"/>
</bean>
<bean id="pmf"
class="org.springframework.orm.jdo.LocalPersistenceManagerFactoryBean"
depends-on="liquibase">
<description>JDO connection</description>
<property name="jdoProperties">
<props>
<prop key="javax.jdo.PersistenceManagerFactoryClass">
org.datanucleus.api.jdo.JDOPersistenceManagerFactory</prop>
<prop key="javax.jdo.option.ConnectionURL">${pinmanager.db.url}</prop>
<prop key="javax.jdo.option.ConnectionUserName">${pinmanager.db.user}</prop>
<prop key="javax.jdo.option.ConnectionPassword">#{ T(diskCacheV111.util.Pgpass).getPassword('${pinmanager.db.password.file}', '${pinmanager.db.url}', '${pinmanager.db.user}', '${pinmanager.db.password}') }</prop>
<prop key="javax.jdo.option.ConnectionDriverName">${pinmanager.db.driver}</prop>
<prop key="datanucleus.PersistenceUnitName">PinManager</prop>
<prop key="datanucleus.connectionPoolingType">BoneCP</prop>
<!-- BoneCP setMaxConnectionsPerPartition: maximum number of
connections (per partition) -->
<prop key="datanucleus.connectionPool.maxPoolSize">${pinmanager.db.connections.max-per-partition}</prop>
<!-- BoneCP setMinConnectionsPerPartition: the minimum number of
connections that will be contained in every partition -->
<prop key="datanucleus.connectionPool.minPoolSize">${pinmanager.db.connections.max-per-partition}</prop>
<!-- BoneCP setStatementsCacheSize: the number of statements to
cache -->
<prop key="datanucleus.connectionPool.maxStatements">100</prop>
<prop key="datanucleus.cache.level2.type">none</prop>
</props>
</property>
</bean>
<bean id="tx-manager" class="org.springframework.orm.jdo.JdoTransactionManager">
<description>JDO transaction manager</description>
<property name="persistenceManagerFactory" ref="pmf"/>
<property name="jdoDialect">
<bean class="org.dcache.util.Jdo3Dialect"/>
</property>
</bean>
<bean id="pmf-proxy"
class="org.springframework.orm.jdo.TransactionAwarePersistenceManagerFactoryProxy">
<description>Transaction aware JDO connection</description>
<property name="targetPersistenceManagerFactory" ref="pmf"/>
<property name="allowCreate" value="false"/>
</bean>
<bean id="dao" class="org.dcache.pinmanager.JdoDao">
<description>Data access object</description>
<property name="persistenceManagerFactory" ref="pmf-proxy"/>
</bean>
<bean class="org.dcache.util.aspects.PerInstanceAnnotationTransactionBeanPostProcessor">
<property name="transactionManager" ref="tx-manager"/>
</bean>
</beans>