Skip to content

Commit b6ba3c0

Browse files
committed
more formatting changes
1 parent c11d702 commit b6ba3c0

24 files changed

Lines changed: 3113 additions & 2846 deletions

‎agent/src/com/cloud/agent/AgentShell.java‎

Lines changed: 581 additions & 541 deletions
Large diffs are not rendered by default.

‎agent/src/com/cloud/agent/IAgentShell.java‎

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,43 @@
1616
*
1717
*/
1818

19-
package com.cloud.agent;
20-
19+
package com.cloud.agent;
20+
2121
import java.util.Map;
2222
import java.util.Properties;
2323

2424
import com.cloud.utils.backoff.BackoffAlgorithm;
25-
26-
public interface IAgentShell {
27-
public Map<String, Object> getCmdLineProperties();
28-
public Properties getProperties();
29-
public String getPersistentProperty(String prefix, String name);
30-
public void setPersistentProperty(String prefix, String name, String value);
31-
32-
public String getHost();
33-
public String getPrivateIp();
34-
public int getPort();
35-
public int getWorkers();
36-
public int getProxyPort();
37-
public String getGuid();
38-
public String getZone();
39-
public String getPod();
40-
41-
public BackoffAlgorithm getBackoffAlgorithm();
42-
public int getPingRetries();
43-
44-
public void upgradeAgent(final String url);
45-
public String getVersion();
46-
}
25+
26+
public interface IAgentShell {
27+
public Map<String, Object> getCmdLineProperties();
28+
29+
public Properties getProperties();
30+
31+
public String getPersistentProperty(String prefix, String name);
32+
33+
public void setPersistentProperty(String prefix, String name, String value);
34+
35+
public String getHost();
36+
37+
public String getPrivateIp();
38+
39+
public int getPort();
40+
41+
public int getWorkers();
42+
43+
public int getProxyPort();
44+
45+
public String getGuid();
46+
47+
public String getZone();
48+
49+
public String getPod();
50+
51+
public BackoffAlgorithm getBackoffAlgorithm();
52+
53+
public int getPingRetries();
54+
55+
public void upgradeAgent(final String url);
56+
57+
public String getVersion();
58+
}

‎agent/src/com/cloud/agent/configuration/AgentComponentLibraryBase.java‎

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -28,52 +28,51 @@
2828
import com.cloud.utils.component.PluggableService;
2929
import com.cloud.utils.db.GenericDao;
3030

31-
3231
public class AgentComponentLibraryBase extends ComponentLibraryBase {
33-
@Override
34-
public Map<String, ComponentInfo<GenericDao<?, ?>>> getDaos() {
35-
return null;
36-
}
32+
@Override
33+
public Map<String, ComponentInfo<GenericDao<?, ?>>> getDaos() {
34+
return null;
35+
}
3736

38-
@Override
39-
public Map<String, ComponentInfo<Manager>> getManagers() {
40-
if (_managers.size() == 0) {
41-
populateManagers();
42-
}
43-
return _managers;
44-
}
37+
@Override
38+
public Map<String, ComponentInfo<Manager>> getManagers() {
39+
if (_managers.size() == 0) {
40+
populateManagers();
41+
}
42+
return _managers;
43+
}
4544

46-
@Override
47-
public Map<String, List<ComponentInfo<Adapter>>> getAdapters() {
48-
if (_adapters.size() == 0) {
49-
populateAdapters();
50-
}
51-
return _adapters;
52-
}
45+
@Override
46+
public Map<String, List<ComponentInfo<Adapter>>> getAdapters() {
47+
if (_adapters.size() == 0) {
48+
populateAdapters();
49+
}
50+
return _adapters;
51+
}
5352

54-
@Override
55-
public Map<Class<?>, Class<?>> getFactories() {
56-
return null;
57-
}
53+
@Override
54+
public Map<Class<?>, Class<?>> getFactories() {
55+
return null;
56+
}
5857

59-
protected void populateManagers() {
60-
//addManager("StackMaidManager", StackMaidManagerImpl.class);
61-
}
58+
protected void populateManagers() {
59+
// addManager("StackMaidManager", StackMaidManagerImpl.class);
60+
}
6261

63-
protected void populateAdapters() {
62+
protected void populateAdapters() {
6463

65-
}
64+
}
6665

67-
protected void populateServices() {
66+
protected void populateServices() {
6867

69-
}
68+
}
7069

71-
@Override
72-
public Map<String, ComponentInfo<PluggableService>> getPluggableServices() {
73-
if (_pluggableServices.size() == 0) {
74-
populateServices();
75-
}
76-
return _pluggableServices;
77-
}
70+
@Override
71+
public Map<String, ComponentInfo<PluggableService>> getPluggableServices() {
72+
if (_pluggableServices.size() == 0) {
73+
populateServices();
74+
}
75+
return _pluggableServices;
76+
}
7877

7978
}

‎agent/src/com/cloud/agent/dao/StorageComponent.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020

2121
import com.cloud.utils.component.Manager;
2222

23-
2423
/**
2524
* StorageDao is an abstraction layer for what the agent will use for storage.
26-
*
25+
*
2726
*/
2827
public interface StorageComponent extends Manager {
29-
String get(String key);
30-
void persist(String key, String value);
28+
String get(String key);
29+
30+
void persist(String key, String value);
3131
}

