1 | /** |
2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
3 | * contributor license agreements. See the NOTICE file |
4 | * distributed with this work for additional information |
5 | * regarding copyright ownership. jclouds licenses this file |
6 | * to you under the Apache License, Version 2.0 (the |
7 | * "License"); you may not use this file except in compliance |
8 | * with the License. You may obtain a copy of the License at |
9 | * |
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | * |
12 | * Unless required by applicable law or agreed to in writing, |
13 | * software distributed under the License is distributed on an |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
15 | * KIND, either express or implied. See the License for the |
16 | * specific language governing permissions and limitations |
17 | * under the License. |
18 | */ |
19 | package org.jclouds.compute.internal; |
20 | |
21 | import java.util.concurrent.ExecutorService; |
22 | |
23 | import javax.inject.Named; |
24 | import javax.inject.Singleton; |
25 | |
26 | import org.jclouds.Constants; |
27 | import org.jclouds.compute.Utils; |
28 | import org.jclouds.compute.domain.NodeMetadata; |
29 | import org.jclouds.crypto.Crypto; |
30 | import org.jclouds.date.DateService; |
31 | import org.jclouds.json.Json; |
32 | import org.jclouds.logging.Logger.LoggerFactory; |
33 | import org.jclouds.rest.HttpAsyncClient; |
34 | import org.jclouds.rest.HttpClient; |
35 | import org.jclouds.ssh.SshClient; |
36 | import org.jclouds.ssh.SshClient.Factory; |
37 | |
38 | import com.google.common.base.Function; |
39 | import com.google.inject.Inject; |
40 | |
41 | /** |
42 | * |
43 | * @author Adrian Cole |
44 | */ |
45 | @Singleton |
46 | public class UtilsImpl extends org.jclouds.rest.internal.UtilsImpl implements Utils { |
47 | @Inject(optional = true) |
48 | private Factory sshFactory; |
49 | private final Function<NodeMetadata, SshClient> sshForNode; |
50 | |
51 | @Inject |
52 | UtilsImpl(Json json, HttpClient simpleClient, HttpAsyncClient simpleAsyncClient, Crypto encryption, |
53 | DateService date, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService userThreads, |
54 | @Named(Constants.PROPERTY_IO_WORKER_THREADS) ExecutorService ioThreads, LoggerFactory loggerFactory, |
55 | Function<NodeMetadata, SshClient> sshForNode) { |
56 | super(json, simpleClient, simpleAsyncClient, encryption, date, userThreads, ioThreads, loggerFactory); |
57 | this.sshForNode = sshForNode; |
58 | } |
59 | |
60 | @Override |
61 | public Factory getSshClientFactory() { |
62 | return sshFactory; |
63 | } |
64 | |
65 | @Override |
66 | public Factory sshFactory() { |
67 | return sshFactory; |
68 | } |
69 | |
70 | @Override |
71 | public Function<NodeMetadata, SshClient> sshForNode() { |
72 | return sshForNode; |
73 | } |
74 | |
75 | } |