+ private class ProviderSessionImpl extends ConsumerSessionImpl implements\r
+ ProviderSession {\r
+\r
+ private Provider provider;\r
+ private Map<QName, RpcImplementation> sessionRpcImpls = Collections.synchronizedMap(new HashMap<QName, RpcImplementation>());\r
+\r
+ public ProviderSessionImpl(Provider provider) {\r
+ super(null);\r
+ this.provider = provider;\r
+ }\r
+\r
+ @Override\r
+ public void addRpcImplementation(QName rpcType,\r
+ RpcImplementation implementation)\r
+ throws IllegalArgumentException {\r
+ if (rpcType == null) {\r
+ throw new IllegalArgumentException("rpcType must not be null");\r
+ }\r
+ if (implementation == null) {\r
+ throw new IllegalArgumentException(\r
+ "Implementation must not be null");\r
+ }\r
+ BrokerImpl.this.addRpcImplementation(rpcType, implementation);\r
+ sessionRpcImpls.put(rpcType, implementation);\r
+ }\r
+\r
+ @Override\r
+ public void removeRpcImplementation(QName rpcType,\r
+ RpcImplementation implToRemove) throws IllegalArgumentException {\r
+ RpcImplementation localImpl = rpcImpls.get(rpcType);\r
+ if (localImpl != implToRemove) {\r
+ throw new IllegalStateException(\r
+ "Implementation was not registered in this session");\r
+ }\r
+\r
+ BrokerImpl.this.removeRpcImplementation(rpcType, implToRemove);\r
+ sessionRpcImpls.remove(rpcType);\r
+ }\r
+\r
+ public Provider getProvider() {\r
+ return this.provider;\r
+ }\r
+\r
+ }\r