Skip to content

Commit 18e95b4

Browse files
author
a-brandt
committed
removed unused code and comments
1 parent e8fd1f8 commit 18e95b4

File tree

6 files changed

+119
-221
lines changed

6 files changed

+119
-221
lines changed

src/main/java/com/arangodb/http/HttpManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ private HttpResponseEntity executeInternal(String baseUrl, HttpRequestEntity req
526526

527527
return responseEntity;
528528
} catch (SocketException ex) {
529+
// catch SocketException before IOException
529530
throw ex;
530531
} catch (ClientProtocolException e) {
531532
throw new ArangoException(e);

src/main/java/com/arangodb/impl/InternalAdminDriverImpl.java

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -67,71 +67,58 @@ public AdminLogEntity getServerLog(
6767
}
6868
param.put("search", text);
6969

70-
// 実行
7170
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(null, "/_admin/log"), param.get());
7271

73-
// 結果変換
74-
try {
75-
AdminLogEntity entity = createEntity(res, AdminLogEntity.class);
76-
return entity;
77-
} catch (ArangoException e) {
78-
throw e;
79-
// return null;
80-
}
81-
72+
return createEntity(res, AdminLogEntity.class);
8273
}
8374

8475
@Override
8576
public StatisticsEntity getStatistics() throws ArangoException {
8677

8778
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(null, "/_admin/statistics"));
8879

89-
try {
90-
return createEntity(res, StatisticsEntity.class);
91-
} catch (ArangoException e) {
92-
throw e;
93-
}
94-
80+
return createEntity(res, StatisticsEntity.class);
9581
}
9682

9783
@Override
9884
public StatisticsDescriptionEntity getStatisticsDescription() throws ArangoException {
9985

10086
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(null, "/_admin/statistics-description"));
10187

102-
try {
103-
return createEntity(res, StatisticsDescriptionEntity.class);
104-
} catch (ArangoException e) {
105-
throw e;
106-
}
107-
88+
return createEntity(res, StatisticsDescriptionEntity.class);
10889
}
10990

11091
/**
11192
* Returns the ArangoDB version
11293
*
11394
* @return a ArangoVersion object
11495
* @throws ArangoException
115-
* @see <a
116-
* href="http://www.arangodb.com/manuals/current/HttpMisc.html#HttpMiscVersion">HttpMiscVersion
117-
* documentation</a>
96+
* @see <a href=
97+
* "http://www.arangodb.com/manuals/current/HttpMisc.html#HttpMiscVersion">
98+
* HttpMiscVersion documentation</a>
11899
*/
119100
@Override
120101
public ArangoVersion getVersion() throws ArangoException {
102+
121103
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(null, "/_api/version"));
104+
122105
return createEntity(res, ArangoVersion.class);
123106
}
124107

125108
@Override
126109
public ArangoUnixTime getTime() throws ArangoException {
110+
127111
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(null, "/_admin/time"));
112+
128113
return createEntity(res, ArangoUnixTime.class);
129114
}
130115

131116
@Override
132117
public DefaultEntity reloadRouting() throws ArangoException {
118+
133119
HttpResponseEntity res = httpManager.doPost(createEndpointUrl(null, "/_admin/routing/reload"), null,
134120
(String) null);
121+
135122
return createEntity(res, DefaultEntity.class, null, false);
136123
}
137124

@@ -141,7 +128,6 @@ public DefaultEntity executeScript(String database, String jsCode) throws Arango
141128
HttpResponseEntity res = httpManager.doPost(createEndpointUrl(database, "/_admin/execute"), null, jsCode);
142129

143130
return createEntity(res, DefaultEntity.class);
144-
145131
}
146132

147133
}

src/main/java/com/arangodb/impl/InternalCollectionDriverImpl.java