‎agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java‎

Lines changed: 82 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -34,98 +34,98 @@
3434

3535
/**
3636
* Uses Properties to implement storage.
37-
*
38-
* @config
39-
* {@table
40-
* || Param Name | Description | Values | Default ||
41-
* || path | path to the properties _file | String | db/db.properties ||
42-
* }
37+
*
38+
* @config {@table || Param Name | Description | Values | Default || || path |
39+
* path to the properties _file | String | db/db.properties || * }
4340
**/
44-
@Local(value={StorageComponent.class})
41+
@Local(value = { StorageComponent.class })
4542
public class PropertiesStorage implements StorageComponent {
46-
private static final Logger s_logger = Logger.getLogger(PropertiesStorage.class);
47-
Properties _properties = new Properties();
48-
File _file;
49-
String _name;
43+
private static final Logger s_logger = Logger
44+
.getLogger(PropertiesStorage.class);
45+
Properties _properties = new Properties();
46+
File _file;
47+
String _name;
5048

51-
@Override
52-
public synchronized String get(String key) {
53-
return _properties.getProperty(key);
54-
}
49+
@Override
50+
public synchronized String get(String key) {
51+
return _properties.getProperty(key);
52+
}
5553

56-
@Override
57-
public synchronized void persist(String key, String value) {
58-
_properties.setProperty(key, value);
59-
FileOutputStream output = null;
60-
try {
61-
output = new FileOutputStream(_file);
62-
_properties.store(output, _name);
63-
output.flush();
64-
output.close();
65-
} catch (FileNotFoundException e) {
66-
s_logger.error("Who deleted the file? ", e);
67-
} catch (IOException e) {
68-
s_logger.error("Uh-oh: ", e);
69-
} finally {
70-
if (output != null) {
71-
try {
72-
output.close();
73-
} catch (IOException e) {
74-
//ignore.
75-
}
76-
}
77-
}
78-
}
54+
@Override
55+
public synchronized void persist(String key, String value) {
56+
_properties.setProperty(key, value);
57+
FileOutputStream output = null;
58+
try {
59+
output = new FileOutputStream(_file);
60+
_properties.store(output, _name);
61+
output.flush();
62+
output.close();
63+
} catch (FileNotFoundException e) {
64+
s_logger.error("Who deleted the file? ", e);
65+
} catch (IOException e) {
66+
s_logger.error("Uh-oh: ", e);
67+
} finally {
68+
if (output != null) {
69+
try {
70+
output.close();
71+
} catch (IOException e) {
72+
// ignore.
73+
}
74+
}
75+
}
76+
}
7977

80-
@Override
81-
public boolean configure(String name, Map<String, Object> params) {
82-
_name = name;
83-
String path = (String)params.get("path");
84-
if (path == null) {
85-
path = "agent.properties";
86-
}
78+
@Override
79+
public boolean configure(String name, Map<String, Object> params) {
80+
_name = name;
81+
String path = (String) params.get("path");
82+
if (path == null) {
83+
path = "agent.properties";
84+
}
8785

88-
File file = PropertiesUtil.findConfigFile(path);
89-
if (file == null) {
90-
file = new File(path);
91-
try {
92-
if (!file.createNewFile()) {
93-
s_logger.error("Unable to create _file: " + file.getAbsolutePath());
94-
return false;
95-
}
96-
} catch (IOException e) {
97-
s_logger.error("Unable to create _file: " + file.getAbsolutePath(), e);
98-
return false;
99-
}
100-
}
86+
File file = PropertiesUtil.findConfigFile(path);
87+
if (file == null) {
88+
file = new File(path);
89+
try {
90+
if (!file.createNewFile()) {
91+
s_logger.error("Unable to create _file: "
92+
+ file.getAbsolutePath());
93+
return false;
94+
}
95+
} catch (IOException e) {
96+
s_logger.error(
97+
"Unable to create _file: " + file.getAbsolutePath(), e);
98+
return false;
99+
}
100+
}
101101

102-
try {
103-
_properties.load(new FileInputStream(file));
104-
_file = file;
105-
} catch (FileNotFoundException e) {
106-
s_logger.error("How did we get here? ", e);
107-
return false;
108-
} catch (IOException e) {
109-
s_logger.error("IOException: ", e);
110-
return false;
111-
}
102+
try {
103+
_properties.load(new FileInputStream(file));
104+
_file = file;
105+
} catch (FileNotFoundException e) {
106+
s_logger.error("How did we get here? ", e);
107+
return false;
108+
} catch (IOException e) {
109+
s_logger.error("IOException: ", e);
110+
return false;
111+
}
112112

113-
return true;
114-
}
113+
return true;
114+
}
115115

116-
@Override
117-
public String getName() {
118-
return _name;
119-
}
116+
@Override
117+
public String getName() {
118+
return _name;
119+
}
120120

121-
@Override
122-
public boolean start() {
123-
return true;
124-
}
121+
@Override
122+
public boolean start() {
123+
return true;
124+
}
125125

126-
@Override
127-
public boolean stop() {
128-
return true;
129-
}
126+
@Override
127+
public boolean stop() {
128+
return true;
129+
}
130130

131131
}

0 commit comments

Comments
 (0)