Lines changed: 46 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
* @author tamtam180 - kirscheless at gmail.com
3131
*
3232
*/
33-
public class InternalCollectionDriverImpl extends BaseArangoDriverImpl implements com.arangodb.InternalCollectionDriver {
33+
public class InternalCollectionDriverImpl extends BaseArangoDriverImpl
34+
implements com.arangodb.InternalCollectionDriver {
3435

3536
InternalCollectionDriverImpl(ArangoConfigure configure, HttpManager httpManager) {
3637
super(configure, httpManager);
@@ -42,20 +43,19 @@ public CollectionEntity createCollection(String database, String name, Collectio
4243
if (collectionOptions == null) {
4344
collectionOptions = new CollectionOptions();
4445
}
45-
HttpResponseEntity res = httpManager.doPost(
46-
createEndpointUrl(database, "/_api/collection"),
47-
null,
48-
EntityFactory.toJsonString(new MapBuilder().put("name", name)
49-
.put("waitForSync", collectionOptions.getWaitForSync())
50-
.put("doCompact", collectionOptions.getDoCompact())
51-
.put("journalSize", collectionOptions.getJournalSize())
52-
.put("isSystem", collectionOptions.getIsSystem())
53-
.put("isVolatile", collectionOptions.getIsVolatile())
54-
.put("keyOptions", collectionOptions.getKeyOptions())
55-
.put("numberOfShards", collectionOptions.getNumberOfShards())
56-
.put("shardKeys", collectionOptions.getShardKeys())
57-
.put("type", collectionOptions.getType() == null ? null : collectionOptions.getType().getType())
58-
.get()));
46+
HttpResponseEntity res = httpManager
47+
.doPost(createEndpointUrl(database, "/_api/collection"), null, EntityFactory
48+
.toJsonString(
49+
new MapBuilder().put("name", name).put("waitForSync", collectionOptions.getWaitForSync())
50+
.put("doCompact", collectionOptions.getDoCompact())
51+
.put("journalSize", collectionOptions.getJournalSize())
52+
.put("isSystem", collectionOptions.getIsSystem())
53+
.put("isVolatile", collectionOptions.getIsVolatile())
54+
.put("keyOptions", collectionOptions.getKeyOptions())
55+
.put("numberOfShards", collectionOptions.getNumberOfShards()).put("shardKeys",
56+
collectionOptions.getShardKeys())
57+
.put("type", collectionOptions.getType() == null ? null : collectionOptions.getType().getType())
58+
.get()));
5959

6060
return createEntity(res, CollectionEntity.class);
6161

@@ -64,64 +64,54 @@ public CollectionEntity createCollection(String database, String name, Collectio
6464
@Override
6565
public CollectionEntity getCollection(String database, String name) throws ArangoException {
6666
validateCollectionName(name);
67+
6768
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(database, "/_api/collection", name), null);
68-
try {
69-
return createEntity(res, CollectionEntity.class);
70-
} catch (ArangoException e) {
71-
throw e;
72-
}
69+
70+
return createEntity(res, CollectionEntity.class);
7371
}
7472

7573
@Override
7674
public CollectionEntity getCollectionRevision(String database, String name) throws ArangoException {
75+
7776
validateCollectionName(name);
77+
7878
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(database, "/_api/collection", name, "/revision"),
7979
null);
80-
try {
81-
return createEntity(res, CollectionEntity.class);
82-
} catch (ArangoException e) {
83-
throw e;
84-
}
80+
81+
return createEntity(res, CollectionEntity.class);
8582
}
8683

8784
@Override
8885
public CollectionEntity getCollectionProperties(String database, String name) throws ArangoException {
86+
8987
validateCollectionName(name);
90-
HttpResponseEntity res = httpManager.doGet(
91-
createEndpointUrl(database, "/_api/collection", name, "/properties"), null);
92-
try {
93-
return createEntity(res, CollectionEntity.class);
94-
} catch (ArangoException e) {
95-
throw e;
96-
}
88+
89+
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(database, "/_api/collection", name, "/properties"),
90+
null);
91+
92+
return createEntity(res, CollectionEntity.class);
9793
}
9894

9995
@Override
10096
public CollectionEntity getCollectionCount(String database, String name) throws ArangoException {
97+
10198
validateCollectionName(name);
99+
102100
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(database, "/_api/collection", name, "/count"),
103101
null);
104-
try {
105-
return createEntity(res, CollectionEntity.class);
106-
} catch (ArangoException e) {
107-
throw e;
108-
}
109102

103+
return createEntity(res, CollectionEntity.class);
110104
}
111105

112106
@Override
113107
public CollectionEntity getCollectionFigures(String database, String name) throws ArangoException {
114108

115109
validateCollectionName(name);
110+
116111
HttpResponseEntity res = httpManager.doGet(createEndpointUrl(database, "/_api/collection", name, "/figures"),
117112
null);
118113

119-
try {
120-
return createEntity(res, CollectionEntity.class);
121-
} catch (ArangoException e) {
122-
throw e;
123-
}
124-
114+
return createEntity(res, CollectionEntity.class);
125115
}
126116

127117
@Override
@@ -150,8 +140,8 @@ public CollectionsEntity getCollections(String database, Boolean excludeSystem)
150140
public CollectionEntity loadCollection(String database, String name, Boolean count) throws ArangoException {
151141

152142
validateCollectionName(name);
153-
HttpResponseEntity res = httpManager.doPut(createEndpointUrl(database, "/_api/collection", name, "/load"),
154-
null, EntityFactory.toJsonString(new MapBuilder("count", count).get()));
143+
HttpResponseEntity res = httpManager.doPut(createEndpointUrl(database, "/_api/collection", name, "/load"), null,
144+
EntityFactory.toJsonString(new MapBuilder("count", count).get()));
155145

156146
return createEntity(res, CollectionEntity.class);
157147

@@ -161,30 +151,22 @@ public CollectionEntity loadCollection(String database, String name, Boolean cou
161151
public CollectionEntity unloadCollection(String database, String name) throws ArangoException {
162152

163153
validateCollectionName(name);
154+
164155
HttpResponseEntity res = httpManager.doPut(createEndpointUrl(database, "/_api/collection/", name, "/unload"),
165156
null, null);
166157

167-
try {
168-
return createEntity(res, CollectionEntity.class);
169-
} catch (ArangoException e) {
170-
throw e;
171-
}
172-
158+
return createEntity(res, CollectionEntity.class);
173159
}
174160

175161
@Override
176162
public CollectionEntity truncateCollection(String database, String name) throws ArangoException {
177163

178164
validateCollectionName(name);
165+
179166
HttpResponseEntity res = httpManager.doPut(createEndpointUrl(database, "/_api/collection", name, "/truncate"),
180167
null, null);
181168

182-
try {
183-
return createEntity(res, CollectionEntity.class);
184-
} catch (ArangoException e) {
185-
throw e;
186-
}
187-
169+
return createEntity(res, CollectionEntity.class);
188170
}
189171

190172
@Override
@@ -195,43 +177,32 @@ public CollectionEntity setCollectionProperties(
195177
Long journalSize) throws ArangoException {
196178

197179
validateCollectionName(name);
198-
HttpResponseEntity res = httpManager.doPut(
199-
createEndpointUrl(database, "/_api/collection", name, "/properties"),
200-
null,
201-
EntityFactory.toJsonString(new MapBuilder().put("waitForSync", newWaitForSync)
202-
.put("journalSize", journalSize).get()));
180+
HttpResponseEntity res = httpManager.doPut(createEndpointUrl(database, "/_api/collection", name, "/properties"),
181+
null, EntityFactory.toJsonString(
182+
new MapBuilder().put("waitForSync", newWaitForSync).put("journalSize", journalSize).get()));
203183

204184
return createEntity(res, CollectionEntity.class);
205-
206185
}
207186

208187
@Override
209188
public CollectionEntity renameCollection(String database, String name, String newName) throws ArangoException {
210189

211190
validateCollectionName(newName);
191+
212192
HttpResponseEntity res = httpManager.doPut(createEndpointUrl(database, "/_api/collection", name, "/rename"),
213193
null, EntityFactory.toJsonString(new MapBuilder("name", newName).get()));
214194

215-
try {
216-
return createEntity(res, CollectionEntity.class);
217-
} catch (ArangoException e) {
218-
throw e;
219-
}
220-
195+
return createEntity(res, CollectionEntity.class);
221196
}
222197

223198
@Override
224199
public CollectionEntity deleteCollection(String database, String name) throws ArangoException {
225200

226201
validateCollectionName(name);
227-
HttpResponseEntity res = httpManager.doDelete(createEndpointUrl(database, "/_api/collection", name), null);
228202

229-
try {
230-
return createEntity(res, CollectionEntity.class);
231-
} catch (ArangoException e) {
232-
throw e;
233-
}
203+
HttpResponseEntity res = httpManager.doDelete(createEndpointUrl(database, "/_api/collection", name), null);
234204

205+
return createEntity(res, CollectionEntity.class);
235206
}
236207

237208
}

src/main/java/com/arangodb/impl/InternalDocumentDriverImpl.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,8 @@ public DocumentEntity<?> deleteDocument(String database, String documentHandle,
245245
new MapBuilder().put("rev", rev).put("policy", policy == null ? null : policy.name().toLowerCase(Locale.US))
246246
.get());
247247

248-
try {
249-
DocumentEntity<?> entity = createEntity(res, DocumentEntity.class);
250-
return entity;
251-
} catch (ArangoException e) {
252-
throw e;
253-
}
254-
248+
DocumentEntity<?> entity = createEntity(res, DocumentEntity.class);
249+
return entity;
255250
}
256251

257252
}

0 commit comments

Comments
 (0)